source: git/Singular/blackbox.h @ 9aac3e

spielwiese
Last change on this file since 9aac3e was 92d684, checked in by Oleksandr Motsak <motsak@…>, 13 years ago
ADD: python - related changes FIX: removed C++-related heades (unused anyway) FIX: blackbox
  • Property mode set to 100644
File size: 2.8 KB
RevLine 
[295381]1#ifndef BLACKBOX_H
2#define BLACKBOX_H
[92d684]3
4#include <misc/auxiliary.h>
[b5f5444]5#include <omalloc/omalloc.h>
[92d684]6
[295381]7#include <kernel/structs.h>
8#include <kernel/febase.h>
[92d684]9
10#include <Singular/lists.h>
[f84c3b]11#include <Singular/silink.h>
[295381]12
13void removeBlackboxStuff(const int rt);
14
15struct blackbox_struct;
16
17typedef struct blackbox_struct blackbox;
18
19struct  blackbox_struct
20{
[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);
[e6d9a32]55
[c728c0]56/// default procedure blackboxDefaultOp2, to be called as "default:" branch
57BOOLEAN blackboxDefaultOp2(int op,leftv l, leftv r1, leftv r2);
[295381]58
[e6d9a32]59/// default procedure blackboxDefaultOpM, to be called as "default:" branch
60BOOLEAN blackbox_default_OpM(int op,leftv l, leftv r);
61
[437cb48]62/// return the structure to the type given by t
[295381]63blackbox* getBlackboxStuff(const int t);
[437cb48]64/// return the name to the type given by t (r/o)
[295381]65const char *    getBlackboxName(const int t);
[437cb48]66/// used by scanner: returns ROOTDECL for known types (and the type number in t)
[295381]67int blackboxIsCmd(const char *n, int & tok);
[437cb48]68/// define a new type
[2df510]69int setBlackboxStuff(blackbox *bb,const char *name);
[295381]70
[437cb48]71/// list all defined type (for debugging)
[295381]72void printBlackboxTypes();
73
[f24733]74/// Emit an "op not implemented" error message and return TRUE
75BOOLEAN WrongOp(const char* cmd, int op, leftv bb);
76
[295381]77#endif
Note: See TracBrowser for help on using the repository browser.