Conditional Includes?

Blitz3D Forums/Blitz3D Programming/Conditional Includes?

John Blackledge(Posted 2004) [#1]
Is there any way to have 'conditional includes'?
Blitz does not seem to acknowledge:
If ProductID = 1
Include "Product1.bb"
Else
Include "Product2.bb"
Endif
- but tries to include any file on any line starting with the word 'include'.


Jeroen(Posted 2004) [#2]
yes, that could come in handy indeed.
In your case, isn't it possible to convert everything to functions in the include?


Rob Farley(Posted 2004) [#3]
No... Unless you're using Micheal Richteabisuits pre-processor.

However, what you've written there will actually work in many situations.

if product1.bb was print "product1" and product2.bb was print "product2" your code would read

if productid = 1
print "product1"
else
print "Product2"
endif


Michael Reitzenstein(Posted 2004) [#4]
No... Unless you're using Micheal Richteabisuits pre-processor.


#IfDef PRODUCT1
	Include "product1.bb"
#Else
	Include "product2.bb"
#EndIf


Lovely thing there. That Mr. Richteabiscuit is a smart guy!


John Blackledge(Posted 2004) [#5]
Sounds perfect. The example is exactly what I want.
I've downloaded it, and I'll let you know.


John Blackledge(Posted 2004) [#6]
Just a thought - if you're replacing BlitzCC.exe, what happens when they update it?


John Blackledge(Posted 2004) [#7]
Whoops. Have unzipped as specified, but I get a 'Abnormal Program Termination' message when I run Blitz3D.exe.
And yes I did unzip with folder structure intact.
Any ideas?


Michael Reitzenstein(Posted 2004) [#8]
You need the Microsoft .Net runtimes.


John Blackledge(Posted 2004) [#9]
Can you be more specific?
Thanks.


jhocking(Posted 2004) [#10]
YOU NEED THE MICROSOFT .NET RUNTIMES!

Tourists know that shouting usually helps get your message across.


jhocking(Posted 2004) [#11]
Sorry bout that, I'm in a cheeky mood (but then, I'm always in a cheeky mood.) I think this is what you want:
http://www.asp.net/download.aspx?tabindex=0&tabid=1


John Blackledge(Posted 2004) [#12]
Ha, ha. 21 megs of download on a 56k modem. I don't think so.
But thanks anyway. I just have to hope that Mark adds conditional includes somewhere along the line.


Michael Reitzenstein(Posted 2004) [#13]
Ha, ha. 21 megs of download on a 56k modem. I don't think so.

I downloaded the *SDK* version on 56k. 21 megs is nothing!


N(Posted 2004) [#14]
I'm afraid I have the .NET runtimes, but I get the same error as John. Really would've liked to have a preprocessor, too :/


Michael Reitzenstein(Posted 2004) [#15]
What IDE do you use?


N(Posted 2004) [#16]
Well, I was testing it with the Blitz IDE, have yet to try it with ConTEXT.

Ran it through ConTEXT, here's the output:


> Executing: C:\Program Files\ConTEXT\ConExec.exe "C:\Program Files\Blitz3D\bin\blitzcc.exe" -q "C:\Program Files\Blitz3D\vein\h_vein.bb"


Unhandled Exception: System.ComponentModel.Win32Exception: The system cannot find the file specified
at System.Diagnostics.Process.StartWithCreateProcess(ProcessStartInfo startInfo)
at System.Diagnostics.Process.Start()
at Resource_Request_BlitzCC.Request(String Arguments, Boolean Console_Write)
at Parameters.Decide_Parameter_Actions(Boolean Allow_Compile)
at Program_Entry.Main(String[] Arguments)
> Execution finished.



Edit: And now it works.

Don't know what happened or why it is... (I'll just blame Windows like everyone else)