Block.st
changeset 5766 64d22218e98b
parent 5744 229241968e2a
child 5767 b98740fd49cc
equal deleted inserted replaced
5765:152a485288d9 5766:64d22218e98b
   320 
   320 
   321 byteCode:bCode numArgs:numArgs numStack:nStack sourcePosition:sourcePos initialPC:initialPC literals:literals
   321 byteCode:bCode numArgs:numArgs numStack:nStack sourcePosition:sourcePos initialPC:initialPC literals:literals
   322     "create a new cheap (homeless) block.
   322     "create a new cheap (homeless) block.
   323      Not for public use - this is a special hook for the compiler."
   323      Not for public use - this is a special hook for the compiler."
   324 
   324 
       
   325     ^ self
       
   326         byteCode:bCode numArgs:numArgs numVars:0 numStack:nStack sourcePosition:sourcePos initialPC:initialPC literals:literals
       
   327 !
       
   328 
       
   329 byteCode:bCode numArgs:numArgs numVars:numVars numStack:nStack sourcePosition:sourcePos initialPC:initialPC literals:literals
       
   330     "create a new cheap (homeless) block.
       
   331      Not for public use - this is a special hook for the compiler."
       
   332 
   325     |newBlock|
   333     |newBlock|
   326 
   334 
   327     newBlock := (super basicNew:(literals size)) 
   335     newBlock := (super basicNew:(literals size)) 
   328                            byteCode:bCode
   336                            byteCode:bCode
   329                            numArgs:numArgs
   337                            numArgs:numArgs
       
   338                            numVars:numVars
   330                            numStack:nStack
   339                            numStack:nStack
   331                      sourcePosition:sourcePos
   340                      sourcePosition:sourcePos
   332                           initialPC:initialPC
   341                           initialPC:initialPC
   333                            literals:literals.
   342                            literals:literals.
   334     ^ newBlock
   343     ^ newBlock
   360     ^ self == Block
   369     ^ self == Block
   361 
   370 
   362     "Modified: 23.4.1996 / 15:55:58 / cg"
   371     "Modified: 23.4.1996 / 15:55:58 / cg"
   363 ! !
   372 ! !
   364 
   373 
       
   374 !Block methodsFor:'Camp Smalltalk'!
       
   375 
       
   376 sunitEnsure: aBlock 
       
   377 	^self valueNowOrOnUnwindDo: aBlock
       
   378 
       
   379     "Created: / 20.6.2000 / 11:59:32 / Sames"
       
   380     "Modified: / 20.6.2000 / 12:27:10 / Sames"
       
   381 !
       
   382 
       
   383 sunitOn: aSignal do: anExceptionBlock 
       
   384 	^self on: aSignal do: anExceptionBlock
       
   385 
       
   386     "Created: / 20.6.2000 / 12:27:57 / Sames"
       
   387 ! !
   365 
   388 
   366 !Block methodsFor:'Compatibility - ANSI'!
   389 !Block methodsFor:'Compatibility - ANSI'!
   367 
   390 
   368 ensure:aBlock
   391 ensure:aBlock
   369     "evaluate the receiver and return its result.
   392     "evaluate the receiver and return its result.
  1457 
  1480 
  1458 ! !
  1481 ! !
  1459 
  1482 
  1460 !Block methodsFor:'private accessing'!
  1483 !Block methodsFor:'private accessing'!
  1461 
  1484 
  1462 byteCode:bCode numArgs:numArgs numStack:numStack sourcePosition:srcPos initialPC:iPC literals:lits
  1485 byteCode:bCode numArgs:numArgs numVars:numVars  numStack:numStack sourcePosition:srcPos initialPC:iPC literals:lits
  1463     "set all relevant internals.
  1486     "set all relevant internals.
  1464      DANGER ALERT: this interface is strictly private."
  1487      DANGER ALERT: this interface is strictly private."
  1465 
  1488 
  1466     byteCode := bCode.
  1489     byteCode := bCode.
  1467     nargs := numArgs.
  1490     nargs := numArgs.
  1468     sourcePos := srcPos.
  1491     sourcePos := srcPos.
  1469     initialPC := iPC.
  1492     initialPC := iPC.
  1470     flags := 0.
  1493     flags := 0.
  1471     self stackSize:numStack.
  1494     self stackSize:numStack.
  1472     self literals:lits.
  1495     self literals:lits.
       
  1496     self numberOfArgs:numArgs.   "/ must set the compiledCode flags as well
       
  1497     self numberOfVars:numVars.   "/ must set the compiledCode flags as well
  1473 
  1498 
  1474     "Modified: 23.4.1996 / 16:05:30 / cg"
  1499     "Modified: 23.4.1996 / 16:05:30 / cg"
  1475     "Modified: 24.6.1996 / 12:37:37 / stefan"
  1500     "Modified: 24.6.1996 / 12:37:37 / stefan"
  1476     "Created: 13.4.1997 / 00:00:57 / cg"
  1501     "Created: 13.4.1997 / 00:00:57 / cg"
  1477 !
  1502 !
  1759 ! !
  1784 ! !
  1760 
  1785 
  1761 !Block class methodsFor:'documentation'!
  1786 !Block class methodsFor:'documentation'!
  1762 
  1787 
  1763 version
  1788 version
  1764     ^ '$Header: /cvs/stx/stx/libbasic/Block.st,v 1.98 2000-12-13 13:15:00 cg Exp $'
  1789     ^ '$Header: /cvs/stx/stx/libbasic/Block.st,v 1.99 2000-12-19 23:24:08 cg Exp $'
  1765 ! !
  1790 ! !
  1766 Block initialize!
  1791 Block initialize!