/**************************************************************************** * process_enum * * Get an enuneration from "enumerations" section of file and add it to our * repository of layout information. Return 0 if an enumeration was found * and processed. Return 1 if there are no more enumerations. ****************************************************************************/ static int process_enum(FILE * f, int skip_add) { static const size_t N_MATCHES = 4; char line[LINE_BUF_SIZE]; regmatch_t match[N_MATCHES]; cmos_enum_t cmos_enum; int result; result = 1; for (;; line_num++) { if (get_layout_file_line(f, line, LINE_BUF_SIZE)) { fprintf(stderr, "%s: Unexpected end of CMOS layout file reached while " "reading \"enumerations\" section.\n", prog_name); exit(1); } if (!regexec(&blank_or_comment_expr, line, 0, NULL, 0)) continue; if (regexec(&enums_line_expr, line, N_MATCHES, match, 0)) { if (regexec(&start_checksums_expr, line, 0, NULL, 0)) { fprintf(stderr, "%s: Syntax error on line %d of CMOS layout " "file.\n", prog_name, line_num); exit(1); } break; /* start of checksums reached: no more enumerations */ } result = 0; /* next layout enumeration found */ if (skip_add) break; line[match[1].rm_eo] = '\0'; line[match[2].rm_eo] = '\0'; line[match[3].rm_eo] = '\0'; create_enum(&cmos_enum, &line[match[1].rm_so], &line[match[2].rm_so], &line[match[3].rm_so]); try_add_cmos_enum(&cmos_enum); break; } line_num++; return result; }
com_ptr<IEnumVARIANT> TDemo::EnumChildren() { return create_enum(children_, this, shared_ptr_converter_select2nd<MAP::value_type>()); }
com_ptr<IEnumVARIANT> CCache::EnumerateKeys() { auto_cs lock(cs_); return create_enum(map_, this, std::select1st<MAP::value_type>()); }