Changeset 608
- Timestamp:
- Apr 19, 2007, 12:42:21 AM (19 years ago)
- File:
-
- 1 edited
-
trunk/warpin/bld_fm2_wpidirs.cmd (modified) (10 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/warpin/bld_fm2_wpidirs.cmd
r597 r608 5 5 * 6 6 * TODO: 7 * - Support multiple levels of destination directories 7 8 * - Add logic to read script to determine 8 9 * - Number of packages … … 31 32 WPI. = '' 32 33 WPI.retval = 0 33 WPI.max_package_number = 99934 WPI.max_package_number_length = 3 34 35 35 36 parse arg args … … 38 39 call ReadFile 39 40 40 do p = 1 to WPI.pkg.0 41 dest_basedir = 'PACKAGE.' || right(WPI.pkg.p.number, length(WPI.max_package_number), '0') 42 '@if not exist 'dest_basedir'\. md 'dest_basedir 43 if WPI.pkg.p.file.0 \= '' then 44 do f = 1 to WPI.pkg.p.file.0 45 dest_dir = dest_basedir || '\' || WPI.pkg.p.file.f.dest 46 '@if not exist 'dest_dir'\. md 'dest_dir 47 'copy ' || WPI.src_basedir || WPI.pkg.p.file.f.src || '\' || WPI.pkg.p.file.f.name || ' ' || dest_dir 48 end 41 do f = 1 to WPI.fileline.0 42 parse var WPI.fileline.f . filename pkgnum src_subdir dest_subdir 43 if WPI.src_basedir \= '..\' then /* Ignore src_subdir from file if not using build subtree */ 44 src_subdir = '.' 45 dest_basedir = MakePackageDir( pkgnum ) 46 dest_dir = dest_basedir || '\' || strip(dest_subdir) 47 call SysMkDir dest_dir 48 'copy ' || WPI.src_basedir || src_subdir || '\' || filename || ' ' || dest_dir 49 49 end 50 50 … … 55 55 parse arg errorcode 56 56 select 57 when errorcode = 1 then58 say 'Error: More than one PACKAGECOUNT line in 'WPI.infile59 when errorcode = 2 then60 say 'Error: More than PACKAGECOUNT PACKAGE lines in 'WPI.infile61 57 when errorcode = 3 then 62 58 do … … 65 61 end 66 62 when errorcode = 4 then 67 say 'Error: Keyword is not PACKAGECOUNT, PACKAGE or FILE in 'WPI.infile63 say 'Error: Keyword is not FILE or NOFILESPACKAGE in 'WPI.infile 68 64 when errorcode = 5 then 69 65 novalue: … … 72 68 say ' 'sourceline(sigl) 73 69 signal NormalExit 74 end75 when errorcode = 6 then76 do77 say 'Error: Duplicate PACKAGE line in 'WPI.infile78 say 'Line : 'txtline79 end80 when errorcode = 7 then81 do82 say 'Error: Invalid package number in 'WPI.infile83 say 'Line : 'txtline84 70 end 85 71 otherwise … … 95 81 96 82 ReadFile: procedure expose (globals) 97 package_number_list = ''83 f = 0 98 84 do while lines(WPI.infile) > 0 99 85 txtline = strip(linein(WPI.infile)) … … 108 94 txtline = strip(txtline) 109 95 end 110 word1 = translate(word(txtline, 1))111 select112 when word1 == 'PACKAGECOUNT:' then113 if WPI.pkg.0 == ''then114 WPI.pkg.0 = word(txtline, 2)96 parse value translate(txtline) with word1 word2 word3 . 97 if (word1 == 'FILE:') then 98 do 99 if words(txtline) \= 5 then 100 call ErrorExit 3 /* Invalid number of parameters */ 115 101 else 116 call ErrorExit 1 /* More than one PACKAGECOUNT */ 117 when word1 == 'PACKAGE:' then 118 do 119 parse var txtline . pkgnum pkgdesc 120 if wordpos(pkgnum, package_number_list) > 0 then 121 call ErrorExit 6 /* Repeated package line */ 122 package_number_list = package_number_list pkgnum 123 p = words(package_number_list) 124 if p > WPI.pkg.0 then 125 call ErrorExit 2 /* More packages than PACKAGECOUNT */ 126 WPI.pkg.p.number = pkgnum 127 WPI.pkg.p.desc = strip(pkgdesc) 128 end 129 when (word1 == 'FILE:') then 130 do 131 parse var txtline . filename pkgnum filesrc filedest rest 132 p = wordpos(pkgnum, package_number_list) 133 if p = 0 then 134 call ErrorExit 7 135 else 136 if strip(rest) \= '' then 137 call ErrorExit 3 /* Too many parameters */ 138 else 139 do 140 i = WPI.pkg.p.file.0 141 if i = '' then 142 i = 1 143 else 144 i = i + 1 145 WPI.pkg.p.file.0 = i 146 WPI.pkg.p.file.i.name = filename 147 if WPI.src_basedir \= '..\' then /* Ignore src-dir if not using build subtree */ 148 WPI.pkg.p.file.i.src = '.' 149 else 150 WPI.pkg.p.file.i.src = filesrc 151 WPI.pkg.p.file.i.dest = filedest 152 end 153 end 154 otherwise 102 do 103 f = f + 1 104 WPI.fileline.f = strip(txtline) 105 /* 106 if word3 > WPI.max_package_number then 107 WPI.max_package_number = word3 108 */ 109 end 110 end 111 else 112 if word1 == 'NOFILESPACKAGE:' then 113 call MakePackageDir word2 114 else 155 115 call ErrorExit 4 /* Invalid line/word1 */ 156 end157 116 end 117 WPI.fileline.0 = f 158 118 call stream WPI.infile, 'c', 'close' 159 119 return … … 181 141 WPI.src_basedir = WPI.src_basedir || '\' 182 142 if args == '' then 143 /* 183 144 WPI.infile = 'BLD_FM2_WPIDIRS.TXT' 145 */ 146 WPI.infile = 'BLD_FM2_WPIDIRS.IN' 184 147 else 185 148 if left(args, 1) == '"' then … … 189 152 return 190 153 154 MakePackageDir: procedure expose (globals) 155 parse arg pkgnum 156 full_dirname = 'PACKAGE.' || right(pkgnum, WPI.max_package_number_length, '0') 157 call SysMkDir full_dirname 158 return full_dirname 159
Note:
See TracChangeset
for help on using the changeset viewer.
