source: git/Singular/blackbox.h @ 06c0b3

Last change on this file since 06c0b3 was 06c0b3, checked in by Hans Schoenemann <hannes@…>, 11 years ago
fix: newstruct changes fropm master
  • Property mode set to 100644
File size: 2.9 KB
[295381]1#ifndef BLACKBOX_H
2#define BLACKBOX_H
4#include <misc/auxiliary.h>
[b5f5444]5#include <omalloc/omalloc.h>
[295381]7#include <kernel/structs.h>
8#include <kernel/febase.h>
10#include <Singular/lists.h>
[f84c3b]11#include <Singular/silink.h>
13void removeBlackboxStuff(const int rt);
15struct blackbox_struct;
17typedef struct blackbox_struct blackbox;
19struct  blackbox_struct
[437cb48]21  /// destroy the object: b points to blackbox_struct, d to data
22  void (*blackbox_destroy)(blackbox  *b, void *d);
23  /// convert the object to a string (which should be freed by omFree)
[295381]24  char *(*blackbox_String)(blackbox *b,void *d);
[437cb48]25  /// print the object: default: use string representation
[295381]26  void (*blackbox_Print)(blackbox *b,void *d);
[437cb48]27  /// construct the default object
[2df510]28  void *(*blackbox_Init)(blackbox *b);
[437cb48]29  /// copy the object: b points to blackbox_struct, d to data
[295381]30  void *(*blackbox_Copy)(blackbox *b,void *d);
[437cb48]31  /// interpreter assign: l:=r
[295381]32  BOOLEAN (*blackbox_Assign)(leftv l, leftv r);
[437cb48]33  /// interpreter: unary operations op(r), r(), ...
[295381]34  BOOLEAN (*blackbox_Op1)(int op,leftv l, leftv r);
[437cb48]35  /// interpreter: binary operations: op(r1,r2), r1 op r2,...
[295381]36  BOOLEAN (*blackbox_Op2)(int op,leftv l, leftv r1,leftv r2);
[437cb48]37  /// interpreter: tertiary op: op(r1,r2,r3)
[295381]38  BOOLEAN (*blackbox_Op3)(int op,leftv l, leftv r1,leftv r2, leftv r3);
[437cb48]39  /// interpreter: operations with undefined number of operands
[295381]40  BOOLEAN (*blackbox_OpM)(int op,leftv l, leftv r);
[c728c0]41  /// check internal structure
42  BOOLEAN (*blackbox_Check)(blackbox *b,void *d);
[9fc2ffd]43  /// serialize
[f84c3b]44  BOOLEAN (*blackbox_serialize)(blackbox *b,void *d, si_link f);
[9fc2ffd]45  /// deserialize
[a088a12]46  BOOLEAN (*blackbox_deserialize)(blackbox **b,void **d, si_link f);
[2df510]47  /// additional type info
48  void *data;
[091193e]49  /// addtinional gneral properties
[8db6c3]50  int properties; // bit 0:blackbox is only a wrapper for lists
51#define  BB_LIKE_LIST(B) ((B)->properties &1)
[295381]52} ;
[06fdbe]53/// default procedure blackboxDefaultOp1, to be called as "default:" branch
54BOOLEAN blackboxDefaultOp1(int op,leftv l, leftv r);
[c728c0]56/// default procedure blackboxDefaultOp2, to be called as "default:" branch
57BOOLEAN blackboxDefaultOp2(int op,leftv l, leftv r1, leftv r2);
[e6d9a32]59/// default procedure blackboxDefaultOpM, to be called as "default:" branch
60BOOLEAN blackbox_default_OpM(int op,leftv l, leftv r);
[06c0b3]62/// default procedure to print this blackbox
63void blackbox_default_Print(blackbox *b,void *d);
[437cb48]65/// return the structure to the type given by t
[295381]66blackbox* getBlackboxStuff(const int t);
[437cb48]67/// return the name to the type given by t (r/o)
[295381]68const char *    getBlackboxName(const int t);
[437cb48]69/// used by scanner: returns ROOTDECL for known types (and the type number in t)
[295381]70int blackboxIsCmd(const char *n, int & tok);
[437cb48]71/// define a new type
[2df510]72int setBlackboxStuff(blackbox *bb,const char *name);
[437cb48]74/// list all defined type (for debugging)
[295381]75void printBlackboxTypes();
[f24733]77/// Emit an "op not implemented" error message and return TRUE
78BOOLEAN WrongOp(const char* cmd, int op, leftv bb);
Note: See TracBrowser for help on using the repository browser.