Codegs

Codegs are a new feature of the Cyan language that makes the interaction between the language and the IDE. To work they need a plugin to the IDE. We have implemented one for Eclipse. This video shows how to install this plugin and how to use it. The demonstration of Codegs starts at time 7:20. Please follow the instructions below for instalation.

To install the Codeg plugin you will need the last version of the 64 bits Eclipse. Download it at www.eclipse.org. Please download the full zip file, not the installer (it may not work for unknown reasons).

Copy the plugin file to directory “dropins” of Eclipse. If “eclipse.exe” is in diretory “C:\tools”, there will be a directory “C:\tools\dropins”. Of course, rename the file, which has  a “.txt” extension, to “.jar”.

Download this zip file  and unzip it. Suppose it is in directory “C:\user”. There will be directories “C:\user\lib” and “C:\user\mimetex”.

Start the Eclipse and go to menu “Cyan\Cyan configuration”. Give the directory “C:\user\lib” as “Cyan library”, “C:\user\lib\javalib” as “Java library”, and “C:\user\mimetex” as “mimetex”.

 

Now choose “New project” in the Cyan menu. Type a name, say, “codegTest” (without the quotes). Then choose “New package”. Type “main”. Then choose “New prototype” and type “Program”. Copy the text of this file to the text editor of Eclipse — this will be the text of file “Program.cyan”. Be aware that the Cyan language demands that all statements of a method start at the same column. Except statements inside other statements.

 

Choose menu “Cyan\Compile and run”. There will be errors because the Codeg information has not been given. Hover the mouse over “@color”. A window will appear. If it does not appear, it may have opened in the background — just put Eclipse in the back to see the Codeg-color window. Choose a color and click on “Ok”. The next time you hover the mouse over “@color” the color you chose will be already selected. The other codegs work similarly.

 

The Codegs that have been made are:

color – to choose a color.

cmd – that opens a DOS prompt at a chosen directory.

batch – the allows one to type a DOS batch file, calls it and shows the results. This Codeg returns to the Cyan compiler the name of a file that should have been created by the batch file.

foundFile – choose a file name through a Windows-Explorer-like window.

image – choose an image through a Windows-Explorer-like window and show it.

latex – type a very simple Latex code with \sin \cos \sqrt. It will be translated to Cyan and the pdf will be shown in a Window. The Latex code will be saved to a user-chosen directory.

sound – record a sound.

The plugin and the Codegs were made by the master student André Cassulino Araújo Souza.