New Clarion language features

Some exciting new features in the Clarion language will be introduced in the next build for C11: Reference variables of Procedure types are supported by the compiler, and corresponding support is added to the linker and RTL.

Declaration of a Procedure reference

A reference variable of a procedural type is declared as follows:

Ref &<procedure label>

where <procedure label> is the label of a previously declared Procedure, a parameter of procedural type, or the label of a method in a CLASS or INTERFACE. If there is more than one Procedure or Class/Interface method with the label (for example, a class method is overloaded), or there is a data declaration with the same label in the current scope/context, the compiler returns an error.

A previous MAP structure must contain the corresponding Procedure type declaration to allow references to a Class or Interface method:

  MAP 
    MethodNameType  PROCEDURE (*ClassId, <other parameters>),...,TYPE       
  END

Ref   &MethodNameType

We’re also considering a possible extension in the future is to allow the <procedure label> to include the Class or Interface identifier as part of the declaration, for example:
Ref &ClassId.MethodName

2. Procedure Reference assignments

The reference assignment to a reference variable of procedural type has the same form as for any other reference assignment:

RefVar &= <source>

For reference assignments to reference variables of procedural types the right-hand side can be any one of the following:

1) NULL
2) an expression where the value can be converted to a LONG type
3) the label of a reference variable of procedural type
4) the label of a parameter of procedural type
5) the label of a Procedure declared in a MAP structure
6) the label of a Class method

For (3),(4) and (5) the profile of a Procedure, or a procedural type on the right hand side must be exactly the same as the profile of the procedural type used in the declaration of the reference variable on the left hand side:

meaning it must match the number of, the types of parameters, the return type, and the calling convention. (or both sides can have no return type)

For (6) if the method label on the right side is overloaded, the compiler tries to find the method with the most suitable profile. In this case “suitable” means that the first parameter (class type) on the right side can also be of a type which is a descendant
of the class type of the first parameter in the profile of the reference variable’s type. All other parameters, their order, return type, and the calling convention must be exactly the same.

The identifier on the right side can include:

  • the label of an instance of a class type, or the label of an interface
  • the label of a reference variable assigned to a class type
  • the label of a reference variable assigned to an interface type
  • the SELF or PARENT keywords
  • the label of a Class type

For example:

CType    CLASS,TYPE
M          PROCEDURE (LONG),LONG,PASCAL,VIRTUAL
         END

         MAP
PType     PROCEDURE (*CType, LONG),LONG,PASCAL
         END

R1       &PType
R2       &MESSAGE  ! the MESSAGE - built-in function
RC       &CType
AClass   CType

  CODE

  RC &= AClass
  R1 &= NULL
  R1 &= AClass.M
  R1 &= RC.M
  R1 &= CType.M
  R2 &= 0 + SYSTEM {PROP:MessageHook}

3. Reference equality operator

The reference equality operator for the reference variable of a procedural type has the same form as for any other reference variables:

Ref &= <right side>

If the left side of the reference equality operator is a reference variable of procedural type,
the <right side> can be of any form as the <source> described above in the “Procedure Reference Assignments” section.

There is one exception for this: if the <right side> is a label of a Class/Interface method, and this label is overloaded, the compiler reports an error; “Error: Ambiguous reference type“, rather than trying to choose the intended matching variation of the method.

4. Usage

A Reference variable of a procedural type can be used in any context where procedures/functions with the same profiles are valid:

  • call statements
  • a parameter of a procedural type
  • the Sort function parameter in QUEUE statements ADD, GET, PUT and SORT
  • as a parameter of the ADDRESS function
  • as a parameter of the BIND statement

Probably the most typical variations of usage for procedural type references are:

  • Calling DLL functions from addresses returned by the Windows API’s GetProcAddress function
  • SYSTEM hooks properties are no longer write-only in the upcoming RTL release. The result of getting these properties are RTL internal functions implementing corresponding statements:
    MESSAGE, COLORDIALOG, FONTDIALOG and other standard dialogs,
    OPEN for Windows and Reports, CLOSE for Windows and Reports, changing SYSTEM properties, etc.

    This means your program can retrieve the RTL’s hook function and replace it with your own function, which calls the original RTL code internally
  • Simulation of virtual functions in cases where the actual function can be changed at run time.

5. Some General info

  • Reference variables of procedural type can be declared as a field in GROUP/QUEUE/CLASS declarations
  • The DIM attribute is currently invalid for declarations of reference variables, and that same rule applies for reference variables of procedural types.
  • The ADDRESS function supports Class type labels in the identifiers of methods passed as parameters, for example, using the declarations from the example above the following expression:

    ADDRESS (CType.M)

    is valid in the upcoming release.

The new language enhancements can be likened to a pointer-to-method, and reference-to-method in C++. But in C++ a special syntax is used to allow the compiler and linker to handle these language constructs properly. No special syntax is required in Clarion.


TYPEd Class Methods

Another powerful language enhancement available in the upcoming release is support for TYPEd Class methods. I’ll be making a separate post on typed Class methods with an example of usage.

News Server partially down

Just wanted to let our users know that we are aware the News server is partially down, the cause is a major issue at Rackspace:

“UPDATE:
12 June 2020, 12:50 CDT

Between 10 June 2020, at 09:11 CDT, and 12 June 2020, at 04:15 CDT, a subset of Cloud Servers customers in the ORD Region may have experienced network degradation. Customers may have experienced timeouts and errors when attempting to connect to devices or perform management actions. Network Operations and Cloud Server engineers worked with the vendor to reconfigure the affected devices and mitigate impact for the majority of customer devices. It is possible that some customers may still experience issues with their affected Cloud Server.”

We were initially told it would likely be resolved in a few hours, but it hasn’t happened yet. The issue is port access, we were told any ports >1024 cannot be accessed until the problem is fixed. That means you can’t use the dBabble client (it runs on port 8132), but you can use an NNTP client (runs on port 119)

C11 update released

Today we are releasing an update for C11. This is a maintenance release with some important fixes and changes, some improvements, and some new features. We’ve added support for the latest ODBC interfaces from Microsoft to the MSSQL driver, added support for the OPT attribute on SQL keys, and optimized the SQL drivers such that setting a filter with INLIST gets converted to “var IN (field, field, …) rather than evaluating the field locally. We’ve also made BUFFER more efficient across all SQL drivers.

But the biggest new “feature” in this release, is that we have integrated the Developer edition of AnyScreen into both EE and PE. AnyScreen is our newest tool for making your Clarion app available for web and mobile devices. The integration allows all Clarion devs the opportunity to see their application running in a Browser. The only restriction in the AnyScreen developer edition is that you can only connect via the local server. If you are interested to see how your app looks when running in a Browser check this post for the details on how to get it running (its very easy).

To review all the changes in this release please check the readme file here

Clarion AnyScreen

AnyScreen is our next generation product for deploying Clarion a application as a web/mobile app. With the addition of AnyScreen your existing Clarion application immediately becomes available on Windows, Mac OS, Linux, iOS, and Android. In other words, it allows your Clarion application to run on any Workstation, Notebook, Tablet or Mobile device.

AnyScreen accomplishes this without you making any changes to your apps (except adding the global template to all the .APPs that make up your application). You also don’t need to know any JavaScript or CSS. It is worth mentioning that AnyScreen ships with several CSS “Themes”, such as; Clarion theme (mirrors the Windows UI), Material UI (Android look-alike), Bootstrap, and Bootstrap ‘outline’. All of these can be tweaked and customized. You also get the built-in support to create totally new CSS themes.

As a developer you don’t need to know JavaScript or CSS, and when you deploy your app using AnyScreen for web/mobile, the end-users of your application won’t need any retraining, because although your application is now running in a Browser, your app UI is replicated exactly like they were running it on their desktop. AnyScreen brings you multi-window support within the Browser. So end-users can open multiple Browses, Forms, Reports, Processes, and any other Windows, and switch between them with a mouse click or a touch to the screen — exactly as they would on their desktop. Here is a screenshot showing what I’m describing:

an AnyScreen app running on Firefox with multiple active windows

For Reports, AnyScreen automatically redirects output to a PDF, and opens the report in a new Browser tab where it can be viewed, saved or printed.

Menus get transformed into a web/mobile friendly React menu with some free extra features to expand or contract all, plus a search function, like these:

AnyScreen is the result of a collaboration between SoftVelocity and Ris – the makers of the thin@ product. Our goals for the project were to develop a system that allows Clarion apps to run as web/mobile apps on any device that can run a modern web Browser, without any changes to the app needed, without requiring any knowledge of JavaScript or HTML5/CSS, retaining all the functionality of the desktop app, and importantly – to run as fast as the desktop application.

The underlying technology in the AnyScreen Server has been in production, supporting hundreds of simultaneous users for several years. The new HTML5 client has been used in a production app, supporting more than 100 users for several months. This is proven tech that has been field-tested in a production application and has delivered great results in performance and stability.

If you want to test your application with AnyScreen follow these steps:

  • Register the AnyScreen.tpl (if you installed C11.13505 into a new folder the template should be already registered. If you installed into an existing Clarion folder then you need to register it)
  • open your APP and add the AnyScreen Global Extension. Do this for all the APPs that are part of your application.
  • Use the Applications Pad to Generate and Make all applications – “Generate and Build All” menu option
  • click the “Run with AnyScreen HTML5” toolbar button
Toolbar button to run in default Browser

You can access the AnyScreen documentation from the AnyScreen drop menu:

AnyScreen Key Features


  • Cross-platform HTML5 architecture that works in all modern browsers
  • Very stable working environment
  • Runs as fast as a desktop application
  • Runs on Windows, Linux, Mac, iOS and Android
  • Identical user interface as in your original application including pictures, icons, menus and all Clarion control types
  • Support for complex ActiveX components (WindowsAPI client only)
  • Support for a number of popular Clarion 3rd party products
  • Multi-threaded application support (allows a multi-window environment inside the web browser)
  • Auto-reconnect option – if you lose your internet connection, or something happens with your network, the client will automatically try to reconnect, and as soon as the network is back you can continue your work without any additional actions.
  • Balanced application load on multiple servers
  • Option to support SaaS (Software as a Service) maturity level 4 support: usage-based billing calculation algorithms integrated into the server allowing you to charge by usage time
  • Add the AnyScreen template to all your .app’s, recompile, and you’re ready to deploy
  • No JavaScript knowledge required
  • Scalable: one server can support ~175+ users (depending on the size of your application)
  • Hand-coded programs require only 2 lines of code to be deployed as a web application

When you decide to put your application on to a production server head over to our shop site and start your subscription!

Here’s some information on the AnyScreen clients.

AnyScreen client options

There are three client options: the new HTML5 client (highly recommended), the WinAPI client, and the Java client.

AnyScreen HTML5 Client

The AnyScreen HTML5 client is written in JavaScript. It makes a Clarion application available to run within any modern web browser on the most common platforms; Windows, Linux, Mac, Android and iOS.

Under the covers AnyScreen uses the ReactJS library to render the applications User Interface (ReactJS is a very popular open source project sponsored by Facebook). And ReactJS + HTML5 makes your application available to run on any system with a modern web browser. The AnyScreen HTML5 Client can also be run as an PWA (Progressive Web Application).

AnyScreen HTML5 is the recommended client to deploy your applications, and is the focus for our future development.

AnyScreen WinApi Client

The AnyScreen WinApi Client is written in Clarion and uses the Windows API to draw the user interface. The AnyScreen WinApi client of course only runs on the Windows platform.

The WinApi client code is open-source. That means any Clarion programmer can modify and recompile the client to suit their own unique needs. For example, you could write interfaces to external devices (scanners, plotters etc.), add custom support for 3rd party products etc.

AnyScreen Java Client

The AnyScreen Java Client is written in Java SE. It makes Clarion applications available inside (and outside) a web browser and on various platforms, including Windows, Linux and Mac.

It uses the Java SE Swing library to render the application User Interface. It can run on any hardware that supports the Java Virtual Machine (JVM). The AnyScreen Java Client can be run in three distinct ways:

  1. Run as a standalone desktop application
  2. as a Java Applet in a web browser
  3. or as a standalone application that is accessible through a web browser using JavaWebStart

***** The AnyScreen HTML5 client requires the latest C11 RTL, the minimum RTL build is version 11.13505

Example-Demo Apps

We are asking for some help from the Clarion developer community. In my prior post I announced the new Clarion Community Edition along with a new free online training course. What we could use some help with is creating some new example/demo Apps. Any App that shows off some specific functionality of Clarion, whether its simple or advanced, would be welcomed. The App can use either the ABC or Clarion template chains, and ideally uses the SQLite driver. If you use a different driver its no problem, we’ll change it to use SQLite. And it doesn’t have to be an .APP, hand coded programs are also welcome. We are looking to get some nice new apps with a modern looking UI — this will help the launch of the Community Edition. If you’re able to help us with this project we ask that you zip up your contribution and upload it to Dropbox, Google Drive or OneDrive (or your own server) and then email support@softvelocity.com with the URL and a note on what your example demonstrates. Thanks in advance to everyone who is able to help us!


Clarion Community Edition

Over the next days I’ll be sharing news about announcements we made at the conference (CIDC 2019).

As the title suggest we are introducing a new, and totally free, Clarion Community Edition. Here are the details:

  • It’s not a Trial version (it never expires)
  • Database Drivers:
    • SQLite, Dos, Ascii, Basic
  • Templates: Both ABC and Clarion chains
  • The only limitations are:
    • No ability to add any additional database drivers
    • No ability to register any additional Templates

This is a great opportunity for members of the Clarion community to get fellow developers who are using other tools to try out Clarion. If every Clarion dev could get ONE new developer to get a copy, we can double the size of the community! Also, if you are a Clarion developer who is using an older version of Clarion this is your opportunity to see what you’ve been missing out on.

We’ll also be making a free training course available on one of the online learning platforms. The course will be designed to teach the essentials of Clarion; both the IDE (Data Dictionary, AppGen, using embeds, and much more.) as well as the language itself.

We expect to release the new edition late October, or early November.

CIDC 2019

We are looking forward to the upcoming Clarion International Developers Conference (CIDC). We anticipate announcing some powerful new capabilities! And we’ll be posting from the conference to share with the Clarion community. If you can’t attend in person there is an option for live streaming. For more information visit cidc2019.com

Clarion 11 update released

Today we are releasing an update for C11. It’s a fairly large update with close to 125 fixes/changes/new features!

Here are a few items from the readme file:

FEATURE: You can now trap calls to the transaction handling functions LOGOUT, COMMIT, and ROLLBACK without having to attach a file callback to every file. To do this you use SYSTEM{PROP:TransactionHook}. (details on how to implement are in the updated Help file)

FEATURE: Adding a .dct.BinaryImport file into a directory will turn on automatic import/export for dct files. Similarly the existence
of a .app.BinaryImport file will turn on import/export of app files. This file can be empty or contain multiple lines with each line being a
file pattern to match files. If the file is empty, then all dct/app files will be imported/exported. Otherwise only files that match at least one of the file patterns will be imported/exported.

FEATURE: Control Template Pad now has a Locator to search the registered control templates.

FEATURE: ABC/Clarion chain: Additional Sort Assisted Order now includes the option to “Force NoCase (Case Insensitive)” for the sort order,
supported in Browse, Vcr form, Report process

There’s a lot more, and you can review all the fixes/changes/new features here

Clarion IP Driver version 11

When we updated the IP Driver for version 11 we made two important changes; we moved from OpenSSL to LibreSSL, and (*as of version 11) the IP Server/Driver only supports secure data communications (SSL/TLS). This is covered in both the driver reference manual and the online help file, but it is easy to explain with these screenshots:

IP Server manager

 

 

Here we specify two ports; the port used by the RMadmin program, and the port used by the Clarion desktop client app.

Specify the 2 ports for the IP Server

IP Driver ports

When connecting to the server for admin work; registering data managers, etc., we connect using the RMadmin program on the ‘Administrator Port’, and in our Clarion client app we specify to connect on the ‘Client Secure Port’. You can choose any ports that are open on your machine, just be sure your firewall allows traffic on the ports you specify.