MediaWiki:Blocklink

From askoh.net wiki

Jump to: navigation, search

Draw a clear line separating input and Squeak interpret (inclusive of GC). From embedded Squeak, Smalltalk code send in as String. Which part of code responsible to take in command line and interpret? How SqueakVM interpret character String then execute? primitiveResponse() normalSend()

Contents

VS Embedded Squeak

Documentation of Visual Studio build of Embedded Squeak. If you want to play with it immediately, get it here. Otherwise, follow instruction below to build a VS Embedded Squeak.

Setup

  • Open-up Visual Studio (VC 2008 Express), choose Visual C++ Empty Project, create new project named EmbeddedSqueak. Set location to "MyRoot\Projects", in my case "C:\Smalltalk\Squeak\3.2(embedded)\SqueakEmbedded\VS2008\Projects". Uncheck Create directory for solution.
  • Close the solution. Cut EmbeddedSqueak.sln and EmbeddedSqueak.ncb from "MyRoot\Projects\EmbeddedSqueak", and paste it at "MyRoot".
  • Open up EmbeddedSqueak.sln, ignore pop-up warnings. Right-click on EmbeddedSqueak(unavailable), remove it. At File -> Add -> Existing Projects..., go into "MyRoot\Projects\EmbeddedSqueak" and add EmbeddedSqueak.vcproj.
  • Steps above done to achieve directory-tree of desire.

Building

  1. Download Embedded Squeak.
  2. Create a directory under "MyRoot", name it "Source". Extract EmbeddedSqueak zip into "MyRoot\Source".
  3. Right-click on the project name, choose Add -> Existing item.., add the following .h and .c files to the project.
    1. ImageFileInMemory.c
    2. interp.c
    3. sqMiscPrims.c
    4. sqEmbedded.c
    5. sqFilePrims.c
    6. sqWin32.h
    7. sq.h
    8. sqConfig.h
    9. sqMachDep.h
    10. sqPlatformSpecific.h
  4. Right-click on project name, choose Properties. Under Configuration Properties -> C/C++ -> Preprocessor -> Preprocessor Definitions, fill in WIN32;_DEBUG;_WINDOWS;__i386__;_CRT_SECURE_NO_DEPRECATE;VM_NAME=\"Squeak\";_USE_32BIT_TIME_T;EMBEDDED.
  5. Now, build can be successfully carried out. But, trying to debug will cause runtime error. Error message: The variable 'result' is being used without being initialized. Edit line 6697 in interp.c, i.e. int result = 0;. Do the same for any similar error pops up.
  6. Build the project, and debug it. Type in Smalltalk expression, e.g. 0.1234 class, returns Float.

I/O Primitive

Primitives with index 90 through 105.

  • primitiveMousePoint
  • primitiveCursorLocPut(primitiveFail)
  • primitiveCursorLink(primitiveFail)
  • primitiveInputSemaphore
  • primitiveSampleInterval(primitiveFail)
  • primitiveInputWord
  • primitiveCopyBits
  • primitiveSnapshot
  • primitiveTimeWordsInto(primitiveFail)
  • primitiveTickWordsInto(primitiveFail)
  • primitiveSignalAtTick(primitiveFail)
  • primitiveBeCursor
  • primitiveBeDisplay
  • primitiveScanCharacters
  • primitiveDrawLoop
  • primitiveStringReplace


  • primitiveStringReplace

Call stack: main() -> interpret() 'case131' -> normalSend() -> sendSelectorToClass() -> executeNewMethod() -> primitiveResponse() 'case105'

sqEmbedded.c

Include minimal support code for Embedded Squeak system. Most primitives were stubbed out. Image processing

sqFilePrims.c

File I/O is not available in Embedded Squeak, since no image will be read(image is embedded into Squeak). Most functions were stubbed out, since they are useless to Embedded Squeak. Image is read as an array in memory.

sqMiscPrims.c

Personal tools
Navigation