Changeset 7874d77


Ignore:
Timestamp:
Aug 11, 2020, 5:33:21 PM (4 years ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum
Children:
cd9ee44
Parents:
8e516fd
Message:

Parseargs now magically figures out argc/argv

Location:
libcfa
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • libcfa/prelude/bootloader.cf

    r8e516fd r7874d77  
    11extern "C" { static inline int invoke_main(int argc, char* argv[], char* envp[]); }
     2int cfa_args_argc;
     3char ** cfa_args_argv;
     4char ** cfa_args_envp;
    25
    36int main(int argc, char* argv[], char* envp[]) {
     7        cfa_args_argc = argc;
     8        cfa_args_argv = argv;
     9        cfa_args_envp = envp;
    410        return invoke_main(argc, argv, envp);
    511}
  • libcfa/src/parseargs.cfa

    r8e516fd r7874d77  
    2424#include "limits.hfa"
    2525
     26extern int cfa_args_argc;
     27extern char ** cfa_args_argv;
     28extern char ** cfa_args_envp;
     29
    2630void printopt(FILE * out, int width, int max, char sn, const char * ln, const char * help) {
    2731        int hwidth = max - (11 + width);
     
    3438                fprintf(out, "%*s%.*s\n", width + 11, "", hwidth, help);
    3539        }
     40}
     41
     42void parse_args( cfa_option options[], size_t opt_count, const char * usage, char ** & left ) {
     43        parse_args(cfa_args_argc, cfa_args_argv, options, opt_count, usage, left );
    3644}
    3745
  • libcfa/src/parseargs.hfa

    r8e516fd r7874d77  
    3131}
    3232
     33void parse_args( cfa_option options[], size_t opt_count, const char * usage, char ** & left );
    3334void parse_args( int argc, char * argv[], cfa_option options[], size_t opt_count, const char * usage, char ** & left );
    3435
Note: See TracChangeset for help on using the changeset viewer.