Branch: Tag:

2005-01-03

2005-01-03 18:57:29 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Several minor bugfixes.

Rev: src/mklibpike.pike:1.4

1:   /* -  * $Id: mklibpike.pike,v 1.3 2005/01/03 18:24:11 grubba Exp $ +  * $Id: mklibpike.pike,v 1.4 2005/01/03 18:57:29 grubba Exp $    *    * Create strapping code for a list of symbols in pike.so,    * and the pike headerfiles.
80:    array(string) srcdirs = ({ "." });    array(string) symbols = ({ });    -  Stdio.File out = Stdio.stdout; +  string out_name;       foreach(Getopt.find_all_options(argv, ({    ({ "help", Getopt.NO_ARG, ({ "-h", "--help" }) }),
112:    break;    case "out":    // -o Specify output filename. -  if (out != Stdio.stdout) { +  if (out_name) {    werror("Output file specified multiple times.\n");    exit(1);    } -  out = Stdio.File(); -  if (!out->open(val, "wct")) { -  werror("Failed to open %O for writing.\n", val); -  exit(1); -  } +  out_name = val;    break;    case "sym":    // -s Add single symbol.
133:    werror("Failed to open symbol file %O.\n", val);    exit(1);    } -  symbols += String.trim_whites((replace(raw_syms, "\r", "")/"\n")[*]); +  symbols += String.trim_whites((replace(raw_syms, "\r", "")/"\n")[*]) - +  ({""});    break;    }    }
158:       mapping(string:array(array(Parser.C.Token))) symbol_info = parse(tokens);    +  Stdio.File out = Stdio.stdout; +  if (out_name) { +  out = Stdio.File(); +  if (!out->open(out_name, "wct")) { +  werror("Failed to open %O for writing.\n", out_name); +  exit(1); +  } +  } +  +  out->write("/*\n" +  " * Automatically generated by " __FILE__ "\n" +  " * on " __DATE__ ". Do NOT edit.\n" +  " */\n" +  "\n" +  "%{#include \"%s\"\n%}\n" +  "\n", +  headers); +     int fail;    foreach(Array.uniq(sort(symbols)), string sym) {    array(array(Parser.C.Token)) info = symbol_info[sym];
171:    out->write("static %s (*vec_%s)%s;\n"    "%s %s%s\n"    "{\n" +  // FIXME: Code to resolve the symbol here.    " %svec_%s(",    rettype, sym, params,    rettype, sym, params,
178:       array(array(Parser.C.Token)) args = info[1][1..sizeof(info[1])-2]/({","});    foreach(args; int n; array(Parser.C.Token) arg) { +  if (sizeof(arg) == 1) continue; // probable void. +     array(Parser.C.Token)|Parser.C.Token name = arg[-1];    if (arrayp(name)) {    if (name[0]->text == "(") {