All posts by rzaunere

CIDC News: Upcoming releases and announcements

The Clarion conference in Orlando was filled with really good content and great speakers. This post is to report (summarize) some of the most relevant points I made in my presentation(s).

I started off with the most important news that the Clarion dev community is most interested in; the release schedule!

The image pretty much says it all, in short, we have an upcoming update for C11.1 which will be available in a couple of weeks. Related to the C11 update is the long awaited release of the AnyScreen resizer (the AS resizer needs a few changes that are included in the C11 update).

Here’s the projected timeline

I announced that we’re launching an open source project, the “Clarion Database Driver Kit”. This project provides the scaffolding and documentation for you to build your own fully Clarion-compliant driver.
Bruce J. of Capesoft already has a list of ideas that he intends to explore. I’ll post back when the project is available on GitHub.

Clarion 12 will release in December. I’ve talked and written a lot about the changes in C12, some are visual but most are internal. But something newly announced (and important) is the implementation of a pathway to making use of AI models (both local on-premises and cloud services). I put this screen up at the conference:

and this one:

No matter where you fall on the GenerativeAI spectrum, the use cases for database application developers are numerous. I’ll have to do a separate post to do justice to this topic.

Another important announcement was this:

We’ve started the process of putting the faithful TopSpeed C/C++ and Modula compilers into semi-retirement, and this image highlights some of the reasoning and benefits:

And just to be clear because I did get some questions on this topic, this change to the tech stack is for use internally in building the RTL and drivers, the [TopSpeed] Clarion compiler lives on!

Wrapping up this post, I made the point that there won’t be a Clarion 13. I’m not at all superstitious, but we’re still changing our version numbering to reflect the year of the release. So Clarion 2024 [64bit] is the release after C12, and it’ll be released by December 2024.

Clarion DevCon 2023

We’re all looking forward to the upcoming Clarion developers conference, where we’ll be presenting the improvements in Clarion 12, along with some exciting brand new recently implemented features. The conference is your opportunity to learn and understand the latest new functionality in Clarion, from some of the brightest developers across the globe.

The Clarion International Developer Conference (CIDC) 2023 is being held on September 11th to September 15th (Sept 11-12 are 2 days of optional training), followed by 3 days of Conference presentations (Sept 13-15). It’s being hosted at the Wyndham Hotel, Disney Springs, Orlando, Florida, USA.

                                https://www.cidclive.com – Find out more and register to attend, or submit a request to be a presenter here

                   

CIDC 2022

The latest Clarion developer conference was hosted in Capetown, South Africa. From all accounts it was an excellent event! I was scheduled to do a remote presentation covering some of the future Clarion features. Unfortunately due to technical issues and scheduling problems I wasn’t able do the remote presentation. This post tries to capture and describe the key points of what was planned as a live remote presentation. I’ll be discussing this on ClarionLive on October 28th, 2022.

The key point is that the majority of new code in C12 is internal to the Runtime and the compiler, these are very important advances for the Clarion community.

The next area of development focus is on improvements for the End User Interface (the UI you present to your customers).

example of a few Listbox styles

Here we have a typical Listbox (with the arrow pointing to it), and the other three images are the same Listbox with additional standard Window Styles applied to them.

Setting additional Styles would be handled at runtime before the Window is displayed via a function call or a PROP call. We plan to have a global template where you set the Styles for any supported control by control-type, the Style settings cascade to a Procedure level template so that all affected control-types can share same style (with the ability to override at the Procedure level). Of course you can also use the function/PROP in hand-code or an appropriate Embed point.

These are the same Styles applied as they appear on Windows 11. I’m only showing the Listbox control, but every control supports standard styles beyond the styles applied by the Clarion runtime. It is a simple, yet impactful way for you to change the UI of your app and potentially enhance it.

Additional ‘Common’ controls:

As we work toward adding support for additional controls the plan is to release them incrementally after the GA release of C12.

Here’s a rough timeline/history of the Microsoft UI for Windows developers:

After a deep dive into the .Net world, Microsoft has seemingly circled back to updating the Win API. The Windows App SDK targets both C++ developers and .Net developers.

Desktop apps can be enhanced with mobile and cross platform solutions, but desktop apps continue on as a critical aspect for most businesses.

Clarion 11.1 updated and AnyScreen 2.0 released

We have an update for Clarion 11.1 and a new version of AnyScreen (v2.0). This build fixes an elusive bug in the MS Sql driver, and well as other fixes. A new feature introduced in this build is a new Pragma “eol_is_space”, here’s an excerpt from the Help file that describes it:

PRAGMA (‘option(eol_is_space => on | off)’) W

If the pragma is ON, end-of-line characters inside a string literal are treated as whitespaces allowing string literals to be multi-line. This option is useful for embedding non-Clarion code, such as Javascript, HTML, and SQL scripts.

There are three requirements, (1) the last line of the assignment statement (the closing single quote) must be terminated with a semi-colon, and (2) you cannot have a WINDOW,REPORT,FILE or VIEW defined within the source code where the pragma is ON, (3) the embedded string literal has a maximum length of 64K.

Compiler Error: if the string literal is longer than 64K the compiler posts the error:
“Invalid string (misused <…> or {…}, or literal is too long)”

     example: 
V CSTRING(1024),AUTO

  CODE
  
  PRAGMA ('option(eol_is_space => on)')
  
  V = '
        <div ng-controller="ExampleController" class="expressions">
          Expression:
          <input type="text" ng-model="expr" size="80"/>
          <button ng-click="addExp(expr)">Evaluate</button>
          <ul>
           <li ng-repeat="expr in exprs track by $index">
             [ <a href="" ng-click="removeExp($index)">X</a> ]
             <code>{{expr}}</code> => <span ng-bind="$parent.$eval(expr)"></span>
            </li>
          </ul>
       </div>

       ';  !terminate with semi-colon
  PRAGMA ('option(eol_is_space => off)')

The use of this new pragma allows for some very useful functionality in AnyScreen 2.0. Essentially you can now embed blocks of HTML and Javascript using copy/paste with no restrictions on special characters used with the pragma block.

The install includes a new example that shows how to embed an HTML editor, Code editor, Video player, Google Maps, Signature capture and the Canvas object.

Load up the example app from Clarion\accessory\examples\AnyScreenDemo\AnyScreenDemo.app and you can see it in action. Here’s a screen shot:

You can review the complete list of changes for Clarion11.1 here

You can review the complete list of changes for AnyScreen 2.0 here

Clarion 11.1 and AnyScreen 1.2 are released today

Latest update to Clarion is going out today, along with a major update for AnyScreen. There are some key features in the RTL for this release :

We back ported the event handling code from C12 into C11. The purpose is to avoid inter-thread SendMessage API calls. SendMessage can be dangerous in a multi-threaded environment because it isn’t thread-safe, and can result in deadlocks, but its needed for communication between threads.

We added a new public interface for working with Reports. When you implement the new IRpt interface the methods are automatically called by the RTL. You can read about it in the 11.1 Help file, just type “IRpt” into the index.

C11.1 has implemented much lower level support for AnyScreen. This has allowed for expanded functionality in AnyScreen, and faster performance.

Due to compiler changes, and renumbering of some property values, the 11.1 release requires all program components be rebuilt. If you use any 3rd party tools that ship blackbox binary files you’ll want to get the latest update for those tools.

You can read the complete list of changes/fixes and features here

AnyScreen has had a major update. Not only does it provide a large number of fixes, it implements a large number of community requests for added functionality. A lot of hard work went into this release, and a lot of deep testing from a great group of volunteers.

You can read the complete list of changes/fixes and features in AnyScreen here

Thanks to everyone who helped with testing this release!

New application security features in Clarion

We’ve added two new linker options that can make your applications more secure from malware exploits; ASLR (Address space layout randomization) and DEP (Data Execution Prevention).

ASLR (Address space layout randomization)

ASLR also often referred to as DYNAMICBASE, modifies the header of an executable to indicate whether the application should be randomly rebased at load time by the OS.
ASLR is transparent to your application. With ASLR, the only difference is the OS will rebase the executable unconditionally, instead of doing it only when a base image conflict exists. ASLR is supported only on Windows Vista and later operating systems, it is ignored on older OS versions.

Why should you use ASLR? On platforms without ASLR support (versions of Windows prior to Windows Vista), there is a well know exploit approach for an attacker to find and manipulate code that exists within its modules (DLLs and EXEs) when the modules have been loaded at predictable locations in the address space of the process. Address space layout randomization (ASLR) randomizes the memory locations used by programs, making it much harder for an attacker to correctly guess the location of a given process, including the base of the executable and the positions of the stack, heap and libraries.

In the next build of C11, the “Dynamic Base Address” option is set on by default at the project level.

If you want to set it from the EXP file, the command is:

DYNAMIC_BASE
on any line by itself (outside of the Exports)

DEP (Data Execution Prevention)

The purpose of DEP is to prevent attackers from being able to execute data as if it were code. This stops an attack that tries to execute code from the stack, heap, and other non-code memory areas. DEP prevents malware from writing code into data pages then executing it.

In the next build of C11, the “Data Execution Protection” option is set on by default at the project level.

If you want to set it from the EXP file, the command is:

DEP
on any line by itself (outside of the Exports)

Summary

The combined use of DEP (Data Execution Prevention) and ASLR (Address Space Layout Randomization) have proven to be effective against the types of exploits that are in use today. DEP breaks exploitation techniques that attackers have traditionally relied upon, but DEP without ASLR is not sufficient to prevent arbitrary code execution in most cases. DEP is also needed to make ASLR (Address Space Layout Randomization) more effective.

Adding these two malware countermeasures to your applications is especially useful for applications that handle financial data, credit cards, health info, and more.

To set these linker options in Clarion at the Project level:

Open the Project properties page:

en

then click on the “Compiling” tab and set the checkboxes to ON

ASLR and DEP
ASLR and DEP

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.