Home Applications helper-for-objectscript-language-extensions

helper-for-objectscript-language-extensions

This application is not supported by InterSystems Corporation. Please be notified that you use it at your own risk.
5
1 reviews
0
Awards
300
Views
18
IPM installs
5
2
Details
Releases
Reviews
Issues
Pull requests
Videos
Articles
This app has a demo View
Utility to add customized Language Extensions programmatically

What's new in this version

move to archive

Helper for ObjectScript Language Extensions

Creating your own commands or shortcut is one of the strongest features of ObjectScript
If you create your own Language Extensions to Object you mostly have to find the
proper %ZLANGC00 or %ZLANGV00 or %ZLANGF00 and add the extensions manually.

A few utilities do it already automatically (ZPM, ZME, ..)
This utility allows you to add your extensions also programmatically.

  • eg. at first run, or during installation
    I found this quite useful for my Docker-based demos as it all happens at start time.

This package includes a demo example to visualize the operation of this utility.

Prerequisites

Make sure you have git and Docker desktop installed.

Installation

Clone/git pull the repo into any local directory

$ git clone https://github.com/rcemper/helper-for-objectscript-language-extensions.git

Open the terminal in this directory and run:

$ docker-compose build

Run the IRIS container with your project:

$ docker-compose up -d

How to Use it

 ; typ = "C" ... command extentson
 ;       "F" ... function extension
 ;       "V" ... variable Extensin
 ; ext = name of the extension
 ; code (by ref) numbered array of lines to add
 ;  
 ; do cmd^zLangExtender(typ,ext,.code)   ;>> add extension 

How to Test it

Open IRIS terminal:

$ docker-compose exec iris iris session iris   
USER>ZN "%SYS"   
%SYS>do ^zLangExample  
Compiling routine : %ZLANGF00.mac  
label="ZZDUMMY"   
line=6  
line(1)=" ; "   
line(2)=" ; just a demo dummy"  
line(3)="ZZDUMMY(%a) "    
line(4)=" quit " I got '"_%a_"' for test""   
line(5)=" ; what a nice demo "  
line(6)=" ; "   
sc=1   
typ="F"   
**** try ****  
sc=" I got 'hi folks' for test"    
result:
         ;Generated by %ZPM.PackageManager: Start
ZPM(pArgs...) Quit ##class(%ZPM.PackageManager).Shell(pArgs...)  
         ;Generated by %ZPM.PackageManager: End  
         ;  
         ; just a demo dummy  
ZZDUMMY(%a) 
         quit " I got '"_%a_"' for test"  
         ; what a nice demo
         ;
%SYS>   

And if you run it a second time ?
It returns a standard error %Status.

%SYS>do ^zLangExample
%objlasterror="0 ...ZZDUMMY^%ZLANGF00 already defined.........
label="ZZDUMMY"
line=6
line(1)=" ; "
line(2)=" ; just a demo dummy"
line(3)="ZZDUMMY(%a) "
line(4)=" quit " I got '"_%a_"' for test""
line(5)=" ; what a nice demo "
line(6)=" ; "
sc=""0 ...ZZDUMMY^%ZLANGF00 already defined.........
typ="F"
ERROR #5001: ZZDUMMY^%ZLANGF00 already defined
%SYS>

Warning

It is meant mainly for COS experts !

Article in DC

Video

Online Demo
Online Terminal

Made with
Install
zpm install language-extender download archive
Version
0.0.416 Sep, 2023
Category
Technology Example
Works with
InterSystems IRIS
First published
01 Apr, 2021
Last checked by moderator
01 Nov, 2023Works