View Full Version : Can thinbundle create a console exe?
Michael Hartlef
11-05-2007, 19:18
Hi folks,
in FANTOM, I output several messages during the parsing process. I used CONSOLE_WRITELINE and STDOUT. Both gave the same results regarding my problem.
The problem is, that when I call the exe, which thinBundle has created, the output won't be transfered/pushed into the stdout pipe and so can't be catched by an 3rd party editor like ConText for an example. It just allways opens a window.
So my questions is. Would there be a way for Roberto to create a CONSOLE exe, when you bundle a console script?
ErosOlmi
11-05-2007, 19:26
Mike,
if you name your script *.tBasic the Gui version of thinBasic will be executed.
If you name your script *.tBasicc the Console version of thinBasic will be executed.
thinBundle should be able to recognize it and bind the needed thinBasic version. Console version will than use STDOUT chain.
This is theory, you are the first using so I'm curious if theory will be also the practice :D
Let me know.
Eros
Michael Hartlef
11-05-2007, 19:48
Like I said. I bundled a console script but it behaves the same as a gui script.
ErosOlmi
11-05-2007, 21:48
Mike, stupid me. I didn't understand what you were doing, sorry. Ok, now I think I've got it.
At the moment what you are trying to do is not possible because there is a short circuit between bundled exe and real script execution.
When you execute a bundled exe a stub inside the exe explode all files included into it on disk. Than thinBasicc.exe (or thinBasic.exe in case of gui script) is executed passing to it the script name. STDOUT of executed script by thinBasicc.exe is not passed back to bundled exe interrupting SDTOUT pipe.
In short, if your script is fantom.tbasicc bundled into fantom.exe:
fantom.exe is executed
all files are exploded to disk
fantome.exe shell thinBasicc.exe with fantom.tbasicc (or fantom.tbasicx if obfuscated)
stdout of command shell "thinBasicc.exe fantom.tbasicc" is not passed to fantom.exe interrupting pipe
I have to talk with Roberto and see if we can find a way to pipe stdout along the chain.
Current only work around I can see is to produce an output disk file with stdout and than look at that file to get fantom compile log.
I will move this post into thinBundle requests.
Ciao
Eros
RobertoBianchi
11-05-2007, 22:19
Humm, seems quite complicate at least now!
Let me thinking on it.
Ciao,
Roberto
Michael Hartlef
12-05-2007, 10:09
Thanks guys, but don't put this on major priority. My intention for converting it is to see if thinBasic is caple of creating a decent parser and have good execution times and more to learn thinbasic better. If you can do this, then it is great. If not, then it is no problem.
I kinda feel bad if you guys allways jump on my request/ideas and then I don't use them properly after you put all the hard work into it.
ErosOlmi
12-05-2007, 10:49
Mike, do not worry. We always try to be open and have great attention on "people feeling" here.
Your indication is nice, I like it and it would be perfect to have in our arsenal even if you will never use.
Bundled exe will be more complete and professional if able to pipe stdout channel along the chain so, again, do not worry.
Meybe we will not find a way to do it but maybe yes. In any case worth to have a look and spend some brain time on it.
Ciao
Eros
RobertoBianchi
15-05-2007, 16:57
Hi Mike,
could you please check if with attached thinairb.dll file (you should extract an put it into ThinAIR's folder) broken pipes are now fixed?
Thank you very much,
Roberto
Michael Hartlef
15-05-2007, 21:30
Works like a charm. Thanks Roberto. :)
Michael Hartlef
15-05-2007, 21:33
Here is a screenshot:
RobertoBianchi
16-05-2007, 08:35
Well, I'm happy.
What is Fantom? A compiler or a translator?
Ciao,
Roberto
Petr Schreiber
16-05-2007, 10:21
Hi Roberto,
I found this (http://michaelhartlef.de/index.php?option=com_content&task=view&id=28&Itemid=35) on Mikes website.
Bye,
Petr
ErosOlmi
16-05-2007, 10:33
From the screen I can see it will be a parser/tokenizer/translator to ASM and than compiled with an ASM compiler.
Good!
Petr Schreiber
16-05-2007, 10:44
Yes,
seems like a powerful beast :)
Bye,
Petr
ErosOlmi
16-05-2007, 12:42
What Roberto made was to understand the type of bundled script, Gui or Console, and create a specific executable: Gui or Console.
In this way subsequent child process will pass each other STDOUT channel.
Previously all bundled exe were Gui applications.
Thanks a lot Roberto.
This is a great fix!
Fix will be present in next preview.
Michael Hartlef
16-05-2007, 13:33
Well, I'm happy.
What is Fantom? A compiler or a translator?
Ciao,
Roberto
Mmmh, what is FANTOM? I don't know ;D Just kiddin....
It is planned to be a BASIC language. The parser/compiler I am building takes the basic source code and translates it into a FASM compatible ASM code. If you don't know FASM, look here: http://www.flatassembler.net FASM can create executables on its own but I think I will bundle it with one of the freely available linkers, maybe the one from PellesC.
The code of FANTOM is largely based on the Let's build a compiler series of Jack Crenshaw. I have allready a running DELPHI source. Features missing are FUNCTION returns, external Function calls and all data types besides integer. It is in a very basic state. But overall it won't be any different from IBASIC PRO, OCEAN, PUREBASIC, etc etc.
Michael
RobertoBianchi
16-05-2007, 14:34
Interesting ideed, why you choose FASM instead of NASM?
Do you know which one is closest to MASM?
bye,
Roberto
Michael Hartlef
16-05-2007, 14:55
Interesting ideed, why you choose FASM instead of NASM?
Do you know which one is closest to MASM?
bye,
Roberto
I like the syntax and macro functionality of FASM a lot. But I have not enough experience to say which one is the closest to MASM as I don't know much about NASM (besides my IBP related stuff) and I don't knwo even less about MASM.
Also what I like about FASM is that it can produce 64bit code and is developed actively.
Michael Hartlef
25-05-2007, 21:23
Hi guys,
it seems with the latest release the output to stdout is gone again.
Even I copy the thinairb.dll Roberto provided inside the thinair folder.
Michael
ErosOlmi
26-05-2007, 08:54
Sorry Mike. :-[
I have to talk with Roberto and see what happened.
Michael Hartlef
26-05-2007, 08:57
NP, thnaks for looking into this.
RobertoBianchi
26-05-2007, 09:54
Ok, while I'm checking on my side.
Mike, actually I don't understand why the old thinairb.dll doesnt work!
Ciao,
Roberto
RobertoBianchi
28-05-2007, 08:40
Trouble seems due to compilation's issue.
However could you please check and confirm if with the attached DLL the bundle works fine?
Thank you very much and best regards,
Roberto
Michael Hartlef
28-05-2007, 08:52
Sorry Roberto, still no output.
RobertoBianchi
28-05-2007, 12:47
Mike,
have the script that you 'bundled' the .tbasicc extension?
Ciao,
Roberto
RobertoBianchi
30-05-2007, 09:40
Michael,
sorry but I'm not able to replicate the trouble.
I made a simple console script pipe1.tbasicc:
uses "Console"
dim i as long
for i = 1 to 10
Console_WriteLine(" Line " + str$(i))
next
If I run it with: pipe1.tbasicc >test.txt
the test.txt file contains the followings rows:
Line 1
Line 2
Line 3
Line 4
Line 5
Line 6
Line 7
Line 8
Line 9
Line 10
But I got same results with the bundled executable version of the script:
pipe1.exe >test.txt
Please see the attached file.
Ciao,
Roberto
Michael Hartlef
30-05-2007, 10:36
Hi Roberto,
sorry but i didn't find time the last to days. As soon as I can, I will check everything again.
To bad I overwrote the tb version prior to the last update.
ErosOlmi
30-05-2007, 18:33
I've tested here latest version just released and above sample.
All seems working fine as far as original script has .tbasicc estension. In this case thinBundle will create a console application and standard output chain will be integrated. If script has .tbasic extension a GUI application will be created and standard output seems broken. But this is by design.
Let us know Mike.
Ciao
Eros
Michael Hartlef
31-05-2007, 19:44
Well ofcourse, the simple test you did works when you output the console into a file, but with a program like ConTEXT, it doesn't display anything anymore.
It worked before but not anymore. At least here it doesn't.
But it doesn't matter to me. It was just a test anyway.
Cheers
Michael
RobertoBianchi
31-05-2007, 22:02
Michael,
if you have time it should be very interesting to understand what exactly has happened.
For me if console script works sending data to standard output that is redirect (by the OS) to a disk file it should work with any standard output redirection, maybe there are some others kind of impediments.
Ciao,
Roberto
Michael Hartlef
01-06-2007, 09:42
Hi Roberto,
when I find time I will look up how I do it in IndeED and post how it is done. I'm sure it is the same method like ConTEXT does.
Michael
RobertoBianchi
01-06-2007, 09:48
Ok Michael, your effort is much precious!
Thank you very much and best regards,
Roberto