int main() { if (!ExampleFileUsage()) { std::cerr << "ExampleFileUsage failed" << std::endl; return 1; } std::cerr << "ExampleFileUsage successful" << std::endl; if (!example2()) { std::cerr << "example2 failed" << std::endl; return 1; } std::cerr << "example2 successful" << std::endl; if (!example3()) { std::cerr << "example3 failed" << std::endl; return 1; } std::cerr << "example3 successful" << std::endl; return 0; }
int main() { example1(); example2(); example3(); example4(); return 0; }
void nextArgument() const { givenACodeSampleToTokenize example1("foo(1, 2, 3, 4);"); ASSERT_EQUALS(true, Token::simpleMatch(example1.tokens()->tokAt(2)->nextArgument(), "2 , 3")); ASSERT_EQUALS(true, Token::simpleMatch(example1.tokens()->tokAt(4)->nextArgument(), "3 , 4")); givenACodeSampleToTokenize example2("foo();"); ASSERT_EQUALS(true, example2.tokens()->tokAt(2)->nextArgument() == 0); givenACodeSampleToTokenize example3("foo(bar(a, b), 2, 3);"); ASSERT_EQUALS(true, Token::simpleMatch(example3.tokens()->tokAt(2)->nextArgument(), "2 , 3")); givenACodeSampleToTokenize example4("foo(x.i[1], \"\", 3);"); ASSERT_EQUALS(true, Token::simpleMatch(example4.tokens()->tokAt(2)->nextArgument(), "\"\" , 3")); }
int main () { int semid, shmid; unsigned short seminit[NUM_SEMS]; struct common *shared; union semun semctlarg; struct customer *first_in_line; semid = semget(SEMKEY, NUM_SEMS, 0777 | IPC_CREAT); if (semid < 0) { perror("Could not get semaphores"); exit(EXIT_FAILURE); } seminit[SEM_MUTEX]=1; seminit[SEM_WAITLIST]=0; semctlarg.array = seminit; semctl(semid, NUM_SEMS, SETALL, semctlarg); shmid = shmget(SHMKEY, sizeof(struct common), 0777 | IPC_CREAT); if (shmid < 0) { perror("Could not get shared memory"); exit(EXIT_FAILURE); } shared=(struct common *)shmat(shmid, 0, 0); shared->wait_count = 0; shared->balance = 500; shmid = shmget(LINESTART, sizeof(struct customer), 0777 | IPC_CREAT); if (shmid < 0) { perror("Could not get shared memory"); exit(EXIT_FAILURE); } first_in_line = (struct customer *)shmat(shmid, 0, 0); shared->customer_offset = LINESTART; shared->front_of_line = LINESTART; example1(); example2(); example3(); semctl(semid, NUM_SEMS, IPC_RMID, 0); shmctl(shmid, IPC_RMID, 0); return EXIT_SUCCESS; }
/*--------------------------------------------------------------------------*/ int main(void) /* int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance,LPSTR szCmdLine, int iCmdShow) */ { if ( StartScilab(NULL, NULL, NULL) == FALSE ) printf("Error : StartScilab\n"); printf("\nexample 1\n"); example1(); printf("\npress return\n"); getchar(); printf("\nexample 2\n"); example2(); printf("\npress return\n"); getchar(); printf("\nexample 3\n"); example3(); printf("\npress return\n"); getchar(); if ( TerminateScilab(NULL) == FALSE ) printf("Error : TerminateScilab\n"); return 0; }
int main(int argc, char **argv) { int num; int i; char retval = 0; u_error_t *error = NULL; u_option_entry_t opt[] = { {"debug", 'd', U_OPTION_ARG_INT, &debug_level, "Set the verbosity of debugging output.", "1-6"} }; u_option_context_t *opt_ctx; opt_ctx = u_option_context_new(""); u_option_context_set_ignore_unknown_options(opt_ctx, FALSE); u_option_context_add_main_entries(opt_ctx, opt, "wsmid_identify"); retval = u_option_context_parse(opt_ctx, &argc, &argv, &error); u_option_context_free(opt_ctx); if (error) { if (error->message) printf("%s\n", error->message); u_error_free(error); return 1; } u_error_free(error); if (debug_level) { initialize_logging(); wsman_debug_set_level(debug_level); } if (argc == 1) { // execute all example1(); example2(); example3(); example4(); example5(); example6(); example7(); example8(); example9(); example10(); example11(); example12(); example13(); example14(); return 0; } for (i = 1; i < argc; i++) { num = atoi(argv[i]); switch (num) { case 1: example1(); break; case 2: example2(); break; case 3: example3(); break; case 4: example4(); break; case 5: example5(); break; case 6: example6(); break; case 7: example7(); break; case 8: example8(); break; case 9: example9(); break; case 10: example10(); break; case 11: example11(); break; case 12: example12(); break; case 13: example13(); break; case 14: example14(); break; default: printf("\n No example%d()\n", num); break; } } return 0; }
int main(int argc, char **argv) { example3(); }