Overriding standard commands

Luo_93

New Member
Does progress allow overriding of standard commands. For example: can I override the "integer" command using my own logic? To be more specific: the "integer" command is not good enough for us. So we created a "my_integer" command to convert a string to an integer. Can I override the "integer" command using the logic in "my_integer" command?

E.g. my_integer("x12345-") returns -12345
Can we override the "integer" command so that we we run integer("x12345-"), it returns -12345 too?
 
As with any language that supports functions, you can extend the language by creating a series of function libraries. When you do this in C++, you will always need to reference the library by using #include. Similarly, in Java, you would reference the library using 'import'.

It's the same in the 4GL. It's just the way that you reference the library that's different. In the 4GL you would make use of SUPER-PROCEDURES. These are 4GL procedures like any other that can contain your functions (e.g. 'my_integer'). Then you need to reference the library from the procedure that wants access to the library functions.

So there are 3 things that you need to learn about.

1. How to write a function
2. How to write function prototypes
3. How write and reference a super-procedure

My approach to this would be to:

1. Create the library procedure
2. Add functions to the library procedure
3. Create an include file containing function prototypes
4. Add the super-procedure references to the include file

This way, all you need to do to access the library is to include the include-file in the procedure that wants to access the library functions. You can then call 'my_integer' or whatever as if the function was part of the 4GL.
 

Luo_93

New Member
Excellent. I have heard of super-procedure, but never used it. It is time for me to try it out. Thank you very much.
 
Top