source: git/Singular/blackbox.h @ a2dde00

spielwiese
Last change on this file since a2dde00 was a088a12, checked in by Andreas Steenpaß <steenpas@…>, 13 years ago
writing newstructs to links git-svn-id: file:///usr/local/Singular/svn/trunk@14175 2c84dea3-7e68-4137-9b89-c4e89433aadc
  • Property mode set to 100644
File size: 2.7 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#include <Singular/silink.h>
7
8void removeBlackboxStuff(const int rt);
9
10struct blackbox_struct;
11
12typedef struct blackbox_struct blackbox;
13
14struct  blackbox_struct
15{
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);
50
51/// default procedure blackboxDefaultOp2, to be called as "default:" branch
52BOOLEAN blackboxDefaultOp2(int op,leftv l, leftv r1, leftv r2);
53
54/// default procedure blackboxDefaultOpM, to be called as "default:" branch
55BOOLEAN blackbox_default_OpM(int op,leftv l, leftv r);
56
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);
65
66/// list all defined type (for debugging)
67void printBlackboxTypes();
68
69/// Emit an "op not implemented" error message and return TRUE
70BOOLEAN WrongOp(const char* cmd, int op, leftv bb);
71
72#endif
Note: See TracBrowser for help on using the repository browser.