• Files
  • Threads
  • Codex
  • Geometry 2D
  • Properties

  • Arrays
  • Strings
  • Primitives
  • Exceptions
  • Time



Codex, Guildhall's scripting system

Codex is my name for Guildhall's script compiler. It uses a subset of C++ and its built-in access to Guildhall APIs to enable simple calculations, but eventually it will be fully integrated with Guildhall's IDE Contessa and enhanced to create applets with as much functionality as current C++ compiled applets have. For the time being it is only available as part of Terminus or by direct hand-coding for Guildhall development purposes. Here's what it looks like in Terminus.


Here's a breakdown of what's going on.

  • tgraph pretty // constructs the graphic "pretty", defaulting to empty
  • trect bounds // constructs a rectangle from (0,0) to (200,200)
  • tcolor rose // constructs an rgb color
  • tbundle rosefill // constructs a drawing bundle that will fill objects with rose
  • pretty.draw // draws 'bounds' to the graph 'pretty' with a rose fill color
  • draw(pretty) // a special built-in function draws the graph 'pretty' to the Terminus shell

> Terminus adds the graphic 'pretty' to its output stream

  • tstring hello // constructs a string from a utf-8 literal
  • tfont helv // constructs an Helvetica font with size 14 and no other styles
  • ttext world // the string 'hello', a location, and the font 'helv' are combined
  • ulong i // declares an unsigned, 32-bit integer
  • for loop // let's iterate for 10 times around a circle, 36 degrees at a time
  •     tmatrix m // declare a matrix, defaulting to identity
  •     m.rotateby // set 'm' to rotate by 36*i degrees about the origin
  •     m.translateby // then set 'm' to move to the center of the rectangle 'bounds'  
  •     pretty.draw // use 'm' to draw 'world' to 'pretty' in black fill
  • } // loop 9 more times
  • draw(pretty)

> Terminus adds the modified graphic 'pretty' to its output stream

This section of code did not have to include any headers because most of Guildhall's lower level APIs are pre-declared for Codex. Codex can define and call new functions but cannot yet declare new classes. There's always more work to be done. Codex is developed as part of Contessa. Future plans will be described there.

Notes

According to Wikipedia [Ada Lovelace], the image of the Contessa is a public domain watercolor portrait of Ada Lovelace by Alfred Edward Chalon around 1838. Only a portion of that work is used herein.

 

Copyright © 1981-2021 Arthur W Cabral. All Rights Reserved. All referenced trademarks are the property of their respective owners. This site does not use cookies. This site does not collect visitor information. The ISP hosting this site collects statistics regarding visitors to this site as part of the normal operation of the website. We do not currently examine those statistics. If that changes, this notice will change. Wikipedia is a trademark of the Wikimedia Foundation.