source: git/Singular/blackbox.h

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