#ifndef GLOBALS_C
#define GLOBALS

#define VERSION_NUMBER			0x00010101			// version number

#define COLLECT_AND_RENUMBER_EXTERNAL_TYPE_REFERENCES	// collects all external types AND numbers them 

#define GDI
#ifdef GDI
	// eax	= graph_i (Int)
	// edx  = descP (String)
	// ecx	= gdi
	
/*
**	:: GlobalDynamicInfo = {
**		,	graph			:: !String
**			file_name		:: !String
**		}
*/	
//#define GDI_FILE_NAME		4
#define GDI_GRAPH			4 //8	
	
#define gdi					%ecx			// GDI ptr

#endif // GDI

 
#define STACK_CHECKS



#define COLOUR_GRAPH
#define EXTEND_DESCRIPTOR_USAGE_TABLE	// use only with colour graph


// REMOVE

//#define TEST_COLOUR_GRAPH

//#define ARRAY_DESCP

/*
	
	Changes:
	
	1) gts_delete.c; restore indirection and entry nodeP is stored in the EN-table.
	2) intermediate descriptor table has a pointer for each descriptor to its usage
*/
#ifdef COLOUR_GRAPH
#ifdef DYNAMIC_BLOCK
#error "DYNAMIC_BLOCK and COLOUR_GRAPH cannot be used together"
#endif
#endif // 

/*
	doel:
	to_string:
	- block en hun entry knopen vastleggen
	- indirecties herstellen
	- extend descriptor prefix table
	
	from_string:
	- decoding it
	
	1. nested dynamics
		- copying dynamics (doen; heeft ook te maken met versie management)
		<- garbage collection and dynamics>
	
	< 2. data dynamics
		- hyper strict evaluation of graph
		- new syntax plus checks for frontend>
	
	3. type correctness of dynamics
		- external type is specification
		
	4. version management 
	
	// compile time
	5. frontend problems
		- overloading (small)
		- polymorphy (representatie van types) (small)
		- uniquness (huge project) (run-time interessant)
		
	6. Bugs

	Doel: type correct dynamics and nested dynamics

	7. Optimizations
		- Clean compiler frontend; sharing of type information
		- graph_to_string: sharing in SN-nodes
		- 
		
	8. Network dynamics
		- ABC libraries
		- MAC port
		
	The copy_graph_to_string algorithm:
	
	pass 1: colouring the graph
	
	pass 2: copying graph & creating descriptor usage sets
	
	pass 3: delete indirections and SN/EN-nodes & copying label/module names
	
	pass 4: adjusting encoded descriptors

*/


#ifdef __COMMENTAAR
#error "kan weg"
	
		
	// more globally ...
	cmpl	$0,free
	jle		garbage_collection2
	
#define temp nodeP
	movl	stackTop,temp
	subl	descStackTop,temp
	shrl	$1,temp
	
	subl	temp,free
	js		garbage_collection
#undef temp

	movl	heapP,descriptor_address_table_base	// to be removed (?)
	// ... more globally	
	
	
	
	

	ret

	// To be done:	
	// - initialize descriptor prefix table
	//	 but *only* the by that block required descriptors
	
	// - undo EN-nodes in graph


	// Two tasks:
	// 1. modify each EN-entry to point to its entry node which has been stored in the
	//    ColourTable. It can be reached by the colour number computed by the first
	//    pass.
	// 2. 
	


//
// The following should be handled correctly:
// - memory allocation for the descriptor prefix table; size is most probably known.
// - in case of garbage collection mode; jump to garbage_collection2; code below for checking
/*
	cmpl	$0,free							// free >= 0
	jg		prepare_to_return

garbage_collection2:	

*/



#endif


#endif