Sorry... I didn't explain the command-line stuff completely and forgot a
part.
Here's a patch (attached).
On Wed, Aug 13, 2014 at 2:22 PM, Chris Moller <[email protected]> wrote:
>
> - Added the command-line stuff.
> - Fixed the assign arrow and branch arrow transposition.
>
> Both pushed to github.
> I'll look at the quad-PW stuff
>
>
> On 08/13/14 16:36, David Lamkins wrote:
>
> Here's a feature request:
>
> - Provide a means to pass command-line arguments to APL.
>
> At the very least, I'd like to be able to do something like:
>
> $ aplwrap -s 16 -- --my-option 1234
>
> where everything from -- onward would be tacked onto the end of aplwrap's
> apl_argv[].
>
> That way, everything after the -- would be available via quad-ARG for
> consumption by the APL program.
>
>
>
--
"The secret to creativity is knowing how to hide your sources."
Albert Einstein
http://soundcloud.com/davidlamkins
http://reverbnation.com/lamkins
http://reverbnation.com/lcw
http://lamkins-guitar.com/
http://lamkins.net/
http://successful-lisp.com/
diff --git a/src/aplwrap.c b/src/aplwrap.c
index a14ebf0..e2790e4 100644
--- a/src/aplwrap.c
+++ b/src/aplwrap.c
@@ -324,6 +324,7 @@ main (int argc,
GtkWidget *vbox;
gboolean rc;
gchar *new_fn = NULL;
+ gchar *opt_lx = NULL;
GOptionEntry entries[] = {
{ "ftsize", 's', 0, G_OPTION_ARG_INT,
@@ -346,6 +347,10 @@ main (int argc,
&new_fn,
"Set an absolute or on-path executable APL other than the default.",
NULL },
+ { "LX", 0, 0, G_OPTION_ARG_STRING,
+ &opt_lx,
+ "Invoke APL âLX on startup. (string: APL command or expression)",
+ NULL },
{ NULL }
};
@@ -368,8 +373,8 @@ main (int argc,
"--silent", // fixme make option
NULL};
#else
- gchar **apl_argv = g_alloca ((7 + argc) * sizeof (gchar *));
- bzero (apl_argv, (7 + argc) * sizeof (gchar *));
+ gchar **apl_argv = g_alloca ((9 + argc) * sizeof (gchar *));
+ bzero (apl_argv, (9 + argc) * sizeof (gchar *));
{
gint ix = 0;
apl_argv[ix++] = "apl";
@@ -378,10 +383,18 @@ main (int argc,
apl_argv[ix++] = "-w";
apl_argv[ix++] = "500";
apl_argv[ix++] = "--silent";
+ if (opt_lx) {
+ apl_argv[ix++] = "--LX";
+ apl_argv[ix++] = opt_lx;
+ }
if (argc > 1) {
- for (int i = 1; i < argc; i++) {
- if (0 != g_strcmp0 (argv[i], "--")) apl_argv[ix++] = argv[i];
+ int i;
+ for (i = 1; i < argc; i++) {
+ if (0 == g_strcmp0 (argv[i], "--")) break;
+ }
+ for (; i < argc; ++i) {
+ apl_argv[ix++] = argv[i];
}
}
apl_argv[ix++] = NULL;