guile-user
[Top][All Lists]
Advanced

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

Re: some more newbie stuff


From: Neil Jerram
Subject: Re: some more newbie stuff
Date: 04 Feb 2001 11:40:02 +0000

>>>>> "balayo" == balayo  <address@hidden> writes:

    balayo> Hi guys, Here's what I'd like to do.  Knowing how to do
    balayo> some of this would answer some questions I have...

    balayo> 1. check to see if a "C" source file exists.

Use the `file-exists?' procedure.

    balayo> 2. If it exists, compile it with gcc and a list of
    balayo> parameters.

Use `string-append' to construct the command line that you want, and
`system' to invoke it.  (For more advanced ways of interacting with
external programs, you could look at guile-scsh.)

    balayo> 3. If it does not exist, create the file with header-stuff
    balayo> already there (put there by guile).

Use `open-output-file' to create an output port into the new file, and
`display' to write stuff into this port.  Finally, use
`close-output-port' to close it (and flush any buffered data to
file).

    balayo> 4. ask if I want to compile the new file.

Use `display' to print the question, `read' to read a response, and
then compare the response against 'y or 'yes.

    balayo> 5. compile it if yes, don't if no.

Same as (2), I think.

    balayo> Of course, feel free to ignore my little exercise.

Shout if you need more help putting this all together.

Regards,
        Neil



reply via email to

[Prev in Thread] Current Thread [Next in Thread]