Command lines arguments with Debug
issueid=347 07-03-2012 17:22
Junior Member
Number of reported issues by MBuckingham: 2
Command lines arguments with Debug
Debug does not handle handle scripts command line arguments

I am trying to use Debug with console scripts. Many of the scripts I write have arguments passed to them on the command line. I know that running a console script from within ThinAir changes the arguments but my scripts can handle that OK. However Debug seems to remove the arguments altogether.

I wrote a test script which printed out its arguments and then ran it from ThinAir with the single argument 5 . The result was:-

[@l "C:\OpenNMR\!!commands\basic\size.tbasicc" 5]
[@l]
["C:\OpenNMR\!!commands\basic\size.tbasicc"]
[5]

When using Debug the output was:-

[@d "C:\OpenNMR\!!commands\basic\size.tbasicc"]
[@d]
["C:\OpenNMR\!!commands\basic\size.tbasicc"]

I hope this is enough information.

Thanks,
Malcolm
Issue Details
Issue Number 347
Project thinDebug
Category Unknown
Status Unconfirmed
Priority 5 - Medium
Affected Version Unknown
Fixed Version (none)
Users able to reproduce bug 0
Users unable to reproduce bug 0
Assigned Users (none)
Tags (none)




07-03-2012 22:25
Super Moderator
Hi Malcolm,

thanks for the report, I can reproduce the issue here.

There is little hint for the meantime, if you use command line, you can execute the script like this (@D triggers debug mode):
thinBasic.exe @D <YourScript> <YourParametersHere>

When launched from ThinAIR, it seems the Script/Command line items get's accidentaly ignored.
I attach code demonstrating the problem:
'[!] Use Script/Command line to specify 1 or more parameters, they will not be visible when debugging from ThinAIR

Uses "OS", "Console"

Long i 
For i = 1 To OS_GetCommands
  PrintL i, OS_GetCommand(i)  
Next
WaitKey

Petr

12-03-2012 10:44
Junior Member
Petr

Thanks for replying and being able to confirm the issue.

Also thanks for the @D information. Unfortunately I don't think it's going to help in my case. The software I've written acquires and processes scientific data. The core of the software is written in Free Pascal and ThinBasic is used as a scripting language. The core software maintains the raw data in shared memory and ThinBasic can access the data through DLL calls. All this works extremely well and allows end users to extend the software by writing small Thin Basic scripts. The core Free Pascal software calls these scripts and passes arguments to them via the command line. Note that the scripts are NOT called from a Windows command prompt.

The problem is when trying to debug the scripts. The good news is that because of the way that the shared memory works you can run ThinAir in parallel to the core software and then execute the script. You can even single step through the script and debug it. The bad news is that at the moment you have to modify the script code to "hard-wire" the command line values while you are debugging using ThinAir.

Overall I think this mixture of compiler and interpreter is a great way to work; you can add to the software without recompiling and linking. All you have to do is store a text file ( the ThinBasic script ) on disk and the new extended version of software is ready to run. You can even do this while the core software is running. You can allow users to extend and modify the software without them being able to break it because all the really scary stuff like memory mapped files, mutexes and multi-tasking are hidden away in DLLs which they can not modify.

Once again thanks for your help and I look forward to a release of ThinAir with the bug removed.
Malcolm



Quote Originally Posted by Petr Schreiber
Hi Malcolm,

thanks for the report, I can reproduce the issue here.

There is little hint for the meantime, if you use command line, you can execute the script like this (@D triggers debug mode):
thinBasic.exe @D <YourScript> <YourParametersHere>

When launched from ThinAIR, it seems the Script/Command line items get's accidentaly ignored.


Petr

13-03-2012 09:38
Super Moderator
Thanks for the information,

I also use ThinBASIC at work in similar fashion - the no need to compile anything is really nice feature in many situations.
I am sure Eros will look into the issue!


Petr

+ Reply