 |
My Project
UNKNOWN_GIT_VERSION
|
Go to the documentation of this file.
125 return complain(
"Back-reference broken");
129 return complain(
"Referenced identifier not from current ring");
132 complain(
"Referenced identifier not available in ring anymore");
138 complain(
"Referenced identifier not available in current context");
217 int typ = arg->
Typ();
314 return self(
static_cast<data_type*
>(data));
332 res->data = (
void*) data;
359 else PrintS(
"<unassigned reference or shared memory>");
393 WerrorS(
"Can only take reference from identifier");
401 WerrorS(
"Noninitialized access");
569 int typ =
head->Typ();
583 int typ =
head->Typ();
604 (
char*)
next->Data(): (
char*)
next->Name());
607 if (strcmp(
name,
"help") == 0)
609 PrintS(
"system(<ref>, ...): extended functionality for reference/shared data <ref>\n");
610 PrintS(
" system(<ref>, count) - number of references pointing to <ref>\n");
611 PrintS(
" system(<ref>, enumerate) - unique number for identifying <ref>\n");
612 PrintS(
" system(<ref>, undefined) - checks whether <ref> had been assigned\n");
613 PrintS(
" system(<ref>, \"help\") - prints this information message\n");
614 PrintS(
" system(<ref>, \"typeof\") - actual type referenced by <ref>\n");
615 PrintS(
" system(<ref1>, same, <ref2>) - tests for identic reference objects\n");
618 if (strncmp(
name,
"undef", 5) == 0)
631 if (strncmp(
name,
"count", 5) == 0)
return obj.
count(
res);
633 if (strcmp(
name,
"name") == 0)
return obj.
name(
res);
634 if (strncmp(
name,
"typ", 3) == 0)
return obj.
type(
res);
682 memset(&
l,0,
sizeof(
l));
706 blackbox *bbx = (blackbox*)
omAlloc0(
sizeof(blackbox));
730 blackbox *bbxshared = (blackbox*)
omAlloc0(
sizeof(blackbox));
BOOLEAN type(leftv res)
Get type of references data.
BOOLEAN ringed()
Test whether we reference to ring-dependent data.
BOOLEAN countedref_Assign(leftv result, leftv arg)
blackbox support - assign element
CountedRefData()
Construct shared memory empty Singular object.
void countedref_shared_load()
void release()
Store actual pointer.
BOOLEAN unassigned() const
Check whether data is all-zero.
BOOLEAN put(leftv result)
Put a shallow copy to given leftv.
back_ptr::ptr_type ptr_type
Fix smart pointer type to referenced data.
count_type count() const
Store actual pointer.
int id_type
name type for identifiers
Construct even deeper copy: Skip identifier (if any) and take care of the data on our own.
BOOLEAN countedref_Op1Shared(int op, leftv res, leftv head)
Blackbox support - unary operation for shared data.
self & operator=(const self &)
Fix smart pointer type to referenced data.
int newstruct_desc_size()
BOOLEAN likewise(leftv res, leftv arg)
Check for likewise identifiers.
BOOLEAN rering()
Determine active ring when ring dependency changes.
static BOOLEAN is_ref(leftv arg)
Check whether argument is already a reference type.
BOOLEAN iiExprArith1(leftv res, leftv a, int op)
BOOLEAN countedref_CheckAssign(blackbox *, leftv, leftv)
We use the function pointer as a marker of reference types for CountedRef::is_ref(leftv),...
CountedRefData(leftv data)
Reference Singular object.
LeftvDeep::copy_tag copy_tag
Fix smart pointer type to referenced data.
BOOLEAN brokenid(idhdl context) const
Check a given context for our identifier.
CountedRef(const self &rhs)
Construct copy.
CountedRefData(leftv data, copy_tag do_copy)
Construct reference for Singular object.
void countedref_destroy(blackbox *, void *ptr)
blackbox support - destruction
static BOOLEAN countedref_Op2_(int op, leftv res, leftv head, leftv arg)
blackbox support - binary operations (resolve seocnd argument)
Ths class wraps leftv by taking into acount memory allocation, destruction as well as shallowly copyi...
BOOLEAN iiExprArithM(leftv res, leftv a, int op)
BOOLEAN dereference(leftv arg)
Replaces argument by a shallow copy of the references data.
~CountedRefData()
Destruct.
static ring parent(leftv rhs)
Store ring for ring-dependent objects.
data_type * outcast()
Construct raw reference data.
BOOLEAN isid() const
Check for being an identifier.
BOOLEAN put(leftv res)
Write (shallow) copy to given handle.
void invalidate()
Mark weak reference as invalid.
BOOLEAN retrieve(leftv res)
Get additional data (e.g. subexpression data) from likewise instances.
This class wraps leftv by taking into acount memory allocation, destruction as well as deeply copying...
Class used for (list of) interpreter objects.
CountedRefShared()
Default constructor for initialized, but all-zero, shared data object.
bool unassigned() const
Test whether reference was never used.
static BOOLEAN construct(leftv res, const char *data)
Construct string.
BOOLEAN enumerate(leftv res)
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
BOOLEAN name(leftv res)
Get (possibly) internal identifier name.
static BOOLEAN resolve(leftv arg)
If necessary dereference.
static BOOLEAN countedref_Op3_(int op, leftv res, leftv head, leftv arg1, leftv arg2)
BOOLEAN countedref_Op2(int op, leftv res, leftv head, leftv arg)
void countedref_reference_load()
Initialize blackbox types 'reference' and 'shared', or both.
char * countedref_String(blackbox *, void *ptr)
blackbox support - convert to string representation
idhdl * root()
Get the current context.
LeftvShallow operator*() const
Extract (shallow) copy of stored data.
BOOLEAN retrieve(leftv res)
Recover additional information (e.g. subexpression) from likewise object.
BOOLEAN countedref_Op3(int op, leftv res, leftv head, leftv arg1, leftv arg2)
blackbox support - ternary operations
BOOLEAN retrieve(leftv res, int typ)
Recover more information (e.g. subexpression data) from computed result.
void PrintS(const char *s)
This class stores a reference counter as well as a Singular interpreter object.
self & operator=(const self &rhs)
Replace reference.
BOOLEAN assign(leftv result, leftv arg)
CountedRefData(leftv wrapid, back_ptr back)
Generate object linked to other reference (e.g. for subscripts)
void destruct()
Kills a link to the referenced object.
static self cast(leftv arg)
Recover the actual object from Singular interpreter object.
BOOLEAN countedref_serialize(blackbox *, void *d, si_link f)
LeftvShallow operator*()
Extract (shallow) copy of stored data.
CountedRef(data_ptr arg)
Recover previously constructed reference.
CountedRefData data_type
Name type for handling referenced data.
data_ptr m_data
Store pointer to actual data.
BOOLEAN countedref_AssignShared(leftv result, leftv arg)
blackbox support - assign element
back_ptr weakref()
Gerenate weak (but managed) reference to *this.
CountedRef(leftv arg)
Reference given Singular data.
int blackboxIsCmd(const char *n, int &tok)
used by scanner: returns ROOT_DECL for known types (and the type number in tok)
BOOLEAN broken() const
Check whether identifier became invalid.
BOOLEAN countedref_OpM(int op, leftv res, leftv args)
blackbox support - n-ary operations
BOOLEAN countedref_Op1(int op, leftv res, leftv head)
blackbox support - unary operations
This class implements implements a refernce counter which we can use as a public base of objects mana...
static BOOLEAN construct(leftv res)
Construct void-style object.
CountedRefShared(leftv arg)
Construct internal copy of Singular interpreter object.
void countedref_destroyShared(blackbox *, void *ptr)
blackbox support - destruction
BOOLEAN jjLIST_PL(leftv res, leftv v)
BOOLEAN iiExprArith3(leftv res, int op, leftv a, leftv b, leftv c)
BOOLEAN count(leftv res)
Get number of references pointing here, too.
leftv idify(idhdl *root)
Wrap data by identifier, if not done yet.
BOOLEAN outcast(leftv res)
Construct reference data object from *this.
~CountedRef()
Kills the link to the referenced object.
BOOLEAN complain(const char *text) const
Raise error message and return TRUE.
static self cast(void *data)
Recover the actual object from raw Singular data.
BOOLEAN countedref_deserialize(blackbox **, void **d, si_link f)
BOOLEAN unassigned() const
Check whether (all-zero) initialized data was never assigned.
BOOLEAN assign(leftv result, leftv arg)
Reassign actual object.
LeftvDeep m_data
Singular object.
BOOLEAN blackboxDefaultOp1(int op, leftv l, leftv r)
default procedure blackboxDefaultOp1, to be called as "default:" branch
self & operator=(const self &rhs)
Change reference to shared data.
back_ptr m_back
Reference to actual object for wrap structures.
void * countedref_InitShared(blackbox *)
Blackbox support - generate initialized, but all-zero - shared data.
BOOLEAN iiExprArith2(leftv res, leftv a, int op, leftv b, BOOLEAN proccall)
BOOLEAN same(leftv res, leftv arg)
Check for identical reference objects.
void * countedref_Init(blackbox *)
blackbox support - initialization
BOOLEAN broken()
Check whether object in valid in current context.
self & operator=(leftv rhs)
Replace with other Singular data.
void CountedRefPtr_kill(ring r)
Overloading ring destruction.
CountedRefPtr< CountedRefData * > data_ptr
Fix smart pointer type to referenced data.
void clearid(idhdl *root)
Erase identifier handles by *this.
BOOLEAN unassigned() const
Check whether (shared) data was initialized but not assigned yet.
void reclaim()
Store actual pointer.
CountedRefShared(const base &rhs)
Reinterprete CountedRef as CountedRefShared.
char name(const Variable &v)
void WerrorS(const char *s)
This file defines reusable classes supporting reference counted interpreter objects and initiates the...
ring_ptr m_ring
Store namespace for ring-dependent objects.
self wrapid()
Temporarily wrap with identifier for '[' and '.' operation.
static self cast(leftv arg)
Recovering outcasted CountedRefShared object from interpreter object.
static self cast(void *arg)
Recovering outcasted CountedRefShared object from raw data.
static BOOLEAN construct(leftv res, long data)
Construct integer value.
const char * Tok2Cmdname(int tok)
CountedRefShared(data_ptr rhs)
Generate from data pointer.
ptr_type wrapid()
Generate object for indexing.
CountedRefWeakPtr< self * > back_ptr
CountedRefData(const self &)
Fix smart pointer type to referenced data.
static BOOLEAN countedref_Op3__(int op, leftv res, leftv head, leftv arg1, leftv arg2)
blackbox * getBlackboxStuff(const int t)
return the structure to the type given by t
BOOLEAN outcast(leftv res, int typ)
Construct reference data object marked by given identifier number.
CountedRefPtr< ring, true > ring_ptr
Fix smart pointer type to ring.
BOOLEAN iiAssign(leftv l, leftv r, BOOLEAN toplevel)
void countedref_Print(blackbox *, void *ptr)
blackbox support - convert to string representation
void * countedref_Copy(blackbox *, void *ptr)
blackbox support - copy element
BOOLEAN countedref_Op2Shared(int op, leftv res, leftv head, leftv arg)
blackbox support - binary operations
BOOLEAN countedref_CheckInit(leftv res, leftv arg)
data_type::back_ptr weakref()
Generate weak reference (may get invalid)
CountedRefShared(const self &rhs)
Construct new reference to internal data.
int setBlackboxStuff(blackbox *bb, const char *n)
define a new type
~CountedRefShared()
Desctruct.