• Print

Author Topic: qb64 on the command line  (Read 134 times)

bobtheunplayer

  • Jr. Member
  • **
  • Posts: 70
  • I'd rather be coding.
    • Email
qb64 on the command line
« on: April 04, 2013, 03:17:25 AM »
I think this is the right place to post.  Not sure if I should reach out to Galleon or not on the Developer Q/A threads.

I want to use qb64 on the CLI.  For example write a program and compile it on the CLI and run it from the CLI much like you can with C.
For example:
# cc -o myprog myprog.c

Reading this you must think I'm insane, but I work for a server hosting company and I am tired of writing programs in C.  Sure I could use Perl, BASH, or Python, but I need to protect the integrity of the code, so those interpreted languages are out.  Linux servers generally do not have the GUI installed, and qb64 always makes Windows when executing a program.  I'm a fan of qb64 and would love to be able to use it for this purpose.

I checked the Tutorials and did a search of the forum, can't seem to find any information on this topic, so I'm asking here.

Thanks,
~b


mcalkins

  • Hero Member
  • *****
  • Posts: 1269
    • qbasicmichael.com
    • Email
Re: qb64 on the command line
« Reply #1 on: April 04, 2013, 03:51:23 AM »
Try the -x switch:

qb64 -x prog.bas

I'm not a Linux guy, so I don't know if that would require X11 or not.

Regards,
Michael

P.S. QB64 does not optimize by default. So it might be less difficult to try to decompile the executables. I'm not sure if that is a concern for you. You can enable optimization by modifying the makeline. You might selectively disable certain optimizations if you are worried about undefined behavior.
The QBASIC Forum Community: http://www.network54.com/index/10167 Includes off-topic subforums.
QB64 Off-topic subforum: http://qb64offtopic.freeforums.org/

LINUXQB64gltester

  • Full Member
  • ***
  • Posts: 240
    • Anyone that likes Art
Re: qb64 on the command line
« Reply #2 on: April 04, 2013, 05:03:11 AM »
 There was also some discussion on this here:
http://www.qb64.net/forum/index.php?topic=10736.msg89844#msg89844
 
For off topic discussions :
Non-QB64 Related Discussion Forum
Also
My Experimenting Forum
"QB64 has a great future!"

bobtheunplayer

  • Jr. Member
  • **
  • Posts: 70
  • I'd rather be coding.
    • Email
Re: qb64 on the command line
« Reply #3 on: April 04, 2013, 05:09:29 AM »
Thanks mcalkins, I'll have to try that.  Optimizations aren't important, I'm only making a few admin tools that will run on occasion, and I don't want the code tampered with.

I search for "Command line" can't believe that page didn't show up, thanks for pointing it out LINUXQB64gltester.

DSMan195276

  • Hero Member
  • *****
  • Posts: 1978
  • Yes
    • Email
Re: qb64 on the command line
« Reply #4 on: April 04, 2013, 05:18:37 AM »
As Michael said, using the "-x" switch to the QB64 compiler shouldn't require X11, however that's only if you're using the latest QB64-GL (Which I don't think is available in even the repo yet). See Galleon's post here. The only real issue for getting QB64 to work without a X-server available is making sure FreeGLUT doesn't run, and with that update we can do that (That's what I was asking him below in that topic). I just went and tested "-x" with the current QB64-GL and I get yelled at by FreeGLUT and the program doesn't run, so you'll probably run into that until that code is put into the repo and we can try it out (I'll definitely be trying it out as soon as it's put it and let you know if it runs without a X-server)

Also I'm not sure if you realize this or not, but if you want programs to run without using X-server (When it's implemented) and to only output to the console, you need to put this at the top of your program:

Code: [Select]
$SCREENHIDE
$CONSOLE
_DEST _CONSOLE

Hope that helps,

Matt
"Cast your cares on the Lord and he will sustain you; he will never let the righteous be shaken" -- Psalm 55:22
QB64 Linux Installer

mcalkins

  • Hero Member
  • *****
  • Posts: 1269
    • qbasicmichael.com
    • Email
Re: qb64 on the command line
« Reply #5 on: April 04, 2013, 07:43:46 AM »
And have:
_SOURCE _CONSOLE
also (in addition to what Matt said).

Regards,
Michael
The QBASIC Forum Community: http://www.network54.com/index/10167 Includes off-topic subforums.
QB64 Off-topic subforum: http://qb64offtopic.freeforums.org/

bobtheunplayer

  • Jr. Member
  • **
  • Posts: 70
  • I'd rather be coding.
    • Email
Re: qb64 on the command line
« Reply #6 on: April 04, 2013, 09:29:56 AM »
Thanks for all the help.  Looks to be working pretty good so far.  I'm running on my computer, not on a server, as I haven't had a real chance to test an X11 free environment. 

Code: [Select]
[bsmith@dew qb64]$ ./qb64 -x ./programs/hello.bas
QB64 COMPILER V0.978

COMPILING C++ CODE INTO EXECUTABLE...
[bsmith@dew qb64]$ ./hello
Hello world.

Press enter to continue

Code: [Select]
' file: hello.bas
' date: 4-Apr-2013
' auth: bsmith
' info: test the CLI only functionality

$SCREENHIDE
$CONSOLE
_DEST _CONSOLE
_SOURCE _CONSOLE

CLS
PRINT "Hello world."
END

DSMan195276

  • Hero Member
  • *****
  • Posts: 1978
  • Yes
    • Email
Re: qb64 on the command line
« Reply #7 on: April 04, 2013, 10:04:38 AM »
Yes, you should have noticed a blank window appear with your Hello World program, that's the correct way to do it though. That shouldn't happen with the next update of QB64-GL, so it should work on a server environment with that update. I'll be testing that to make sure so if it doesn't work in a non-X-server environment I'll see if I can make a patch for QB64 to get it working (And give it over to Galleon to put into the main QB64).

Matt
"Cast your cares on the Lord and he will sustain you; he will never let the righteous be shaken" -- Psalm 55:22
QB64 Linux Installer

  • Print