Changeset 2993


Ignore:
Timestamp:
Apr 6, 2007, 8:44:12 PM (18 years ago)
Author:
bird
Message:

applied the remaining patch from Yuri.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • TabularUnified branches/libc-0.6/src/misc/dllar.cmd

    r2985 r2993  
    8989                i = i + 1;
    9090                outFile = word(cmdLine, i);
    91             end;
     91            end
    9292            when abbrev('def', substr(tmp, 2), 3) then
    9393                useDefFile = GetLongArg();
     
    126126                K = inputFiles.0;
    127127                inputFiles.K = files.J;
    128             end;
     128            end
    129129            else
    130130                files.0 = 0;
     
    133133                say 'ERROR: No file(s) found: "'tmp'"';
    134134                exit 8;
    135             end;
     135            end
    136136            drop files.;
    137         end;
    138     end; /* iterate cmdline words */
     137        end
     138    end /* iterate cmdline words */
    139139
    140140    if (flag_omf = 1) then
     
    149149        say 'dllar: no input files'
    150150        call PrintHelp;
    151     end;
     151    end
    152152
    153153    /*
     
    166166                call CleanUp;
    167167                exit 8;
    168             end;
     168            end
    169169
    170170            /* Prefix with '!' to indicate archive */
     
    172172            call doCommand('cd 'substr(inputFiles.I, 2)' && 'AR' x 'fullname);
    173173            call directory(curDir);
    174             rc = SysFileTree(substr(inputFiles.I, 2)'\*.o', 'files', 'FO');
     174            rc = SysFileTree(substr(inputFiles.I, 2)'\*.o*', 'files', 'FO');
    175175            if (rc = 0) then
    176176            do
    177177                inputFiles.0 = inputFiles.0 + 1;
    178178                K = inputFiles.0;
    179                 inputFiles.K = substr(inputFiles.I, 2)'/*.o';
     179                inputFiles.K = substr(inputFiles.I, 2)'/*.o*';
    180180                /* Remove all empty files from archive since emxexp will barf */
    181181                do J = 1 to files.0
    182182                    if (stream(files.J, 'C', 'QUERY SIZE') <= 32) then
    183183                        call SysFileDelete(files.J);
    184                 end;
     184                end
    185185                drop files.;
    186186            end
    187187            else
    188188                say 'WARNING: there are no files in archive "'substr(inputFiles.I, 2)'"';
    189         end;
    190     end;
     189        end
     190    end
    191191
    192192    /*
     
    196196        if (left(inputFiles.I, length(curDirS)) = curDirS) then
    197197            inputFiles.I = substr(inputFiles.I, length(curDirS) + 1);
    198     end;
     198    end
    199199
    200200    /*
     
    206206        do_backup = 1;
    207207        outFile = inputFiles.1;
    208     end;
     208    end
    209209
    210210    /* If its an archive, remove the '!' and the '$_' prefixes */
     
    217217        if ((ext = 'DLL') | (ext = 'O') | (ext = 'A')) then
    218218            outFile = substr(outFile, 1, dotpos - 1);
    219     end;
     219    end
    220220
    221221    EXTRA_CFLAGS = substr(EXTRA_CFLAGS, 2);
     
    227227
    228228    if (do_backup & stream(arcFile, 'C', 'query exists') \= '') then
     229    do
     230        '@del 'outFile'_s.a > NUL';
    229231        call doCommand('ren 'arcFile' 'outFile'_s.a');
    230 
    231    if useDefFile = '' then
    232    do
    233        /*
    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.0
    239            if (left(inputFiles.I, 1) \= '!') then
    240                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) then
    250            call lineOut defFile, 'DATA 'library_data;
    251        if (length(description) > 0) then
    252            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() > 0
    261            parse pull line;
    262            if (length(line) > 0) & (word(line, 1) \= ';') & (export_ok(line)) then
    263            do
    264                if (EXPORT_BY_ORDINALS) then
    265                do
    266                    iPos = pos(';', line);
    267                    if (iPos > 1) then
    268                        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    end
    281    else
    282    do
    283        defFile = useDefFile;
    284    end
     232    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
    285287
    286288
     
    298300    do I = 1 to inputFiles.0
    299301        if (left(inputFiles.I, 1) \= '!') then
    300             call charout sTmpFile, ' 'translate(inputFiles.I, '/', '\');;
    301     end;
     302            call charout sTmpFile, ' 'translate(inputFiles.I, '/', '\');
     303    end
    302304    call lineout sTmpFile, ' 'EXTRA_CFLAGS
    303305    call stream dsTmpFile, 'c', 'close'
     
    315317        if (left(inputFiles.I, 1) \= '!') then
    316318            gccCmdl = gccCmdl' 'inputFiles.I;
    317     end;
     319    end
    318320    call doCommand(CC CFLAGS' -Zdll -o 'dllFile defFile||gccCmdl' 'EXTRA_CFLAGS);
    319321end
     
    326328        if (EXPORT_BY_ORDINALS) then
    327329            add_flags = '-ynd';
    328         call doCommand('lxlite -cs -t: -mrn -mln 'add_flags' 'dllFile);
    329     end;
     330        call doCommand('lxlite -cs -t: -mrn -ml1 'add_flags' 'dllFile);
     331    end
    330332
    331333    /*
     
    397399            else
    398400                _tmp_ = _tmp_' 'word(cmdLine, i);
    399         end;
     401        end
    400402        if (right(_tmp_, 1) = left(_tmp_, 1)) then
    401403            _tmp_ = substr(_tmp_, 2, length(_tmp_) - 2);
    402     end;
     404    end
    403405return _tmp_;
    404406
     
    419421        if (pos(noexport, line) > 0) then
    420422            return 0;
    421     end;
     423    end
    422424return 1;
    423425
     
    453455        call CleanUp;
    454456        exit rcCmd;
    455     end;
     457    end
    456458    drop _cmd_;                            /* prevent running out of memory... */
    457459return;
     
    468470        if (left(inputFiles.I, 1) = '!') then
    469471            Address CMD 'rm -rf' substr(inputFiles.I, 2);
    470     end;
     472    end
    471473
    472474    /*
Note: See TracChangeset for help on using the changeset viewer.