Crustacean of Bethany

From PigaLore
Jump to navigationJump to search

Crustacean of Bethany is a prospective project since July 14, 2019, to create a partial Gambas (BASIC) to Lazarus (Free Pascal) and vice versa converter tool for simple graphical user interface (GUI) programs. The name is an amalgam of crustacean (from gambas, which means prawns) and Lazarus of Bethany (the Biblical figure supposedly resurrected by Jesus Christ).

This would limitedly allow the creation of Free Pascal programs using of the powerful Gambas integrated development environment (IDE) for rapid application development (RAD), which are also cross-platform as opposed to Gambas' restriction to Unix-like systems. Development is intended to be incremental and bottom-up, with individual features ported over piece by piece as Graham L. Wilson learns how to use Lazarus.

Naturally, it will never be able to produce a 1-1 conversion as there will always be discrepancies in features between the two languages and toolkits; moderate to heavy manual tweaking will be necessary. Best results would ensue from keeping inter-operability in mind when designing the program to be converted.

IDE Notes[edit]

  • Code can be formatted in Lazarus by pressing Ctrl - D, while in Gambas it is done via Ctrl - Shift - F.

Syntax[edit]

BASIC / Visual Basic - Free Pascal / Object Pascal

  • += and -= and /= and *= can be enabled by adding the compiler directive {$COPERATORS ON} at the start

Differences[edit]

  • uses, type, var, and procedures must be defined in header
  • ' becomes // for comments while ' is used instead of " for strings
  • ; appended at the end of code lines for termination
  • begin opens procedures; end; closes procedures, end. closes units
  • := for assignments and = for comparison instead of = being interpreted by context
  • No x and y coordinate system properties; see Top and Left
  • Text property becomes Caption
  • Tag is a 64-bit integer, not a variant
  • TObject is the sender for event calls
  • Border is BorderStyle

Similarities[edit]

  • Top and Left properties are still the same
  • Visible property is still the same
  • Enabled property is still the same
  • Color property is still the same
  • Name property is still the same
  • Font property is still the same
  • Cursor property is still the same
  • Align property is still the same
  • Alignment property is still the same for text displays

Form Conversion[edit]

Duplicates for each control must be placed onto the new Lazarus form with matching names, however code generated from the Gambas form file will produce instructions to make them match the position, size, caption and other properties from the Gambas project. These are to be placed in the form creation procedure of the Lazarus Unit file (this could also be done manually if so desired...).

Class Conversion[edit]

The Class file will be read and converted as best as possible into a Unit file.

Procedure initialization:

Public Sub Form_Open()  

Becomes...

procedure TForm1.FormCreate(Sender: TObject);
begin

Or...

Public Sub Button1_Click()

Becomes...

procedure TForm1.Button1Click(Sender: TObject);
begin

Procedure termination:

End

Becomes...

End;

The code inside is then converted based on the essential syntactic differences between the languages.

Components And Controls[edit]

LCL Components - gb.gui / gb.qt4 / gb.form Controls

Standard tab[edit]

Additional tab[edit]

Misc tab[edit]

System tab[edit]

Common Controls tab[edit]

Other[edit]