X-Git-Url: http://git.efficios.com/?p=babeltrace.git;a=blobdiff_plain;f=include%2Fbabeltrace%2Fctf-text%2Ftypes.h;h=7d9b5bfb70b8a7da34ad88ff7c3b0566e9f1be44;hp=6a363a47a013ef7826b732737fa925f109940e82;hb=de913cfdf87242ec3ff54c72a318ebb8714e5465;hpb=1ae19169d9cb823765444d22cdb05cd2ed3f162f diff --git a/include/babeltrace/ctf-text/types.h b/include/babeltrace/ctf-text/types.h index 6a363a47..7d9b5bfb 100644 --- a/include/babeltrace/ctf-text/types.h +++ b/include/babeltrace/ctf-text/types.h @@ -24,7 +24,7 @@ #include #include #include -#include +#include #include #include @@ -37,6 +37,9 @@ struct ctf_text_stream_pos { FILE *fp; /* File pointer. NULL if unset. */ int depth; int dummy; /* disable output */ + int print_names; /* print field names */ + int field_nr; + GString *string; /* Current string */ }; static inline @@ -48,14 +51,14 @@ struct ctf_text_stream_pos *ctf_text_pos(struct stream_pos *pos) /* * Write only is supported for now. */ -void ctf_text_integer_write(struct stream_pos *pos, struct definition *definition); -void ctf_text_float_write(struct stream_pos *pos, struct definition *definition); -void ctf_text_string_write(struct stream_pos *pos, struct definition *definition); -void ctf_text_enum_write(struct stream_pos *pos, struct definition *definition); -void ctf_text_struct_write(struct stream_pos *pos, struct definition *definition); -void ctf_text_variant_write(struct stream_pos *pos, struct definition *definition); -void ctf_text_array_write(struct stream_pos *pos, struct definition *definition); -void ctf_text_sequence_write(struct stream_pos *pos, struct definition *definition); +int ctf_text_integer_write(struct stream_pos *pos, struct definition *definition); +int ctf_text_float_write(struct stream_pos *pos, struct definition *definition); +int ctf_text_string_write(struct stream_pos *pos, struct definition *definition); +int ctf_text_enum_write(struct stream_pos *pos, struct definition *definition); +int ctf_text_struct_write(struct stream_pos *pos, struct definition *definition); +int ctf_text_variant_write(struct stream_pos *pos, struct definition *definition); +int ctf_text_array_write(struct stream_pos *pos, struct definition *definition); +int ctf_text_sequence_write(struct stream_pos *pos, struct definition *definition); static inline void print_pos_tabs(struct ctf_text_stream_pos *pos) @@ -66,4 +69,18 @@ void print_pos_tabs(struct ctf_text_stream_pos *pos) fprintf(pos->fp, "\t"); } +/* + * Check if the field must be printed. + */ +int print_field(struct definition *definition); + +static inline +const char *rem_(const char *str) +{ + if (str[0] == '_') + return &str[1]; + else + return str; +} + #endif /* _BABELTRACE_CTF_TEXT_TYPES_H */