extern struct Specifier * MkSpecifierName(const char * name);
+extern char * strcpy(char * , const char * );
+
extern void PrintType(struct Type * type, char * string, unsigned int printName, unsigned int fullName);
extern struct TypeName * MkTypeName(struct __ecereNameSpace__ecere__sys__OldList * qualifiers, struct Declarator * declarator);
}
else
{
+if(returnType->passAsTemplate)
+strcpy(string, "uint64");
+else
PrintType(returnType, string, returnType->kind == 18 ? 1 : 0, 1);
decl = SpecDeclFromString(string, specs, MkDeclaratorIdentifier(MkIdentifier("__ecereReturnVal")));
}
}
}
-extern char * strcpy(char * , const char * );
-
static void OutputDeclaration(struct Declaration * decl, struct __ecereNameSpace__ecere__com__Instance * f)
{
struct Specifier * spec;
extern struct __ecereNameSpace__ecere__com__Instance * GetPrivateModule(void);
+extern unsigned int memoryGuard;
+
void ComputeDataTypes()
{
struct External * external;
DeclareFunctionUtil("eInstance_StopWatching");
DeclareFunctionUtil("eInstance_Watch");
DeclareFunctionUtil("eInstance_FireWatchers");
+if(memoryGuard)
+{
+DeclareFunctionUtil("MemoryGuard_PushLoc");
+DeclareFunctionUtil("MemoryGuard_PopLoc");
+}
DeclareStruct("ecere::com::Class", 0);
DeclareStruct("ecere::com::Instance", 0);
DeclareStruct("ecere::com::Property", 0);
else
{
// Printing 'name' as a hack when we're dealing with typedefs with extended attributes
- PrintType /*NoConst*/(returnType, string, returnType.kind == dummyType ? true : false, true);
+ if(returnType.passAsTemplate)
+ strcpy(string, "uint64");
+ else
+ PrintType /*NoConst*/(returnType, string, returnType.kind == dummyType ? true : false, true);
decl = SpecDeclFromString(string, specs, MkDeclaratorIdentifier(MkIdentifier("__ecereReturnVal")));
}
DeclareFunctionUtil("eInstance_StopWatching");
DeclareFunctionUtil("eInstance_Watch");
DeclareFunctionUtil("eInstance_FireWatchers");
+ if(memoryGuard)
+ {
+ DeclareFunctionUtil("MemoryGuard_PushLoc");
+ DeclareFunctionUtil("MemoryGuard_PopLoc");
+ }
DeclareStruct("ecere::com::Class", false);
DeclareStruct("ecere::com::Instance", false);
#ifdef MEMINFO
import "Thread"
static define MAX_MEMORY_LOC = 40;
+static define MAX_STACK_FRAMES = 1000;
static class MemStack : BTNode
{
- const char * frames[1000];
+ const char * frames[MAX_STACK_FRAMES];
int pos;
bool recurse;
};
stack.key = GetCurrentThreadID();
memStacks.Add(stack);
}
- if(stack.pos < 1000)
+ if(stack.pos < MAX_STACK_FRAMES)
stack.frames[stack.pos++] = loc;
- else
- printf("");
memMutex.Release();
#endif
}
{
stack.pos--;
}
- else
- printf("");
memMutex.Release();
#endif
}
bool freed;
const char * _class;
uint id;
- const char * allocLoc[MAX_MEMORY_LOC];
- const char * freeLoc[MAX_MEMORY_LOC];
+ char * allocLoc[MAX_MEMORY_LOC];
+ char * freeLoc[MAX_MEMORY_LOC];
bool internal;
void OutputStacks(bool showFree)
bool recurse = false;
static int blockID;
//Class allocateClass;
-const char * allocateClass;
+char * allocateClass;
bool allocateInternal;
#endif
static uint TOTAL_MEM = 0;
+#ifndef MEMINFO
static uint OUTSIDE_MEM = 0;
+#endif
#if !defined(ECERE_BOOTSTRAP)
static Mutex memMutex { };
}
};
+#ifndef MEMINFO
static BlockPool * pools; //[NUM_POOLS];
/*static uint PosFibonacci(uint number)
}
}
*/
+
static uint log1_5i(uint number)
{
uint pos;
}
return (uint)current;
}
+#endif
// -- Math Helpers ---
public uint log2i(uint number)
return 1<<log2i(number);
}
+#ifndef MEMINFO
static bool memoryInitialized = false;
static void InitMemory()
{
pools[c].Expand(Max(1, expansion));
}
}
+#endif
+#ifndef MEMINFO
static void * _mymalloc(unsigned int size)
{
MemBlock block = null;
return pointer;
}
+
static void _myfree(void * pointer)
{
if(pointer)
}
return newPointer;
}
+#endif
#ifndef MEMINFO
#undef realloc
}
}
- while(block = (MemInfo)memBlocks.root)
+ while((block = (MemInfo)memBlocks.root))
{
byte * address;
int c;
printf("Memory Check Completed.\n");
#if defined(__WIN32__) && !defined(ECERE_BOOTSTRAP)
if(memoryErrorsCount)
- getch();
+ system("pause");
#endif
#endif
}