2 * Copyright (C) 2001-2003, The Perl Foundation.
6 * Command line option parsing (for pre-initialized code)
7 * Data Structure and Algorithms:
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
20 typedef const char* longopt_string_t
;
22 /* &gen_from_enum(longopt.pasm) subst(s/(\w+)/uc($1)/e) */
24 OPTION_required_FLAG
= 0x1,
25 OPTION_optional_FLAG
= 0x2
29 struct longopt_opt_decl
{
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 */
50 int longopt_get(PARROT_INTERP
,
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 */
67 * c-file-style: "parrot"
69 * vim: expandtab shiftwidth=4: