Changeset 2993
- Timestamp:
- Apr 6, 2007, 8:44:12 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified branches/libc-0.6/src/misc/dllar.cmd ¶
r2985 r2993 89 89 i = i + 1; 90 90 outFile = word(cmdLine, i); 91 end ;91 end 92 92 when abbrev('def', substr(tmp, 2), 3) then 93 93 useDefFile = GetLongArg(); … … 126 126 K = inputFiles.0; 127 127 inputFiles.K = files.J; 128 end ;128 end 129 129 else 130 130 files.0 = 0; … … 133 133 say 'ERROR: No file(s) found: "'tmp'"'; 134 134 exit 8; 135 end ;135 end 136 136 drop files.; 137 end ;138 end ;/* iterate cmdline words */137 end 138 end /* iterate cmdline words */ 139 139 140 140 if (flag_omf = 1) then … … 149 149 say 'dllar: no input files' 150 150 call PrintHelp; 151 end ;151 end 152 152 153 153 /* … … 166 166 call CleanUp; 167 167 exit 8; 168 end ;168 end 169 169 170 170 /* Prefix with '!' to indicate archive */ … … 172 172 call doCommand('cd 'substr(inputFiles.I, 2)' && 'AR' x 'fullname); 173 173 call directory(curDir); 174 rc = SysFileTree(substr(inputFiles.I, 2)'\*.o ', 'files', 'FO');174 rc = SysFileTree(substr(inputFiles.I, 2)'\*.o*', 'files', 'FO'); 175 175 if (rc = 0) then 176 176 do 177 177 inputFiles.0 = inputFiles.0 + 1; 178 178 K = inputFiles.0; 179 inputFiles.K = substr(inputFiles.I, 2)'/*.o ';179 inputFiles.K = substr(inputFiles.I, 2)'/*.o*'; 180 180 /* Remove all empty files from archive since emxexp will barf */ 181 181 do J = 1 to files.0 182 182 if (stream(files.J, 'C', 'QUERY SIZE') <= 32) then 183 183 call SysFileDelete(files.J); 184 end ;184 end 185 185 drop files.; 186 186 end 187 187 else 188 188 say 'WARNING: there are no files in archive "'substr(inputFiles.I, 2)'"'; 189 end ;190 end ;189 end 190 end 191 191 192 192 /* … … 196 196 if (left(inputFiles.I, length(curDirS)) = curDirS) then 197 197 inputFiles.I = substr(inputFiles.I, length(curDirS) + 1); 198 end ;198 end 199 199 200 200 /* … … 206 206 do_backup = 1; 207 207 outFile = inputFiles.1; 208 end ;208 end 209 209 210 210 /* If its an archive, remove the '!' and the '$_' prefixes */ … … 217 217 if ((ext = 'DLL') | (ext = 'O') | (ext = 'A')) then 218 218 outFile = substr(outFile, 1, dotpos - 1); 219 end ;219 end 220 220 221 221 EXTRA_CFLAGS = substr(EXTRA_CFLAGS, 2); … … 227 227 228 228 if (do_backup & stream(arcFile, 'C', 'query exists') \= '') then 229 do 230 '@del 'outFile'_s.a > NUL'; 229 231 call doCommand('ren 'arcFile' 'outFile'_s.a'); 230 231 if useDefFile = '' then 232 do233 /*234 * Extract public symbols from all the object files.235 */236 tmpdefFile = '$_'filespec('NAME', defFile);237 call SysFileDelete(tmpdefFile);238 do I = 1 to inputFiles.0239 if (left(inputFiles.I, 1) \= '!') then240 call doCommand('emxexp -u' inputFiles.I' >>'tmpdefFile);241 end;242 243 /* 244 * Create the def file.245 */246 call SysFileDelete(defFile);247 call stream defFile, 'c', 'open write';248 call lineOut defFile, 'LIBRARY 'filespec('NAME', outFile)' 'library_flags;249 if (length(library_data) > 0) then250 call lineOut defFile, 'DATA 'library_data;251 if (length(description) > 0) then252 call lineOut defFile, 'DESCRIPTION "'description'"';253 call lineOut defFile, 'EXPORTS';254 255 queTmp = RxQueue('Create'); 256 queOld = RxQueue('Set', queTmp);257 call doCommand('cat 'tmpdefFile' | sort.exe | uniq.exe | rxqueue.exe'queTmp);258 259 ordinal = 1; 260 do while queued() > 0261 parse pull line;262 if (length(line) > 0) & (word(line, 1) \= ';') & (export_ok(line)) then263 do264 if (EXPORT_BY_ORDINALS) then265 do266 iPos = pos(';', line);267 if (iPos > 1) then268 line = strip(substr(line, 1, iPos - 1), 'T');269 line = line||' @'||ordinal||' NONAME';270 ordinal = ordinal + 1;271 end;272 call lineOut defFile, line;273 end;274 end;275 call RxQueue 'Delete', RxQueue('Set', queOld);276 call stream defFile, 'C', 'CLOSE';277 call SysFileDelete(tmpdefFile);278 drop line ordinal tmpdefFile; /* try prevent running out of memory... */279 280 end281 else282 do283 defFile = useDefFile;284 end232 end 233 234 if useDefFile = '' then 235 do 236 /* 237 * Extract public symbols from all the object files. 238 */ 239 tmpdefFile = '$_'filespec('NAME', defFile); 240 call SysFileDelete(tmpdefFile); 241 do I = 1 to inputFiles.0 242 if (left(inputFiles.I, 1) \= '!') then 243 call doCommand('emxexp -u' inputFiles.I' >>'tmpdefFile); 244 end 245 246 /* 247 * Create the def file. 248 */ 249 call SysFileDelete(defFile); 250 call stream defFile, 'c', 'open write'; 251 call lineOut defFile, 'LIBRARY 'filespec('NAME', outFile)' 'library_flags; 252 if (length(library_data) > 0) then 253 call lineOut defFile, 'DATA 'library_data; 254 if (length(description) > 0) then 255 call lineOut defFile, 'DESCRIPTION "'description'"'; 256 call lineOut defFile, 'EXPORTS'; 257 258 queTmp = RxQueue('Create'); 259 queOld = RxQueue('Set', queTmp); 260 call doCommand('cat 'tmpdefFile' | sort.exe | uniq.exe | rxqueue.exe' queTmp); 261 262 ordinal = 1; 263 do while queued() > 0 264 parse pull line; 265 if (length(line) > 0) & (word(line, 1) \= ';') & (export_ok(line)) then 266 do 267 if (EXPORT_BY_ORDINALS) then 268 do 269 iPos = pos(';', line); 270 if (iPos > 1) then 271 line = strip(substr(line, 1, iPos - 1), 'T'); 272 line = line||' @'||ordinal||' NONAME'; 273 ordinal = ordinal + 1; 274 end 275 call lineOut defFile, line; 276 end 277 end 278 call RxQueue 'Delete', RxQueue('Set', queOld); 279 call stream defFile, 'C', 'CLOSE'; 280 call SysFileDelete(tmpdefFile); 281 drop line ordinal tmpdefFile; /* try prevent running out of memory... */ 282 end 283 else 284 do 285 defFile = useDefFile; 286 end 285 287 286 288 … … 298 300 do I = 1 to inputFiles.0 299 301 if (left(inputFiles.I, 1) \= '!') then 300 call charout sTmpFile, ' 'translate(inputFiles.I, '/', '\'); ;301 end ;302 call charout sTmpFile, ' 'translate(inputFiles.I, '/', '\'); 303 end 302 304 call lineout sTmpFile, ' 'EXTRA_CFLAGS 303 305 call stream dsTmpFile, 'c', 'close' … … 315 317 if (left(inputFiles.I, 1) \= '!') then 316 318 gccCmdl = gccCmdl' 'inputFiles.I; 317 end ;319 end 318 320 call doCommand(CC CFLAGS' -Zdll -o 'dllFile defFile||gccCmdl' 'EXTRA_CFLAGS); 319 321 end … … 326 328 if (EXPORT_BY_ORDINALS) then 327 329 add_flags = '-ynd'; 328 call doCommand('lxlite -cs -t: -mrn -ml n'add_flags' 'dllFile);329 end ;330 call doCommand('lxlite -cs -t: -mrn -ml1 'add_flags' 'dllFile); 331 end 330 332 331 333 /* … … 397 399 else 398 400 _tmp_ = _tmp_' 'word(cmdLine, i); 399 end ;401 end 400 402 if (right(_tmp_, 1) = left(_tmp_, 1)) then 401 403 _tmp_ = substr(_tmp_, 2, length(_tmp_) - 2); 402 end ;404 end 403 405 return _tmp_; 404 406 … … 419 421 if (pos(noexport, line) > 0) then 420 422 return 0; 421 end ;423 end 422 424 return 1; 423 425 … … 453 455 call CleanUp; 454 456 exit rcCmd; 455 end ;457 end 456 458 drop _cmd_; /* prevent running out of memory... */ 457 459 return; … … 468 470 if (left(inputFiles.I, 1) = '!') then 469 471 Address CMD 'rm -rf' substr(inputFiles.I, 2); 470 end ;472 end 471 473 472 474 /*
Note:
See TracChangeset
for help on using the changeset viewer.