Ejemplo n.º 1
0
void exit_program( int exit_value )
{
  reset_attr( );
  if ( html_flag )
    __printf_chk( 1, "</pre>\n" );
  if ( readline_enabled && write_history( history_filename ) )
    __fprintf_chk( stderr, 1, "%s: Unable to save readline history into file \"%s\".\n", prog_name, history_filename );
  if ( exit_value == 0 && quiet_mode == 0 && html_flag == 0 )
    __printf_chk( 1, "Thank you for using Mathomatic!\n" );
  exit( exit_value );
}
Ejemplo n.º 2
0
void inthandler( int sig )
{
  abort_flag++;
  switch ( abort_flag )
  {
  case 0:
  case 1:
    __printf_chk( 1, "\nUser interrupt signal received; three times quits Mathomatic.\n" );
    break;
  case 2:
    __printf_chk( 1, "\nRepeatedly interrupted; returning to operating system...\n" );
    exit_program( 1 );
    break;
//  case 2:
    __printf_chk( 1, "\nPress Control-C once more to quit program.\n" );
    break;
  }
  return;
}
void test (void)
{
  vi0 = 0;
  __printf_chk (1, "hello");
  vi1 = 0;
  __printf_chk (1, "hello\n");
  vi2 = 0;
  __printf_chk (1, "a");
  vi3 = 0;
  __printf_chk (1, "");
  vi4 = 0;
  __printf_chk (1, "%s", "hello");
  vi5 = 0;
  __printf_chk (1, "%s", "hello\n");
  vi6 = 0;
  __printf_chk (1, "%s", "a");
  vi7 = 0;
  __printf_chk (1, "%s", "");
  vi8 = 0;
  __printf_chk (1, "%c", 'x');
  vi9 = 0;
  __printf_chk (1, "%s\n", "hello\n");
  via = 0;
}
Ejemplo n.º 4
0
void alarmhandler( int sig )
{
  __printf_chk( 1, "\nTimeout, quitting...\n" );
  exit_program( 1 );
  return;
}
Ejemplo n.º 5
0
int main( int argc, char **argv )
{
  int eax;
  double fp7;
  int i;
  char *cp = &ebx;
  double numerator, denominator;
  double new_size;
  int coption, boption, wide_flag;
  init_gvars( );
  default_out = stdout;
  gfp = stdout;
  wide_flag = 0;
  coption = 0;
  if ( i >= 0 )
  {
    if ( i + -98 + -98 <= 22 )
    {
      ;
    }
    usage( );
    exit( 2 );
  }
  else
  {
    if ( n_tokens <= 99 )
    {
      __fprintf_chk( stderr, 1, "%s: Expression array size too small.\n", prog_name );
      exit( 2 );
    }
    if ( init_mem( ) == 0 )
    {
      __fprintf_chk( stderr, 1, "%s: Not enough memory.\n", prog_name );
      exit( 2 );
    }
    if ( readline_enabled )
    {
      if ( numerator && prog_name )
      {
        __snprintf_chk( history_filename_storage, 4096, 1, 4096, "%s/.%s_history", cp, prog_name );
        history_filename = history_filename_storage;
      }
      rl_initialize( );
      using_history( );
      stifle_history( 500 );
      rl_inhibit_completion = 1;
      if ( html_flag == 0 )
      {
        color_flag = tigetnum( "colors" ) > 7;
      }
      read_history( history_filename );
    }
    get_screen_size( );
    if ( html_flag )
      __printf_chk( 1, "&lt;pre&gt;\n" );
    if ( test_mode == 0 )
    {
      if ( quiet_mode == 0 )
      {
        if ( security_level > 1 )
          __printf_chk( 1, "Secure " );
        __printf_chk( 1, "Mathomatic version %s (www.mathomatic.org)\n", "15.1.1" );
        __printf_chk( 1, "Copyright (C) 1987-2010 George Gesslein II.\n" );
        __printf_chk( 1, "%d equation spaces available, %ld kilobytes per equation space.\n", 100, (/*HI*/int)( ( n_tokens << 5 ) * 0x10624dd3 ) >> 6 );
        if ( test_mode == 0 )
          goto B32;
      }
B32:;
      if ( load_rc( ) == 0 )
        __fprintf_chk( stderr, 1, "%s: Error loading set options from \"%s\".\n", prog_name, rc_file );
    }
    if ( wide_flag )
    {
      screen_columns = 0;
      screen_rows = 0;
    }
    if ( coption & 1 )
      color_flag = color_flag == 0;
    if ( 0 )
    {
      color_flag = 1;
      bold_colors = 1;
    }
    if ( test_mode )
      color_flag = 0;
    if ( quiet_mode == 0 && color_flag )
    {
      __printf_chk( 1, "%s%s color mode enabled", html_flag != 0 ? "ANSI" : "HTML", bold_colors == 0 ? " bold" : "" );
      if ( 0 )
        __printf_chk( 1, ".\n" );
      else
        __printf_chk( 1, "; disable with the -c option or \"set no color\".\n" );
    }
    i = _setjmp( &jmp_save[0].__jmpbuf[0] );
    if ( _setjmp( &jmp_save[0].__jmpbuf[0] ) )
    {
      clean_up( );
      if ( i == 14 )
        error( "Expression too large." );
      __printf_chk( 1, "Operation aborted.\n" );
    }
    else
    {
      if ( set_signals( ) == 0 )
        __fprintf_chk( stderr, 1, "signal(2) setting failed.\n" );
      if ( !f_to_fraction( 0.500000000000, &denominator, ebp_36 ) || denominator != 1.000000000000 || ebp_36 != 2.000000000000 || 0 || !f_to_fraction( 0.333333333333, &denominator, ebp_36 ) || denominator != 1.000000000000 || 0 || ebp_36 != 3.000000000000 || ebp_36 != 3.000000000000 )
      {
        __fprintf_chk( stderr, 1, "%s: Cannot convert any floating point values to fractions.\n", prog_name );
        __fprintf_chk( stderr, 1, "Roots will not work properly.\n" );
      }
      i = optind;
      if ( argc <= optind || argv[ i ] == 0 )
      {
        main_io_loop( );
        exit_program( 0 );
        return 0;
      }
    {
      /* phantom */ size_t __s1_len;
      /* phantom */ size_t __s2_len;
      unsigned char *__s1;
      /* phantom */ int __result;
      do
      {
        if ( '-' == argv[ i ][0] && argv[ i ][1] == 0 )
          main_io_loop( );
        else
        {
          if ( read_file( argv[ i ] ) == 0 )
          {
            __fprintf_chk( stderr, 1, "Read of file \"%s\" failed.\n", argv[ i ] );
            exit_program( 1 );
          }
        }
        i++;
      }
      while ( i + 1 < argc && argv[ i + 1 + 1 ] );
    }
    }
  }
}
Ejemplo n.º 6
0
void usage( void )
{
  __printf_chk( 1, "\nMathomatic computer algebra system version %s\n\n", "15.1.1" );
  __printf_chk( 1, "Usage: %s [ options ] [ input_files ]\n\n", prog_name );
  __printf_chk( 1, "Options:\n" );
  __printf_chk( 1, "  -b            Enable bold color mode.\n" );
  __printf_chk( 1, "  -c            Toggle color mode.\n" );
  __printf_chk( 1, "  -h            Display this help and exit.\n" );
  __printf_chk( 1, "  -m number     Specify a memory size multiplier.\n" );
  __printf_chk( 1, "  -q            Set quiet mode (don't display prompts).\n" );
  __printf_chk( 1, "  -r            Disable readline.\n" );
  __printf_chk( 1, "  -s level      Set enforced security level for session.\n" );
  __printf_chk( 1, "  -t            Set test mode.\n" );
  __printf_chk( 1, "  -u            Set unbuffered output.\n" );
  __printf_chk( 1, "  -v            Display version information, then exit.\n" );
  __printf_chk( 1, "  -w            Wide output mode, sets unlimited width.\n" );
  __printf_chk( 1, "  -x            Enable HTML/XHTML output mode.\n" );
  __printf_chk( 1, "\nPlease refer to the Mathomatic man page for more information.\n" );
  __printf_chk( 1, "The man page is viewed by typing \"man mathomatic\" in shell.\n" );
  return;
}