Пример #1
0
int main (int argc, char **argv) {
   program_name = basename (argv[0]);
   scan_options (argc, argv);
   stack *stack = new_stack ();
   bool quit = false;
   yy_flex_debug = false;
   while (! quit) {
      int token = yylex();
      if (token == YYEOF) break;
      switch (token) {
         case NUMBER: do_push (stack, yytext); break;
         case '+': do_binop (stack, add_bigint); break;
         case '-': do_binop (stack, sub_bigint); break;
         case '*': do_binop (stack, mul_bigint); break;
         case 'c': do_clear (stack); break;
         case 'f': do_print_all (stack); break;
         case 'p': do_print (stack); break;
         case 'q': quit = true; break;
         default: unimplemented (token); break;
      }
   }
   yycleanup();
   DEBUGF ('m', "EXIT %d\n", exit_status);
   do_clear(stack);
   free_stack(stack);
   return EXIT_SUCCESS;
}
Пример #2
0
int main (int argc, char **argv) {
   program_name = basename (argv[0]);
   scan_options (argc, argv);
   stack *stack = new_stack ();
   token *scanner = new_token (stdin);
   for (;;) {
      int token = scan_token (scanner);
      if (token == EOF) break;
      switch (token) {
         case NUMBER: do_push (stack, peek_token (scanner)); break;
         case '+': do_binop (stack, add_bigint); break;
         case '-': do_binop (stack, sub_bigint); break;
         case '*': do_binop (stack, mul_bigint); break;
         case 'c': do_clear (stack); break;
         case 'f': do_print_all (stack); break;
         case 'p': do_print (stack); break;
         default: unimplemented (token); break;
      }
   }
   
   do_clear(stack);
   free_stack(stack);
   free_token(scanner);
   DEBUGF ('m', "EXIT %d\n", exit_status);
   return EXIT_SUCCESS;
}
Пример #3
0
void
clear_cb (GtkWidget * widget, gpointer data)
{
  sw_view * view = (sw_view *)data;
  sw_sample * s = view->sample;

  do_clear (s);
}
Пример #4
0
void do_operator (stack *the_stack, const char *oper) {
   switch (oper[0]) {
         case '+': do_binop (the_stack, '+'); break;
         case '-': do_binop (the_stack, '-'); break;
         case '*': do_binop (the_stack, '*'); break;
         case '/': do_binop (the_stack, '/'); break;
         case ';': do_print (the_stack);      break;
         case '@': do_clear (the_stack);      break;
         default : bad_operator (oper);   break;
      }
}
Пример #5
0
void do_operator (stack *the_stack, const char *oper) {
   switch (*oper) {
      case '+': do_binop (the_stack, '+'); break;
      case '-': do_binop (the_stack, '-'); break;
      case '*': do_binop (the_stack, '*'); break;
      case '/': do_binop (the_stack, '/'); break;
      case ';': do_print (the_stack); break;
      case '@': do_clear (the_stack); break;
      default : bad_operator (oper); break;
      }
   //printf ("the_stack=%p, top=%d, oper=\"%s\"\n",
     //    the_stack, the_stack->top, oper);
}
Пример #6
0
 void clear() { do_clear(); }
Пример #7
0
// Implementing pure virtual method of ColumnBase.
inline void BinaryColumn::clear(size_t, bool)
{
    do_clear(); // Throws
}
Пример #8
0
inline void BinaryColumn::clear()
{
    do_clear(); // Throws
}
Пример #9
0
int main(int argc, char *argv[])
{
	int c;
	struct option long_options[] = {
		/* Options/Commands */
		{"clear",             0, 0, 'c'},
		{"disable",           0, 0, 'd'},
		{"enable",            0, 0, 'e'},
		{"force-reset",       0, 0, 'f'},
		{"loglevel",          1, 0, 'l'},
		{"help",              0, 0, 'h'},
		{"reboot",            1, 0, 'r'},
		{"status",            0, 0, 's'},
		{"verbose",           0, 0, 'V'},
		{"version",           0, 0, 'v'},
		/* Tests */
		{"complete-cycle",    0, 0, 200},
		{"disable-enable",    0, 0, 201},
		{"false-ack",         0, 0, 202},
		{"false-unsubscribe", 0, 0, 203},
		{"failed-kick",       0, 0, 204},
		{"no-kick",           0, 0, 205},
		{"premature-trigger", 0, 0, 206},
		{NULL, 0, 0, 0}
	};

	while ((c = getopt_long(argc, argv, "cdefl:hr:sVv?", long_options, NULL)) != EOF) {
		switch (c) {
		case 'c':
			return do_clear();

		case 'd':
			return do_enable(0);

		case 'e':
			return do_enable(1);

		case 'f':
			return do_reset(0);

		case 'l':
			return set_loglevel(optarg);

		case 'h':
			return usage(0);

		case 'r':
			return do_reset(atoi(optarg));

		case 's':
			return show_status();

		case 'V':
			verbose = 1;
			break;

		case 'v':
			return show_version();

		case 200:
			return testit();

		case 201:
			disable_enable = 1;
			return testit();

		case 202:
			false_ack = 1;
			return testit();

		case 203:
			false_unsubscribe = 1;
			return testit();

		case 204:
			failed_kick = 1;
			return testit();

		case 205:
			no_kick = 1;
			return testit();

		case 206:
			premature = 1;
			return testit();

		default:
			warn("Unknown or currently unsupported.");
			return usage(1);
		}
	}

	return 0;
}
Пример #10
0
void btclear(btree *t)
{
	t->visitor = free_node_only;
	do_clear(t);
}
Пример #11
0
// Overriding virtual method of Column.
inline void StringEnumColumn::clear(size_t, bool)
{
    do_clear(); // Throws
}
Пример #12
0
inline void StringEnumColumn::clear()
{
    do_clear(); // Throws
}
Пример #13
0
// Implementing pure virtual method of ColumnBase.
inline void StringColumn::clear(std::size_t, bool)
{
    do_clear(); // Throws
}
Пример #14
0
int main()
{
	pololu_3pi_init(2000);  
	play_mode(PLAY_CHECK);
	clear();

	// start receiving data at 115.2 kbaud
	serial_set_baud_rate(115200);
	serial_receive_ring(buffer, 100);

	while(1)
	{
		// wait for a command
		char command = read_next_byte();

		// The list of commands is below: add your own simply by
		// choosing a command byte and introducing another case
		// statement.
		switch(command)
		{
		case (char)0x00:
			// silent error - probable master resetting
			break;

		case (char)0x81:
			send_signature();
			break;
		case (char)0x86:
			send_raw_sensor_values();
			break;
		case (char)0x87:
			send_calibrated_sensor_values(1);
			break;
		case (char)0xB0:
			send_trimpot();
			break;
		case (char)0xB1:
			send_battery_millivolts();
			break;
		case (char)0xB3:
			do_play();
			break;
		case (char)0xB4:
			calibrate_line_sensors(IR_EMITTERS_ON);
			send_calibrated_sensor_values(1);
			break;
		case (char)0xB5:
			line_sensors_reset_calibration();
			break;
		case (char)0xB6:
			send_line_position();
			break;
		case (char)0xB7:
			do_clear();
			break;
		case (char)0xB8:
			do_print();
			break;
		case (char)0xB9:
			do_lcd_goto_xy();
			break;
		case (char)0xBA:
			auto_calibrate();
			break;
		case (char)0xBB:
			set_pid();
			break;
		case (char)0xBC:
			stop_pid();
			break;

		case (char)0xC1:
			m1_forward();
			break;
		case (char)0xC2:
			m1_backward();
			break;
		case (char)0xC5:
			m2_forward();
			break;
		case (char)0xC6:
			m2_backward();
			break;

		default:
			clear();
			print("Bad cmd");
			lcd_goto_xy(0,1);
			print_hex_byte(command);

			play("o7l16crc");
			continue; // bad command
		}
	}
}
Пример #15
0
int
main (int argc, char **argv)
{
  int ret = -1;

  reset_parameters ();
  genl_client_init ();

  if (argc < 2)
    {
      ret = usage ();
      goto end;
    }

  if (strcmp (argv[1], HELP) == 0)
    {
      ret = usage ();
      goto end;
    }

  if ((strcmp (argv[1], LOCALSID) != 0) && (strcmp (argv[1], SRDEV) != 0))
    {
      printf ("Unrecognized table. Please try \"srconf help\". \n");
      goto end;
    }

  params.table = argv[1];

  if (strcmp (argv[1], LOCALSID) == 0)
    {

      if (argc == 2)
	{
	  ret = usage_localsid ();
	  goto end;
	}

      params.command = argv[2];

      if (strcmp (argv[2], HELP) == 0)
	ret = do_help (argc, argv);

      else if (strcmp (argv[2], FLUSH) == 0)
	ret = do_flush (argc, argv);

      else if (strcmp (argv[2], CLEAR) == 0)
	ret = do_clear (argc, argv);

      else if (strcmp (argv[2], SHOW) == 0)
	ret = do_show (argc, argv);

      else if (strcmp (argv[2], DEL) == 0)
	ret = do_del (argc, argv);

      else if (strcmp (argv[2], ADD) == 0)
	ret = do_add (argc, argv);

      else
	printf
	  ("Unrecognized command. Please try \"srconf localsid help\".\n");
    }
  else
    {
      printf ("srconf srdev commands are not supported yet. \n");
      usage_srdev ();
    }

end:
  return ret;
}
Пример #16
0
void btdestroy(btree *t)
{
	t->visitor = free_node_destroy;
	do_clear(t);
}
template<class T> inline void BasicColumn<T>::clear()
{
    do_clear(); // Throws
}