Bay Six Software Forum Index Bay Six Software
Beyond the Basics
 
 FAQFAQ   SearchSearch   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Experiment - Compiler directives

 
Post new topic   Reply to topic    Bay Six Software Forum Index -> ViviFire language
View previous topic :: View next topic  
Author Message
Brent
Site Admin


Joined: 01 Jul 2005
Posts: 797

PostPosted: Mar 23rd, 2012, 10:37pm    Post subject: Experiment - Compiler directives Reply with quote

This is another thought experiment to get feedback on the syntactic possibilities of VF.

Almost all modern languages have a means of controlling how code gets parsed at compile-time. This usually involves defining constants, testing these constants for a particular value (or just their existence), and possibly generating code or aborting a compile.

VF, so far, can parse the following directives:
  • @define constant - defines a constant
  • @if constant - compiles the following code if constant is defined
  • @elseif constant - when the preceding @if failed, tests alternative constants
  • @else - when all preceding @if and @elseif fail, compile the following
  • @endif - ends a conditional

_________________
Brent
Back to top
View user's profile Send private message Send e-mail
STPendl
Full Member


Joined: 20 Aug 2007
Posts: 161
Location: Austria

PostPosted: Mar 24th, 2012, 1:23am    Post subject: Re: Experiment - Compiler directives Reply with quote

Conditional compilation is very useful, so debugging information can be omitted for the release compilation for instance.

I like that addition.

_________________
Stefan

Any code I post can be freely used, just give credit.
Back to top
View user's profile Send private message
Brent
Site Admin


Joined: 01 Jul 2005
Posts: 797

PostPosted: Mar 29th, 2012, 6:14pm    Post subject: Re: Experiment - Compiler directives Reply with quote

My plan for now is to allow some simple logical operations: And, Or, Not.
Code:
@if Windows
' Windows-specific thing
@if Win64
' Win64-specific thing
@endif
@elseif Linux or MacOS
' *nix-specific thing
@if Linux
' Linux-specific thing
@if not Ubuntu and not Fedora
' Non-Ubuntu/Fedora-specific thing
@endif
@elseif MacOS
' MacOS-specific thing
@endif
@endif

_________________
Brent
Back to top
View user's profile Send private message Send e-mail
STPendl
Full Member


Joined: 20 Aug 2007
Posts: 161
Location: Austria

PostPosted: Mar 30th, 2012, 7:49am    Post subject: Re: Experiment - Compiler directives Reply with quote

That makes sense too, so specifying a constant for the path separator or path list delimiter would be easy.
_________________
Stefan

Any code I post can be freely used, just give credit.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Bay Six Software Forum Index -> ViviFire language All times are GMT
Page 1 of 1
Jump to:  
Quick Reply
Username:
Message:
   Shortcut keys: Alt+Q to activate, Alt+P to preview, Alt+S to submit
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum



Lo-Fi Version
Powered by phpBB © 2001, 2005 phpBB Group