static void test_variables( libvlc_instance_t *p_vlc ) { libvlc_int_t *p_libvlc = p_vlc->p_libvlc_int; srand( time( NULL ) ); log( "Testing for integers\n" ); test_integer( p_libvlc ); log( "Testing for booleans\n" ); test_booleans( p_libvlc ); log( "Testing for floats\n" ); test_floats( p_libvlc ); log( "Testing for strings\n" ); test_strings( p_libvlc ); log( "Testing for addresses\n" ); test_address( p_libvlc ); log( "Testing the callbacks\n" ); test_callbacks( p_libvlc ); log( "Testing the limits\n" ); test_limits( p_libvlc ); log( "Testing choices\n" ); test_choices( p_libvlc ); log( "Testing var_Change()\n" ); test_change( p_libvlc ); log( "Testing type at creation\n" ); test_creation_and_type( p_libvlc ); }
int main(void) { range_select(); init_timer0(); init_ADC(); init_7Seg(); init_led(); while(1) { int r = 0; if(read_ADC()) r = calc_resist(read_ADC()); test_limits(r); printbuf(r); _delay_ms(150); } }
void opt_proc(int argc, char *argv[]) { // specify default values fin_base[0]=0; output_dir[0]=0; ipar[0] = 0; ipar[1] = 20; ipar[2] = 1; ipar[3] = 1; ipar[4] = 1; ipar[5] = 5; ipar[6] = 3; ipar[7] = 1; dpar[0] = 0.5; dpar[1] = 1.0; dpar[2] = 0.0; int *lofa=(int*)(&long_option_flag); // long option flag address static struct option long_options[] = { {"ascii", no_argument,0,'a'}, {"binary", no_argument,0,'b'}, {"extraction-order",required_argument,lofa,EXTRACTION_ORDER}, {"file", required_argument,0,'f'}, {"help", no_argument,0,'h'}, {"save-parameters",optional_argument,lofa,SAVE_PARAMETERS}, {"set-M", required_argument,lofa,SET_M}, {"set-Nd", required_argument,lofa,SET_ND}, {"set-pad", required_argument,lofa,SET_PAD}, {"set-rule1", required_argument,lofa,SET_RULE1}, {"set-rule2", required_argument,lofa,SET_RULE2}, {"set-nu", required_argument,lofa,SET_NU}, {"set-nv", required_argument,lofa,SET_NV}, {"set-num_threads",required_argument,0,'j'}, {"set-gfactor", required_argument,lofa,SET_GFACTOR}, {"set-mua", required_argument,lofa,SET_MUA}, {"set-mus", required_argument,lofa,SET_MUS}, {"test", no_argument,0,'t'}, {"verbose", no_argument,0,'v'}, {0,0,0,0} }; int option_index=0; int c; while ( (c=getopt_long_only(argc,argv,"abf:hj:o:tv",long_options,&option_index)) != -1) { switch (c) { case 0: //switch (long_options[option_index].flag) if (long_option_flag==EXTRACTION_ORDER) { sscanf(optarg,"%d",&extraction_order); //printf("extraction_order = %d\n",ipar[0]); } else if (long_option_flag==SAVE_PARAMETERS) { save_parameters_flag=1; if (!optarg) strcpy(fout_pars,"solver_v1_pars"); else strcpy(fout_pars,optarg); } else if (long_option_flag==SET_M) sscanf(optarg,"%d",ipar); else if (long_option_flag==SET_ND) sscanf(optarg,"%d",ipar+1); else if (long_option_flag==SET_PAD) sscanf(optarg,"%d",ipar+2); else if (long_option_flag==SET_RULE1) sscanf(optarg,"%d",ipar+3); else if (long_option_flag==SET_RULE2) sscanf(optarg,"%d",ipar+4); else if (long_option_flag==SET_NU) sscanf(optarg,"%d",ipar+5); else if (long_option_flag==SET_NV) sscanf(optarg,"%d",ipar+7); // has been merged with short option -j //else if (long_option_flag==SET_NUM_THREADS) //sscanf(optarg,"%d",ipar+8); else if (long_option_flag==SET_GFACTOR) sscanf(optarg,"%lf",dpar); else if (long_option_flag==SET_MUA) sscanf(optarg,"%lf",dpar+1); else if (long_option_flag==SET_MUS) sscanf(optarg,"%lf",dpar+2); break; case 'a': format=1; break; case 'b': format=2; break; case 'f': read_pars_from_file(optarg); break; case 'h': print_usage(); exit(0); break; case 'j': sscanf(optarg,"%d",ipar+8); break; case 't': test_limits(); exit(0); break; case 'v': verbose_flag=1; break; case 'o': strcpy(output_dir,optarg); break; case '?': printf("%s\n",optarg); print_usage(); exit(1); break; default: abort(); } } // The remaining command line arguments is the input mesh files if (optind>=argc) { printf("Requires a base name for the input file as argument!\n"); print_usage(); exit(1); } strcpy(fin_base,argv[optind]); {// Delete int extension ".msh", if any. // might remove this function later char * temp= strstr(fin_base,".msh"); if (temp) *temp=0; } if (save_parameters_flag) save_pars_to_file(fout_pars); if (output_dir[0]==0) strcpy(output_dir,"SOL"); }