/** * enter_event_loop -- begin execution of the game loop * * After initialization and set-up, this is where the flow of control will * reside for the vast majority of the process lifetime. It will only be * exited in order to handle a termination signal, or as a response to a * user's "quit" command. */ void enter_event_loop(void) { #define REPEAT_PERIOD 0.025f #define ANIMATE_PERIOD 3.5f #define FLOW_PERIOD 0.08f struct ev_loop *readloop = EV_DEFAULT; struct ev_loop *execloop = EV_DEFAULT; ev_io read; // stdin is readable ev_timer render; // things which must occur once per tick ("atomic") ev_timer flow; // water and weather effects, some physics ev_timer animate; // long-period animations of the map window ev_io_init(&read, &iolisten_cb, 0, EV_READ); ev_init(&render, &render_cb); ev_init(&animate, &animate_cb); ev_init(&flow, &flow_cb); render.repeat = REPEAT_PERIOD; animate.repeat = ANIMATE_PERIOD; flow.repeat = FLOW_PERIOD; ev_timer_again(execloop, &render); ev_timer_again(execloop, &animate); ev_timer_again(execloop, &flow); loop_test(true); ev_io_start(readloop, &read); ev_run(execloop, 0); }
/* * Test for the pixel movement. */ int main(int argc, char **argv) { Solarus solarus(argc, argv); basic_test(); loop_test(); syntax_test(); empty_test(); restart_test(); list_test(); return 0; }
int main (int argc, char **argv) { gcc_jit_context *ctxt = NULL; gcc_jit_result *result = NULL; /* Get a "context" object for working with the library. */ ctxt = gcc_jit_context_acquire (); if (!ctxt) { fprintf (stderr, "NULL ctxt"); goto error; } /* Set some options on the context. Let's see the code being generated, in assembler form. */ gcc_jit_context_set_bool_option ( ctxt, GCC_JIT_BOOL_OPTION_DUMP_GENERATED_CODE, 0); /* Populate the context. */ create_code (ctxt); /* Compile the code. */ result = gcc_jit_context_compile (ctxt); if (!result) { fprintf (stderr, "NULL result"); goto error; } /* Extract the generated code from "result". */ typedef int (*loop_test_fn_type) (int); loop_test_fn_type loop_test = (loop_test_fn_type)gcc_jit_result_get_code (result, "loop_test"); if (!loop_test) { fprintf (stderr, "NULL loop_test"); goto error; } /* Run the generated code. */ int val = loop_test (10); printf("loop_test returned: %d\n", val); error: gcc_jit_context_release (ctxt); gcc_jit_result_release (result); return 0; }
int main(int argc, char **argv) { string_test(); printf("1111111111111\n"); expr_test(); printf("1111111111111\n"); macro_test(); scope_test(); forward_test(); funcptr_test(); loop_test(); switch_test(); goto_test(); enum_test(); typedef_test(); struct_test(); array_test(); expr_ptr_test(); bool_test(); expr2_test(); constant_expr_test(); expr_cmp_test(); char_short_test(); init_test(); compound_literal_test(); kr_test(); struct_assign_test(); cast_test(); bitfield_test(); c99_bool_test(); float_test(); longlong_test(); manyarg_test(); stdarg_test(); whitespace_test(); relocation_test(); old_style_function(); alloca_test(); sizeof_test(); typeof_test(); statement_expr_test(); local_label_test(); asm_test(); builtin_test(); return 0; }
int main() { printf("hello world!\n"); print_test(); loop_test(); }
/* C entry. * * \param argc the number of arguments. * \param argv the arguments. * * DO NOT CHANGES THE NAME OF PARAMETERS, otherwise your program will get * a compile error if you are using INIT_CMD_PIPE macro. */ int main(int argc, char *argv[]) { char device_node_path[256]; int setup_delay; int call_time; int loop_ctl_pipe_fd; int loop_mode_flag = 1; int ret = -1; /* init cmd pipe after local variable declaration */ INIT_CMD_PIPE(); init_script(atoi(argv[2])); db_msg("2glooptester\n"); if(script_fetch("loop","device_node",(int*)device_node_path,sizeof(device_node_path)/4)){ db_warn("2glooptester:can't fetch device_node,set to /dev/ttyUSB0\n"); strcpy(device_node_path,"/dev/ttyUSB0"); } db_msg("device_node=%s\n",device_node_path); if(script_fetch("loop","setup_delay",&setup_delay,1)){ db_warn("2glooptester:can't fetch setup_delay,set to 5s\n"); setup_delay=5; } if(script_fetch("loop","call_time",&call_time,1)){ db_warn("2glooptester:can't fetch call_time,set to 30s\n"); call_time=30; } /* single_level=setup_device(device_node_path,setup_delay); if(single_level==0) { SEND_CMD_PIPE_FAIL_EX("can't get single level"); return -1; }*/ loop_ctl_pipe_fd = open(LOOP_CTL_PIPE_NAME,O_RDONLY ,0); if(loop_ctl_pipe_fd==NULL){ printf("2glooptester:fail to open loop_ctl_pipe\n"); } setup_device(device_node_path,setup_delay); LOOP_TEST: if(enter_loop_mode()){ SEND_CMD_PIPE_FAIL_EX("failed:loop\n"); return 0; } if(loop_test()){ SEND_CMD_PIPE_FAIL_EX("failed:sound_loop\n"); return 0; } SEND_CMD_PIPE_OK(); //call time delay,you can speak th each other in this time // sleep(call_time); // exit_loop_mode(); /* send OK to core if test OK, otherwise send FAIL * by using SEND_CMD_PIPE_FAIL(). */ SEND_CMD_PIPE_OK_EX("test done"); while(1){ db_msg("get loop_ctl_pipe\n"); ret = read(loop_ctl_pipe_fd,&loop_mode_flag,sizeof(loop_mode_flag)); if(ret == -1){ db_msg("no data avlaible\n"); } db_msg("loop mode ON \n"); if(!loop_mode_flag){ db_msg("exit_loop_mode\n"); exit_loop_mode(); break; } sleep(1); } while(1){ ret = read(loop_ctl_pipe_fd,&loop_mode_flag,sizeof(loop_mode_flag)); if(ret == -1){ db_msg("no data avlaible\n"); } db_msg("loop mode OFF \n"); sleep(2); if(loop_mode_flag) goto LOOP_TEST; } close(loop_ctl_pipe_fd); return 0; }
int main(int argc, char **argv) { int x; INIT(); if (argc > 2 && strcmp("-bind_now", argv[1])) { #ifdef WINDOWS print("-bind_now is Linux-only\n"); #else /* Re-exec the test with LD_BIND_NOW in the environment to force eager * binding. */ setenv("LD_BIND_NOW", "1", true/*overwrite*/); execv(argv[0], argv); #endif } print("calling via IAT-style call\n"); import_me1(57); /* XXX: Should assert that &import_me2 is within the bounds of the current * module, since that's what we want to test. */ print("calling via PLT-style call\n"); call_plt(&import_me2); /* funky ind call is only caught by us w/ -native_exec_guess_calls * FIXME: add a -no_native_exec_guess_calls runregression run * for that run: * FIXME: assert curiosity in debug run, would like to add to template! * FIXME: have way for nativeexec.dll.c to know whether native or not? * call DR routine? * then can have release build die too * * 06:13 PM ~/dr/suite/tests * % useops -no_native_exec_guess_calls * % make win32/nativeexec.runinjector * PASS * % make DEBUG=yes win32/nativeexec.runinjector * > <CURIOSITY : false && "inside native_exec dll" in file x86/interp.c line 1967 */ print("calling via funky ind call\n"); call_funky(&import_me3); print("calling nested native\n"); import_me4(print_int, 42); print("calling cross-module unwinder\n"); unwind_level1(unwind_setjmp, 3); print("calling indirect ret_imm\n"); x = call_ret_imm(import_ret_imm); print(" -> %d\n", x); /* i#1077: If the appdll is native, then DR inserts a back_from_native * retaddr. The appdll then does a tail call */ print("calling tail caller\n"); tail_caller(print_int, 35); print("calling loop_test\n"); loop_test(); print("all done\n"); return 0; }