[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: gEDA-user: gnetlist quitting after execl call



On Sep 6, 2010, at 2:49 PM, Oliver King-Smith wrote:

>   John,
>   Ah much improved.  I tried using system* but now I don't seem to be
>   getting my command line arguments.  For example both
>       (system* "/sw/share/gEDA/scheme/subfunction" (string-append " --m="
>                                 (number->string m) " --w="
>   (number->string w)
>                                 " --l=" (number->string l) " --type=nmos"
>   ) )
>   and
>       (system* "/sw/share/gEDA/scheme/subfunction" " --m="
>                                 (number->string m) " --w="
>   (number->string w)
>                                 " --l=" (number->string l) " --type=nmos"
>   )
>   run my C++ program and return with guile continuing, but my program
>   sees no signs of the command line arguments.  The following code barfs
>   out
>       (system* (string-append "/sw/share/gEDA/scheme/subfunction" " --m="
>                                 (number->string m) " --w="
>   (number->string w)
>                                 " --l=" (number->string l) " --type=nmos"
>   ) )
>   with
>      1: 0* [magic-new "small_amplifier"]
>   In /sw/share/gEDA/scheme/gnet-magic-new.scm:
>    816: 1  [magic:write-top-cell "small_amplifier"]
>    799: 2  (let* ((port (open-output-file #))) (display "magic
>   " port) ...)
>    802: 3* [magic:components #<output: small_amplifier.mag 12> ("OUT"
>   "VSS" "VCC" ...)]
>    781: 4  (if (not #) (begin # #))
>      ...
>    782: 5  (begin (let # # # ...) (magic:components port #))
>    783: 6* (let ((pattern #) (package #)) (display "use " port) ...)
>    788: 7* [magic:write-component "M3"]
>    762: 8  (let* ((device #)) (cond (# #) (# #) (else #)))
>      ...
>    654: 9  [system* "/sw/share/gEDA/scheme/subfunction --m=1 --w=30 --l=5
>   --type=pmos"]
>   Any suggestions?

Use (system) if you want to use a single string for the whole command, or use a single string for each argument with (system*).

>   Oliver
>     __________________________________________________________________
> 
>   From: John Doty <jpd@xxxxxxxxx>
>   To: gEDA user mailing list <geda-user@xxxxxxxxxxxxxx>
>   Sent: Mon, September 6, 2010 12:22:31 PM
>   Subject: Re: gEDA-user: gnetlist quitting after execl call
>   On Sep 6, 2010, at 1:08 PM, Oliver King-Smith wrote:
>> I am extending gnetlist and I dislike scheme.  To work around this I
>> wrote a little program in C++ to do the heavy lifting and I am
>   trying
>> to call it from my scheme extension to gnetlist.
>> I wrote the following function in scheme:
>> (define magic:write_nmos_fet
>>   (lambda (w l m)
>>     (display (string-append "in write_nmos_fet " (number->string w)
>> "\n") )
>> 
>>     (execl "/sw/share/gEDA/scheme/subfunction" " --m="
>   (number->string
>   There's your problem: (execl) is not like a call. It replaces the
>   current process, so it should never return unless something goes wrong.
>   Like execl() in libc.
>   You probably want (system) or (system*).
>> m)
>>             " --w=" (number->string w)  " --l=" (number->string l) "
>> --type=nmos" )
>>     (display "Finished C call\n" )
>>       ))
>> This works and calls my C++ program (called subfunction right now).
>> The C++ program runs without problems and produces the expected
>> output.  My problem is nothing seems to run in my scheme program
>   after
>> calling subfunction.  For example the line:
>>     (display "Finished C call\n" )
>> does not run.  Nothing else appears to run after this.  However
>   there
>> are no error messages.
>> Does anyone have any suggestions as to why this might be?
>> Is there a better way to be calling external programs from gnetlist?
>> Oliver
>> 
>> 
>> _______________________________________________
>> geda-user mailing list
>> [1]geda-user@xxxxxxxxxxxxxx
>> [2]http://www.seul.org/cgi-bin/mailman/listinfo/geda-user
>   John Doty              Noqsi Aerospace, Ltd.
>   [3]http://www.noqsi.com/
>   [4]jpd@xxxxxxxxx
>   _______________________________________________
>   geda-user mailing list
>   [5]geda-user@xxxxxxxxxxxxxx
>   [6]http://www.seul.org/cgi-bin/mailman/listinfo/geda-user
> 
> References
> 
>   1. mailto:geda-user@xxxxxxxxxxxxxx
>   2. http://www.seul.org/cgi-bin/mailman/listinfo/geda-user
>   3. http://www.noqsi.com/
>   4. mailto:jpd@xxxxxxxxx
>   5. mailto:geda-user@xxxxxxxxxxxxxx
>   6. http://www.seul.org/cgi-bin/mailman/listinfo/geda-user
> 
> 
> _______________________________________________
> geda-user mailing list
> geda-user@xxxxxxxxxxxxxx
> http://www.seul.org/cgi-bin/mailman/listinfo/geda-user

John Doty              Noqsi Aerospace, Ltd.
http://www.noqsi.com/
jpd@xxxxxxxxx




_______________________________________________
geda-user mailing list
geda-user@xxxxxxxxxxxxxx
http://www.seul.org/cgi-bin/mailman/listinfo/geda-user