Changeset aa4d31 in git


Ignore:
Timestamp:
Feb 7, 2019, 1:18:27 PM (5 years ago)
Author:
Reimer Behrends <behrends@…>
Branches:
(u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
Children:
098784114c00a08a4d18cf392c0f2411aa0d007ed669f7b103e531e130535f2141dd1d77cfa31a81
Parents:
54b24c79febc0e79ee3f9c6a86b7c4d505c69a43
Message:
parallel preprocessor-related fixes.
Files:
12 added
21 edited

Legend:

Unmodified
Added
Removed
  • Singular/dyn_modules/gfanlib/gfanlib.cc

    r54b24c raa4d31  
    2424  bbpolytope_setup(p);
    2525  tropical_setup(p);
    26   VAR return MAX_TOK;
     26  return MAX_TOK;
    2727}
    2828
  • Singular/dyn_modules/polymake/polymake_wrapper.cc

    r54b24c raa4d31  
    19791979  p->iiAddCproc("polymakeInterface.lib","vertexEdgeGraph",FALSE,PMvertexEdgeGraph);
    19801980
    1981   VAR blackbox* b=getBlackboxStuff(polytopeID);
     1981  blackbox* b=getBlackboxStuff(polytopeID);
    19821982  b->blackbox_Op2=bbpolytope_Op2;
    19831983
    19841984  init_polymake_help();
    1985   VAR return MAX_TOK;
     1985  return MAX_TOK;
    19861986}
    19871987
  • Singular/dyn_modules/pyobject/pyobject.cc

    r54b24c raa4d31  
    717717extern "C" int SI_MOD_INIT(pyobject)(SModulFunctions* psModulFunctions)
    718718{
    719   VAR int tok = -1;
    720   VAR blackbox* bbx = pyobject_blackbox(tok);
     719  int tok = -1;
     720  blackbox* bbx = pyobject_blackbox(tok);
    721721  if (bbx->blackbox_Init != pyobject_Init)
    722722  {
     
    738738    PYOBJECT_ADD_C_PROC(python_run);
    739739  }
    740   VAR return MAX_TOK;
     740  return MAX_TOK;
    741741}
    742742#undef PYOBJECT_ADD_C_PROC
  • Singular/dyn_modules/syzextra/mod_main.cc

    r54b24c raa4d31  
    525525
    526526#undef ADD
    527   VAR return MAX_TOK;
    528 }
     527  return MAX_TOK;
     528}
  • gfanlib/gfanlib_circuittableint.cpp

    r54b24c raa4d31  
    99
    1010namespace gfan{
    11 INST_VAR class MVMachineIntegerOverflow MVMachineIntegerOverflow;
     11INST_VAR MVMachineIntegerOverflowType MVMachineIntegerOverflow;
    1212}
  • gfanlib/gfanlib_circuittableint.h

    r54b24c raa4d31  
    2626};
    2727
    28 EXTERN_INST_VAR MVMachineIntegerOverflow MVMachineIntegerOverflow;
     28typedef MVMachineIntegerOverflow MVMachineIntegerOverflowType;
     29
     30EXTERN_INST_VAR MVMachineIntegerOverflowType MVMachineIntegerOverflow;
    2931
    3032/*
  • libpolys/misc/options.h

    r54b24c raa4d31  
    1111/*the general set of verbose-options : si_opt_2(verbose) */
    1212#ifdef __cplusplus
    13 extern "C" unsigned si_opt_1; //< NOTE: Original option variable name: test
    14 extern "C" unsigned si_opt_2; //< NOTE: Original option variable name: verbose
     13extern "C" VAR unsigned si_opt_1; //< NOTE: Original option variable name: test
     14extern "C" VAR unsigned si_opt_2; //< NOTE: Original option variable name: verbose
    1515extern "C" BOOLEAN siCntrlc;
    1616#else
  • libpolys/polys/weight.cc

    r54b24c raa4d31  
    1818
    1919/*0 implementation*/
    20 extern "C" double (*wFunctional)(int *degw, int *lpol, int npol,
     20extern "C" THREAD_VAR double (*wFunctional)(int *degw, int *lpol, int npol,
    2121       double *rel, double wx, double wNsqr);
    2222extern "C" double wFunctionalMora(int *degw, int *lpol, int npol,
  • libpolys/polys/weight.h

    r54b24c raa4d31  
    2424
    2525// internal:
    26 extern "C" double (*wFunctional)(int *degw, int *lpol, int npol,
     26extern "C" THREAD_VAR double (*wFunctional)(int *degw, int *lpol, int npol,
    2727       double *rel, double wx, double wNsqr);
    2828extern "C" double wFunctionalBuch(int *degw, int *lpol, int npol,
  • ppcc/LICENSE

    r54b24c raa4d31  
    1 This license applies to all parts of this software project that are not
    2 third-party libraries. The third-party libraries are:
     1The AdLib system is distributed under the terms of the Boost Software
     2License 1.0 (see below). This license applies to all files in this directory
     3or any of its subdirectories that are not third-party libraries. The
     4following parts are third-party libraries:
    35
    4 * The Tiny GC garbage collector (comprising all files in the gclib
    5   directory).
    6 * The autosetup code (comprising all files in the autosetup directory).
     6* The Tiny GC garbage collector and Doug Lea's malloc() implementation
     7  (comprising the files in the gclib directory).
     8* The autosetup code (comprising the files in the autosetup directory).
    79
    8 These libraries have their own licenses whose terms differ from the
    9 terms below.
     10These third-party libraries have their own licenses whose terms differ from
     11those of the Boost Software License.
    1012
    1113---------------------------------------------------------------------------
     
    3537---------------------------------------------------------------------------
    3638
    37 
  • ppcc/adlib/os.cc

    r54b24c raa4d31  
    1111  if (fp == NULL)
    1212    return NULL;
    13   Str *result = new Str(1024);
     13  StrArr *result = new StrArr();
    1414  for (;;) {
    1515    size_t nbytes = fread(buffer, 1, sizeof(buffer), fp);
    1616    if (nbytes == 0)
    1717      break;
    18     result->add(buffer, nbytes);
    19   }
    20   return result;
     18    result->add(new Str(buffer, nbytes));
     19  }
     20  return StrJoin(result, "");
    2121}
    2222
     
    197197}
    198198
    199 Str *Pwd() {
     199Str *CurrentDir() {
    200200#ifdef PATH_MAX
    201201  char *path = getcwd(NULL, PATH_MAX);
     
    389389}
    390390
     391Str *AbsolutePath(Str *path) {
     392  if (path->starts_with(PathSeparator)) {
     393    return path->clone();
     394  }
     395  Str *result = CurrentDir();
     396  return result->add(PathSeparator)->add(path);
     397}
     398
     399Str *NormalizePath(Str *path) {
     400  bool abs = path->starts_with(PathSeparator);
     401  StrArr *parts = path->split(PathSeparator);
     402  StrArr *result = new StrArr();
     403  for (Int i = 0; i < parts->len(); i++) {
     404    Str *part = parts->at(i);
     405    if (part->eq("") || part->eq(".")) {
     406      // do nothing
     407    } else if (part->eq("..")) {
     408      if (result->len() > 0)
     409        result->pop();
     410      else if (!abs)
     411        result->add(part);
     412    } else {
     413      result->add(part);
     414    }
     415  }
     416  if (abs)
     417    return S(PathSeparator)->add(StrJoin(result, PathSeparator));
     418  else
     419    return StrJoin(result, PathSeparator);
     420}
     421
     422Str *GetEnv(const char *name) {
     423  char *result = getenv(name);
     424  if (result)
     425    return new Str(result);
     426  else
     427    return NULL;
     428}
     429
     430Str *GetEnv(Str *name) {
     431  return GetEnv(name->c_str());
     432}
     433
     434Str *ProgramPath() {
     435  Str *arg0 = new Str(ArgV[0]);
     436  Str *result = arg0;
     437  if (arg0) {
     438    if (FileStat(result, true)) {
     439      return NormalizePath(AbsolutePath(result));
     440    }
     441    if (!arg0->starts_with(PathSeparator)) {
     442      Str *path = GetEnv("PATH");
     443      StrArr *paths = path ? path->split(':') : A();
     444      for (Int i = 0; i < paths->len(); i++) {
     445        Str *p = paths->at(i)->clone();
     446        p->add(PathSeparator);
     447        p->add(arg0);
     448        if (FileStat(p, true)) {
     449          result = p;
     450          break;
     451        }
     452      }
     453    }
     454  }
     455  return result ? NormalizePath(AbsolutePath(result)) : result;
     456}
     457
    391458bool MakeDir(const char *path, bool recursive) {
    392459  if (!recursive)
  • ppcc/adlib/os.h

    r54b24c raa4d31  
    3232};
    3333
    34 Str *Pwd();
     34Str *CurrentDir();
    3535bool ChDir(Str *path);
    3636bool ChDir(const char *path);
     
    6565Str *BaseName(Str *path);
    6666Str *FileExtension(Str *path);
     67Str *AbsolutePath(Str *path);
     68Str *NormalizePath(Str *path);
     69Str *GetEnv(Str *name);
     70Str *GetEnv(const char *name);
     71
     72Str *ProgramPath();
     73
    6774bool MakeDir(Str *path, bool recursive = false);
    6875bool MakeDir(const char *path, bool recursive = false);
  • ppcc/adlib/str.cc

    r54b24c raa4d31  
    1111
    1212StrArr *Str::split(const char *s, Int n) {
     13  if (n == 1)
     14    return split(s[0]);
    1315  Arr<Int> *parts = new Arr<Int>();
    1416  parts->add(-n);
     
    9698  if (arr->len() == 0)
    9799    return new Str();
    98   Str *result = new Str(arr->len() * (n + 1));
     100  Int len = (arr->len() - 1) * n;
     101  for (Int i = 0; i < arr->len(); i++) {
     102    len += arr->at(i)->len();
     103  }
     104  Str *result = new Str(len);
    99105  result->add(arr->first());
    100106  for (Int i = 1; i < arr->len(); i++) {
    101     result->add(sep, n);
     107    if (n >= 0)
     108      result->add(sep, n);
    102109    result->add(arr->at(i));
    103110  }
  • ppcc/adlib/test1.cc

    r54b24c raa4d31  
    5858  Check(sum_tree(tree) * 2 == counter * (counter - 1),
    5959      "stress test memory allocation");
     60  Check(NormalizePath(S("/foo/x/../bar/./"))->eq("/foo/bar"), "normalize path");
     61  Check(BaseName(ProgramPath())->eq("test1"), "program path");
    6062}
  • ppcc/adlib/test2.cc

    r54b24c raa4d31  
    2222  Check(ListFiles(".")->len() > 0, "reading directories");
    2323  StrSet *files = new StrSet(ListFiles("adlib"));
    24   files = new StrSet(ListFileTree(Pwd(), ListFilesRelative));
     24  files = new StrSet(ListFileTree(CurrentDir(), ListFilesRelative));
    2525  Check(files->contains(S(__FILE__)), "reading directories recursively");
    2626}
  • ppcc/auto.def

    r54b24c raa4d31  
    117117proc check-tmp-flags {flags} {
    118118  msg-checking "Checking whether the C++ compiler accepts $flags..."
    119   set iquote [cctest -cflags "-iquote ."]
    120   if {$iquote} {
     119  set works [cctest -cflags $flags]
     120  if {$works} {
    121121    msg-result yes
    122122    return 1
     
    192192  }
    193193  cc-check-includes dirent.h
    194   # -iquote vs. -I
    195   set iquote [check-tmp-flags "-iquote"]
    196194  define OPT ""
    197195  foreach opt {{-g -O2} {-g -O} {-g}} {
     
    287285set adlibsrc [glob adlib/*.cc]
    288286if {!$boehm} {
    289   lappend adlibsrc "gclib/tinygc.c"
     287  lappend adlibsrc "gclib/gc.c"
    290288}
    291289
     
    323321set progre [glob -nocomplain src/*.re]
    324322set proghdr [glob -nocomplain src/*.h]
     323set testsrc [lsort -unique $testsrc]
    325324set gensrc {}
    326325foreach file $progre {
  • ppcc/autosetup/autosetup

    r54b24c raa4d31  
    18641864{#!/bin/sh
    18651865dir="`dirname "$0"`/autosetup"
    1866 WRAPPER="$0"; export WRAPPER; exec "`$dir/autosetup-find-tclsh`" "$dir/autosetup" "$@"
     1866WRAPPER="$0"; export WRAPPER; exec "`"$dir/autosetup-find-tclsh"`" "$dir/autosetup" "$@"
    18671867}
    18681868        }
  • ppcc/autosetup/cc.tcl

    r54b24c raa4d31  
    1212## CC       - C compiler
    1313## CXX      - C++ compiler
     14## CPP      - C preprocessor
    1415## CCACHE   - Set to "none" to disable automatic use of ccache
    1516## CFLAGS   - Additional C compiler flags
     
    700701define CCACHE [find-an-executable [get-env CCACHE ccache]]
    701702
     703# If any of these are set in the environment, propagate them to the AUTOREMAKE commandline
     704foreach i {CC CXX CCACHE CPP CFLAGS CXXFLAGS CXXFLAGS LDFLAGS LIBS CROSS CPPFLAGS LINKFLAGS CC_FOR_BUILD LD} {
     705        if {[env-is-set $i]} {
     706                # Note: If the variable is set on the command line, get-env will return that value
     707                # so the command line will continue to override the environment
     708                define-append AUTOREMAKE [quote-if-needed $i=[get-env $i ""]]
     709        }
     710}
     711
    702712# Initial cctest settings
    703713cc-store-settings {-cflags {} -includes {} -declare {} -link 0 -lang c -libs {} -code {} -nooutput 0}
  • ppcc/autosetup/configure

    r54b24c raa4d31  
    11#!/bin/sh
    22dir="`dirname "$0"`/autosetup"
    3 WRAPPER="$0"; export WRAPPER; exec "`$dir/autosetup-find-tclsh`" "$dir/autosetup" "$@"
     3WRAPPER="$0"; export WRAPPER; exec "`"$dir/autosetup-find-tclsh"`" "$dir/autosetup" "$@"
  • ppcc/src/parser.cc

    r54b24c raa4d31  
    11#include "adlib/lib.h"
    22#include "adlib/map.h"
     3#include "adlib/set.h"
    34#include "pplex.h"
    45
     
    1819static Dict *class_vars;
    1920static Dict *class_types;
     21static StrSet *type_prefix_set;
     22static Dict *namespaced;
    2023
    2124enum DeclType {
     
    3740  GCVar(class_vars, new Dict());
    3841  GCVar(class_types, new Dict());
     42  GCVar(type_prefix_set, new StrSet());
     43  type_prefix_set->add(S("class"));
     44  type_prefix_set->add(S("struct"));
     45  type_prefix_set->add(S("typedef"));
     46  // special treatment for some gfanlib variables for now.
     47  GCVar(namespaced, new Dict());
     48  namespaced->add(S("MVMachineIntegerOverflow"), S("gfan"));
     49  namespaced->add(S("lpSolver"), S("gfan"));
    3950});
    4051
     
    244255  }
    245256  if ((is_class && !is_extern) || init_start >= 0) {
    246     if (is_toplevel)
     257    if (is_toplevel) {
    247258      init_list->add(var_name);
     259    }
    248260    Token var_init = Token(SymGen, var_name->clone()->add("__INIT__"));
    249261    parser->emit(static_token);
     
    262274      parser->init_count++;
    263275      parser->emit(Token(SymGen, S(
    264         "static pSingular_register_init_var(void *, void *, long);"
     276        "void pSingular_register_init_var(void *, void *, long);"
    265277        "class %s__CONSTR__ {\n"
    266         "  %s__CONSTR__() {\n"
     278        "  public: %s__CONSTR__() {\n"
    267279        "    pSingular_register_init_var(&%s, &%s__INIT__, sizeof(%s));\n"
    268280        "  }\n"
     
    281293    Token &token = output->at(i);
    282294    if (token.sym == SymIdent && class_vars->contains(token.str)) {
    283       token.str = class_vars->at(token.str);
     295      Int j = i-1;
     296      while (j >= 0 && TEST(SymsWS | BIT(SymAst), output->at(j).sym))
     297        j--;
     298      if (j < 0 || !type_prefix_set->contains(output->at(j).str))
     299        token.str = class_vars->at(token.str);
    284300    }
    285301  }
     
    318334    if (class_vars->contains(var_name)) {
    319335      Str *type = class_types->at(var_name);
     336      if (namespaced->contains(var_name)) {
     337        type = namespaced->at(var_name)->clone()->add("::")->add(type);
     338        var_name = namespaced->at(var_name)->clone()->add("::")->add(var_name);
     339      }
    320340      init_part->add(S(
    321341        "  %s = (%c *)pSingular_alloc_var((long)sizeof(%c));\n"
     
    374394    Int var_pos = -1, var_start = -1, var_end = -1;
    375395    var_start = parser->current_pos();
    376     parser->skip_while(SymsTypePrefix | BIT(SymWS));
     396    parser->skip_while(SymsTypePrefix | BIT(SymWS) | BIT(SymClass));
    377397    if (TEST(SymsEndDecl | BIT(SymLBrkt), parser->current_sym())) {
    378398      // We are one symbol past the initial variable identifier.
     
    481501        if (toplevel->len() > 0)
    482502          toplevel->pop();
     503        tl = 0;
    483504        parser->advance();
    484505        break;
  • ppcc/src/ppcc.cc

    r54b24c raa4d31  
    160160void TestOutputExecutable() {
    161161  if (mode == LINK) {
    162     Str *path = S("factory/threadsupport.cc");
    163     for (Int i = 0; i < 4; i++) {
    164       if (FileStat(path)) {
    165         ExtraArgs->add(path);
    166         return;
    167       }
    168       path = S("../")->add(path);
     162    if (Output && FileExtension(Output)->len() != 0) {
     163      return;
     164    }
     165    Str *path = DirName(ProgramPath());
     166    if (path) {
     167      path->add("/../Singular/threadsupport.cc");
     168      path = NormalizePath(path);
     169    }
     170    if (path && FileStat(path)) {
     171      ExtraArgs->add(path);
     172    } else {
     173      PrintLn(path);
     174      Error("cannot locate ppcc directory");
    169175    }
    170176  }
Note: See TracChangeset for help on using the changeset viewer.