MCPcopy Create free account
hub / github.com/DreamSourceLab/DSView / parse_section

Function parse_section

libsigrok4DSL/input/in_vcd.c:128–159  ·  view source on GitHub ↗

Reads a single VCD section from input file and parses it to structure. * e.g. $timescale 1ps $end => "timescale" "1ps" */

Source from the content-addressed store, hash-verified

126 * e.g. $timescale 1ps $end => "timescale" "1ps"
127 */
128static gboolean parse_section(FILE *file, gchar **name, gchar **contents)
129{
130 gboolean status;
131 GString *sname, *scontents;
132
133 /* Skip any initial white-space */
134 if (!read_until(file, NULL, 'N')) return FALSE;
135
136 /* Section tag should start with $. */
137 if (fgetc(file) != '$')
138 {
139 sr_err("Expected $ at beginning of section.");
140 return FALSE;
141 }
142
143 /* Read the section tag */
144 sname = g_string_sized_new(32);
145 status = read_until(file, sname, 'W');
146
147 /* Skip whitespace before content */
148 status = status && read_until(file, NULL, 'N');
149
150 /* Read the content */
151 scontents = g_string_sized_new(128);
152 status = status && read_until(file, scontents, '$');
153 g_strchomp(scontents->str);
154
155 /* Release strings if status is FALSE, return them if status is TRUE */
156 *name = g_string_free(sname, !status);
157 *contents = g_string_free(scontents, !status);
158 return status;
159}
160
161struct probe
162{

Callers 2

parse_headerFunction · 0.85
format_matchFunction · 0.85

Calls 1

read_untilFunction · 0.85

Tested by

no test coverage detected