Пример #1
0
void RWarning_not_prod(const char *fmt,...){
#ifndef RELEASE
  char message[1000];
  va_list argp;
  
  va_start(argp,fmt);
  /*	vfprintf(stderr,fmt,argp); */
  vsprintf(message,fmt,argp);
  va_end(argp);

  show_message(IS_WARNING,message);
#endif
}
Пример #2
0
static void in_received_handler(DictionaryIterator *iter, void *context) {
  phone_heartbeat = 5;
  APP_LOG(APP_LOG_LEVEL_DEBUG, "Received message, current screen: %d", current_screen);
  Tuple *server_error_tuple = dict_find(iter, SERVER_ERROR_KEY); 
  if (server_error_tuple){
	    if (current_screen != SCREEN_MESSAGE_KEY){
		server_error = atoi(server_error_tuple->value->cstring);
		APP_LOG(APP_LOG_LEVEL_DEBUG, "Server error received %d", server_error);
		show_message("No connection to Boat Remote Server");
	  } 
	  return;
  }
	
  else{
	  switch(current_menu){
		  case VIEW_MENU:
		  	  switch(current_screen){
				case SCREEN_MESSAGE_KEY:
		  			window_stack_pop(true);
		   		    change_screen(last_screen);
				case SCREEN_GPS_KEY:
		   			update_gps_fields(iter);
		   			break;
				case SCREEN_SAILING_KEY:
				   update_sailing_fields(iter);
				   break;
				case SCREEN_NAVIGATION_KEY:
				   update_navigation_fields(iter);
				   break;
				case SCREEN_WAYPOINT_KEY:
				   update_waypoint_fields(iter);
				   break;
				case SCREEN_LOG_KEY:
				   update_log_fields(iter);
				   break;
				case SCREEN_ANCHOR_WATCH_KEY:
				   update_anchor_watch_fields(iter);
	     		   Tuple *location_status_tuple = dict_find(iter, LOCATION_STATUS_KEY); 
		   		   if (location_status_tuple){
			           if (atoi(location_status_tuple->value->cstring) == 1){
				           show_popup("Attempting to set anchor location using phone GPS");
			           }
			           else{
			               show_popup("Unable to set anchor location using phone GPS, attempting to use boat location");
			           }
		           }
		           break;
			  }
	  }
  }
}
Пример #3
0
static void
show_messages (void *ctx,
	       const notmuch_show_format_t *format,
	       notmuch_messages_t *messages,
	       int indent,
	       notmuch_show_params_t *params)
{
    notmuch_message_t *message;
    notmuch_bool_t match;
    int first_set = 1;
    int next_indent;

    fputs (format->message_set_start, stdout);

    for (;
	 notmuch_messages_valid (messages);
	 notmuch_messages_move_to_next (messages))
    {
	if (!first_set)
	    fputs (format->message_set_sep, stdout);
	first_set = 0;

	fputs (format->message_set_start, stdout);

	message = notmuch_messages_get (messages);

	match = notmuch_message_get_flag (message, NOTMUCH_MESSAGE_FLAG_MATCH);

	next_indent = indent;

	if (match || params->entire_thread) {
	    show_message (ctx, format, message, indent, params);
	    next_indent = indent + 1;

	    fputs (format->message_set_sep, stdout);
	}

	show_messages (ctx,
		       format,
		       notmuch_message_get_replies (message),
		       next_indent,
		       params);

	notmuch_message_destroy (message);

	fputs (format->message_set_end, stdout);
    }

    fputs (format->message_set_end, stdout);
}
Пример #4
0
/*
 * initialize hotkeys
 */
void
hotkeys_init()
{
	char	msg_str[128];

	begin_func("hotkeys_init");

	if (hotkey_parse(menukey_str, &menukey, &menukey_mask) != 0) {
		sprintf(msg_str, "Invalid menu hotkey '%s'.\nFalling back to "
				"default (" DEF_MENUKEY ")\n", menukey_str);
		show_message(msg_str, "Warning", "OK", NULL, NULL);
		strcpy(menukey_str, DEF_MENUKEY);
		hotkey_parse(menukey_str, &menukey, &menukey_mask);
	}
	if (hotkey_parse(prev_item_key_str, &prev_item_key, &prev_item_mask) != 0) {
		sprintf(msg_str, "Invalid previous item hotkey '%s'.\n"
				"Falling back to default (" DEF_PREV_ITEM_KEY
				")\n", prev_item_key_str);
		show_message(msg_str, "Warning", "OK", NULL, NULL);
		hotkey_parse(DEF_PREV_ITEM_KEY, &prev_item_key,
				&prev_item_mask);
	}
	if (hotkey_parse(exec_item_key_str, &exec_item_key, &exec_item_mask) != 0) {
		sprintf(msg_str, "Invalid exec hotkey '%s'.\n"
				"Falling back to default (" DEF_EXEC_ITEM_KEY
				")\n", exec_item_key_str);
		show_message(msg_str, "Warning", "OK", NULL, NULL);
		hotkey_parse(DEF_EXEC_ITEM_KEY, &exec_item_key,
				&exec_item_mask);
	}
	gdk_window_add_filter(gdk_get_default_root_window(), global_keys_filter, NULL);
	grab_key(menukey, menukey_mask);
	grab_key(prev_item_key, prev_item_mask);
	grab_key(exec_item_key, exec_item_mask);

	return_void();
}
Пример #5
0
int main(void)
{
	pthread_t id;
	setbuf(stdout, NULL);
	
	if( pthread_create (&id, NULL, (void *)get_input, NULL) )
	{
		perror("Create thread fail!\n");
		exit(EXIT_FAILURE);
	}

	show_message();

	pthread_join(id, NULL);
	return EXIT_SUCCESS;
}
Пример #6
0
static gboolean time_handler(GtkWidget *widget)
{
  static int msg_life = 0;
  pthread_mutex_lock(&mutex);
  if (new_msg) {
    new_msg = FALSE;
    msg_life = MSG_LIFE / time_interval;
    pthread_mutex_unlock(&mutex);
    show_message(msg_from, msg_content);
  }
  else {
    pthread_mutex_unlock(&mutex);
    if (--msg_life == 0)
      win_show("", "");
  }
  return TRUE;
}
Пример #7
0
void UserInterface::exec_fityk_script(const string& filename)
{
    user_interrupt = false;

    boost::scoped_ptr<FileOpener> opener;
    if (endswith(filename, ".gz"))
        opener.reset(new GzipFileOpener);
    else
        opener.reset(new NormalFileOpener);
    if (!opener->open(filename.c_str())) {
        warn("Can't open file: " + filename);
        return;
    }

    int line_index = 0;
    char *line;
    string s;
    while ((line = opener->read_line()) != NULL) {
        ++line_index;
        if (line[0] == '\0')
            continue;
        if (ctx_->get_verbosity() >= 0)
            show_message (kQuoted, S(line_index) + "> " + line);
        s += line;
        if (*(s.end() - 1) == '\\') {
            s.resize(s.size()-1);
            continue;
        }
        if (s.find("_SCRIPT_DIR_/") != string::npos) {
            string dir = get_directory(filename);
            replace_all(s, "_EXECUTED_SCRIPT_DIR_/", dir); // old magic string
            replace_all(s, "_SCRIPT_DIR_/", dir); // new magic string
        }
        Status r = execute_line(s);
        if (r != kStatusOk &&
                ctx_->get_settings()->on_error[0] != 'n' /*nothing*/)
            break;
        if (user_interrupt) {
            mesg("Script stopped by signal INT.");
            break;
        }
        s.clear();
    }
    if (line == NULL && !s.empty())
        throw SyntaxError("unfinished line");
}
Пример #8
0
// Converte o arquivo pet_db.txt para SQL.
void convert_pet_db(void)
{
	FILE *fread, *fwrite;
	char line[1024], path[256];
	int count = 0, i;

	sprintf(path, "%s", "db/pet_db.txt");

	if (!(fread = fopen(path, "r")))
		return;

	fwrite = fopen("sql/pet_db.sql", "w+");

	while (fgets(line, sizeof(line), fread) != NULL) {
		char *token, **script, buf[1024], write[1024], *pos = buf;

		if ((line[0] == '/' && line[1] == '/') || line[0] == '\n')
			continue;

		line[strlen(line)-1] = '\0';
		explode(&script, (char *)line, '{');
		token = strtok(line, ",");

		for (i = 0; i < 22; i++) {
			if (i) {
				pos += sprintf(pos, ",");
			}

			if (i < 20)
				pos += ((i == 1 || i == 2)) ? sprintf(pos, "'%s'", escape_str(token)) : sprintf(pos, "%s", token);
			else
				pos += (i == 21) ? sprintf(pos, "'{%s'", escape_str(script[2])) : sprintf(pos, "'{%s'", replace_str(escape_str(script[1]), "},", "}"));

			token = strtok(NULL, ",");
		}

		snprintf(write, sizeof(write), "REPLACE INTO pet_db VALUES(%s);\n", buf);
		fprintf(fwrite, write);
		count++;
	}

	show_message(LIGHT_GREEN, "File %s successfully converted! rows affected: %d\n", path, count);
	fclose(fread);
	fclose(fwrite);
	file_count++;
}
Пример #9
0
static void show_signals(dbc_t *dbc)
{
  message_list_t *ml;
  signal_list_t *sl;

  show_message_header();
  show_signal_header();

  for(ml = dbc->message_list; ml != NULL; ml = ml->next) {
    for(sl = ml->message->signal_list; sl != NULL; sl = sl->next) {
      show_message(ml);
      putchar(';');
      show_signal(sl);
      putchar('\n');
    }
  }
}
Пример #10
0
int main (int argc, char *argv[]) {

  if (argc < 3 || argc < 2 || argc < 1) {
    show_usage(argv[0], TRUE, -1);
  }

  if (file_exists(argv[1]) != 1) {
    show_message("File not found.", TRUE, -2);
  }

  const char* cfilename   = argv[1];
  const char* cfieldname  = argv[2];

  json_object* jobj       = json_object_from_file(cfilename);
  json_object* jlast;

  int i;
  jlast = jobj;
  for(i = 2; i < argc; i++) {
    //printf("arg %d = %s \n", i, argv[i]);

    //argument is referencing an array item by index
    if (json_object_is_array(jlast) && str_is_integer(argv[i])) {
      jlast = json_object_array_get_idx(jlast, atol(argv[i]));
      continue;
    }

    if (json_object_has_item(jlast, argv[i])) {
      jlast = get_object_item(jlast, argv[i]);
    } else {
      jlast = NULL;
    }
  }

  //item was not found
  if (jlast == NULL) {
    printf("%s", "");
    exit(1);
  }

  //print string value or JSON representation of the object
  printf("%s", json_object_get_string(jlast));

  exit(0);
}
Пример #11
0
static gint check_table(gpointer data)
{
    gint i;

    for (i = 0; i < addrcnt; i++)
        update_column(i);

    if (connections_updated) {
        update_connections_table();
        connections_updated = FALSE;
    }

    if (message[0]) {
	show_message(message);
	message[0] = 0;
    }

    return TRUE;
}
Пример #12
0
/* ARGSUSED */
static XtCallbackProc
reset_all_cback(Widget w, xgobidata *xg, XtPointer cb_data) {
/*
 * read the raw data back in here instead of having to go
 * to the file menu to accomplish it.
*/
  Boolean reset = False;

  if (xg->datafilename != "") {
    if (reread_dat(xg->datafilename, xg)) {
      plot_once(xg);
      reset = True;
    }
  }

  if (!reset)
    show_message(
     "Sorry, I can\'t reset because I can\'t reread the data file\n", xg);
}
Пример #13
0
int main(int argc, const char * argv[]) {
    // insert code here...
    int i, playRound, moveStep;
    char choice;
    int *dot;
    
    srand(time(NULL));											/* 随机数生成*/
    show_message();
    
    for(playRound = 1; ;)
    {
        dot = calloc(MAX_PLAYER, sizeof(int));
        for(i = 0; ; ++i)
        {
            moveStep = f__move();
            printf("Player want to move %d\n", moveStep);
            
            dot[i % MAX_PLAYER] += moveStep;
            printf("Player %d is now %d\n", i % MAX_PLAYER + 1, dot[i % MAX_PLAYER]);
            if(dot[i % MAX_PLAYER] >= 60)
            {
                printf("%s%d\n", "YOU WIN! Congratulations PLAYER ", i % MAX_PLAYER + 1);
                break;
            }
        }
        printf("%s%d%s", "Round ", playRound," is over, do you want to next round?(Y/N)");
        scanf("%c", &choice);
        switch(choice)
        {
            case 'Y':
                continue;
            case 'N':
                printf("Bye\n");
                exit(0);
            default:
                printf("Your choice is unbelievbable!!\n");
                exit(0);
        }
    }
    
    return 0;

}
static gint32 open_raw(
    char*            filename,
    enum pix_fmt     fmt,
    struct raw_data* img_data,
    const gchar*     plugin_name
) {
    gint32 img;
    FILE *file;

    file = fopen(filename, "rb");
    if (!file)
    {
	show_message("can't open file for reading");
	return(ERROR);
    }
    img = load_raw(filename, file, fmt, img_data, plugin_name);
    fclose (file);

    return img;
}
Пример #15
0
void die(const char *fmt, ...)
{
  va_list ap;
  char str[1024];

  va_start(ap, fmt);
  vsnprintf(str, sizeof str, fmt, ap);
  va_end(ap);

  show_message("fatal error: %s", str);

#ifdef ZTERP_GLK
#ifdef GARGLK
  fprintf(stderr, "%s\n", str);
#endif
  glk_exit();
#endif

  exit(EXIT_FAILURE);
}
Пример #16
0
// Converte o arquivo skill_improvise_db.txt para SQL.
void convert_skill_improvise_db(void)
{
	FILE *fread, *fwrite;
	char line[1024], path[256];
	int count = 0, i;

	sprintf(path, "%s", "db/skill_improvise_db.txt");

	if (!(fread = fopen(path, "r")))
		return;

	fwrite = fopen("sql/skill_improvise_db.sql", "w+");

	while (fgets(line, sizeof(line), fread) != NULL) {
		char *token, buf[1024], write[1024], *pos = buf;

		if ((line[0] == '/' && line[1] == '/') || line[0] == '\n')
			continue;

		line[strlen(line)-1] = '\0';
		token = strtok(line, ",");

		for (i = 0; i < 2; i++) {
			if (i) {
				pos += sprintf(pos, ",");
			}

			pos += sprintf(pos, "%d", atoi(token));
			token = strtok(NULL, ",");
		}

		snprintf(write, sizeof(write), "REPLACE INTO skill_improvise_db VALUES(%s);\n", buf);
		fprintf(fwrite, write);
		count++;
	}

	show_message(LIGHT_GREEN, "File %s successfully converted! rows affected: %d\n", path, count);
	fclose(fread);
	fclose(fwrite);
	file_count++;
}
Пример #17
0
void UserInterface::exec_stream(FILE *fp)
{
    LineReader reader;
    char *line;
    string s;
    while ((line = reader.next(fp)) != NULL) {
        if (ctx_->get_verbosity() >= 0)
            show_message(kQuoted, string("> ") + line);
        s += line;
        if (*(s.end() - 1) == '\\') {
            s.resize(s.size()-1);
            continue;
        }
        Status r = execute_line(s);
        if (r != kStatusOk)
            break;
        s.clear();
    }
    if (line == NULL && !s.empty())
        throw SyntaxError("unfinished line");
}
Пример #18
0
void move_points_on (xgobidata *xg)
{
/*
 *  If this mode is currently selected, turn it off.
*/
  if (xg->prev_plot_mode == MOVEPTS_MODE && xg->plot_mode != MOVEPTS_MODE)
  {
    xg->is_point_moving = False;
    XtRemoveEventHandler(xg->workspace,
      XtAllEvents, TRUE,
      (XtEventHandler) mp_button, (XtPointer) xg);
    map_move_points(xg, False);
    xg->nearest_point = -1;
    plot_once(xg);
  }
  /* Else -- if xyplotting -- turn it on */
  else if (xg->plot_mode == MOVEPTS_MODE &&
           xg->prev_plot_mode != MOVEPTS_MODE)
  {
    if (xg->is_xyplotting || xg->is_spinning ||
      (xg->is_touring && !xg->is_pp) ||
      (xg->is_corr_touring && !xg->is_corr_pursuit))
    {
      xg->is_point_moving = True;
      map_move_points(xg, True);
      XtAddEventHandler(xg->workspace,
        ButtonPressMask | ButtonReleaseMask, FALSE,
        (XtEventHandler) mp_button, (XtPointer) xg);
      (void) XtAppAddWorkProc(app_con, RunWorkProcs, (XtPointer) NULL);
      /* Should use a different cursor ... */

    } else {
      show_message("Moving points won\'t work in this mode; sorry\n", xg);

      /*
       * It may be necessary to disable point moving if xg->std_type != 0
      */
    }
  }
}
Пример #19
0
void send_result(int bluepts[4], int whitepts[4], char blue_vote, char white_vote, 
		 char blue_hansokumake, char white_hansokumake, gint legend, gint hikiwake)
{
    memset(&msgout, 0, sizeof(msgout));

    if (current_category < 10000 || current_match >= 1000) {
        return;
    }
    msgout.type = MSG_RESULT;
    msgout.u.result.tatami = tatami;
    msgout.u.result.category = current_category;
    msgout.u.result.match = current_match;
    msgout.u.result.minutes = get_match_time();
    msgout.u.result.legend = legend;

    msgout.u.result.blue_score = array2int(bluepts); 
    msgout.u.result.white_score = array2int(whitepts);
    msgout.u.result.blue_vote = hikiwake ? 1 : blue_vote; 
    msgout.u.result.white_vote = hikiwake ? 1 : white_vote;
    msgout.u.result.blue_hansokumake = blue_hansokumake;
    msgout.u.result.white_hansokumake = white_hansokumake;

    if (msgout.u.result.blue_score != msgout.u.result.white_score ||
        msgout.u.result.blue_vote != msgout.u.result.white_vote || hikiwake ||
        msgout.u.result.blue_hansokumake || msgout.u.result.white_hansokumake) {
#if 0
        if (demo)
            while(time(NULL) % 20 != 0)
                ;
#endif
        send_packet(&msgout);
        result_send_time = time(NULL);
    }

#if 0
    show_message("", "", "", "", "", "");
    current_category = 0;
    current_match = 0;
#endif
}
Пример #20
0
DEFINE_LOADER_PLUGIN_IDENTIFY(p __attribute__((unused)), st, vw __attribute__((unused)), c __attribute__((unused)), priv __attribute__((unused)))
{
  unsigned char buf[3];

  if (stream_read(st, buf, 3) != 3)
    return LOAD_NOT;

  if (memcmp(buf, "GIF", 3) != 0)
    return LOAD_NOT;

  if (stream_read(st, buf, 3) != 3)
    return LOAD_NOT;

  if (memcmp(buf, "87a", 3) == 0)
    return LOAD_OK;
  if (memcmp(buf, "89a", 3) == 0)
    return LOAD_OK;

  show_message("GIF detected, but version is neither 87a nor 89a.\n");

  return LOAD_OK;
}
Пример #21
0
// Converte o arquivo const.txt para SQL.
void convert_const_db(void)
{
	FILE *fread, *fwrite;
	char line[1024], path[256];
	int count = 0;

	sprintf(path, "%s", "db/const.txt");

	if (!(fread = fopen(path, "r")))
		return;

	fwrite = fopen("sql/const_db.sql", "w+");

	while (fgets(line, sizeof(line), fread) != NULL) {
		char write[1024], name[1024], val[1024];
		int type = 0;

		if ((line[0] == '/' && line[1] == '/') || line[0] == '\n')
			continue;

		line[strlen(line)-1] = '\0';

		if(sscanf(line,"%1023[A-Za-z0-9/_],%1023[A-Za-z0-9/_-],%d",name,val,&type)>=2 ||
		   sscanf(line,"%1023[A-Za-z0-9/_] %1023[A-Za-z0-9/_-] %d",name,val,&type)>=2){
			if(type)
				snprintf(write, sizeof(write), "REPLACE INTO const_db VALUES('%s','%s',%d);\n", name, val, type);
			else
				snprintf(write, sizeof(write), "REPLACE INTO const_db VALUES('%s','%s',%s);\n", name, val, "NULL");
			fprintf(fwrite, write);
			count++;
		}
	}

	show_message(LIGHT_GREEN, "File %s successfully converted! rows affected: %d\n", path, count);
	fclose(fread);
	fclose(fwrite);
	file_count++;
}
Пример #22
0
static void
start_animation (ply_boot_splash_plugin_t *plugin)
{
  ply_list_node_t *node;

  assert (plugin != NULL);
  assert (plugin->loop != NULL);

  redraw_views (plugin);

  if (plugin->message != NULL)
    show_message (plugin);

  if (plugin->is_animating)
     return;

  node = ply_list_get_first_node (plugin->views);
  while (node != NULL)
    {
      ply_list_node_t *next_node;
      view_t *view;

      view = ply_list_node_get_data (node);
      next_node = ply_list_get_next_node (plugin->views, node);

      view_start_animation (view);

      node = next_node;
    }

  plugin->is_animating = true;

  animate_frame (plugin, 0);
  ply_event_loop_watch_for_timeout (plugin->loop, 1.0,
                                    (ply_event_loop_timeout_handler_t)
                                    on_timeout, plugin);
}
Пример #23
0
/* Formatted output of single message */
static int
do_show_single (void *ctx,
		notmuch_query_t *query,
		const notmuch_show_format_t *format,
		sprinter_t *sp,
		notmuch_show_params_t *params)
{
    notmuch_messages_t *messages;
    notmuch_message_t *message;
    notmuch_status_t status;
    unsigned int count;

    status = notmuch_query_count_messages_st (query, &count);
    if (print_status_query ("notmuch show", query, status))
	return 1;

    if (count != 1) {
	fprintf (stderr, "Error: search term did not match precisely one message.\n");
	return 1;
    }

    status = notmuch_query_search_messages_st (query, &messages);
    if (print_status_query ("notmuch show", query, status))
	return 1;

    message = notmuch_messages_get (messages);

    if (message == NULL) {
	fprintf (stderr, "Error: Cannot find matching message.\n");
	return 1;
    }

    notmuch_message_set_flag (message, NOTMUCH_MESSAGE_FLAG_MATCH, 1);

    return show_message (ctx, format, sp, message, 0, params)
	!= NOTMUCH_STATUS_SUCCESS;
}
Пример #24
0
void dx_renderer::sound_record(char *file)
{
	if (file){
		b_sound=true;

		WAVEFORMATEX wfx;
		wfx.wFormatTag = WAVE_FORMAT_PCM;
		wfx.wBitsPerSample = 16;
		wfx.cbSize = 0;
		wfx.nChannels = 2;
		wfx.nSamplesPerSec = 44100;
		wfx.nBlockAlign = wfx.wBitsPerSample / 8 * wfx.nChannels;
		wfx.nAvgBytesPerSec = wfx.nSamplesPerSec * wfx.nBlockAlign;
		wav=new CWaveSoundWrite;
		wav->Open(file,&wfx);
		snd_size=0;
	}
	else{
		delete wav;
		wav=NULL;
		b_sound=false;
		show_message("sound record stopped              ");
	}
}
Пример #25
0
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
int main(int argc, char **argv)
{
  int menu_index;
  const union syslinux_derivative_info *sdi;

  openconsole(&dev_stdcon_r, &dev_stdcon_w);

  lowmem_buf = __com32.cs_bounce;
  lowmem_buf_size = __com32.cs_bounce_size;

  sdi = syslinux_derivative_info();

  gfx_config.sector_shift = sdi->disk.sector_shift;
  gfx_config.boot_drive = sdi->disk.drive_number;

  if(sdi->c.filesystem == SYSLINUX_FS_PXELINUX) {
    gfx_config.sector_shift = 11;
    gfx_config.boot_drive = 0;
  }

  gfx_config.media_type = gfx_config.boot_drive < 0x80 ? 1 : 0;

  if(sdi->c.filesystem == SYSLINUX_FS_ISOLINUX) {
    gfx_config.media_type = sdi->iso.cd_mode ? 0 : 2;
  }

  gfx_config.bootloader = 1;
  gfx_config.sysconfig_size = sizeof gfx_config;
  gfx_config.bootloader_seg = 0;	// apparently not needed

  save_buf_size = lowmem_buf_size;
  save_buf = malloc(save_buf_size);

  if(argc < 2) {
    printf("Usage: gfxboot.c32 bootlogo_file [message_file]\n");
    if(argc > 2) show_message(argv[2]);

    return 0;
  }

  if(read_config_file()) {
    printf("Error reading config file\n");
    if(argc > 2) show_message(argv[2]);

    return 0;
  }

  if(gfx_init(argv[1])) {
    printf("Error setting up gfxboot\n");
    if(argc > 2) show_message(argv[2]);

    return 0;
  }

  gfx_menu_init();

  for(;;) {
    menu_index = gfx_input();

    // abort gfx, return to text mode prompt
    if(menu_index == -1) {
      gfx_done();
      break;
    }

    // does not return if it succeeds
    boot(menu_index);
  }

  if(argc > 2) show_message(argv[2]);

  return 0;
}
void main()
	{
	int choice;
		double edge[20][3]=
				{
			100,0,0,
			100,100,0,
			0,100,0,
			0,100,100,
			0,0,100,
			0,0,0,
			100,0,0,
			100,0,100,
			100,75,100,
			75,100,100,
			100,100,75,
			100,100,0,
			100,100,75,
			100,75,100,
			75,100,100,
			0,100,100,
			0,100,0,
			0,0,0,
			0,0,100,
			100,0,100
				};
		while(1)
			{
		clrscr();
			show_message();
		cout<<"\n1:==> Draw Cube "<<endl;
		cout<<"2:==> Scaling "<<endl;
		cout<<"3:==> Rotation "<<endl;
		cout<<"4:==> Reflection "<<endl;
		cout<<"5:==> Translation "<<endl;
		cout<<"6:==> Perspective Projection "<<endl;
		cout<<"7:==> Exit "<<endl;
		cout<<" Enter Your Choice :=";
			cin>>choice;
		switch(choice)
			 {
			 case 1:
				draw_cube(edge);
				break;

			 case 2:
				scale(edge);
				break;

			 case 3:
				rotate(edge);
				break;

			 case 4:
				reflect(edge);
				break;

			 case 5:
				translate(edge);
				break;

			 case 6:
					perspect(edge);
				break;

			 case 7:
				exit(0);

					 default:
						cout<<" Press A Valid Key...!!! ";
							getch();
							break;
			 }
			closegraph();
			}
	}
Пример #27
0
static void
display_message (ply_boot_splash_plugin_t *plugin,
                 const char               *message)
{
        show_message (plugin, message);
}
Пример #28
0
void I2C_stop(){ //Instead of a function, can use a #define macro as well since we're not waiting for it to return anything
	if(ENABLE_DEBUG) show_message(0,0, "stop     ");
	TWCR |= (1<<TWINT)|(1<<TWEN)|(1<<TWSTO);
	while(TWCR & (1<<TWSTO));
}
Пример #29
0
/**
 * \fn void show_error (char *msg)
 * \brief Function to show a dialog with an error message.
 * \param msg
 * \brief Error message.
 */
void
show_error (char *msg)
{
  show_message (gettext ("ERROR!"), msg, ERROR_TYPE);
}
Пример #30
0
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
int main(int argc, char **argv)
{
  int menu_index;
  const union syslinux_derivative_info *sdi;
  char working_dir[256];

  openconsole(&dev_stdcon_r, &dev_stdcon_w);

  lowmem_buf = lmalloc(LOWMEM_BUF_SIZE);
  if (!lowmem_buf) {
    printf("Could not allocate memory.\n");
    return 1;
  }

  sdi = syslinux_derivative_info();

  gfx_config.sector_shift = sdi->disk.sector_shift;
  gfx_config.boot_drive = sdi->disk.drive_number;

  if(sdi->c.filesystem == SYSLINUX_FS_PXELINUX) {
    gfx_config.sector_shift = 11;
    gfx_config.boot_drive = 0;
  }

  gfx_config.media_type = gfx_config.boot_drive < 0x80 ? 1 : 0;

  if(sdi->c.filesystem == SYSLINUX_FS_ISOLINUX) {
    gfx_config.media_type = sdi->iso.cd_mode ? 0 : 2;
  }

  gfx_config.bootloader = 1;
  gfx_config.sysconfig_size = sizeof gfx_config;
  gfx_config.bootloader_seg = 0;	// apparently not needed

  if(argc < 2) {
    printf("Usage: gfxboot.c32 bootlogo_file [message_file]\n");
    if(argc > 2) show_message(argv[2]);

    return 0;
  }

  if(read_config_file("~")) {
    printf("Error reading config file\n");
    if(argc > 2) show_message(argv[2]);

    return 0;
  }

  if(getcwd(working_dir, sizeof working_dir)) {
    gfx_config.gfxboot_cwd = (uint32_t) working_dir;
  }

  if(gfx_init(argv[1])) {
    printf("Error setting up gfxboot\n");
    if(argc > 2) show_message(argv[2]);

    return 0;
  }

  gfx_menu_init();

  for(;;) {
    menu_index = gfx_input();

    // abort gfx, return to text mode prompt
    if(menu_index == -1) {
      gfx_done();
      break;
    }

    // does not return if it succeeds
    boot(menu_index);
  }

  if(argc > 2) show_message(argv[2]);

  return 0;
}