The idea of this module is to find and report groups of isomorphic instances (instances with the same Anonymous Type). We do not actually produce type definitions, or anything like them, but instead use various sorting techniques. Note that anonymous type is a dynamic quantity in the ascend language definition which allows deferred binding. This should be named something like isomorph.c, but half the compiler files start with i already. These functions are thread-safe, if the instance data structures are, as this module creates no global variables. At present, instance structures are not thread-safe unless the entire global simulations list is locked into one thread.
Ultimately the user will be returned a gl_list of AnonType pointers, where each pointer knows how many occurrences of some identical AT there are and where those occurences are. This list will become invalid if any compiler actions anywhere in the simulation universe change any of the instances in such a way that any instance is MOVED (e.g. by realloc) or modified independently of all other instances in the same anonymous type group.
The Instances are NOT left with a record of their anonymous type. Each AT has a unique index number, which is its position in the gl_list returned. There is no useful ordering of the gl_list returned. Each AT knows its formal family as a doubly linked list, and each AT has a counter, visited, that the user can do arbitrary things with. The doubly linked list is ordered in some way that is an artifact of the classification algorithm. The head and tail of the linked list are NULL.
Special cases:
They are more like atomic types. Their true 'formal type', if you like, is the statement defining them since their basic DEFINITIONS are universal. If you accept this, then you can easily see also that the 'anonymous type' (the expanded token form) of a relation is entirely dependent on the anonymous type of the relation's context. This also holds for logical relations and when structures.
So, in the collected 'anonymous types', there will be only as many AT's devoted to relations as there are formal definitions present in the system for relation (normally just 1). The AT for each formal relation definition present will have an instance list of all relations from that definition.
To find cliques of relations, just look at cliques of models. If this handling of relations is insufficient, then the statement of the relation could be used in a secondary slot of the AT. To find exact relation groups requires a two pass algorithm.
Requires include <stdio.h> include "utilities/ascConfig.h" include "general/list.h" include "compiler/instance_enum.h"
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.
Data Structures | |
| struct | AnonType |
Defines | |
| #define | ATDEBUG 0 |
| #define | INSTANCES_PER_AT 2 |
| #define | ANONEXPECTED 200 |
| #define | ANONTABLESIZE 1024 |
| #define | Asc_GetAnonType(atl, n) ((struct AnonType *)gl_fetch((atl),(n))) |
| #define | Asc_GetAnonCount(atl, n) gl_length(Asc_GetAnonType((atl),(n))->instances) |
| #define | Asc_GetAnonTypeInstance(at, c) (struct Instance *)gl_fetch((at)->instances,(c)) |
Functions | |
| Instance * | Asc_GetAnonPrototype (struct AnonType *at) |
| ASC_DLLSPEC void | Asc_DestroyAnonList (struct gl_list_t *atl) |
| ASC_DLLSPEC struct gl_list_t * | Asc_DeriveAnonList (struct Instance *root) |
| ASC_DLLSPEC void | Asc_WriteAnonList (FILE *fp, struct gl_list_t *atl, struct Instance *root, int mlists) |
1.5.1