Loading...
Searching...
No Matches
blackbox.h
Go to the documentation of this file.
#ifndef BLACKBOX_H
#define BLACKBOX_H
#include "kernel/mod2.h"
#include "kernel/structs.h"
#include "Singular/lists.h"
#include "Singular/links/silink.h"
void removeBlackboxStuff(const int rt);
struct blackbox_struct;
typedef struct blackbox_struct blackbox;
struct blackbox_struct
{
/// destroy the object: b points to blackbox_struct, d to data
void (*blackbox_destroy)(blackbox *b, void *d);
/// convert the object to a string (which should be freed by omFree)
char *(*blackbox_String)(blackbox *b,void *d);
/// print the object: default: use string representation
void (*blackbox_Print)(blackbox *b,void *d);
/// construct the default object
void *(*blackbox_Init)(blackbox *b);
/// copy the object: b points to blackbox_struct, d to data
void *(*blackbox_Copy)(blackbox *b,void *d);
/// interpreter assign: l:=r
BOOLEAN (*blackbox_Assign)(leftv l, leftv r);
/// interpreter: unary operations op(r), r(), ...
// convention for blackbox_Op1..blackbox_OpM:
// return FALSE, if op was successfully performed
// return TRUE (and an error message) for failure
// return TRUE (and no error message) if not defined
BOOLEAN (*blackbox_Op1)(int op,leftv l, leftv r);
/// interpreter: binary operations: op(r1,r2), r1 op r2,...
BOOLEAN (*blackbox_Op2)(int op,leftv l, leftv r1,leftv r2);
/// interpreter: tertiary op: op(r1,r2,r3)
BOOLEAN (*blackbox_Op3)(int op,leftv l, leftv r1,leftv r2, leftv r3);
/// interpreter: operations with undefined number of operands
BOOLEAN (*blackbox_OpM)(int op,leftv l, leftv r);
/// is an assign of r to l (part of b) impossible?
BOOLEAN (*blackbox_CheckAssign)(blackbox *b,leftv l, leftv r);
/// serialize
BOOLEAN (*blackbox_serialize)(blackbox *b,void *d, si_link f);
/// deserialize
BOOLEAN (*blackbox_deserialize)(blackbox **b,void **d, si_link f);
/// additional type info
void *data;
/// additional general properties
int properties; // bit 0:blackbox is only a wrapper for lists
#define BB_LIKE_LIST(B) ((B)->properties &1)
} ;
/// default procedure blackboxDefaultOp1, to be called as "default:" branch
BOOLEAN blackboxDefaultOp1(int op,leftv l, leftv r);
/// default procedure blackboxDefaultOp2, to be called as "default:" branch
BOOLEAN blackboxDefaultOp2(int op,leftv l, leftv r1, leftv r2);
/// default procedure blackboxDefaultOp3, to be called as "default:" branch
BOOLEAN blackboxDefaultOp3(int op,leftv l, leftv r1,leftv r2, leftv r3);
/// default procedure blackboxDefaultOpM, to be called as "default:" branch
BOOLEAN blackboxDefaultOpM(int op,leftv l, leftv r);
/// default procedure blackbox_default_Print: print the string
void blackbox_default_Print(blackbox *b,void *d);
/// return the structure to the type given by t
blackbox* getBlackboxStuff(const int t);
/// return the name to the type given by t (r/o)
const char * getBlackboxName(const int t);
/// used by scanner: returns ROOT_DECL for known types
/// (and the type number in @c tok)
int blackboxIsCmd(const char *n, int & tok);
/// define a new type
int setBlackboxStuff(blackbox *bb,const char *name);
/// list all defined type (for debugging)
void printBlackboxTypes();
/// struct for containing list of blackbox names and the number of them.
struct blackbox_list {
int count;
void **list;
};
/// return array of all define types.
struct blackbox_list *getBlackboxTypes();
#endif
BOOLEAN
int BOOLEAN
Definition auxiliary.h:88
getBlackboxTypes
struct blackbox_list * getBlackboxTypes()
return array of all define types.
Definition blackbox.cc:245
blackbox_list::list
void ** list
Definition blackbox.h:86
blackbox_struct::blackbox_Assign
BOOLEAN(* blackbox_Assign)(leftv l, leftv r)
interpreter assign: l:=r
Definition blackbox.h:30
blackbox_struct::blackbox_deserialize
BOOLEAN(* blackbox_deserialize)(blackbox **b, void **d, si_link f)
deserialize
Definition blackbox.h:48
getBlackboxName
const char * getBlackboxName(const int t)
return the name to the type given by t (r/o)
Definition blackbox.cc:213
removeBlackboxStuff
void removeBlackboxStuff(const int rt)
Definition blackbox.cc:206
blackbox_struct::blackbox_Op3
BOOLEAN(* blackbox_Op3)(int op, leftv l, leftv r1, leftv r2, leftv r3)
interpreter: tertiary op: op(r1,r2,r3)
Definition blackbox.h:40
blackbox_struct::blackbox_CheckAssign
BOOLEAN(* blackbox_CheckAssign)(blackbox *b, leftv l, leftv r)
is an assign of r to l (part of b) impossible?
Definition blackbox.h:44
blackbox_struct::data
void * data
additional type info
Definition blackbox.h:50
blackboxDefaultOp3
BOOLEAN blackboxDefaultOp3(int op, leftv l, leftv r1, leftv r2, leftv r3)
default procedure blackboxDefaultOp3, to be called as "default:" branch
Definition blackbox.cc:102
blackbox_struct::blackbox_destroy
void(* blackbox_destroy)(blackbox *b, void *d)
destroy the object: b points to blackbox_struct, d to data
Definition blackbox.h:20
getBlackboxStuff
blackbox * getBlackboxStuff(const int t)
return the structure to the type given by t
Definition blackbox.cc:17
setBlackboxStuff
int setBlackboxStuff(blackbox *bb, const char *name)
define a new type
Definition blackbox.cc:143
blackbox_default_Print
void blackbox_default_Print(blackbox *b, void *d)
default procedure blackbox_default_Print: print the string
Definition blackbox.cc:55
blackboxIsCmd
int blackboxIsCmd(const char *n, int &tok)
used by scanner: returns ROOT_DECL for known types (and the type number in tok)
Definition blackbox.cc:219
blackboxDefaultOpM
BOOLEAN blackboxDefaultOpM(int op, leftv l, leftv r)
default procedure blackboxDefaultOpM, to be called as "default:" branch
Definition blackbox.cc:107
blackbox_struct::blackbox_OpM
BOOLEAN(* blackbox_OpM)(int op, leftv l, leftv r)
interpreter: operations with undefined number of operands
Definition blackbox.h:42
blackbox_struct::blackbox_Op2
BOOLEAN(* blackbox_Op2)(int op, leftv l, leftv r1, leftv r2)
interpreter: binary operations: op(r1,r2), r1 op r2,...
Definition blackbox.h:38
blackbox_struct::properties
int properties
additional general properties
Definition blackbox.h:52
printBlackboxTypes
void printBlackboxTypes()
list all defined type (for debugging)
Definition blackbox.cc:236
blackbox_struct::blackbox_Print
void(* blackbox_Print)(blackbox *b, void *d)
print the object: default: use string representation
Definition blackbox.h:24
blackbox_list::count
int count
Definition blackbox.h:85
blackbox_struct::blackbox_Op1
BOOLEAN(* blackbox_Op1)(int op, leftv l, leftv r)
interpreter: unary operations op(r), r(), ...
Definition blackbox.h:36
blackboxDefaultOp2
BOOLEAN blackboxDefaultOp2(int op, leftv l, leftv r1, leftv r2)
default procedure blackboxDefaultOp2, to be called as "default:" branch
Definition blackbox.cc:97
blackbox_struct::blackbox_serialize
BOOLEAN(* blackbox_serialize)(blackbox *b, void *d, si_link f)
serialize
Definition blackbox.h:46
blackboxDefaultOp1
BOOLEAN blackboxDefaultOp1(int op, leftv l, leftv r)
default procedure blackboxDefaultOp1, to be called as "default:" branch
Definition blackbox.cc:78
blackbox_list
struct for containing list of blackbox names and the number of them.
Definition blackbox.h:84
blackbox_struct
Definition blackbox.h:18
l
int l
Definition cfEzgcd.cc:100
b
CanonicalForm b
Definition cfModGcd.cc:4111
f
FILE * f
Definition checklibs.c:9
name
char name(const Variable &v)
Definition factory.h:189
lists.h
mod2.h
silink.h
si_link
ip_link * si_link
Definition silink.h:20
structs.h
leftv
sleftv * leftv
Definition structs.h:53