source: git/Singular/blackbox.h @ b5f5444

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