Changeset 636c28 in git


Ignore:
Timestamp:
Mar 24, 2011, 6:36:10 PM (13 years ago)
Author:
Oleksandr Motsak <motsak@…>
Branches:
(u'spielwiese', '5b153614cbc72bfa198d75b1e9e33dab2645d9fe')
Children:
de4e64a426712523b3ba44188f1f75f4bb4aad7d
Parents:
e5a4ba6cad9681dda18e8cc54544efb5003d053b
Message:
ADD: "scons debug=1" for debug version
UPD: updated bigintm to support correct (debug/release) version
FIX: some minor warnings (thanks to debug version)

From: Oleksandr Motsak <motsak@mathematik.uni-kl.de>

git-svn-id: file:///usr/local/Singular/svn/trunk@14066 2c84dea3-7e68-4137-9b89-c4e89433aadc
Location:
dyn_modules
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • dyn_modules/bigintm/SConstruct

    re5a4ba r636c28  
    11# Emacs edit mode for this file is -*- python -*-
     2
     3MODNAME = 'bigintm'
     4SRCS = ["bigintm.cc", "mod_main.cc"]
     5
    26env = Environment()
    37
     
    913
    1014
    11 sing_psico_int_if = env.SharedLibrary('bigintm',
    12                                ["bigintm.cc", "mod_main.cc"],
    13                                SHLIBPREFIX="", LDMODULESUFFIX=".so",
    14                                CPPPATH = SING_INCLUDES,
    15                                LIBS=[])
     15#env.SharedObject(target = 'mod_main.o', source = 'mod_main.cc')
    1616
    17 Default(sing_psico_int_if)
     17CXXTEMPLFLAGS = "-fno-implicit-templates --no-exceptions"
    1818
     19
     20
     21
     22### for the use with "scons debug=1"
     23if ARGUMENTS.get('debug', 0):
     24    ### Works with Singularg only!
     25    syzextra_debug_if = env.LoadableModule( MODNAME + '_g',
     26        SRCS,
     27        SHLIBPREFIX="",
     28        LDMODULESUFFIX=".sog",
     29        SHLIBSUFFIX = ".sog",
     30        CPPPATH = SING_INCLUDES,
     31        CXXFLAGS = "-g -Wextra -Wall -pedantic -Wno-long-long " + CXXTEMPLFLAGS,
     32        LIBS=[])
     33    Default(syzextra_debug_if)
     34else:
     35    ### Works with any Singular
     36    syzextra_if = env.SharedLibrary(MODNAME,
     37        SRCS,
     38        SHLIBPREFIX="",
     39        LDMODULESUFFIX=".so",
     40        SHLIBSUFFIX = ".so",
     41        CPPPATH = SING_INCLUDES,
     42        CPPDEFINES = ["NDEBUG", "OM_NDEBUG"],
     43        CXXFLAGS = "-O3 -fomit-frame-pointer --no-rtti " + CXXTEMPLFLAGS,
     44        CCFLAGS="-O3 -fomit-frame-pointer ",
     45        LIBS=[])
     46    Default(syzextra_if)
     47
     48
     49
     50### clean with "scons -c ."
  • dyn_modules/bigintm/bigintm.tst

    re5a4ba r636c28  
    11echo = 2;
    22
    3 LIB("./bigintm.so");
     3"ndebug?: ", system("with", "ndebug");
     4"om_ndebug?: ", system("with", "om_ndebug");
    45
    5 bigintm_print_load_counter();
    6 printBlackboxTypes();
    7 
    8 
    9 LIB("./bigintm.so");
    10 
    11 bigintm_print_load_counter();
    12 printBlackboxTypes();
    13 
    14 LIB("./bigintm.so");
    15 
    16 bigintm_print_load_counter();
    17 printBlackboxTypes();
    18 
     6if( system("with", "ndebug") )
     7{
     8  "Loading the Release version!";
     9  LIB("./bigintm.so");
     10}
     11else
     12{
     13  "Loading the Debug version!";
     14  LIB("./bigintm_g.sog");
     15}
    1916
    2017printBlackboxTypes();
    21 
    2218bigintm_setup();
    23 
    2419printBlackboxTypes();
    25 
    2620bigintm_setup();
    27 
    2821printBlackboxTypes();
    2922
  • dyn_modules/bigintm/mod_main.cc

    re5a4ba r636c28  
    2626
    2727/// listing all blackbox types (debug stuff)
    28 static BOOLEAN printBlackboxTypes0(leftv __res, leftv __v)
     28static BOOLEAN printBlackboxTypes0(leftv __res, leftv /*__v*/)
    2929{
    3030  NoReturn(__res);
     
    3434
    3535/// init the bigintm (a sample blackbox) type
    36 static BOOLEAN bigintm_setup0(leftv __res, leftv __v)
     36static BOOLEAN bigintm_setup0(leftv __res, leftv /*__v*/)
    3737{
    3838  NoReturn(__res);
     
    4040}
    4141
    42 static long int load_counter = -1;
    43 
    44 /// init the bigintm (a sample blackbox) type
    45 static BOOLEAN print_load_counter(leftv __res, leftv __v)
    46 {
    47   Print("print_load_counter: load counter: %ld", load_counter);
    48   Print(", printBlackboxTypes: %p", (void*)(printBlackboxTypes0));
    49   Print(", bigintm_setup: %p", (void*)(bigintm_setup0));
    50   PrintLn();
    51 
    52   NoReturn(__res);
    53   return FALSE;
    5442}
    55 
    56 };
    5743
    5844
     
    6147  int mod_init(SModulFunctions* psModulFunctions)
    6248  {
    63     load_counter++;
    64    
    65     if( !load_counter)
    66     {
    67      
    68       psModulFunctions->iiAddCproc(currPack->libname,(char*)"printBlackboxTypes",FALSE, printBlackboxTypes0);
    69       psModulFunctions->iiAddCproc(currPack->libname,(char*)"bigintm_setup",FALSE, bigintm_setup0);
    70       psModulFunctions->iiAddCproc(currPack->libname,(char*)"bigintm_print_load_counter",FALSE, print_load_counter);
     49    psModulFunctions->iiAddCproc(currPack->libname,(char*)"printBlackboxTypes",FALSE, printBlackboxTypes0);
     50    psModulFunctions->iiAddCproc(currPack->libname,(char*)"bigintm_setup",FALSE, bigintm_setup0);
    7151
    72       // Q: should we call 'bigintm_setup' here??!?!?
    73       return 0;
    74     }
    75     else
    76     {
    77       PrintS("ERROR: Sorry this dynamic module was already loaded...!!!");
    78       PrintLn();
    79       // Q: what about loading this module multipple times...?
    80       return 0; // -1? - No difference!!!
    81 
    82     }
    83      
     52    // Q: should we call 'bigintm_setup' here??!?!?
     53    return 0;
    8454  }
    8555}
  • dyn_modules/syzextra/SConstruct

    re5a4ba r636c28  
    11# Emacs edit mode for this file is -*- python -*-
     2
     3MODNAME = 'syzextra'
     4SRCS = ["mod_main.cc", "DebugPrint.cc", "myNF.cc"]
     5
    26env = Environment()
    37
     
    1115#env.SharedObject(target = 'mod_main.o', source = 'mod_main.cc')
    1216
     17CXXTEMPLFLAGS = "-fno-implicit-templates --no-exceptions"
    1318
    14 ### Works with any Singular
    15 #syzextra_if = env.SharedLibrary('syzextra',
    16 #                               ["mod_main.cc", "DebugPrint.cc", "myNF.cc"],
    17 #                               SHLIBPREFIX="", LDMODULESUFFIX=".so", CPPDEFINES = 'NDEBUG', SHLIBSUFFIX = ".so",
    18 #                               CPPPATH = SING_INCLUDES,
    19 #                               LIBS=[])
    2019
    21 ### Works with Singularg only!
    22 syzextra_debug_if = env.LoadableModule('syzextra_g',
    23                                ["mod_main.cc", "DebugPrint.cc", "myNF.cc"],
    24                                SHLIBPREFIX="", LDMODULESUFFIX=".sog", SHLIBSUFFIX = ".sog",
    25                                CPPPATH = SING_INCLUDES,
    26                                LIBS=[])
    2720
    28 # Default(syzextra_if)
    29 # Default(syzextra_debug_if)
    3021
     22### for the use with "scons debug=1"
     23if ARGUMENTS.get('debug', 0):
     24    ### Works with Singularg only!
     25    syzextra_debug_if = env.LoadableModule( MODNAME + '_g',
     26        SRCS,
     27        SHLIBPREFIX="",
     28        LDMODULESUFFIX=".sog",
     29        SHLIBSUFFIX = ".sog",
     30        CPPPATH = SING_INCLUDES,
     31        CXXFLAGS = "-g -Wextra -Wall -pedantic -Wno-long-long " + CXXTEMPLFLAGS,
     32        LIBS=[])
     33    Default(syzextra_debug_if)
     34else:
     35    ### Works with any Singular
     36    syzextra_if = env.SharedLibrary(MODNAME,
     37        SRCS,
     38        SHLIBPREFIX="",
     39        LDMODULESUFFIX=".so",
     40        SHLIBSUFFIX = ".so",
     41        CPPPATH = SING_INCLUDES,
     42        CPPDEFINES = ["NDEBUG", "OM_NDEBUG"],
     43        CXXFLAGS = "-O3 -fomit-frame-pointer --no-rtti " + CXXTEMPLFLAGS,
     44        CCFLAGS="-O3 -fomit-frame-pointer ",
     45        LIBS=[])
     46    Default(syzextra_if)
     47
     48
     49
     50### clean with "scons -c ."
  • dyn_modules/syzextra/mod_main.cc

    re5a4ba r636c28  
    5454}
    5555
    56 BOOLEAN noop(leftv __res, leftv __v)
     56BOOLEAN noop(leftv __res, leftv /*__v*/)
    5757{
    5858  NoReturn(__res);
     
    149149  if( h->Typ() == RESOLUTION_CMD )
    150150  {
    151     const syStrategy syzstr = reinterpret_cast<syStrategy>(h->Data());
     151    const syStrategy syzstr = reinterpret_cast<const syStrategy>(h->Data());
    152152
    153153    h = h->Next();
     
    156156
    157157
    158     Print("RESOLUTION_CMD(%p): ", reinterpret_cast<void*>(syzstr)); PrintLn();
     158    Print("RESOLUTION_CMD(%p): ", reinterpret_cast<const void*>(syzstr)); PrintLn();
    159159
    160160    const ring save = currRing;
     
    171171
    172172
    173 #define PRINT_pINTVECTOR(s, v) Print("intvec '%10s'(%p)", #v, (s)->v); \
     173#define PRINT_pINTVECTOR(s, v) Print("intvec '%10s'(%p)", #v, reinterpret_cast<const void*>((s)->v)); \
    174174if( (s)->v != NULL ){ PrintS(": "); view((s)->v); }; \
    175175PrintLn();
     
    199199
    200200    const SRes rP = syzstr->resPairs;
    201     Print("SRes 'resPairs': %p", rP); PrintLn();
     201    Print("SRes 'resPairs': %p", reinterpret_cast<const void*>(rP)); PrintLn();
    202202
    203203    if (rP != NULL)
     
    216216
    217217    //  const ring rrr = (iLevel > 0) ? rr : save; ?
    218 #define PRINT_RESOLUTION(s, v) Print("resolution '%12s': %p", #v, (s)->v); PrintLn(); \
     218#define PRINT_RESOLUTION(s, v) Print("resolution '%12s': %p", #v, reinterpret_cast<const void*>((s)->v)); PrintLn(); \
    219219if ((s)->v != NULL) \
    220220  for (int iLevel = 0; (iLevel < iLength) && ( ((s)->v)[iLevel] != NULL ); iLevel++) \
    221221  { \
    222     const ring rrr = (iLevel > 0) ? save : save; \
    223     Print("id '%10s'[%d]: (%p) ncols = %d / size: %d; nrows = %d, rank = %ld / rk: %ld", #v, iLevel, ((s)->v)[iLevel], ((s)->v)[iLevel]->ncols, idSize(((s)->v)[iLevel]), ((s)->v)[iLevel]->nrows, ((s)->v)[iLevel]->rank, -1L/*idRankFreeModule(((s)->v)[iLevel], rrr)*/ ); \
     222    /* const ring rrr = (iLevel > 0) ? save : save; */ \
     223    Print("id '%10s'[%d]: (%p) ncols = %d / size: %d; nrows = %d, rank = %ld / rk: %ld", #v, iLevel, reinterpret_cast<const void*>(((s)->v)[iLevel]), ((s)->v)[iLevel]->ncols, idSize(((s)->v)[iLevel]), ((s)->v)[iLevel]->nrows, ((s)->v)[iLevel]->rank, -1L/*idRankFreeModule(((s)->v)[iLevel], rrr)*/ ); \
    224224    PrintLn(); \
    225225  } \
     
    236236#undef PRINT_RESOLUTION
    237237
    238 #define PRINT_POINTER(s, v) Print("pointer '%17s': %p", #v, (s)->v); PrintLn();
     238#define PRINT_POINTER(s, v) Print("pointer '%17s': %p", #v, reinterpret_cast<const void*>((s)->v)); PrintLn();
    239239    // 2d arrays:
    240240    PRINT_POINTER(syzstr, truecomponents);
     
    258258    } else
    259259    {
    260       Print("resolution 'fullres': (%p) => resolution seems to be computed already", syzstr->fullres);
     260      Print("resolution 'fullres': (%p) => resolution seems to be computed already", reinterpret_cast<const void*>(syzstr->fullres));
    261261      PrintLn();
    262262      dPrint(*syzstr->fullres, save, save, nTerms);
     
    272272    } else
    273273    {
    274       Print("resolution 'minres': (%p) => resolution seems to be minimized already", syzstr->minres);
     274      Print("resolution 'minres': (%p) => resolution seems to be minimized already", reinterpret_cast<const void*>(syzstr->minres));
    275275      PrintLn();
    276276      dPrint(*syzstr->minres, save, save, nTerms);
     
    396396    const int iExpSize = r->ExpL_Size;
    397397
    398     intvec *iv = new intvec(iExpSize);
     398//    intvec *iv = new intvec(iExpSize);
    399399
    400400    lists l=(lists)omAllocBin(slists_bin);
     
    418418
    419419/// Endowe the current ring with additional (leading) Syz-component ordering
    420 static BOOLEAN MakeSyzCompOrdering(leftv res, leftv h)
     420static BOOLEAN MakeSyzCompOrdering(leftv res, leftv /*h*/)
    421421{
    422422
  • dyn_modules/syzextra/singularxx_defs.h

    re5a4ba r636c28  
    2727
    2828#define BEGIN_NAMESPACE(a) namespace a {
    29 #define END_NAMESPACE };
     29#define END_NAMESPACE }
    3030#define USING_NAMESPACE(a) using namespace a;
    3131
  • dyn_modules/syzextra/syzextra.tst

    re5a4ba r636c28  
    1212{
    1313  "Loading the Debug version!";
    14   LIB("./syzextra.sog");
     14  LIB("./syzextra_g.sog");
    1515}
    1616
Note: See TracChangeset for help on using the changeset viewer.