Method.st
changeset 3963 a1ebd82e368c
parent 3950 f9c4485a91d1
child 4014 e9040614767a
equal deleted inserted replaced
3962:c941b3a72553 3963:a1ebd82e368c
   330 
   330 
   331     "Modified: / 17.2.1998 / 14:50:00 / cg"
   331     "Modified: / 17.2.1998 / 14:50:00 / cg"
   332     "Modified: / 23.2.1998 / 10:26:08 / stefan"
   332     "Modified: / 23.2.1998 / 10:26:08 / stefan"
   333 !
   333 !
   334 
   334 
   335 decompiledSource
       
   336     |s|
       
   337 
       
   338     s := '' writeStream.
       
   339     self decompileTo:s.
       
   340     ^ s contents
       
   341 
       
   342     "Created: 3.7.1996 / 10:12:31 / cg"
       
   343 !
       
   344 
       
   345 flags
       
   346     "return the flags (number of method variables, stacksize etc.).
       
   347      Dont depend on the values in the flag field - its interpretations
       
   348      may change without notice."
       
   349 
       
   350     ^ flags
       
   351 
       
   352     "Modified: 8.3.1996 / 13:20:48 / cg"
       
   353 !
       
   354 
       
   355 getSource
   335 getSource
   356     "low-level access to the source instance-variable.
   336     "low-level access to the source instance-variable.
   357      This is NOT always the methods source string"
   337      This is NOT always the methods source string"
   358 
   338 
   359     ^ source
   339     ^ source
   365 
   345 
   366     source := aFileName.
   346     source := aFileName.
   367     sourcePosition := aNumber negated
   347     sourcePosition := aNumber negated
   368 
   348 
   369     "Created: 16.1.1997 / 01:25:52 / cg"
   349     "Created: 16.1.1997 / 01:25:52 / cg"
   370 !
       
   371 
       
   372 numberOfMethodArgs
       
   373     "return the number of arguments, the method expects.
       
   374      This method is left for backward compatibility - use #numArgs." 
       
   375 
       
   376     ^ self numArgs
       
   377 
       
   378     "Modified: 4.11.1996 / 21:42:08 / cg"
       
   379 !
       
   380 
       
   381 numberOfMethodVars
       
   382     "return the number of method local variables. 
       
   383      This method is left for backward compatibility - use #numVars." 
       
   384 
       
   385     ^ self numVars
       
   386 
       
   387     "Modified: 4.11.1996 / 21:42:21 / cg"
       
   388 !
   350 !
   389 
   351 
   390 package
   352 package
   391     "return the package-symbol"
   353     "return the package-symbol"
   392 
   354 
  1098 	aCopy source:(self source)
  1060 	aCopy source:(self source)
  1099     ].
  1061     ].
  1100     ^ aCopy
  1062     ^ aCopy
  1101 
  1063 
  1102     "Modified: 16.1.1997 / 01:27:25 / cg"
  1064     "Modified: 16.1.1997 / 01:27:25 / cg"
  1103 ! !
       
  1104 
       
  1105 !Method methodsFor:'debugging'!
       
  1106 
       
  1107 breakPointInProcess:aProcess
       
  1108     "arrange for a breakpoint-debugger to be opened when this method
       
  1109      is invoked from withn aProcess."
       
  1110 
       
  1111     MessageTracer trapMethod:self inProcess:aProcess.
       
  1112 
       
  1113     "Created: / 12.1.1998 / 18:21:10 / cg"
       
  1114     "Modified: / 12.1.1998 / 18:22:39 / cg"
       
  1115 !
       
  1116 
       
  1117 clearBreakPoint
       
  1118     "remove any break/trace-point on this method"
       
  1119 
       
  1120     MessageTracer unwrapMethod:self.
       
  1121 
       
  1122     "Created: / 11.1.1998 / 13:44:45 / cg"
       
  1123     "Modified: / 12.1.1998 / 18:22:14 / cg"
       
  1124 !
       
  1125 
       
  1126 isCounted
       
  1127     "obsolete - replaced by isCountinMemoryUsage"
       
  1128 
       
  1129     ^ MessageTracer notNil
       
  1130       and:[MessageTracer isCountingMemoryUsage:self]
       
  1131 
       
  1132     "Created: / 12.1.1998 / 19:05:24 / cg"
       
  1133     "Modified: / 27.7.1998 / 11:05:36 / cg"
       
  1134 !
       
  1135 
       
  1136 isCounting
       
  1137     "return true, if invokations of this method are counted"
       
  1138 
       
  1139     ^ MessageTracer notNil
       
  1140       and:[MessageTracer isCounting:self]
       
  1141 
       
  1142     "Modified: / 27.7.1998 / 11:06:00 / cg"
       
  1143 !
       
  1144 
       
  1145 isCountingMemoryUsage
       
  1146     "return true, if memory allocations done by this method (and callees)
       
  1147      are counted"
       
  1148 
       
  1149     ^ MessageTracer notNil
       
  1150       and:[MessageTracer isCountingMemoryUsage:self]
       
  1151 
       
  1152     "Created: / 12.1.1998 / 19:06:29 / cg"
       
  1153     "Modified: / 27.7.1998 / 11:06:23 / cg"
       
  1154 !
       
  1155 
       
  1156 resetCountingStatistics
       
  1157     "reset count statistics of the receiver"
       
  1158 
       
  1159     MessageTracer resetCountOfMethod:self
       
  1160 
       
  1161     "Modified: / 12.1.1998 / 18:24:30 / cg"
       
  1162     "Created: / 30.7.1998 / 17:40:09 / cg"
       
  1163 !
       
  1164 
       
  1165 resetMemoryUsageStatistics
       
  1166     "reset count statistics of the receiver"
       
  1167 
       
  1168     MessageTracer resetMemoryUsageOfMethod:self
       
  1169 
       
  1170     "Modified: / 12.1.1998 / 18:24:30 / cg"
       
  1171     "Created: / 30.7.1998 / 17:40:20 / cg"
       
  1172 !
       
  1173 
       
  1174 resetTimingStatistics
       
  1175     "reset timing statistics of the receiver"
       
  1176 
       
  1177     MessageTracer resetExecutionTimesOfMethod:self
       
  1178 
       
  1179     "Modified: / 12.1.1998 / 18:24:30 / cg"
       
  1180     "Created: / 30.7.1998 / 17:16:14 / cg"
       
  1181 !
       
  1182 
       
  1183 setBreakPoint
       
  1184     "arrange for a breakpoint-debugger to be opened when this method
       
  1185      is invoked."
       
  1186 
       
  1187     MessageTracer trapMethod:self.
       
  1188 
       
  1189     "Created: / 11.1.1998 / 13:59:16 / cg"
       
  1190     "Modified: / 12.1.1998 / 18:22:36 / cg"
       
  1191 !
       
  1192 
       
  1193 setTraceFullPoint
       
  1194     "arrange for a full-backtrace to be sent to the standard-error stream
       
  1195      when this method is invoked."
       
  1196 
       
  1197     MessageTracer traceMethodFull:self on:Transcript
       
  1198 
       
  1199     "Created: / 11.1.1998 / 14:02:43 / cg"
       
  1200     "Modified: / 12.1.1998 / 18:23:11 / cg"
       
  1201 !
       
  1202 
       
  1203 setTracePoint
       
  1204     "arrange for a trace-message to be sent to the standard-error stream
       
  1205      when this method is invoked."
       
  1206 
       
  1207     MessageTracer traceMethod:self on:Transcript
       
  1208 
       
  1209     "Created: / 11.1.1998 / 14:02:30 / cg"
       
  1210     "Modified: / 12.1.1998 / 18:23:23 / cg"
       
  1211 !
       
  1212 
       
  1213 setTraceSenderPoint
       
  1214     "arrange for a sender-trace-message to be sent to the standard-error stream
       
  1215      when this method is invoked."
       
  1216 
       
  1217     MessageTracer traceMethodSender:self on:Transcript
       
  1218 
       
  1219     "Created: / 11.1.1998 / 14:02:59 / cg"
       
  1220     "Modified: / 12.1.1998 / 18:23:31 / cg"
       
  1221 !
       
  1222 
       
  1223 startCounting
       
  1224     "start counting invokations of the receiver"
       
  1225 
       
  1226     MessageTracer countMethod:self
       
  1227 
       
  1228     "Created: / 11.1.1998 / 14:01:05 / cg"
       
  1229     "Modified: / 12.1.1998 / 18:23:45 / cg"
       
  1230 !
       
  1231 
       
  1232 startCountingMemoryUsage
       
  1233     "start counting memory usage of the receiver (and every callee)"
       
  1234 
       
  1235     MessageTracer countMemoryUsageOfMethod:self
       
  1236 
       
  1237     "Created: / 11.1.1998 / 14:01:19 / cg"
       
  1238     "Modified: / 27.7.1998 / 11:06:55 / cg"
       
  1239 !
       
  1240 
       
  1241 startTiming
       
  1242     "start timing the receiver"
       
  1243 
       
  1244     MessageTracer timeMethod:self
       
  1245 
       
  1246     "Created: / 11.1.1998 / 14:01:29 / cg"
       
  1247     "Modified: / 12.1.1998 / 18:24:05 / cg"
       
  1248 !
       
  1249 
       
  1250 stopCounting
       
  1251     "stop counting calls of the receiver"
       
  1252 
       
  1253     MessageTracer stopCountingMethod:self
       
  1254 
       
  1255     "Created: / 11.1.1998 / 14:01:45 / cg"
       
  1256     "Modified: / 12.1.1998 / 18:24:15 / cg"
       
  1257 !
       
  1258 
       
  1259 stopCountingMemoryUsage
       
  1260     "stop counting memory usage of the receiver"
       
  1261 
       
  1262     MessageTracer stopCountingMemoryUsageOfMethod:self
       
  1263 
       
  1264     "Created: / 11.1.1998 / 14:02:01 / cg"
       
  1265     "Modified: / 12.1.1998 / 18:24:22 / cg"
       
  1266 !
       
  1267 
       
  1268 stopTiming
       
  1269     "stop timing of the receiver"
       
  1270 
       
  1271     MessageTracer stopTimingMethod:self
       
  1272 
       
  1273     "Created: / 11.1.1998 / 14:02:14 / cg"
       
  1274     "Modified: / 12.1.1998 / 18:24:30 / cg"
       
  1275 ! !
  1065 ! !
  1276 
  1066 
  1277 !Method methodsFor:'error handling'!
  1067 !Method methodsFor:'error handling'!
  1278 
  1068 
  1279 invalidCodeObject
  1069 invalidCodeObject
  2580 ! !
  2370 ! !
  2581 
  2371 
  2582 !Method class methodsFor:'documentation'!
  2372 !Method class methodsFor:'documentation'!
  2583 
  2373 
  2584 version
  2374 version
  2585     ^ '$Header: /cvs/stx/stx/libbasic/Method.st,v 1.167 1998-12-29 16:56:57 cg Exp $'
  2375     ^ '$Header: /cvs/stx/stx/libbasic/Method.st,v 1.168 1999-01-30 14:02:21 cg Exp $'
  2586 ! !
  2376 ! !
  2587 Method initialize!
  2377 Method initialize!