1 function sort(V, N, tmp, i, j) {
2 V[-1] = ""; # Used as a sentinel before V[0].
3 for (i = 1; i < N; i++)
4 for (j = i; V[j - 1] > V[j]; j--) {
14 builtin["printf"] = "int printf(const char *, ...)";
15 builtin["sprintf"] = "int sprintf(char *, const char *, ...)";
16 builtin["malloc"] = "void *malloc()";
17 builtin["calloc"] = "void *calloc()";
18 builtin["memcpy"] = "void *memcpy()";
19 builtin["memset"] = "void *memset()";
20 builtin["memmove"] = "void *memmove()";
21 builtin["strcpy"] = "char *strcpy()";
22 builtin["strchr"] = "char *strchr()";
26 /^[0123456789abcdef]+ [ABCDGRSTUVW] / {
27 if ($3 != "symbols" && $3 != "symbols_nelts") {
36 print "#include \"loader/symbols.h\"\n";
38 # Must deal with compiler builtins etc.
39 for (x = 0; x < nname; x++) {
40 if (builtin[name[x]] != "")
41 print builtin[name[x]] ";";
43 print "extern int " name[x]"();";
47 # nname++: An { 0, 0 } entry is added at the end of the vector.
48 print "const int symbols_nelts = " nname+1 ";";
49 print "const struct symbols symbols[" nname+1 "] = {";
50 for (x = 0; x < nname; x++)
51 print "{ \"" name[x] "\", (void *)&"name[x]" },";
52 print "{ (const char *)0, (void *)0} };";