static void handle_styles_element (ParserState *parser_state) { int type; const xmlChar *tag_name; g_return_if_fail (parser_state->error == NULL); while (parser_state->error == NULL) { /* FIXME: is xmlTextReaderIsValid call needed here or * error func will be called? */ xmlTextReaderRead (parser_state->reader); xmlTextReaderIsValid (parser_state->reader); if (parser_state->error != NULL) break; tag_name = xmlTextReaderConstName (parser_state->reader); type = xmlTextReaderNodeType (parser_state->reader); /* End at the closing </styles> tag */ if (tag_name && type == XML_READER_TYPE_END_ELEMENT && !xmlStrcmp (BAD_CAST "styles", tag_name)) break; /* Skip nodes that aren't <style> elements */ if (tag_name == NULL || xmlStrcmp (BAD_CAST "style", tag_name)) continue; /* Handle <style> elements */ parse_style (parser_state); } }
void ViewCompilerImpl::parse_view_member(ViewClassMembers &type, StyleToken &token, StyleTokenizer &tokenizer) { if (token.type != StyleTokenType::ident) throw_parse_error(token, "Expected identifier"); std::string identifier1 = token.value; tokenizer.read(token, true); if (token.type == StyleTokenType::colon) { tokenizer.read(token, true); parse_style(type, identifier1, token, tokenizer); } else if (token.type == StyleTokenType::delim && token.value == "=") { tokenizer.read(token, true); parse_value(type, identifier1, token, tokenizer); } else if (token.type == StyleTokenType::ident) { parse_add_children(type, identifier1, token, tokenizer); } else { parse_update_child(type, identifier1, token, tokenizer); } }
static int isInvis(char *style) { char **styles = 0; char **sp; char *p; if (style[0]) { styles = parse_style(style); sp = styles; while ((p = *sp++)) { if (streq(p, "invis")) return 1; } } return 0; }
static void traverse_layout(GenerateWebsiteWorkspace *workspace, xmlNodePtr node) { CongNodePtr child; g_assert(node); g_message("traverse_layout <%s>", node->name); for (child=node->children; child; child=child->next) { if (cong_node_is_element(child, NULL, "config")) { parse_config(workspace, child); } else if (cong_node_is_element(child, NULL, "copyright")) { parse_copyright(workspace, child); } else if (cong_node_is_element(child, NULL, "headlink")) { parse_headlink(workspace, child); } else if (cong_node_is_element(child, NULL, "style")) { parse_style(workspace, child); } else if (cong_node_is_element(child, NULL, "toc")) { parse_toc(workspace, child); } else if (cong_node_is_element(child, NULL, "notoc")) { parse_notoc(workspace, child); } } }
int main(int argc, char *argv[]) { int i, ch, cmdsiz = 0; char *e, *s; double intvl; setlocale(LC_ALL, ""); /* * Command line option handling */ while ((ch = getopt(argc, argv, "+i:rewps:c:x")) != -1) switch (ch) { case 'i': intvl = strtod(optarg, &e); if (*optarg == '\0' || *e != '\0') errx(EX_USAGE, "invalid interval: %s", optarg); if (*optarg == '-') errx(EX_USAGE, "interval must be positive: %s", optarg); opt_interval.tv_sec = (int)intvl; opt_interval.tv_usec = (u_long) (intvl * 1000000UL) % 1000000UL; break; case 'r': reverse_mode = REVERSE_CHAR; break; case 'w': reverse_mode = REVERSE_WORD; break; case 'e': reverse_mode = REVERSE_LINE; break; case 'p': pause_status = 1; break; case 's': start_line = atoi(optarg); break; case 'c': start_column = atoi(optarg); break; case 'x': xflag = 1; break; default: usage(); exit(EX_USAGE); } argc -= optind; argv += optind; /* * Build command string to give to popen */ if (argc <= 0) { usage(); exit(EX_USAGE); } if ((cmdv = calloc(argc + 1, sizeof(char *))) == NULL) err(EX_OSERR, "calloc"); cmdstr = ""; for (i = 0; i < argc; i++) { cmdv[i] = argv[i]; while (strlen(cmdstr) + strlen(argv[i]) + 3 > cmdsiz) { if (cmdsiz == 0) { cmdsiz = 128; s = calloc(cmdsiz, 1); } else { cmdsiz *= 2; s = realloc(cmdstr, cmdsiz); } if (s == NULL) err(EX_OSERR, "malloc"); cmdstr = s; } if (i != 0) strlcat(cmdstr, " ", cmdsiz); strlcat(cmdstr, argv[i], cmdsiz); } cmdv[i++] = NULL; /* * Initialize signal */ (void) signal(SIGINT, on_signal); (void) signal(SIGTERM, on_signal); (void) signal(SIGHUP, on_signal); /* * Initialize curses environment */ initscr(); start_color(); use_default_colors(); parse_style(); noecho(); crmode(); /* * Enter main processing loop and never come back here */ command_loop(); /* NOTREACHED */ abort(); }
bool rxvt_image::set_geometry (const char *geom, bool update) { bool changed = false; int geom_flags = 0; int x = h_align; int y = v_align; unsigned int w = h_scale; unsigned int h = v_scale; uint8_t new_flags = 0; if (geom == NULL) return false; if (geom[0]) { char **arr = rxvt_strsplit (':', geom); for (int i = 0; arr[i]; i++) { if (!strncasecmp (arr[i], "style=", 6)) { parse_style (arr[i] + 6, x, y, w, h, new_flags); geom_flags = WidthValue|HeightValue|XValue|YValue; } else if (!strcasecmp (arr[i], "op=tile")) new_flags |= IM_TILE; else if (!strcasecmp (arr[i], "op=keep-aspect")) new_flags |= IM_KEEP_ASPECT; else if (!strcasecmp (arr[i], "op=root-align")) new_flags |= IM_ROOT_ALIGN; // deprecated else if (!strcasecmp (arr[i], "tile")) { new_flags |= IM_TILE; w = h = noScale; geom_flags |= WidthValue|HeightValue; } else if (!strcasecmp (arr[i], "propscale")) { new_flags |= IM_KEEP_ASPECT; w = h = windowScale; geom_flags |= WidthValue|HeightValue; } else if (!strcasecmp (arr[i], "hscale")) { new_flags |= IM_TILE; w = windowScale; h = noScale; geom_flags |= WidthValue|HeightValue; } else if (!strcasecmp (arr[i], "vscale")) { new_flags |= IM_TILE; h = windowScale; w = noScale; geom_flags |= WidthValue|HeightValue; } else if (!strcasecmp (arr[i], "scale")) { w = h = windowScale; geom_flags |= WidthValue|HeightValue; } else if (!strcasecmp (arr[i], "auto")) { w = h = windowScale; x = y = centerAlign; geom_flags |= WidthValue|HeightValue|XValue|YValue; } else if (!strcasecmp (arr[i], "root")) { new_flags |= IM_TILE|IM_ROOT_ALIGN; w = h = noScale; geom_flags |= WidthValue|HeightValue; } else geom_flags |= XParseGeometry (arr[i], &x, &y, &w, &h); } /* done parsing ops */ rxvt_free_strsplit (arr); } new_flags |= flags & ~IM_GEOMETRY_FLAGS; if (!update) { if (!(geom_flags & XValue)) x = y = defaultAlign; else if (!(geom_flags & YValue)) y = x; if (!(geom_flags & (WidthValue|HeightValue))) w = h = defaultScale; else if (!(geom_flags & HeightValue)) h = w; else if (!(geom_flags & WidthValue)) w = h; } clamp_it (x, -100, 200); clamp_it (y, -100, 200); if (flags != new_flags || h_scale != w || v_scale != h || h_align != x || v_align != y) { flags = new_flags; h_scale = w; v_scale = h; h_align = x; v_align = y; changed = true; } if (is_size_sensitive ()) flags |= IM_IS_SIZE_SENSITIVE; else flags &= ~IM_IS_SIZE_SENSITIVE; return changed; }