Пример #1
0
 char * grabBracketed(char front,char back) {
   bool save = d_skipws;
   d_skipws = false;
   char c;
   getCharacter(c);
   if(c!=front) {
     GBStream << "Got:" << c << " and not " << front << '\n';
     errorh(__LINE__);
   };
   vector<char> vec;
   int nest = 1;
   while(nest>0)  {
     getCharacter(c);
     if(c==front) {
       ++nest;
     } else if(c==back) {
       --nest;
     };
     if(nest!=0) vec.push_back(c);
     if(nest<0) errorh(__LINE__);
   };
   if(c!=back) {
     GBStream << "Got:" << c << " and not " << front << '\n';
     errorh(__LINE__);
   };
   int sz = vec.size();
   char * result = new char[sz+1];
   copy(vec.begin(),vec.end(),result);
   result[sz] = '\0';
   d_skipws = save;
   return result;
 };
Пример #2
0
static void string(void)
{
  register int16_t count = 0;         /* # chars in string */

  token = tSTRING_CONST;             /* indicate string constant type */
  getCharacter();                    /* skip over 1st single quote */

  while (inChar != SQUOTE)           /* loop until next single quote */
    {
      if (inChar == '\n')            /* check for EOL in string */
        {
          error(eNOSQUOTE);          /* ERROR, terminate string */
          break;
        } /* end if */
      else
        {
          *stringSP++ = inChar;      /* concatenate character */
          count++;                   /* bump count of chars */
        } /* end else */
      getCharacter();                /* get the next character */
    } /* end while */
  *stringSP++ = '\0';                /* terminate ASCIIZ string */

  getCharacter();                    /* skip over last single quote */
  if (count == 1)                    /* Check for char constant */
    {
      token = tCHAR_CONST;           /* indicate char constant type */
      tknInt = *tkn_strt;            /* (integer) value = single char */
      stringSP = tkn_strt;           /* "pop" from string stack */
    } /* end if */
} /* end string */
Пример #3
0
 void peekCharacter(char & c,const char * ignore) {
   getCharacter(c);
   while(!check(c,ignore)) {
     getCharacter(c);
   };
   d_useUnget = true;
   d_unget = c;
 };
Пример #4
0
void ControllableAction::activate()
{
	Action::activate();

	getCharacter()->clearKey();
	getCharacter()->setControllable( m_bControllable );
	
	// ControllableAction is 'very' instantaneous, so deactivate() is called
	// immediately after activate().
	deactivate();
}
Пример #5
0
cTexture *cAsciiFonts::buildTextWrapped(unsigned char font, const QCString &text, unsigned short maxWidth, unsigned short hue, bool shaded, enTextAlign align) {
	// Insert Newslines if the word would exceed the maxWidth boundary
	unsigned int lineLength = 0;
	QCString wrapped;
	unsigned int spaceWidth = 0;

	cSurface *sf = getCharacter(font, ' ');
	if (sf) {
		spaceWidth = sf->width();
	}

	// Split into words using the spaces
	QStringList parts = QStringList::split(" ", text.data());
	QStringList::const_iterator it;
	for (it = parts.begin(); it != parts.end(); ++it) {
		QString word = *it;
		bool first = (it == parts.begin());
		unsigned int wordWidth = 0;
		unsigned int i;
		for (i = 0; i < word.length(); ++i) {
			cSurface *sf = getCharacter(font, word.at(i).latin1());
			if (sf) {
				wordWidth += sf->width();
			}
		}

		if (!first) {
			wordWidth += spaceWidth;
		}

		// Check if the word still fits
		if (lineLength > 0 && lineLength + wordWidth > maxWidth) {
			wrapped += "\n";
			if (!first) {
				wordWidth -= spaceWidth; // We're not prepending the space anyway
			}
			lineLength = wordWidth;
		} else {
			if (!first) {
				wrapped += " ";				
			}
			lineLength += wordWidth;
		}

		wrapped += word.latin1();
	}

	return buildText(font, wrapped, hue, shaded, align);
}
Пример #6
0
int16_t rePrimeTokenizer(void)
{
  TRACE(lstFile,"[rePrimeTokenizer]");

  /* (Re-)set the char pointer to the beginning of the line */

  FP->cp = FP->buffer;

  /* Read the next line from the input stream */

  if (!fgets(FP->cp, LINE_SIZE, FP->stream))
    {
      /* EOF.. close file */

      return 1;
    }

  /* Initialize the line nubmer */

  FP->line = 1;

  /* Get the first character from the new file */

  getCharacter();
  return 0;
}
Пример #7
0
void TextField::handleQueuedEvent(std::shared_ptr<Events::Event> event) {
    if(event->getEventType() == Events::EventType::CHARACTER_TYPED) {
        auto casted_event = std::static_pointer_cast<Input::CharacterTypedEvent>(event);
        onCharacterTyped(casted_event->getCharacter());
    }
    TextArea::handleQueuedEvent(event);
}
Пример #8
0
static int
getDecimalInteger (BrailleDisplay *brl, unsigned int *integer, unsigned int width, const char *description) {
  char buffer[width + 1];
  memset(buffer, '0', width);
  buffer[width] = 0;
  for (;;) {
    wchar_t character;
    char prompt[0X40];
    snprintf(prompt, sizeof(prompt), "%s: %s", description, buffer);
    writePrompt(brl, prompt);
    switch ((character = getCharacter(brl))) {
      default:
        continue;
      case WC_C('\r'):
        *integer = atoi(buffer);
        return 1;
      case '\b':
        return 0;
      case WC_C('0'):
      case WC_C('1'):
      case WC_C('2'):
      case WC_C('3'):
      case WC_C('4'):
      case WC_C('5'):
      case WC_C('6'):
      case WC_C('7'):
      case WC_C('8'):
      case WC_C('9'):
        memmove(buffer, buffer+1, width-1);
        buffer[width-1] = character;
        break;
    }
  }
}
Пример #9
0
void ActorFactory::createChar(Encounter* parent, PFMapCharInstance& data)
{
   GameObject* temp = new GameObject(parent, data.pos);

   temp->addComponent(new ActorComponent(temp, data.id));
   temp->addComponent(new RenderComponent(temp, data.sprite.first, data.sprite.second));

   // Get a reference to the actor component of our new character
   auto actor = temp->getComponent<ActorComponent>(ComponentType::ACTOR);

   actor->getCharacter().getRawData().name = data.name;
   actor->setTeam(data.team);

   // Construct and equip all of the items that this character is supposed to have equipped
   for (auto &item : data.equipped)
   {
      auto itemInstance = PFWeaponBuilder().load( item.second.id )->build();
      actor->getInventory().equippedItems().equipItem(item.first, itemInstance);
   }

   // Construct and equip all of the items that this character is supposed to have equipped
   for (auto &item : data.backpack)
   {
      auto itemInstance = PFWeaponBuilder().load( item.id )->build();
      actor->getInventory().backpack().addItem( itemInstance );
   }

   parent->addGameObj(temp);
}
Пример #10
0
 simpleString getString(int & len,bool keep = true) {
   bool save = d_skipws;
   d_skipws = false;
   if(!d_word) {
     d_word = new char[1001];
   } else if(strlen(d_word)<1000) {
     delete d_word;
     d_word = new char[10001];
   };
   char * t = d_word;
   char c;
   getCharacter(c);
   if(c!='\"') errorh(__LINE__);
   if(keep) {
     *t=c;++t;++len;
   };
   peekCharacter(c);
   len  = 0;
   while(c!='\"') {
     passCharacter();
     *t = c;++t;++len;
     if(len>1000) errorh(__LINE__);
     peekCharacter(c);
   };
   if(keep) {
     *t=c;++t;++len;
   };
   passCharacter();
   *t = '\0';  
   simpleString result(d_word);
   d_skipws = save;
   return result;
 };
Пример #11
0
static void unsignedRealNumber(void)
{
  /* This logic (along with with unsignedNumber and unsignedExponent)
   * handles:
   *
   * FORM: real-number =
   *       digit-sequence '.' [digit-sequence] [ exponent scale-factor ] |
   *       '.' digit-sequence [ exponent scale-factor ] |
   *       digit-sequence exponent scale-factor
   * FORM: exponent = 'e' | 'E'
   *
   * When called:
   * - inChar is the character AFTER the '.'.
   * - Any leading digit-sequence is already in the character stack
   * - the '.' is not in the character stack.
   */

  /* Its a real constant */

  token = tREAL_CONST;

  /* Save the decimal point (inChar points to the character after
   * the decimal point).
   */

  *stringSP++ = '.';

  /* Now, loop to process the optional digit-sequence after the
   * decimal point.
   */

  while (isdigit(inChar))
    {
      *stringSP++ = inChar;
      getCharacter();
    }

  /* If it is a digit-sequence followed by 'e' (or 'E'), then
   * continue processing this token as a real number.
   */

  if ((inChar == 'e') || (inChar == 'E'))
    {
      unsignedExponent();
    }
  else
    {
      /* There is no exponent...
       * Terminate the real number string  and convert it to binay
       * using sscanf.
       */

      *stringSP++ = '\0';
      (void) sscanf(tkn_strt, "%lf", &tknReal);
    } /* end if */

  /* Remove the number string from the character identifer stack */

  stringSP = tkn_strt;
}
Пример #12
0
vec2 Font::getDimensions(const string &text, FontSize size) const
{
	float row_width=0;
	float max_width=0;
	int numLines=1;

	for(string::const_iterator i = text.begin(); i != text.end(); ++i)
	{
		if((*i) == '\n')
		{
			numLines++;
			max_width = max(max_width, row_width);
			row_width = 0;
		}
		else
		{
			row_width += getCharacter(*i).width;
		}
	}

	max_width = max(max_width, row_width);

	const float _size = fontSize.find(size)->second;

	return vec2(max_width, numLines*lineHeight) * _size;
}
Пример #13
0
void decodeData(ibitstream& input, HuffmanNode* encodingTree, ostream& output) {
	while (true) {
        int character = getCharacter(input, encodingTree);
        if (character == NOT_A_CHAR || input.tellg() == -1) return;

		output.put(character);
	}
}
Пример #14
0
int main(void){
	
	saveCharacter("Nico", 15);
	Personaje *pj = getCharacter();
	char *nombre = toString(pj);
	int lvl = pj->lvl;
	printf("%s:%d\n", nombre, lvl);
	return 0;
}
Пример #15
0
/*
 [4]  NameChar ::= Letter | Digit | '.' | '-' | '_' | ':' | CombiningChar | Extender
 [5]  Name ::= (Letter | '_' | ':') (NameChar)*
 [7]  Nmtoken ::= (NameChar)+
 [84] Letter ::= BaseChar | Ideographic

 We don't do this quite right; we rely on the Unicode charsets to do this analysis.  While
 the productions in the XML spec are based on the Unicode character sets, the definitions
 differ slightly to avoid those areas where the Unicode standard is still being resolved.
 At any rate, I'd lay money that using the Unicode charsets, we will be more correct than
 the vast majority of parsers out there.

 Letter == kCFUniCharLetterCharacterSet
 Digit == kCFUniCharDecimalDigitCharacterSet
 CombiningChar == kCFUniCharNonBaseCharacterSet
 Extender - complex, and not represented by a uniform character set.
 */
CF_PRIVATE Boolean _inputStreamScanXMLName(_CFXMLInputStream *stream, Boolean isNMToken, CFStringRef *str) {
    UniChar ch;
    Boolean success = true;
    stream->parserMark = dropMark(stream);
    if (!isNMToken) {
        // Only difference between an NMToken and a Name is Names have a stricter condition on the first character
        if (!getCharacter(stream, &ch, false)) {
            success = false;
        } else if (!CFUniCharIsMemberOf(ch, kCFUniCharLetterCharacterSet) && ch != '_' && ch != ':') {
            success = false;
        } else {
            getCharacter(stream, &ch, true);
        }
    }
    if (success) {
        while (getCharacter(stream, &ch, true)) {
            if (!CFUniCharIsMemberOf(ch, kCFUniCharLetterCharacterSet) && !CFUniCharIsMemberOf(ch, kCFUniCharDecimalDigitCharacterSet)  && ch != '.' && ch != '-' && ch != '_' && ch != ':' && !CFUniCharIsMemberOf(ch, kCFUniCharNonBaseCharacterSet)) {
                _inputStreamReturnCharacter(stream, ch);
                break;
            }
        }
        if (NULL == stream->currentChar || stream->currentChar == stream->parserMark) {
            success = false; // Must have processed at least one character
        }
    }
    if (success) {
        if (str) {
            if (!stream->nameSet) {
                stream->nameSet = CFSetCreateMutable(stream->allocator, 0, &kCFTypeSetCallBacks);
                stream->tempString = CFStringCreateMutableWithExternalCharactersNoCopy(stream->allocator, NULL, 0, 0, kCFAllocatorNull);
            }
            CFStringSetExternalCharactersNoCopy(stream->tempString, stream->parserMark, stream->currentChar-stream->parserMark, stream->currentChar-stream->parserMark);
            if (!CFSetGetValueIfPresent(stream->nameSet, stream->tempString, (const void **)str)) {
                *str = (CFStringRef)CFStringCreateCopy(stream->allocator, stream->tempString);
                CFSetAddValue(stream->nameSet, *str);
                CFRelease(*str);
            }
        }
    } else {
        restoreToMark(stream, stream->parserMark);
    }
    stream->parserMark = NULL;
    return success;
}
Пример #16
0
void HealAction::activate()
{
	Action::activate();

	getCharacter()->heal( m_healAmount );

	// HealAction is 'very' instantaneous, so deactivate() is called
	// immediately after activate().
	deactivate();
}
Пример #17
0
void treeReader::getWordFull(){
  char foundWord[MAX_WORD_LEN + 1];
  int i;
  for(i = 0; i < MAX_WORD_LEN; i++){
    if(markers[i] == -1) break;
      foundWord[i] = getCharacter(markers[i]);
  }
  foundWord[i] = '\0';
  fout << foundWord << endl;
}
Пример #18
0
 void passString() {
   char c;
   getCharacter(c);
   if(c!='\"') errorh(__LINE__);
   peekCharacter(c);
   while(c!='\"') {
     passCharacter();
     peekCharacter(c);
   };
   passCharacter();
 };
Пример #19
0
 treeReader(){
   fout.open("ttwist_output.txt", ios::out);
   descriptor = openFile(fileName);
   currentState = S_START;
   for(int i = 0; i < MAX_WORD_LEN; i++){
     markers[i] = -1;
   }
   reader = 0;
   fileSetCurrentPointer(descriptor, reader);
   currentVal = getCharacter(reader);
 }
Пример #20
0
static void identifier(void)
{
  const  RTYPE *rptr;                         /* Pointer to reserved word */

  tknSubType = txNONE;                        /* Initialize */

  /* Concatenate identifier */

  do
    {
      *stringSP++ = toupper(inChar);          /* concatenate char */
      getCharacter();                         /* get next character */
    }
  while ((isalnum(inChar)) || (inChar == '_'));
  *stringSP++ = '\0';                         /* make ASCIIZ string */

  /* Check if the identifier is a reserved word */

  rptr = findReservedWord(tkn_strt);
  if (rptr)
    {
      token      = rptr->rtype;               /* get type from rsw table */
      tknSubType = rptr->subtype;             /* get subtype from rsw table */
      stringSP      = tkn_strt;               /* pop token from stack */
    } /* End if */

  /* Check if the identifier is a symbol */

  else
    {
      tknPtr = findSymbol(tkn_strt);
      if (tknPtr)
        {
          token = tknPtr->sKind;              /* get type from symbol table */
          stringSP = tkn_strt;                /* pop token from stack */

          /* The following assignments only apply to constants.  However it
           * is simpler just to make the assignments than it is to determine
           * if is appropriate to do so
           */

          if (token == tREAL_CONST)
            tknReal = tknPtr->sParm.c.val.f;
          else
            tknInt  = tknPtr->sParm.c.val.i;
        } /* End if */

      /* Otherwise, the token is an identifier */
      else
        token = tIDENT;

    } /* end else */

} /* End identifier */  
Пример #21
0
void Font::drawChar(const vec3 &a, const vec3 &b, const vec3 &c, const vec3 &d, char z, const color &color) const
{
	glBindTexture(GL_TEXTURE_2D, getCharacter(z).charTex);
	glColor4fv(color);

	glBegin(GL_QUADS);
		glTexCoord2f(0.0f, 0.0f); glVertex3fv(a);
		glTexCoord2f(1.0f, 0.0f); glVertex3fv(b);
		glTexCoord2f(1.0f, 1.0f); glVertex3fv(c);
		glTexCoord2f(0.0f, 1.0f); glVertex3fv(d);
	glEnd();
}
Пример #22
0
void Garage::doOnStartClosingEvent() {
    auto player = engine->getPlayer();
    auto plyChar = player->getCharacter();
    auto playerPosition = plyChar->getPosition();
    auto playerVehicle = plyChar->getCurrentVehicle();
    bool playerIsInVehicle = playerVehicle != nullptr;
    RW_UNUSED(playerPosition);
    RW_UNUSED(playerIsInVehicle);

    switch (type) {
        case Type::Mission:
        case Type::CollectCars1:
        case Type::CollectCars2: {
            player->setInputEnabled(false);
            break;
        }

        case Type::BombShop1:
        case Type::BombShop2:
        case Type::BombShop3:
        case Type::Respray: {
            player->setInputEnabled(false);
            playerVehicle->setHandbraking(true);
            break;
        }

        case Type::MissionForCarToComeOut: {
            break;
        }

        case Type::Crusher: {
            break;
        }

        case Type::MissionKeepCar: {
            break;
        }

        case Type::MissionToOpenAndClose: {
            break;
        }

        case Type::MissionForSpecificCar: {
            break;
        }

        case Type::MissionKeepCarAndRemainClosed: {
            break;
        }

        default: { break; }
    }
}
Пример #23
0
void Font::putChar(vec3 *offset, char character, const color *color, FontSize size) const
{
	const float _size = fontSize.find(size)->second;

	float w = 0.0f;
	float h = 0.0f;
	vec3 right;
	vec3 up;
	vec3 nextOffset;

	w = _size / 100.0f;
	h = _size / 100.0f;

	w = _size;
	h = _size;
	right = vec3(1, 0, 0);
	up = vec3(0, 1, 0);

	if(character == '\n')
	{
		nextOffset.x = 0;
		nextOffset.y = (*offset).y - h*lineHeight;
	}
	else
	{
		/*               center the quad          place it        shift left by an offset  */
		const vec3 a = -right*(w*0.5f)        + (*offset) - right*w*getCharacter(character).left;
		const vec3 b =  right*(w*0.5f)        + (*offset) - right*w*getCharacter(character).left;
		const vec3 c =  right*(w*0.5f) + up*h + (*offset) - right*w*getCharacter(character).left;
		const vec3 d = -right*(w*0.5f) + up*h + (*offset) - right*w*getCharacter(character).left;

		drawChar(a, b, c, d, character, *color);

		float offsetRight = w * (getCharacter(character).width + spacing);

		nextOffset = (*offset) + right*offsetRight;
	}

	(*offset) = nextOffset;
}
Пример #24
0
void Font::putBillboardChar(vec3 start,
							vec3 *offset,
							char character,
							const color *color,
							FontSize size,
							mat3 cameraOrientation) const
{
	const float _size = fontSize.find(size)->second;

	float w = _size / 100.0f;
	float h = _size / 100.0f;

	const vec3 right = cameraOrientation.getAxisX();
	const vec3 up = cameraOrientation.getAxisY();

	vec3 nextOffset;

	if(character == '\n')
	{
		nextOffset = (*offset) + -up*(h*lineHeight);
	}
	else
	{
		/*               center the quad          place it        shift left by an offset  */
		const vec3 a = -right*(w*0.5f)        + (*offset) - right*w*getCharacter(character).left;
		const vec3 b =  right*(w*0.5f)        + (*offset) - right*w*getCharacter(character).left;
		const vec3 c =  right*(w*0.5f) + up*h + (*offset) - right*w*getCharacter(character).left;
		const vec3 d = -right*(w*0.5f) + up*h + (*offset) - right*w*getCharacter(character).left;

		drawChar(a, b, c, d, character, *color);

		float offsetRight = w * (getCharacter(character).width + spacing);

		nextOffset = (*offset) + right*offsetRight;
	}

	(*offset) = nextOffset;
}
Пример #25
0
static void unsignedHexadecimal(void)
{
  /* FORM: integer-number = decimal-integer | hexadecimal-integer |
   *       binary-integer
   * FORM: hexadecimal-integer = '$' hex-digit-sequence
   * FORM: hex-digit-sequence = hex-digit { hex-digit }
   * FORM: hex-digit = digit | 'a' | 'b' | 'c' | 'd' | 'e' | 'f'
   *
   * On entry, inChar is '$'
   */

  /* This is another representation for an integer */

  token = tINT_CONST;

  /* Loop to process each hex 'digit' */

  for (;;)
    {
      /* Get the next character */

      getCharacter();

      /* Is it a decimal digit? */

      if (isdigit(inChar))
        *stringSP++ = inChar;

      /* Is it a hex 'digit'? */

      else if ((inChar >= 'A') && (inChar <= 'F'))
        *stringSP++ = inChar;

      else if ((inChar >= 'a') && (inChar <= 'f'))
        *stringSP++ = _toupper(inChar);

      /* Otherwise, that must be the end of the hex value */

      else break;
    }

  /* Terminate the hex string and convert to binary using sscanf */

  *stringSP++ = '\0';
  (void)sscanf(tkn_strt, "%lx", &tknInt);

  /* Remove the hex string from the character identifer stack */

  stringSP = tkn_strt;
}
Пример #26
0
int main()
{ 
	alt_putstr("Hello from Nios II!\n");
	//alt_putstr("Input the char you would like to send.\n");
	//alt_putchar(*parallel_in);
	//alt_putstr("\n");
	//int c = alt_getchar();
	//alt_putstr("\n");
	int i = 0;
	char hello[20] = "Hello, world! abc123";

	while (i < 20) {

		*transmit_enable = 0x0;
		*load = 0x0;
		//*parallel_out = c;
		*data_bus_output = (hello[i]);
		//getBits(*parallel_out);
		//alt_putstr("\n*parallel_out\n");
		//alt_putchar((*parallel_out >> 1));
		//alt_putchar(*parallel_out);
		*data_bus_output = setParity(*data_bus_output);
		//getBits(*parallel_out);
		//alt_putchar(getCharacter(*parallel_out));
		//alt_putstr("\ngetCharacter(*parallel_out)\n");
		//alt_putchar(getCharacter(*parallel_out));
		usleep(1000);
		*transmit_enable = 0x1;
		*load = 0x1;
		usleep(50);
		*load = 0x0;
		while (!*character_received) {
		}
		while (!*character_sent) {
		}
		*transmit_enable = 0x0;

		/*if (getParity(*parallel_in)) {
			alt_putstr("bad parity\n");
		} else {
			alt_putstr("good parity\n");
		}*/
		//getBits(*parallel_in);
		alt_putchar(getCharacter(*data_bus_input));
		//alt_putstr("\n");
		i++;
	}

	return 0;
}
Пример #27
0
static void unsignedBinary(void)
{
  uint32_t value;

  /* FORM: integer-number = decimal-integer | hexadecimal-integer |
   *       binary-integer
   * FORM: binary-integer = '%' binary-digit-sequence
   * FORM: binary-digit-sequence = binary-digit { binary-digit }
   * FORM: binary-digit = '0' | '1'
   *
   * On entry, inChar is '%'
   */

  /* This is another representation for an integer */

  token = tINT_CONST;

  /* Loop to process each hex 'digit' */

  value = 0;

  for (;;)
    {
      /* Get the next character */

      getCharacter();

      /* Is it a binary 'digit'? */

      if (inChar == '0')
        value <<= 1;

      else if (inChar == '1')
        {
          value <<= 1;
          value  |= 1;
        }

      /* Otherwise, that must be the end of the binary value */

      else break;
    }

  /* I don't there there is an sscanf conversion for binary, that's
   * why we did it above.
   */

  tknInt = (int32_t)value;
}
Пример #28
0
static void skipLine(void)
{
  if (getLine())
    {
      /* Uh-oh, we are out of data!  Just return some bogus value. */

      inChar = '?';
    } /* end if */
  else
    {
      /* Otherwise, get the first character from the line */

      getCharacter();
    }
}
Пример #29
0
MessageResult messageGetCharacter(const Message message, int line,
	int index, char* outValue){

	if(!message)
		return MESSAGE_NULL_ARGUMENT;

	if(message->type !=MESSAGE_TEXT)
		return MESSAGE_WRONG_TYPE;

	if( line > strlen(message->content.text) -1)
		return MESSAGE_OUT_OF_BOUNDS;

	return getCharacter(message->content.text,line,index,outValue);

}
Пример #30
0
void treeReader::processTree(){
  char value;
  while(value = getCharacter(reader)){
    if(isalpha(value)){
      foundAlpha();
    } else if(value == '0') {
      foundZero();
    } else if(value == '1') {
      foundOne();
    } else {
      cout << "Error: foreign character found\n";
      exit(1);
    }
    advanceReader();
  }
  cout << "Done!\n";
}