Changeset 4593 for trunk/tools


Ignore:
Timestamp:
Nov 15, 2000, 1:20:44 AM (25 years ago)
Author:
bird
Message:

Added optional recursion.
Fixed bug when using multiple -I arguments.
Added options for full or relative filenames.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tools/vslick/genproject.cmd

    r4361 r4593  
    1 /* $Id: genproject.cmd,v 1.4 2000-10-02 04:08:49 bird Exp $
     1/* $Id: genproject.cmd,v 1.5 2000-11-15 00:20:44 bird Exp $
    22 *
    33 * This script generates a Visual Slick project of the source and include
    44 * files found in the directory tree starting at the current directory.
    55 *
    6  * Copyright (c) 1999 knut st. osmundsen
     6 * Copyright (c) 1999-2000 knut st. osmundsen
    77 *
    88 * Project Odin Software License can be found in LICENSE.TXT
     
    1616    sIncludes = '';
    1717    sProjFile = '';
     18    fFullDir = 1;
     19    fRecursive = 0;
    1820
    1921    sArgs.0 = 0;
     
    5052            /* option */
    5153            chArg = substr(sArg, 2, 1);
    52             sArg  = substr(sArg, 3);
     54            sArg  = strip(substr(sArg, 3));
    5355            select
    5456                when chArg = 'I' | chArg = 'i' then do
    55                     sIncludes = sIncludes||sArg;
     57                    if (sArg <> '' & substr(sArg, length(sArg), 1) <> ';')  then
     58                        sincludes = sIncludes || sArg || ';';
     59                    else
     60                        sIncludes = sIncludes || sArg;
     61                end
     62
     63                when chArg = 'f' | chArg = 'F' then do
     64                    fFullDir = 1;
     65                end
     66
     67                when chArg = 'r' | chArg = 'R' then do
     68                    fFullDir = 0;
    5669                end
    5770
    5871                when chArg = 'h' | chArg = '?' | sArg = '-help' then do
    5972                    call syntax;
     73                end
     74
     75                when chArg = 's' | chArg = 'S' then do
     76                    fRecursive = 1;
    6077                end
    6178
     
    89106        call lineout sProjFile, 'MACRO=odin32_setcurrentdir();\nodin32_maketagfile();\n'
    90107        call lineout sProjFile, 'FILTEREXPANSION=1 1 0 0 1'
    91         call lineout sProjFile, 'compile=concur|capture|clear|:Compile:&Compile,nmake %n.obj'
     108        call lineout sProjFile, 'compile=concur|capture|clear|:Compile:&Compile,nmake .\bin\debug\%n.obj'
    92109        call lineout sProjFile, 'make=concur|capture|clear|:Build:&Build,nmake'
    93         call lineout sProjFile, 'rebuild=concur|capture|clear|:Rebuild:&Rebuild,nmake /A'
     110        call lineout sProjFile, 'rebuild=concur|capture|clear|:Rebuild:&Rebuild,nmake -a'
    94111        call lineout sProjFile, 'debug=:Debug:&Debug,'
    95112        call lineout sProjFile, 'execute=:Execute:E&xecute,'
     
    104121
    105122        call lineout sProjFile, '[FILES]'
    106         call processDirTree sProjFile, directory(), directory();
     123        call processDirTree sProjFile, directory(), directory(), fRecursive, fFullDir;
    107124        call lineout sProjFile, '[ASSOCIATION]'
    108125        call lineout sProjFile, '[STATE]'
     
    129146
    130147syntax: procedure
    131     say 'syntax: genproject.cmd  <project filename> [-I<include directories>]'
    132     say ''
    133     say 'Copyright (c) 1999 knut st. osmundsen'
     148    say 'Syntax: genproject.cmd  <project filename> [-I<include directories>]'
     149    say '   switches:   -s                  Recursivly scan subdirectories too.'
     150    say '                                   (default: Current dir only)'
     151    say '               -f                  Full filenames.         (default)'
     152    say '               -r                  Relative filenames.     (default: -f)'
     153    say '               -I<dir or dirlist>  Include directories.'
     154    say 'Copyright (c) 1999-2000 knut st. osmundsen'
    134155    exit (1);
    135156
    136157/* processes an directory tree */
    137158processDirTree: procedure
    138     parse arg sProjFile, sDirectory, sRoot
     159    parse arg sProjFile, sDirectory, sRoot, fRecursive, fFullDir
    139160
    140161    rc = SysFileTree(sDirectory'\*', sFiles, 'FO');
     
    142163        do i = 1 to sFiles.0
    143164            if filterFile(sFiles.i) then
    144                 call lineout sProjFile, substr(sFiles.i, length(sRoot)+2)
    145         end
    146     end
    147 
    148     rc = SysFileTree(sDirectory'\*', sDirs, 'DO');
    149     if rc == 0  then do
    150         do i = 1 to sDirs.0
    151             if filterDirectory(sDirs.i) then
    152                 call processDirTree sProjFile, sDirs.i, sRoot
     165            do
     166                if (fFullDir) then
     167                    call lineout sProjFile, sFiles.i;
     168                else
     169                    call lineout sProjFile, substr(sFiles.i, length(sRoot)+2);
     170            end
     171        end
     172    end
     173
     174    if (fRecursive) then
     175    do
     176        rc = SysFileTree(sDirectory'\*', sDirs, 'DO');
     177        if rc == 0  then do
     178            do i = 1 to sDirs.0
     179                if filterDirectory(sDirs.i) then
     180                    call processDirTree sProjFile, sDirs.i, sRoot, fRecursive, fFullDir
     181            end
    153182        end
    154183    end
Note: See TracChangeset for help on using the changeset viewer.