Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   Call structure? (https://forums.graalonline.com/forums/showthread.php?t=78133)

projectigi 12-30-2007 12:50 PM

Call structure?
 
Hi,

is there any way to get the call structure without function profiling?
like

PHP Code:

function onCreated()
  {
  
test1();
  }

function 
test1()
  {
  
test2();
  }

function 
test2()
  {
  } 

would be onCreated=>test1=>test2

cbk1994 12-30-2007 04:19 PM

What is the call structure? aka what does it mean? Never heard the term before.

Novo 12-30-2007 05:46 PM

What I think about that is using a global variable...

PHP Code:

function thing()
{
  
stack.add"thing" );
  
test1();
  
stack.deletestack.size() - );
}

function 
test1()
{
  
stack.add"test1" );
  
test2();
  
stack.deletestack.size() - );
}

function 
test2()
{
  
stack.add"test2" );
  echo( 
stack );
  
stack.deletestack.size() - );


I do believe that temp.name returns the name of the function... But I can't verify this right now... But if you'll be using this, I would recommend you try it out.

What you want, however, isn't currently available in Graal, nor do I believe that it will be.

Inverness 12-31-2007 04:47 PM

Quote:

Originally Posted by cbkbud (Post 1366826)
What is the call structure? aka what does it mean? Never heard the term before.

Basically you're finding out what functions are called and the order they're called in.

cbk1994 12-31-2007 05:48 PM

Quote:

Originally Posted by Inverness (Post 1367125)
Basically you're finding out what functions are called and the order they're called in.

So, you could get the same result by calling something like

PHP Code:

function storeFunction)
{
  
this.functionsCalled.add);


and then at the end you would have the same result?

EDIT: I realize this isn't what you're asking, I'm just trying to understand this.

Skyld 12-31-2007 05:54 PM

Quote:

Originally Posted by cbkbud (Post 1366826)
What is the call structure? aka what does it mean? Never heard the term before.

It is probably more accurately named "call stack access"; typically call stacks are used internally in a lot of languages so that a function knows where to send it's return value, however call stack access also means that the programmer can read the order of executed functions (and also sometimes identify where the function was called from).

It's something that Stefan has thought about adding into GScript but hasn't got to yet; it would greatly improve script security if functions could tell where they were being called from.

Admins 01-02-2008 12:24 PM

Yes will try to work on that soon.


All times are GMT +2. The time now is 04:10 AM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.