Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How run a script with arguments? #7

Open
uliwitness opened this issue Oct 16, 2022 · 6 comments
Open

How run a script with arguments? #7

uliwitness opened this issue Oct 16, 2022 · 6 comments

Comments

@uliwitness
Copy link
Contributor

uliwitness commented Oct 16, 2022

I'm trying to get this to run in my (non-MPW) makefile:

MakePPCCodeRsrc build/obj/$(EXECUTABLE).tmp -o $(EXECUTABLE) -append -rt xcmd=7000 -c 'RSED' -t 'rsrc' -rn $(EXECUTABLE)

Installed copied the Scripts folder from Apple's MPW to ~/mpw/Scripts/. Tried

~/mpw/bin/mpw-shell -c "MakePPCCodeRsrc build/obj/$(EXECUTABLE).tmp -o build/$(EXECUTABLE) -append -rt xcmd=7000 -c 'RSED' -t 'rsrc' -rn $(EXECUTABLE)"

And as long as I add {MPW}Scripts to $Commands that seems to run, but it then fails with

Exiting - PC = 0
make: *** [build/SelectionMode] Error 70

I tried adding -v before -c to get some additional information, but that doesn't seem to have any effect. Also tried :build:obj:$(EXECUTABLE).tmp as the path. I'm assuming something about the file paths is wrong, but no idea how to confirm that or what format this stuff should really be. Do I somehow need to tell mpw-shell about the current directory from zsh? Or should it just pick that up?

@ksherlock
Copy link
Owner

Well, it looks like that's not actually supported yet (the above errors is from trying to run it as an executable with MPW which doesn't work). execute MakePPCCodeRsrc will run it as a script but that doesn't pass any of the parameters so it's not useful. I'll try to add script support.

@uliwitness
Copy link
Contributor Author

I'm curious, would adding this be complicated, or is it something I could do, like adding a command-line argument that calls through to a particular function?

@ksherlock
Copy link
Owner

The main hangup is environment variable handling. I did some testing with MPW in Basilisk and it looks like with user scripts, they get their own copy of the local variables which are isolated from the main shell's variables (but scripts can also export them out). Currently, there's one big table of variables and some are flagged as exported so that would need to change. For the most part, it's probably not a big deal if local environment variables are shared but if a script calls another script, the argument variables (0, 1, 2, ...) will be clobbered.

@ksherlock
Copy link
Owner

scripts should work now. You may need to mark them as text (SetFile -t TEXT file). The MakePPCCodeRsrc won't work yet because regular expressions aren't yet supported (they're in progress).

@ksherlock
Copy link
Owner

I added regular expression support to evaluate ... but there are a couple other deficiencies that are preventing that script from running.

@uliwitness
Copy link
Contributor Author

Thanks for all the work you've put into this so far. If there's anything I can help with, let me know.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants