source: git/Singular/blackbox.h @ e6d9a32

spielwiese
Last change on this file since e6d9a32 was e6d9a32, checked in by Oleksandr Motsak <motsak@…>, 13 years ago
ADD: bigintm as a module sample ADD: public blackbox_default_OpM ADD: more commands/ops From: Oleksandr Motsak <motsak@mathematik.uni-kl.de> git-svn-id: file:///usr/local/Singular/svn/trunk@13940 2c84dea3-7e68-4137-9b89-c4e89433aadc
  • Property mode set to 100644
File size: 2.4 KB
Line 
1#ifndef BLACKBOX_H
2#define BLACKBOX_H
3#include <omalloc.h>
4#include <kernel/structs.h>
5#include <kernel/febase.h>
6
7void removeBlackboxStuff(const int rt);
8
9struct blackbox_struct;
10
11typedef struct blackbox_struct blackbox;
12
13struct  blackbox_struct
14{
15  /// destroy the object: b points to blackbox_struct, d to data
16  void (*blackbox_destroy)(blackbox  *b, void *d);
17  /// convert the object to a string (which should be freed by omFree)
18  char *(*blackbox_String)(blackbox *b,void *d);
19  /// print the object: default: use string representation
20  void (*blackbox_Print)(blackbox *b,void *d);
21  /// construct the default object
22  void *(*blackbox_Init)(blackbox *b);
23  /// copy the object: b points to blackbox_struct, d to data
24  void *(*blackbox_Copy)(blackbox *b,void *d);
25  /// interpreter assign: l:=r
26  BOOLEAN (*blackbox_Assign)(leftv l, leftv r);
27  /// interpreter: unary operations op(r), r(), ...
28  BOOLEAN (*blackbox_Op1)(int op,leftv l, leftv r);
29  /// interpreter: binary operations: op(r1,r2), r1 op r2,...
30  BOOLEAN (*blackbox_Op2)(int op,leftv l, leftv r1,leftv r2);
31  /// interpreter: tertiary op: op(r1,r2,r3)
32  BOOLEAN (*blackbox_Op3)(int op,leftv l, leftv r1,leftv r2, leftv r3);
33  /// interpreter: operations with undefined number of operands
34  BOOLEAN (*blackbox_OpM)(int op,leftv l, leftv r);
35  /// check internal structure
36  BOOLEAN (*blackbox_Check)(blackbox *b,void *d);
37  /// additional type info
38  void *data;
39  /// addtinional gneral properties
40  int properties; // bit 0:blackbox is only a wrapper for lists
41#define  BB_LIKE_LIST(B) ((B)->properties &1)
42} ;
43/// default procedure blackboxDefaultOp1, to be called as "default:" branch
44BOOLEAN blackboxDefaultOp1(int op,leftv l, leftv r);
45
46/// default procedure blackboxDefaultOp2, to be called as "default:" branch
47BOOLEAN blackboxDefaultOp2(int op,leftv l, leftv r1, leftv r2);
48
49/// default procedure blackboxDefaultOpM, to be called as "default:" branch
50BOOLEAN blackbox_default_OpM(int op,leftv l, leftv r);
51
52/// return the structure to the type given by t
53blackbox* getBlackboxStuff(const int t);
54/// return the name to the type given by t (r/o)
55const char *    getBlackboxName(const int t);
56/// used by scanner: returns ROOTDECL for known types (and the type number in t)
57int blackboxIsCmd(const char *n, int & tok);
58/// define a new type
59int setBlackboxStuff(blackbox *bb,const char *name);
60
61/// list all defined type (for debugging)
62void printBlackboxTypes();
63
64#endif
Note: See TracBrowser for help on using the repository browser.