Jump to content

  • Log In with Google      Sign In   
  • Create Account


Jason Goepel

Member Since 15 May 2013
Offline Last Active Today, 07:06 AM

Posts I've Made

In Topic: Version changes on 16bit string structures?

14 August 2014 - 05:16 AM

I'm not sure how to address your issue.  I have the most current version of AngelScript (revision 1988), and I don't experience any trouble with my 16-bit string literals.

 

I specify the 16-bit encoding:

engine->SetEngineProperty(asEP_STRING_ENCODING, 1);

I use MFC's CString class as my string class, and I register the string factory as follows:

CString StringFactory(asUINT length, const wchar_t* s)
{
    return CString(s, (int)(length/2));
}

r = engine->RegisterStringFactory("String", asFUNCTIONPR(StringFactory, (asUINT, const wchar_t*), CString), asCALL_CDECL);

In Topic: Template Specialization Subtypes

19 May 2014 - 06:06 AM

Is there a reason you did change asCObjectType::GetSubType as well?


In Topic: Global Variable Redeclaration

12 May 2014 - 02:50 PM

I'm sorry, I mean global variables declared from the script.  I find that in any script two global variable declarations compile with no errors.

double x;
double x;
void test() {

}

It doesn't look like there is any test for duplicate names in asCCompiler::CompileGlobalVariable.

 

as_compiler.cpp(1196):

asSExprContext compiledCtx(engine);
bool preCompiled = false;
if( gvar->datatype.IsAuto() )
	preCompiled = CompileAutoType(gvar->datatype, compiledCtx, node, gvar->declaredAtNode);
if( gvar->property == 0 )
{
	gvar->property = builder->module->AllocateGlobalProperty(gvar->name.AddressOf(), gvar->datatype, gvar->ns);
	gvar->index = gvar->property->id;
}

as_module.cpp(1175):

asCGlobalProperty *asCModule::AllocateGlobalProperty(const char *name, const asCDataType &dt, asSNameSpace *ns)
{
	asCGlobalProperty *prop = engine->AllocateGlobalProperty();
	prop->name = name;
	prop->nameSpace = ns;

	// Allocate the memory for this property based on its type
	prop->type = dt;
	prop->AllocateMemory();

	// Make an entry in the address to variable map
	engine->varAddressMap.Insert(prop->GetAddressOfValue(), prop);

	// Store the variable in the module scope (the reference count is already set to 1)
	scriptGlobals.Put(prop);

	return prop;
}

In Topic: GetObjectType for Instances of Templates

30 April 2014 - 11:38 AM

You are correct.  I didn't have the latest WIP version.  I should have been more careful about checking for that.  Thanks!


In Topic: GetObjectType for Instances of Templates

30 April 2014 - 08:35 AM

GetObjectTypeByDecl is not exposed... but it does look like I can get it with a combination of GetObjectTypeById and GetTypeIdByDecl.

 

:-)


PARTNERS