示例#1
0
int
main (int argc, char *argv[])
{
  tests_start_mpfr ();

  if (argc != 1) /* teint x [prec] */
    {
      mpfr_t x;
      mp_prec_t p;
      p = (argc < 3) ? 53 : atoi (argv[2]);
      mpfr_init2 (x, p);
      mpfr_set_str (x, argv[1], 10, GMP_RNDN);
      printf ("eint(");
      mpfr_out_str (stdout, 10, 0, x, GMP_RNDN);
      printf (")=");
      mpfr_eint (x, x, GMP_RNDN);
      mpfr_out_str (stdout, 10, 0, x, GMP_RNDN);
      printf ("\n");
      mpfr_clear (x);
    }
  else
    {
      check_specials ();

      test_generic (2, 100, 100);
    }

  tests_end_mpfr ();
  return 0;
}
示例#2
0
文件: tcsch.c 项目: Kirija/XPIR
int
main (int argc, char *argv[])
{
  tests_start_mpfr ();

  check_specials ();
  test_generic (2, 200, 10);

  tests_end_mpfr ();
  return 0;
}
示例#3
0
int
main (int argc, char *argv[])
{
  tests_start_mpfr ();

  check_specials ();
  check_bugs ();
  test_generic (2, 200, 10);
  underflowed_cothinf ();

  tests_end_mpfr ();
  return 0;
}
示例#4
0
/*
 * The main entry point for executing commands.
 * Can be recursively called from 'at', 'order', 'force'.
 */
void interpret( CHAR_DATA *ch, char *argument )
{
    char command[MAX_INPUT_LENGTH];
    char logline[MAX_INPUT_LENGTH];
    int cmd;
    int trust;
    int position;
    bool found;

/* inserting wait check for mobiles here to get around order etc. */
    if ( ch->wait > 0 ) {
       send_to_char("You're still busy with the last thing you did!\n\r", ch );
       return;
    }

    /*
     * Strip leading spaces.
     */
    while ( isspace(*argument) )
	argument++;
    if ( argument[0] == '\0' )
	return;

    if ( IS_NPC( ch ) && ch->desc == NULL )
      interp_doer = 0;
    else
      interp_doer = UMIN( MAX_LEVEL, get_trust( ch ) );

    /*
     * Implement freeze command.
     */
    if ( !IS_NPC(ch) && IS_SET(ch->act, PLR_FREEZE) )
    {
	send_to_char( "You're totally frozen!\n\r", ch );
	interp_doer = 0;
	return;
    }

    /*
     * Grab the command word.
     * Special parsing so ' can be a command,
     *   also no spaces needed after punctuation.
     */
    strcpy( logline, argument );
    if ( !isalpha(argument[0]) && !isdigit(argument[0]) )
    {
	command[0] = argument[0];
	command[1] = '\0';
	argument++;
	while ( isspace(*argument) )
	    argument++;
    }
    else
    {
	argument = one_argument( argument, command );
    }

    /*
     * Look for command in command table.
     */
    found = FALSE;
    trust = get_trust( ch );
    for ( cmd = 0; cmd_table[cmd].name[0] != '\0'; cmd++ )
    {
	if ( command[0] == cmd_table[cmd].name[0]
	&&   !str_prefix( command, cmd_table[cmd].name )
	&&   cmd_table[cmd].level <= trust )
	{
	    found = TRUE;
	    break;
	}
    }


    if (IS_SET(ch->act, PLR_AFK) 
	 && (cmd_table[cmd].level < AFK)) {    
        // quick & dirty hack to allow wizcmds without breaking afk
	send_to_char("You are gone, remember?\n\r", ch);
	interp_doer = 0;
	return;
    }

    /*
     * No hiding.
     */
    if ( cmd_table[cmd].motion == TRUE )
	REMOVE_BIT( ch->affected_by, AFF_HIDE );

    /*
     * Lose concentration.
     */
    if ( cmd_table[cmd].concentration == TRUE && ch->predelay_time > 0 )
    {
	send_to_char( "You stop concentrating...\n\r", ch );
	ch->predelay_time = 0;
	free_predelay( ch->predelay_info );
	ch->predelay_info = NULL;
    }

    /*
     * Log and snoop.
     */
    if ( cmd_table[cmd].log == LOG_NEVER )
	strcpy( logline, "XXXXXXXX XXXXXXXX XXXXXXXX" );

    if ( ( !IS_NPC(ch) && IS_SET(ch->act, PLR_LOG) )
    ||   fLogAll
    ||   cmd_table[cmd].log == LOG_ALWAYS )
    {
	sprintf( log_buf, "Log %s: %s", ch->name, logline );
	log_string( log_buf );
    }

    if ( ch->desc != NULL && ch->desc->snoop_by != NULL )
    {
	write_to_buffer( ch->desc->snoop_by, "% ",    2 );
	write_to_buffer( ch->desc->snoop_by, logline, 0 );
	write_to_buffer( ch->desc->snoop_by, "\n\r",  2 );
    }

    /*
     * Character not in position for command?
     */
    position = ch->position;
    if ( check_fighting( ch ) && ch->position == POS_STANDING )
	position = POS_FIGHTING;

    if ( found && position < cmd_table[cmd].position )
    {
	switch( position )
	{
	case POS_DEAD:
	    send_to_char( "Lie still; you are DEAD.\n\r", ch );
	    break;

	case POS_MORTAL:
	case POS_INCAP:
	    send_to_char( "You are hurt far too bad for that.\n\r", ch );
	    break;

	case POS_STUNNED:
	    send_to_char( "You are too stunned to do that.\n\r", ch );
	    break;

	case POS_SLEEPING:
	    send_to_char( "In your dreams, or what?\n\r", ch );
	    break;

	case POS_RESTING:
	    send_to_char( "Nah... You feel too relaxed...\n\r", ch);
	    break;

	case POS_FIGHTING:
	    send_to_char( "No way!  You are fighting for your life!\n\r", ch);
	    break;

	}
	interp_doer = 0;
	return;
    }

    if ( check_specials( ch, command,
	    ( found ? *cmd_table[cmd].do_fun : NULL ),
	    argument ) )
    {
        interp_doer = 0;
	return;
    }

    /*
     * Dispatch the command.
     */
    if ( found )
    {
	if ( cmd_table[cmd].delay_fun == NULL )
	    (*cmd_table[cmd].do_fun) ( ch, argument );
	else
	    (*cmd_table[cmd].delay_fun) ( ch, argument );
    }
    else
    {
	/*
	 * Look for command in socials table.
	 */
	if ( !check_social( ch, command, argument ) )
	    send_to_char( "Huh?\n\r", ch );
        interp_doer = 0;
	return;
    }

    interp_doer = 0;
    tail_chain( );
    return;
}