My Project
Toggle main menu visibility
Loading...
Searching...
No Matches
Singular
pyobject_setup.cc
Go to the documentation of this file.
1
// -*- c++ -*-
2
//*****************************************************************************
3
/** @file pyobject_setup.cc
4
*
5
* @author Alexander Dreyer
6
* @date 2010-12-15
7
*
8
* This header file defines the @c blackbox setup operations for the pyobject
9
*
10
* @par Copyright:
11
* (c) 2010 by The Singular Team, see LICENSE file
12
**/
13
//*****************************************************************************
14
15
#include "
kernel/mod2.h
"
16
17
#include "
Singular/blackbox.h
"
18
#include "
Singular/ipshell.h
"
19
20
static
BOOLEAN
pyobject_load
()
21
{
22
return
jjLOAD
(
"pyobject.so"
,
TRUE
);
23
}
24
25
/// blackbox support - initialization via autoloading
26
void
*
pyobject_autoload
(blackbox* bbx)
27
{
28
assume
(bbx !=
NULL
);
29
return
(
pyobject_load
() || (bbx->blackbox_Init ==
pyobject_autoload
)?
30
NULL
: bbx->blackbox_Init(bbx));
31
}
32
33
void
pyobject_default_destroy
(blackbox *
/*b*/
,
void
*
/*d*/
)
34
{
35
WerrorS
(
"Python-based functionality not available!"
);
36
}
37
38
// Setting up an empty blackbox type, which can be filled with pyobject
39
void
pyobject_setup
()
40
{
41
blackbox *bbx = (blackbox*)
omAlloc0
(
sizeof
(blackbox));
42
bbx->blackbox_Init =
pyobject_autoload
;
43
bbx->blackbox_destroy =
pyobject_default_destroy
;
44
setBlackboxStuff
(bbx,
"pyobject"
);
45
}
46
47
/// Explicitely load, if not loaded already
48
BOOLEAN
pyobject_ensure
()
49
{
50
51
int
tok = -1;
52
blackbox* bbx = (
blackboxIsCmd
(
"pyobject"
, tok) ==
ROOT_DECL
?
53
getBlackboxStuff
(tok): (blackbox*)
NULL
);
54
if
(bbx ==
NULL
)
return
TRUE
;
55
return
(bbx->blackbox_Init ==
pyobject_autoload
?
pyobject_load
():
FALSE
);
56
}
BOOLEAN
int BOOLEAN
Definition
auxiliary.h:88
TRUE
#define TRUE
Definition
auxiliary.h:101
FALSE
#define FALSE
Definition
auxiliary.h:97
setBlackboxStuff
int setBlackboxStuff(blackbox *bb, const char *n)
define a new type
Definition
blackbox.cc:143
getBlackboxStuff
blackbox * getBlackboxStuff(const int t)
return the structure to the type given by t
Definition
blackbox.cc:17
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
blackbox.h
WerrorS
void WerrorS(const char *s)
Definition
feFopen.cc:24
ROOT_DECL
@ ROOT_DECL
Definition
grammar.cc:320
jjLOAD
BOOLEAN jjLOAD(const char *s, BOOLEAN autoexport)
load lib/module given in v
Definition
iparith.cc:5593
ipshell.h
mod2.h
assume
#define assume(x)
Definition
mod2.h:389
omAlloc0
#define omAlloc0(size)
Definition
omAllocDecl.h:211
NULL
#define NULL
Definition
omList.c:12
pyobject_setup
void pyobject_setup()
initialize blackbox support for pyobject; functionilty os autoloaded on demand
Definition
pyobject_setup.cc:39
pyobject_load
static BOOLEAN pyobject_load()
Definition
pyobject_setup.cc:20
pyobject_ensure
BOOLEAN pyobject_ensure()
Explicitely load, if not loaded already.
Definition
pyobject_setup.cc:48
pyobject_default_destroy
void pyobject_default_destroy(blackbox *, void *)
Definition
pyobject_setup.cc:33
pyobject_autoload
void * pyobject_autoload(blackbox *bbx)
blackbox support - initialization via autoloading
Definition
pyobject_setup.cc:26
Generated on
for My Project by
doxygen 1.17.0
for
Singular