command line options
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, LCMark
-
- VIP Livecode Opensource Backer
- Posts: 3581
- Joined: Mon Jan 22, 2007 7:36 am
- Location: Berkeley, CA, US
- Contact:
command line options
I've been looking at the command line processor.
In the old cgi engine we had the ability to pass scripts to the engine from the command line and have the engine run them. This was locked down when the licensing mechanism changed to license the engine rather than the home stack.
I'd like to revive this feature to allow command line processing ala shell scripts, i.e.,
livecode < myscript.txt
I used to do this as an alternative to perl, ruby, etc. and I'd like to have it back.
I see the list of stack files getting processed from the command line in dskmain.cpp, but setting the return value of MCModeShouldLoadStacksOnStartup() in mode_development doesn't do the trick. I don't want to load a stack on startup anyway, I just want to execute a script text file.
Is there something simple that will allow input redirection to magically happen or is it more involved than that?
In the old cgi engine we had the ability to pass scripts to the engine from the command line and have the engine run them. This was locked down when the licensing mechanism changed to license the engine rather than the home stack.
I'd like to revive this feature to allow command line processing ala shell scripts, i.e.,
livecode < myscript.txt
I used to do this as an alternative to perl, ruby, etc. and I'd like to have it back.
I see the list of stack files getting processed from the command line in dskmain.cpp, but setting the return value of MCModeShouldLoadStacksOnStartup() in mode_development doesn't do the trick. I don't want to load a stack on startup anyway, I just want to execute a script text file.
Is there something simple that will allow input redirection to magically happen or is it more involved than that?
PowerDebug http://powerdebug.ahsoftware.net
PowerTools http://www.ahsoftware.net/PowerTools/PowerTools.irev
PowerTools http://www.ahsoftware.net/PowerTools/PowerTools.irev
Re: command line options
I think this still works with the standalone engine... It's only the ide ('development') engine that has the licensing code embedded.
-
- VIP Livecode Opensource Backer
- Posts: 3581
- Joined: Mon Jan 22, 2007 7:36 am
- Location: Berkeley, CA, US
- Contact:
Re: command line options
Hmmm... I put
into file "test.txt", then replaced the community engine with the newly-build standalone engine. Running
just launched the IDE. Running
gave me a segmentation fault.
Code: Select all
put the version
Code: Select all
livecodecommunity.x86 < test.txt
Code: Select all
livecodecommunity.x86 -ui < test.txt
PowerDebug http://powerdebug.ahsoftware.net
PowerTools http://www.ahsoftware.net/PowerTools/PowerTools.irev
PowerTools http://www.ahsoftware.net/PowerTools/PowerTools.irev
-
- VIP Livecode Opensource Backer
- Posts: 3581
- Joined: Mon Jan 22, 2007 7:36 am
- Location: Berkeley, CA, US
- Contact:
Re: command line options
...and gdb says I crashed here
Code: Select all
Program received signal SIGSEGV, Segmentation fault.
0x080a07e8 in MCScreenRect::evaluate (ep=..., p_working=false,
p_plural=false, p_effective=false) at ./src/funcs.cpp:4189
4189 t_rectangle = p_working ? t_displays[t_index] . workarea : t_displays[t_index] . viewport;
PowerDebug http://powerdebug.ahsoftware.net
PowerTools http://www.ahsoftware.net/PowerTools/PowerTools.irev
PowerTools http://www.ahsoftware.net/PowerTools/PowerTools.irev
Re: command line options
Okay - I'll re-qualify the above with : it *should* work... I think you just found a bug
Re: command line options
Actually - reading back - if 'livecodecommunity.x86' launched the IDE at any point, then that isn't the standalone engine.
-
- VIP Livecode Opensource Backer
- Posts: 3581
- Joined: Mon Jan 22, 2007 7:36 am
- Location: Berkeley, CA, US
- Contact:
Re: command line options
I renamed it to make sure there weren't *those kind* of conflicts. But it's the standalone engine copied from the _debug folder after the build.
Update: the copy may have failed, so I redid the test, removing the existing engine first and then copying>
Now I get
when launching
with or without the -ui option
Update: the copy may have failed, so I redid the test, removing the existing engine first and then copying>
Now I get
Code: Select all
Startup error - failed to read standalone stack
Code: Select all
livecodecommunity.x86 < test.txt
PowerDebug http://powerdebug.ahsoftware.net
PowerTools http://www.ahsoftware.net/PowerTools/PowerTools.irev
PowerTools http://www.ahsoftware.net/PowerTools/PowerTools.irev
Re: command line options
Hmm... didn't the old CGI engine require something like this rather than just 'put the version'
Code: Select all
on startup
put the version
end startup
LiveCode User Group on Facebook : http://FaceBook.com/groups/LiveCodeUsers/
Re: command line options
Hmm... I think it was blocked from all engines when server came out... would have been too encouraging to just keep using CGI I guess. I think the last engine to support it was 3.5 ishI think this still works with the standalone engine
LiveCode User Group on Facebook : http://FaceBook.com/groups/LiveCodeUsers/
-
- VIP Livecode Opensource Backer
- Posts: 3581
- Joined: Mon Jan 22, 2007 7:36 am
- Location: Berkeley, CA, US
- Contact:
Re: command line options
Yeah... I'm hoping to get that put back.
PowerDebug http://powerdebug.ahsoftware.net
PowerTools http://www.ahsoftware.net/PowerTools/PowerTools.irev
PowerTools http://www.ahsoftware.net/PowerTools/PowerTools.irev
Re: command line options
Ah yes - I misremembered. The ability of the standalone engine to run a text script directly (as a parameter, don't think you could ever pipe one in as the stdin/stdout are directly passed to the stack/script for its use) stopped when standalones became proper executables and licensed based on the edition they were built in. I dimly recall providing a stack (to the improve-list at the time) you could build into a standalone that emulated the effect, but I might be mistaken.
In any case, the licensing requirement is obviously not there any more with community so it makes sense to reinstate this behavior (for both IDE and Standalone engines) - it also solves our build automation problem as part of the process (building the installers) is a LiveCode script based process that requires functionality in the IDE engine.
In any case, the licensing requirement is obviously not there any more with community so it makes sense to reinstate this behavior (for both IDE and Standalone engines) - it also solves our build automation problem as part of the process (building the installers) is a LiveCode script based process that requires functionality in the IDE engine.
Re: command line options
I had a look at this briefly yesterday and made some headway towards getting it to work - not sure if it will get into 6.0.1 but will put it on a branch at least if I get the patch finished.
-
- VIP Livecode Opensource Backer
- Posts: 3581
- Joined: Mon Jan 22, 2007 7:36 am
- Location: Berkeley, CA, US
- Contact:
Re: command line options
Yay! That's great news.
PowerDebug http://powerdebug.ahsoftware.net
PowerTools http://www.ahsoftware.net/PowerTools/PowerTools.irev
PowerTools http://www.ahsoftware.net/PowerTools/PowerTools.irev
-
- VIP Livecode Opensource Backer
- Posts: 3581
- Joined: Mon Jan 22, 2007 7:36 am
- Location: Berkeley, CA, US
- Contact:
Re: command line options
@runrevmark - did this ever make it into a branch? I don't see it anywhere obvious. And it's still a current topic:
http://forums.runrev.com/viewtopic.php? ... 603#p76603
http://forums.runrev.com/viewtopic.php? ... 603#p76603
PowerDebug http://powerdebug.ahsoftware.net
PowerTools http://www.ahsoftware.net/PowerTools/PowerTools.irev
PowerTools http://www.ahsoftware.net/PowerTools/PowerTools.irev
Re: command line options
@mwieder: It's a work in progress - it turned out to be a little fiddlier than I imagined... However, it's still being worked on