Jump to content

  • Log In with Google      Sign In   
  • Create Account


brightening-eyes

Member Since 20 Oct 2013
Offline Last Active Jul 19 2014 05:54 PM
-----

Topics I've Started

how can i parse Script functions, variables, etc

14 June 2014 - 11:49 AM

hi all,

i'm developing a compiler for AngelScript using LLVM frontend

i have some questions:

how can i know what is the current line, it is a function? it is a variable, an expression, a statement, ETC!

and how can i know how many parameters does my function have, in order for LLVM to parse?

how can i know what is the return type?

how can i know the types of parameters?

how can i get a pointer to the script functions and objects?

thanks in advance


how can i compile a script to an executable?

17 May 2014 - 11:11 AM

hi everyone, i'm developping a game engine for visually impaired users (firstly myself) i haven't any problem dirring the registration of the script functions and classes! now when i want to compile the script, i dont know how can i say to my engine to load main() and compile it firstly and set it as the entrypoint! and run it? this is my run and compile functions:
void run(const char* script)
{
CScriptBuilder builder;
int r;
r=builder.StartNewModule(engine, "build");
if(rWriteMessage(script, 0, 0, asMSGTYPE_ERROR, "can't run the script");
}
r=builder.AddSectionFromFile(script);
if(rWriteMessage(script, 0, 0, asMSGTYPE_ERROR, "the file can not be loaded");
return ;
}
asIScriptFunction *mainfunc=engine->GetModule("build", asGM_ONLY_IF_EXISTS)->GetFunctionByDecl("void main()");
asIScriptContext *ctx=engine->CreateContext();
if(mainfunc==nullptr)
{
engine->WriteMessage(script, 0, 0, asMSGTYPE_ERROR, "the function void main() has not been declared");
return ;
}
ctx->Prepare(mainfunc);
ctx->Execute();
}

void compile(const char *script, const char *output, bool debug)
{
	engine->SetEngineProperty(asEP_INIT_GLOBAL_VARS_AFTER_BUILD, false);
CScriptBuilder builder;
int r;
r=builder.StartNewModule(engine, "build");
if(rWriteMessage(script, 0, 0, asMSGTYPE_ERROR, "can't compile the script");
}
r=builder.AddSectionFromFile(script);
if(rWriteMessage(script, 0, 0, asMSGTYPE_ERROR, "the file can not be loaded");
return ;
}
r=builder.BuildModule();
if(rGetModule("build", asGM_ONLY_IF_EXISTS);
compilerstream comp;
r=comp.open(output);
if(rWriteMessage(output, 0, 0, asMSGTYPE_ERROR, "the file can not be loaded for compilation");
return ;
}
compiler->finalizePages();
mod->SaveByteCode(&comp, !debug);
}
the problem is, i dont know how to load main() and set it as my executables main function! my mean is, when user run the executable, the game runs and executes main() and this happens when user runs the script from the engine! what should i do? thanks so much!

the compiler doesn't compile the script

29 November 2013 - 04:08 AM

hi

i'm making a game engine and i want to test my compiler

previously, it crashed

but with getting help, i fixed it

now, when i want to compile my script, it load's the file, and don't write's to it

the run function also crashed

now when i'm trying to run my application, it doesn't show anything

also when i'm trying to compile my application, it load's the file and it doesn't write to it

i've uploaded the code here

Attached File  AGC.zip   427.48KB   15 downloads

thanks in advance


a question about SFML and ogre

24 November 2013 - 01:10 PM

hi, i started to make game with SFML because it is easy to use and ogre because it is very good for 3D now a question is in my mind: can i use SFML and ogre together? for example, create a window from SFML and draw with ogre is it possible to do this? i didn't try this thanks in advance

function registration is very very slow

24 October 2013 - 02:37 AM

i'm trying to make a game engine using AngelScript when i registered some of my functions, and tryed to testit, it show's a console window and nothing happens for a while what i have to do? this is the engine's source code:

http://amir-ramezani.3owl.com/AGC.zip

what i've done incorrectly?

what is the problem?

these are some of my functions that i've registered

i want to work on Artificial intelligence, 3d renderring and many many functions

if it wants to be slow, it can't be successfull

i want to make it very fast

thanks in advance


PARTNERS