4 * The following command generates ./xcode/ff2c/sample.{c,h}
6 * $ ./xcode/ff2c/ff2c ./xcode/ff2c/sample.ff
11 * C-style comments are used, blank-spaces between tokens are ignored.
13 * Semicolon is used as a _separator_, not a _terminator_. That is, various
14 * lists (fields, declarations) have a form E0 ; E1 ; ... ; EN.
18 * "require" statement introduces a dependency on other source file. For each
19 * "require", an #include directive is produced, which includes corresponding
20 * header file, "lib/vec.h" in this case
26 * Following in this file are type declaration statements, which all have form
27 * "type-declaration type-name".
30 /* define "fid" as a RECORD type, having two U64 fields. */
36 * Produced C declaration is:
38 * uint64_t f_container;
44 * Define "optfid" as a UNION containing a byte discriminator field (o_flag),
45 * followed either by a fid (provided o_flag's value is 1) or a U32 value
46 * o_short (provided o_flag's value is 3).
54 * Produced C declaration is:
65 /* define optfidarray as a counted array of optfid instances. */
71 * Produced C declaration is:
73 * struct optfidarray {
75 * struct optfid *ofa_data;
80 * define fixarray as a fixed-size array of optfids. Array size is NR, which
81 * must be defined in one of "require"-d files.
88 * Produced C declaration is:
92 * struct optfid *fa_data;
96 /* demonstrate declaration of a more complex structure. */
101 * "p_cred" is opaque field. It is represented as a pointer to struct
102 * m0_cred. The actual type of pointed object is returned by
103 * m0_package_cred_get() function.
105 *m0_cred p_cred [m0_package_cred_get];
108 * field's type can be defined in-place. ff2c generates a name of the
109 * form "parent_type"_"field_name" for such anonymous type.
124 * Produced C declaration is:
128 * struct m0_cred *p_cred;
129 * struct package_p_name {
131 * struct p_name_s_el {
133 * struct fixarray e_payload;
134 * struct s_el_e_datum {
144 * int m0_package_cred_get(const struct m0_xcode_obj *par,
145 * const struct m0_xcode_type **out);
153 * Produced C declaration is: