Ignore:
Timestamp:
Mar 24, 2008, 2:43:42 AM (17 years ago)
Author:
Paul Smedley
Message:

Update source to ALSA 1.0.16 level

File:
1 edited

Legend:

Unmodified
Added
Removed
  • GPL/branches/uniaud-2.0/tools/wat2map.cmd

    r293 r305  
    1 /*
    2  * Includes fixes from Helper script MapSym.cmd by Knut (aka bird).
    3  *
    4  * Copyright (c) 2002 knut st. osmundsen (bird@anduin.net)
    5  *
    6  * Project Odin Software License can be found in LICENSE.TXT
    7  *
    8  */
     1/* $Id: wat2map.cmd,v 1.1.1.1 2003/07/02 13:57:04 eleph Exp $ */
    92
    103/* SCCSID = %W% %E% */
     
    5447/* <End of helpText> - don't modify this string - used to flag end of help. */
    5548/****************************************************************************/
    56 
    57 Parse arg arg1 arg2
    58 
     49CALL RXFUNCADD 'sysloadfuncs','rexxutil','sysloadfuncs'
     50call sysloadfuncs
     51
     52Parse Arg arg1 arg2 rest
    5953If (Length( arg1 ) = 0) | (Verify( arg1, '/-?' ) = 0) Then Do;
    6054   Do i = 1 to 1000
     
    6357      Say helpText
    6458   End;
    65    Return 1
    66 End;
    67 
    68 If Length( arg2 ) == 0 Then Do;
     59   Return
     60End;
     61If Length( arg2 ) = 0 Then Do;
    6962   Say " Way to go Beaver... How about an out-put file name ?"
    70    Return 2
     63   Return
    7164End;
    7265mapFile = arg1          /* Can be Null, in which case we pull from stdin. */
    7366outFile = arg2
    74 fFlatMode = 0;
    7567
    7668/* erase outfile */  /* kill the old map file */
     
    8173Do While Lines( mapFile ) <> 0
    8274   watcomText = LineIn( mapFile )
    83    /*Parse Value watcomText With "Executable Image: " fileName "." fileExt*/
    84    Parse Value watcomText With "Executable Image: " sFilename
    85    If (sFilename <> '') Then Do;
    86       sFilename = filespec('name', sFilename);
    87       Parse Var sFilename fileName "." fileExt
    88       If fileName <> "" Then Do;   /* Found match */
    89          call lineout outfile ,' '
    90          call lineout outfile ,' ' || fileName
    91          call lineout outfile ,' '
    92          Leave;                    /* Break from loop. */
    93       End;
     75   Parse Value watcomText With "Executable Image: " fileName "." fileExt
     76
     77   If fileName <> "" Then Do;   /* Found match */
     78      call lineout outfile ,' '
     79      call lineout outfile ,' ' || fileName
     80      call lineout outfile ,' '
     81      Leave;                    /* Break from loop. */
    9482   End;
    9583End
    9684If Lines( mapFile ) = 0 Then Do;        /* If end of file ... */
    9785   Say "Error:  Expected to find line with text 'Executable Image:' "
    98    Return 3
     86   Return
    9987End
    10088
     
    10997If Lines( mapFile ) = 0 Then Do;        /* If end of file ... */
    11098   Say "Error:  Expected to find line with text 'Segments ... Size' "
    111    Return 4
    112 End
    113 
    114 
    115 junk = LineIn( mapFile )      /* Discard a couple lines of formatting. */
    116 junk = LineIn( mapFile )      /* Discard a couple lines of formatting. */
     99   Return
     100End
     101junk = LineIn( mapFile )       /* Discard a couple lines of formatting. */
     102junk = LineIn( mapFile )
     103
    117104/*--- 4.  Translate segment table.  ---*/
    118 /*"Segment                Class          Group          Address         Size"*/
    119 iClass = pos('Class', watcomText);
    120 iGroup = pos('Group', watcomText);
    121 iAddress = pos('Address', watcomText);
    122 iSize = pos('Size', watcomText);
    123 
    124 call lineout outfile , " Start         Length     Name                   Class"  /* bird bird bird fixed!!! */
    125 Do While Lines( mapFile ) <> 0
    126    watcomText = LineIn( mapFile )
    127    /* do it the hard way to make sure we support spaces segment names. */
    128    segName = strip(substr(watcomText, 1, iClass-1));
     105call lineout outfile , " Start     Length     Name                   Class"
     106Do While Lines( mapFile ) <> 0
     107   watcomText = LineIn( mapFile )
     108   Parse Value watcomText With segName className groupName address size .
    129109   If segName = "" Then Leave;          /* Empty line, break from loop. */
    130    className = strip(substr(watcomText, iClass, iGroup-iClass));
    131    groupName = strip(substr(watcomText, iGroup, iAddress-iGroup));
    132    address = strip(substr(watcomText, iAddress, iSize-iAddress));
    133    size = strip(substr(watcomText, iSize));
    134    if (pos(':', address) <= 0) then     /* NT binaries doesn't have a segment number. */
    135    do
    136       fFlatMode = 1;
    137       address = '0001:'||address;
    138    end
    139    length = right(strip(strip(size), 'L', '0'), 9, '0') || 'H     '
     110   length = Substr( size, 4, 5 ) || 'H     '
    140111   segName = Left( segName, 23 )
    141112   call lineout outfile ,' ' || address || ' ' || length || segName || className
     
    153124Do While Lines( mapFile ) <> 0
    154125   watcomText = LineIn( mapFile )
    155    Parse Value watcomText With seg ':' ofs 14 . 16 declaration
    156    if (fFlatMode) then
    157    do
    158       seg = '0001';
    159       Parse Value watcomText With ofs 9 . 16 declaration
    160    end
    161    else
    162    do  /* kso: more workarounds */
    163        if (is_Hex(seg) & length(ofs) > 4 & \is_Hex(substr(ofs,5,1))) then
    164            ofs = '0000'||left(ofs,4);
    165    end
    166    /*say ofs  '-'declaration*/
     126   Parse Value watcomText With seg ':' ofs 10 . 16 declaration
    167127   is_Adress = (is_Hex(seg) = 1) & (is_Hex(ofs) = 1)
    168    If ((is_Adress = 1) & (seg <> '0000')) Then Do;          /* bird: skip symbols with segment 0. (__DOSseg__) */
     128   If (is_Adress = 1) Then Do;
     129
    169130      /*--- Haven't done the work to xlate operator symbols - skip the line. */
    170131      If Pos( '::operator', declaration ) <> 0 Then Iterate;
     
    197158      call lineout outfile ,' ' || seg || ':' || ofs || '       ' || declaration
    198159   End;
    199 
    200    /* check for entry point, if found we add it and quit. */
    201    if (pos('Entry point address', watcomText) > 0) then
    202    do
    203        parse var watcomText 'Entry point address:' sEntryPoint
    204        if (pos(':', sEntryPoint) <= 0) then
    205            sEntryPoint = '0001:'||strip(sEntryPoint);
    206        call lineout outfile, ''
    207        call lineout outfile, 'Program entry point at' strip(sEntryPoint)
    208        leave;
    209    end
    210160End; /* End While through symbol section, end of input file. */
    211161
    212 call stream outfile, 'c', 'close';
    213 call stream mapfile, 'c', 'close';
    214 
    215 Return 0;  /* End of program.  */
     162Return;  /* End of program.  */
    216163
    217164/*--- Helper subroutines. ---*/
     
    237184      Return StripMatchedParen( string )
    238185   End;
    239 return;
     186End;
    240187
    241188ReplaceSubstr:
     
    251198   End;
    252199   Return string
    253 return;
     200End;
    254201
    255202is_Hex:
     
    257204   Parse Arg string
    258205   Return (Length(string) > 0) &  (Verify( string, '0123456789abcdefABCDEF' ) = 0)
    259 return;
     206End;
Note: See TracChangeset for help on using the changeset viewer.