Exemple #1
0
int main(int argc, char **argv) {
    int *intarray= NULL;
    int numInts;
    int checkEvery= MAXint;
    int curlong, totlong;
    int traceLevel= 4; /* 4 normally, no tracing since qset does not log.  5 for memory tracing */

    readOptions(argc, argv, prompt, &numInts, &checkEvery, &traceLevel);
    setupMemory(traceLevel, numInts, &intarray);

    testSetappendSettruncate(numInts, intarray, checkEvery);
    testSetdelSetadd(numInts, intarray, checkEvery);
    testSetappendSet(numInts, intarray, checkEvery);
    testSetcompactCopy(numInts, intarray, checkEvery);
    testSetequalInEtc(numInts, intarray, checkEvery);
    testSettemp(numInts, intarray, checkEvery);
    testSetlastEtc(numInts, intarray, checkEvery);
    testSetdelsortedEtc(numInts, intarray, checkEvery);
    printf("\n\nNot testing qh_setduplicate and qh_setfree2.\n  These routines use heap-allocated set contents.  See qhull tests.\n");

    qh_memstatistics(stdout);
    qh_memfreeshort(&curlong, &totlong);
    if (curlong || totlong){
        qh_fprintf(stderr, 8043, "qh_memfreeshort: did not free %d bytes of long memory(%d pieces)\n", totlong, curlong);
        error_count++;
    }
    if(error_count){
        qh_fprintf(stderr, 8012, "testqset: %d errors\n\n", error_count);
        exit(1);
    }else{
        printf("testqset: OK\n\n");
    }
    return 0;
}/*main*/
Exemple #2
0
// Initialize the haret application.
void
setupHaret()
{
    preparePath();

    // Open log file "haretlog.txt" if "earlyharetlog.txt" is found.
    char fn[100];
    fnprepare("earlyharetlog.txt", fn, sizeof(fn));
    FILE *logfd=fopen(fn, "r");
    if (logfd) {
        // Requesting early logs..
        fclose(logfd);
        openLogFile("haretlog.txt");
    }

    outTls = TlsAlloc();
    TlsSetValue(outTls, 0);

    Output("\n===== HaRET %s =====", VERSION);

    init_ehandling();

    // Prep for per-thread output function.
    prepThread();

    Output("Finished initializing output");

    if(InitKMDriver()){
    	Output("Initializing kernel mode driver succeeded");
    }else{
    	Output(C_ERROR "Initializing kernel mode driver FAILED");
    }

    // Bind to DLLs dynamically.
    setup_LateLoading();

    // Detect some system settings
    setupMachineType();

    // Init memory maps.
    setupMemory();

    // Setup variable/command lists.
    setupCommands();

    // Initialize the machine found earlier.
    Output("Initializing for machine '%s'", Mach->name);
    Mach->init();

    // Send banner info to log (if logging on).
    printWelcome();
}