Changeset 490


Ignore:
Timestamp:
Jun 22, 2010, 1:27:23 AM (15 years ago)
Author:
David Azarewicz
Message:

Fixed missing symbols, sorted output, etc.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • OCO/trunk/tools/wat2map.cmd

    r89 r490  
    136136/* call lineout outfile ,' '*/
    137137
     138LineTbl.0=0;
     139LineIX = 0;
    138140Do While Lines( mapFile ) <> 0
    139141   watcomText = LineIn( mapFile )
    140142   Parse Value watcomText With seg ':' ofs declaration
     143   if length(ofs) = 5 then
     144     ofs = left(ofs, 4) || strip(translate(right(ofs, 1),, '+*'))
    141145   if length(ofs) = 9 then
    142146     ofs = left(ofs, 8) || strip(translate(right(ofs, 1),, '+*'))
     
    155159
    156160      /*--- Strip array brackets if this is an array. */
    157       sqBracket = Pos( '[', declaration )
     161      sqBracket = Pos( '[', declaration );
    158162      If sqBracket <> 0
    159163         Then declaration = Substr(declaration, 1, sqBracket-1);
     
    161165      /*--- Strip leading tokens from the function name.
    162166         Eg., remove function return type, near/far, etc.  */
    163       declaration = Word( declaration, Words(declaration) )
     167      declaration = Word( declaration, Words(declaration) );
    164168
    165169      /*--- Strip any remaining parens around function name. ---*/
    166       declaration = ReplaceSubstr( '(', ' ', declaration )
    167       declaration = ReplaceSubstr( ')', ' ', declaration )
     170      declaration = ReplaceSubstr( '(', ' ', declaration );
     171      declaration = ReplaceSubstr( ')', ' ', declaration );
    168172
    169173      /*--- Debug kernel doesn't like symbol for scoping operator "::"
    170174         in symbol names.  Replace :: with double underscore "__". ---*/
    171       declaration = ReplaceSubstr( '::', '__', declaration )
     175      declaration = ReplaceSubstr( '::', '__', declaration );
    172176
    173177      /*--- Debug kernel doesn't like symbol for destructor "~"
    174178         in symbol names.  Replace ~ with character "d" for "destructor.
    175179         Note destructor for a class will translate "A::~A" -> "A__dA". ---*/
    176       declaration = ReplaceSubstr( '~', 'd', declaration )
     180      declaration = ReplaceSubstr( '~', 'd', declaration );
     181
     182      /* remove any trailing underscore */
     183      declaration = STRIP(declaration, 't', '_');
     184
     185      /* remove the first underscore (if any) */
     186      if (LEFT(declaration,1) = '_') then do;
     187        declaration = RIGHT(declaration, LENGTH(declaration)-1);
     188      end;
    177189
    178190      fill = copies(' ', 7)
    179       call lineout outfile ,' ' || seg || ':' || ofs || fill || declaration
     191      LineIX = LineIX + 1;
     192      LineTbl.LineIX = seg || ':' || ofs || fill || declaration;
     193      LineTbl.0 = LineIX;
    180194   End;
    181195End; /* End While through symbol section, end of input file. */
     196
     197
     198/* Sort the data */
     199do i=2 to LineTbl.0
     200   t=LineTbl.i
     201   do j=i-1 to 1 by -1 while t<LineTbl.j
     202      k=j+1
     203      LineTbl.k=LineTbl.j
     204   end
     205   j=j+1
     206   LineTbl.j=t
     207end
     208
     209/* output the data */
     210do LineIX = 1 to LineTbl.0;
     211  call lineout outfile , ' ' || LineTbl.LineIX;
     212end;
    182213
    183214call stream mapfile, 'C', 'CLOSE'
Note: See TracChangeset for help on using the changeset viewer.