SRL Archive - General

What Does This Mean??/


SKy Scripter

2007-02-20 18:04:53


// if i type this "{$ somthing }" in SCAR it turns it invisable why?????

{$ bfdbfjksdbfjksdbfjksfjkbsdjkfbsdk}


bullzeye95

2007-02-20 18:33:48

It has a use in Delphi that Kaitnieks didn't put into SCAR.

SKy Scripter

2007-02-22 10:04:21

oh ok thank you

Ron

2007-02-25 15:41:40

Woah nice find. I didn't know about that. I wonder what it's supposed to do.

When I try to compile this…

program New;

begin
"{$ClearDebug;")
end.

I get a "Unknown compiler directives at 6:-20." message.

Freddy1990

2007-02-25 15:52:34

A compiler directive is a … thing, used in delphi to tell the compiler to do certain things, for example you could tell him to not compile a ertain part of code into the program if… you define for example a certain term..

I never tried this before in scar, didn't know it worked, but here's an example…
program CompilerDirectivesTest;
{$Define Hello}
begin
{$IfDef Hello}
WriteLn('Hello World');
{$Else}
WriteLn('Hello Mars');
{$EndIf}
end.
Like this it'll write hello world, comment out or remove the {$Define Hello} and it'll write hello mars


You can also reverse this, by using IfNDef, that checks if it's not defines instead of if it's defined
program CompilerDirectivesTest;
{$Define Hello}
begin
{$IfNDef Hello}
WriteLn('Hello World');
{$Else}
WriteLn('Hello Mars');
{$EndIf}
end.

Smartzkid

2007-02-25 15:59:38

Whoa! Heh you could really get people messed up with this :p sounds fun :D

Freddy1990

2007-02-25 16:10:48

Edit:
Scratch that, the include directive doesn't work properly

SKy Scripter

2007-02-26 14:36:06

thats pretty AWSOME but it's weird..

bullzeye95

2007-02-26 14:53:20

It has no use :-/

Freddy1990

2007-02-26 16:23:25

From: bullzeye95
It has no use :-/

That's where you're wrong
The uses are pretty much unlimited, a simple example…
If you for example put something in an IfDef clause while it's not defined it does not only skip that stuff, the stuff doesn't even have to be included, can be useful…
Another example…
You make a script that is supported by several includes, you can just switch to using the other include by putting a compiler directive around the stuff to determine when it should be used
There truely are loads of uses

SKy Scripter

2007-02-26 16:59:35


The uses are pretty much unlimited, a simple example…
If you for example put something in an IfDef clause while it's not defined it does not only skip that stuff, the stuff doesn't even have to be included, can be useful…
Another example…
You make a script that is supported by several includes, you can just switch to using the other include by putting a compiler directive around the stuff to determine when it should be used
There truely are loads of uses


i wish i knew as much as you
lol… all i know is SCAR, HTML, JAVA SCRIPTING =(
thanks,

botmaster

2007-02-26 17:10:57

Compiler directives in SCAR don't work. I dunno, what compiler did Kait use? I know some stuff about them. Might be of some use to reduce compilation times of SRL?

Freddy1990

2007-02-26 18:10:44

Compiler directives do work in scar, but only a very limited amount of them

bullzeye95

2007-02-26 19:07:01

From: Freddy1990
That's where you're wrong
The uses are pretty much unlimited, a simple example…
If you for example put something in an IfDef clause while it's not defined it does not only skip that stuff, the stuff doesn't even have to be included, can be useful…
Another example…
You make a script that is supported by several includes, you can just switch to using the other include by putting a compiler directive around the stuff to determine when it should be used
There truely are loads of uses


I meant in SCAR. Is that what you're talking about?

Freddy1990

2007-02-26 19:08:39

yeah
Well, I can't argue with the fact htta it has more uses in delphi, but still, there are plenty of uses for scar
(800th post yay :) )

bullzeye95

2007-02-26 19:13:11

You say if something is not included you could switch to using another one (am I right?). Well can you include something in the middle of a script? Is there anyway to do that?

Freddy1990

2007-02-27 06:45:50

From: bullzeye95
You say if something is not included you could switch to using another one (am I right?). Well can you include something in the middle of a script? Is there anyway to do that?


I don't think so…
Compiler directives are more guidelines for the compiler rather than being real booleans