Please don't post any comments!!! Currently I don't have a data base, I'll remedy that later, but don't post any comments for a while, while I'm studying sqlite :) !
Feel free to use this JNI application that has JSlider:s in a JFrame so that some ints that a game engine might be using can be changed while the game is running. The idea is that a game engine might use some ints or something (once you have an int you can easily convert it to some other value like float or something) to decide how fast a character can run or jump or whatever. Then instead of recompiling to change these, or even change a text file, the values can be changed interactivelly. This would be good while developing the game, later, when good settings are found, these values can be hard coded by compiling them in, or something. I really don't know, I'd be glad to hear... but no comments please
When using the java tools remember to stand in the right folder so that the relative path corresponds to the package structure. For instance if a class is in package "slider" then the relative path to the class should be "slider/className".
To start the application just write
java -Djava.library.path="" slider.Test
(stand in right directory so slider.Test becomes the relative path to Test)
To compile the c source in windows write
cl -I"winheader" -LD slider_Glue.c -Feslider_Glue.dll
I'm using the winheader directory in this example for the include files located under the include directory in the jdk install directory. Locate the directory jdk installed on in your system. In order to generate slider_Glue.h use javah:
javah slider.Glue - stand in the right directory
To compile I just javac @path.txt src/*/*.java. If you want to do any of the commands from different directories then it's possible after setting some paths.
Rigth almost forgot, here's the thing.
Please don't post any comments, I don't have a data base yet. Meanwhile I'm learning sqlite :) !
So I have implemented my parser generator and used it to implement a interpreter for a little toy language. The syntax looks like this:
A procedure can be called with parameters, or the list of parameters can be empty, it's a toy language so the only type available is int. A procedure looks like this
procedure_name(int variable_name1,int variable_name2,int variable_name3 ...)
statement
A statement can have various forms:
expression ; (note the semi colon after expression)
return expression ;
int variable_name ; (declaration)
Various controll statements, while will execute the statement as long as the expression evaluates to non zero, if will execute the statement once if the expression is non zero.
while(expression) statement
for(declaration,expression,statement)statement
if(expression)statement
A block sentence, a way to put several statements in the place of one.
{ followed by a list of statements (at least one) }
An expression can have various forms, you can use the four basic arithmetic operators as well as the pre- and post- increment and decrement operators.
Assignement expression: (evaluates to the value of expression)
variable_name = expression ;
Variable expression: (evaluates to the value stored in the variable after assignement)
variable_name
procedure invocation: (evaluates to the value returned from the procedure with the return statement, see above)
procedure_name(expression1,expression2,expression3 ...)
Comparison expressions, if the comparison is true the value of the comparison expression will be 1, otherwise it will be 0.
expression1 < expression2 (true if expression1 is less than expression 2)
expression1 <= expression2
expression1 > expression2
expression1 <>= expression2
When you type a program into the window below and then click run the interpreter is going to find the procedure with the name "main" and zero arguments and display the value returned by the procedure. For instance you can copy paste this program to the text field below and then execute it:
main()
return faculty(5);
faculty(int a){
int result;
result=1;
while(a){
result=result*a;
a--;
}
return result;
}
When you run that program the result is going to be 120
I little problem I encountered is with the JTextField below..., hopefully fix it later, well let's see now, I'm typing this in a text editor, I wonder what it will look like in Fire Fox ;)
Edit: Oops, looks like I've made something wrong here, well not as much a bug as a omission. I need to correct the, what's the word when you accidentally overlooked something, but it's a feature related thing. And I'm a little pressed for time right now so I'll correct it later. It still works to copy paste the sample program and run it