pixel Main

Forums

Wiki

Downloads

Tutorials

Walkthrough

Unreal-netiquette

Links

Submit-News

Oldunreal's hosted:
UnrealReference

Usermaps

Real-CTF

Donate for Oldunreal:

Oldunreal Donation pixel
Oldunreallogo
 
Welcome, Guest. Please Login or Register
Search the forums:
02/09/10 at 11:23:37
News:


UnrealEngine 1 PreProcessor (Read 1533 times)
Raven
Developer Team



Yog-Sothoth rulez :)

Posts: 282
UnrealEngine 1 PreProcessor
08/24/08 at 16:25:29
 
This preprocessor is inspired by the one existing in Unreal Engine 3.

Install:
Copy files in the archive to your <Udir>/system folder.

Download

http://turniej.unreal.pl/files/uenginepp.zip (~570 kb)

ReadMe

ReadMe at WIKI



It's copy of UT3 preprocessor. Currently supported directives are:

     `process - should be in the first line of .uc file. Tells preprocessor to parse file
     `include file - embade file in the currently opened .uc
     `inc_process file - embade file in the currently opened .uc and parses it
     `define variable - defines empty variable (used in `ifdef and `ifndef directives)
     `define variable=value - defines variable with specified value
     `write variable - writes defined variable
     `ifdef variable - evaluates to true if variable is defined
     `ifndef variable - evaluates to true if variable is not defined
     `else  - part of conditional statement
     `endif - ends conditional statement
     `check definition==value - evaluates to true if defined variable (definition) equals value. Used in strings, floats, integers.
     `check definition<>value - evaluates to true if defined variable (definition) does not match value. Used in strings, floats, integers.
     `check definition>value - evaluates to true if defined variable (definition) is greater then value. Used in floats, integers.
     `check definition<value - evaluates to true if defined variable (definition) is less then value. Used in floats, integers.

usage:

     utpreprocessor <project_dir>/<project_file> <modifiers>

     where:

           <project_dir> - relative project directory.
           <project_file> - file (.upc extension) conaining all options. If file is detected, no fuhrer modifiers are checked.


     modifiers:

           -clean - deletes preprocessor directives from .uc file
           -debug - turns on debug mode (prints every operation on parsed .uc file)
           -make <ini file> - runs ucc.exe with specified ini
           -h - prints help
               -global someglobal=somevalue - defines global variable

project file:


     [project]                 - project informations
     path=path                 - path to project
     debug=true                - turns on debug mode (prints every operation on parsed .uc)
     make=true                 - if true, ucc will be executed
     make_ini=ini_file.ini     - if present runs ucc.exe with specified ini
     clean=true                - if true will delete preprocessor directives
     output=folder             - override default output folder where parsed .uc files are written
     input=folder              - override default input folder where parsed .uc files are stored

     [globals]                 - group contatin global variables for whole project
     someglobal=somevalue      - global variable (sample)

example:

     [project]
     path=../MyProject/
     debug=true
     make=true
     make_ini=make.ini
     clean=true
     output=classes
     input=classes_ucp

     [globals]
     global_value1=test1
     global_value2=test2

Note that project file must have upc extension, and 'path' must be relative to uenginepp.exe location. Default location to files with preprocessor headers is:

Quote:
<project_folder>/classes_ucp


parsed .uc files will be stored in:

Quote:
<project_folder>/classes


Let's say you have project file in <UDir>/system called RUI.upc with content:

Code:
[project]
path=../RComputerUI/
debug=true
make=true
make_ini=make.ini
clean=true
output=classes
input=classes_ucp 



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:


Code:
`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 



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:

Code:
class PreProcessorTest extends Actor;

var() int test2;
var() class<actor> NewActor; 



Same output code with clean turned off:

Code:
////`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 



Of course input file can look different, but most important thing is to write `process in first line.
Back to top
 
« Last Edit: 08/27/08 at 10:50:19 by Raven »  

View Profile WWW Raven 311164304   IP Logged
DieHard SCWS
Global Moderator
*****


DìèHárdsDòG»§ÇW §

Posts: 1799
Gender: male
Re: UnrealEngine 1 PreProcessor
Reply #1 - 08/24/08 at 16:50:37
 
For posts like this, you should also include information to what it is and what it does. Theres alot of data in the post but i have absolute no clue whats it about. So please post also information to what this is Smiley


Otherwise it looks great lol Smiley
.
.
.
Back to top
 
« Last Edit: 08/24/08 at 16:51:05 by DieHard SCWS »  
View Profile   IP Logged
Raven
Developer Team



Yog-Sothoth rulez :)

Posts: 282
Re: UnrealEngine 1 PreProcessor
Reply #2 - 08/24/08 at 17:10:58
 
Well... it's preprocessor.

Quote:
In 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.


Unreal Engine 3 has preprocessor which is kinda useful in scripting. I wrote it for debugging of TCO.
Back to top
 
 

View Profile WWW Raven 311164304   IP Logged
Jâçkrâßßit
God Member
*****




Posts: 654
Gender: female
Re: UnrealEngine 1 PreProcessor
Reply #3 - 08/24/08 at 19:50:36
 
so basically you can insert "test data" to debug a script before you actually compile the .u?

I guess it would save some time so you wouldn't have to recompile a bunch to get things working correctly.. cool raven
Back to top
 
 

Call me conservative....but I'm sticking with 226b from now on. Its the only real version that I feel captures the humble center of what is Unreal.
View Profile Jâçkrâßßit   IP Logged
Chaos13
Developer Team



/dev/cobd0

Posts: 950
Gender: male
Re: UnrealEngine 1 PreProcessor
Reply #4 - 08/24/08 at 20:10:59
 
I guess not, it converts .ucp files to .uc files with usage of `... lines like #... lines (compiler directives like #ifdef #endif etc...) with replacement of ` lines with designated script code. Pretty cool and useful Roll Eyes

... Edit: Gonna go debug stuff for UT3 Grin
Back to top
 
« Last Edit: 08/24/08 at 20:14:56 by Chaos13 »  

View Profile WWW Chaos13 404275323 ikuto@rocketmail.com   IP Logged
Raven
Developer Team



Yog-Sothoth rulez :)

Posts: 282
Re: UnrealEngine 1 PreProcessor
Reply #5 - 08/24/08 at 23:18:52
 
You have to recompile the code. It generates .uc files. But it saves time if you don't want to edit code to delete some things (like logging functions).
Back to top
 
 

View Profile WWW Raven 311164304   IP Logged
Jâçkrâßßit
God Member
*****




Posts: 654
Gender: female
Re: UnrealEngine 1 PreProcessor
Reply #6 - 08/25/08 at 01:45:23
 
Raven wrote on 08/24/08 at 23:18:52:
You have to recompile the code. It generates .uc files. But it saves time if you don't want to edit code to delete some things (like logging functions).


ahhh I gotcha
Back to top
 
 

Call me conservative....but I'm sticking with 226b from now on. Its the only real version that I feel captures the humble center of what is Unreal.
View Profile Jâçkrâßßit   IP Logged
Raven
Developer Team



Yog-Sothoth rulez :)

Posts: 282
Re: UnrealEngine 1 PreProcessor
Reply #7 - 08/25/08 at 11:52:34
 
Update:

new features:
- globals can be defined in project file in special [globals] group or in commandline with special -global switch:

Code:
[globals]
global_value1=test1
global_value2=test2 

or Code:
uenginepp.exe ..\SomeScript -clean -debug -global testglobal1=test1 -global testglobal2=test2 



fixes
- if defined variable does not exists (in `write or `check), it's name will be used instead
Back to top
 
 

View Profile WWW Raven 311164304   IP Logged
Chaos13
Developer Team



/dev/cobd0

Posts: 950
Gender: male
Re: UnrealEngine 1 PreProcessor
Reply #8 - 08/25/08 at 12:40:28
 
Quote:
uenginepp.exe ..\SomeScript -clean -debug -global testglobal1=test1 -global testglobal2=test2


Ownage Grin GMode=Debug Tongue
Back to top
 
 

View Profile WWW Chaos13 404275323 ikuto@rocketmail.com   IP Logged