/* $VER: 0.1, ©1996 M. Puts C, C++ and Header files into the Project list

INTRODUCTION

    When I make a C or C++ program, I hold all the #?.c, #?.h, #?.o and all
    other stuff in one directory and sometimes it's not easy to find a
    source file in GED's file requester. So I started to use the Project
    feature but I was too lazy to maintain the list by hand. So I made
    this simple macro. It scans current directory for source files and
    puts them into the Project list. If you use assembler or E or any
    other language, just change the pattern on line 87.


USAGE

    Use it the same way like any other GoldEd arexx macro. I use it as
    GoldEd startup macro.


INSTALLATION

    Just copy it anywhere, e.g. golded:arrexx and run it from GoldEd somehow.
    List and Sort commands must be present in C:


LEGAL INFO

    This macro is freeware. You can copy it as long as you do not modify
    the package. You can include it in any PD collection as long as you
    let me know about it. Free CDs appreciated!


DISCLAIMER

    Use this macro at your own risk, blah blah blah


FEEDBACK

    If you like it, please send me an E-mail like this:

------------------------- Cut here ---------------------------------

To: trochtam@risc.upol.cz
Subject: I LOVE your GED macro !!!!

Hi, M!

    I just downloaded your Src2Proj macro and I've got to say it's
really cool. Great idea ! I use it as a GoldED startup macro and my
life is much easier now. Thank you.

                            regards,

                                        < sign here >

------------------------- Cut here ---------------------------------


AUTHOR

    E-Mail: trochtam@risc.upol.cz

    WWW homepage: http://risc.upol.cz/~trochtam/

    Snail-mail:
        Myra Trochta
        Kratka 708
        757 01 Valasske Mezirici
        Czech Republic

    Phone: +42-651-24615

P.S. Excuse my English - e.g. I don't know if I spell the word "blah" correctly
P.P.S. ;-)
*/

OPTIONS RESULTS                             /* enable return codes     */

if (LEFT(ADDRESS(), 6) ~= "GOLDED") then    /* not started by GoldEd ? */
    address 'GOLDED.1'


project clr  /* comment this out if you wanna keep previous entries */


address command 'c:list >t:project pat #?.(cpp|h|c|cc|cxx|hh|c++) lformat "%s%s"'
                                       /* Pattern of the files to be added */

if open(file,'t:project',read) = 0 then
                                   return 0

line = readln( file )
call close( file )
if line = "" then do
    return 0
end

address command 'c:sort from t:project to t:project'

OPTIONS FAILAT 21

if open( file, 't:project', read ) = 0 then
                                       return 0
fini = 0
do until fini
    line = readln( file )
    if line~="" then
    do
        PROJECT ADD line
    end
    fini = eof( file )
end
call close( file )

address command 'c:delete >nil: t:project'

EXIT
