source: git/Singular/blackbox.h @ 42a7cb4

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