Reads a single VCD section from input file and parses it to structure. * e.g. $timescale 1ps $end => "timescale" "1ps" */
| 126 | * e.g. $timescale 1ps $end => "timescale" "1ps" |
| 127 | */ |
| 128 | static 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 | |
| 161 | struct probe |
| 162 | { |
no test coverage detected