Ejemplo n.º 1
0
void DumpGlobalSymbol(char *name)
{
    SYMBOL * sym = GetGlobalSym(name);

    if (!sym)
        return;

    DumpEnumEntry(sym);
}
Ejemplo n.º 2
0
void RebuildCpp_StartUp()
{
	SYMBOL *ep;
	FILE *out;

	RebuildEmit("\n");
	RebuildEmit("//****************************************\n");
	RebuildEmit("//          	 Startup\n");
	RebuildEmit("//****************************************\n");
	RebuildEmit("\n");

#ifdef LOG_REGISTER_STATE_CHANGES
	{
	int n;
	for(n = 0; n < 32; n++) {
		RebuildEmit("static int last_%s = 0;\n", Cpp_reg[n]);
	}


	RebuildEmit("#define LOG_REGISTER_STATE_CHANGES(reg_used)\\\n");
	for(n = 0; n < 32; n++) {
		RebuildEmit("if((regused&(1<<%d)) && (last_%s != %s)) { last_%s = %s; LOG_REGISTER(%s); }\\\n", n, Cpp_reg[n], Cpp_reg[n], Cpp_reg[n], Cpp_reg[n], Cpp_reg[n], Cpp_reg[n]);
	}
	RebuildEmit("\n");
	}
#endif

	RebuildEmit("#define ds_len  %d\n", DataIP);
	RebuildEmit("#define bs_len  %d\n", BssIP);
	RebuildEmit("#define all_len %d\n", (BssIP + DataIP));
	RebuildEmit("#define max_data %d\n\n", MaxDataIP);

//	RebuildEmit("int *mem_ds;\n");


	RebuildEmit("void cpp_main()\n");
	RebuildEmit("{\n");

	RebuildEmit("	int i0,i1,i2;\n");
	RebuildEmit("\n");

	RebuildEmit("	i0 = %i;	//mem size\n", Default_DataSize);
	RebuildEmit("	i1 = %i;		//stack size\n", Default_StackSize);
	RebuildEmit("	i2 = %i;		//heap size\n", Default_HeapSize);
	RebuildEmit("	sp = %i-16; //Init stack\n", Default_DataSize);
	RebuildEmit("\n");

	RebuildEmit("	mem_ds = CppInitReadData(\"data_section.bin\", max_data, i0);\n");

	// emit the bin file

	out = fopen("data_section.bin", "wb");
	ArrayWriteFP(&DataMemArray, out, MaxDataIP);
	fclose(out);

	ep	= GetGlobalSym(Code_EntryPoint);

	if (ep)
		CppCallFunction(ep, 1);

	RebuildEmit("\n}\n");

}