/** * Create a new program line with number 'number' and the command in 's'. */ void create_line(unsigned int number, char *s) { unsigned char command; char * args; program_line * new_line; args = find_args(s); command = find_keyword(s); if (command != CMD_UNKNOWN) { delete_line(number); new_line = malloc(sizeof(program_line)); new_line->number = number; new_line->command = command; new_line->args = malloc(strlen(args) + 1); strcpy(new_line->args, args); if (program && number > program->number) { program_line *line = program; while (line->next && number > line->next->number) { line = line->next; } new_line->next = line->next; line->next = new_line; } else { new_line->next = program; program = new_line; } } else { lcd_puts("Unknown command!\n"); } }
/** * Execute the BASIC command in 's'. */ void execute(char *s) { unsigned char command; char * args; reset_interrupted(); s = skip_whitespace(s); args = find_args(s); command = find_keyword(s); if (command != CMD_UNKNOWN) { command_functions[command](args); } else { lcd_puts("Unknown command!\n"); } }
int main(int num_args, char **args) { Sarl_Relation *r; Sarl_Set *s; Sarl_RelationIterator *r_it; Sarl_SetIterator *intent; Sarl_SetIterator *s_it; bool TRACE_OUTPUT = (find_args(num_args, args, "-trace") != 0); int i, j; int LEN = 10; r = sarl_relation_create(); s = sarl_set_create(); for(i=1;i<=LEN;i++) { for(j=1;j<=LEN;j++) { if ( i % j == 0 ) { sarl_relation_insert(r, i, j); } } } sarl_set_insert(s, 6); // sarl_set_insert(s, 8); r_it = sarl_relation_iterator_create(r); s_it = sarl_set_iterator_create(s); sarl_set_iterator_reset(s_it); intent = sarl_relation_iterator_intent_set(r_it, s_it); SARL_TEST_ASSERT(intent != 0); SARL_TEST_ASSERT_EQ(sarl_set_iterator_count(intent), 4); sarl_set_iterator_decr_ref(intent); sarl_set_decr_ref(s); sarl_relation_decr_ref(r); sarl_relation_iterator_decr_ref(r_it); sarl_set_iterator_decr_ref(s_it); };
struct prom_pmemblock * __init prom_getmdesc(void) { char *memsize_str; unsigned int memsize; char tmp_cmdline[COMMAND_LINE_SIZE]; char *tmp_str; strlcpy(tmp_cmdline, arcs_cmdline, COMMAND_LINE_SIZE); tmp_str = find_args(tmp_cmdline, "debug_ros"); if (tmp_str) { sscanf(tmp_str, "%x", &audio_addr); debug_flag = 1; } if (audio_addr == 0) { audio_addr = *((unsigned int *)0xa00000d8); audio_addr = reverseInt(audio_addr); } if ((audio_addr < 0x81000000) || (audio_addr >= 0x82000000)) { printk("**************************************************************\n"); printk("You didn't specify audio image address, use default instead...\n"); printk("**************************************************************\n"); audio_addr = 0; } memsize_str = prom_getenv("memsize"); if (!memsize_str) { prom_printf("memsize not set in boot prom, set to default (32Mb)\n"); memsize = 0x02000000; } else { #ifdef DEBUG prom_printf("prom_memsize = %s\n", memsize_str); #endif memsize = simple_strtol(memsize_str, NULL, 0); if (memsize < 0x02000000) { panic("memsize cannot be less then 32Mb.\n"); } } memset(mdesc, 0, sizeof(mdesc)); #ifdef CONFIG_REALTEK_MARS_RESERVE_LAST_48MB if (memsize == 0x10000000) memsize -= 0x03000000; #endif // The last page is used to store the DRAM calibration parameter; // Jacky says that this page can be included in his RTOS memory region. // mdesc[4].type = yamon_dontuse; // mdesc[4].base = memsize - 4096; // mdesc[4].size = 4096; #if CONFIG_REALTEK_RTOS_MEMORY_SIZE // If memsize is over 32Mb if(memsize > 0x02000000) { mdesc[4].type = yamon_free; mdesc[4].base = 0x02000000; mdesc[4].size = memsize - 0x02000000; } // This memory region is used by RTOS. mdesc[3].type = yamon_dontuse; // mdesc[3].base = mdesc[4].base - CONFIG_REALTEK_RTOS_MEMORY_SIZE; if (audio_addr != 0) { audio_addr = audio_addr-0x80000000; mdesc[3].base = audio_addr; mdesc[3].size = 0x02000000 - audio_addr; } else { mdesc[3].base = 0x02000000 - CONFIG_REALTEK_RTOS_MEMORY_SIZE; mdesc[3].size = CONFIG_REALTEK_RTOS_MEMORY_SIZE; } printk("audio addr: %x \n", audio_addr); // Kernel image is stored in 0x100000 - CPHYSADDR(PFN_ALIGN(&_end)). mdesc[2].type = yamon_free; mdesc[2].base = CPHYSADDR(PFN_ALIGN(&_end)); mdesc[2].size = mdesc[3].base - CPHYSADDR(PFN_ALIGN(&_end)); #else // Kernel image is stored in 0x100000 - CPHYSADDR(PFN_ALIGN(&_end)). mdesc[2].type = yamon_free; mdesc[2].base = CPHYSADDR(PFN_ALIGN(&_end)); mdesc[2].size = memsize - CPHYSADDR(PFN_ALIGN(&_end)); #endif mdesc[1].type = yamon_dontuse; mdesc[1].base = 0x100000; mdesc[1].size = CPHYSADDR(PFN_ALIGN(&_end))-0x100000; mdesc[0].type = yamon_free; mdesc[0].base = 0x0; mdesc[0].size = 0x100000; return &mdesc[0]; }