Ignore:
Timestamp:
Oct 19, 2022, 4:33:34 PM (19 months ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
ADT, ast-experimental, master
Children:
135143b
Parents:
72b5805e
Message:

Change parse args to use new arrays instead of C arrays.
Also added const ?? to arrays.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • tests/configs/parsebools.cfa

    r72b5805e rd1abc63c  
    1515//
    1616
     17#include <fstream.hfa>
    1718#include <parseargs.hfa>
    18 #include <fstream.hfa>
    1919
    2020#include "../meta/fork+exec.hfa"
     
    3030        bool sf = true;
    3131
    32         cfa_option options[] = {
    33                 {'e', "yesno",     "test yes/no",     YN, parse_yesno},
    34                 {'y', "YN",        "test yes/no",     Yn, parse_yesno},
    35                 {'n', "yn",        "test yes/no",     yn, parse_yesno},
    36                 {'t', "truefalse", "test true/false", tf, parse_truefalse},
    37                 {'s', "settrue",   "test set true",   st, parse_settrue},
    38                 {'u', "setfalse",  "test set false",  sf, parse_setfalse},
    39         };
    40         int options_cnt = sizeof(options) / sizeof(cfa_option);
     32        array( cfa_option, 6 ) options;
     33        options[0] = (cfa_option){'e', "yesno",     "test yes/no",     YN, parse_yesno};
     34        options[1] = (cfa_option){'y', "YN",        "test yes/no",     Yn, parse_yesno};
     35        options[2] = (cfa_option){'n', "yn",        "test yes/no",     yn, parse_yesno};
     36        options[3] = (cfa_option){'t', "truefalse", "test true/false", tf, parse_truefalse};
     37        options[4] = (cfa_option){'s', "settrue",   "test set true",   st, parse_settrue};
     38        options[5] = (cfa_option){'u', "setfalse",  "test set false",  sf, parse_setfalse};
    4139
    4240        char **left;
    43         parse_args( options, options_cnt, "[OPTIONS]...\ntesting bool parameters", left);
     41        parse_args( options, "[OPTIONS]...\ntesting bool parameters", left);
    4442
    4543        sout | "yes/no     :" | YN;
Note: See TracChangeset for help on using the changeset viewer.