Changeset 491
- Timestamp:
- Jun 22, 2010, 1:31:09 AM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified GPL/trunk/tools/wat2map.cmd ¶
r305 r491 1 /* $Id: wat2map.cmd,v 1. 1.1.1 2003/07/02 13:57:04 elephExp $ */2 3 /* SCCSID = %W% %E%*/1 /* $Id: wat2map.cmd,v 1.2 2002/04/26 23:09:44 smilcke Exp $ */ 2 3 /* SCCSID = src/dev/mme/pciaudio/wat2map.cmd, pciaudio, c.basedd 99/08/20 */ 4 4 /**************************************************************************** 5 5 * * … … 12 12 * * 13 13 ****************************************************************************/ 14 /**@internal %W% 14 15 /* 05 Jul 05 SHL - Correct do/end errors, close files 16 05 Jul 05 SHL - Partial 16/32 bit support (see f32bit) 17 */ 18 19 /**@internal src/dev/mme/pciaudio/wat2map.cmd, pciaudio, c.basedd 15 20 * WAT2MAP - translate symbol map from Watcom format to MS format. 16 * @version %I%21 * @version 1.1 17 22 * @context 18 23 * Unless otherwise noted, all interfaces are Ring-0, 16-bit, kernel stack. … … 47 52 /* <End of helpText> - don't modify this string - used to flag end of help. */ 48 53 /****************************************************************************/ 54 49 55 CALL RXFUNCADD 'sysloadfuncs','rexxutil','sysloadfuncs' 50 56 call sysloadfuncs 57 58 f32bit = 0 /* fixme to autodetect */ 51 59 52 60 Parse Arg arg1 arg2 rest … … 74 82 watcomText = LineIn( mapFile ) 75 83 Parse Value watcomText With "Executable Image: " fileName "." fileExt 76 77 84 If fileName <> "" Then Do; /* Found match */ 78 85 call lineout outfile ,' ' … … 103 110 104 111 /*--- 4. Translate segment table. ---*/ 105 call lineout outfile , " Start Length Name Class" 112 if f32bit then 113 call lineout outfile , " Start Length Name Class" 114 else 115 call lineout outfile , " Start Length Name Class" 116 106 117 Do While Lines( mapFile ) <> 0 107 118 watcomText = LineIn( mapFile ) 108 119 Parse Value watcomText With segName className groupName address size . 109 120 If segName = "" Then Leave; /* Empty line, break from loop. */ 110 length = Substr( size, 4, 5 ) || 'H ' 121 if f32bit then 122 length = size || 'H ' 123 else 124 length = Substr( size, 4, 5 ) || 'H ' 111 125 segName = Left( segName, 23 ) 112 126 call lineout outfile ,' ' || address || ' ' || length || segName || className … … 122 136 /* call lineout outfile ,' '*/ 123 137 124 Do While Lines( mapFile ) <> 0 125 watcomText = LineIn( mapFile ) 126 Parse Value watcomText With seg ':' ofs 10 . 16 declaration 138 LineTbl.0=0; 139 LineIX = 0; 140 Do While Lines( mapFile ) <> 0 141 watcomText = LineIn( mapFile ) 142 Parse Value watcomText With seg ':' ofs declaration 143 if length(ofs) = 5 then 144 ofs = left(ofs, 4) || strip(translate(right(ofs, 1),, '+*')) 145 if length(ofs) = 9 then 146 ofs = left(ofs, 8) || strip(translate(right(ofs, 1),, '+*')) 147 127 148 is_Adress = (is_Hex(seg) = 1) & (is_Hex(ofs) = 1) 128 149 If (is_Adress = 1) Then Do; 129 150 151 if \ f32bit then 152 ofs = right(ofs, 4) 153 130 154 /*--- Haven't done the work to xlate operator symbols - skip the line. */ 131 155 If Pos( '::operator', declaration ) <> 0 Then Iterate; … … 135 159 136 160 /*--- Strip array brackets if this is an array. */ 137 sqBracket = Pos( '[', declaration ) 161 sqBracket = Pos( '[', declaration ); 138 162 If sqBracket <> 0 139 163 Then declaration = Substr(declaration, 1, sqBracket-1); … … 141 165 /*--- Strip leading tokens from the function name. 142 166 Eg., remove function return type, near/far, etc. */ 143 declaration = Word( declaration, Words(declaration) ) 167 declaration = Word( declaration, Words(declaration) ); 144 168 145 169 /*--- Strip any remaining parens around function name. ---*/ 146 declaration = ReplaceSubstr( '(', ' ', declaration ) 147 declaration = ReplaceSubstr( ')', ' ', declaration ) 170 declaration = ReplaceSubstr( '(', ' ', declaration ); 171 declaration = ReplaceSubstr( ')', ' ', declaration ); 148 172 149 173 /*--- Debug kernel doesn't like symbol for scoping operator "::" 150 174 in symbol names. Replace :: with double underscore "__". ---*/ 151 declaration = ReplaceSubstr( '::', '__', declaration ) 175 declaration = ReplaceSubstr( '::', '__', declaration ); 152 176 153 177 /*--- Debug kernel doesn't like symbol for destructor "~" 154 178 in symbol names. Replace ~ with character "d" for "destructor. 155 179 Note destructor for a class will translate "A::~A" -> "A__dA". ---*/ 156 declaration = ReplaceSubstr( '~', 'd', declaration ) 157 158 call lineout outfile ,' ' || seg || ':' || ofs || ' ' || 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; 189 190 fill = copies(' ', 7) 191 LineIX = LineIX + 1; 192 LineTbl.LineIX = seg || ':' || ofs || fill || declaration; 193 LineTbl.0 = LineIX; 159 194 End; 160 195 End; /* End While through symbol section, end of input file. */ 196 197 /* Sort the data */ 198 do i=2 to LineTbl.0; 199 t=LineTbl.i; 200 do j=i-1 to 1 by -1 while t<LineTbl.j; 201 k=j+1; 202 LineTbl.k=LineTbl.j; 203 end; 204 j=j+1; 205 LineTbl.j=t; 206 end; 207 208 /* output the data */ 209 do LineIX = 1 to LineTbl.0; 210 call lineout outfile , ' ' || LineTbl.LineIX; 211 end; 212 213 call stream mapfile, 'C', 'CLOSE' 214 call lineout outfile 161 215 162 216 Return; /* End of program. */ … … 184 238 Return StripMatchedParen( string ) 185 239 End; 186 End; 240 187 241 188 242 ReplaceSubstr: … … 198 252 End; 199 253 Return string 200 End; 254 201 255 202 256 is_Hex: … … 204 258 Parse Arg string 205 259 Return (Length(string) > 0) & (Verify( string, '0123456789abcdefABCDEF' ) = 0) 206 End;
Note:
See TracChangeset
for help on using the changeset viewer.