Changeset 5cdbfe in git for dyn_modules/bigintm


Ignore:
Timestamp:
Mar 15, 2011, 7:17:48 PM (13 years ago)
Author:
Oleksandr Motsak <motsak@…>
Branches:
(u'spielwiese', '91e5db82acc17434e4062bcfa44e6efa7d41fd30')
Children:
f247337dd844f01e85a8379ff9c1e26fe7eea863
Parents:
92e0ebb492f002a11e78b302b3758d32aedea17e
Message:
ADD: dynamic module stuff...

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

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

Legend:

Unmodified
Added
Removed
  • dyn_modules/bigintm/bigintm.cc

    r92e0eb r5cdbfe  
    106106  // interpreter: a1 is ist bigintm
    107107  assume( r->Typ() == bigintm_type_id );
    108 
     108/*
     109  // "typeof( <blackbox> )" is handled by 'blackboxDefaultOp1'
    109110  if (op==TYPEOF_CMD)
    110111  {
     
    113114    return FALSE;
    114115  }
     116*/
    115117 
    116118  if( op=='(' ) // <bigintm>  VAR();
     
    246248    case '.':
    247249    {
    248       Werror("bigintm_Op2: Op: '.': 2nd argument-type: '%s'(%d) in", Tok2Cmdname(a2->Typ()), a2->Typ());     
     250
     251      if (a2->name==NULL)
     252      {
     253        Werror("bigintm_Op2: Op: '.': 2nd argument-type: '%s'(%d) should be a NAME", Tok2Cmdname(a2->Typ()), a2->Typ());     
     254        return TRUE;
     255      }
     256     
     257      Werror("bigintm_Op2: Op: '.': 2nd argument-type: '%s'(%d) is called '%s' in ", Tok2Cmdname(a2->Typ()), a2->Typ(), a2->name);     
    249258      return blackboxDefaultOp2(op,res,a1,a2);
    250259      return TRUE;
  • dyn_modules/bigintm/bigintm.tst

    r92e0eb r5cdbfe  
    22
    33LIB("./bigintm.so");
     4
     5bigintm_print_load_counter();
     6printBlackboxTypes();
     7
     8
     9LIB("./bigintm.so");
     10
     11bigintm_print_load_counter();
     12printBlackboxTypes();
     13
     14LIB("./bigintm.so");
     15
     16bigintm_print_load_counter();
     17printBlackboxTypes();
     18
    419
    520printBlackboxTypes();
     
    8196
    8297
    83 a - s;
    8498
    85 c == s;
     99
     100
     101
     102
    86103
    87104c.s;
    88105c.sss;
    89 c.0;
     106c."a";
    90107
     108
     109
     110option(yacc);
     111c - s;
     112c == s; // BUG?
     113option(noyacc);
     114
     115
     116
     117c.0; // BUG?
     118option(yacc);
     119c.1; // BUG?
     120c. ; // BUG?
     121option(noyacc);
    91122
    92123
  • dyn_modules/bigintm/mod_main.cc

    r92e0eb r5cdbfe  
    2424
    2525/// listing all blackbox types (debug stuff)
    26 BOOLEAN printBlackboxTypes(leftv __res, leftv __v)
     26BOOLEAN printBlackboxTypes0(leftv __res, leftv __v)
    2727{
    2828  NoReturn(__res);
     
    3232
    3333/// init the bigintm (a sample blackbox) type
    34 BOOLEAN bigintm_setup(leftv __res, leftv __v)
     34BOOLEAN bigintm_setup0(leftv __res, leftv __v)
    3535{
    3636  NoReturn(__res);
     
    3838}
    3939
     40static long int load_counter = -1;
     41
     42/// init the bigintm (a sample blackbox) type
     43BOOLEAN print_load_counter(leftv __res, leftv __v)
     44{
     45  Print("print_load_counter: load counter: %ld", load_counter);
     46  Print(", printBlackboxTypes: %p", (void*)(printBlackboxTypes0));
     47  Print(", bigintm_setup: %p", (void*)(bigintm_setup0));
     48  PrintLn();
     49
     50  NoReturn(__res);
     51  return FALSE;
     52}
     53
     54
    4055extern "C"
    4156{
    4257  int mod_init(SModulFunctions* psModulFunctions)
    4358  {
    44     psModulFunctions->iiAddCproc(currPack->libname,(char*)"printBlackboxTypes",FALSE, printBlackboxTypes);
    45     psModulFunctions->iiAddCproc(currPack->libname,(char*)"bigintm_setup",FALSE, bigintm_setup);
    46     return 0;
     59    load_counter++;
     60   
     61    if( !load_counter)
     62    {
     63     
     64      psModulFunctions->iiAddCproc(currPack->libname,(char*)"printBlackboxTypes",FALSE, printBlackboxTypes0);
     65      psModulFunctions->iiAddCproc(currPack->libname,(char*)"bigintm_setup",FALSE, bigintm_setup0);
     66      psModulFunctions->iiAddCproc(currPack->libname,(char*)"bigintm_print_load_counter",FALSE, print_load_counter);
     67
     68      // Q: should we call 'bigintm_setup' here??!?!?
     69      return 0;
     70    }
     71    else
     72    {
     73      PrintS("ERROR: Sorry this dynamic module was already loaded...!!!");
     74      PrintLn();
     75      // Q: what about loading this module multipple times...?
     76      return 0; // -1? - No difference!!!
     77
     78    }
     79     
    4780  }
    4881}
Note: See TracChangeset for help on using the changeset viewer.