UnrealEngine1 PreProcessor
UnrealEngine1 PreProcessor
This preprocessor is inspired by the one existing in Unreal Engine 3.
Install:
Copy files in the archive to your <UTdir>/system folder.
Download
http://turniej.unreal.pl/files/uenginepp.zip (~570 kb)
ReadMe
ReadMe at WIKI
Install:
Copy files in the archive to your <UTdir>/system folder.
Download
http://turniej.unreal.pl/files/uenginepp.zip (~570 kb)
ReadMe
ReadMe at WIKI
Last edited by Raven on 27 Aug 2008, 11:48, edited 4 times in total.
Madness, as you know, is like gravity…all it takes is a little push!

http://turniej.unreal.pl/portfolio

http://turniej.unreal.pl/portfolio
Unreal Engine 3 has preprocessor which is kinda useful in scripting. I wrote it for debugging of TCO. So you can define some value likeIn computer science, a preprocessor is a program that processes its input data to produce output that is used as input to another program. The output is said to be a preprocessed form of the input data, which is often used by some subsequent programs like compilers. The amount and kind of processing done depends on the nature of the preprocessor; some preprocessors are only capable of performing relatively simple textual substitutions and macro expansions, while others have the power of fully-fledged programming languages.
Code: Select all
`define _FINALRELEASE=0
Madness, as you know, is like gravity…all it takes is a little push!

http://turniej.unreal.pl/portfolio

http://turniej.unreal.pl/portfolio
Well, it looks like (surprise!) preprocessor - the tool that does some additional pre-processing to the source code before the actual compiler (ucc in this case) does it's job. It allows you to divide code into separate files, just like in c/c++, include them, create conditional code (eg. debug/release version) and so on.
BUT I might be mistaken.
Question: is -clean for piping or it butchers the input file?
EDIT: Raven already explained it...
BUT I might be mistaken.
Question: is -clean for piping or it butchers the input file?
EDIT: Raven already explained it...
UBerserker wrote:Story: totally guessed that Skeletor was the thief.
when preprocessor will find -clean argument or clean in project file, it'll produce pure UnrealScript without all other stuff. If false, all things like preprocessor directives will be commented out. Just working on one new thing.
Madness, as you know, is like gravity…all it takes is a little push!

http://turniej.unreal.pl/portfolio

http://turniej.unreal.pl/portfolio
Don't get it. So how does it work? You put something likeRaven wrote:when preprocessor will find -clean argument or clean in project file, it'll produce pure UnrealScript without all other stuff. If false, all things like preprocessor directives will be commented out.
Code: Select all
var int bodycount = 1; //is this a proper UScript? :P
'define EXTRA_GORE
'ifdef EXTRAGORE
bodycount = 1000;
'endif
So what do I need clean for?
Also, about writing the variables. What's the syntax? And, if I understand correctly it writes string representing value of the variable, right? Where is it written? Any example use?
Also, can I define variables from command line? Something like -DVARIABLE[=Value] from GCC?
UBerserker wrote:Story: totally guessed that Skeletor was the thief.
Let's say you have project file in <UTDir>/system called RUI.upc with content:
whe you'll call uenginepp.exe RUI.upc parser will process all files in classes_ucp, and generates output code in classes, which will be striped out (or not) from preprocessor directives. Let's say you have class:
You run preprocessor and:
1. `process directive is found, so preprocessor knows that this class has to be parsed
2. it sets int1 variable as 120
3. it sets int2 variable as 123
4. it sets nc variable as var() class<actor> NewActor;
5. it detects `check directive and compare int1 and int2. because int1 is smaller then int2, expression evaluates to false and all next lines are skipped and deleted
6. it detects `else directive. preprocessor stops deleting lines and searches for next directives
7. var() int test2; is not detected as directive so it's left alone
8. directive `write is detected. preprocessor searches for variable named nc and (if found) writes it in .uc file
9. directive `endif stops conditional expression
output .uc file in classes will look like:
Of course input file can look different, but most important thing is to write `process in first line.
EDIT:
Now same output code with clean turned off:
Code: Select all
[project]
path=../RComputerUI/
debug=true
make=true
make_ini=make.ini
clean=true
output=classes
input=classes_ucp
Code: Select all
`process
`define int1=120
`define int2=123
`define nc=var() class<actor> NewActor;
class PreProcessorTest extends Actor;
`check int1>int2
var() int test1;
`else
var() int test2;
`write nc
`endif
1. `process directive is found, so preprocessor knows that this class has to be parsed
2. it sets int1 variable as 120
3. it sets int2 variable as 123
4. it sets nc variable as var() class<actor> NewActor;
5. it detects `check directive and compare int1 and int2. because int1 is smaller then int2, expression evaluates to false and all next lines are skipped and deleted
6. it detects `else directive. preprocessor stops deleting lines and searches for next directives
7. var() int test2; is not detected as directive so it's left alone
8. directive `write is detected. preprocessor searches for variable named nc and (if found) writes it in .uc file
9. directive `endif stops conditional expression
output .uc file in classes will look like:
Code: Select all
class PreProcessorTest extends Actor;
var() int test2;
var() class<actor> NewActor;
EDIT:
Now same output code with clean turned off:
Code: Select all
////`process
//`define int1=120
//`define int2=123
//`define nc=var() class<actor> NewActor;
class PreProcessorTest extends Actor;
////`check int1>int2
//var() int test1;
//`else
var() int test2;
var() class<actor> NewActor; //`write nc
//`endif
Madness, as you know, is like gravity…all it takes is a little push!

http://turniej.unreal.pl/portfolio

http://turniej.unreal.pl/portfolio
Now I get it. It takes source code from folder <input>, writes files with the same names but stripped/commented out into <output> and then, if specified, compules all uc files from <output> with ucc? Brilliant!
Still, possibility of using -D or make-style labels in project files *might* speed-up debugging/developement/including-excluding features etc.

Still, possibility of using -D or make-style labels in project files *might* speed-up debugging/developement/including-excluding features etc.
UBerserker wrote:Story: totally guessed that Skeletor was the thief.
Cool idea, will add it in next release.
Madness, as you know, is like gravity…all it takes is a little push!

http://turniej.unreal.pl/portfolio

http://turniej.unreal.pl/portfolio
OK, now I'm confused.
1. I don't have utpreprocessor.exe, the package you've linked contains only uengineapp.exe, but I assume that's the same thing.
2. I created folder named 'Projects' in <utdir>\system, and placed following structure there:
test.upc is:
The directory classes_ucp contains 2 files:
globals.uc
main.uc
Test result?:
Wher did he got 4 files from? Also, no output written to projects\classes
I've tried also:
Why bodycount (uc count
) increased? Still, no files were processed (no output in classes/, the default output directory).
Also, I again don't quite understand the idea. Or do I? make.ini contains the information about where compiler (u-file name) should put the output, right? Can you post sample make.ini?
1. I don't have utpreprocessor.exe, the package you've linked contains only uengineapp.exe, but I assume that's the same thing.
2. I created folder named 'Projects' in <utdir>\system, and placed following structure there:
Code: Select all
2008-08-24 18:17 <DIR> classes
2008-08-24 18:11 <DIR> classes_ucp
2008-08-24 18:18 102 test.upc
Code: Select all
[project]
path=projects/
debug=true
make=false
clean=true
output=classes
input=classes_ucp
globals.uc
Code: Select all
'define DEBUG
Code: Select all
'process
'include globals.uc
//Don't care if it actually compiles ATM
class TestWeapon extends TournamentWeapon
{
void Test() {
var int bodycount = 10;
'ifdef DEBUG
bodycount = 100;
'else
bodycount = 15;
'endif
}
}
Code: Select all
?>uenginepp.exe projects\test.upc
------------------------------------------
UnralEngine PreProcessor
------------------------------------------
Version : 0.1.0
Build : 24.08.2008
------------------------------------------
Using project definition: projects\test.upc.
Using project directory projects/.
Debug mode: on.
Run ucc make with
------------------------------------------
------------------------------------------
4 uc files found.
0 uc files parsed.
Execution time: 0.03 seconds.
------------------------------------------
Executing: ucc.exe make
--------------------Core--------------------
--------------------Engine--------------------
--------------------Editor--------------------
--------------------UWindow--------------------
--------------------Fire--------------------
--------------------IpDrv--------------------
--------------------UWeb--------------------
--------------------UBrowser--------------------
--------------------UnrealShare--------------------
--------------------UnrealI--------------------
--------------------UMenu--------------------
--------------------IpServer--------------------
--------------------Botpack--------------------
--------------------UTServerAdmin--------------------
--------------------UTMenu--------------------
--------------------UTBrowser--------------------
Success - 0 error(s), 0 warnings
I've tried also:
Code: Select all
?>uenginepp.exe ..\system\projects -clean -debug
------------------------------------------
UnralEngine PreProcessor
------------------------------------------
Version : 0.1.0
Build : 24.08.2008
------------------------------------------
Using project directory ..\system\projects.
Debug mode: on.
------------------------------------------
------------------------------------------
5 uc files found.
0 uc files parsed.
Execution time: 0.03 seconds.

Also, I again don't quite understand the idea. Or do I? make.ini contains the information about where compiler (u-file name) should put the output, right? Can you post sample make.ini?
UBerserker wrote:Story: totally guessed that Skeletor was the thief.
It's not:
'process
but
`process. Just found bug. It returns number of all files (directories, etc), not uc files. Will be fixed in next release
. Ok, and included file is not processed. Will also fix it.
'process
but
`process. Just found bug. It returns number of all files (directories, etc), not uc files. Will be fixed in next release

Madness, as you know, is like gravity…all it takes is a little push!

http://turniej.unreal.pl/portfolio

http://turniej.unreal.pl/portfolio
Oops, my badRaven wrote:`process

Ok, so I know my answer if includes are processed

Now, the program hanged my system once - no idea why. How about logger?
Another thing: `include globals.uc fails. What should be the path? Even if it's not processed it should be included to produce non-stripped code.
One more thing: output is always empty for me, even if I remove all the tags.
Also, I've test-added `ifdef at the end, without any parameters, without closing, without anyting and the program didn't even complain.
Another.... undocumented feature -
Code: Select all
//`include xxx.uc
Oh, and, to clarify things. It's not that I complain only to complain. I'm no UScript programmer and probably never will be. But I have some background in programming and I know what do I expect from the tools I use, that's why I try to give some feedback. Please, don't be mad at me...
UBerserker wrote:Story: totally guessed that Skeletor was the thief.
Tnx for testing
. Update:
-path to included files is now relative to project path
-new directive - `inc_process was added. it includes file and parse it.

-path to included files is now relative to project path
-new directive - `inc_process was added. it includes file and parse it.
Madness, as you know, is like gravity…all it takes is a little push!

http://turniej.unreal.pl/portfolio

http://turniej.unreal.pl/portfolio