[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: minor patches, random questions.



On Nov 27, 2003, at 2:50 PM, Faried Nawaz wrote:

>
> The diff file is at http://web.nilpotent.org/tmp/goo-2003-11-26.txt
>
> c/grt.c: (app-args) was returning the args in reverse order.
>
> emacs/goo.el: I noticed that my code using (with-port ...) indented
> differently from the code in goo's sources.

this should probably be generalized to indent any with-* form as you 
suggest.

> src/goo/top.goo, src/goo/main.goo: This code lets you run goo scripts.
> You can create a file with
>
> == cut here ==
> #!/path/to/goo --
>
> (+ 2 3)
> == cut here ==
>
> make it executable, and run it.

looks good.

> There are two problems with this.  The first one is that the first two
> elements of (app-args) are now "--" and the name of the script you're
> running.  Since scripts generally expect argv[1] and upwards to point
> to real arguments, argc/argv need to be mangled to skip these two args.
> Will a simple { Pargc += 2; Pargv += 2; } in read-script work?

well i don't think this should be done at this low a level as this 
returns exactly what c main returns.  instead there could be an 
argument processing filter that returns a table of key value pairs...

> Other problem: the changes to main.goo.  They're not nice, but that's
> because i tried to keep the ";;; GOO\n;;; JONATHAN BACHRACH\n ..."
> header when goo was started interactively.

this seems reasonable.

> I thought about writing a file-access method --
>
> (file-access 'read "/etc/passwd") => #t
> (file-access 'write "/etc/shadow") => #f
> (file-access 'execute "/bin/ls") => #t
>
> but I realized that instead of hacking src/goo/%system.c, I could
> simply write inline C code using the access(2) system call.  Which
> cases call for inline C and which cases call for %fns?

i'm thinking that when the amount of c code is small, is to be used 
exactly once and involves a certain amount of nudging into goo land, 
then it would be much more succinct as embedded c code.  i'm actually 
thinking about eventually getting rid of most of the c primitives and 
replacing them with embedded c.

> Also -- I couldn't figure out how to build and return a tuple from C.

all the more reason to use embedded c.

but if you gotta, then you can do this with:

   t = YPPtfab((P)n, YPfalse);
   YPtelt_setter(x, t, i);
   ...

> Thanks,
>
> Faried.
>
>