[squeak-dev] Will Newspeak be callable by external programs?

askoh askoh at askoh.com
Tue Feb 17 04:44:09 UTC 2009


Below is the explanation of the C# program in condensed form for easier
understanding.
Thanks,
Aik-Siong Koh
---------------------------------
Start the Smalltalk COM Server and returns aCADSMClass intance to C#.
A corresponding aStCADSM object exists in Smalltalk.
    CADSMClass aCADSMClass = new CADSMClass();
Create aStAssembly in Smalltalk and link that to aAssembly in C#.
Send some string and double array values to aAssembly to pass over to
aStAssembly.
aStAssembly is contained in aStCADSM.
    CSMAssembly aAssembly = (CSMAssembly)aCADSMClass.AddAssembly();
    ...
Create aStAssemblyMarker in Smalltalk and link that to aGlobalOriginMarker
in C#.
aStAssemblyMarker is contained in aStAssembly.
Send some string and double array values to aGlobalOriginMarker to pass over
to aStAssemblyMarker.
    CSMMarker aGlobalOriginMarker = (CSMMarker)aAssembly.AddMarker();
    ...
Create aStPart in Smalltalk and link that to aPendulumBlock in C#.
aStPart is contained in aStAssembly.
Send some string and double array values to aPendulumBlock to pass over to
aStPart.
    CSMPart aPendulumBlock = (CSMPart)aAssembly.AddPart();
    ...
Create aStPartMarker in Smalltalk and link that to aPendulumBlockJointMarker
in C#.
aStPartMarker is contained in aStPart.
Send some string and double array values to aPendulumBlockJointMarker to
pass over to aStPartMarker.
    CSMMarker aPendulumBlockJointMarker =
(CSMMarker)aPendulumBlock.AddMarker();
    ...
Create aStCylindricalJoint in Smalltalk and link that to aCylindricalJoint
in C#.
aStCylindricalJoint is contained in aStAssembly.
Pass the fullname of aGlobalOriginMarker so that aStCylindricalJoint will
set aStAssemblyMarker as the Ith marker of aStCylindricalJoint.
Pass the fullname of aPendulumBlockJointMarker so that aStCylindricalJoint
will set aStPartMarker as the Jth marker of aStCylindricalJoint.
    CSMCylindricalJoint aCylindricalJoint =
(CSMCylindricalJoint)aAssembly.AddCylindricalJoint();
      aCylindricalJoint.MarkerI = aGlobalOriginMarker.FullName();
      aCylindricalJoint.MarkerJ = aPendulumBlockJointMarker.FullName();
Create aStRotationalMotion in Smalltalk and link that to aMotion1 in C#.
aStRotationalMotion is contained in aStAssembly.
Set the equation string for the aStRotationalMotion.
    CSMRotationalMotion aMotion1 =
(CSMRotationalMotion)aCylindricalJoint.AddRotation();
      aMotion1.Rotation = "2.0*pi*time";
Create aStSimulationParameters in Smalltalk and link that to aSimulation in
C#.
aStSimulationParameters is contained in aStAssembly.
Send some numerical values to aSimulation to pass over to
aStSimulationParameters.
    CSMSimulation aSimulation =
(CSMSimulation)aAssembly.SimulationParameters();
    ...
Start the dynamic simulation of aStAssembly in aStCADSM. This runs in a
separate process from the COM interface process.
    aCADSMClass.StartDynamic();
While the simulation is running aCADSMClass can interrogate if an output
frame is ready in the Smalltalk side. If so, aPendulumBlock asks for the
simulation output of aStPart sent to it in C# as an array of doubles. The
array is accumulated on the C# side for use later or immediately.
    short iFrame = 1;
    while (iFrame <= aNoOfFrames)
    {        
        if (aCADSMClass.CheckFrame(iFrame))
        {    
         Array temp_frameArray = new double[28];        
         temp_frameArray = (Array)aPendulumBlock.Pos4by4VelAccData(iFrame);
         AllFramesTransformArray.SetValue(temp_frameArray, iFrame-1);
    iFrame++;
        }        
    }
When done, quit the COM server and C# can continue without any Smalltalk
running.
    aCADSMClass.quit()



-- 
View this message in context: http://www.nabble.com/Will-Newspeak-be-callable-by-external-programs--tp21896396p22050677.html
Sent from the Squeak - Dev mailing list archive at Nabble.com.




More information about the Squeak-dev mailing list