Branch: Tag:

2003-09-10

2003-09-10 16:30:48 by Martin Stjernholm <mast@lysator.liu.se>

Handle large constants correctly. Improved the line number info in the
generated file.

Rev: src/post_modules/GL/gen.pike:1.20

486:    foreach(fn, string f)    res += " add_function_constant(\""+f+"\", f_"+f+",\n\t\t\t\"function("+    prot[f]+")\", OPT_SIDE_EFFECT);\n"; -  foreach(sort(indices(constants)), string co) +  foreach(sort(indices(constants)), string co) { +  int val = constants[co]; +  if (val >= 1 << 31) +  res += sprintf (#"\ + #ifdef INT64 +  push_int64(%dLL); + #else +  push_int(%d); +  push_int(31); +  f_lsh(2); +  push_int(%d); +  f_or(2); + #endif +  simple_add_constant(%O, Pike_sp-1, 0); +  pop_stack(); + ", +  val, val >> 31, val & ((1 << 31) - 1), co); +  else    res += " add_integer_constant(\""+co+"\", "+ -  (string)constants[co]+", 0);\n"; +  (string)val+", 0);\n"; +  }    res += " post_init();\n";    res += "}\n";    return res;
500:    write(({    "#line 1 \"auto.c.in\"\n",    f[0], -  sprintf("\n#line 1 %O\n", "generated by " + __FILE__), +  sprintf("\n#line %d \"auto.c (generated by %s)\"\n", +  String.count (f[0], "\n") + 4, __FILE__),    gen(),    sprintf("\n#line %d \"auto.c.in\"\n", sizeof(f[0]/"\n")),    @f[1..]})*"");   }