Пример #1
0
/* read into InputLine until the next1 end of line
 * @return true iff something has actually been read, i.e. we have not already
 *         been at the end of line
 */
boolean ReadToEndOfLine(void)
{
  if (LastChar=='\r' || LastChar=='\n')
    return false;
  else
  {
    char *p = InputLine;

    do
    {
      NextChar();
    } while (strchr(LineSpaceChar,LastChar));

    while (LastChar!='\r' && LastChar!='\n')
    {
      *p++ = LastChar;
      NextChar();
    }

    if (p >= (InputLine + sizeof(InputLine)))
      output_plaintext_fatal_message(InpLineOverflow);

    *p = '\0';

    return true;
  }
}
Пример #2
0
void redo_imitator_addition(move_effect_journal_entry_type const *entry)
{
  square const to = entry->u.imitator_addition.to;

  TraceFunctionEntry(__func__);
  TraceFunctionParamListEnd();

  if (being_solved.number_of_imitators==maxinum)
    output_plaintext_fatal_message(ManyImitators);

  being_solved.isquare[being_solved.number_of_imitators] = to;
  ++being_solved.number_of_imitators;

  TraceFunctionExit(__func__);
  TraceFunctionResultEnd();
}
Пример #3
0
char *ReadNextTokStr(void)
{
  while (strchr(SpaceChar,LastChar))
    NextChar();

  if (strchr(TokenChar,LastChar))
  {
    char *p = InputLine;
    char *t = TokenLine;

    do {
      *p++ = LastChar;
      *t++ = LastChar;
      /* *t++= (isupper(ch)?tolower(ch):ch);  */
      /* EBCDIC support ! HD */
      NextChar();
    } while (strchr(TokenChar,LastChar));

    if (p >= (InputLine+sizeof(InputLine)))
      output_plaintext_fatal_message(InpLineOverflow);

    *t = '\0';
    *p = '\0';

    return TokenLine;
  }
  else if (strchr(SepraChar,LastChar))
  {
    do
    {
      NextChar();
    } while (strchr(SepraChar,LastChar));
    return Sep;
  }
  else
  {
    output_plaintext_input_error_message(WrongChar,LastChar);
    LastChar = TokenLine[0]= ' ';
    TokenLine[1] = '\0';
    return TokenLine;
  }
}
Пример #4
0
/* Add the addition of an imitator to the current move of the current ply
 * @param reason reason for adding the imitator
 * @param to where to add the imitator
 */
static void move_effect_journal_do_imitator_addition(move_effect_reason_type reason,
                                                     square to)
{
  move_effect_journal_entry_type * const entry = move_effect_journal_allocate_entry(move_effect_imitator_addition,reason);

  TraceFunctionEntry(__func__);
  TraceSquare(to);
  TraceFunctionParamListEnd();

  entry->u.imitator_addition.to = to;

  if (being_solved.number_of_imitators==maxinum)
    output_plaintext_fatal_message(ManyImitators);

  being_solved.isquare[being_solved.number_of_imitators] = to;
  ++being_solved.number_of_imitators;

  TraceFunctionExit(__func__);
  TraceFunctionResultEnd();
}