Satimage Previous | Next
Making a code into an osax
Home Documentation Smile Computing Working with external codes Making a code into an osax  
osax is the nickname (Open Scripting Architecture eXtension) for a Scripting addition. A Scripting addition is a plug-in for AppleScript, that you can call from any script: an osax expands AppleScript's terminology.

Since an osax installs commands in AppleScript, the commands must return in little time: an osax is suitable for small codes with short running times, for instance a specific function.

  • Why make a code into a Scripting addition rather than a raw program?
    • it is little work,
    • your scripts can use your code in a much more legible way,
    • AppleScript's syntax supports complex types, optional parameters, parameters assuming possibly several types, prepositions. Passing structured data is more natural.
    See below an excerpt from an osax' dictionary.
    gegenbauerGegenbauer polynomials also known as ultraspherical polynomials
    real -- a real or an array of real
    index integer -- order of the function : an integer (≥0) or a range {i1,i2} (i1 and i2 integers)
    [parameter] anything -- parameter a > -1/2 (default 0)
    Result: real -- a real or an array of real
  • To make your code into an osax, you have to provide it with a dictionary, and you have to implement additional calls in your code to install your C or C++ handlers into the AppleScript terminology.

    For the instructions to make your code into an osax, download the sample code folder from the page below and use the SampleOsax project for XCode. The SampleOsax computes the famous fractal Mandelbrot-Julia set.
Version française
Copyright ©2009 Paris, Satimage