source: git/Singular/blackbox.h @ e3c628

fieker-DuValspielwiese
Last change on this file since e3c628 was 997bf7, checked in by Hans Schoenemann <hannes@…>, 5 years ago
fix: compatibility
  • Property mode set to 100644
File size: 3.3 KB
RevLine 
[295381]1#ifndef BLACKBOX_H
2#define BLACKBOX_H
[92d684]3
[b5dd9b]4#include "kernel/mod2.h"
[92d684]5
[b5dd9b]6#include "kernel/structs.h"
[92d684]7
[b5dd9b]8#include "Singular/lists.h"
9#include "Singular/links/silink.h"
[295381]10
11void removeBlackboxStuff(const int rt);
12
13struct blackbox_struct;
14
15typedef struct blackbox_struct blackbox;
16
17struct  blackbox_struct
18{
[437cb48]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)
[295381]22  char *(*blackbox_String)(blackbox *b,void *d);
[437cb48]23  /// print the object: default: use string representation
[295381]24  void (*blackbox_Print)(blackbox *b,void *d);
[437cb48]25  /// construct the default object
[2df510]26  void *(*blackbox_Init)(blackbox *b);
[437cb48]27  /// copy the object: b points to blackbox_struct, d to data
[295381]28  void *(*blackbox_Copy)(blackbox *b,void *d);
[437cb48]29  /// interpreter assign: l:=r
[295381]30  BOOLEAN (*blackbox_Assign)(leftv l, leftv r);
[437cb48]31  /// interpreter: unary operations op(r), r(), ...
[83ce22]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
[295381]36  BOOLEAN (*blackbox_Op1)(int op,leftv l, leftv r);
[437cb48]37  /// interpreter: binary operations: op(r1,r2), r1 op r2,...
[295381]38  BOOLEAN (*blackbox_Op2)(int op,leftv l, leftv r1,leftv r2);
[437cb48]39  /// interpreter: tertiary op: op(r1,r2,r3)
[295381]40  BOOLEAN (*blackbox_Op3)(int op,leftv l, leftv r1,leftv r2, leftv r3);
[437cb48]41  /// interpreter: operations with undefined number of operands
[295381]42  BOOLEAN (*blackbox_OpM)(int op,leftv l, leftv r);
[8357e21]43  /// is an assign of r to l (part of b) impossible?
44  BOOLEAN (*blackbox_CheckAssign)(blackbox *b,leftv l, leftv r);
[9fc2ffd]45  /// serialize
[f84c3b]46  BOOLEAN (*blackbox_serialize)(blackbox *b,void *d, si_link f);
[9fc2ffd]47  /// deserialize
[a088a12]48  BOOLEAN (*blackbox_deserialize)(blackbox **b,void **d, si_link f);
[2df510]49  /// additional type info
50  void *data;
[091193e]51  /// addtinional gneral properties
[8db6c3]52  int properties; // bit 0:blackbox is only a wrapper for lists
53#define  BB_LIKE_LIST(B) ((B)->properties &1)
[295381]54} ;
[06fdbe]55/// default procedure blackboxDefaultOp1, to be called as "default:" branch
56BOOLEAN blackboxDefaultOp1(int op,leftv l, leftv r);
[e6d9a32]57
[c728c0]58/// default procedure blackboxDefaultOp2, to be called as "default:" branch
59BOOLEAN blackboxDefaultOp2(int op,leftv l, leftv r1, leftv r2);
[295381]60
[1161a61]61/// default procedure blackboxDefaultOp3, to be called as "default:" branch
[97cc98]62BOOLEAN blackboxDefaultOp3(int op,leftv l, leftv r1,leftv r2, leftv r3);
[1161a61]63
[e6d9a32]64/// default procedure blackboxDefaultOpM, to be called as "default:" branch
[97cc98]65BOOLEAN blackboxDefaultOpM(int op,leftv l, leftv r);
[e6d9a32]66
[d7ad81]67/// default procedure blackbox_default_Print: print the string
[06c0b3]68void blackbox_default_Print(blackbox *b,void *d);
69
[437cb48]70/// return the structure to the type given by t
[295381]71blackbox* getBlackboxStuff(const int t);
[437cb48]72/// return the name to the type given by t (r/o)
[295381]73const char *    getBlackboxName(const int t);
[a9c298]74/// used by scanner: returns ROOT_DECL for known types
[35a0c12]75/// (and the type number in @c tok)
[295381]76int blackboxIsCmd(const char *n, int & tok);
[437cb48]77/// define a new type
[2df510]78int setBlackboxStuff(blackbox *bb,const char *name);
[295381]79
[437cb48]80/// list all defined type (for debugging)
[295381]81void printBlackboxTypes();
82
[e1859b]83/// struct for containing list of blackbox names and the number of them. 
84struct blackbox_list {
[997bf7]85        int count;
86        void **list;
[e1859b]87};
88
89/// return array of all define types.
90struct blackbox_list *getBlackboxTypes();
91
[295381]92#endif
Note: See TracBrowser for help on using the repository browser.