Compiler Instance Hierarchy

Data Structures

struct  ChildListEntry
struct  ChildDescR
struct  ChildDescI
struct  ChildDescS
union  ChildDescUnion
struct  ChildDesc
struct  ChildHash
struct  ChildListStructure
union  for_union_t
struct  for_var_t
struct  Instance
struct  NameNode
union  InstanceNameUnion
struct  InstanceName
struct  RealInstance
struct  IntegerInstance
struct  BooleanInstance
struct  SetInstance
struct  SymbolInstance
struct  CommonAtomInstance
struct  RealAtomInstance
struct  IntegerAtomInstance
struct  BooleanAtomInstance
struct  SetAtomInstance
struct  SymbolAtomInstance
struct  CommonConstantInstance
struct  RealConstantInstance
struct  IntegerConstantInstance
struct  BooleanConstantInstance
struct  SymbolConstantInstance
struct  RelationInstance
struct  LogRelInstance
struct  PendInstance
struct  ModelInstance
struct  WhenInstance
struct  ArrayChild
struct  ArrayInstance
struct  SimulationInstance
struct  GlobalDummyInstance
struct  parpendingentry
struct  pending_t
struct  SearchEntry
struct  set_t
struct  real_value_t
union  value_union
struct  value_t
struct  visitmapinfo

Files

file  instance_types.h
file  instmacro.h

Defines

#define CAC(acp)   ((struct ArrayChild *)(acp))
#define MALLOCPOOLAC   CAC(pool_get_element(g_array_child_pool))
#define FREEPOOLAC(ac)   pool_free_element(g_array_child_pool,(ac))
#define CheckInstance(a, b)   CheckInstanceLevel((a),(b),5)
#define AliasingOrigin(ori)
#define ParametricOrigin(ori)   ((ori) >= origin_PALI && (ori) <= origin_PWB)
#define ChildVisible(cl, n)   ((ChildGetBooleans((cl),(n)) & CBF_VISIBLE)!=0)
#define ChildSupported(cl, n)   ((ChildGetBooleans((cl),(n)) & CBF_SUPPORTED)!=0)
#define ChildPassed(cl, n)   ((ChildGetBooleans((cl),(n)) & CBF_PASSED) !=0)
#define ChildHide(cl, n)   ChildSetBoolean((cl),(n),CBF_VISIBLE,0)
#define ChildShow(cl, n)   ChildSetBoolean((cl),(n),CBF_VISIBLE,1)
#define NUM_FUNDTYPES   5
#define ICDESC(x)   CDescInit(&(x))
#define ICDESCPTR(y)   CDescInit(y)
#define AssignChildArrayElement(a, n, e)   AssignChildArrayElementF((a),(n),(e))
#define GetChildArrayElement(a, n)   GetChildArrayElementF((a),(n))
#define ChildDescType(e)   ChildDescTypeF(e)
#define ValueAssigned(e)   ValueAssignedF(e)
#define IntegerDefault(e)   IntegerDefaultF(e)
#define BooleanDefault(e)   BooleanDefaultF(e)
#define SetDefault(e)   SetDefaultF(e)
#define SetIsIntegerSet(e)   SetIsIntegerSetF(e)
#define SymbolDefault(e)   SymbolDefaultF(e)
#define RealDefaultValue(e)   RealDefaultValueF(e)
#define RealDimensions(e)   RealDimensionsF(e)
#define LegalOrigin(n)   ( ((n)>0 && (n) <=8) ? (n) : 0 )
#define CHILDHASHINDEX(p)   (((((asc_intptr_t) (p))*1103515245) >> 22) & 255)
#define CHILDHASHTABLESIZE   256
#define CGET(l, n)   ((struct ChildListEntry *)gl_fetch((l)->list,(n)))
#define CNAME(l, n)   ((l)->data[(n)-1].sym)
#define GGET(l, n)   ((struct ChildListEntry *)gl_fetch((l),(n)))
#define CPUT(l, p)   gl_insert_sorted((l)->list,(p),(CmpFunc)CmpChildListEntries)
#define GL(a)   (a)->list
#define GN(a)   (a)->symbols
#define CmpParents   CmpRealPtrs
#define CmpRelations   CmpRealPtrs
#define CmpLogRelations   CmpRealPtrs
#define CmpWhens   CmpRealPtrs
#define MESSYTHRESH   10
#define FINDEBUG   0
#define GetDeclarativeContext()   g_DeclarativeContext
#define SetDeclarativeContext(n)   g_DeclarativeContext = (n)
#define EVALDEBUG   0
#define GetEvaluationContext()   GetEvaluationContextF()
#define GetEvaluationForTable()   GetEvaluationForTableF()
#define SetEvaluationContext(i)   SetEvaluationContextF(i)
#define SetEvaluationForTable(ft)   SetEvaluationForTableF(ft)
#define for_table_t   gl_list_t
#define IREAL   0x1
#define IINT   0x2
#define IBOOL   0x4
#define ISYM   0x8
#define ISET   0x10
#define IARR   0x20
#define IENUM   0x40
#define IFUND   0x80
#define ICONS   0x100
#define IATOM   0x200
#define ICOMP   0x400
#define IMOD   0x800
#define IRELN   0x1000
#define ILRELN   0x2000
#define IWHEN   0x4000
#define IAUTO   0x8000
#define IDUMB   0x10000
#define ICHILDLESS   (IFUND | ICONS | IWHEN | IDUMB)
#define IERRINST
#define ASC_ENUM_DECLS(D, X)
#define InstanceNameType(in)   ((in).t)
#define InstanceNameStr(in)   ((in).u.name)
#define InstanceIntIndex(in)   ((in).u.index)
#define InstanceStrIndex(in)   ((in).u.name)
#define SetInstanceNameType(in, type)   ((in).t) = (type)
#define SetInstanceNameStrPtr(in, str)   ((in).u.name) = (str)
#define SetInstanceNameStrIndex(in, str)   ((in).u.name) = (str)
#define SetInstanceNameIntIndex(in, int_index)   ((in).u.index) = (int_index)
#define LONGCHILDREN   0
#define SOL_ASSIGNED   0x1
#define SOL_FIXED   0x2
#define SOL_INACTIVELB   0x4
#define SOL_INACTIVEUB   0x8
#define SOL_ODESTATE   0x10
#define SOL_ODEOBSERVE   0x20
#define SOL_ISZERO   0x40
#define SOL_INTEGER   0x80
#define SOL_RELAXEDINT   0x100
#define SOL_INTERVAL   0x200
#define SOL_COMPLEX   0x400
#define SOL_DOMAIN   0x800
#define SOL_ODEINDEP   0x1000
#define SOL_NODOF   0x2000
#define SOL_PARAMETRIC   0x4000
#define SOL_INTENSIVE   0x8000
#define SOL_NONBASIC   0x10000
#define SOL_TIGHTLB   0x100000
#define SOL_TIGHTUB   0x200000
#define SOL_NOELIG   0x400000
#define NORELS   0x0
#define GBOXRELS   0x1
#define BBOXRELS   0x2
#define TOKRELS   0x4
#define ALLRELS   (GBOXRELS | BBOXRELS | TOKRELS)
#define EXTRELS   (GBOXRELS | BBOXRELS)
#define Instantiate(a, b, c, d)   NewInstantiate((a),(b),(c),(d))
#define ReInstantiate(a)   NewReInstantiate(a)
#define AVG_CONSTANT_PARENTS   2L
#define AVG_ICONSTANT_PARENTS   20L
#define AVG_PARENTS   2L
#define AVG_CASES   2L
#define AVG_WHEN   2L
#define AVG_RELATIONS   7L
#define AVG_LOGRELS   7L
#define AVG_ARY_CHILDREN   7L
#define AVG_LINKS   4
#define AVG_LINKS_INST   4
#define UNDEFAULTEDREAL   0.0
#define MAX_EXTRELATIONS   50
#define INST(i)   ((struct Instance *)(i))
#define SIM_INST(i)   ((struct SimulationInstance *)(i))
#define RELN_INST(i)   ((struct RelationInstance *)(i))
#define LRELN_INST(i)   ((struct LogRelInstance *)(i))
#define ARY_INST(i)   ((struct ArrayInstance *)(i))
#define MOD_INST(i)   ((struct ModelInstance *)(i))
#define W_INST(i)   ((struct WhenInstance *)(i))
#define R_INST(i)   ((struct RealInstance *)(i))
#define I_INST(i)   ((struct IntegerInstance *)(i))
#define B_INST(i)   ((struct BooleanInstance *)(i))
#define S_INST(i)   ((struct SetInstance *)(i))
#define SYM_INST(i)   ((struct SymbolInstance *)(i))
#define CI_INST(i)   ((struct CommonConstantInstance *)(i))
#define RC_INST(i)   ((struct RealConstantInstance *)(i))
#define IC_INST(i)   ((struct IntegerConstantInstance *)(i))
#define BC_INST(i)   ((struct BooleanConstantInstance *)(i))
#define SYMC_INST(i)   ((struct SymbolConstantInstance *)(i))
#define CA_INST(i)   ((struct CommonAtomInstance *)(i))
#define RA_INST(i)   ((struct RealAtomInstance *)(i))
#define BA_INST(i)   ((struct BooleanAtomInstance *)(i))
#define IA_INST(i)   ((struct IntegerAtomInstance *)(i))
#define SA_INST(i)   ((struct SetAtomInstance *)(i))
#define SYMA_INST(i)   ((struct SymbolAtomInstance *)(i))
#define SOL_INST(i)   ((struct SolverAtomInstance *)(i))
#define D_INST(i)   ((struct GlobalDummyInstance *)(i))
#define CIASS(i)   (CI_INST(i)->vflag & ci_ASSIGNED)
#define BCV(i)   ((BC_INST(i)->vflag & ci_BVAL) == ci_BVAL)
#define R_PARENT(i)   INST((asc_intptr_t)i-(asc_intptr_t)R_INST(i)->parent_offset)
#define I_PARENT(i)   INST((asc_intptr_t)i-(asc_intptr_t)I_INST(i)->parent_offset)
#define B_PARENT(i)   INST((asc_intptr_t)i-(asc_intptr_t)B_INST(i)->parent_offset)
#define S_PARENT(i)   INST((asc_intptr_t)i-(asc_intptr_t)S_INST(i)->parent_offset)
#define SYM_PARENT(i)   INST((asc_intptr_t)i-(asc_intptr_t)SYM_INST(i)->parent_offset)
#define NextHighestEven(ivalue)   (((ivalue) & 1) ? ((ivalue)+1) : (ivalue))
#define CHILD_ADR(iptr, type, c)   ((struct Instance **)((asc_intptr_t)iptr+(asc_intptr_t)sizeof(type))+c)
#define SIM_CHILD(i, c)   CHILD_ADR(i,struct SimulationInstance,c)
#define MOD_CHILD(i, c)   CHILD_ADR(i,struct ModelInstance,c)
#define RA_CHILD(i, c)   CHILD_ADR(i,struct RealAtomInstance,c)
#define BA_CHILD(i, c)   CHILD_ADR(i,struct BooleanAtomInstance,c)
#define IA_CHILD(i, c)   CHILD_ADR(i,struct IntegerAtomInstance,c)
#define SA_CHILD(i, c)   CHILD_ADR(i,struct SetAtomInstance,c)
#define SYMA_CHILD(i, c)   CHILD_ADR(i,struct SymbolAtomInstance,c)
#define REL_CHILD(i, c)   CHILD_ADR(i,struct RelationInstance,c)
#define LREL_CHILD(i, c)   CHILD_ADR(i,struct LogRelInstance,c)
#define CLIST(in, type)   (struct Instance **)((asc_intptr_t)(in)+sizeof(type))
#define BASE_ADDR(in, num, type)   INST((CLIST(in,type)) + NextHighestEven(num))
#define NotAtom(i)   NotAtomF(i)
#define InstanceKind(i)   InstanceKindF(i)
#define IsConstantInstance(i)   ((i)->t & ICONS)
#define IsFundamentalInstance(i)   ((i)->t & IFUND)
#define IsAtomicInstance(i)   ((i)->t & IATOM)
#define IsCompoundInstance(i)   ((i)->t & ICOMP)
#define IsArrayInstance(i)   ((i)->t & IARR)
#define IsChildlessInstance(i)   ((i)->t & ICHILDLESS)
#define InstanceUniversal(i)   (GetUniversalFlag(InstanceTypeDesc(i)) != 0)
#define PendingInstance(pt)   PendingInstanceF(pt)
#define MAXIMUM_ID_LENGTH   80
#define IVAL(x)   ValInit(&(x))
#define IVALPTR(y)   ValInit(y)
#define ValueKind(v)   ((v).t)
#define IntegerValue(v)   ((v).u.i)
#define RealValue(v)   ((v).u.r.value)
#define BooleanValue(v)   ((v).u.b)
#define RealValueDimensions(v)   ((v).u.r.dimp)
#define SetValue(v)   ((v).u.sptr)
#define SymbolValue(v)   ((v).u.sym_ptr)
#define ErrorValue(v)   ((v).u.t)
#define IsConstantValue(v)   ((v).constant)
#define BothConstantValue(va, vb)   ((va).constant && (vb).constant)
#define SetConstantValue(v)   ((v).constant = 1)
#define SetVariableValue(v)   ((v).constant = 0)
#define FIRSTCHOICE   1
#define VisitInstanceTree(a, b, c, d)   SlowVisitInstanceTree(a,b,c,d)
#define VisitNameTreeTwo(a, b, c, d, e, f)   SlowVisitNameTreeTwo((a), (b), (c), (d), (e), (f))
#define FALSE   0
#define MODEL_ON   0x1
#define MODEL_IN_WHEN   0x2
#define MODEL_ACTIVE   0x4
#define model_on(m)   model_flagbit((m),MODEL_ON)
#define model_in_when(m)   model_flagbit((m),MODEL_IN_WHEN)
#define model_active(m)   model_flagbit((m),MODEL_ACTIVE)
#define model_set_on(m, bv)   model_set_flagbit((m),MODEL_ON,(bv))
#define model_set_in_when(m, bv)   model_set_flagbit((m),MODEL_IN_WHEN,(bv))
#define model_set_active(m, bv)   model_set_flagbit((m),MODEL_ACTIVE,(bv))
#define RELINST_ON   0x1
#define RELINST_CONDITIONAL   0x2
#define RELINST_IN_WHEN   0x4
#define LOGRELINST_ON   0x8
#define LOGRELINST_CONDITIONAL   0x10
#define LOGRELINST_IN_WHEN   0x20
#define relinst_on(r)   relinst_flagbit((r),RELINST_ON)
#define relinst_conditional(r)   relinst_flagbit((r),RELINST_CONDITIONAL)
#define relinst_in_when(r)   relinst_flagbit((r),RELINST_IN_WHEN)
#define logrelinst_on(lr)   logrelinst_flagbit((lr),LOGRELINST_ON)
#define logrelinst_conditional(lr)   logrelinst_flagbit((lr),LOGRELINST_CONDITIONAL)
#define logrelinst_in_when(lr)   logrelinst_flagbit((lr),LOGRELINST_IN_WHEN)
#define relinst_set_on(r, bv)   relinst_set_flagbit((r),RELINST_ON,(bv))
#define relinst_set_conditional(r, bv)   relinst_set_flagbit((r),RELINST_CONDITIONAL,(bv))
#define relinst_set_in_when(r, bv)   relinst_set_flagbit((r),RELINST_IN_WHEN,(bv))
#define logrelinst_set_on(lr, bv)   logrelinst_set_flagbit((lr),LOGRELINST_ON,(bv))
#define logrelinst_set_conditional(lr, bv)   logrelinst_set_flagbit((lr),LOGRELINST_CONDITIONAL,(bv))
#define logrelinst_set_in_when(lr, bv)   logrelinst_set_flagbit((lr),LOGRELINST_IN_WHEN,(bv))

Typedefs

typedef void(* AVProc )(struct Instance *)
typedef CONST struct
ChildListStructure
ChildListPtr
typedef VOIDPTR(* IPFunc )(struct Instance *, VOIDPTR)
typedef VOIDPTR(* IPDeleteFunc )(struct Instance *, VOIDPTR, VOIDPTR)
typedef void(* VisitProc )(struct Instance *)
typedef void(* VisitTwoProc )(struct Instance *, VOIDPTR)
typedef void(* IndexedVisitProc )(struct Instance *, unsigned long *, int, VOIDPTR)
typedef void(* VisitNameProc )(struct Instance *, struct gl_list_t *)
typedef void(* VisitNameTwoProc )(struct Instance *, struct gl_list_t *, VOIDPTR)

Enumerations

enum  ChildDescT {
  bad_child, real_child, integer_child, boolean_child,
  set_child, symbol_child
}
enum  Copy_enum { c_none, c_reference, c_tomodify }
enum  find_errors { unmade_instance, undefined_instance, impossible_instance, correct_instance }
enum  for_kind { f_untyped, f_integer, f_symbol, f_set }
enum  inst_t
enum  NameTypes { IntArrayIndex, StrArrayIndex, StrName }
enum  ppstatus {
  pp_ERR = 0, pp_ISA, pp_ISAARR, pp_ARR,
  pp_ASGN, pp_ASSC, pp_ASAR, pp_WV,
  pp_DONE
}
enum  set_kind { integer_set, string_set, empty_set }
enum  evaluation_error {
  type_conflict, name_unfound, incorrect_name, temporary_variable_reused,
  undefined_value, dimension_conflict, incorrect_such_that, empty_choice,
  empty_intersection, illegal_set_use
}
enum  value_kind {
  real_value, integer_value, symbol_value, boolean_value,
  list_value, set_value, error_value
}
enum  visitmap_enum { vimap_ERROR = -1, vimap_DOWN, vimap_UP }

Functions

void InitInstanceNanny (void)
void DestroyInstanceNanny (void)
void ReportInstanceNanny (FILE *f)
struct gl_list_tCollectArrayInstances (CONST struct Instance *i, struct gl_list_t *list)
void ArrayVisitLocalLeaves (struct Instance *mch, AVProc func)
ASC_DLLSPEC struct InstanceChildByChar (CONST struct Instance *i, symchar *str)
int RectangleArrayExpanded (CONST struct Instance *i)
int RectangleSubscriptsMatch (CONST struct Instance *context, CONST struct Instance *ary, CONST struct Name *subscripts)
unsigned long NextToExpand (CONST struct Instance *i)
unsigned long NumberofDereferences (CONST struct Instance *i)
CONST struct SetIndexSet (CONST struct Instance *i, unsigned long num)
void ExpandArray (struct Instance *i, unsigned long num, struct set_t *set, struct Instance *rhsinst, struct Instance *arginst, struct gl_list_t *rhslist)
struct InstanceFindOrAddIntChild (struct Instance *i, long v, struct Instance *rhsinst, struct Instance *arginst)
struct InstanceFindOrAddStrChild (struct Instance *i, symchar *sym, struct Instance *rhsinst, struct Instance *arginst)
int CmpArrayInsts (struct Instance *i1, struct Instance *i2)
unsigned long ConstantByteLength (enum inst_t it)
unsigned long RealAtomByteLength (unsigned long num_children, CONST struct ChildDesc *c)
unsigned long IntegerAtomByteLength (unsigned long num_children, CONST struct ChildDesc *c)
unsigned long BooleanAtomByteLength (unsigned long num_children, CONST struct ChildDesc *c)
unsigned long SetAtomByteLength (unsigned long num_children, CONST struct ChildDesc *c)
unsigned long SymbolAtomByteLength (unsigned long num_children, CONST struct ChildDesc *c)
unsigned long RelationAtomByteLength (unsigned long num_children, CONST struct ChildDesc *c)
unsigned long LogRelAtomByteLength (unsigned long num_children, CONST struct ChildDesc *c)
ASC_DLLSPEC unsigned AtomAssigned (CONST struct Instance *i)
ASC_DLLSPEC unsigned AtomMutable (CONST struct Instance *i)
unsigned DepthAssigned (CONST struct Instance *i)
ASC_DLLSPEC double RealAtomValue (CONST struct Instance *i)
ASC_DLLSPEC void SetRealAtomValue (struct Instance *i, double d, unsigned depth)
ASC_DLLSPEC CONST dim_typeRealAtomDims (CONST struct Instance *i)
ASC_DLLSPEC void SetRealAtomDims (struct Instance *i, CONST dim_type *dim)
ASC_DLLSPEC long GetIntegerAtomValue (CONST struct Instance *i)
ASC_DLLSPEC void SetIntegerAtomValue (struct Instance *i, long v, unsigned depth)
ASC_DLLSPEC int GetBooleanAtomValue (CONST struct Instance *i)
ASC_DLLSPEC void SetBooleanAtomValue (struct Instance *i, int truth, unsigned depth)
ASC_DLLSPEC CONST struct set_tSetAtomList (CONST struct Instance *i)
int AssignSetAtomList (struct Instance *i, struct set_t *list)
int GetSetAtomKind (CONST struct Instance *i)
ASC_DLLSPEC symcharGetSymbolAtomValue (CONST struct Instance *i)
ASC_DLLSPEC void SetSymbolAtomValue (struct Instance *i, symchar *s)
int CmpAtomValues (CONST struct Instance *i1, CONST struct Instance *i2)
ASC_DLLSPEC void CheckInstanceLevel (FILE *f, CONST struct Instance *i, int pass)
void CheckInstanceStructure (FILE *f, CONST struct Instance *i)
void InstanceTokenStatistics (FILE *f, CONST struct Instance *i)
ASC_DLLSPEC void InstanceStatistics (FILE *f, CONST struct Instance *i)
int CmpChildListEntries (CONST struct ChildListEntry *e1, CONST struct ChildListEntry *e2)
ChildListPtr CreateChildList (struct gl_list_t *l)
void DestroyChildList (ChildListPtr cl)
ChildListPtr AppendChildList (ChildListPtr cl, struct gl_list_t *l)
ASC_DLLSPEC unsigned long ChildListLen (ChildListPtr cl)
ASC_DLLSPEC symcharChildStrPtr (ChildListPtr cl, unsigned long n)
unsigned int ChildIsArray (ChildListPtr cl, unsigned long n)
unsigned int ChildOrigin (ChildListPtr cl, unsigned long n)
unsigned int ChildAliasing (ChildListPtr cl, unsigned long n)
unsigned int ChildParametric (ChildListPtr cl, unsigned long n)
CONST struct StatementChildStatement (ChildListPtr cl, unsigned long n)
ASC_DLLSPEC unsigned ChildGetBooleans (ChildListPtr cl, unsigned long n)
ASC_DLLSPEC void ChildSetBoolean (ChildListPtr cl, unsigned long n, unsigned cbfname, unsigned val)
ASC_DLLSPEC struct
TypeDescription
ChildBaseTypePtr (ChildListPtr cl, unsigned long n)
ASC_DLLSPEC unsigned long ChildPos (ChildListPtr cl, symchar *s)
int CompareChildLists (ChildListPtr cl, ChildListPtr c2, unsigned long *diff)
int BaseType (symchar *name)
struct ChildDescMakeChildDesc (symchar *name, struct StatementList *sl, ChildListPtr clist)
unsigned long CalcByteSize (enum type_kind t, ChildListPtr clist, struct ChildDesc *childd)
void CDescInit (struct ChildDesc *c)
struct ChildDescCreateChildDescArray (unsigned long l)
struct ChildDescCreateEmptyChildDescArray (void)
void DestroyChildDescArray (struct ChildDesc *c, unsigned long l)
void AssignChildArrayElementF (struct ChildDesc *a, unsigned long n, struct ChildDesc e)
struct ChildDesc GetChildArrayElementF (CONST struct ChildDesc *a, unsigned long n)
enum ChildDescT ChildDescTypeF (struct ChildDesc e)
int ValueAssignedF (struct ChildDesc e)
long IntegerDefaultF (struct ChildDesc e)
int BooleanDefaultF (struct ChildDesc e)
CONST struct set_tSetDefaultF (struct ChildDesc e)
int SetIsIntegerSetF (struct ChildDesc e)
symcharSymbolDefaultF (struct ChildDesc e)
double RealDefaultValueF (struct ChildDesc e)
CONST dim_typeRealDimensionsF (struct ChildDesc e)
struct ChildDesc MakeRealDesc (int assigned, double v, CONST dim_type *dims)
struct ChildDesc MakeIntegerDesc (int assigned, long i)
struct ChildDesc MakeBooleanDesc (int assigned, int b)
struct ChildDesc MakeSetDesc (int assigned, int intset, struct set_t *s)
struct ChildDesc MakeSymbolDesc (int assigned, symchar *str)
ASC_DLLSPEC void WriteChildList (FILE *fp, ChildListPtr cl)
ASC_DLLSPEC char * WriteChildDetails (ChildListPtr cl, unsigned long n)
ASC_DLLSPEC CONST char * WriteChildMetaDetails (void)
ASC_DLLSPEC void WriteChildMissing (FILE *fp, char *scope, symchar *childname)
ASC_DLLSPEC int CmpSymchar (symchar *s1, symchar *s2)
int CmpPtrs (const void *p1, const void *p2)
ASC_DLLSPEC int CmpRealPtrs (const void *p1, const void *p2)
int CmpParentsF (CONST struct Instance *i1, CONST struct Instance *i2)
int CmpRelationsF (CONST struct Instance *i1, CONST struct Instance *i2)
int CmpLogRelationsF (CONST struct Instance *i1, CONST struct Instance *i2)
int CmpWhensF (CONST struct Instance *i1, CONST struct Instance *i2)
int CmpPtrsReverse (void *p1, void *p2)
void CheckChildCopies (unsigned long int num, struct Instance **clist)
void RedoChildPointers (unsigned long int num, struct Instance *newparent, struct Instance **newchildptrs, CONST struct Instance *oldparent, struct Instance *CONST *oldchildptrs)
struct InstanceShortCutMakeUniversalInstance (struct TypeDescription *type)
void CollectNodes (struct Instance *i, struct gl_list_t *l)
struct InstanceShortCutProtoInstance (struct TypeDescription *type)
ASC_DLLSPEC struct InstanceCopyInstance (CONST struct Instance *i)
void ZeroNewChildrenEntries (struct Instance **ary, unsigned long int num)
struct InstanceCreateSimulationInstance (struct TypeDescription *type, symchar *name)
struct InstanceCreateModelInstance (struct TypeDescription *type)
struct InstanceCreateDummyInstance (struct TypeDescription *type)
struct InstanceCreateRealInstance (struct TypeDescription *type)
struct InstanceCreateIntegerInstance (struct TypeDescription *type)
struct InstanceCreateBooleanInstance (struct TypeDescription *type)
struct InstanceCreateSetInstance (struct TypeDescription *type, int intset)
struct InstanceCreateSymbolInstance (struct TypeDescription *type)
struct InstanceCreateArrayInstance (struct TypeDescription *type, unsigned long aIndex)
struct InstanceCreateRelationInstance (struct TypeDescription *type, enum Expr_enum reltype)
struct InstanceCreateLogRelInstance (struct TypeDescription *type)
struct InstanceCreateWhenInstance (struct TypeDescription *type)
ASC_DLLSPEC void DestroyInstance (struct Instance *inst, struct Instance *parent)
void InitDump (void)
ASC_DLLSPEC void EmptyTrash (void)
void TendTrash (void)
void TrashType (symchar *str)
void AddInstance (struct Instance *i)
struct InstanceFindInstance (symchar *str)
struct Instance ** AddVarToTable (struct Instance *inst, int *added)
void FixExternalVars (struct Instance *old, struct Instance *new)
void SetSimulationExtVars (struct Instance *i, struct Instance **extvars)
struct InstanceGetEvaluationContextF (void)
struct for_table_t * GetEvaluationForTableF (void)
void SetEvaluationContextF (CONST struct Instance *i)
void SetEvaluationForTableF (struct for_table_t *ft)
struct value_t InstanceEvaluateName (CONST struct Name *nptr)
struct value_t InstanceEvaluateSatisfiedName (CONST struct Name *nptr, double tol)
struct gl_list_tFindInstances (CONST struct Instance *i, CONST struct Name *n, enum find_errors *err)
struct gl_list_tFindInstancesFromNames (CONST struct Instance *i, CONST struct gl_list_t *names, enum find_errors *err, unsigned long *errpos)
struct gl_list_tFindInstancesPaths (CONST struct Instance *i, CONST struct Name *n, enum find_errors *err)
struct for_table_t * CreateForTable (void)
void DestroyForTable (struct for_table_t *ft)
void WriteForTable (FILE *out, struct for_table_t *ft)
unsigned long ActiveForLoops (CONST struct for_table_t *ft)
void AddLoopVariable (struct for_table_t *ft, struct for_var_t *var)
struct for_var_tLoopIndex (CONST struct for_table_t *ft, unsigned long num)
struct for_var_tFindForVar (CONST struct for_table_t *ft, symchar *name)
void RemoveForVariable (struct for_table_t *ft)
struct for_var_tCreateForVar (symchar *name)
void SetForVarType (struct for_var_t *ft, enum for_kind t)
void SetForInteger (struct for_var_t *fv, long ivalue)
void SetForSymbol (struct for_var_t *fv, symchar *sym_ptr)
void SetForSet (struct for_var_t *fv, struct set_t *sptr)
enum for_kind GetForKind (CONST struct for_var_t *fv)
symcharGetForName (CONST struct for_var_t *fv)
long GetForInteger (CONST struct for_var_t *fv)
symcharGetForSymbol (CONST struct for_var_t *fv)
CONST struct set_tGetForSet (CONST struct for_var_t *fv)
void DestroyForVar (struct for_var_t *fv)
int ClearForVarRecycle (void)
CONST char * instance_typename (CONST struct Instance *inst)
struct gl_list_tShortestPath (CONST struct Instance *inst, CONST struct Instance *ref, unsigned int height, unsigned int best)
struct gl_list_tAllPaths (CONST struct Instance *inst)
struct gl_list_tISAPaths (CONST struct gl_list_t *pathlist)
ASC_DLLSPEC int WriteInstanceName (FILE *f, CONST struct Instance *i, CONST struct Instance *ref)
void WriteInstanceNameDS (Asc_DString *dsPtr, CONST struct Instance *i, CONST struct Instance *ref)
ASC_DLLSPEC char * WriteInstanceNameString (CONST struct Instance *i, CONST struct Instance *ref)
ASC_DLLSPEC int WriteAnyInstanceName (FILE *f, struct Instance *i)
ASC_DLLSPEC unsigned long CountAliases (CONST struct Instance *i)
ASC_DLLSPEC unsigned long CountISAs (CONST struct Instance *i)
void WriteAliases (FILE *f, CONST struct Instance *i)
void WriteISAs (FILE *f, CONST struct Instance *i)
ASC_DLLSPEC struct gl_list_tWriteAliasStrings (CONST struct Instance *i)
ASC_DLLSPEC struct gl_list_tWriteISAStrings (CONST struct Instance *i)
void WriteClique (FILE *f, CONST struct Instance *i)
ASC_DLLSPEC void WriteInstance (FILE *f, CONST struct Instance *i)
int WritePath (FILE *f, CONST struct gl_list_t *path)
char * WritePathString (CONST struct gl_list_t *path)
ASC_DLLSPEC void SaveInstance (FILE *f, CONST struct Instance *inst, int dorelations)
void WriteInstanceList (struct gl_list_t *list)
ASC_DLLSPEC void WriteAtomValue (FILE *fp, CONST struct Instance *i)
struct gl_list_tPushInterfacePtrs (struct Instance *i, IPFunc ipcreatef, unsigned long int iest, int visitorder, VOIDPTR vp)
void PopInterfacePtrs (struct gl_list_t *oldips, IPDeleteFunc ipdestroyf, VOIDPTR vp)
ASC_DLLSPEC int ArrayIsRelation (struct Instance *i)
ASC_DLLSPEC int ArrayIsLogRel (struct Instance *i)
ASC_DLLSPEC int ArrayIsWhen (struct Instance *i)
int ArrayIsModel (struct Instance *i)
void SetInstantiationRelnFlags (unsigned int flag)
unsigned int GetInstantiationRelnFlags (void)
struct InstanceNewInstantiate (symchar *type, symchar *name, int intset, symchar *defmethod)
ASC_DLLSPEC void NewReInstantiate (struct Instance *i)
ASC_DLLSPEC void UpdateInstance (struct Instance *root, struct Instance *target, CONST struct StatementList *slist)
struct InstanceInstantiatePatch (symchar *patch, symchar *name, int intset)
void ConfigureInstFromArgs (struct Instance *inst, CONST struct Instance *arginst)
void ReConfigureInstFromArgs (struct Instance *inst, CONST struct Instance *arginst)
void LinkToParentByPos (struct Instance *parent, struct Instance *child, unsigned long childnum)
int IncompleteArray (CONST struct Instance *i)
int NotAtomF (struct Instance *)
ASC_DLLSPEC enum inst_t InstanceKindF (CONST struct Instance *i)
unsigned long InstanceDepth (CONST struct Instance *i)
ASC_DLLSPEC unsigned long InstanceShortDepth (CONST struct Instance *i)
void SetNextCliqueMember (struct Instance *i, struct Instance *ptr)
ASC_DLLSPEC struct InstanceNextCliqueMember (CONST struct Instance *i)
ASC_DLLSPEC VOIDPTR GetInterfacePtr (CONST struct Instance *i)
ASC_DLLSPEC void SetInterfacePtr (struct Instance *i, VOIDPTR c)
unsigned int GetAnonFlags (CONST struct Instance *i)
void SetAnonFlags (struct Instance *i, unsigned int flags)
ASC_DLLSPEC struct BitListInstanceBitList (CONST struct Instance *i)
ASC_DLLSPEC symcharInstanceType (CONST struct Instance *i)
ASC_DLLSPEC struct
TypeDescription
InstanceTypeDesc (CONST struct Instance *i)
unsigned long InstanceIndirected (CONST struct Instance *i)
unsigned long InstanceSize (CONST struct Instance *i)
ASC_DLLSPEC int IntegerSetInstance (CONST struct Instance *i)
ASC_DLLSPEC symcharGetSimulationName (struct Instance *i)
struct gl_list_tFindSimulationAncestors (struct Instance *i)
ASC_DLLSPEC struct InstanceGetSimulationRoot (struct Instance *i)
ASC_DLLSPEC struct InstanceFindSimulationInstance (struct Instance *i)
void ChangeRelationPointers (struct Instance *rel, struct Instance *old, struct Instance *new)
void ChangeLogRelPointers (struct Instance *lrel, struct Instance *old, struct Instance *new)
void ChangeWhenPointers (struct Instance *when, struct Instance *old, struct Instance *new)
void ChangeParent (struct Instance *parent, struct Instance *oldchild, struct Instance *newchild)
void ReDirectParents (struct Instance *oldinst, struct Instance *newinst)
void ReDirectChildren (struct Instance *oldinst, struct Instance *newinst)
void ReorderChildrenPtrs (struct Instance **c, CONST ChildListPtr oldinst, CONST ChildListPtr newinst, unsigned long int oldlen, unsigned long int newlen)
void FixCliques (struct Instance *old, struct Instance *new)
void FixRelations (struct RealAtomInstance *old, struct RealAtomInstance *new)
void FixLogRelations (struct Instance *old, struct Instance *new)
void FixWhens (struct Instance *old, struct Instance *new)
void FixWhensForRefinement (struct Instance *old, struct Instance *new)
ASC_DLLSPEC enum Expr_enum GetInstanceRelationType (CONST struct Instance *i)
ASC_DLLSPEC CONST struct relationGetInstanceRelationOnly (CONST struct Instance *i)
ASC_DLLSPEC CONST struct relationGetInstanceRelation (CONST struct Instance *i, enum Expr_enum *type)
struct relationGetInstanceRelToModify (struct Instance *i, enum Expr_enum *type)
void SetInstanceRelation (struct Instance *i, struct relation *rel, enum Expr_enum type)
ASC_DLLSPEC CONST struct
logrelation
GetInstanceLogRelOnly (CONST struct Instance *i)
ASC_DLLSPEC CONST struct
logrelation
GetInstanceLogRel (CONST struct Instance *i)
struct logrelationGetInstanceLogRelToModify (struct Instance *i)
void SetInstanceLogRel (struct Instance *i, struct logrelation *lrel)
ASC_DLLSPEC struct gl_list_tGetInstanceOperands (CONST struct Instance *i)
struct gl_list_tGetInstanceWhenVars (CONST struct Instance *i)
struct gl_list_tGetInstanceWhenCases (CONST struct Instance *i)
struct gl_list_tGetInstanceWhens (CONST struct Instance *i)
void SetWhenVarList (struct Instance *i, struct gl_list_t *whenvars)
void SetWhenCases (struct Instance *i, struct gl_list_t *whencases)
ASC_DLLSPEC unsigned long RelationsCount (CONST struct Instance *i)
ASC_DLLSPEC struct InstanceRelationsForAtom (CONST struct Instance *i, unsigned long c)
void AddRelation (struct Instance *i, struct Instance *reln)
void RemoveRelation (struct Instance *i, struct Instance *reln)
ASC_DLLSPEC unsigned long LogRelationsCount (CONST struct Instance *i)
ASC_DLLSPEC struct InstanceLogRelationsForInstance (CONST struct Instance *i, unsigned long c)
void AddLogRel (struct Instance *i, struct Instance *reln)
void RemoveLogRel (struct Instance *i, struct Instance *lreln)
ASC_DLLSPEC unsigned long WhensCount (struct Instance *i)
ASC_DLLSPEC struct InstanceWhensForInstance (struct Instance *i, unsigned long c)
void AddWhen (struct Instance *i, struct Instance *when)
void RemoveWhen (struct Instance *i, struct Instance *when)
ASC_DLLSPEC struct InstanceMergeInstances (struct Instance *i1, struct Instance *i2)
ASC_DLLSPEC void PostMergeCheck (struct Instance *i)
ASC_DLLSPEC void MergeCliques (struct Instance *i1, struct Instance *i2)
ASC_DLLSPEC unsigned long NumberParents (CONST struct Instance *i)
ASC_DLLSPEC struct InstanceInstanceParent (CONST struct Instance *i, unsigned long n)
unsigned long SearchForParent (CONST struct Instance *i, CONST struct Instance *p)
void DeleteParent (struct Instance *i, unsigned long pos)
ASC_DLLSPEC struct InstanceName ParentsName (CONST struct Instance *p, CONST struct Instance *c)
void AddParent (struct Instance *i, struct Instance *p)
ASC_DLLSPEC unsigned long NumberChildren (CONST struct Instance *i)
ASC_DLLSPEC struct InstanceInstanceChild (CONST struct Instance *i, unsigned long n)
ASC_DLLSPEC struct InstanceName ChildName (CONST struct Instance *i, unsigned long n)
ASC_DLLSPEC CONST struct
Statement
ChildDeclaration (CONST struct Instance *i, unsigned long n)
CONST struct TypeDescriptionChildRefines (CONST struct Instance *i, unsigned long n)
ASC_DLLSPEC unsigned long ChildSearch (CONST struct Instance *i, CONST struct InstanceName *name)
ASC_DLLSPEC unsigned long ChildIndex (CONST struct Instance *i, CONST struct Instance *child)
void StoreChildPtr (struct Instance *i, unsigned long n, struct Instance *child)
struct parpendingentryCreatePPE (void)
void DestroyPPE (struct parpendingentry *ppe)
void ppe_init_pool (void)
void ppe_destroy_pool (void)
void ppe_report_pool (void)
void InitPendingPool (void)
void DestroyPendingPool (void)
void ReportPendingPool (FILE *f)
struct InstancePendingInstanceF (CONST struct pending_t *pt)
void ClearList (void)
unsigned long NumberPending (void)
void AddBelow (struct pending_t *pt, struct Instance *i)
void AddToEnd (struct Instance *i)
void RemoveInstance (struct Instance *i)
void PendingInstanceRealloced (struct Instance *old_inst, struct Instance *new_inst)
int InstanceInList (struct Instance *i)
struct pending_tTopEntry (void)
struct pending_tListEntry (unsigned long n)
struct pending_tBottomEntry (void)
void MoveToBottom (struct pending_t *pt)
ASC_DLLSPEC unsigned long NumberPendingInstances (struct Instance *i)
void InitializePrototype (void)
ASC_DLLSPEC struct InstanceLookupPrototype (symchar *t)
void DeletePrototype (symchar *t)
ASC_DLLSPEC void AddPrototype (struct Instance *i)
ASC_DLLSPEC void DestroyPrototype (void)
ASC_DLLSPEC char * Asc_MakeInitString (int len)
ASC_DLLSPEC void Asc_ReInitString (char *str)
ASC_DLLSPEC struct SearchEntryAsc_SearchEntryCreate (char *name, struct Instance *i)
ASC_DLLSPEC struct InstanceAsc_SearchEntryInstance (struct SearchEntry *se)
ASC_DLLSPEC char * Asc_SearchEntryName (struct SearchEntry *se)
ASC_DLLSPEC void Asc_SearchEntryDestroy (struct SearchEntry *se)
ASC_DLLSPEC void Asc_SearchListDestroy (struct gl_list_t *search_list)
ASC_DLLSPEC struct gl_list_tAsc_BrowQlfdidSearch (char *str, char *temp)
ASC_DLLSPEC int Asc_QlfdidSearch2 (char *str)
ASC_DLLSPEC int Asc_QlfdidSearch3 (CONST char *str, int relative)
struct InstanceRefineInstance (struct Instance *i, struct TypeDescription *type, struct Instance *arginst)
ASC_DLLSPEC struct InstanceRefineClique (struct Instance *i, struct TypeDescription *type, struct Instance *arginst)
void WriteInstSet (FILE *f, CONST struct set_t *s)
void InitSetManager (void)
void DestroySetManager (void)
void ReportSetManager (FILE *f)
struct set_tCreateEmptySet (void)
void InsertInteger (struct set_t *set, asc_intptr_t i)
void InsertIntegerRange (struct set_t *set, long lower, long upper)
void InsertString (struct set_t *set, symchar *str)
struct set_tSetUnion (CONST struct set_t *s1, CONST struct set_t *s2)
struct set_tSetIntersection (CONST struct set_t *s1, CONST struct set_t *s2)
struct set_tSetDifference (CONST struct set_t *s1, CONST struct set_t *s2)
struct set_tCopySet (CONST struct set_t *set)
int IntMember (asc_intptr_t i, CONST struct set_t *set)
int StrMember (symchar *str, CONST struct set_t *set)
void DestroySet (struct set_t *set)
int NullSet (CONST struct set_t *set)
ASC_DLLSPEC unsigned long Cardinality (CONST struct set_t *set)
ASC_DLLSPEC symcharFetchStrMember (CONST struct set_t *set, unsigned long n)
ASC_DLLSPEC asc_intptr_t FetchIntMember (CONST struct set_t *set, unsigned long n)
void SetIterate (struct set_t *set, void(*func)())
ASC_DLLSPEC enum set_kind SetKind (CONST struct set_t *set)
int SetsEqual (CONST struct set_t *s1, CONST struct set_t *s2)
int Subset (CONST struct set_t *s1, CONST struct set_t *s2)
int CmpSetInstVal (CONST struct set_t *s1, CONST struct set_t *s2)
void AppendIntegerElement (struct set_t *set, asc_intptr_t i)
void AppendStringElement (struct set_t *set, symchar *str)
unsigned long GetTmpNum (CONST struct Instance *i)
void SetTmpNum (struct Instance *i, unsigned long int n)
unsigned long IncrementTmpNum (struct Instance *i)
unsigned long DecrementTmpNum (struct Instance *i)
void ZeroTmpNums (struct Instance *i, int order)
void InitValueManager (void)
void DestroyValueManager (void)
void ReportValueManager (FILE *f)
void ValInit (struct value_t *v)
struct value_t CopyValue (struct value_t value)
struct value_t CreateRealValue (double value, CONST dim_type *dim, unsigned constant)
struct value_t CreateIntegerValue (long value, unsigned constant)
struct value_t CreateSymbolValue (symchar *sym_ptr, unsigned constant)
struct value_t CreateBooleanValue (int truth, unsigned constant)
struct value_t CreateSetValue (struct set_t *sptr)
struct value_t CreateSetFromList (struct value_t value)
struct value_t CreateOrderedSetFromList (struct value_t value)
struct value_t CreateErrorValue (enum evaluation_error t)
struct value_t CreateVacantListValue (void)
struct value_t CreateEmptyListValue (void)
void AppendToListValue (struct value_t list, struct value_t value)
void DestroyValue (struct value_t *value)
struct value_t AddValues (struct value_t value1, struct value_t value2)
struct value_t SubtractValues (struct value_t value1, struct value_t value2)
struct value_t MultiplyValues (struct value_t value1, struct value_t value2)
struct value_t DivideValues (struct value_t value1, struct value_t value2)
struct value_t PowerValues (struct value_t value1, struct value_t value2)
struct value_t CardValues (struct value_t value)
struct value_t ChoiceValues (struct value_t value)
struct value_t SumValues (struct value_t value)
struct value_t ProdValues (struct value_t value)
struct value_t UnionValues (struct value_t value)
struct value_t IntersectionValues (struct value_t value)
struct value_t OrValues (struct value_t value1, struct value_t value2)
struct value_t AndValues (struct value_t value1, struct value_t value2)
struct value_t InValues (struct value_t value1, struct value_t value2)
struct value_t EqualValues (struct value_t value1, struct value_t value2)
struct value_t NotEqualValues (struct value_t value1, struct value_t value2)
struct value_t LessValues (struct value_t value1, struct value_t value2)
struct value_t GreaterValues (struct value_t value1, struct value_t value2)
struct value_t LessEqValues (struct value_t value1, struct value_t value2)
struct value_t GreaterEqValues (struct value_t value1, struct value_t value2)
struct value_t ApplyFunction (struct value_t value, CONST struct Func *f)
struct value_t NegateValue (struct value_t value)
struct value_t NotValue (struct value_t value)
void ResetVisitCounts (struct Instance *inst)
ASC_DLLSPEC void SilentVisitInstanceTree (struct Instance *inst, VisitProc proc, int depth, int leaf)
void FastVisitInstanceTree (struct Instance *inst, VisitProc proc, int depth, int leaf)
ASC_DLLSPEC void SlowVisitInstanceTree (struct Instance *inst, VisitProc proc, int depth, int leaf)
void IndexedVisitInstanceTree (struct Instance *inst, IndexedVisitProc proc, int depth, int leaf, unsigned long **llist, unsigned int *llen, VOIDPTR userdata)
void SilentVisitInstanceTreeTwo (struct Instance *inst, VisitTwoProc proc, int depth, int leaf, VOIDPTR userdata)
ASC_DLLSPEC void VisitInstanceTreeTwo (struct Instance *inst, VisitTwoProc proc, int depth, int leaf, VOIDPTR userdata)
void SilentVisitInstanceFringeTwo (struct Instance *inst, VisitTwoProc proc1, VisitTwoProc proc2, int depth, int leaf, VOIDPTR userdata)
void VisitInstanceFringeTwo (struct Instance *inst, VisitTwoProc proc1, VisitTwoProc proc2, int depth, int leaf, VOIDPTR userdata)
void SilentVisitInstanceRootsTwo (struct Instance *inst, VisitTwoProc proc, int depth, VOIDPTR userdata)
struct visitmapinfoMakeVisitMap (struct Instance *inst, unsigned long *maplen)
void SilentVisitNameTreeTwo (struct Instance *inst, VisitNameTwoProc proc, int depth, int leaf, int anon_flags, VOIDPTR userdata)
void SlowVisitNameTreeTwo (struct Instance *inst, VisitNameTwoProc proc, int depth, int leaf, int anon_flags, VOIDPTR userdata)
void WriteWhen (FILE *f, CONST struct Instance *wheninst, CONST struct Instance *ref)
ASC_DLLSPEC char * WriteWhenString (CONST struct Instance *wheninst, CONST struct Instance *ref)
unsigned long NumberWhenVariables (CONST struct Instance *when)
struct InstanceWhenVariable (CONST struct Instance *when, unsigned long varnum)
int VarFoundInWhen (CONST struct Instance *var, CONST struct Instance *when)
unsigned long NumberWhenCases (CONST struct Instance *when)
struct CaseWhenCase (CONST struct Instance *when, unsigned long casenum)
void ModifyWhenPointers (struct gl_list_t *reforvar, CONST struct Instance *old, CONST struct Instance *new)
struct gl_list_tCopyWhenBVarList (struct Instance *dest_inst, struct gl_list_t *copylist)
struct gl_list_tCopyWhenCaseRefList (struct Instance *dest_inst, struct gl_list_t *copylist)
void DestroyWhenVarList (struct gl_list_t *l, struct Instance *inst)
void DestroyWhenCaseList (struct gl_list_t *l, struct Instance *inst)
unsigned int model_flags (struct Instance *mod)
void model_set_flags (struct Instance *mod, unsigned int flags)
unsigned int model_flagbit (CONST struct Instance *mod, unsigned int name)
void model_set_flagbit (struct Instance *mod, unsigned int NAME, unsigned int oneorzero)
unsigned int relinst_flags (struct Instance *rel)
void relinst_set_flags (struct Instance *rel, unsigned int flags)
unsigned int relinst_flagbit (CONST struct Instance *rel, unsigned int name)
void relinst_set_flagbit (struct Instance *rel, unsigned int NAME, unsigned int oneorzero)
unsigned int logrelinst_flags (struct Instance *lrel)
void logrelinst_set_flags (struct Instance *lrel, unsigned intflags)
unsigned int logrelinst_flagbit (CONST struct Instance *lrel, unsigned int name)
void logrelinst_set_flagbit (struct Instance *rel, unsigned int NAME, unsigned int oneorzero)

Variables

pool_store_t g_array_child_pool
symcharChildHash::sym
unsigned long ChildHash::clindex
struct gl_list_tChildListStructure::symbols
struct ChildHashChildListStructure::table [CHILDHASHTABLESIZE]
struct ChildHashChildListStructure::data
struct Instance ** g_ExtVariablesTable
int ListMode
int EvaluatingSets
int g_DeclarativeContext
CONST struct Instanceg_EvaluationContext
struct for_table_t * g_EvaluationForTable
ASC_DLLSPEC long int g_compiler_counter
struct RealInstanceg_r_inst
struct IntegerInstanceg_i_inst
struct BooleanInstanceg_b_inst
struct SetInstanceg_s_inst
struct SymbolInstanceg_sym_inst
struct RealConstantInstanceg_rc_inst
struct IntegerConstantInstanceg_ic_inst
struct BooleanConstantInstanceg_bc_inst
struct SetConstantInstance * g_sc_inst
struct SymbolConstantInstanceg_symc_inst
struct RealAtomInstanceg_ra_inst
struct IntegerAtomInstanceg_ia_inst
struct BooleanAtomInstanceg_ba_inst
struct SetAtomInstanceg_sa_inst
struct SymbolAtomInstanceg_syma_inst
struct ModelInstanceg_mod_inst
struct RelationInstanceg_rel_inst
struct LogRelInstanceg_lrel_inst
struct WhenInstanceg_when_inst
void(* InterfacePtrDelete )()
void(* InterfaceNotify )()
void(* InterfacePtrATS )()
ASC_DLLSPEC struct Instanceg_search_inst
ASC_DLLSPEC struct Instanceg_relative_inst

Define Documentation

#define CAC ( acp   )     ((struct ArrayChild *)(acp))

Definition at line 102 of file arrayinst.h.

#define MALLOCPOOLAC   CAC(pool_get_element(g_array_child_pool))

Get an element from the pool. Only call after InitInstanceNanny().

Definition at line 126 of file arrayinst.h.

#define FREEPOOLAC ( ac   )     pool_free_element(g_array_child_pool,(ac))

Return element ac to the pool. Only call after InitInstanceNanny().

Definition at line 128 of file arrayinst.h.

#define CheckInstance ( a,
 )     CheckInstanceLevel((a),(b),5)

Definition at line 44 of file check.h.

#define AliasingOrigin ( ori   ) 
Value:
((ori) == origin_PALI || (ori) == origin_ALI || \
   (ori) == origin_PARR || (ori) == origin_ARR)

Returns 1 if the value given is an alias sort.

Definition at line 121 of file child.h.

Referenced by ChildAliasing().

#define ParametricOrigin ( ori   )     ((ori) >= origin_PALI && (ori) <= origin_PWB)

Returns 1 if the value given is a parametric sort or 0 if not.

Definition at line 129 of file child.h.

Referenced by ChildParametric().

#define ChildVisible ( cl,
 )     ((ChildGetBooleans((cl),(n)) & CBF_VISIBLE)!=0)

Returns 1 if child has visibility bit turned on.

Definition at line 228 of file child.h.

Referenced by WriteChildDetails().

#define ChildSupported ( cl,
 )     ((ChildGetBooleans((cl),(n)) & CBF_SUPPORTED)!=0)

Returns 1 if child has supported bit turned on.

Definition at line 234 of file child.h.

Referenced by WriteChildDetails().

#define ChildPassed ( cl,
 )     ((ChildGetBooleans((cl),(n)) & CBF_PASSED) !=0)

Returns 1 if child has PASSED bit turned on.

Definition at line 240 of file child.h.

Referenced by WriteChildDetails().

#define ChildHide ( cl,
 )     ChildSetBoolean((cl),(n),CBF_VISIBLE,0)

Hide (presumably for display purposes) the nth child in cl.

Parameters:
cl CONST ChildListPtr*
n unsigned long

Definition at line 255 of file child.h.

#define ChildShow ( cl,
 )     ChildSetBoolean((cl),(n),CBF_VISIBLE,1)

Unhide (presumably for display purposes) the nth child in cl.

Parameters:
cl CONST ChildListPtr
n unsigned long

Definition at line 263 of file child.h.

#define NUM_FUNDTYPES   5

There are 5 allowable ATOM children types, at present. The functions BaseType and GetTypeInfoFromISA rely on a table and the ordering within it. This is a hack to restrict the types allowed as ATOM children.

Definition at line 60 of file childdef.h.

Referenced by BaseType().

#define ICDESC (  )     CDescInit(&(x))

Initialize a child description structure. x must be a struct ChildDesc variable, NOT a pointer to same. If you want to init a pointer contents, use ICDESCPTR().

Definition at line 110 of file childinfo.h.

Referenced by MakeBooleanDesc(), MakeIntegerDesc(), MakeRealDesc(), MakeSetDesc(), and MakeSymbolDesc().

#define ICDESCPTR (  )     CDescInit(y)

Initialize a child description structure via a pointer. y must be a pointer to a struct ChildDesc variable. If you want to init a ChildDesc variable directly, use ICDESC().

Definition at line 116 of file childinfo.h.

#define AssignChildArrayElement ( a,
n,
 )     AssignChildArrayElementF((a),(n),(e))

Set an element of a ChildDesc array.

Parameters:
a struct ChildDesc*, the array to modify.
n unsigned long, index of the element to set. Should be between 1 and the length of "a" (never 0).
e struct ChildDesc, the value to which element n should be set.
Returns:
No return value.
See also:
AssignChildArrayElementF()

Definition at line 161 of file childinfo.h.

#define GetChildArrayElement ( a,
 )     GetChildArrayElementF((a),(n))

Get an element from a ChildDesc array.

Parameters:
a struct ChildDesc*, the array to query.
n unsigned long, index of the element to retrieve. Should be between 1 and the length of "a" (never 0).
Returns:
Returns a ChildDesc corresponding to element n.
See also:
GetChildArrayElementF()

Definition at line 193 of file childinfo.h.

#define ChildDescType (  )     ChildDescTypeF(e)

Return the type of e.

Parameters:
e struct ChildDesc, the ChildDesc to query.
Returns:
Returns the ChildDescT of e.
See also:
ChildDescTypeF()

Definition at line 221 of file childinfo.h.

#define ValueAssigned (  )     ValueAssignedF(e)

Test whether ChildDesc e has been assigned a value.

Parameters:
e struct ChildDesc, the ChildDesc to query.
Returns:
Returns as an int a true value if e has been assigned a value, a false value otherwise.
See also:
ValueAssignedF()

Definition at line 244 of file childinfo.h.

#define IntegerDefault (  )     IntegerDefaultF(e)

Return the default value of integer ChildDesc e. The value is meaningless if e is not an integer_child, or if ValueAssigned(e) is not true.

Parameters:
e struct ChildDesc, the ChildDesc to query.
Returns:
Returns as a long the default value of e.
See also:
IntegerDefaultF()

Definition at line 269 of file childinfo.h.

#define BooleanDefault (  )     BooleanDefaultF(e)

Return the default value of boolean ChildDesc e. The value is meaningless if e is not an boolean_child, or if ValueAssigned(e) is not true.

Parameters:
e struct ChildDesc, the ChildDesc to query.
Returns:
Returns as an int the default value of e.
See also:
BooleanDefaultF()

Definition at line 295 of file childinfo.h.

#define SetDefault (  )     SetDefaultF(e)

Return the default value of set ChildDesc e. The value is meaningless if e is not an set_child, or if ValueAssigned(e) is not true.

Parameters:
e struct ChildDesc, the ChildDesc to query.
Returns:
Returns as a CONST struct set_t* the default value of e.
See also:
SetDefaultF()

Definition at line 321 of file childinfo.h.

#define SetIsIntegerSet (  )     SetIsIntegerSetF(e)

Return the set type of e. The value is meaningless if e is not a set_child, or if ValueAssigned(e) is not true.

Parameters:
e struct ChildDesc, the ChildDesc to query.
Returns:
Returns an int: 0 for a symbol set, 1 for an integer set.
See also:
SetIsIntegerSetF()

Definition at line 347 of file childinfo.h.

#define SymbolDefault (  )     SymbolDefaultF(e)

Return the default value of symbol ChildDesc e. The value is meaningless if e is not an symbol_child, or if ValueAssigned(e) is not true.

Parameters:
e struct ChildDesc, the ChildDesc to query.
Returns:
Returns as a symchar* the default value of e.
See also:
SymbolDefaultF()

Definition at line 371 of file childinfo.h.

#define RealDefaultValue (  )     RealDefaultValueF(e)

Return the default value of real ChildDesc e. The value is meaningless if e is not an real_child, or if ValueAssigned(e) is not true.

Parameters:
e struct ChildDesc, the ChildDesc to query.
Returns:
Returns as a double the default value of e.
See also:
RealDefaultValueF()

Definition at line 397 of file childinfo.h.

#define RealDimensions (  )     RealDimensionsF(e)

Return the units pointer of real ChildDesc e. The value is meaningless if e is not an real_child, or if ValueAssigned(e) is not true.

Parameters:
e struct ChildDesc, the ChildDesc to query.
Returns:
Returns as a CONST dim_type* the units pointer of e.
See also:
RealDimensionsF()

Definition at line 422 of file childinfo.h.

#define LegalOrigin (  )     ( ((n)>0 && (n) <=8) ? (n) : 0 )

origin of sanity (or sanity of origin) check. dependent on header

Definition at line 48 of file childpriv.h.

#define CHILDHASHINDEX (  )     (((((asc_intptr_t) (p))*1103515245) >> 22) & 255)

Hash function on heap pointers for 32 bit hardware. May need to revisit on high address architectures with 64 bit pointers. Creates a number 0 - 255.

Definition at line 61 of file childpriv.h.

Referenced by ChildPos().

#define CHILDHASHTABLESIZE   256

Must be 2^N with N even and must match CHILDHASHINDEX. buckets in every child hash table regardless of # of children.

Definition at line 67 of file childpriv.h.

#define CGET ( l,
 )     ((struct ChildListEntry *)gl_fetch((l)->list,(n)))
#define CNAME ( l,
 )     ((l)->data[(n)-1].sym)

return nth name of a child list ptr l

Definition at line 83 of file childpriv.h.

Referenced by ChildStrPtr().

#define GGET ( l,
 )     ((struct ChildListEntry *)gl_fetch((l),(n)))

return nth element of a gl list ptr l of entries to read.

Definition at line 85 of file childpriv.h.

Referenced by AppendChildList(), CreateChildList(), WriteChildDetails(), and WriteChildList().

#define CPUT ( l,
 )     gl_insert_sorted((l)->list,(p),(CmpFunc)CmpChildListEntries)

the following will always amount to an append of child list ptr with p remember to reconstruct the list of names and hash table when done.

Definition at line 89 of file childpriv.h.

Referenced by AppendChildList(), and CreateChildList().

#define GL (  )     (a)->list

macro to fetch the gl list of entries from the ChildListPtr

Definition at line 92 of file childpriv.h.

Referenced by AppendChildList(), ChildGetBooleans(), ChildListLen(), ChildSetBoolean(), DestroyChildList(), WriteChildDetails(), and WriteChildList().

#define GN (  )     (a)->symbols

macro to fetch the gl list of names from the ChildListPtr

Definition at line 94 of file childpriv.h.

#define CmpParents   CmpRealPtrs

Macro for redirection of CmpParents based on debug mode.

See also:
CmpRealPtrs(), CmpParentsF()

Definition at line 110 of file cmpfunc.h.

Referenced by AddParent().

#define CmpRelations   CmpRealPtrs

Macro for redirection of CmpRelations based on debug mode.

See also:
CmpRealPtrs(), CmpRelationsF()

Definition at line 130 of file cmpfunc.h.

Referenced by AddRelation(), and RemoveRelation().

#define CmpLogRelations   CmpRealPtrs

Macro for redirection of CmpLogRelations based on debug mode.

See also:
CmpRealPtrs(), CmpLogRelationsF()

Definition at line 150 of file cmpfunc.h.

Referenced by AddLogRel(), and RemoveLogRel().

#define CmpWhens   CmpRealPtrs

Macro for redirection of CmpWhens based on debug mode.

See also:
CmpRealPtrs(), CmpWhensF()

Definition at line 170 of file cmpfunc.h.

Referenced by AddWhen(), and RemoveWhen().

#define MESSYTHRESH   10

Definition at line 46 of file dump.h.

Referenced by TendTrash().

#define FINDEBUG   0

Definition at line 72 of file find.h.

 
#define GetDeclarativeContext (  )     g_DeclarativeContext

retrieve the declarative context

Definition at line 74 of file find.h.

Referenced by InstanceEvaluateName().

#define SetDeclarativeContext (  )     g_DeclarativeContext = (n)

set the declarative context

Definition at line 77 of file find.h.

#define EVALDEBUG   0

1 = contextnoisy, 2 = fornoisy, 3 = both

Definition at line 108 of file find.h.

 
#define GetEvaluationContext (  )     GetEvaluationContextF()
 
#define GetEvaluationForTable (  )     GetEvaluationForTableF()
#define SetEvaluationContext (  )     SetEvaluationContextF(i)

Definition at line 123 of file find.h.

Referenced by FindInstances(), FindInstancesPaths(), and RectangleSubscriptsMatch().

#define SetEvaluationForTable ( ft   )     SetEvaluationForTableF(ft)

Definition at line 124 of file find.h.

#define for_table_t   gl_list_t

Definition at line 60 of file forvars.h.

Referenced by CreateForTable().

#define IREAL   0x1

Definition at line 72 of file instance_enum.h.

#define IINT   0x2

Definition at line 73 of file instance_enum.h.

#define IBOOL   0x4

Definition at line 74 of file instance_enum.h.

#define ISYM   0x8

Definition at line 75 of file instance_enum.h.

#define ISET   0x10

Definition at line 76 of file instance_enum.h.

Referenced by CmpAtomValues().

#define IARR   0x20

Definition at line 77 of file instance_enum.h.

Referenced by InstanceIndirected().

#define IENUM   0x40

Definition at line 78 of file instance_enum.h.

#define IFUND   0x80

Definition at line 79 of file instance_enum.h.

#define ICONS   0x100

Definition at line 80 of file instance_enum.h.

Referenced by AtomAssigned(), and AtomMutable().

#define IATOM   0x200

Definition at line 81 of file instance_enum.h.

#define ICOMP   0x400

Definition at line 82 of file instance_enum.h.

Referenced by Asc_WriteAnonList().

#define IMOD   0x800

Definition at line 83 of file instance_enum.h.

#define IRELN   0x1000

Definition at line 84 of file instance_enum.h.

#define ILRELN   0x2000

Definition at line 85 of file instance_enum.h.

#define IWHEN   0x4000

Definition at line 86 of file instance_enum.h.

#define IAUTO   0x8000

Definition at line 87 of file instance_enum.h.

#define IDUMB   0x10000

Definition at line 88 of file instance_enum.h.

#define ICHILDLESS   (IFUND | ICONS | IWHEN | IDUMB)
Todo:
future work

Definition at line 92 of file instance_enum.h.

Referenced by InstanceChild().

#define IERRINST
Value:

any of these bits on is an error explain this

Definition at line 96 of file instance_enum.h.

Referenced by InstanceChild(), and InstanceKindF().

#define ASC_ENUM_DECLS ( D,
X   ) 
Value:
D( ERROR_INST,           0) X                   \
    D( SIM_INST,             ICOMP) X               \
    D( MODEL_INST,           ICOMP | IMOD) X        \
    D( REL_INST,             IRELN) X               \
    D( LREL_INST,            ILRELN) X              \
    D( WHEN_INST,            IWHEN) X               \
    D( ARRAY_INT_INST,       ICOMP | IARR | IINT) X \
    D( ARRAY_ENUM_INST,      ICOMP | IARR | ISYM) X \
    D( REAL_INST,            IFUND | IREAL) X       \
    D( INTEGER_INST,         IFUND | IINT) X        \
    D( BOOLEAN_INST,         IFUND | IBOOL) X       \
    D( SYMBOL_INST,          IFUND | ISYM) X        \
    D( SET_INST,             IFUND | ISET) X        \
    D( REAL_ATOM_INST,       IATOM | IREAL) X       \
    D( INTEGER_ATOM_INST,    IATOM | IINT) X        \
    D( BOOLEAN_ATOM_INST,    IATOM | IBOOL) X       \
    D( SYMBOL_ATOM_INST,     IATOM | ISYM) X        \
    D( SET_ATOM_INST,        IATOM | ISET) X        \
    D( REAL_CONSTANT_INST,   ICONS | IREAL) X       \
    D( BOOLEAN_CONSTANT_INST,ICONS | IINT) X        \
    D( INTEGER_CONSTANT_INST,ICONS | IBOOL) X       \
    D( SYMBOL_CONSTANT_INST, ICONS | ISYM) X        \
    D( DUMMY_INST,           IDUMB)

Values for use in declaration of enum inst_t.

these enum declarations are done using the 'define list trick' so that ASC_ENUM_DECLS can be re-purposed to give an string enum lookup table in instance_io.h. Deleted instance (error). Simulation instance. Model instance. Relation(equality or inequality). Logical relation( == || != ). WHEN instance Array instance integer Array instance enumed Real instance. Int instance. Boolean instance. Symbol instance. Set instance. Real atomic instance. Int atomic instance. Boolean atomic instance. Symbol atomic instance. Set atomic instance. Real constant instance. Boolean constant instance. Int constant instance. Symbol constant instance. Dummy instance - unselected IS_A children.

Definition at line 110 of file instance_enum.h.

#define InstanceNameType ( in   )     ((in).t)

Return the type of InstanceName structure in.

Definition at line 62 of file instance_name.h.

Referenced by ChildSearch(), and WritePath().

#define InstanceNameStr ( in   )     ((in).u.name)

Return the name of InstanceName structure in. in must be of type StrName.

Definition at line 68 of file instance_name.h.

Referenced by ChildSearch(), and WritePath().

#define InstanceIntIndex ( in   )     ((in).u.index)

Return the integer index value of InstanceName structure in.

Definition at line 75 of file instance_name.h.

Referenced by ChildSearch(), and WritePath().

#define InstanceStrIndex ( in   )     ((in).u.name)

Return the string index value of InstanceName structure in.

Definition at line 81 of file instance_name.h.

Referenced by ChildSearch(), and WritePath().

#define SetInstanceNameType ( in,
type   )     ((in).t) = (type)

Set the type of InstanceName structure in to type (a NameTypes).

Definition at line 87 of file instance_name.h.

Referenced by Asc_BrowQlfdidSearch(), ChildName(), and ParentsName().

#define SetInstanceNameStrPtr ( in,
str   )     ((in).u.name) = (str)

Set the string pointer of InstanceName structure in to str (a symchar*).

Definition at line 93 of file instance_name.h.

Referenced by Asc_BrowQlfdidSearch(), ChildName(), and ParentsName().

#define SetInstanceNameStrIndex ( in,
str   )     ((in).u.name) = (str)

Set the string index of InstanceName structure in to str (a symchar*).

Definition at line 99 of file instance_name.h.

Referenced by Asc_BrowQlfdidSearch(), ChildName(), and ParentsName().

#define SetInstanceNameIntIndex ( in,
int_index   )     ((in).u.index) = (int_index)

Set the integer index of InstanceName structure in to int_index (a long).

Definition at line 105 of file instance_name.h.

Referenced by Asc_BrowQlfdidSearch(), ChildName(), and ParentsName().

#define LONGCHILDREN   0

if LONGCHILDREN, then pointers are 8 bytes

Definition at line 74 of file instance_types.h.

#define SOL_ASSIGNED   0x1

atom value ever assigned

Definition at line 240 of file instance_types.h.

#define SOL_FIXED   0x2

variable fixed for solvers

Definition at line 242 of file instance_types.h.

#define SOL_INACTIVELB   0x4

lower bound to be ignored in solving

Definition at line 243 of file instance_types.h.

#define SOL_INACTIVEUB   0x8

upper bound to be ignored in solving

Definition at line 244 of file instance_types.h.

#define SOL_ODESTATE   0x10

variable state for ivp solver

Definition at line 245 of file instance_types.h.

#define SOL_ODEOBSERVE   0x20

variable recording for ivp

Definition at line 246 of file instance_types.h.

#define SOL_ISZERO   0x40

semicontinuous set 0 for sciconic

Definition at line 247 of file instance_types.h.

#define SOL_INTEGER   0x80

integer variable

Definition at line 248 of file instance_types.h.

#define SOL_RELAXEDINT   0x100

integer variable treat as relaxed

Definition at line 249 of file instance_types.h.

#define SOL_INTERVAL   0x200

interval real variable

Definition at line 250 of file instance_types.h.

#define SOL_COMPLEX   0x400

complex variable. lower -> imaginary part upper -> magnitude bound. ASCEND -> pot

Definition at line 251 of file instance_types.h.

#define SOL_DOMAIN   0x800

continuous variable defines domain

Definition at line 253 of file instance_types.h.

#define SOL_ODEINDEP   0x1000

independent variable in ODE/BVP

Definition at line 254 of file instance_types.h.

#define SOL_NODOF   0x2000

user doesn't want to see var in DOF

Definition at line 255 of file instance_types.h.

#define SOL_PARAMETRIC   0x4000

whatever that means to a solver

Definition at line 256 of file instance_types.h.

#define SOL_INTENSIVE   0x8000

physics/che intensive property variable

Definition at line 257 of file instance_types.h.

#define SOL_NONBASIC   0x10000

in DOF of optimization problem 2,4,8-0000 reserved for future

Definition at line 258 of file instance_types.h.

#define SOL_TIGHTLB   0x100000

value at or near lower

Definition at line 261 of file instance_types.h.

#define SOL_TIGHTUB   0x200000

value at or near upper

Definition at line 262 of file instance_types.h.

#define SOL_NOELIG   0x400000

variable not eligible to be fixed in DOF

Definition at line 263 of file instance_types.h.

#define NORELS   0x0

Definition at line 67 of file instantiate.h.

Referenced by SimsCreateInstance().

#define GBOXRELS   0x1

Definition at line 68 of file instantiate.h.

#define BBOXRELS   0x2

Definition at line 69 of file instantiate.h.

Referenced by ExecuteBBOXElement().

#define TOKRELS   0x4

Definition at line 70 of file instantiate.h.

#define ALLRELS   (GBOXRELS | BBOXRELS | TOKRELS)

Definition at line 71 of file instantiate.h.

#define EXTRELS   (GBOXRELS | BBOXRELS)

Definition at line 72 of file instantiate.h.

Referenced by InstantiatePatch().

#define Instantiate ( a,
b,
c,
 )     NewInstantiate((a),(b),(c),(d))

Definition at line 109 of file instantiate.h.

Referenced by InstantiatePatch(), and SimsCreateInstance().

#define ReInstantiate (  )     NewReInstantiate(a)

Definition at line 121 of file instantiate.h.

#define AVG_CONSTANT_PARENTS   2L

size to which all parent lists are initialized for real constants

Definition at line 78 of file instmacro.h.

Referenced by CreateRealInstance().

#define AVG_ICONSTANT_PARENTS   20L

size to which all parent lists are initialized for int constants

Definition at line 80 of file instmacro.h.

Referenced by CreateBooleanInstance(), CreateIntegerInstance(), and CreateSymbolInstance().

#define AVG_PARENTS   2L

size to which all parent lists are initialized

Definition at line 82 of file instmacro.h.

Referenced by CreateArrayInstance(), CreateBooleanInstance(), CreateIntegerInstance(), CreateModelInstance(), CreateRealInstance(), CreateSetInstance(), and CreateSymbolInstance().

#define AVG_CASES   2L

size to which all cases lists are initialized (WHEN instance)

Definition at line 84 of file instmacro.h.

#define AVG_WHEN   2L

size to which all when lists are initialized (models, relations)

Definition at line 86 of file instmacro.h.

Referenced by AddWhen().

#define AVG_RELATIONS   7L

size to which all relation lists are initialized

Definition at line 88 of file instmacro.h.

Referenced by AddRelation().

#define AVG_LOGRELS   7L

size to which all logical relation lists are initialized

Definition at line 90 of file instmacro.h.

Referenced by AddLogRel().

#define AVG_ARY_CHILDREN   7L

size to which all array children lists are initialized

Definition at line 92 of file instmacro.h.

Referenced by FindOrAddIntChild(), and FindOrAddStrChild().

#define AVG_LINKS   4

size to which all link_tables are initialized for link entries

Definition at line 94 of file instmacro.h.

Referenced by CreateModelInstance(), getLinks(), getLinksReferencing(), getLinkTypes(), and removeNonDeclarativeLinkEntry().

#define AVG_LINKS_INST   4

size to which all link_entries are initialized for number of instances linked

Definition at line 96 of file instmacro.h.

Referenced by FindInsts(), getLinkInstances(), and getLinkInstancesFlat().

#define UNDEFAULTEDREAL   0.0

Definition at line 98 of file instmacro.h.

Referenced by CreateRealInstance().

#define MAX_EXTRELATIONS   50

maximum number of different ext relations for a given simulation

Definition at line 100 of file instmacro.h.

#define INST (  )     ((struct Instance *)(i))
#define SIM_INST (  )     ((struct SimulationInstance *)(i))
#define RELN_INST (  )     ((struct RelationInstance *)(i))
#define LRELN_INST (  )     ((struct LogRelInstance *)(i))
#define ARY_INST (  )     ((struct ArrayInstance *)(i))
#define MOD_INST (  )     ((struct ModelInstance *)(i))
#define W_INST (  )     ((struct WhenInstance *)(i))
#define R_INST (  )     ((struct RealInstance *)(i))
#define I_INST (  )     ((struct IntegerInstance *)(i))
#define B_INST (  )     ((struct BooleanInstance *)(i))
#define S_INST (  )     ((struct SetInstance *)(i))
#define SYM_INST (  )     ((struct SymbolInstance *)(i))
#define CI_INST (  )     ((struct CommonConstantInstance *)(i))
#define RC_INST (  )     ((struct RealConstantInstance *)(i))
#define IC_INST (  )     ((struct IntegerConstantInstance *)(i))
#define BC_INST (  )     ((struct BooleanConstantInstance *)(i))
#define SYMC_INST (  )     ((struct SymbolConstantInstance *)(i))
#define CA_INST (  )     ((struct CommonAtomInstance *)(i))
#define RA_INST (  )     ((struct RealAtomInstance *)(i))
#define BA_INST (  )     ((struct BooleanAtomInstance *)(i))
#define IA_INST (  )     ((struct IntegerAtomInstance *)(i))
#define SA_INST (  )     ((struct SetAtomInstance *)(i))
#define SYMA_INST (  )     ((struct SymbolAtomInstance *)(i))
#define SOL_INST (  )     ((struct SolverAtomInstance *)(i))

Definition at line 132 of file instmacro.h.

#define D_INST (  )     ((struct GlobalDummyInstance *)(i))
#define CIASS (  )     (CI_INST(i)->vflag & ci_ASSIGNED)
#define BCV (  )     ((BC_INST(i)->vflag & ci_BVAL) == ci_BVAL)

boolean constant value

Definition at line 138 of file instmacro.h.

Referenced by GetBooleanAtomValue().

#define R_PARENT (  )     INST((asc_intptr_t)i-(asc_intptr_t)R_INST(i)->parent_offset)

Definition at line 141 of file instmacro.h.

Referenced by InstanceParent(), and SearchForParent().

#define I_PARENT (  )     INST((asc_intptr_t)i-(asc_intptr_t)I_INST(i)->parent_offset)

Definition at line 143 of file instmacro.h.

Referenced by InstanceParent(), and SearchForParent().

#define B_PARENT (  )     INST((asc_intptr_t)i-(asc_intptr_t)B_INST(i)->parent_offset)

Definition at line 145 of file instmacro.h.

Referenced by InstanceParent(), and SearchForParent().

#define S_PARENT (  )     INST((asc_intptr_t)i-(asc_intptr_t)S_INST(i)->parent_offset)

Definition at line 147 of file instmacro.h.

Referenced by InstanceParent(), and SearchForParent().

#define SYM_PARENT (  )     INST((asc_intptr_t)i-(asc_intptr_t)SYM_INST(i)->parent_offset)

Definition at line 149 of file instmacro.h.

Referenced by InstanceParent(), and SearchForParent().

#define NextHighestEven ( ivalue   )     (((ivalue) & 1) ? ((ivalue)+1) : (ivalue))

this should probably be conditionally defined by LONGCHILDREN so that if LONGCHILDREN, just returns ivalue.

Definition at line 155 of file instmacro.h.

#define CHILD_ADR ( iptr,
type,
 )     ((struct Instance **)((asc_intptr_t)iptr+(asc_intptr_t)sizeof(type))+c)

Definition at line 158 of file instmacro.h.

#define SIM_CHILD ( i,
 )     CHILD_ADR(i,struct SimulationInstance,c)

Definition at line 160 of file instmacro.h.

Referenced by ChildIndex(), GetSimulationRoot(), InstanceChild(), and StoreChildPtr().

#define MOD_CHILD ( i,
 )     CHILD_ADR(i,struct ModelInstance,c)
#define RA_CHILD ( i,
 )     CHILD_ADR(i,struct RealAtomInstance,c)

Definition at line 162 of file instmacro.h.

Referenced by ChildIndex(), InstanceChild(), ParentsName(), and StoreChildPtr().

#define BA_CHILD ( i,
 )     CHILD_ADR(i,struct BooleanAtomInstance,c)

Definition at line 163 of file instmacro.h.

Referenced by ChildIndex(), InstanceChild(), ParentsName(), and StoreChildPtr().

#define IA_CHILD ( i,
 )     CHILD_ADR(i,struct IntegerAtomInstance,c)

Definition at line 164 of file instmacro.h.

Referenced by ChildIndex(), InstanceChild(), ParentsName(), and StoreChildPtr().

#define SA_CHILD ( i,
 )     CHILD_ADR(i,struct SetAtomInstance,c)

Definition at line 165 of file instmacro.h.

Referenced by ChildIndex(), InstanceChild(), ParentsName(), and StoreChildPtr().

#define SYMA_CHILD ( i,
 )     CHILD_ADR(i,struct SymbolAtomInstance,c)

Definition at line 166 of file instmacro.h.

Referenced by ChildIndex(), InstanceChild(), ParentsName(), and StoreChildPtr().

#define REL_CHILD ( i,
 )     CHILD_ADR(i,struct RelationInstance,c)

Definition at line 167 of file instmacro.h.

Referenced by ChildIndex(), InstanceChild(), ParentsName(), and StoreChildPtr().

#define LREL_CHILD ( i,
 )     CHILD_ADR(i,struct LogRelInstance,c)

Definition at line 168 of file instmacro.h.

Referenced by ChildIndex(), InstanceChild(), ParentsName(), and StoreChildPtr().

#define CLIST ( in,
type   )     (struct Instance **)((asc_intptr_t)(in)+sizeof(type))
#define BASE_ADDR ( in,
num,
type   )     INST((CLIST(in,type)) + NextHighestEven(num))
Todo:
The whole use of BASE_ADDR needs to be reinvestigated. in particular we need RealInstance children to be aligned to 8 bytes, not 2 bytes which is all NextHighestEven gives us.

Definition at line 171 of file instmacro.h.

Referenced by CreateBooleanInstance(), CreateIntegerInstance(), CreateLogRelInstance(), CreateRealInstance(), CreateRelationInstance(), CreateSetInstance(), and CreateSymbolInstance().

#define NotAtom (  )     NotAtomF(i)

Definition at line 184 of file instmacro.h.

Referenced by PostMergeCheck(), and ResetVisitCounts().

#define InstanceKind (  )     InstanceKindF(i)

Return the enumerated inst_t that indicates the type of Instance* i.

See also:
InstanceKindF()
instance_enum.h for the various values you get back.

Definition at line 151 of file instquery.h.

Referenced by AddBelow(), AddToEnd(), AnonMergeCountTree(), ArrayIsLogRel(), ArrayIsModel(), ArrayIsRelation(), ArrayIsWhen(), Asc_BrowQlfdidSearch(), Asc_WriteAnonList(), CalcRelationNominal(), CallExternalProcs(), CmpAtomValues(), ConfigureInstFromArgs(), DestroyInstance(), dis_BackendTokens_to_dis(), ExecuteBBOXElement(), FindTolInSatTermOfLogRel(), GetInstanceLogRelOnly(), GetInstanceOperands(), GetSimulationName(), GetSimulationRoot(), IncompleteArray(), Initialize(), InstanceEvaluateName(), InstanceEvaluateSatisfiedName(), InstanceIndirected(), InstanceInList(), InstanceSize(), LogRelCalcResidualInfix(), LogRelCalcResidualPostfix(), LogRelCalcResidualPostfix2(), LogRelFindBoolValues(), logrelinst_flagbit(), logrelinst_flags(), logrelinst_set_flagbit(), logrelinst_set_flags(), LogTermSatisfied(), MergeInstances(), model_flagbit(), model_flags(), model_set_flagbit(), model_set_flags(), Pass2CollectAnonProtoVars(), Pass2CopyAnonProto(), plot_prepare_file(), PrintDirectBooleanResult(), PrintDirectResult(), PrintGradients(), PrintResidual(), PrintScale(), ReallyBadMerge(), ReConfigureInstFromArgs(), RelationCalcHessianMtxSafe(), RelationCalcResidGradRevSafe(), RelationCalcResidGradSafe(), RelationCalcSecondDerivSafe(), RelationFindRoots(), RelationSetBinTokens(), relinst_flagbit(), relinst_flags(), relinst_set_flagbit(), relinst_set_flags(), RemoveInstance(), ResetVisitCounts(), SetSimulationExtVars(), slvreq_assign_hooks(), slvreq_sim_destroy_hooks(), var_BackendTokens_to_vars(), WriteAtomValue(), and WriteInstance().

#define IsConstantInstance (  )     ((i)->t & ICONS)

Returns TRUE (some value >0) if i is a constant instance.

Definition at line 166 of file instquery.h.

Referenced by DecrementTmpNum(), IncrementTmpNum(), InstanceEvaluateName(), InstanceSize(), and SetTmpNum().

#define IsFundamentalInstance (  )     ((i)->t & IFUND)

Returns TRUE (some value >0) if i is a fundamental instance.

Definition at line 170 of file instquery.h.

Referenced by InstanceSize().

#define IsAtomicInstance (  )     ((i)->t & IATOM)

Returns TRUE (some value >0) if i is an atomic instance.

Definition at line 174 of file instquery.h.

Referenced by DecrementTmpNum(), GetTmpNum(), IncrementTmpNum(), and SetTmpNum().

#define IsCompoundInstance (  )     ((i)->t & ICOMP)

Returns TRUE (some value >0) if i is a compound instance.

Definition at line 178 of file instquery.h.

Referenced by AnonMergeCountTree(), Asc_AnonMergeWriteList(), DestroyInstance(), InstanceChild(), and NewReInstantiate().

#define IsArrayInstance (  )     ((i)->t & IARR)

Returns TRUE (some value >0) if i is an array instance.

Definition at line 182 of file instquery.h.

Referenced by AnonMergeCountTree(), CollectArrayInstances(), InstanceChild(), and RectangleSubscriptsMatch().

#define IsChildlessInstance (  )     ((i)->t & ICHILDLESS)

Returns TRUE (some value >0) if i is a childless instance.

Definition at line 186 of file instquery.h.

Referenced by ChildIndex(), and NumberChildren().

#define InstanceUniversal (  )     (GetUniversalFlag(InstanceTypeDesc(i)) != 0)

Returns TRUE if i is a UNIVERSAL instance.

Definition at line 335 of file instquery.h.

#define PendingInstance ( pt   )     PendingInstanceF(pt)

Returns the instance part of a pending_t structure.

Parameters:
pt CONST struct pending_t*, pending instance to query.
Returns:
Returns the instance as a struct Instance*.
See also:
PendingInstanceF()

Definition at line 82 of file pending.h.

#define MAXIMUM_ID_LENGTH   80

Definition at line 36 of file qlfdid.h.

Referenced by Asc_QlfdidSearch2().

#define IVAL (  )     ValInit(&(x))

Initialize a struct value_t variable (NOT a pointer to same). Does nothing if NDEBUG is defined. If you want to init a pointer to a value_t, use IVALPTR().

IVAL(stackvar) (or IVARPTR(&stackvar)) should be called on locally allocated value_t before any other action using them is taken. When NDEBUG is not defined, it causes the stack memory to be initialized to 0. Normally it is a do nothing macro. Proper initialization helps us separate signal from noise in gdb and purify.

Parameters:
x The struct value_t to initialize.
Returns:
No return value.
See also:
ValInit()

Definition at line 160 of file value_type.h.

Referenced by CreateBooleanValue(), CreateEmptyListValue(), CreateErrorValue(), CreateIntegerValue(), CreateOrderedSetFromList(), CreateRealValue(), CreateSetFromList(), CreateSetValue(), CreateSymbolValue(), CreateVacantListValue(), and EvaluateExpr().

#define IVALPTR (  )     ValInit(y)

Initialize a struct value_t variable via a pointer. Does nothing if NDEBUG is defined. If you want to init a struct value_t (i.e. not a pointer to same), use IVAL().

Parameters:
y Pointer to the struct value_t to initialize.
Returns:
No return value.
See also:
ValInit()

Definition at line 182 of file value_type.h.

Referenced by AppendToListValue().

#define ValueKind (  )     ((v).t)

Return the value of a value_t.

Definition at line 201 of file value_type.h.

Referenced by EvaluateSet(), RectangleSubscriptsMatch(), and SetTemp().

#define IntegerValue (  )     ((v).u.i)

Return the value of an integer or integer_constant value_t.

Definition at line 207 of file value_type.h.

Referenced by ApplyFunction(), EvaluateSet(), and SetTemp().

#define RealValue (  )     ((v).u.r.value)

Return the real value of a real or real_constant value_t.

Definition at line 213 of file value_type.h.

Referenced by ApplyFunction().

#define BooleanValue (  )     ((v).u.b)

Return the boolean value of a boolean or boolean_constant value_t.

Definition at line 219 of file value_type.h.

Referenced by RectangleSubscriptsMatch().

#define RealValueDimensions (  )     ((v).u.r.dimp)

Return the dimensions of the real or real_constant value_t.

Definition at line 225 of file value_type.h.

#define SetValue (  )     ((v).u.sptr)

Return the set value of a set value_t.

Definition at line 231 of file value_type.h.

Referenced by CreateOrderedSetFromList().

#define SymbolValue (  )     ((v).u.sym_ptr)

Return the symbol value of a symbol or symbol_constant value_t. This will be a symchar *.

Definition at line 237 of file value_type.h.

Referenced by SetTemp().

#define ErrorValue (  )     ((v).u.t)

Return the error type.

Definition at line 244 of file value_type.h.

Referenced by RectangleSubscriptsMatch().

#define IsConstantValue (  )     ((v).constant)

Return 1 if value is marked constant, 0 if not.

Definition at line 340 of file value_type.h.

Referenced by ApplyFunction(), NegateValue(), and NotValue().

#define BothConstantValue ( va,
vb   )     ((va).constant && (vb).constant)
#define SetConstantValue (  )     ((v).constant = 1)

Mark value as constant.

Definition at line 352 of file value_type.h.

#define SetVariableValue (  )     ((v).constant = 0)

Mark value as constant.

Definition at line 358 of file value_type.h.

#define FIRSTCHOICE   1

If FIRSTCHOICE = 0 ChoiceValues uses a fancy method to pick the set member, else it will always return the first (in internal storage) set member. You can guess what our storage is. The DEFAULT value of this is 1 because it gives deterministic behavior that is platform independent across platforms with an identical collating sequence.

Definition at line 439 of file value_type.h.

#define VisitInstanceTree ( a,
b,
c,
 )     SlowVisitInstanceTree(a,b,c,d)
#define VisitNameTreeTwo ( a,
b,
c,
d,
e,
 )     SlowVisitNameTreeTwo((a), (b), (c), (d), (e), (f))
See also:
SlowVisitNameTreeTwo().

Definition at line 85 of file visitlink.h.

#define FALSE   0

Definition at line 51 of file when_util.h.

Referenced by analyze_make_problem(), ApplyFunction(), Asc_CloseCurrentModule(), Asc_OpenModule(), Asc_OpenStringModule(), Asc_PrintHasVTable(), backward_substitute(), backward_substitute2(), bnd_apply_filter(), boolean_var(), calc_arccos_D0(), calc_arccosh_D0(), calc_arccosh_D2(), calc_arcsin_D0(), calc_arctanh_D0(), calc_arctanh_D2(), calc_cbrt_D2(), calc_cos_Dn(), calc_cube(), calc_dependent_cols_ranki2(), calc_exp_D0(), calc_ln_D0(), calc_lnm_inv(), calc_pow_D0(), calc_rec(), calc_sqrt_D0(), calc_tan_D2(), cases_matching(), col_is_a_spike(), configure_conditional_problem(), consistency_analysis(), cpqr_entry(), dis_apply_filter(), dis_fixed(), forward_substitute(), forward_substitute2(), get_globally_consistent_eligible(), gl_pool_initialized(), gl_set_expandable(), gl_set_sorted(), identify_invariant_rels_at_bnd(), identify_variant_rels_in_subregion(), linsolqr_add_rhs(), linsolqr_calc_residual(), linsolqr_copy_solution(), linsolqr_create(), linsolqr_matrix_was_changed(), linsolqr_rhs_was_changed(), linutils_A_condqr_kaa(), logrel_apply_filter(), logrel_equal(), logrel_included(), logrel_not_equal(), LogRelFindBoolValues(), logrelman_calc_satisfied(), main(), mtx_check_blocks(), mtx_make_col_independent(), mtx_read_region(), mtx_steal_cur_col_sparse(), mtx_steal_cur_row_sparse(), mtx_steal_org_col_sparse(), mtx_steal_org_row_sparse(), pairlist_contains(), ranki2_entry(), ranki_entry(), reanalyze_solver_lists(), rel_apply_filter(), rel_equal(), rel_greater(), rel_included(), rel_less(), RelationCheckDimensions(), RelationFindRoots(), RelationInvertToken(), relman_directly_solve_new(), set_active_rels_as_invariant(), set_active_rels_in_subregion(), set_inactive_disvars_in_list(), set_inactive_vars_in_list(), slv_bnd_initialization(), solver_binary(), solver_int(), solver_semi(), solver_var(), system_generate_diffvars(), tm_cpu_time(), TypeLintIllegalBodyStats(), var_apply_filter(), var_fixed(), var_interface(), var_relaxed(), vec_init(), when_apply_filter(), and when_case_apply_filter().

#define MODEL_ON   0x1

Bit flag - is the model part of my problem ?

Definition at line 176 of file when_util.h.

Referenced by WriteInstance().

#define MODEL_IN_WHEN   0x2

Bit flag - is the MODEL inside a WHEN statement ?

Definition at line 177 of file when_util.h.

#define MODEL_ACTIVE   0x4

Bit flag - is the model active in the current iteration ?

Definition at line 178 of file when_util.h.

#define model_on (  )     model_flagbit((m),MODEL_ON)

Definition at line 180 of file when_util.h.

#define model_in_when (  )     model_flagbit((m),MODEL_IN_WHEN)

Definition at line 181 of file when_util.h.

#define model_active (  )     model_flagbit((m),MODEL_ACTIVE)

Definition at line 182 of file when_util.h.

#define model_set_on ( m,
bv   )     model_set_flagbit((m),MODEL_ON,(bv))

Definition at line 188 of file when_util.h.

#define model_set_in_when ( m,
bv   )     model_set_flagbit((m),MODEL_IN_WHEN,(bv))

Definition at line 189 of file when_util.h.

#define model_set_active ( m,
bv   )     model_set_flagbit((m),MODEL_ACTIVE,(bv))

Definition at line 190 of file when_util.h.

#define RELINST_ON   0x1

Bit flag - is the relation part of my problem?

Definition at line 275 of file when_util.h.

Referenced by WriteInstance().

#define RELINST_CONDITIONAL   0x2

Bit flag - is the relation a boundary expression?

Definition at line 276 of file when_util.h.

#define RELINST_IN_WHEN   0x4

Bit flag - is the relation inside a WHEN statement?

Definition at line 277 of file when_util.h.

#define LOGRELINST_ON   0x8

Bit flag - is the logical relation part of my problem?

Definition at line 278 of file when_util.h.

#define LOGRELINST_CONDITIONAL   0x10

Bit flag - is the logical relation a boundary expression?

Definition at line 279 of file when_util.h.

#define LOGRELINST_IN_WHEN   0x20

Bit flag - is the logical relation inside a WHEN statement?

Definition at line 280 of file when_util.h.

#define relinst_on (  )     relinst_flagbit((r),RELINST_ON)

Definition at line 295 of file when_util.h.

#define relinst_conditional (  )     relinst_flagbit((r),RELINST_CONDITIONAL)

Definition at line 296 of file when_util.h.

#define relinst_in_when (  )     relinst_flagbit((r),RELINST_IN_WHEN)

Definition at line 297 of file when_util.h.

#define logrelinst_on ( lr   )     logrelinst_flagbit((lr),LOGRELINST_ON)

Definition at line 298 of file when_util.h.

#define logrelinst_conditional ( lr   )     logrelinst_flagbit((lr),LOGRELINST_CONDITIONAL)

Definition at line 299 of file when_util.h.

#define logrelinst_in_when ( lr   )     logrelinst_flagbit((lr),LOGRELINST_IN_WHEN)

Definition at line 300 of file when_util.h.

#define relinst_set_on ( r,
bv   )     relinst_set_flagbit((r),RELINST_ON,(bv))

Definition at line 307 of file when_util.h.

#define relinst_set_conditional ( r,
bv   )     relinst_set_flagbit((r),RELINST_CONDITIONAL,(bv))

Definition at line 308 of file when_util.h.

#define relinst_set_in_when ( r,
bv   )     relinst_set_flagbit((r),RELINST_IN_WHEN,(bv))

Definition at line 310 of file when_util.h.

#define logrelinst_set_on ( lr,
bv   )     logrelinst_set_flagbit((lr),LOGRELINST_ON,(bv))

Definition at line 311 of file when_util.h.

#define logrelinst_set_conditional ( lr,
bv   )     logrelinst_set_flagbit((lr),LOGRELINST_CONDITIONAL,(bv))

Definition at line 313 of file when_util.h.

#define logrelinst_set_in_when ( lr,
bv   )     logrelinst_set_flagbit((lr),LOGRELINST_IN_WHEN,(bv))

Definition at line 315 of file when_util.h.


Typedef Documentation

typedef void(* AVProc)(struct Instance *)

A function taking an Instance* and having no return value.

Definition at line 174 of file arrayinst.h.

typedef CONST struct ChildListStructure* ChildListPtr

The ChildListStructure is a private implementation detail. All the public interface needs is a pointer thereto.

Definition at line 53 of file child.h.

typedef VOIDPTR(* IPFunc)(struct Instance *, VOIDPTR)

This is the type of function you should write for use with PushInterfacePtrs(). It will be applied to the instances in the tree. If your function returns anything other than NULL, then we will make the instance's interface pointer be the pointer you returned.

In constructing instance bridges it is good to be able to attach temporary data structures to instances during construction. These temporary structures should not be left laying about. Rather, you should call the following Push and Pop functions like so:

     int build_my_bridge(struct Instance *i, ...)
     {
        struct gl_list_t *oldips = NULL;
        oldips =  PushInterfacePtrs(i,YourCreateFunc,0,1,vp);
          Do whatever you need to here, making the assumption
          that the instance's YourFunc was interested in have
          the data created by YourFunc in their interface_ptrs.
        PopInterfacePtrs(oldips,YourDestroyFunc,vp);
     }
  

If everyone follows this rule, it is easy to see that we can support nested transient clients so long as they don't go sneaking around in each others guts. Abstraction is your friend. Clients, such as a horribly sloppy GUI, may work without using the push and pop functions, but sanity insurance is then THAT client's responsibility and none of ours.

Definition at line 235 of file instance_io.h.

typedef VOIDPTR(* IPDeleteFunc)(struct Instance *, VOIDPTR, VOIDPTR)

This is a function you supply. It will be called with the pointer you returned in IPFunc and the matching instance and the void you passed to PopInterfacePtrs. This is so you may do any destruction of the objects returned by IPFunc.

Definition at line 297 of file instance_io.h.

typedef void(* VisitProc)(struct Instance *)

Typedef for a function that takes an instance; Used with VisitInstanceTree().

Definition at line 36 of file visitinst.h.

typedef void(* VisitTwoProc)(struct Instance *, VOIDPTR)

Typedef for a function that takes an instance and a user pointer; Used with VisitInstanceTreeTwo().

Definition at line 42 of file visitinst.h.

typedef void(* IndexedVisitProc)(struct Instance *, unsigned long *, int, VOIDPTR)

Used with IndexedVisitInstanceTree(). fcn(i,llist,activelen,userdata);
The user supplied 'fcn' must accept the list of child indices from the root to the instance given and llist[0..activelen-1] contain valid data, though llist may have a higher capacity. If the user function needs to know the higher capacity or the root instance of the visit, that is it's job to keep track of in userdata.

Definition at line 48 of file visitinst.h.

typedef void(* VisitNameProc)(struct Instance *, struct gl_list_t *)

Typedef for a function that takes an instance; Used with VisitNameTree() (if/when implemented).

Definition at line 45 of file visitlink.h.

typedef void(* VisitNameTwoProc)(struct Instance *, struct gl_list_t *, VOIDPTR)

Typedef for a function that takes an instance, a path to the instance, and a user pointer, Used with VisitNameTreeTwo(). The name path is pairs of childnum/instance* in gl_list_t form indicating how the current node was reached. The path is subject to change, so if your function needs it to persist, copy it to your own data.

For example, the length of the path is 0 at the root instance and at any instance below the root: gl_length(path) == 2*(number links followed), (unsigned long)gl_fetch(path,1) number of child of root followed gl_fetch(path,2) == child of root.

The last element of the path will be a parent OF the instance i, and the len-1th element of the path will be the child index of i in last element. Because ASCEND creates instance trees that are acyclic, no instance will ever appear in the path twice. Child numbers may repeat, obviously.

Definition at line 51 of file visitlink.h.


Enumeration Type Documentation

enum ChildDescT

Atom child types.

Enumerator:
bad_child 

invalid type. This should never, ever, ever be seen except in childless atoms who need a place holder. bad_child-ren are never assigned and the UNION meaningless

real_child 

real type.

integer_child 

integer type.

boolean_child 

boolean type.

set_child 

set type.

symbol_child 

symbol type.

Definition at line 79 of file childinfo.h.

enum Copy_enum
Enumerator:
c_none 
c_reference 
c_tomodify 

Definition at line 48 of file copyinst.h.

Search error codes. At present, there is a GREAT DEAL of insanity between find_errors and evaluation_error (value_type.h). In particular there is a lot of idiocy mapping undefined_instance <--> undefined_value which is just plain wrong in most cases.

Enumerator:
unmade_instance 

Found an unmade instance (NULL child).

undefined_instance 

Instance in an expression is unknown child.

impossible_instance 

Name cannot possibily exist(real error),often sets.

correct_instance 

Return value when everything went okay.

Definition at line 43 of file find.h.

enum for_kind
Enumerator:
f_untyped 
f_integer 
f_symbol 
f_set 

Definition at line 41 of file forvars.h.

enum inst_t

Instance types, see also comments at head of instance_enum.h.

There are 'fundamental instances' which include REAL, INTEGER, BOOLEAN, SYMBOL and SET (suffixed with _INST).

There are nonfundamental 'atomic' instances, REAL, INTEGER, BOOLEAR, SYMBOL and SET, (this time suffixed with _ATOM_INST).

There are nonfundamental constant instances, REAL, BOOLEAR, INTEGER and SYMBOL (suffixed with _CONSTANT_INST).

Then there are some special instances:

  • ERROR_INST -- a deleted instance
  • SIM_INST -- a simulation
  • MODEL_INST -- a model instance (used where...)
  • REL_INST -- a 'relation' i.e. equality or inequality (real-valued LHS and RHS)
  • LREL_INST -- a logical relation (true or false) (An '==' or '!=' between LHS and RHS).
  • WHEN_INST -- ...
  • ARRAY_INT_INST -- 'array instance integer'...
  • ARRAY_ENUM_INST -- 'array instance enumed'...
  • DUMMY_INST -- dummy instance - unselected 'IS_A' children.
See also:
InstanceEnumLookup in instance_io.c

Definition at line 162 of file instance_enum.h.

enum NameTypes
Enumerator:
IntArrayIndex 

integer array index

StrArrayIndex 

string array index

StrName 

string name

Definition at line 46 of file instance_name.h.

enum ppstatus
Enumerator:
pp_ERR 
pp_ISA 

IS_A of simple to be done, from absorbed.

pp_ISAARR 

IS_A of array to do, from absorbed and gets converted to asar during processing.

pp_ARR 

array that's constructed but requires range checking

pp_ASGN 

assignment to do in absorbed objects

pp_ASSC 

scalar assignment to check in absorbed objects

pp_ASAR 

Array to be checked for being completely assigned, but its subscript range is presumed right.

pp_WV 

WITH_VALUE to be checked

pp_DONE 

finished statement

Definition at line 49 of file parpend.h.

enum set_kind
Enumerator:
integer_set 

set of integer values

string_set 

set of string values

empty_set 

set with nothing in it

Definition at line 49 of file setinstval.h.

Evaluation error types.

Enumerator:
type_conflict 
name_unfound 

inst of name not made yet

incorrect_name 

name can never be found

temporary_variable_reused 
undefined_value 

inst exists without being assigned

dimension_conflict 

arithmetic error in dimensionality

incorrect_such_that 
empty_choice 

CHOICE() on an empty set

empty_intersection 
illegal_set_use 

set used in list context

Definition at line 70 of file value_type.h.

enum value_kind

Unique types of values.

Enumerator:
real_value 
integer_value 
symbol_value 
boolean_value 
list_value 

keep set and list together

set_value 

set is unique and sorted, or ought to be

error_value 

Definition at line 84 of file value_type.h.

Mapinfo visit info.

Enumerator:
vimap_ERROR 

mapinfo is not valid

vimap_DOWN 

mapinfo represents visiting a child of inst

vimap_UP 

mapinfo represents returning from completed inst

Definition at line 62 of file visitinst.h.


Function Documentation

void InitInstanceNanny ( void   ) 

Sets up array child instantiation gizmos. This must be called once before any arrays can be built, ideally at startup time. Do not call it again unless DestroyInstanceNanny is called first. If insufficient memory to compile anything at all, does exit(2).

Under no circumstances should you (an external client) be freeing a struct ArrayChild.

Definition at line 116 of file arrayinst.c.

References ASC_PANIC, IN_ELT_SIZE, IN_LEN, IN_MORE_BARS, IN_MORE_ELTS, IN_WID, NULL, and pool_create_store().

Referenced by Asc_CompilerInit().

void DestroyInstanceNanny ( void   ) 

Destroy array child instantiation gizmos. This must be called to clean up before shutting down ASCEND. Do attempt to instantiate anything after you call this unless you have recalled InitInstanceNanny().

Definition at line 128 of file arrayinst.c.

References NULL, and pool_destroy_store().

Referenced by Asc_CompilerDestroy().

void ReportInstanceNanny ( FILE *  f  ) 

Reports on the array child instantiator to f.

Definition at line 135 of file arrayinst.c.

References FPRINTF, NULL, and pool_print_store().

struct gl_list_t* CollectArrayInstances ( CONST struct Instance i,
struct gl_list_t list 
) [read]

Appends pointers of the set/MODEL/ATOM/constant instances found in the leaves of an array instance, i, sparse or dense. If list given by user is NULL, a list to be returned is made if necessary. If i is not an array, list returned will be NULL if list given is NULL. If i is an array, list returned may be empty, but not NULL. This function recurses through all the subscripts of the array.

Definition at line 194 of file arrayinst.c.

References ARY_INST, CollectArrayInstances(), gl_append_ptr(), gl_create(), gl_fetch, gl_length, ArrayChild::inst, IsArrayInstance, and NULL.

Referenced by CollectArrayInstances().

void ArrayVisitLocalLeaves ( struct Instance mch,
AVProc  func 
)

This function visits the instances indicated by the name given in the definition statement of mch. func is as described in visitinst.h for VisitProc. mch is an array instance that is the child of a MODEL.

Definition at line 178 of file arrayinst.c.

References ARY_INST, Asc_Panic, AssertMemory, ArrayInstance::desc, GetArrayIndexList, gl_length, ArrayInstance::indirected, int(), and ArrayInstance::t.

Referenced by AnonMergeCountTree().

ASC_DLLSPEC struct Instance * ChildByChar ( CONST struct Instance i,
symchar str 
) [read]

This returns to the pointer to a child, c, of parent,p, named by str. str must be a simple name. If child not found, returns NULL. str must be from the symbol table. If AscFindSymbol(str)==NULL, then this function should not be called because NO instance can have a child with a name which is not in the symbol table. func is as described in visitinst.h for VisitProc. mch is an array instance that is the child of a MODEL.

This returns to the pointer to a child, c, of parent,p, named by str. str must be a simple name. If child not found, returns NULL. str must be from the symbol table. If AscFindSymbol(str)==NULL, then this function should not be called because NO instance can have a child with a name which is not in the symbol table.

Definition at line 1079 of file parentchild.c.

References AscFindSymbol(), ChildSearch(), InstanceChild(), InstanceNameUnion::name, NULL, StrName, InstanceName::t, and InstanceName::u.

Referenced by CalcRelationNominal(), dis_fixed(), dis_nominal(), dis_set_fixed(), dis_set_nominal(), logrel_included(), logrel_set_included(), rel_included(), rel_set_included(), var_fixed(), var_interface(), var_lower_bound(), var_nominal(), var_odeatol(), var_relaxed(), var_set_fixed(), var_set_lower_bound(), var_set_nominal(), var_set_relaxed(), var_set_upper_bound(), and var_upper_bound().

int RectangleArrayExpanded ( CONST struct Instance i  ) 

Test if the array is fully expanded (i.e. all the sets for all the derefencing have been specified).

On sparse arrays, this operator might return a FALSE positive because it checks down the leading member of each defined subscript range. This error is precluded only by the fact that when instantiating, we do sparse arrays completely in one pass, therefore the leading members check is a sufficient test. In general, however, this should not be used on sparse arrays.

Definition at line 226 of file arrayinst.c.

References ARY_INST, Asc_Panic, ASC_PANIC, AssertContainedMemory, AssertMemory, ArrayInstance::children, ArrayInstance::desc, GetArrayIndexList, gl_fetch, gl_length, ArrayInstance::indirected, ArrayChild::inst, NULL, and ArrayInstance::t.

Referenced by IncompleteArray().

int RectangleSubscriptsMatch ( CONST struct Instance context,
CONST struct Instance ary,
CONST struct Name subscripts 
)

Test if the ary children expected from evaluating the nodes of subscripts (all set nodes) are all compatible with the children of the array instance given. The set expressions in Name elements are evaluated in the context given. Assumes the array has been fully expanded.

On array subscripts not yet resolvable, returns -2; try later.
On array shape mismatch, returns -1.
On subscripts mismatch, returns 0.
On match, returns 1.

On sparse arrays, this operator should NOT be used. A reasonably intelligent person could rewrite this to handle sparse arrays, with the addition of a for_table argument.

Definition at line 311 of file arrayinst.c.

References ARY_INST, ASCERR, boolean_value, BooleanValue, CONST, CreateSetFromList(), CreateSetValue(), DestroyValue(), EqualValues(), error_value, ErrorValue, EvaluateSet(), FPRINTF, GetEvaluationContext, gl_fetch, gl_length, ArrayChild::inst, InstanceEvaluateName(), IsArrayInstance, list_value, name_unfound, NameId, NameSetPtr, NextName, NULL, set_value, SetEvaluationContext, undefined_value, and ValueKind.

unsigned long NextToExpand ( CONST struct Instance i  ) 

Return the number of the dereferencing that needs to be expanded. This returns 0 if none are needed; 1 is the first dereference.

Definition at line 425 of file arrayinst.c.

References ARY_INST, ASC_PANIC, AssertContainedMemory, AssertMemory, ArrayInstance::children, ArrayInstance::desc, GetArrayIndexList, gl_fetch, gl_length, ArrayInstance::indirected, ArrayChild::inst, NULL, and ArrayInstance::t.

unsigned long NumberofDereferences ( CONST struct Instance i  ) 

This returns the number of dereferences that this array instance has before reaching what the array contains.

Definition at line 454 of file arrayinst.c.

References ARY_INST, Asc_Panic, AssertMemory, ArrayInstance::desc, GetArrayIndexList, gl_length, ArrayInstance::indirected, and ArrayInstance::t.

Referenced by ExpandArray(), and WriteInstance().

CONST struct Set* IndexSet ( CONST struct Instance i,
unsigned long  num 
) [read]

Return the set that the num'th index is defined over. Don't make any changes to the structure that is returned! 1 <= num <= NumberofDereferences(i) Will return NULL on the final subscript of an ALIASES/IS_A inside a FOR loop.

void ExpandArray ( struct Instance i,
unsigned long  num,
struct set_t set,
struct Instance rhsinst,
struct Instance arginst,
struct gl_list_t rhslist 
)

This will expand the num'th index over the set of index values given by set. set is returned unchanged.

If the array is being expanded by an IS_A, this may effect the pending instance list. All the instances it adds will be added below the top.

If the array is being expanded by an alias, rhsinst is not NULL and rhsinst is used as the array element and pending list is not affected.

If the array is being expanded by an aliases-IS_A, rhsinst is NULL, rhslist is used as the array elements source for copying, and the pending list is not affected. The contents of the list is a bunch of struct ArrayChild * which should have indices matching the last subscript of the array being expanded. Deallocating the contents of the rhs ist is the caller's responsibility, as is creating it -- it is copied as needed internally.

If the array being expanded is of a parametric type, the arginst will be used to construct the elements and pending list may be affected.

struct Instance* FindOrAddIntChild ( struct Instance i,
long  v,
struct Instance rhsinst,
struct Instance arginst 
) [read]

Add sparse array child at location defined by current ForTable after instantiating child if rhsinst is NULL (an ISA). If instantiating, uses arginst if not NULL. Uses rhsinst if it is not NULL (an array element defined by alias).

struct Instance* FindOrAddStrChild ( struct Instance i,
symchar sym,
struct Instance rhsinst,
struct Instance arginst 
) [read]

Add sparse array child at location defined by current ForTable after instantiating child if rhsinst is NULL (an ISA). If instantiating, uses arginst if not NULL. Uses rhsinst if it is not NULL (an array element defined by alias).

Definition at line 825 of file arrayinst.c.

References ARY_INST, ASC_PANIC, AVG_ARY_CHILDREN, CmpStrIndex(), gl_create(), gl_fetch, gl_insert_sorted(), gl_search(), ArrayChild::inst, ArrayChild::name, NULL, ArrayChild::str, and Instance::t.

int CmpArrayInsts ( struct Instance i1,
struct Instance i2 
)

Returns 0 if the arrays i1 and i2 are defined over equivalent subscript ranges and have leaf parts of shallowly equivalent types. (hint: relations and models are not deeply checked.) Returns 1 for any non-equivalency. Doesn't return if called with something other than arrays. NULL input --> 1 + warning, rather than exit.

Definition at line 946 of file arrayinst.c.

References ARY_INST, GetArrayBaseType, and NULL.

unsigned long ConstantByteLength ( enum inst_t  it  ) 

Returns the number of bytes needed for the Constant instance of type it.

Definition at line 85 of file atomsize.c.

References ASC_PANIC.

Referenced by CalcByteSize(), and InstanceSize().

unsigned long RealAtomByteLength ( unsigned long  num_children,
CONST struct ChildDesc c 
)

Given the number of children and descriptions of the children, this routine will calculate the number of bytes needed for the instance.

unsigned long IntegerAtomByteLength ( unsigned long  num_children,
CONST struct ChildDesc c 
)

Given the number of children and descriptions of the children, this routine will calculate the number of bytes needed for the instance.

unsigned long BooleanAtomByteLength ( unsigned long  num_children,
CONST struct ChildDesc c 
)

Given the number of children and descriptions of the children, this routine will calculate the number of bytes needed for the instance.

unsigned long SetAtomByteLength ( unsigned long  num_children,
CONST struct ChildDesc c 
)

Given the number of children and descriptions of the children, this routine will calculate the number of bytes needed for the instance.

unsigned long SymbolAtomByteLength ( unsigned long  num_children,
CONST struct ChildDesc c 
)

Given the number of children and descriptions of the children, this routine will calculate the number of bytes needed for the instance.

unsigned long RelationAtomByteLength ( unsigned long  num_children,
CONST struct ChildDesc c 
)

Given the number of children and descriptions of the children, this routine will calculate the number of bytes needed for the instance.

unsigned long LogRelAtomByteLength ( unsigned long  num_children,
CONST struct ChildDesc c 
)

Given the number of children and descriptions of the children, this routine will calculate the number of bytes needed for the instance.

ASC_DLLSPEC unsigned AtomAssigned ( CONST struct Instance i  ) 

Return a nonzero value if the atom instance has been assigned; otherwise, return false. It will actually return the number of times that the atom has been assigned. Valid for *_INST, *_ATOM_INSTANCE, *_CONSTANT_INSTANCE.

Definition at line 54 of file atomvalue.c.

References ASC_USER_ERROR, AssertMemory, B_INST, BA_INST, CIASS, ERROR_REPORTER_NOLINE, I_INST, IA_INST, ICONS, NULL, R_INST, RA_INST, S_INST, SA_INST, SYM_INST, and SYMA_INST.

Referenced by CmpAtomValues(), InstanceEvaluateName(), SetRealAtomValue(), slv_check_dvar_initialization(), slv_check_var_initialization(), WriteAtomValue(), and WriteInstance().

ASC_DLLSPEC unsigned AtomMutable ( CONST struct Instance i  ) 

Return a true value if the atom instance is mutable; otherwise, return false. Valid for *_INST, *_ATOM_INSTANCE, *_CONSTANT_INSTANCE. Often rather a redundant operator, since *_INST and *_ATOM_INSTANCE are permanently mutable.

Definition at line 82 of file atomvalue.c.

References ASC_PROG_ERROR, AssertMemory, CIASS, ERROR_REPORTER_HERE, ICONS, NULL, S_INST, SA_INST, SYM_INST, and SYMA_INST.

unsigned DepthAssigned ( CONST struct Instance i  ) 

Return the depth of the assignment. This only works on real and boolean instances.

Definition at line 105 of file atomvalue.c.

References ASC_PANIC, AssertMemory, B_INST, BA_INST, NULL, R_INST, and RA_INST.

ASC_DLLSPEC double RealAtomValue ( CONST struct Instance i  ) 
ASC_DLLSPEC void SetRealAtomValue ( struct Instance i,
double  d,
unsigned  depth 
)

Assign the value d(in system units) to instance i. This works only on REAL_INST or REAL_ATOM_INST or REAL_CONSTANT_INSTANCEs not assigned. This will set the assigned attribute also. This will set the depth too.

It is recommended that the interface use depth = 0 which will take precidence over every other assignment.

ASC_DLLSPEC CONST dim_type* RealAtomDims ( CONST struct Instance i  ) 

Return the dimensions attribute of instance i. This works only on REAL_INST or REAL_ATOM_INST or REAL_CONSTANT_INSTANCE. This should never return a NULL pointer.

Definition at line 206 of file atomvalue.c.

References ASC_PANIC, AssertMemory, NULL, R_INST, RA_INST, and RC_INST.

Referenced by CmpAtomValues(), CreateBlackBoxRelation(), InstanceEvaluateName(), RelationCheckDimensions(), and WriteInstance().

ASC_DLLSPEC void SetRealAtomDims ( struct Instance i,
CONST dim_type dim 
)

Set i's dimensions to dim. dim should already be in the dimensions list. This works only on REAL_INST or REAL_ATOM_INST or REAL_CONSTANT_INSTANCEs not dimensioned.

Definition at line 176 of file atomvalue.c.

References ASC_PANIC, ASC_PROG_ERROR, AssertMemory, ERROR_REPORTER_NOLINE, IsWild(), NextCliqueMember(), NULL, R_INST, RA_INST, RC_INST, and Instance::t.

ASC_DLLSPEC long GetIntegerAtomValue ( CONST struct Instance i  ) 

Return the value of the integer instance i. This only works on INTEGER_INST or INTEGER_ATOM_INST or INTEGER_CONSTANT_INST type instances.

Definition at line 221 of file atomvalue.c.

References ASC_PANIC, ASC_PROG_WARNING, AssertMemory, CIASS, ERROR_REPORTER_HERE, I_INST, IA_INST, IC_INST, and NULL.

Referenced by CmpAtomValues(), dis_set_inst_and_field_value(), dis_set_value_from_inst(), InstanceEvaluateName(), var_interface(), WriteAtomValue(), and WriteInstance().

ASC_DLLSPEC void SetIntegerAtomValue ( struct Instance i,
long  v,
unsigned  depth 
)

Set the value of instance i to v. This only works on INTEGER_INST or INTEGER_ATOM_INST or unassigned INTEGER_CONSTANT_INST type instances.

This also sets the assigned as needed. Calling on an improper integer will cause a crash.

ASC_DLLSPEC int GetBooleanAtomValue ( CONST struct Instance i  ) 

Return a true value if i is TRUE; otherwise return a false value. This only works on BOOLEAN_INST or BOOLEAN_ATOM_INST or BOOLEAN_CONSTANT_INST type instances.

Definition at line 275 of file atomvalue.c.

References ASC_PANIC, ASC_PROG_WARNING, AssertMemory, B_INST, BA_INST, BCV, CIASS, ERROR_REPORTER_HERE, and NULL.

Referenced by CmpAtomValues(), dis_fixed(), dis_nominal(), dis_set_inst_and_field_value(), dis_set_value_from_inst(), InstanceEvaluateName(), logrel_included(), LogRelFindBoolValues(), LogTermBoolVar(), rel_included(), var_fixed(), var_interface(), var_relaxed(), WriteAtomValue(), and WriteInstance().

ASC_DLLSPEC void SetBooleanAtomValue ( struct Instance i,
int  truth,
unsigned  depth 
)

If truth is a true value, i will be set to TRUE; otherwise, i will be set to FALSE. This only works on BOOLEAN_INST or BOOLEAN_ATOM_INST or unassigned BOOLEAN_CONSTANT_INST type instances. This will set the assigned attribute of i.

It is recommended that the interface use depth = 0 because it will override every other assignment.

ASC_DLLSPEC CONST struct set_t* SetAtomList ( CONST struct Instance i  )  [read]

Return the list from the set instance i. This only works on SET_INST and SET_ATOM_INST type instances. This returns NULL when i has not been assigned.

Definition at line 398 of file atomvalue.c.

References ASC_PANIC, AssertMemory, NULL, S_INST, and SA_INST.

Referenced by CmpAtomValues(), InstanceEvaluateName(), WriteAtomValue(), and WriteInstance().

int AssignSetAtomList ( struct Instance i,
struct set_t list 
)

Set i's list to list. This will set the assigned attribute unless list is NULL. A set's value cannot be changed after it has been assigned. Returns 1 if successful. Returns 0 if not successful. If the return is 0, the user is responsible for list since it did not become part of i.

Definition at line 338 of file atomvalue.c.

References ASC_PROG_ERR, ASC_PROG_ERROR, ASC_PROG_NOTE, ASCERR, AssertMemory, DestroySet(), empty_set, error_reporter_end_flush(), ERROR_REPORTER_HERE, ERROR_REPORTER_START_HERE, FPRINTF, GetBaseTypeName(), integer_constant_type, integer_set, NULL, S_INST, SA_INST, SCP, SetKind(), SetsEqual(), symbol_constant_type, Instance::t, and WriteInstSet().

int GetSetAtomKind ( CONST struct Instance i  ) 

Return the kind of the set. 1 ==> integer set; 0 ==> string set.

Definition at line 411 of file atomvalue.c.

References ASC_PANIC, AssertMemory, NULL, S_INST, and SA_INST.

Referenced by CmpAtomValues().

ASC_DLLSPEC symchar* GetSymbolAtomValue ( CONST struct Instance i  ) 

This returns the symbol that instance i is assigned to. If i is unassigned, it will return NULL. This only works on SYMBOL_INST and SYMBOL_ATOM_INST or SYMBOL_CONSTANT_INST type instances. The character string does not contain the single quote delimeters. The symchar can be converted to a string with macro SCP from compiler.h.

Definition at line 424 of file atomvalue.c.

References ASC_PANIC, ASCERR, AssertMemory, CIASS, FPRINTF, NULL, SYM_INST, SYMA_INST, and SYMC_INST.

Referenced by CmpAtomValues(), dis_set_value_from_inst(), InstanceEvaluateName(), WriteAtomValue(), and WriteInstance().

ASC_DLLSPEC void SetSymbolAtomValue ( struct Instance i,
symchar s 
)

This makes an assignment to i. Instance i should be of type SYMBOL_INST or SYMBOL_ATOM_INST or unassigned SYMBOL_CONSTANT_INST. Character strings should not contain the single quote delimiters. Buggy at present, since symbolatominst are supposed to be mutable.

Definition at line 449 of file atomvalue.c.

References ASC_PANIC, ASCERR, AscFindSymbol(), AssertMemory, ci_ASSIGNED, CIASS, FPRINTF, NextCliqueMember(), NULL, SCP, SYM_INST, SYMA_INST, SYMC_INST, and Instance::t.

int CmpAtomValues ( CONST struct Instance i1,
CONST struct Instance i2 
)

Return -1,0,1 as i2 < == or > i1. i1 and i2 should be of the same base type. The following types are allowed: REAL_*INST, BOOLEAN_*INST, SYMBOL_*INST, INTEGER_*INST SET_*INST. Calls with other types will not return, nor will calls with mismatched types.

Definition at line 483 of file atomvalue.c.

References ASC_PANIC, ASC_PROG_ERROR, AtomAssigned(), CmpDimen(), CmpSetInstVal(), CmpSymchar(), ERROR_REPORTER_HERE, GetBooleanAtomValue(), GetIntegerAtomValue(), GetSetAtomKind(), GetSymbolAtomValue(), InstanceKind, ISET, NULL, RealAtomDims(), RealAtomValue(), and SetAtomList().

ASC_DLLSPEC void CheckInstanceLevel ( FILE *  f,
CONST struct Instance i,
int  pass 
)

Perform all the possible consistency checks possible, and check for as many errors as possible. This won't modify anything. The value of pass determines which pending statements will be printed. pass == 0: do not print pendings
pass == 1: IS_As and other constructors only
pass == 2: relations also
pass == 3: logical relations also
pass == 4: whens also
pass == 5: defaults also

Definition at line 429 of file check.c.

References ASGN, DestroySuppressions(), GetStatioSuppressions(), LOGREL, NULL, REL, and WHEN.

void CheckInstanceStructure ( FILE *  f,
CONST struct Instance i 
)

Perform popular consistency checks possible, and check for as many errors as possible. This won't modify anything. This doesn't warn about unassigned real constants, basically.

Definition at line 443 of file check.c.

References NULL.

void InstanceTokenStatistics ( FILE *  f,
CONST struct Instance i 
)

This compiles and prints various token relation statistics for this instance tree.

Definition at line 942 of file check.c.

References ExprEnumName(), FPRINTF, gl_create(), gl_destroy(), gl_length, NULL, NUM_EXPR_ENUMS, and SilentVisitInstanceTree().

ASC_DLLSPEC void InstanceStatistics ( FILE *  f,
CONST struct Instance i 
)

This compiles and prints various statistics about this instance tree.

Definition at line 974 of file check.c.

References TypeCount::count, FindRelationType(), FPRINTF, GetByteSize, gl_create(), gl_destroy(), gl_fetch, gl_free_and_destroy(), gl_length, TypeCount::name, NONZERO, NULL, SilentVisitInstanceTree(), and VisitInstanceTree.

int CmpChildListEntries ( CONST struct ChildListEntry e1,
CONST struct ChildListEntry e2 
)

Returns the result of an alphabetical order comparison on the names in the two pointers. Not necessarily implemented with strcmp, however, so you should use this function.

Definition at line 72 of file child.c.

References CmpSymchar(), and NULL.

Referenced by AppendChildList(), and CreateChildList().

ChildListPtr CreateChildList ( struct gl_list_t l  ) 

This takes a list of struct ChildListEntry * from a gl_list_t to a ChildList type. l must be sorted and should not contain any duplicate entries, nor any entries with a NULL typeptr. There are no other preconditions on l. Children lists are always stored in alphabetic order (strcmp). If the list isn't sorted, we will sort it at rather an expense. You still own the list l AND its entries and should act accordingly. We will return a ChildListPtr. You don't know what is in that. We own the memory to it and only we know how to destroy it. Creating a ChildListPtr causes the type descriptions of the children to be copied.

This function should never return a NULL pointer except in the case where you have specified input with a NULL typeptr.

Definition at line 142 of file child.c.

References CHMALLOC, CLCOPY, CLSMALLOC, CmpChildListEntries(), CPUT, ChildListStructure::data, GGET, gl_append_ptr(), gl_create(), gl_length, gl_sort(), gl_sorted(), ChildListStructure::list, NULL, ChildListEntry::strptr, ChildListStructure::symbols, and VOIDPTR.

Referenced by AppendChildList().

void DestroyChildList ( ChildListPtr  cl  ) 

Deallocate the memory associated with the list but not the symchars in the list. The fact that you're passing a CONST pointer object into this function is somewhat odd, but it suffices to know that after this call, any data that might have been in the pointer you gave us really has been disposed of.

Definition at line 219 of file child.c.

References CGET, CHFREE, CLPOOLFREE, CLSFREE, ChildListStructure::data, DeleteTypeDesc(), GL, gl_destroy(), gl_length, ChildListStructure::list, NULL, ChildListStructure::symbols, and ChildListEntry::typeptr.

Referenced by DeleteTypeDesc().

ChildListPtr AppendChildList ( ChildListPtr  cl,
struct gl_list_t l 
)

Create and return a new child list which contains all the information contained in cl or l. l must be sorted, and it is assumed that there are no duplicate entries. The new list returned is sorted. If l is not sorted, we will sort it at rather an expense. The same conditions for l in CreateChildList apply here.

Definition at line 247 of file child.c.

References CGET, CHMALLOC, CLCOPY, CLSMALLOC, CmpChildListEntries(), CPUT, CreateChildList(), ChildListStructure::data, GGET, GL, gl_append_ptr(), gl_create(), gl_fetch, gl_length, gl_sort(), gl_sorted(), ChildListStructure::list, NULL, ChildListEntry::strptr, ChildListStructure::symbols, and VOIDPTR.

ASC_DLLSPEC unsigned long ChildListLen ( ChildListPtr  cl  ) 
ASC_DLLSPEC symchar* ChildStrPtr ( ChildListPtr  cl,
unsigned long  n 
)

Return child number n name element 1 string. Children are numbered 1..ChildListLen(cl).

unsigned int ChildIsArray ( ChildListPtr  cl,
unsigned long  n 
)

Return >= 1 if child number n is determined array type at parse time. The return value the number of subscripts of child n needed to reach a single array element of ChildBaseTypePtr type. Returns 0 if type is not array.

unsigned int ChildOrigin ( ChildListPtr  cl,
unsigned long  n 
)

Return the origin code of the child.

unsigned int ChildAliasing ( ChildListPtr  cl,
unsigned long  n 
)

Return the Aliasness of a child, meaning if the child ALIASES one passed into the type definition or a part of the definition.

unsigned int ChildParametric ( ChildListPtr  cl,
unsigned long  n 
)

Return the parametricness of a child. That is, if the child is one passed into the type definition or one aliasing something or a part of something passed into the definition.

CONST struct Statement* ChildStatement ( ChildListPtr  cl,
unsigned long  n 
) [read]

Return child number n initial declaration statement. Children are numbered 1..ChildListLen(cl).

ASC_DLLSPEC unsigned ChildGetBooleans ( ChildListPtr  cl,
unsigned long  n 
)

Return child number n current boolean flags. Children are numbered 1..ChildListLen(cl). If an improperly large or small n is given, result is 0.

ASC_DLLSPEC void ChildSetBoolean ( ChildListPtr  cl,
unsigned long  n,
unsigned  cbfname,
unsigned  val 
)

Set child number n current boolean flag bit cbfname to val. Children are numbered 1..ChildListLen(cl). cbfname is a child boolean flag CBF_ defined above. val is 0 or 1 only.

ASC_DLLSPEC struct TypeDescription* ChildBaseTypePtr ( ChildListPtr  cl,
unsigned long  n 
) [read]

Return child number n type determinable at parse time. If type was not determinable, returns NULL, but this will never be the case as Something is always determinable. NOTE: an array child does not return an array type description but instead the base type for the array. Note that this requires we ignore refinement statements on specific array children when dealing with array base type info. If this pointer is not NULL, then any corresponding instance will be of at least the type returned. Children are numbered 1..ChildListLen(cl).

Note: The children of atoms always return NULL type since they do not have type descriptions in the system because they are not full instances.

ASC_DLLSPEC unsigned long ChildPos ( ChildListPtr  cl,
symchar s 
)

Search for the string s in child list cl. If it is not found, it will return 0; otherwise, it returns the index of the child which matches s. s must be in the symbol table. If s is NOT in the symbol table, then it is impossible a priori for this function to return nonzero and so it will not return at all because you have asked a stupid question. If you need to check s yourself, AscFindSymbol(s) will return s if s is in the symbol table -- but there should never be a programming context where you need to check. If you need to guarantee s is in the table, call AddSymbol first.

Definition at line 405 of file child.c.

References AscFindSymbol(), CHILDHASHINDEX, ChildHash::clindex, ChildHash::next, NULL, and ChildHash::sym.

Referenced by ChildSearch().

int CompareChildLists ( ChildListPtr  cl,
ChildListPtr  c2,
unsigned long *  diff 
)

Returns -1/0/1 as d1 <,==,> d2 (0). If cmp != 0, diff = position in child list d2 of first difference, i.e. if the lists are m and n long (m > n) and OTHERWISE equivalent, diff = n + 1.

Definition at line 419 of file child.c.

References ChildListEntry::bflags, CGET, ChildListLen(), CmpSymchar(), GetParseId, ChildListEntry::isarray, MIN, NULL, ChildListEntry::origin, ChildListEntry::strptr, and ChildListEntry::typeptr.

Referenced by TypesAreEquivalent().

int BaseType ( symchar name  ) 

Returns the number of the fundamental type, or -1 if not fundamental. The code here is *VERY* dependent upon the number and position of the FundamentalTypeList (internal to childdef.c)! Note that the fundamentalTypeList should be refilled with pointers from the symbol table and then comparisons done by ptr rather than strcmp. But that comes after we get a real symbol table.

Definition at line 79 of file childdef.c.

References boolean_type, GetBaseTypeName(), TypeDescription::init, integer_type, NUM_FUNDTYPES, real_type, set_type, and symbol_type.

Referenced by InitBaseTypeNames().

struct ChildDesc* MakeChildDesc ( symchar name,
struct StatementList sl,
ChildListPtr  clist 
) [read]

Returns the child description array based on legal statements in sl.

Definition at line 499 of file childdef.c.

References ChildListLen(), CreateChildDescArray(), and CreateEmptyChildDescArray().

Referenced by CreateAtomTypeDef(), CreateLogRelTypeDef(), and CreateRelationTypeDef().

unsigned long CalcByteSize ( enum type_kind  t,
ChildListPtr  clist,
struct ChildDesc childd 
)
void CDescInit ( struct ChildDesc c  ) 

Initializes the contents of c to 0. Do not call this function -- use ICDESC() or IDESCPTR() instead.

Definition at line 42 of file childinfo.c.

struct ChildDesc* CreateChildDescArray ( unsigned long  l  )  [read]

Allocate space for an array of length l. This will not initialize the array in any special way. Use ICDESC() or ICDESCPTR() to initialize the elements of the array. The array should be accessed using AssignChildArrayElement() and GetChildArrayElement(). When finished with the array, deallocate it using DestroyChildDescArray().

struct ChildDesc* CreateEmptyChildDescArray ( void   )  [read]

Allocate space for an array of length 1. The array element will be initialized as type bad_child (its value is not initialized). The array should be accessed using AssignChildArrayElement() and GetChildArrayElement(). When finished with the array, deallocate it using DestroyChildDescArray().

Definition at line 63 of file childinfo.c.

References ASC_NEW_CLEAR, bad_child, NULL, and ChildDesc::t.

Referenced by MakeChildDesc().

void DestroyChildDescArray ( struct ChildDesc c,
unsigned long  l 
)

This routine will deallocate the space for array c of length l. Any elements of c which are sets will have all subelements properly deallocated also.

void AssignChildArrayElementF ( struct ChildDesc a,
unsigned long  n,
struct ChildDesc  e 
)

Implementation function for AssignChildArrayElement(). Do not use this function directly - use AssignChildArrayElement() instead.

struct ChildDesc GetChildArrayElementF ( CONST struct ChildDesc a,
unsigned long  n 
) [read]

Implementation function for GetChildArrayElement(). Do not use this function directly - use GetChildArrayElement() instead.

enum ChildDescT ChildDescTypeF ( struct ChildDesc  e  ) 

Implementation function for ChildDescType(). Do not use this function directly - use ChildDescType() instead.

Definition at line 152 of file childinfo.c.

References ChildDesc::t.

int ValueAssignedF ( struct ChildDesc  e  ) 

Implementation function for ValueAssigned(). Do not use this function directly - use ValueAssigned() instead.

Definition at line 157 of file childinfo.c.

References ChildDesc::assigned.

long IntegerDefaultF ( struct ChildDesc  e  ) 

Implementation function for IntegerDefault(). Do not use this function directly - use IntegerDefault() instead.

Definition at line 162 of file childinfo.c.

References ChildDescUnion::ivalue, ChildDesc::u, and ChildDescI::value.

int BooleanDefaultF ( struct ChildDesc  e  ) 

Implementation function for BooleanDefault(). Do not use this function directly - use BooleanDefault() instead.

Definition at line 172 of file childinfo.c.

References ChildDescUnion::bvalue, and ChildDesc::u.

CONST struct set_t* SetDefaultF ( struct ChildDesc  e  )  [read]

Implementation function for SetDefault(). Do not use this function directly - use SetDefault() instead.

Definition at line 177 of file childinfo.c.

References ChildDescUnion::s, ChildDescS::slist, and ChildDesc::u.

int SetIsIntegerSetF ( struct ChildDesc  e  ) 

Implementation function for SetIsIntegerSet(). Do not use this function directly - use SetIsIntegerSet() instead.

Definition at line 182 of file childinfo.c.

References ChildDescS::is_int, ChildDescUnion::s, and ChildDesc::u.

symchar* SymbolDefaultF ( struct ChildDesc  e  ) 

Implementation function for SymbolDefault(). Do not use this function directly - use SymbolDefault() instead.

Definition at line 167 of file childinfo.c.

References ChildDescUnion::svalue, and ChildDesc::u.

double RealDefaultValueF ( struct ChildDesc  e  ) 

Implementation function for RealDefaultValue(). Do not use this function directly - use RealDefaultValue() instead.

Definition at line 187 of file childinfo.c.

References ChildDescUnion::rvalue, ChildDesc::u, and ChildDescR::value.

CONST dim_type* RealDimensionsF ( struct ChildDesc  e  ) 

Implementation function for RealDimensions(). Do not use this function directly - use RealDimensions() instead.

Definition at line 192 of file childinfo.c.

References ChildDescR::dims, ChildDescUnion::rvalue, and ChildDesc::u.

struct ChildDesc MakeRealDesc ( int  assigned,
double  v,
CONST dim_type dims 
) [read]

Make a real child with default v, and dimensions dims. Those values can be garbage if assigned is FALSE.

Definition at line 84 of file childinfo.c.

References ChildDesc::assigned, ChildDescR::dims, ICDESC, real_child, ChildDescUnion::rvalue, ChildDesc::t, ChildDesc::u, v, and ChildDescR::value.

struct ChildDesc MakeIntegerDesc ( int  assigned,
long  i 
) [read]

Make an integer child with default value i. The value i is ignored if assigned is false.

struct ChildDesc MakeBooleanDesc ( int  assigned,
int  b 
) [read]

Make a boolean child with default value b. The value b is ignored if assigned is false.

Definition at line 105 of file childinfo.c.

References ChildDesc::assigned, boolean_child, ChildDescUnion::bvalue, ICDESC, ChildDesc::t, and ChildDesc::u.

struct ChildDesc MakeSetDesc ( int  assigned,
int  intset,
struct set_t s 
) [read]

Make a set child with default value s. The value of s is ignored if assigned is false.

Definition at line 115 of file childinfo.c.

References ChildDesc::assigned, ICDESC, ChildDescS::is_int, ChildDescUnion::s, set_child, ChildDescS::slist, ChildDesc::t, and ChildDesc::u.

struct ChildDesc MakeSymbolDesc ( int  assigned,
symchar str 
) [read]

Make a symbol child description with default value str. The value of str is ignored if assigned is false.

Definition at line 126 of file childinfo.c.

References ChildDesc::assigned, ICDESC, ChildDescUnion::svalue, symbol_child, ChildDesc::t, and ChildDesc::u.

ASC_DLLSPEC void WriteChildList ( FILE *  fp,
ChildListPtr  cl 
)

Write what is known at parse time about the children in the child list given. What is known may be surprising. It may be only mildly accurate.

Definition at line 139 of file childio.c.

References ChildListEntry::bflags, CONST, FPRINTF, GetName, GGET, GL, gl_length, ChildListEntry::isarray, len, NULL, ChildListEntry::origin, SCP, ChildListEntry::statement, ChildListEntry::strptr, ChildListEntry::typeptr, WriteStatement(), and WriteStatementLocation().

Referenced by WriteDefinition().

ASC_DLLSPEC char* WriteChildDetails ( ChildListPtr  cl,
unsigned long  n 
)

Return a string containing buckets o'stuff about the nth child in list. The string will make use of braces as necessary to delimit items. What each item is will be subject to change according to the meta-data given by WriteChildMetaDetails. Items are booleans, integers or strings as explained below.

The string returned is the caller's responsibility.

Definition at line 272 of file childio.c.

References Asc_DStringAppend(), Asc_DStringInit(), Asc_DStringResult(), Asc_ModuleBestName(), ASC_PANIC, ChildAliasing(), ChildBaseTypePtr(), ChildIsArray(), ChildOrigin(), ChildParametric(), ChildPassed, ChildStatement(), ChildStrPtr(), ChildSupported, ChildVisible, CONST, GetBaseType, GetBaseTypeName(), GetName, GGET, GL, gl_length, len, NULL, origin_ARR, origin_ISA, origin_PARR, origin_PISA, origin_PWB, origin_WB, SCLEN, SCP, StatementLineNum, StatementModule, and WriteName2Str().

ASC_DLLSPEC CONST char* WriteChildMetaDetails ( void   ) 

Returns a string with fields brace delimited. Each field describes the corresponding field of a WriteChildDetails return string. The ordering and size may be expected to shift as ASCEND evolves. The hope is that the contents of metas individual fields will shift much more slowly than the ordering, number of fields and so forth. Using metas, one can expect to write code which survives changes in plain s.

The returned string is NOT yours to free. (safe to keep, though). The format is one or more elements in braces like:
"{data} {data} {data}"
where data is a triplet separated by - "name-ctype-{explanation}" Name is a single string with no blanks, ctype is boolean, integer, or string. explanation is for human consumption and explains the field.

Definition at line 172 of file childio.c.

ASC_DLLSPEC void WriteChildMissing ( FILE *  fp,
char *  scope,
symchar childname 
)

Issues a child missing error to file if the same childname/scope has not been missing since the last call with any NULL argument.

Definition at line 394 of file childio.c.

References CONSOLE_DEBUG, gl_append_ptr(), gl_create(), gl_destroy(), gl_ptr_search(), NULL, SCP, and VOIDPTR.

Referenced by Asc_CompilerDestroy().

ASC_DLLSPEC int CmpSymchar ( symchar s1,
symchar s2 
)

Compare two strings from the symbol table. Regardless of the details of the symchar definition, returns the result of alphabetic comparison between two items from the symbol table. NULL does not appear in the symbol table, so it better not be given here. Not necessarily implemented as strcmp.

Returns:
Result Condition
-1 s1 < s2
0 s1 == s2
1 s1 > s2

Definition at line 36 of file cmpfunc.c.

References AscFindSymbol(), NULL, and SCP.

Referenced by AddInstance(), Asc_ModuleCreateAlias(), Asc_SimsCmpSim(), CmpAtomValues(), CmpChildListEntries(), CmpProcs(), CmpSetInstVal(), CmpStrIndex(), CollectLinkTypes(), CompareChildLists(), CompareExprs(), CompareISStatements(), CompareNames(), CompareStatements(), DefineUnits(), DifferentVersionCheck(), ExprsEqual(), FindInstance(), getLinks(), getLinksReferencing(), GetTypeNamesFromStatList(), GreaterEqValues(), GreaterValues(), LessEqValues(), LessValues(), removeNonDeclarativeLinkEntry(), SearchProcList(), and TrashType().

int CmpPtrs ( const void *  p1,
const void *  p2 
)

General pointer comparison function. The comparison is for the pointers themselves, not what they point at. Either pointer may be NULL.

Returns:
Result Condition
-1 p1 < p2
0 p1 == p2
1 p1 > p2
See also:
CmpPtrsReverse()

Definition at line 46 of file cmpfunc.c.

Referenced by GetNotesAllLanguages().

ASC_DLLSPEC int CmpRealPtrs ( const void *  p1,
const void *  p2 
)

Real pointer comparison function. The comparison is for the pointers themselves, not what they point at. Neither pointer may be NULL (checked by assertion).

Returns:
Result Condition
-1 p1 < p2
0 p1 == p2
1 p1 > p2

Definition at line 51 of file cmpfunc.c.

References NULL.

int CmpParentsF ( CONST struct Instance i1,
CONST struct Instance i2 
)

Parent instance pointer comparison function. The comparison is for the pointers themselves, not what they point at. Neither pointer may be NULL (checked by assertion).

Returns:
Result Condition
-1 p1 < p2
0 p1 == p2
1 p1 > p2

Definition at line 59 of file cmpfunc.c.

References NULL.

int CmpRelationsF ( CONST struct Instance i1,
CONST struct Instance i2 
)

Relation instance pointer comparison function. The comparison is for the pointers themselves, not what they point at. Neither pointer may be NULL (checked by assertion).

Returns:
Result Condition
-1 p1 < p2
0 p1 == p2
1 p1 > p2

Definition at line 66 of file cmpfunc.c.

References NULL.

int CmpLogRelationsF ( CONST struct Instance i1,
CONST struct Instance i2 
)

Log relation instance pointer comparison function. The comparison is for the pointers themselves, not what they point at. Neither pointer may be NULL (checked by assertion).

Returns:
Result Condition
-1 p1 < p2
0 p1 == p2
1 p1 > p2

Definition at line 74 of file cmpfunc.c.

References NULL.

int CmpWhensF ( CONST struct Instance i1,
CONST struct Instance i2 
)

When instance pointer comparison function. The comparison is for the pointers themselves, not what they point at. Neither pointer may be NULL (checked by assertion).

Returns:
Result Condition
-1 p1 < p2
0 p1 == p2
1 p1 > p2

Definition at line 82 of file cmpfunc.c.

References NULL.

int CmpPtrsReverse ( void *  p1,
void *  p2 
)

General pointer comparison function with reverse ordering. The comparison is for the pointers themselves, not what they point at. Either pointer may be NULL.

Returns:
Result Condition
-1 p1 > p2
0 p1 == p2
1 p1 < p2
See also:
CmpPtrs()

Definition at line 109 of file cmpfunc.c.

void CheckChildCopies ( unsigned long int  num,
struct Instance **  clist 
)

Fixes up the num subatomic children sets copied into clist.

void RedoChildPointers ( unsigned long int  num,
struct Instance newparent,
struct Instance **  newchildptrs,
CONST struct Instance oldparent,
struct Instance *CONST *  oldchildptrs 
)

Fix up the num subatomic child pointers of newparent.

Definition at line 132 of file copyinst.c.

References INST.

struct Instance* ShortCutMakeUniversalInstance ( struct TypeDescription type  )  [read]

Checks if the given type is universal and if a universal instance exists. If one does, it will be returned, otherwise this returns NULL. If the a non-NULL instance is returned, it is the responsibility of the caller to ensure that the instance *knows* about the caller. See AddParent for example. Historical note: This function used to be a part of almost all the Create*Instance routines, but has been separated, so that those functions will now *always* create memory.

Definition at line 88 of file copyinst.c.

References GetUniversalFlag, GetUniversalTable(), LookupInstance(), and NULL.

void CollectNodes ( struct Instance i,
struct gl_list_t l 
)

Appends i to l, and sets the tmpnum of i to be the length of l after i was appended. If i does not have a tmpnum (ATOM children) this function just returns.

Definition at line 831 of file copyinst.c.

References ASC_PANIC, gl_append_ptr(), gl_length, SetTmpNum(), SIM_INST, Instance::t, and VOIDPTR.

Referenced by SaveInstance().

struct Instance* ShortCutProtoInstance ( struct TypeDescription type  )  [read]

Checks if a prototype exists for the given type definition. If one does, a copy of a prototype is returned. If the a non NULL instance is returned, it is the responsibility of the caller to ensure that the instance *knows* about the caller. See AddParent() for example.

Historical note: This function has been created such that it may be called separately from CreateInstance. If it were copied for example then there is no need to redo default statements etc. And so a caller can treat a copied instance specially.

Definition at line 104 of file copyinst.c.

References CopyInstance(), GetName, LookupPrototype(), and NULL.

ASC_DLLSPEC struct Instance* CopyInstance ( CONST struct Instance i  )  [read]

This will make a copy of instance i.

This routine is especially good for copying atomic instances, since it is faster to copy an atomic instance rather than instantiating it.

  1995
  This will make a copy of instance i.  i may not be a fundamental
  atomic instance.  At the current time, there are the following
  additional restrictions on instance i.
    1) "i" may not contain instances of universal types
    2) all instances in the instance tree "i" must have parent's
       only in the instance tree "i".
    3) instances in the instance tree "i" may not be ARE_ALIKE'd
       to instances outside of instance tree "i".
    4) The tree must not have any pending statements, as pendings
       and bitlists are basically ignored.
  1997 (as left by abbott):
    1) is no longer valid,
    2&3) only partially correct,
    4) is more important than ever. --baa
  

Definition at line 1168 of file copyinst.c.

References ASC_PANIC, Asc_Panic, AssertMemory, NULL, and SIM_INST.

Referenced by CreateBooleanInstance(), CreateIntegerInstance(), CreateLogRelInstance(), CreateModelInstance(), CreateRealInstance(), CreateRelationInstance(), CreateSetInstance(), CreateSymbolInstance(), CreateWhenInstance(), and ShortCutProtoInstance().

void ZeroNewChildrenEntries ( struct Instance **  ary,
unsigned long int  num 
)

Sets num entries of ary to NULL.

struct Instance* CreateSimulationInstance ( struct TypeDescription type,
symchar name 
) [read]

Create an instance of the type described by "type". The memory of "type" is used by the instance structure, so do not dispose or modify the memory. This initializes the instance with no parents, no clique membership. Being a simulation instance, it will have only 1 child and will make a separate copy of its name. The type should be the type of the root instance of the simulation. A simulation instance will have no parents. It will respond cleanly to all general instance query commands.

The reference count of type is incremented.

Definition at line 162 of file createinst.c.

References ascmalloc, CopyTypeDesc, SimulationInstance::desc, SimulationInstance::extvars, INST, SimulationInstance::interface_ptr, SimulationInstance::name, NULL, SIM_INST, SimulationInstance::slvreq_hooks, and SimulationInstance::t.

Referenced by NewInstantiate().

struct Instance* CreateModelInstance ( struct TypeDescription type  )  [read]

Create an instance of the type described by "type". The memory of "type" is used by the instance structure, so do not dispose or modify the memory. This initializes the instance with no parents, no clique membership, and no statements executed.

The reference count of type is incremented.

< DS: initially the link_table for a model is empty

Definition at line 98 of file createinst.c.

References AddUniversalInstance(), ModelInstance::alike_ptr, ModelInstance::anon_flags, ascmalloc, AssertMemory, AVG_LINKS, AVG_PARENTS, ChildListLen(), CONST, CopyInstance(), CopyTypeDesc, CreateFBList(), ModelInstance::desc, ModelInstance::executed, GetChildList, GetList, GetName, GetStatementList, GetUniversalFlag, GetUniversalTable(), gl_create(), gl_length, INST, INT_MAX, ModelInstance::interface_ptr, ModelInstance::link_table, LookupPrototype(), MOD_CHILD, MOD_INST, NULL, ModelInstance::parents, ModelInstance::pending_entry, ModelInstance::t, ModelInstance::tmp_num, ModelInstance::visited, ModelInstance::whens, and ZeroNewChildrenEntries().

struct Instance* CreateDummyInstance ( struct TypeDescription type  )  [read]

Returns a DummyInstance using the type given, which must be the dummy_type named BASE_UNSELECTED. The instance returned is UNIVERSAL.

The reference count of type is incremented.

Definition at line 140 of file createinst.c.

References AddUniversalInstance(), GlobalDummyInstance::anon_flags, ASC_NEW, CopyTypeDesc, GlobalDummyInstance::desc, dummy_type, GetBaseType, GetUniversalTable(), INST, GlobalDummyInstance::interface_ptr, NULL, GlobalDummyInstance::ref_count, GlobalDummyInstance::t, GlobalDummyInstance::tmp_num, and GlobalDummyInstance::visited.

struct Instance* CreateRealInstance ( struct TypeDescription type  )  [read]

Create a real instance whose type is described by "type". The instance struct will use the memory pointed to by type, so don't destroy this structure. It is cheaper to copy an instance of a real, than to create one. The value of the instance is initialized to def.

Type may be either real_type or real_constant_type or refinements thereof. User is expected to know what to do with the result. The reference count of type and units are incremented.

This function, redone by kirk, no longer finds universals and returns them. if that were appropriate, it should have been checked and done before hand. By ShortCutMakeUniversalInstance

Definition at line 317 of file createinst.c.

References AddPrototype(), AddUniversalInstance(), RealConstantInstance::alike_ptr, RealAtomInstance::alike_ptr, RealAtomInstance::anon_flags, ascmalloc, AssertMemory, RealAtomInstance::assigned, AtomDefaulted, AVG_CONSTANT_PARENTS, AVG_PARENTS, BASE_ADDR, BaseTypeIsAtomic, ChildListLen(), ci_ASSIGNED, CLIST, ConstantDefaulted, CopyInstance(), CopyTypeDesc, RealAtomInstance::depth, RealConstantInstance::desc, RealAtomInstance::desc, RealConstantInstance::dimen, RealAtomInstance::dimen, GetByteSize, GetChildDesc, GetChildList, GetConstantDefReal, GetConstantDimens, GetName, GetRealDefault, GetRealDimens, GetUniversalFlag, GetUniversalTable(), gl_create(), INST, RealConstantInstance::interface_ptr, RealAtomInstance::interface_ptr, LookupPrototype(), NULL, RealConstantInstance::parents, RealAtomInstance::parents, RA_INST, RC_INST, RealAtomInstance::relations, RealConstantInstance::t, RealAtomInstance::t, RealConstantInstance::tmp_num, RealAtomInstance::tmp_num, UNDEFAULTEDREAL, RealConstantInstance::value, RealAtomInstance::value, RealConstantInstance::vflag, RealConstantInstance::visited, and RealAtomInstance::visited.

struct Instance* CreateIntegerInstance ( struct TypeDescription type  )  [read]

Create an integer instance whose type is described by "type". The memory pointed to by type is used by the instance, so don't destroy it or modify it. Type may be either integer_type or integer_constant_type or refinements thereof. User is expected to know what to do with the result.

It is cheaper to copy an instance of an integer, than to create one. FALSE: Integer instances don't have default values.

Definition at line 412 of file createinst.c.

References AddPrototype(), AddUniversalInstance(), IntegerConstantInstance::alike_ptr, IntegerAtomInstance::alike_ptr, IntegerAtomInstance::anon_flags, ascmalloc, AssertMemory, IntegerAtomInstance::assigned, AtomDefaulted, AVG_ICONSTANT_PARENTS, AVG_PARENTS, BASE_ADDR, BaseTypeIsAtomic, ChildListLen(), ci_ASSIGNED, CLIST, ConstantDefaulted, CopyInstance(), CopyTypeDesc, IntegerAtomInstance::depth, IntegerConstantInstance::desc, IntegerAtomInstance::desc, GetByteSize, GetChildDesc, GetChildList, GetConstantDefInteger, GetIntDefault, GetName, GetUniversalFlag, GetUniversalTable(), gl_create(), IA_INST, IC_INST, INST, IntegerConstantInstance::interface_ptr, IntegerAtomInstance::interface_ptr, LookupPrototype(), NULL, IntegerConstantInstance::parents, IntegerAtomInstance::parents, IntegerConstantInstance::t, IntegerAtomInstance::t, IntegerConstantInstance::tmp_num, IntegerAtomInstance::tmp_num, IntegerConstantInstance::value, IntegerAtomInstance::value, IntegerConstantInstance::vflag, IntegerConstantInstance::visited, IntegerAtomInstance::visited, IntegerConstantInstance::whens, and IntegerAtomInstance::whens.

struct Instance* CreateBooleanInstance ( struct TypeDescription type  )  [read]

Create a boolean instance whose type is described by "type". The instance structure will use the memory pointed to by type, so don't modify it or free it. FALSE: Booleans don't yet have defaults. Type may be either boolean_type or boolean_constant_type or refinements thereof. User is expected to know what to do with the result.

Definition at line 491 of file createinst.c.

References AddPrototype(), AddUniversalInstance(), BooleanConstantInstance::alike_ptr, BooleanAtomInstance::alike_ptr, BooleanAtomInstance::anon_flags, ascmalloc, AssertMemory, BooleanAtomInstance::assigned, AtomDefaulted, AVG_ICONSTANT_PARENTS, AVG_PARENTS, BA_INST, BASE_ADDR, BaseTypeIsAtomic, BC_INST, ChildListLen(), CLIST, ConstantDefaulted, CopyInstance(), CopyTypeDesc, BooleanAtomInstance::depth, BooleanConstantInstance::desc, BooleanAtomInstance::desc, GetBoolDefault, GetByteSize, GetChildDesc, GetChildList, GetConstantDefBoolean, GetName, GetUniversalFlag, GetUniversalTable(), gl_create(), INST, INT_MAX, BooleanConstantInstance::interface_ptr, BooleanAtomInstance::interface_ptr, BooleanAtomInstance::logrelations, LookupPrototype(), NULL, BooleanAtomInstance::padding, BooleanConstantInstance::parents, BooleanAtomInstance::parents, BooleanConstantInstance::t, BooleanAtomInstance::t, BooleanConstantInstance::tmp_num, BooleanAtomInstance::tmp_num, BooleanAtomInstance::value, BooleanConstantInstance::vflag, BooleanConstantInstance::visited, BooleanAtomInstance::visited, BooleanConstantInstance::whens, and BooleanAtomInstance::whens.

struct Instance* CreateSetInstance ( struct TypeDescription type,
int  intset 
) [read]

Create a set instance whose type is described by "type". The instance will use the memory pointed to by type, so don't modify it or free it. Set instances don't have defaults.

intset determines the "type" of set. True means it is a set of integers, FALSE means a set of symbols.

Definition at line 571 of file createinst.c.

References AddPrototype(), AddUniversalInstance(), SetAtomInstance::alike_ptr, SetAtomInstance::anon_flags, ASCERR, ascmalloc, AssertMemory, AVG_PARENTS, BASE_ADDR, BaseTypeIsAtomic, ChildListLen(), CLIST, CopyInstance(), CopyTypeDesc, SetAtomInstance::desc, FPRINTF, GetByteSize, GetChildDesc, GetChildList, GetName, GetUniversalFlag, GetUniversalTable(), gl_create(), INST, SetAtomInstance::int_set, SetAtomInstance::interface_ptr, SetAtomInstance::list, LookupPrototype(), NULL, SetAtomInstance::parents, SA_INST, SetAtomInstance::t, SetAtomInstance::tmp_num, and SetAtomInstance::visited.

struct Instance* CreateSymbolInstance ( struct TypeDescription type  )  [read]
struct Instance* CreateArrayInstance ( struct TypeDescription type,
unsigned long  aIndex 
) [read]

Create an array instance whose type is described by "set". The instance will use the memory pointed to by type, so don't modify it or free it.

index indicates the number in the index list which this array is. Normally this should be 1.

struct Instance* CreateRelationInstance ( struct TypeDescription type,
enum Expr_enum  reltype 
) [read]

Create a relation instance who type is described by "type". The instance will use the memory pointed to by type, so don't modify it or free it. reltype is one of e_glassbox, e_blackbox, e_opcode, e_tokens and must be provided.

Definition at line 690 of file createinst.c.

References AddPrototype(), RelationInstance::anon_flags, ascmalloc, AssertMemory, BASE_ADDR, ChildListLen(), CLIST, CopyInstance(), CopyTypeDesc, RelationInstance::desc, GetByteSize, GetChildDesc, GetChildList, GetName, INST, RelationInstance::interface_ptr, RelationInstance::logrels, LookupPrototype(), NULL, RelationInstance::parent, RelationInstance::ptr, RELN_INST, RelationInstance::t, RelationInstance::tmp_num, RelationInstance::type, RelationInstance::visited, and RelationInstance::whens.

struct Instance* CreateLogRelInstance ( struct TypeDescription type  )  [read]
struct Instance* CreateWhenInstance ( struct TypeDescription type  )  [read]
ASC_DLLSPEC void DestroyInstance ( struct Instance inst,
struct Instance parent 
)

If parent is NULL, this will destroy all references to inst and deallocate the memory associated with inst. It will delete inst's reference to its children. If parent is not NULL, this will destroy parent's reference to inst. If this is the only reference to inst, it will deallocate the memory associated with inst.

DestroyInstance will modify the parent's of inst to remove the reference.

Definition at line 615 of file destroyinst.c.

References D_INST, GetUniversalFlag, GetUniversalTable(), InstanceKind, InstanceTypeDesc(), InterfacePtrDelete, IsCompoundInstance, NULL, TypeDescription::ref_count, RemoveInstance(), RemoveUniversalInstance(), SIM_INST, and Instance::t.

Referenced by AddPrototype(), DeletePrototype(), DestroyPrototype(), EmptyTrash(), sim_destroy(), TendTrash(), and TrashType().

void InitDump ( void   ) 

Must be called to initialize the dump.

Definition at line 68 of file dump.c.

References DUMPHASHSIZE, g_dump_inst_count, g_dump_type_count, and NULL.

Referenced by Asc_CompilerInit().

ASC_DLLSPEC void EmptyTrash ( void   ) 

Delete all the instances in the dump. The dump can still be used after this call.

Definition at line 76 of file dump.c.

References ascfree, AssertAllocatedMemory, DestroyInstance(), DUMPHASHSIZE, g_dump_inst_count, g_dump_type_count, gl_destroy(), gl_fetch, gl_length, DumpRec::instances, len, DumpRec::next, and NULL.

Referenced by Asc_CompilerDestroy().

void TendTrash ( void   ) 

This is a less drastic version of EmptyTrash(), which only deletes instance with too many copies in the dump. Too many is more than MESSYTHRES copies of a given type.

Definition at line 103 of file dump.c.

References DestroyInstance(), DUMPHASHSIZE, g_dump_inst_count, gl_delete(), gl_fetch, gl_length, DumpRec::instances, MESSYTHRESH, DumpRec::next, and NULL.

void TrashType ( symchar str  ) 

Delete any copies of type 'str' from the dump. This should be called if for instance the definition of 'str' is being changed. In such cases, fetching copies of 'str' from the dump would return the old version.

str should have no leading blanks and should be a valid identifier.

Definition at line 125 of file dump.c.

References AscFindSymbol(), ascfree, CmpSymchar(), DestroyInstance(), DUMPHASHINDEX, g_dump_inst_count, g_dump_type_count, gl_destroy(), gl_fetch, gl_length, DumpRec::instances, len, DumpRec::next, NULL, SCP, and DumpRec::type.

void AddInstance ( struct Instance i  ) 
struct Instance* FindInstance ( symchar str  )  [read]

This will return an instance if it one is available; otherwise, it returns NULL.

Definition at line 162 of file dump.c.

References ascfree, CmpSymchar(), DUMPHASHINDEX, g_dump_inst_count, g_dump_type_count, gl_delete(), gl_destroy(), gl_fetch, gl_length, DumpRec::instances, DumpRec::next, NULL, SCP, and DumpRec::type.

struct Instance** AddVarToTable ( struct Instance inst,
int *  added 
) [read]

Given an instance will store it in the ExtVariablesTable and will return the 'handle' to the instance. If variable existed already, it will not be added. If there was a failure then the variable will not be added. This is reflected in the variable "added".

Definition at line 82 of file extinst.c.

References Asc_Panic, and NULL.

Referenced by CreateExtCall().

void FixExternalVars ( struct Instance old,
struct Instance new 
)

Replaces old with new in the table. This will be called only for MODEL_INSTS.

Just used in MergeModels and RefineModel -- JP.

Definition at line 112 of file extinst.c.

References Asc_Panic, CONSOLE_DEBUG, gl_destroy(), gl_fetch, gl_length, len, and NULL.

void SetSimulationExtVars ( struct Instance i,
struct Instance **  extvars 
)

Will set the given extvar table to the instance. Not for the casual user !! Could not avoid exporting this one. I would rather have not. However instantiate needs to be able to set this table when finished.

Definition at line 137 of file extinst.c.

References InstanceKind, and SIM_INST.

Referenced by NewInstantiate().

struct Instance* GetEvaluationContextF ( void   )  [read]

retrieve the evaluation context (mainly for debugging)

Definition at line 91 of file find.c.

struct for_table_t* GetEvaluationForTableF ( void   )  [read]

retrieve the evaluation for table (mainly for debugging)

Definition at line 106 of file find.c.

References g_EvaluationForTable.

void SetEvaluationContextF ( CONST struct Instance i  ) 

set the evaluation context (mainly for debugging)

Definition at line 95 of file find.c.

References ASCERR, and FPRINTF.

void SetEvaluationForTableF ( struct for_table_t *  ft  ) 

set the evaluation for table (mainly for debugging)

Definition at line 110 of file find.c.

References ASCERR, FPRINTF, and g_EvaluationForTable.

struct value_t InstanceEvaluateName ( CONST struct Name nptr  )  [read]
struct value_t InstanceEvaluateSatisfiedName ( CONST struct Name nptr,
double  tol 
) [read]

This function is specially to evaluate name of relations or logical relations included in SATISFIED expressions. This evaluates the name in the context given by EvaluationContext. This must be set before the InstanceEvaluateName call. Note since this is a global variable you cannot evaluate names in more than one context simultaneously. If EvaluationForTable is non-NULL, the for table will be checked before the instance tree.

Definition at line 385 of file find.c.

References ASCERR, AssertMemory, CONST, CopySet(), correct_instance, CreateBooleanValue(), CreateErrorValue(), CreateIntegerValue(), CreateSetValue(), CreateSymbolValue(), DEFTOLERANCE, e_equal, e_greater, e_greatereq, e_less, e_lesseq, e_notequal, f_integer, f_set, f_symbol, FindForVar(), FPRINTF, GetEvaluationContext, GetEvaluationForTable, GetForInteger(), GetForKind(), GetForSet(), GetForSymbol(), GetInstanceRelationOnly(), gl_destroy(), gl_fetch, gl_length, impossible_instance, incorrect_name, InstanceKind, LogRelCalcResidual, for_var_t::name, name_unfound, NULL, RelationCalcResidualPostfixSafe(), RelationRelop(), safe_ok, SimpleNameIdPtr(), undefined_instance, undefined_value, and unmade_instance.

Referenced by EvaluateExpr().

struct gl_list_t* FindInstances ( CONST struct Instance i,
CONST struct Name n,
enum find_errors err 
) [read]

Return the list of instances specified by n. If this returns NULL, it indicates that it couldn't find the name. Check err to discover why.

Definition at line 784 of file find.c.

References AssertMemory, correct_instance, GetEvaluationContext, impossible_instance, NULL, and SetEvaluationContext.

Referenced by ExecuteBBOXElement(), FindInstancesFromNames(), FindInsts(), InitBBox(), ProcessExtRelArgs(), ProcessExtRelData(), and UpdateInstance().

struct gl_list_t* FindInstancesFromNames ( CONST struct Instance i,
CONST struct gl_list_t names,
enum find_errors err,
unsigned long *  errpos 
) [read]

Return the list of instances specified by names. If this returns NULL, it indicates that it couldn't find a name. Check err to discover why and errpos to discover which list element had the problem. Each listed name on input must resolve to a single instance, or the err will be impossible_instance.

Definition at line 800 of file find.c.

References correct_instance, FindInstances(), gl_append_ptr(), gl_create(), gl_destroy(), gl_fetch, gl_length, impossible_instance, and NULL.

Referenced by InitBBox().

struct gl_list_t* FindInstancesPaths ( CONST struct Instance i,
CONST struct Name n,
enum find_errors err 
) [read]

Return the list of Names expanded from n that have instances. Don't forget to destroy the names in the list before destroying list. If this returns NULL, it indicates that it couldn't find something in the name. Check err to discover why.

Definition at line 341 of file findpath.c.

References AssertMemory, correct_instance, GetEvaluationContext, gl_fetch, gl_length, gl_store(), impossible_instance, IAndName::n, NULL, and SetEvaluationContext.

Referenced by ProcessExtRelArgNames(), and ProcessExtRelDataName().

struct for_table_t* CreateForTable ( void   )  [read]

This function creates an empty FOR table which is then ready for use.

Definition at line 62 of file forvars.c.

References AssertMemory, for_table_t, and gl_create().

void DestroyForTable ( struct for_table_t *  ft  ) 

This procedure deallocates the memory associated with the for table.

void WriteForTable ( FILE *  out,
struct for_table_t *  ft 
)

This procedure writes the contents of a for table.

unsigned long ActiveForLoops ( CONST struct for_table_t *  ft  ) 

Returns the number of active FOR loops.

void AddLoopVariable ( struct for_table_t *  ft,
struct for_var_t var 
)

Add another loop variable to the for table. Adding a loop variable to the for table is like activating the FOR loop variable

struct for_var_t* LoopIndex ( CONST struct for_table_t *  ft,
unsigned long  num 
) [read]

Returns the num'th loop index. Loop indices are numbered in the order they are added to the list. The first being one and the last being the number given by ActiveForLoops(ft).

struct for_var_t* FindForVar ( CONST struct for_table_t *  ft,
symchar name 
) [read]

Searches for a FOR index variable which matches name. If it finds a match it returns the for_var_t; otherwise, it returns NULL.

void RemoveForVariable ( struct for_table_t *  ft  ) 

This removes the most recently added FOR index variable. The for_var_t is automatically deallocated.

struct for_var_t* CreateForVar ( symchar name  )  [read]

Create a for_var_t with the name given. This for_var_t starts out being f_untyped. You can use the routines below to set type and values. Never free a for_var_t except by using DestroyForVar below.

Definition at line 186 of file forvars.c.

References AscFindSymbol(), AssertAllocatedMemory, f_untyped, FVMALLOC, for_var_t::name, NULL, and for_var_t::t.

void SetForVarType ( struct for_var_t ft,
enum for_kind  t 
)

Set the type to t. fv must be untyped.

Definition at line 197 of file forvars.c.

References AssertAllocatedMemory, f_untyped, and for_var_t::t.

void SetForInteger ( struct for_var_t fv,
long  ivalue 
)

Set an integer for variable's value to ivalue.

void SetForSymbol ( struct for_var_t fv,
symchar sym_ptr 
)

Set a symbol for variable's value to sym_ptr.

Definition at line 211 of file forvars.c.

References AscFindSymbol(), AssertAllocatedMemory, f_symbol, NULL, for_union_t::sym_ptr, for_var_t::t, and for_var_t::value.

void SetForSet ( struct for_var_t fv,
struct set_t sptr 
)

Set a set for variable's value to sptr.

Definition at line 219 of file forvars.c.

References AssertAllocatedMemory, f_set, for_union_t::sptr, for_var_t::t, and for_var_t::value.

enum for_kind GetForKind ( CONST struct for_var_t fv  ) 

Return the type of the for variable.

Definition at line 226 of file forvars.c.

References AssertAllocatedMemory, and NULL.

Referenced by InstanceEvaluateName(), and InstanceEvaluateSatisfiedName().

symchar* GetForName ( CONST struct for_var_t fv  ) 

Return the name of the for variable

Definition at line 233 of file forvars.c.

References AssertAllocatedMemory, and NULL.

long GetForInteger ( CONST struct for_var_t fv  ) 

Return the value of an integer for variable.

Definition at line 240 of file forvars.c.

References AssertAllocatedMemory, and f_integer.

Referenced by addLinkEntry(), InstanceEvaluateName(), InstanceEvaluateSatisfiedName(), and removeLinkEntry().

symchar* GetForSymbol ( CONST struct for_var_t fv  ) 

Return the value of a symbol for variable.

Definition at line 247 of file forvars.c.

References AssertAllocatedMemory, and f_symbol.

Referenced by InstanceEvaluateName(), and InstanceEvaluateSatisfiedName().

CONST struct set_t* GetForSet ( CONST struct for_var_t fv  )  [read]

Return the value of a set for variable.

Definition at line 254 of file forvars.c.

References AssertAllocatedMemory, and f_set.

Referenced by InstanceEvaluateName(), and InstanceEvaluateSatisfiedName().

void DestroyForVar ( struct for_var_t fv  ) 

Deallocate the memory of this for variable. In the case of a set for variable, this will also deallocate the set.

Definition at line 261 of file forvars.c.

References AssertAllocatedMemory, DestroySet(), f_set, for_var_t::name, NULL, for_union_t::sptr, for_var_t::t, and for_var_t::value.

Referenced by DestroyForTable(), and RemoveForVariable().

int ClearForVarRecycle ( void   ) 

Deallocates the recycle list of forvar_t. returns the list length, if anyone cares. This function may be safely called at any time. There is no recycle initialization function.

Definition at line 272 of file forvars.c.

References ascfree, len, for_var_t::name, and NULL.

Referenced by Asc_CompilerDestroy().

CONST char* instance_typename ( CONST struct Instance inst  ) 

Return the instance's type name as given in instance_enum.h. This is a constant char pointer that the called does NOT own.

Panics if the inst_t in the instance isn't found in our list of names.

Returns:
the name

Definition at line 96 of file instance_io.c.

References ASC_PANIC, AssertMemory, CONSOLE_DEBUG, InstanceEnumLookup::name, NULL, and InstanceEnumLookup::t.

struct gl_list_t* ShortestPath ( CONST struct Instance inst,
CONST struct Instance ref,
unsigned int  height,
unsigned int  best 
) [read]

Collect all instances in path connecting inst with ref and returns them in a list. If path doesn't exist, it returns NULL. Path will be such that the smallest number of intermediate instances are used. This is a recursive function so send in 0,UINT_MAX as the last two arguments to initiate the call.

This returns a list of pointers to instances, and it should be deallocated with gl_destroy(path).

Definition at line 116 of file instance_io.c.

References gl_append_ptr(), gl_create(), gl_destroy(), gl_fetch, gl_length, gl_store(), InstanceParent(), InstanceShortDepth(), len, NULL, NumberParents(), ShortestPath(), and VOIDPTR.

Referenced by ShortestPath(), WriteInstanceName(), and WriteInstanceNameDS().

struct gl_list_t* AllPaths ( CONST struct Instance inst  )  [read]

AllPaths makes and returns a list of lists of NameNode structures. Each member of list AllPaths returns is a path from the given instance to root.

How to deallocate the result of AllPaths: Here is an example of how to deallocate the results. Use it or something equivalent.

  struct gl_list_t *paths,*path;
  paths = AllPaths(i);
  ....whatever....
  for(c=1;c <= gl_length(paths);c++){
     gl_free_and_destroy(gl_fetch(paths,c));
  }
  gl_destroy(paths);
  

Definition at line 359 of file instance_io.c.

References AllPaths(), ASC_NEW, CONST, gl_append_ptr(), gl_concat(), gl_create(), gl_destroy(), gl_fetch, gl_length, NameNode::index, NameNode::inst, InstanceChild(), InstanceParent(), NumberChildren(), NumberParents(), and VOIDPTR.

Referenced by AllPaths(), CountAliases(), CountISAs(), WriteAliases(), WriteAliasStrings(), WriteISAs(), and WriteISAStrings().

struct gl_list_t* ISAPaths ( CONST struct gl_list_t pathlist  )  [read]

Given pathlist, the output of AllPaths, returns the list of names which are real: that is names which have been constructed without ALIASES or WILL_BE's intermediate. The list returned contains pointers to elements of the pathlist given, so it should be destroyed with gl_destroy(isalist) before the AllPaths destruction is applied to pathlist. In well written MODELs, the isalist returned will be one long.

Definition at line 450 of file instance_io.c.

References ASCERR, FPRINTF, gl_append_ptr(), gl_create(), gl_fetch, gl_length, NULL, and VOIDPTR.

Referenced by CountISAs(), WriteISAs(), and WriteISAStrings().

ASC_DLLSPEC int WriteInstanceName ( FILE *  f,
CONST struct Instance i,
CONST struct Instance ref 
)

Print the instance's name to the specified file. The name that is printed is derived from the shortest path between i and ref. If ref is NULL, the shortest path to root is used. The number of characters written is returned, to assist in pretty printing or line breaking.

Definition at line 251 of file instance_io.c.

References gl_destroy(), ShortestPath(), and WritePath().

Referenced by CreateLogicalRelation(), CreateTokenRelation(), dis_write_name(), logrel_write_name(), Pass2CollectAnonProtoVars(), Pass2CopyAnonProto(), rel_write_name(), system_generate_diffvars(), var_write_name(), when_write_name(), WriteInstanceList(), and WriteWhen().

void WriteInstanceNameDS ( Asc_DString dsPtr,
CONST struct Instance i,
CONST struct Instance ref 
)

Print the instance's name to the specified dstring. The name that is printed is derived from the shortest path between i and ref. If ref is NULL, the shortest path to root is used. This does not put a . in at the beginning of a name, so you cannot build up proper names in a DS with it. It writes proper relative names instead, where the context is assumed to be ref.

Definition at line 269 of file instance_io.c.

References gl_destroy(), and ShortestPath().

Referenced by WriteInstanceNameString().

ASC_DLLSPEC char* WriteInstanceNameString ( CONST struct Instance i,
CONST struct Instance ref 
)

Return a string (that the caller then owns). The name that is printed is derived from the shortest path between i and ref. If ref is NULL, the shortest path to root is used. The name will not begin with a '.', even if the path ref is not a simulation or NULL.

Definition at line 279 of file instance_io.c.

References Asc_DStringInit(), Asc_DStringResult(), and WriteInstanceNameDS().

Referenced by bnd_make_name(), CalcRelationNominal(), ChangeRelationPointers(), dis_make_name(), getOdeId(), getOdeType(), Initialize(), logrel_make_name(), rel_make_name(), var_make_name(), and when_make_name().

ASC_DLLSPEC int WriteAnyInstanceName ( FILE *  f,
struct Instance i 
)

Print the instance's name to the specified file. Very similar to WriteInstanceName(). The name that is printed is derived from *any* path from i to NULL. This function was designed for speed, rather than good looks, and may be used for bulk writing of instance names. Returns the count of characters written.

Definition at line 325 of file instance_io.c.

References gl_create(), gl_destroy(), and WritePath().

ASC_DLLSPEC unsigned long CountAliases ( CONST struct Instance i  ) 

Count all the known names of the instance given.

Definition at line 553 of file instance_io.c.

References AllPaths(), gl_destroy(), gl_fetch, gl_free_and_destroy(), and gl_length.

ASC_DLLSPEC unsigned long CountISAs ( CONST struct Instance i  ) 

Count the names with which the instance given was created.

Definition at line 568 of file instance_io.c.

References AllPaths(), gl_destroy(), gl_fetch, gl_free_and_destroy(), gl_length, and ISAPaths().

void WriteAliases ( FILE *  f,
CONST struct Instance i 
)

Print all the instance's names to the specified file.

Definition at line 591 of file instance_io.c.

References AllPaths(), FPRINTF, gl_destroy(), gl_fetch, gl_free_and_destroy(), gl_length, and PUTC.

Referenced by WriteClique().

void WriteISAs ( FILE *  f,
CONST struct Instance i 
)

Print the instance's constructed names to the specified file. (there may not be any in bizarre circumstances).

Definition at line 609 of file instance_io.c.

References AllPaths(), FPRINTF, gl_destroy(), gl_fetch, gl_free_and_destroy(), gl_length, ISAPaths(), and PUTC.

ASC_DLLSPEC struct gl_list_t* WriteAliasStrings ( CONST struct Instance i  )  [read]

Return a list of strings of all the possible instance names for i. The list AND the strings on it are the user's responsibility to destroy. gl_free_and_destroy(aliases) would be convenient.

Definition at line 633 of file instance_io.c.

References AllPaths(), gl_append_ptr(), gl_create(), gl_destroy(), gl_fetch, gl_free_and_destroy(), gl_length, NULL, and VOIDPTR.

ASC_DLLSPEC struct gl_list_t* WriteISAStrings ( CONST struct Instance i  )  [read]

Return a list of strings of all the constructed instance names for i. Names created by WILL_BE/ALIASES are not returned. Under bizarre circumstances, the list may be empty. The list AND the strings on it are the user's responsibility to destroy. gl_free_and_destroy(aliases) would be convenient.

Bug:
Returns IS_A'd parents as well. need to hunt down the path of instances being tracked and see if they were passed the original instance we queried about.

Definition at line 653 of file instance_io.c.

References AllPaths(), gl_append_ptr(), gl_create(), gl_destroy(), gl_fetch, gl_free_and_destroy(), gl_length, ISAPaths(), NULL, and VOIDPTR.

void WriteClique ( FILE *  f,
CONST struct Instance i 
)

Print all the instance's clique members.

Definition at line 679 of file instance_io.c.

References CONST, NextCliqueMember(), and WriteAliases().

ASC_DLLSPEC void WriteInstance ( FILE *  f,
CONST struct Instance i 
)
int WritePath ( FILE *  f,
CONST struct gl_list_t path 
)

Returns the number of name pieces written.

Definition at line 167 of file instance_io.c.

References ASCERR, CONST, FPRINTF, gl_fetch, gl_length, InstanceIntIndex, InstanceNameStr, InstanceNameType, InstanceStrIndex, IntArrayIndex, NULL, ParentsName(), PUTC, SCLEN, SCP, StrArrayIndex, and StrName.

Referenced by WriteAnyInstanceName(), and WriteInstanceName().

char* WritePathString ( CONST struct gl_list_t path  ) 

Returns the path in a string. The caller should free the string when done with it.

Definition at line 236 of file instance_io.c.

References Asc_DStringInit(), and Asc_DStringResult().

ASC_DLLSPEC void SaveInstance ( FILE *  f,
CONST struct Instance inst,
int  dorelations 
)

Save the information contained in inst in a format that will allow efficient reconstruction of the instance. This will be followed up with RestoreInstance.

Definition at line 1779 of file instance_io.c.

References CollectNodes(), CreateTable(), DestroyTable(), gl_create(), gl_destroy(), gl_length, NULL, TYPE_HASH_SIZE, and VisitInstanceTreeTwo().

void WriteInstanceList ( struct gl_list_t list  ) 

This is a debugging aid and not intended for general use. It assumes that this is a list of instances and will try to write out the instance name for each element on the list.

This is a debugging aid and not intended for general use

Definition at line 1094 of file instance_io.c.

References FPRINTF, gl_fetch, gl_length, NULL, and WriteInstanceName().

ASC_DLLSPEC void WriteAtomValue ( FILE *  fp,
CONST struct Instance i 
)
struct gl_list_t* PushInterfacePtrs ( struct Instance i,
IPFunc  ipcreatef,
unsigned long int  iest,
int  visitorder,
VOIDPTR  vp 
) [read]

Creates a gl_list and returns it to you. It contains the information needed to restore the state of the instance interface pointers ipcreatef returns non-NULL values for. Remember that not all instance types have interface pointers. Push does not visit subatomic instances (ATOM/reln children).

The algorithm is as follows:

  • Create an initial gl_list of capacity = 2 * iest (we keep pairs). (Thus, iest allows you to give us a hint about how many insts you expect to be interested in. iest need not be a perfect hint.)
  • Visit the instance tree (visitorder is treated as order is in the VisitInstanceTree function). Each place that ipcreatef returns non-NULL, save ip state information in the gl_list and replace it in the instance with your ip data.
  • Return gllist. The gl_list returned here can only be safely destroyed by a call following to PopInterfacePtrs. The gl_list returned may be NULL if malloc fails or you forgot ipcreatef.

ASSUMPTION: For the duration of the Push/Pop sequence you will be taking NO compiler action that deletes, relocates, or merges any part of the subtree rooted at instance i. Violate this rule and we die most probably. This is not a hard assumption to meet in single thread code.

void PopInterfacePtrs ( struct gl_list_t oldips,
IPDeleteFunc  ipdestroyf,
VOIDPTR  vp 
)

This function restores the previous state of interface pointers. oldips is from a call to PushInterfacePtrs. ipdestroyf is a function you provide. If you provide NULL (meaning that no deallocation of objects pointed at by interface_ptr) we simply restore the old state. If ipdestroyf is not NULL, we will call it on the instances in oldips. We deallocate oldips, this is not your job.

Definition at line 1871 of file instance_io.c.

References GetInterfacePtr(), gl_destroy(), gl_fetch, gl_length, NULL, and SetInterfacePtr().

Referenced by Asc_AnonMergeUnmarkIPs(), dis_BackendTokens_to_dis(), and var_BackendTokens_to_vars().

ASC_DLLSPEC int ArrayIsRelation ( struct Instance i  ) 

Returns 1 if the instance sent in is a good relation array or relation, 0 OTHERWISE.

is this file the right place for ArrayIsRelation, ArrayIsLogRel, etc? Makes the assumption that the instance sent is not null and that array children for relations are all of the same type so that I can look at the first child only. Added to code to take care of empty sets -- resulting in 0 children.

Definition at line 1901 of file instance_io.c.

References InstanceChild(), InstanceKind, NULL, and NumberChildren().

ASC_DLLSPEC int ArrayIsLogRel ( struct Instance i  ) 

Returns 1 if the instance sent in is a good logical relation array or logical relation, 0 OTHERWISE.

Definition at line 1914 of file instance_io.c.

References InstanceChild(), InstanceKind, NULL, and NumberChildren().

ASC_DLLSPEC int ArrayIsWhen ( struct Instance i  ) 

Returns 1 if the instance sent in is a good when array or when, 0 OTHERWISE.

Definition at line 1926 of file instance_io.c.

References InstanceChild(), InstanceKind, NULL, and NumberChildren().

int ArrayIsModel ( struct Instance i  ) 

Returns 1 if the instance sent in is a good model array or when, 0 OTHERWISE.

Definition at line 1938 of file instance_io.c.

References InstanceChild(), InstanceKind, NULL, and NumberChildren().

void SetInstantiationRelnFlags ( unsigned int  flag  ) 

Sets the relation instantiation state of the instantiator. The flags control when and how how relations are instantiated. of relations. This allows more control over the sequence in which instantiation is done, and for so-called 'phased-compilation'.

Valid flags are the following:

  • NORELS No relations should be instantiated
  • GBOXRELS Glassbox relations
  • BBOXRELS Blackbox relations
  • TOKRELS Token relations
  • ALLRELS Glassbox, Blackbox, and Token relations
  • EXTRELS Glassbox and Blackbox relations

Definition at line 13259 of file instantiate.c.

Referenced by InstantiatePatch(), and SimsCreateInstance().

unsigned int GetInstantiationRelnFlags ( void   ) 

Retrieves the relation instantiation state of the instantiator. See SetInstantiationRelnFlags() for more information.

Definition at line 13264 of file instantiate.c.

Referenced by InstantiatePatch(), and SimsCreateInstance().

struct Instance* NewInstantiate ( symchar type,
symchar name,
int  intset,
symchar defmethod 
) [read]

This routine will return an instance of type SIM_INST. It will make an instance of the given type this will be set as the *root* of the simulation. To access the root of the instance tree use the functions GetSimulationRoot in instquery.h intset is only used when you are making an instance of a set type. defmethod is a METHOD name we are to attempt calling on the created instance at the END of compilation. If it does not exist, we will return silently after instantiation.

  5 phase Algorithm (approximately. here we ignore failure modes):
  Phase 1
  level
  1	get type
  1	create sim inst
  1	call real_instantiate_1
  2	call instantiate_model_1
  3	steal and return universal instance of type, or
  3	create model instance head
  3	process pending instances of model
  4	recursive instantiate, marking rels. logrels and whens done
      in arrays/bitlists without actually doing them.
  4	if no pendings,
  4	else error message about parts missing,
     and constants undefined.
  ...return all the way up eventually.
  Go back and mark all relation statements undone, put insts pending
  Phase 2
  1	call real_instantiate_2
  2	call instantiate_model_2
  3	process pending instances of model
  4	recursive instantiate, doing rels only  and
      marking logrels and whens as done.
      Explain failed relations.
  4	All statements are now determinate,
           All variables must be findable or they can't be.
  ...return all the way up eventually.
  Go back and mark all logrelation statements undone, put insts pending
  Phase 3
  1	call real_instantiate_3
  2	call instantiate_model_3
  3	process pending instances of model
  4	recursive instantiate, doing logrels only and
      marking whens as done. In phase 3 there are
      more than 1 iteration for the instantiation of
      logrels, since logrels can reference logrels
      (logrels inside conditional statements).
	Explain failed logrelations.
  4	All logical variables and referenced rels and
      logrels must be findable or they can't be.
   ...return all the way up eventually.
  Go back and mark all when statements undone, put insts pending
  Phase 4
  1	call real_instantiate_4
  2	call instantiate_model_4
  3	process pending instances of model
  4	recursive instantiate, doing whens only.
	Explain failed whens.
  4	All conditional variables, rels or logrels
      referenced by the whens  must be findable or
      they can't be
  ...return all the way up eventually.
  DS: Added new Phase for LINK statements that need the final instances in order to be consistent
 		Phase 6
		1 call real_instantiate_5
 	  2 call instantiate_model_5
    3 process pending instances of model
 	  4 recursive instantiate, doing LINKs only
  Phase 5
      Execution of default statements. (we would like to delete phase 5).
  Phase 6
 	Execute defmethod.
  

Definition at line 13073 of file instantiate.c.

References ASCERR, CreateSimulationInstance(), FindType(), FPRINTF, g_compiler_counter, g_ExtVariablesTable, LinkToParentByPos(), NULL, SCP, and SetSimulationExtVars().

ASC_DLLSPEC void NewReInstantiate ( struct Instance i  ) 

This routine is used to resume execution of an instance with unexecuted statements. It will reattempt to execute the unexecuted statement. If it is able to complete the instance, it will execute the DEFAULT assignments(assignments to reals and booleans).

On entry it is assumed that the instance i has already been refined and so will not MOVE during subsequent work. The process here must be kept in sync with NewRealInstantiateModel, but must, additionally, deal ok with array instances as input.

Definition at line 13170 of file instantiate.c.

References asc_assert, ASC_PANIC, ASCERR, CONSOLE_DEBUG, FPRINTF, g_compiler_counter, IsCompoundInstance, NULL, and SilentVisitInstanceTree().

ASC_DLLSPEC void UpdateInstance ( struct Instance root,
struct Instance target,
CONST struct StatementList slist 
)

Update instance takes a pointer to the root of a simulation (ie the instance tree), and will find instance target. It will then apply the statementlist to the given to the target instance. This is the start of some experimental encapsulation/parameterization schemes.

This is the version of instantiate to deal with with 'patched' types. Here name is the name of the patch that is to be instantiated. We first find the 'original' type, instantiate it and then apply the patch. The things that are properly and fully supported is external relations, which is the real reason that the patch was designed.

Definition at line 13277 of file instantiate.c.

References ASCERR, EXT, ExternalStatScope, FindInstances(), FPRINTF, GetList, gl_destroy(), gl_fetch, gl_length, NULL, and StatementType.

Referenced by InstantiatePatch().

struct Instance* InstantiatePatch ( symchar patch,
symchar name,
int  intset 
) [read]

Instantiate patch takes the name of a patch that is supposed to be applied to a type. It partially instantiates the instance, then applies the patch. It returns the instance created. It uses UpdateInstance to do the real work. The applicability of the patch is hence determined by what that function supports.

this function instantiates a thing of type name without doing relations.

Relations are then hacked in from external places but OTHERWISE the object appears as a regular ASCEND object. (note HACKED is the right word.)

This function is obsolete; bintoken.c and multiphase instantiation make it irrelevant.

Definition at line 13335 of file instantiate.c.

References asc_assert, ASCERR, EXTRELS, FindType(), FPRINTF, g_compiler_counter, GetBaseType, GetInstantiationRelnFlags(), GetName, GetPatchOriginal, GetSimulationRoot(), GetStatementList, Instantiate, NULL, patch_type, SCP, SetInstantiationRelnFlags(), and UpdateInstance().

Referenced by SimsCreateInstance().

void ConfigureInstFromArgs ( struct Instance inst,
CONST struct Instance arginst 
)

inst and arginst must be of the same MODEL type. inst should have NO executed statements -- it should be fresh from CreateModelInstance. Neither inst nor arginst should have any parents yet, if ever. This function copies or references, depending on how declared in the parameter list of the type for both models, the non-NULL children of arginst into inst.

Connect WILL_BE'd children from arginst to inst. Copy IS_A'd children from arginst to inst. At this point there can be no alias children -- all are either WILL_BE or IS_A of constants/arrays. This must only be called with models when arginst !=NULL. arginst == NULL --> immediate, no action return. inst and arginst are assumed to be the same type.

Definition at line 3661 of file instantiate.c.

References asc_assert, ASC_PANIC, ChildListLen(), ChildOrigin(), GetChildList, InstanceChild(), InstanceKind, InstanceTypeDesc(), NULL, origin_ALI, origin_ARR, origin_ERR, origin_ISA, origin_PALI, origin_PARR, origin_PISA, origin_PWB, and origin_WB.

void ReConfigureInstFromArgs ( struct Instance inst,
CONST struct Instance arginst 
)

inst and arginst must be or are about to be of the same MODEL type. inst should have been created from a less refined version of the type and is in the process of being refined up to type of arginst. arginst should not have any parents. This function copies or references, depending on how declared in the parameter list of the type for both models, the non-NULL children of arginst into inst for the slots in inst that are not already occupied.

For Those children not already present in inst, which must be of the same type as arginst. Connect WILL_BE'd children from arginst to inst. Copy IS_A'd children from arginst to inst. At this point there can be no alias children -- all are either WILL_BE or IS_A of constants/arrays, so far as arginst is concerned.

This must only be called with models when arginst !=NULL. arginst == NULL --> immediate, no action return. inst is expected to be of same type as arginst.

Definition at line 3712 of file instantiate.c.

References asc_assert, ASC_PANIC, ChildListLen(), ChildOrigin(), GetChildList, InstanceChild(), InstanceKind, InstanceTypeDesc(), NULL, origin_ALI, origin_ARR, origin_ERR, origin_ISA, origin_PALI, origin_PARR, origin_PISA, origin_PWB, and origin_WB.

void LinkToParentByPos ( struct Instance parent,
struct Instance child,
unsigned long  childnum 
)

Add child as childnumth child of parent and add parent to child.

Definition at line 958 of file instantiate.c.

References AddParent(), asc_assert, NULL, and StoreChildPtr().

Referenced by NewInstantiate().

int IncompleteArray ( CONST struct Instance i  ) 

Given an array instance i, returns 1 if incomplete, 0 if ok. This means all NONNULL children are done, with the possible exception of arrays of relations/logical_relations.

Definition at line 13124 of file instantiate.c.

References GetArrayBaseIsLogRel, GetArrayBaseIsRelation, InstanceChild(), InstanceKind, InstanceTypeDesc(), NULL, NumberChildren(), and RectangleArrayExpanded().

int NotAtomF ( struct Instance  ) 

Returns 1 if instance is compound (i.e. not relation, ATOM, constant, when. that means array or MODEL.) else returns 0.

Definition at line 70 of file instmacro.c.

References ASC_PANIC, AssertMemory, and Instance::t.

ASC_DLLSPEC enum inst_t InstanceKindF ( CONST struct Instance i  ) 

Implementation function for InstanceKind(). Do not use this function directly - use InstanceKind() instead.

Definition at line 80 of file instquery.c.

References IERRINST, and NULL.

unsigned long InstanceDepth ( CONST struct Instance i  ) 

Return the longest distance between i and root. The depth of NULL is 0. The root instance is at depth 1.

Definition at line 87 of file instquery.c.

References AssertMemory, CONST, InstanceDepth(), InstanceParent(), NULL, and NumberParents().

Referenced by InstanceDepth().

ASC_DLLSPEC unsigned long InstanceShortDepth ( CONST struct Instance i  ) 

Return the shortest distance between i and root. The depth of NULL is 0, and the depth of root is 1.

Definition at line 100 of file instquery.c.

References AssertMemory, CONST, InstanceParent(), InstanceShortDepth(), NULL, and NumberParents().

Referenced by InstanceShortDepth(), and ShortestPath().

void SetNextCliqueMember ( struct Instance i,
struct Instance ptr 
)

Sets i->alike_ptr to ptr for types that have alike_ptrs. Exits on types that don't or bad input. Instantiator use only! Clients should never ever touch this. This is not an intelligent function.

Definition at line 121 of file instquery.c.

References Asc_Panic, ASC_PANIC, AssertMemory, BA_INST, BC_INST, IA_INST, IC_INST, MOD_INST, NULL, RA_INST, RC_INST, SA_INST, SIM_INST, SYMA_INST, SYMC_INST, and Instance::t.

Referenced by FixCliques(), and MergeCliques().

ASC_DLLSPEC struct Instance* NextCliqueMember ( CONST struct Instance i  )  [read]

This is defined to give clients access to the cliques(ARE_ALIKE) links between instances. Each instance has a clique pointer which points to the next member of the clique list. These pointers form a circularly linked list. The following loop can be used to access each member of the clique.

     struct Instance *i,*start;
     (* i points the instance whose clique is to be examined *)
     start = i;
     do {
        (* insert your code here *)
        i = NextCliqueMember(i);
     } while(i!=start);
  

This loop will execute the inserted code for each member of the clique. This function can be call on *any* type of instance.

Definition at line 187 of file instquery.c.

References ASC_PANIC, AssertMemory, BA_INST, BC_INST, IA_INST, IC_INST, MOD_INST, RA_INST, RC_INST, SA_INST, SIM_INST, SYMA_INST, and SYMC_INST.

Referenced by FixCliques(), MergeCliques(), RefineClique(), SetBooleanAtomValue(), SetIntegerAtomValue(), SetRealAtomDims(), SetRealAtomValue(), SetSymbolAtomValue(), and WriteClique().

ASC_DLLSPEC VOIDPTR GetInterfacePtr ( CONST struct Instance i  ) 

Return the interface pointer. The compiler initializes this to NULL when it creates an instance of the following kinds, and hence should only be called on them.

  • SIM_INST
  • MODEL_INST
  • SET_ATOM_INST
  • REL_INST
  • LREL_INST
  • WHEN_INST
  • REAL_ATOM_INST
  • INTEGER_ATOM_INST
  • SYMBOL_ATOM_INST
  • BOOLEAN_ATOM_INST
  • ARRAY_ENUM_INST
  • ARRAY_INT_INST
  • REAL_CONSTANT_INST
  • INTEGER_CONSTANT_INST
  • SYMBOL_CONSTANT_INST
  • BOOLEAN_CONSTANT_INST

Those not supported are:

  • (atom children)
  • REAL_INST
  • INTEGER_INST
  • SYMBOL_INST
  • BOOLEAN_INST
  • SET_INST

It is up to the interface to give this pointer meaning. In a multiple interface environment this pointer needs to be managed carefully. Any really sane environment will not use this pointer except in a transient fashion with Push/Pop in instance_io.h.

Definition at line 236 of file instquery.c.

References ARY_INST, ASC_PANIC, AssertMemory, BA_INST, CI_INST, D_INST, IA_INST, LRELN_INST, MOD_INST, NULL, RA_INST, RELN_INST, SA_INST, SIM_INST, SYMA_INST, and W_INST.

Referenced by Asc_AnonMergeCmpInstances(), Asc_AnonMergeWriteList(), dis_BackendTokens_to_dis(), logrel_destroy(), PopInterfacePtrs(), rel_destroy(), var_BackendTokens_to_vars(), and when_destroy().

ASC_DLLSPEC void SetInterfacePtr ( struct Instance i,
VOIDPTR  c 
)

Set the interface pointer. The interface must set and maintain this pointer. See the note for GetInterfacePtr about applicability of this function.

Definition at line 275 of file instquery.c.

References ARY_INST, ASC_PANIC, ASCERR, AssertMemory, BA_INST, CI_INST, D_INST, FPRINTF, IA_INST, LRELN_INST, MOD_INST, RA_INST, RELN_INST, SA_INST, SIM_INST, SYMA_INST, Instance::t, and W_INST.

Referenced by dis_BackendTokens_to_dis(), logrel_destroy(), PopInterfacePtrs(), rel_destroy(), var_BackendTokens_to_vars(), and when_destroy().

unsigned int GetAnonFlags ( CONST struct Instance i  ) 

Returns the flags associated with an instance. This is a utility service provided for clients who need access to flags associated with an instance. These flags may also be set with the below function. Works for all instance kinds except subatomic ones.

Definition at line 334 of file instquery.c.

References ARY_INST, ASC_PANIC, AssertMemory, CA_INST, CI_INST, D_INST, LRELN_INST, MOD_INST, RELN_INST, SIM_INST, and W_INST.

Referenced by Asc_AnonMergeCmpInstances(), and Asc_AnonMergeWriteList().

void SetAnonFlags ( struct Instance i,
unsigned int  flags 
)

Sets the flags associated with an instance. This is a utility service provided for clients who need access to flags associated with Works for all instance kinds except subatomic ones.

Definition at line 377 of file instquery.c.

References ARY_INST, ASC_PANIC, AssertMemory, CA_INST, CI_INST, D_INST, LRELN_INST, MOD_INST, RELN_INST, SIM_INST, Instance::t, and W_INST.

Referenced by AnonMergeCountTree().

ASC_DLLSPEC struct BitList* InstanceBitList ( CONST struct Instance i  )  [read]

Return the bit list which indicates which statements have and have not been executed. NULL indicates that there aren't any unexecuted statements. Only MODEL_INST have bitlists.

Definition at line 724 of file instquery.c.

References ASC_PANIC, AssertMemory, MOD_INST, and NULL.

Referenced by Pass2CopyAnonProto().

ASC_DLLSPEC symchar* InstanceType ( CONST struct Instance i  ) 

Return a string indicating the type of instance i. This works for all types of instances. It returns the blank string for arrays and relations though.

ASC_DLLSPEC struct TypeDescription* InstanceTypeDesc ( CONST struct Instance i  )  [read]
unsigned long InstanceIndirected ( CONST struct Instance i  ) 

Returns the indirected field of array instances and LONG_MAX for other kinds of instances. Does not tolerate NULL.

Definition at line 663 of file instquery.c.

References ARY_INST, IARR, InstanceKind, LONG_MAX, and NULL.

Referenced by AnonMergeCountTree(), Asc_WriteAnonList(), and WriteInstance().

unsigned long InstanceSize ( CONST struct Instance i  ) 

Returns the number of bytes chargeable to the given instance i. This is not recursive. Fundamental types (which occur only as children of atoms/relations) are charged to their parent atom/relation and hence have a 'cost' of 0 according to this function. Symbol table, set_t, and dimen items associated with instances are not charged.

Definition at line 483 of file instquery.c.

References ARY_INST, ASC_PANIC, AssertMemory, BA_INST, BC_INST, BitListBytes(), ChildListLen(), ConstantByteLength(), ModelInstance::desc, ModelInstance::executed, GetByteSize, GetChildList, gl_capacity(), gl_length, IA_INST, IC_INST, InstanceKind, InstanceTypeDesc(), IsConstantInstance, IsFundamentalInstance, LRELN_INST, MOD_INST, NULL, ModelInstance::parents, RA_INST, RC_INST, RELN_INST, SIM_INST, SYMA_INST, SYMC_INST, W_INST, and ModelInstance::whens.

ASC_DLLSPEC int IntegerSetInstance ( CONST struct Instance i  ) 

It will return true if the set is of integers and false otherwise. This should only be called on set instances.

Definition at line 600 of file instquery.c.

References ASC_PANIC, AssertMemory, S_INST, and SA_INST.

ASC_DLLSPEC symchar* GetSimulationName ( struct Instance i  ) 

Returns the name of the simulation instance. i must be a SIM_INST kind.

Definition at line 426 of file instquery.c.

References ASCERR, FPRINTF, InstanceKind, and SIM_INST.

Referenced by Asc_FindSimulationRoot(), Asc_FindSimulationTop(), Asc_SimsCmpSim(), Asc_SimsFindSimulationName(), Asc_SimsUniqueName(), and sim_destroy().

struct gl_list_t* FindSimulationAncestors ( struct Instance i  )  [read]

Returns a list of all the simulation ancestors of i. Caller should destroy the list (but obviously not its content).

Definition at line 447 of file instquery.c.

References gl_create(), NULL, SilentVisitInstanceRootsTwo(), and VOIDPTR.

Referenced by FindSimulationInstance().

ASC_DLLSPEC struct Instance* GetSimulationRoot ( struct Instance i  )  [read]

Returns the root instance of the simulation. This is where most if not all useful queries of a simulation should be based. i must be a sim instance.

Definition at line 458 of file instquery.c.

References InstanceKind, SIM_CHILD, and SIM_INST.

Referenced by Asc_FindSimulationRoot(), Asc_SimsFindSimulationName(), and InstantiatePatch().

ASC_DLLSPEC struct Instance* FindSimulationInstance ( struct Instance i  )  [read]

Attempt to navigate up the Instance Tree until a SIM_INST SimulationInstance is located.

Definition at line 465 of file instquery.c.

References CONSOLE_DEBUG, FindSimulationAncestors(), gl_destroy(), gl_fetch, gl_length, and NULL.

Referenced by slvreq_destroy_hooks(), slvreq_do_solve(), slvreq_set_option(), and slvreq_set_solver().

void ChangeRelationPointers ( struct Instance rel,
struct Instance old,
struct Instance new 
)

This procedure changes all references of "old" in relation instance rel to "new".

this gets used in interactive merge/refinement and destruction.

Definition at line 73 of file linkinst.c.

References ASC_FREE, AssertMemory, CONSOLE_DEBUG, e_blackbox, e_glassbox, e_token, e_undefined, ModifyBlackBoxRelPointers(), ModifyGlassBoxRelPointers(), ModifyTokenRelationPointers(), NULL, PANIC_ILLEGAL_INSTANCE, RELN_INST, Instance::t, and WriteInstanceNameString().

Referenced by FixRelations().

void ChangeLogRelPointers ( struct Instance lrel,
struct Instance old,
struct Instance new 
)

This procedure changes all references of "old" in logical relation instance lrel to "new".

Definition at line 106 of file linkinst.c.

References AssertMemory, logrelation::bvars, LRELN_INST, ModifyLogRelPointers(), NULL, PANIC_ILLEGAL_INSTANCE, logrelation::satrels, and Instance::t.

void ChangeWhenPointers ( struct Instance when,
struct Instance old,
struct Instance new 
)

This procedure changes all references of "old" in when instance when to "new".

Definition at line 144 of file linkinst.c.

References AssertMemory, CmpP(), GetCaseReferences, gl_fetch, gl_length, gl_search(), len, ModifyWhenPointers(), NULL, PANIC_ILLEGAL_INSTANCE, Instance::t, and W_INST.

void ChangeParent ( struct Instance parent,
struct Instance oldchild,
struct Instance newchild 
)

Tell a parent to point to newchild instead of pointing to oldchild

Tell parent to change pointers to oldchild to pointers to newchild.

Definition at line 196 of file linkinst.c.

References AssertMemory, InstanceChild(), NumberChildren(), and StoreChildPtr().

Referenced by ReDirectParents().

void ReDirectParents ( struct Instance oldinst,
struct Instance newinst 
)

Tell to all the parent of the oldchild, to point to newchild rather than to point to oldchild.

Definition at line 209 of file linkinst.c.

References ChangeParent(), InstanceParent(), and NumberParents().

void ReDirectChildren ( struct Instance oldinst,
struct Instance newinst 
)

Look at all of the children of the instance new; if old is one of their parents, delete the parent old and add the parent new.

Definition at line 219 of file linkinst.c.

References AddParent(), DeleteParent(), InstanceChild(), NULL, NumberChildren(), and SearchForParent().

void ReorderChildrenPtrs ( struct Instance **  c,
CONST ChildListPtr  oldinst,
CONST ChildListPtr  newinst,
unsigned long int  oldlen,
unsigned long int  newlen 
)

This expands the old child pointers packed into a MODEL struct into the new list, starting at the tail of the instance and copying until blanks are needed to accomodate new children, filling those blanks with NULL, and then continuing on up toward the top of the child list which comes right after the end of the struct ModelInstance defined in the header instance_types.h

void FixCliques ( struct Instance old,
struct Instance new 
)

Substitute the old instance in a clique by the new instance. It is required after merging or refinement an instance, task which implies some instance is going to be destroyed.

Remove old from the clique put new in its place.

Definition at line 257 of file linkinst.c.

References NextCliqueMember(), and SetNextCliqueMember().

void FixRelations ( struct RealAtomInstance old,
struct RealAtomInstance new 
)

This is called to tell relations about a change in variable location e.g. If two atoms are merged, point all the relations that know about ATOM old to ATOM new.

A RealAtomInstance contains a gl_list of relations. Such a gl_list tells us in which relations this real atom appears. Basically it is a list of pointers. When merging two MODELS, for example, the atoms contained in one of the models are going to be destroyed. In such a case (and in many other involving merging and refinement) the relation using such a variable must be notified about the change. This is the goal of this function. It will vist the list of relations of a real atom instance and it will tell them to use the the "new" instance instead of the "old" instance. For an explanation about how to handle different cases, see the function FixWhens below, thinking of course in list of relations instances rather than a list of when instances.

Definition at line 272 of file linkinst.c.

References AddRelation(), AssertMemory, ChangeRelationPointers(), gl_destroy(), INST, len, NULL, RealAtomInstance::relations, RelationsCount(), and RelationsForAtom().

void FixLogRelations ( struct Instance old,
struct Instance new 
)

This is called to tell logrelations about a change in the location of a variable or a relation referenced in the logrelation. For example:

A BOOLEAN_ATOM_INST contains a gl_list of logrelations. Such a gl_list tells us in which logrelations this boolean atom appears. Basically it is a list of pointers. When merging two MODELS, for example, the atoms contained in one of the models are going to be destroyed. In such a case (and in many other involving merging and refinement) the logrelation using such a variable must be notified about the change. This is the goal of this function. Similar situation applies for REL_INST and LREL_INST.

It will vist the list of logrelations of the instance and it will tell them to use the the "new" instance instead of the "old" instance.

For an explanation about how to handle different cases, see the function FixWhens below, thinking of course in list of logrelations instances rather than a list of when instances.

Definition at line 325 of file linkinst.c.

References AssertMemory, BA_INST, gl_destroy(), LRELN_INST, NULL, PANIC_ILLEGAL_INSTANCE, RELN_INST, and Instance::t.

void FixWhens ( struct Instance old,
struct Instance new 
)

A WHEN instance contains a list of variables and a list of CASEs. Also, each CASE contains a list of model and relation instances to be used if such a CASE applies. In the list of variables, instances allowed are

  • BOOLEAN_ATOM_INST,
  • INTEGER_ATOM_INST,
  • SYMBOL_ATOM_INST,
  • BOOLEAN_CONSTANT_INST,
  • INTEGER_CONSTANT_INST, and
  • SYMBOL_CONSTANT_INST.

In the list of instances of each CASE, we allow

  • MODEL_INST,
  • REL_INST,
  • LREL_INST,
  • WHEN_INST.

For purposes of Merging and refining, an instance must know if it appears in some of the lists of instances of a WHEN instance. That is, all the instances listed above contain a when field, which is a gl_list. This gl_list tells us which and how many WHEN statements use the instance.

So, in the process of merging two instances , for example, we keep only one of the instances (the most refined) and destroy the other. If the instance that we are going to destroy is used in some WHEN statement, then we should tell those WHEN about the change. That is what this function does. It takes two instance structures as argument, old and new. Then,

  1. It goes through the list of whens of the NEW instance and tells the WHENs contained in such a list that they must point to the instance new instead of the instance old.
  2. Actually there are some modifications to the previous case. The function can also go through the list of whens of the OLD instance and tell the WHENs contained in such a list that they must point to the instance new instead of the instance old.

So, which list of when we are going to visit depends in what we want. What is always the same however, is the fact that the WHEN has to point the instance new rather than the instance old at the end of the process, since the instance old is, in general, going to be destroyed.

The following cases were anticipated:

  1. If the list of whens of the instance new is NULL, this list will be set equal to the list of whens of the old instance and then the list of whens of the instance new should be visited. This may happen when we are refining ( booleans, integer, symbols or relations, but not models)
  1. If the list of when of new and old is the same, it does not matter which list of when we have to visit, we visit the list of whens of the new instance. This may happen when we are merging instances of the same type.
  1. If the list of whens of the new instance is not null and is different to the list of whens of the old instance, we will visit the list of whens of the old instance, perform the change of the pointers (new instead of old), and then enlarge the list of whens of the new instance with the WHENs of the old instance. Example
    	old->whens contains   when1, when2  (also when1 and when2 point to old)
    	new->whens contains   when3, when4  (also when3 and when4 point to new)
	old is going to be destroyed, it is going to be subtituted by new.
	Then, changing pointers
	when1 and when2 will point to  new
	Therefore, new must know that when1 and when2 point to it now
	new->whens  will contain  when1,when2,when3,when4
	This may happen when we are merging two instances, one more
	refined than another. Remeber again, old is going to be destroyed.
	

Definition at line 397 of file linkinst.c.

References AssertMemory, BA_INST, BC_INST, gl_destroy(), IA_INST, IC_INST, LRELN_INST, MOD_INST, NULL, PANIC_ILLEGAL_INSTANCE, RELN_INST, SYMA_INST, SYMC_INST, Instance::t, and W_INST.

void FixWhensForRefinement ( struct Instance old,
struct Instance new 
)

This function is almost equal to the previous function, the difference is that it is specific for the refinement of a MODEL. In such a case, the instance new is the result of a reallocation of memory of the instance old. Therefore, the list of whens of the old instance is NULL, and the list of WHEN of the new instance is not NULL. This would fall in case 3 of the previous function, which involves visiting the list of whens of the old instance (which is NULL).That is precisely the reason for which we wrote this other function, we want to visit the list of whens of the new instance instead.

Definition at line 545 of file linkinst.c.

References AssertMemory, BA_INST, BC_INST, IA_INST, IC_INST, LRELN_INST, MOD_INST, NULL, PANIC_ILLEGAL_INSTANCE, RELN_INST, SYMA_INST, SYMC_INST, and W_INST.

ASC_DLLSPEC enum Expr_enum GetInstanceRelationType ( CONST struct Instance i  ) 

This returns the type of the relation associated with this relations instance (REL_INST). This should be one of e_token, e_opcode, e_glassbox or e_blackbox.

Definition at line 76 of file mathinst.c.

References AssertMemory, PANIC_INCORRECT_TYPE, and RELN_INST.

Referenced by DestroyRelation(), RelationSetBinTokens(), and SaveReln2GlassBox().

ASC_DLLSPEC CONST struct relation* GetInstanceRelationOnly ( CONST struct Instance i  )  [read]

This returns the guts of a relation instance (REL_INST). These should be treated as read only usually because you don't know who is sharing those guts.

Definition at line 86 of file mathinst.c.

References AssertMemory, PANIC_INCORRECT_TYPE, and RELN_INST.

Referenced by CollectTokenRelationsWithUniqueBINlessShares(), GetInstanceOperands(), InstanceEvaluateSatisfiedName(), LogTermSatisfied(), rel_equal(), rel_greater(), rel_less(), rel_multiplier(), rel_nominal(), rel_relop(), rel_residual(), rel_set_multiplier(), rel_set_nominal(), rel_set_residual(), and RelationSetBinTokens().

ASC_DLLSPEC CONST struct relation* GetInstanceRelation ( CONST struct Instance i,
enum Expr_enum type 
) [read]
struct relation* GetInstanceRelToModify ( struct Instance i,
enum Expr_enum type 
) [read]

This returns the value of a relation inst(REL_INST). In this function we do not get a CONST structure and therefore we can modify it. This is useful while marking conditional relations.

Definition at line 108 of file mathinst.c.

References AssertMemory, PANIC_INCORRECT_TYPE, RELN_INST, and Instance::t.

void SetInstanceRelation ( struct Instance i,
struct relation rel,
enum Expr_enum  type 
)

Set the relation to rel. rel will be incorporated into the instance, so rel should not be modified or destroyed. The type of the relation has* to be provided.

rel and type may be the NULL/e_undefined combination.

This is a tricky function. If we are attempting to set a new relation, and if the i->ptr is not NULL, i.e. a relation structure was already assigned, we must *not* force the assignment, and destroy the old relation. Unfortunately at this stage, we would have to back up todo undo the AddRelations etc. So we punt.

Definition at line 293 of file mathinst.c.

References Asc_Panic, AssertMemory, NULL, PANIC_INCORRECT_TYPE, RELN_INST, and Instance::t.

Referenced by ExecuteBBOXElement().

ASC_DLLSPEC CONST struct logrelation* GetInstanceLogRelOnly ( CONST struct Instance i  )  [read]

This returns the guts of a logical relation instance (LREL_INST). These should be treated as read only usually because you don't know who is sharing those guts.

Definition at line 144 of file mathinst.c.

References AssertMemory, InstanceKind, LRELN_INST, and PANIC_INCORRECT_TYPE.

Referenced by logrel_equal(), logrel_nominal(), logrel_not_equal(), logrel_relop(), logrel_residual(), and logrel_set_residual().

ASC_DLLSPEC CONST struct logrelation* GetInstanceLogRel ( CONST struct Instance i  )  [read]

This returns the value of a logrelation inst(LREL_INST).

Definition at line 122 of file mathinst.c.

References AssertMemory, LRELN_INST, and PANIC_INCORRECT_TYPE.

Referenced by CopyLogRelByReference(), CopyLogRelToModify(), FindTolInSatTermOfLogRel(),