Esempio n. 1
0
/*
**
** main function
**
*/
int main( int argc, char *argv[] )
{
#ifdef AMIGA
    STRPTR version_string = "$VER: 0.6.3 hsc (30.8.1995)";
#endif
    BOOL ok = FALSE;

    /* set program information */
    set_prginfo( "hsc", "Tommy-Saftwörx", 0, 6, 3,
        "HTML Sucks Completely", "This is FreeWare!" );

#ifdef UMEM_TRACKING
    /* display a memory tracking report */
    /* at end of execution */
    atexit( atexit_uglymemory );
#endif

    /* use cleanup() as additional exit func */
    atexit( cleanup );

    /*
    ** main procedure
    */
    if ( args_ok( argc, argv ) ) {

        /* display programm-info if requested */
        if ( verbose )
            fprintf_prginfo( stderr );

        if ( open_error()              /* init error file */
             && open_output()          /* open output file */
             && config_ok() )          /* read config */
        {
            /* include file parsed in args */
            ok = include_hsc( inpfilename, outfile, IH_PARSE_END );

        }

    }

    /* TODO: set return value 0,5,10,20 */
    /* ->define symbols like RC_FAIL, vars like any_warn */
    if ( ok )
        return( 0 ); /* successful */
    else
        return( 20 );
}
Esempio n. 2
0
/*
**
** main function
**
*/
int main( int argc, char *argv[] )
{
    BOOL ok = FALSE;

    /* set program information */
    set_prginfo( "hsc", "Tommy-Saftwörx", 0, 9, 2,
        "HTML Sucks Completely", "This is FreeWare." );

#ifdef UMEM_TRACKING
    /* display a memory tracking report */
    /* at end of execution */
    atexit( atexit_uglymemory );
#endif

    /* use cleanup() as additional exit func */
    atexit( cleanup );

    /*
    ** main procedure
    */
    if ( args_ok( argc, argv ) ) {

        /* display programm-info if requested */
        if ( verbose )
            fprintf_prginfo( stderr );

        if ( open_error()              /* init error file */
             && open_output()          /* open output file */
             && config_ok()            /* read config */
             && include_ok() )        /* read include files */
        {
            /* include file parsed in args */
            ok = include_hsc_file( inpfilename, outfile, IH_PARSE_END );
        }

    }

    return( return_code );
}
Esempio n. 3
0
/* ---------------------------------------------------------------------- */
void
mexFunction(int nlhs,       mxArray *plhs[],
            int nrhs, const mxArray *prhs[])
/* ---------------------------------------------------------------------- */
{
    double                tolerance;
    char                  errmsg[1023 + 1];
    struct grdecl         grdecl;
    struct processed_grid g;

    if (args_ok(nlhs, nrhs, prhs)) {
        mx_init_grdecl(&grdecl, prhs[0]);
        tolerance = define_tolerance(nrhs, prhs);

        process_grdecl(&grdecl, tolerance, &g);

        plhs[0] = allocate_grid(&g, mexFunctionName());

        if (plhs[0] != NULL) {
            fill_grid(plhs[0], &g);
        } else {
            /* Failed to create grid structure.  Return empty. */
            plhs[0] = mxCreateDoubleMatrix(0, 0, mxREAL);
        }

        free_processed_grid(&g);
    } else {
        sprintf(errmsg,
                "Calling sequence is\n\t"
                "G = %s(grdecl)\t%%or\n\t"
                "G = %s(grdecl, tolerance)\n"
                "The 'grdecl' must be a valid structure with fields\n"
                "\t'cartDims', 'COORD', 'ZCORN'",
                mexFunctionName(), mexFunctionName());
        mexErrMsgTxt(errmsg);
    }
}
Esempio n. 4
0
int main (int argc, char **argv)
{
    char const *doctype;
    char const **ptr;

    args_data = postqueue_data = message_data;

    message_construct(argv[0]);
    args_construct(argc, argv, "?x:l:", 0);

    hashmap_construct(&symtab);
    lines_construct(&global.d_toc);
    lines_construct(&global.d_section);
    lines_add(&global.d_section, "");

    hashmap_constructText(&global.d_symbol, default_symbols);

    if (!args_ok() || args_nArgs() < 2)     /* check arguments */
        usage();

    if (args_nArgs() == 2)                  /* file name specified  */
    {
        global.d_out = stdout;
        global.d_noext = 0;
    }
    else
    {
        global.d_noext = file_rmExtension(args_arg(2));
        global.d_ext = file_extension(args_arg(2));
        if (!global.d_ext)
        {
            global.d_ext = new_str(args_optarg('x'));
            if (!global.d_ext)
                global.d_ext = "ypp";      /* Yodl Post Processor  */
        }
    }

    string_construct(&global.d_outName, 0);
    postqueue_construct(task);

    if (global.d_noext)
    {
        string_format(&global.d_outName, "%s.%s",
                            global.d_noext, global.d_ext);

        global.d_out = file_open(string_str(&global.d_outName), "w");
    }

    doctypes[sizeofDocType - 1] =
                    doctype = hashmap_textOf(&global.d_symbol, "documenttype");

    for
    (
        ptr = doctypes, global.d_doctype = 1;
            strcmp(doctype, *ptr);
                ptr++, global.d_doctype <<= 1
    )
        ;

    postqueue_process();

    fclose(global.d_out);
    return 0;
}