MCPcopy Create free account
hub / github.com/Entware/Entware / print_symbol_for_c

Function print_symbol_for_c

scripts/config/confdata.c:736–776  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

734}
735
736static void print_symbol_for_c(FILE *fp, struct symbol *sym)
737{
738 const char *val;
739 const char *sym_suffix = "";
740 const char *val_prefix = "";
741 char *escaped = NULL;
742
743 if (sym->type == S_UNKNOWN)
744 return;
745
746 val = sym_get_string_value(sym);
747
748 switch (sym->type) {
749 case S_BOOLEAN:
750 case S_TRISTATE:
751 switch (*val) {
752 case 'n':
753 return;
754 case 'm':
755 sym_suffix = "_MODULE";
756 /* fall through */
757 default:
758 val = "1";
759 }
760 break;
761 case S_HEX:
762 if (val[0] != '0' || (val[1] != 'x' && val[1] != 'X'))
763 val_prefix = "0x";
764 break;
765 case S_STRING:
766 escaped = escape_string_value(val);
767 val = escaped;
768 default:
769 break;
770 }
771
772 fprintf(fp, "#define %s%s%s %s%s\n", CONFIG_, sym->name, sym_suffix,
773 val_prefix, val);
774
775 free(escaped);
776}
777
778static void print_symbol_for_rustccfg(FILE *fp, struct symbol *sym)
779{

Callers

nothing calls this directly

Calls 2

sym_get_string_valueFunction · 0.85
escape_string_valueFunction · 0.85

Tested by

no test coverage detected