void RL::Entry::on_xcap_answer (bool error, std::string value) { if (error) { set_note (value); } else { doc = boost::shared_ptr<xmlDoc> (xmlRecoverMemory (value.c_str (), value.length ()), xmlFreeDoc); if ( !doc) doc = boost::shared_ptr<xmlDoc> (xmlNewDoc (BAD_CAST "1.0"), xmlFreeDoc); node = xmlDocGetRootElement (doc.get ()); if (node == NULL || node->name == NULL || !xmlStrEqual (BAD_CAST "entry", node->name)) { set_note (_("Invalid server data")); } else { set_note (""); parse (); updated (); } } }
void menu() { u32 index; new_unselectable_entry("ACNL Cheats 2.2");//USA new_spoiler("Inventory Codes"); index = new_entry("Text to Item", text2item_usa); set_note(TEXT_ITEM_NOTE, index); new_entry("Duplication", duplicate_usa); exit_spoiler(); new_spoiler("Movement Codes"); index = new_entry("Moon Jump", moonjump_usa); set_note(MOON_JUMP_NOTE, index); new_entry("Teleport", teleport_usa); new_entry("Coordinates Modifier", coord_usa); index = new_entry("Speed Hack", speed_usa); set_note(SPEED_HACK_NOTE, index); exit_spoiler(); new_spoiler("Enviroment Codes"); new_entry("Seeder", seed_usa); new_entry("Search and Replace", search_usa); index = new_entry("Instant Tree", tree_usa); set_note(INSTANT_TREE_NOTE, index); exit_spoiler(); }
void set_note (Operation operation, NoteKey key, const Note ¬e) { if (operation.is_phi_handle()) set_note(*operation.get_phi_handle(), key, note); else set_note(*operation.get_instr_handle(), key, note); }
void new_entry_index_note(char *str, const char * const note, void (*function)(void), int identifier) { int index; index = add_new_entry(str, function, identifier); set_note((char *)note, index); }
void new_entry_note(char *str, const char * const note, void (*function)(void)) { int index; index = new_entry(str, function); set_note((char *)note, index); }
void new_toggle_entry_note(char *str, char *note, void (*function)(void), int identifier) { int index; index = add_new_entry(str, function, identifier); update_status(0, identifier); set_note(note, index); }
static void example(void) { if(button_clicked(LEFT)) { set_note(NOTE_C, 4); wait_ms(500); set_note(NOTE_D, 4); wait_ms(500); stop_note(); } if(button_clicked(RIGHT)) { set_note(NOTE_D, 4); wait_ms(500); set_note(NOTE_C, 4); wait_ms(500); stop_note(); } }
void Gmconf::PersonalDetails::set_presence_info (const std::string _presence, const std::string _note) { presence = _presence; note = _note; set_presence (_presence); set_note (_note); updated (); }
void with_note_common(const char *name, const char *note, void (*cheatfunction)(void), int type) { int index; if (type == 0) index = new_entry((char *)name, cheatfunction); else if (type == 1) index = new_radio_entry((char *)name, cheatfunction); else if (type == 2) index = new_spoiler((char *)name); else return; set_note(note, index); }
void defocus(OptUnit *local_unit) { claim(the_local_unit == local_unit); OneNote<long> note = get_note(local_unit, k_vr_count); if (is_null(note)) { note = OneNote<long>(the_vr_count); set_note(local_unit, k_vr_count, note); } else { note.set_value(the_vr_count); } the_vr_count = 0; the_local_scope = NULL; the_local_unit = NULL; }
int main( int argc, /* I */ char **argv) /* I */ { struct batch_status *bstatus = NULL; int con; char *specified_server = NULL; int errflg = 0; int i; extern char *optarg; extern int optind; char **pa; struct batch_status *pbstat; int flag = ALLI; char *note = NULL; enum note_flags note_flag = unused; char **nodeargs = NULL; int lindex; enum NStateEnum ListType = tnsNONE; /* get default server, may be changed by -s option */ progname = strdup(argv[0]); while ((i = getopt(argc, argv, "acdlopqrs:x-:N:n")) != EOF) { switch (i) { case 'a': flag = ALLI; break; case 'c': flag = CLEAR; break; case 'd': flag = DIAG; break; case 'l': flag = LIST; break; case 'o': flag = OFFLINE; break; case 'p': flag = PURGE; break; case 'q': quiet = 1; break; case 'r': flag = RESET; break; case 's': specified_server = optarg; break; case 'x': flag = ALLI; DisplayXML = TRUE; break; case 'N': /* preserve any previous option other than the default, * to allow -N to be combined with -o, -c, etc */ if (flag == ALLI) flag = NOTE; note = strdup(optarg); if (note == NULL) { perror("Error: strdup() returned NULL"); exit(1); } note_flag = set; /* -N n is the same as -N "" -- it clears the note */ if (!strcmp(note, "n")) *note = '\0'; if (strlen(note) > MAX_NOTE) { fprintf(stderr, "Warning: note exceeds length limit (%d) - server may reject it...\n", MAX_NOTE); } if (strchr(note, '\n') != NULL) fprintf(stderr, "Warning: note contains a newline - server may reject it...\n"); break; case 'n': note_flag = list; break; case '-': if ((optarg != NULL) && !strcmp(optarg, "version")) { fprintf(stderr, "Version: %s\nRevision: %s\n", PACKAGE_VERSION, SVN_VERSION); exit(0); } else if ((optarg != NULL) && !strcmp(optarg, "about")) { TShowAbout_exit(); } errflg = 1; break; case '?': default: errflg = 1; break; } /* END switch (i) */ } /* END while (i = getopt()) */ if ((note_flag == list) && (flag != LIST)) { fprintf(stderr, "Error: -n requires -l\n"); errflg = 1; } for (pa = argv + optind;*pa;pa++) { if (strlen(*pa) == 0) { errflg = 1; } } if (errflg != 0) { if (!quiet) { fprintf(stderr, "usage:\t%s [-{c|d|l|o|p|r}] [-s server] [-n] [-N \"note\"] [-q] node ...\n", progname); fprintf(stderr, "\t%s [-{a|x}] [-s server] [-q] [node]\n", progname); } exit(1); } con = cnt2server(specified_server); if (con <= 0) { if (!quiet) { fprintf(stderr, "%s: cannot connect to server %s, error=%d (%s)\n", progname, (specified_server) ? specified_server : pbs_default(), con * -1, pbs_strerror(con * -1)); } exit(1); } /* if flag is ALLI, LIST, get status of all nodes */ if ((flag == ALLI) || (flag == LIST) || (flag == DIAG)) { if ((flag == ALLI) || (flag == LIST) || (flag == DIAG)) { if (flag == LIST) { /* allow state specification */ if (argv[optind] != NULL) { for (lindex = 1;lindex < tnsLAST;lindex++) { if (!strcasecmp(NState[lindex], argv[optind])) { ListType = lindex; optind++; break; } } } } /* allow node specification (if none, then create an empty list) */ if (argv[optind] != NULL) { nodeargs = argv + optind; } else { nodeargs = calloc(2, sizeof(char **)); nodeargs[0] = strdup(""); nodeargs[1] = '\0'; } } } if ((note_flag == set) && (note != NULL)) { /* set the note attrib string on specified nodes */ for (pa = argv + optind;*pa;pa++) { set_note(con, *pa, note); } } switch (flag) { case DIAG: /* NYI */ break; case CLEAR: /* clear OFFLINE from specified nodes */ for (pa = argv + optind;*pa;pa++) { marknode(con, *pa, ND_offline, DECR, NULL, DECR); } break; case RESET: /* clear OFFLINE, add DOWN to specified nodes */ for (pa = argv + optind;*pa;pa++) { marknode(con, *pa, ND_offline, DECR, ND_down, INCR); } break; case OFFLINE: /* set OFFLINE on specified nodes */ for (pa = argv + optind;*pa;pa++) { marknode(con, *pa, ND_offline, INCR, NULL, INCR); } break; case PURGE: /* remove node record */ /* NYI */ break; case ALLI: if (DisplayXML == TRUE) { char *tmpBuf = NULL, *tail = NULL; int bufsize; mxml_t *DE; DE = NULL; MXMLCreateE(&DE, "Data"); for (lindex = 0;nodeargs[lindex] != '\0';lindex++) { bstatus = statnode(con, nodeargs[lindex]); for (pbstat = bstatus;pbstat;pbstat = pbstat->next) { addxmlnode(DE, pbstat); } /* END for (pbstat) */ pbs_statfree(pbstat); } MXMLToXString(DE, &tmpBuf, &bufsize, INT_MAX, &tail, TRUE); MXMLDestroyE(&DE); fprintf(stdout, "%s\n", tmpBuf); } else { for (lindex = 0;nodeargs[lindex] != '\0';lindex++) { bstatus = statnode(con, nodeargs[lindex]); for (pbstat = bstatus;pbstat;pbstat = pbstat->next) { printf("%s\n", pbstat->name); prt_node_attr(pbstat, 0); putchar('\n'); } /* END for (bpstat) */ pbs_statfree(pbstat); } } break; case LIST: /* list any node that is DOWN, OFFLINE, or UNKNOWN */ for (lindex = 0;nodeargs[lindex] != '\0';lindex++) { bstatus = statnode(con, nodeargs[lindex]); for (pbstat = bstatus;pbstat != NULL;pbstat = pbstat->next) { char *S; S = get_nstate(pbstat); if (filterbystate(pbstat, ListType, S)) { char *n; if ((note_flag == list) && (n = get_note(pbstat))) { printf("%-20.20s %-26.26s %s\n", pbstat->name, S, n); } else { printf("%-20.20s %s\n", pbstat->name, S); } } } pbs_statfree(pbstat); } break; } /* END switch (flag) */ pbs_disconnect(con); return(0); } /* END main() */
static void run(void) { if(ir_recv()) { // receive a ir signal, react motor_on(); led_on(RIGHT); set_note(NOTE_B, 5); wait_ms(200); set_note(NOTE_F, 5); wait_ms(100); led_off(RIGHT); led_on(LEFT); set_note(NOTE_G, 5); wait_ms(100); set_note(NOTE_Ab, 5); wait_ms(100); set_note(NOTE_A, 5); wait_ms(100); led_off(LEFT); motor_off(); } else if(button_clicked(RIGHT)) { // button clicked, send ir signal and do some stuff led_on(RIGHT); set_note(NOTE_A, 5); wait_ms(100); set_note(NOTE_Ab, 5); wait_ms(100); set_note(NOTE_G, 5); wait_ms(100); led_off(RIGHT); led_on(LEFT); set_note(NOTE_F, 5); wait_ms(100); set_note(NOTE_B, 5); wait_ms(200); stop_note(); led_off(LEFT); ir_on(); wait_ms(400); ir_off(); wait_ms(10); } else { // regular bug behaviour uint8_t light = photons_measure(); pentatonic_all_led_set(light >> 3); motor_set(biased_random(light) > BASELINE + 0x40); led_set(RIGHT, biased_random(light) > BASELINE + 0x00); led_set(LEFT, biased_random(light) > BASELINE + 0x00); if(biased_random(light) > BASELINE + 0x20) { uint16_t tone = (biased_random(light) * 2) + 500; set_note(tone, 0); } else { stop_note(); } wait_ms(200); } }