/* MaGIC1.c Version of 22-11-89 This is the serial version of MaGIC compatible with xmagic version 1. It requires such structures as JOB to be defined in MAGIC.h and expects the large body of external variables to be declared in lid.c. */ #define TICK 100 #include "MaGIC.h" /** ** Since this is not the parallel version, the timing macro has ** not been included, so timing apparatus goes in here. **/ #include #include #ifdef HASTIMES #include struct tms time_buffer; #endif int begin_timer, end_timer; CLoCK(timer) int *timer; { struct timeval tp; struct timezone tzp; gettimeofday(&tp,&tzp); *timer = tp.tv_sec & 0xffff; *timer *= 100; *timer += (tp.tv_usec / 10000); #ifdef HASTIMES times(&time_buffer); #endif } JOB *theJob; /* Run specification */ /******************************************************************** ********************************************************************/ int DONE; FILE *infil, /* For data input */ *outfil, /* "Real" output */ *fopen(); int noclear = 0, /* Suppress "clear" */ start_time; /* Clock reading */ char *malloc(); #include "lid.c" #include "setup.c" #include "TR.c" /*******************************************************************/ main(argc,argv) int argc; char *argv[]; { int i, j, option; extern char *optarg; extern int optind; while ((option = getopt (argc, argv, "x#:")) != -1) if ( option == 'x' ) noclear = 1; theJob = (JOB*) malloc(sizeof(JOB)); job_defaults(); perm_initial(); while ( i = dialog() ) if ( i > 0 ) { printf("\n Searching.....\n"); fflush(stdout); job_start(); subf_set(); DONE = 0; while ( got_siz() ) if ( theJob->f_n ) while ( got_neg() ) do_a_job(); else do_a_job(); job_stop(); } if ( !noclear ) system("clear"); } /*****************************************************************/ do_a_job() { while ( got_ord() ) while ( got_des() ) if ( pre_set() ) { setperm(); transref( Vlength, Good_matrix, set_poss ); } } .