source: benchmark/io/http/parseargs.hfa @ 0d52c6f

ADTarm-ehast-experimentalenumforall-pointer-decayjacob/cs343-translationnew-astnew-ast-unique-exprpthread-emulationqualifiedEnum
Last change on this file since 0d52c6f was 53e4562, checked in by Thierry Delisle <tdelisle@…>, 4 years ago

Added options to list files instead of running the server

  • Property mode set to 100644
File size: 1.4 KB
Line 
1#pragma once
2
3struct cfa_option {
4      char short_name;
5      const char * long_name;
6      const char * help;
7      void * variable;
8      bool (*parse)(const char *, void * );
9};
10
11extern cfa_option last_option;
12
13static inline void ?{}( cfa_option & this ) {}
14
15forall(dtype T | { bool parse(const char *, T & ); })
16static inline void ?{}( cfa_option & this, char short_name, const char * long_name, const char * help, T & variable ) {
17      this.short_name = short_name;
18      this.long_name  = long_name;
19      this.help       = help;
20      this.variable   = (void*)&variable;
21      this.parse      = (bool (*)(const char *, void * ))parse;
22}
23
24forall(dtype T)
25static inline void ?{}( cfa_option & this, char short_name, const char * long_name, const char * help, T & variable, bool (*parse)(const char *, T & )) {
26      this.short_name = short_name;
27      this.long_name  = long_name;
28      this.help       = help;
29      this.variable   = (void*)&variable;
30      this.parse      = (bool (*)(const char *, void * ))parse;
31}
32
33void parse_args( int argc, char * argv[], cfa_option options[], size_t opt_count, const char * usage, char ** & left );
34
35bool parse_yesno   (const char *, bool & );
36bool parse_settrue (const char *, bool & );
37bool parse_setfalse(const char *, bool & );
38
39bool parse(const char *, const char * & );
40bool parse(const char *, unsigned & );
41bool parse(const char *, size_t & );
42bool parse(const char *, int & );
Note: See TracBrowser for help on using the repository browser.