Changeset f24733 in git


Ignore:
Timestamp:
Mar 15, 2011, 7:17:49 PM (12 years ago)
Author:
Oleksandr Motsak <motsak@…>
Branches:
(u'jengelh-datetime', 'ceac47cbc86fe4a15902392bdbb9bd2ae0ea02c6')(u'spielwiese', 'a800fe4b3e9d37a38c5a10cc0ae9dfa0c15a4ee6')
Children:
9e8da7ec659821d053dbf793a28c79fc2d851551
Parents:
5cdbfef15d0014847a35358d543945451f68ff41
Message:
MV: moved WrongOP to blackbox
FIX: dynamic modules must ONLY export 'mod_init'!

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

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

Legend:

Unmodified
Added
Removed
  • Singular/blackbox.cc

    r5cdbfe rf24733  
    4242  return NULL;
    4343}
     44
     45// Tok2Cmdname -> iiTwoOps
     46BOOLEAN WrongOp(const char* cmd, int op, leftv bb)
     47{
     48  assume( bb->Typ() > MAX_TOK ); // it IS a blackbox type, right?!
     49 
     50  if( op > 127 )
     51    Werror("'%s' of type %s(%d) for op %s(%d) not implemented",
     52           cmd,
     53           getBlackboxName(bb->Typ()),bb->Typ(),
     54           iiTwoOps(op), op);
     55  else
     56    Werror("'%s' of type %s(%d) for op '%c' not implemented",
     57           cmd,
     58           getBlackboxName(bb->Typ()), bb->Typ(),
     59           op);
     60
     61  return TRUE;
     62}
     63
    4464BOOLEAN blackboxDefaultOp1(int op,leftv l, leftv r)
    4565{
     
    5070    return FALSE;
    5171  }
    52   if (op<127)
    53     Werror("blackbox_Op1 of type %s(%d) for op '%c' not implemented",
    54       getBlackboxName(r->Typ()),r->Typ(),op);
    55   else
    56     Werror("blackbox_Op1 of type %s(%d) for op %s(%d) not implemented",
    57       getBlackboxName(r->Typ()),r->Typ(),Tok2Cmdname(op),op);
    58   return TRUE;
     72
     73  return WrongOp("blackbox_Op1", op, r);
    5974}
     75
    6076BOOLEAN blackboxDefaultOp2(int op,leftv l, leftv r1, leftv r2)
    6177{
    62   if (op<127)
    63     Werror("blackbox_Op2 of type %s(%d) for op '%c' not implemented",
    64       getBlackboxName(r1->Typ()),r1->Typ(),op);
    65   else
    66     Werror("blackbox_Op2 of type %s(%d) for op %s(%d) not implemented",
    67       getBlackboxName(r1->Typ()),r1->Typ(),Tok2Cmdname(op),op);
    68   return TRUE;
     78  return WrongOp("blackbox_Op2", op, r1);
    6979}
     80
    7081BOOLEAN blackbox_default_Op3(int op,leftv l, leftv r1,leftv r2, leftv r3)
    7182{
    72   if (op<127)
    73     Werror("blackbox_Op3 of type %s(%d) for op '%c' not implemented",
    74       getBlackboxName(r1->Typ()),r1->Typ(),op);
    75   else
    76     Werror("blackbox_Op3 of type %s(%d) for op %s(%d) not implemented",
    77       getBlackboxName(r1->Typ()),r1->Typ(),Tok2Cmdname(op),op);
    78   return TRUE;
     83  return WrongOp("blackbox_Op3", op, r1);
    7984}
     85
    8086BOOLEAN blackbox_default_OpM(int op,leftv l, leftv r)
    8187{
    82   if (op<127)
    83     Werror("blackbox_OpM of type %s(%d) for op '%c' not implemented",
    84       getBlackboxName(r->Typ()),r->Typ(),op);
    85   else
    86     Werror("blackbox_OpM of type %s(%d) for op %s(%d) not implemented",
    87       getBlackboxName(r->Typ()),r->Typ(),Tok2Cmdname(op),op);
    88   return TRUE;
     88  return WrongOp("blackbox_OpM", op, r);
    8989}
    9090
  • Singular/blackbox.h

    r5cdbfe rf24733  
    6262void printBlackboxTypes();
    6363
     64/// Emit an "op not implemented" error message and return TRUE
     65BOOLEAN WrongOp(const char* cmd, int op, leftv bb);
     66
    6467#endif
  • dyn_modules/bigintm/bigintm.cc

    r5cdbfe rf24733  
    1515
    1616#define HAVE_BIGINTM 1
     17
     18namespace
     19{
    1720
    1821#ifdef HAVE_BIGINTM
     
    8588}
    8689
    87 // Tok2Cmdname
    88 static inline BOOLEAN WrongOp(const char* cmd, int op, leftv bb)
    89 {
    90   assume( bb->Typ() > MAX_TOK ); // it IS a blackbox type, right?!
    91   if( op > 127 )
    92     Werror("'%s' of type %s(%d) for op %s(%d) not implemented",
    93            cmd,
    94            getBlackboxName(bb->Typ()),bb->Typ(),
    95            iiTwoOps(op), op);
    96   else
    97     Werror("'%s' of type %s(%d) for op '%c' not implemented",
    98            cmd,
    99            getBlackboxName(bb->Typ()), bb->Typ(),
    100            op);
    101 
    102 }
    103 
    10490BOOLEAN bigintm_Op1(int op,leftv l, leftv r)
    10591{
     
    118104  if( op=='(' ) // <bigintm>  VAR();
    119105  {
    120     Werror("bigintm_Op1: What du you mean by '<bigintm>()'?!");
     106    Werror("bigintm_Op1: What do you mean by '<bigintm>()'?!");
    121107    return TRUE; 
    122108  }
    123109
    124   WrongOp("bigintm_Op1", op, r);
    125110  return blackboxDefaultOp1(op, l, r);
    126111}
     
    159144
    160145      Werror("bigintm_Op2: Op: '+': Sorry unsupported 2nd argument-type: %s in", Tok2Cmdname(a2->Typ()));
    161       WrongOp("bigintm_Op2", op, a1);
    162       return TRUE;
     146      return WrongOp("bigintm_Op2", op, a1);
    163147    }
    164148
     
    286270    case '(' : // <bigintm>  VAR(b,...);
    287271    {
    288       Werror("bigintm_OpM: What du you mean by '<bigintm>(...)'?!");
     272      Werror("bigintm_OpM: What do you mean by '<bigintm>(...)'?!");
    289273      return TRUE; 
    290274    }
     
    308292#endif
    309293
    310 
    311 
     294};
    312295
    313296// this is only a demo
  • dyn_modules/bigintm/mod_main.cc

    r5cdbfe rf24733  
    1515#include "bigintm.h"
    1616
     17namespace
     18{
    1719
    1820static inline void NoReturn(leftv& res)
     
    2426
    2527/// listing all blackbox types (debug stuff)
    26 BOOLEAN printBlackboxTypes0(leftv __res, leftv __v)
     28static BOOLEAN printBlackboxTypes0(leftv __res, leftv __v)
    2729{
    2830  NoReturn(__res);
     
    3234
    3335/// init the bigintm (a sample blackbox) type
    34 BOOLEAN bigintm_setup0(leftv __res, leftv __v)
     36static BOOLEAN bigintm_setup0(leftv __res, leftv __v)
    3537{
    3638  NoReturn(__res);
     
    4143
    4244/// init the bigintm (a sample blackbox) type
    43 BOOLEAN print_load_counter(leftv __res, leftv __v)
     45static BOOLEAN print_load_counter(leftv __res, leftv __v)
    4446{
    4547  Print("print_load_counter: load counter: %ld", load_counter);
     
    5153  return FALSE;
    5254}
     55
     56};
    5357
    5458
Note: See TracChangeset for help on using the changeset viewer.