This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.
Show posts Menu
struct MyPublicStruct {
import public static void MyPublicStaticFunction();
import protected static void MyPrivateStaticFunction();
};
struct MyPublicStruct2 {
import public static void MyPublicStaticFunction2();
};
static void MyPublicStruct ::MyPublicStaticFunction() {
...
}
static void MyPublicStruct ::MyPrivateStaticFunction() {
...
}
static void MyPublicStruct2::MyPublicStaticFunction2() {
MyPublicStruct.MyPublicStaticFunction();
MyPublicStruct.MyPrivateStaticFunction();
}
#define MACRO1 1
#define MACRO2 -1000
...
int tab[10];
int i=1005;
int x = tab[i+MACRO1 MACRO2];
#define FLOAT_PARAM -1000.0
struct MyStruct {
import static void MyFunction(float aNormalParam, float anOptionalParam = FLOAT_PARAM);
};
#define FLOAT_PARAM -1000
...
MyStruct.MyFunction(0.0, FLOAT_PARAM); //this raises an error
...
#define INT_MIN -2147483647
struct MyStruct {
import static void MyFunc (int value = INT_MIN);
};
//allocate the array
ADDR myArray = AGSH_DynArrays.AllocArray(100); //arbitrary size
//example of use : fill in the array with an arbitrary value
int i=0;
while (i < AGSH_DynArrays.GetArraySize(myArray) {
memory[myArray+i] = 66;
i++;
}
//show what's inside the array
AGSH_DynArrays.DisplayMemoryRaw(myArray, AGSH_DynArrays.GetArraySize(myArray));
//free the array
AGSH_DynArrays.FreeArray(myArray);
static ADDR AGSH_Allocator::searchContiguousBlock(ADDR node, ADDR contiguousToBlock) {
ADDR return_node = node;
AGSH_Console.DebugMsg(String.Format("searchContiguousBlock (%d, %d)", node, contiguousToBlock));
if (contiguousToBlock < 0) {
AGSH_Console.DebugMsg(String.Format("Cannot search block contiguous to an invalid node (@%d)", contiguousToBlock));
return INVALID_ADDR;
}
if (node == INVALID_ADDR) {
//node = INVALID_ADDR;
//do nothing; return INVALID_ADDR
AGSH_Console.DebugMsg("null"); //DEBUG
} else {
int whatSide = AGSH_Allocator.compareNodes(contiguousToBlock, node);
if (whatSide == CMP_INTERSECT) {
AGSH_Console.DebugMsg("CMP_INTERSECT"); //DEBUG
//we are probably in the case where contiguousToblock == node; search 'node's sons
return_node = AGSH_Allocator.searchContiguousBlock(AGSH_FreeNodesLifo.GetLeftSon(node), contiguousToBlock);
if (return_node == INVALID_ADDR)
return_node = AGSH_Allocator.searchContiguousBlock(AGSH_FreeNodesLifo.GetRightSon(node), contiguousToBlock);
} else if (whatSide == CMP_LEFT) {
AGSH_Console.DebugMsg("CMP_LEFT"); //DEBUG
return_node = AGSH_Allocator.searchContiguousBlock(AGSH_FreeNodesLifo.GetLeftSon(node), contiguousToBlock);
} else if (whatSide == CMP_RIGHT) {
AGSH_Console.DebugMsg("CMP_RIGHT"); //DEBUG
return_node = AGSH_Allocator.searchContiguousBlock(AGSH_FreeNodesLifo.GetRightSon(node), contiguousToBlock);
} else if (whatSide == CMP_LEFT_CONTIGUOUS_RIGHT || whatSide == CMP_RIGHT_CONTIGUOUS_LEFT) {
//block 'contiguousToBlock' is contiguous to 'node'
AGSH_Console.DebugMsg("CMP_LEFT_CONTIGUOUS_RIGHT || whatSide == CMP_RIGHT_CONTIGUOUS_LEFT"); //DEBUG
//do nothing; we return 'node'
} else {
AGSH_Console.Error(String.Format("AGSH_Allocator::searchContiguousBlock : Forbidden value : whatSide=%d", whatSide));
}
}
AGSH_Console.DebugMsg(String.Format("Return : %d", node));
return return_node;
}
}
searchContiguousBlock (688, 688)
CMP_INTERSECT
searchContiguousBlock (-1, 688)
null
Return : -1
searchContiguousBlock (-1, 688)
null
Return : -1
Return : 688
Quote from: Pumaman on Mon 06/06/2005 18:50:56
There is no fixed limit on the size of global arrays, but as scotch says they use up memory
#define MYMACRO(param) printf("this is the parameter of my macro : %d", (param) );
// MODULE 1 HEADER ///////////
struct A {
import int MyFunction();
import static int MyStaticFunction();
}
A MyA;
// MODULE 1 BODY///////////
int A::MyFunction() {
return 0;
}
static int A::MyStaticFunction() {
return 0;
}
// MODULE 2 HEADER //////////
struct B {
import int MyOtherFunction();
}
// MODULE 2 BODY ////////////////
int MyArray[10];
int B::MyOtherFunction() {
return MyArray[MyA.MyFunction()]; // CODE 1 : compiles fine
int i = A.MyStaticFunction(); // CODE 2
return MyArray[i]; // CODE 2 : compiles fine
return MyArray[A.MyStaticFunction()]; // CODE 3 : doesn't compile (unknown symbol/parse error after '[')
}
By continuing to use this site you agree to the use of cookies. Please visit this page to see exactly how we use these.
Page created in 0.143 seconds with 15 queries.