source: git/Singular/blackbox.h @ 1161a61

jengelh-datetimespielwiese
Last change on this file since 1161a61 was 1161a61, checked in by Alexander Dreyer <alexander.dreyer@…>, 11 years ago
fix: pyobject handles ternary operations acordingly
  • Property mode set to 100644
File size: 3.0 KB
Line 
1#ifndef BLACKBOX_H
2#define BLACKBOX_H
3
4#include <misc/auxiliary.h>
5#include <omalloc/omalloc.h>
6
7#include <kernel/structs.h>
8#include <kernel/febase.h>
9
10#include <Singular/lists.h>
11#include <Singular/silink.h>
12
13void removeBlackboxStuff(const int rt);
14
15struct blackbox_struct;
16
17typedef struct blackbox_struct blackbox;
18
19struct  blackbox_struct
20{
21  /// destroy the object: b points to blackbox_struct, d to data
22  void (*blackbox_destroy)(blackbox  *b, void *d);
23  /// convert the object to a string (which should be freed by omFree)
24  char *(*blackbox_String)(blackbox *b,void *d);
25  /// print the object: default: use string representation
26  void (*blackbox_Print)(blackbox *b,void *d);
27  /// construct the default object
28  void *(*blackbox_Init)(blackbox *b);
29  /// copy the object: b points to blackbox_struct, d to data
30  void *(*blackbox_Copy)(blackbox *b,void *d);
31  /// interpreter assign: l:=r
32  BOOLEAN (*blackbox_Assign)(leftv l, leftv r);
33  /// interpreter: unary operations op(r), r(), ...
34  BOOLEAN (*blackbox_Op1)(int op,leftv l, leftv r);
35  /// interpreter: binary operations: op(r1,r2), r1 op r2,...
36  BOOLEAN (*blackbox_Op2)(int op,leftv l, leftv r1,leftv r2);
37  /// interpreter: tertiary op: op(r1,r2,r3)
38  BOOLEAN (*blackbox_Op3)(int op,leftv l, leftv r1,leftv r2, leftv r3);
39  /// interpreter: operations with undefined number of operands
40  BOOLEAN (*blackbox_OpM)(int op,leftv l, leftv r);
41  /// check internal structure
42  BOOLEAN (*blackbox_Check)(blackbox *b,void *d);
43  /// serialize
44  BOOLEAN (*blackbox_serialize)(blackbox *b,void *d, si_link f);
45  /// deserialize
46  BOOLEAN (*blackbox_deserialize)(blackbox **b,void **d, si_link f);
47  /// additional type info
48  void *data;
49  /// addtinional gneral properties
50  int properties; // bit 0:blackbox is only a wrapper for lists
51#define  BB_LIKE_LIST(B) ((B)->properties &1)
52} ;
53/// default procedure blackboxDefaultOp1, to be called as "default:" branch
54BOOLEAN blackboxDefaultOp1(int op,leftv l, leftv r);
55
56/// default procedure blackboxDefaultOp2, to be called as "default:" branch
57BOOLEAN blackboxDefaultOp2(int op,leftv l, leftv r1, leftv r2);
58
59/// default procedure blackboxDefaultOp3, to be called as "default:" branch
60BOOLEAN blackboxDefaultOp3(int op,leftv l, leftv r1,leftv r2, leftv r3);
61
62/// default procedure blackboxDefaultOpM, to be called as "default:" branch
63BOOLEAN blackbox_default_OpM(int op,leftv l, leftv r);
64
65/// default procedure to print this blackbox
66void blackbox_default_Print(blackbox *b,void *d);
67
68/// return the structure to the type given by t
69blackbox* getBlackboxStuff(const int t);
70/// return the name to the type given by t (r/o)
71const char *    getBlackboxName(const int t);
72/// used by scanner: returns ROOTDECL for known types (and the type number in t)
73int blackboxIsCmd(const char *n, int & tok);
74/// define a new type
75int setBlackboxStuff(blackbox *bb,const char *name);
76
77/// list all defined type (for debugging)
78void printBlackboxTypes();
79
80/// Emit an "op not implemented" error message and return TRUE
81BOOLEAN WrongOp(const char* cmd, int op, leftv bb);
82
83#endif
Note: See TracBrowser for help on using the repository browser.