* t/pmc/complex.t:
[parrot.git] / include / parrot / longopt.h
blobe9de31e948b0de728cc46e07cc11cc7fda769686
1 /* longopt.h
2 * Copyright (C) 2001-2003, The Perl Foundation.
3 * SVN Info
4 * $Id$
5 * Overview:
6 * Command line option parsing (for pre-initialized code)
7 * Data Structure and Algorithms:
8 * History:
9 * Notes:
10 * References:
13 #ifndef PARROT_LONGOPT_H_GUARD
14 #define PARROT_LONGOPT_H_GUARD
16 /* I use a char* here because this needs to be easily statically
17 * initialized, and because the interpreter is probably not running
18 * yet.
20 typedef const char* longopt_string_t;
22 /* &gen_from_enum(longopt.pasm) subst(s/(\w+)/uc($1)/e) */
23 typedef enum {
24 OPTION_required_FLAG = 0x1,
25 OPTION_optional_FLAG = 0x2
26 } OPTION_flags;
27 /* &end_gen */
29 struct longopt_opt_decl {
30 int opt_short;
31 int opt_id;
32 OPTION_flags opt_flags;
33 longopt_string_t opt_long[10]; /* An array of long aliases */
36 struct longopt_opt_info {
37 int opt_index; /* The index within argv */
38 int opt_id; /* 0 signifies end of options */
39 longopt_string_t opt_arg; /* A pointer to any argument's position */
40 longopt_string_t opt_error;
42 const char* _shortopt_pos;
45 #define LONGOPT_OPT_INFO_INIT { 1, 0, NULL, NULL, NULL }
47 /* HEADERIZER BEGIN: src/longopt.c */
49 PARROT_API
50 int longopt_get(PARROT_INTERP,
51 int argc,
52 ARGIN(const char* argv[]),
53 ARGIN(const struct longopt_opt_decl options[]),
54 ARGMOD(struct longopt_opt_info* info_buf))
55 __attribute__nonnull__(1)
56 __attribute__nonnull__(3)
57 __attribute__nonnull__(4)
58 __attribute__nonnull__(5)
59 FUNC_MODIFIES(* info_buf);
61 /* HEADERIZER END: src/longopt.c */
63 #endif /* PARROT_LONGOPT_H_GUARD */
66 * Local variables:
67 * c-file-style: "parrot"
68 * End:
69 * vim: expandtab shiftwidth=4: