static int load_panel_theme(struct panel_theme *theme, struct config_format_tree *tree) { CLEAR_STRUCT(theme); struct config_format_entry *e = find_config_format_entry(&tree->root, "panel"); if (!e) return XERROR("Failed to find 'panel' section in theme format file"); theme->position = PANEL_POSITION_TOP; /* default */ const char *v = find_config_format_entry_value(e, "position"); if (v) theme->position = parse_position(v); theme->background = parse_image_part_named("background", e, tree, 1); if (!theme->background) return -1; theme->separator = parse_image_part_named("separator", e, tree, 0); theme->transparent = parse_bool("transparent", e); theme->align = parse_align("align", e); theme->height = parse_int("height", e, -1); theme->width = parse_int_or_percents("width", e, -1, &theme->width_in_percents); return 0; }
static symbolS * obj_coff_common_parse (int ignore ATTRIBUTE_UNUSED, symbolS *symbolP, addressT size) { addressT align = 0; if (*input_line_pointer == ',') { align = parse_align (0); if (align == (addressT) -1) return NULL; } S_SET_VALUE (symbolP, size); S_SET_EXTERNAL (symbolP); S_SET_SEGMENT (symbolP, bfd_com_section_ptr); symbol_get_bfdsym (symbolP)->flags |= BSF_OBJECT; /* There is no S_SET_ALIGN (symbolP, align) in COFF/PE. Instead we must add a note to the .drectve section. */ if (align) { segT current_seg = now_seg; subsegT current_subseg = now_subseg; flagword oldflags; asection *sec; size_t pfxlen, numlen; char *frag; char numbuff[20]; sec = subseg_new (".drectve", 0); oldflags = bfd_get_section_flags (stdoutput, sec); if (oldflags == SEC_NO_FLAGS) { if (!bfd_set_section_flags (stdoutput, sec, TC_COFF_SECTION_DEFAULT_ATTRIBUTES)) as_warn (_("error setting flags for \"%s\": %s"), bfd_section_name (stdoutput, sec), bfd_errmsg (bfd_get_error ())); } /* Emit a string. Note no NUL-termination. */ pfxlen = strlen (" -aligncomm:") + 2 + strlen (S_GET_NAME (symbolP)) + 1; numlen = snprintf (numbuff, sizeof (numbuff), "%d", (int) align); frag = frag_more (pfxlen + numlen); (void) sprintf (frag, " -aligncomm:\"%s\",", S_GET_NAME (symbolP)); memcpy (frag + pfxlen, numbuff, numlen); /* Restore original subseg. */ subseg_set (current_seg, current_subseg); } return symbolP; }
/* Parses single column description. Returns zero on successful parsing. */ static int parse(map_name_cb cn, const char str[], column_info_t *info, void *arg) { load_defaults(info); if((str = parse_align(str, info)) != NULL) { if((str = parse_width(str, info)) != NULL) { if((str = parse_name(cn, str, info, arg)) != NULL) { str = parse_cropping(str, info); } } } return str == NULL || *str != '\0'; }
int check_for_directive(struct _asm_context *asm_context, char *token) { if (strcasecmp(token, "org") == 0) { if (parse_org(asm_context) != 0) return -1; return 1; } else if (strcasecmp(token, "align") == 0) { if (parse_align(asm_context) != 0) return -1; return 1; } else if (strcasecmp(token, "name") == 0) { if (parse_name(asm_context) != 0) return -1; return 1; } else if (strcasecmp(token, "public") == 0) { if (parse_public(asm_context) != 0) return -1; return 1; } else if (strcasecmp(token, "db") == 0 || strcasecmp(token, "dc8") == 0 || strcasecmp(token, "ascii") == 0) { if (parse_db(asm_context, 0) != 0) return -1; return 1; } else if (strcasecmp(token, "asciiz") == 0) { if (parse_db(asm_context, 1) != 0) return -1; return 1; } else if (strcasecmp(token, "dc") == 0) { if (parse_dc(asm_context) != 0) return -1; return 1; } else if (strcasecmp(token, "dq") == 0) { if (parse_dq(asm_context) != 0) return -1; return 1; } else if (strcasecmp(token, "dw") == 0 || strcasecmp(token, "dc16") == 0) { if (parse_dc16(asm_context) != 0) return -1; return 1; } else if (strcasecmp(token, "dl") == 0 || strcasecmp(token, "dc32") == 0) { if (parse_dc32(asm_context) != 0) return -1; return 1; } else if (strcasecmp(token, "dc64") == 0) { if (parse_dc64(asm_context) != 0) return -1; return 1; } else if (strcasecmp(token, "ds") == 0 || strcasecmp(token, "ds8") == 0) { if (parse_ds(asm_context,1) != 0) return -1; return 1; } else if (strcasecmp(token, "ds16") == 0) { if (parse_ds(asm_context,2) != 0) return -1; return 1; } else if (strcasecmp(token, "ds32") == 0) { if (parse_ds(asm_context,4) != 0) return -1; return 1; } else if (strcasecmp(token, "resb") == 0) { if (parse_resb(asm_context,1) != 0) return -1; return 1; } else if (strcasecmp(token, "resw") == 0) { if (parse_resb(asm_context,2) != 0) return -1; return 1; } else if (strcasecmp(token, "end") == 0) { return 2; } else if (strcasecmp(token, "big_endian") == 0) { asm_context->memory.endian = ENDIAN_BIG; return 1; } else if (strcasecmp(token, "little_endian") == 0) { asm_context->memory.endian = ENDIAN_LITTLE; return 1; } if (asm_context->parse_directive != NULL) { int ret = asm_context->parse_directive(asm_context, token); if (ret == 0) { return 1; } // Found and used if (ret == -1) { return -1; } // Found and there was a problem } int n = 0; while (cpu_list[n].name != NULL) { if (strcasecmp(token, cpu_list[n].name) == 0) { configure_cpu(asm_context, n); #if 0 if (strcmp(token, "65816") == 0) { asm_context->parse_directive = parse_directive_65816; } else #endif { asm_context->parse_directive = NULL; } return 1; } n++; } return 0; }
int check_for_directive(struct _asm_context *asm_context, char *token) { if (strcasecmp(token, "org") == 0) { if (parse_org(asm_context) != 0) return -1; return 1; } else if (strcasecmp(token, "align") == 0) { if (parse_align(asm_context) != 0) return -1; return 1; } else if (strcasecmp(token, "name") == 0) { if (parse_name(asm_context) != 0) return -1; return 1; } else if (strcasecmp(token, "public") == 0) { if (parse_public(asm_context) != 0) return -1; return 1; } else if (strcasecmp(token, "db") == 0 || strcasecmp(token, "dc8") == 0 || strcasecmp(token, "ascii") == 0) { if (parse_db(asm_context, 0) != 0) return -1; return 1; } else if (strcasecmp(token, "asciiz") == 0) { if (parse_db(asm_context, 1) != 0) return -1; return 1; } else if (strcasecmp(token, "dc") == 0) { if (parse_dc(asm_context) != 0) return -1; return 1; } else if (strcasecmp(token, "dw") == 0 || strcasecmp(token, "dc16") == 0) { if (parse_dw(asm_context) != 0) return -1; return 1; } else if (strcasecmp(token, "dl") == 0 || strcasecmp(token, "dc32") == 0) { if (parse_dl(asm_context) != 0) return -1; return 1; } else if (strcasecmp(token, "ds") == 0 || strcasecmp(token, "ds8") == 0) { if (parse_ds(asm_context,1) != 0) return -1; return 1; } else if (strcasecmp(token, "ds16") == 0) { if (parse_ds(asm_context,2) != 0) return -1; return 1; } else if (strcasecmp(token, "resb") == 0) { if (parse_resb(asm_context,1) != 0) return -1; return 1; } else if (strcasecmp(token, "resw") == 0) { if (parse_resb(asm_context,2) != 0) return -1; return 1; } else if (strcasecmp(token, "end") == 0) { return 2; } else if (strcasecmp(token, "big_endian") == 0) { asm_context->memory.endian=ENDIAN_BIG; } else if (strcasecmp(token, "little_endian") == 0) { asm_context->memory.endian=ENDIAN_LITTLE; } int n = 0; while (cpu_list[n].name != NULL) { if (strcasecmp(token, cpu_list[n].name) == 0) { asm_context->cpu_type = cpu_list[n].type; asm_context->memory.endian = cpu_list[n].default_endian; asm_context->bytes_per_address = cpu_list[n].bytes_per_address; asm_context->is_dollar_hex = cpu_list[n].is_dollar_hex; asm_context->can_tick_end_string = cpu_list[n].can_tick_end_string; asm_context->parse_instruction = cpu_list[n].parse_instruction; asm_context->list_output = cpu_list[n].list_output; asm_context->cpu_list_index = n; return 1; } n++; } return 0; }