+ if(!found)
+ {
+ snam = Safe_calloc(1, sizeof(sectName));
+ snam->name = Safe_strdup(sectname);
+ snam->regsSet = NULL;
+
+ addSet(§Names, snam);
+ }
+
+ ssym->section = snam;
+
+#if 0
+ fprintf(stderr, "%s:%d placing symbol %s at section %s (%p)\n", __FILE__, __LINE__,
+ ssym->name, snam->name, snam);
+#endif
+
+ cp = get_pragma_token(cp, &token);
+ if (TOKEN_STR == token.type)
+ symname = get_pragma_string(&token);
+ else if (TOKEN_EOL == token.type)
+ symname = NULL;
+ else
+ {
+ err = 1;
+ symname = NULL;
+ }
+ }
+
+ Safe_free(sectname);
+ }
+ break;
+
+ /* #pragma library library_module */
+ case P_LIBRARY:
+ {
+ const char *lmodule;
+
+ cp = get_pragma_token(cp, &token);
+ if (TOKEN_EOL != token.type)
+ {
+ lmodule = get_pragma_string(&token);
+
+ /* lmodule can be:
+ * c link the C library
+ * math link the math library
+ * io link the IO library
+ * debug link the debug libary
+ * anything else, will link as-is */
+
+ if(!strcmp(lmodule, "c"))
+ libflags.want_libc = 1;
+ else if(!strcmp(lmodule, "math"))
+ libflags.want_libm = 1;
+ else if(!strcmp(lmodule, "io"))
+ libflags.want_libio = 1;
+ else if(!strcmp(lmodule, "debug"))
+ libflags.want_libdebug = 1;
+ else if(!strcmp(lmodule, "ignore"))
+ libflags.ignore = 1;
+ else
+ {
+ if(!libflags.ignore)
+ {
+ fprintf(stderr, "link library %s\n", lmodule);
+ addSetHead(&libFilesSet, (char *)lmodule);
+ }
+ }
+ }
+ else
+ {
+ err = 1;
+ break;
+ }
+
+ cp = get_pragma_token(cp, &token);
+ if (TOKEN_EOL != token.type)
+ {
+ err = 1;
+ break;
+ }
+ }
+ break;
+
+#if 0
+ /* This is an experimental code for #pragma inline
+ and is temporarily disabled for 2.5.0 release */
+ case P_INLINE:
+ {
+ char *tmp = strtok((char *)NULL, WHITECOMMA);
+
+ while(tmp) {
+ addSet(&asmInlineMap, Safe_strdup( tmp ));
+ tmp = strtok((char *)NULL, WHITECOMMA);
+ }
+
+ {
+ char *s;
+
+ for(s = setFirstItem(asmInlineMap); s ; s = setNextItem(asmInlineMap)) {
+ debugf("inline asm: `%s'\n", s);
+ }
+ }
+ }
+ break;
+#endif /* 0 */
+
+ default:
+ processed = 0;
+ break;
+ }
+
+ get_pragma_token(cp, &token);
+
+ if (1 == err)
+ werror(W_BAD_PRAGMA_ARGUMENTS, name);
+
+ free_pragma_token(&token);
+ return processed;
+}
+
+static struct pragma_s pragma_tbl[] = {
+ { "maxram", P_MAXRAM, 0, do_pragma },
+ { "stack", P_STACK, 0, do_pragma },
+ { "code", P_CODE, 0, do_pragma },
+ { "udata", P_UDATA, 0, do_pragma },
+ { "library", P_LIBRARY, 0, do_pragma },
+/*{ "inline", P_INLINE, 0, do_pragma }, */
+ { NULL, 0, 0, NULL },
+ };
+
+static int
+_process_pragma(const char *s)
+{
+ return process_pragma_tbl(pragma_tbl, s);