Oleg-N-Cher / OfrontPlus

Oberon family of languages to C translator for ARM, x64 and x86 architectures
Other
55 stars 11 forks source link

Improving the convenience of defining bindings to external procedures #84

Closed Oleg-N-Cher closed 3 years ago

Oleg-N-Cher commented 4 years ago

Previously, we could:

PROCEDURE- [fastcall] oam_spr* (x, y, chrnum, attr, sprid: BYTE): BYTE;
PROCEDURE- OamSpr* (x, y, chrnum, attr, sprid: BYTE): BYTE
  "oam_spr(x, y, chrnum, attr, sprid)";

What caused the duplicate descriptions and a module interface to become clogged. Now it's time to allow this syntax (as it is implemented in BlackBox), where we can define the original C function's name as a tag after the Oberon name:

PROCEDURE [fastcall] OamSpr* ["oam_spr"] (x, y, chrnum, attr, sprid: BYTE): BYTE;

This is required to reduce the complexity of developing bindings, so as not to do extra work.

Oleg-N-Cher commented 4 years ago

A module's flags "foreign", "main" and "noinit" was added:

MODULE Mod [foreign]; <-- definition of interface on external library MODULE Mod [main]; <-- compile as main module, the same as option -m MODULE Mod [noinit]; <-- don't generate BEGIN section's body