Trifox development tools, collectively called TRIMtools, use TRIMpl as their shared language. Using these design tools, developers build and maintain a framework of events and triggers that can be shared. Thus, for example, all applications that have an exit key designated as [F3] can use the same piece of TRIMpl code to execute that operation.
TRIMpl scripts can also run as standalone programs to perform a variety of database or system management functions.
TRIMpl, based on the C language, is easy for any C programmer to learn. The main difference is in its its handling of specific datatypes.
You can download the information in PDF format from our FTP site.
In addition to disk based storage, list objects can also be loaded into shared memory. This is often advantageous for static data lookup tables such as part numbers, zipcodes, and so on.
The data in a list column does not have to all be of the same type and lists themselves can be stored in list data items. For example, a part record can have a data column that expands into sub-assemblies. Even TRIMpl code itself can be stored in a list data item and executed dynamically.
A simple TRIMpl script to update staff salaries could look like this:
{
list ll;
number nn;
ll = list_open("select salary,id from staff",10000);
while (true) {
nn = to_number(prompt("Enter new salary for id "^^
list_curr(ll,1)^^" ==> "));
list_modcol(ll,0,n);
if (list_pos(ll) == list_next(ll)) break;
}
exec_sql("update staff set salary = :1 where id = :2",ll);
commit();
}
A slightly more complicated script is used to build the Makefile and spec files
for the DesignVision rpm:
/******************************************************************************/
/* Script builds the Makefile and Spec file for the DesignVision rpm */
/* parm.0 - version number */
/******************************************************************************/
{
list ll,ml,sl;
int i,prelen;
char prefix[200];
prefix = "/tmp/TrifoxRPM/DesignVision-"^^ parm.0 ^^"/"; /* get the version */
prelen = length(prefix) + 1;
/******************************************************************************/
/* Spec file header */
/******************************************************************************/
list_mod(sl,1,"BuildRoot: /usr2/trim/rpm/TrimTools-root");
list_mod(sl,1,"Summary: DesignVision");
list_mod(sl,1,"License: Trifox");
list_mod(sl,1,"Name: DesignVision");
list_mod(sl,1,"Version: "^^parm.0);
list_mod(sl,1,"Release: 1");
list_mod(sl,1,"Source: DesignVision-"^^parm.0^^".tar.gz");
list_mod(sl,1,"Group: Application Development");
list_mod(sl,1,"");
list_mod(sl,1,"%description");
list_mod(sl,1,"DesignVision includes a 4GL application designer, TRIMqmr");
list_mod(sl,1,"adhoc query and report tool, and the TRIMPL script language");
list_mod(sl,1,"");
list_mod(sl,1,"%prep");
list_mod(sl,1,"%setup -q");
list_mod(sl,1,"");
list_mod(sl,1,"%build");
list_mod(sl,1,"");
list_mod(sl,1,"%install");
list_mod(sl,1,"make install prefix=$RPM_BUILD_ROOT");
list_mod(sl,1,"");
list_mod(sl,1,"%clean");
list_mod(sl,1,"");
list_mod(sl,1,"%define __find_requires %{nil}");
list_mod(sl,1,"%files");
list_mod(sl,1,"%defattr(-,bin,bin)");
/******************************************************************************/
/* Makefile header */
/******************************************************************************/
list_mod(ml,1,"#");
list_mod(ml,1,"# Makefile for installing DesignVision");
list_mod(ml,1,"#");
list_mod(ml,1,"PGMS = ");
/******************************************************************************/
/* Load the filenames that were moved by the bldrpm script. */
/******************************************************************************/
ll = list_open("dir! "^^prefix^^"bin/*",10000);
for (i=list_rows(ll);i;i--,ll++) {
list_modcol(ml,0,list_curr(ml,0)^^substr(list_curr(ll,0),prelen) ^^" ");
list_mod(sl,1,"/usr/local/Trifox/bin/"^^substr(list_curr(ll,0),prelen+4));
}
list_mod(ml,1,"LIBS = ");
ll = list_open("dir! "^^prefix^^"lib/*",10000);
for (i=list_rows(ll);i;i--,ll++) {
list_modcol(ml,0,list_curr(ml,0)^^substr(list_curr(ll,0),prelen) ^^" ");
list_mod(sl,1,"/usr/local/Trifox/lib/"^^substr(list_curr(ll,0),prelen+4));
}
list_mod(ml,1,"QMR = ");
ll = list_open("dir! "^^prefix^^"qmr/*",10000);
for (i=list_rows(ll);i;i--,ll++) {
list_modcol(ml,0,list_curr(ml,0)^^substr(list_curr(ll,0),prelen) ^^" ");
list_mod(sl,1,"/usr/local/Trifox/qmr/"^^substr(list_curr(ll,0),prelen+4));
}
list_mod(sl,1,"/usr/local/Trifox/INSTALL");
list_file(sl,"/usr/src/packages/SPECS/DesignVision.spec","a");
/******************************************************************************/
/* Makefile footer */
/******************************************************************************/
list_mod(ml,1,"prefix=/tmp/dogface"); /* for safety */
list_mod(ml,1,"");
list_mod(ml,1,"install: $(PGMS) $(LIBS) $(QMR)");
list_mod(ml,1,chr(9)^^"mkdir -p ${prefix}/usr/local/Trifox/bin");
list_mod(ml,1,chr(9)^^"mkdir -p ${prefix}/usr/local/Trifox/lib");
list_mod(ml,1,chr(9)^^"mkdir -p ${prefix}/usr/local/Trifox/qmr");
list_mod(ml,1,chr(9)^^"rm -f ${prefix}/usr/local/Trifox/bin/*");
list_mod(ml,1,chr(9)^^"rm -f ${prefix}/usr/local/Trifox/lib/*");
list_mod(ml,1,chr(9)^^"rm -f ${prefix}/usr/local/Trifox/qmr/*");
list_mod(ml,1,chr(9)^^"cp $(PGMS) ${prefix}/usr/local/Trifox/bin");
list_mod(ml,1,chr(9)^^"cp $(LIBS) ${prefix}/usr/local/Trifox/lib");
list_mod(ml,1,chr(9)^^"cp $(QMR) ${prefix}/usr/local/Trifox/qmr");
list_mod(ml,1,chr(9)^^"cp INSTALL ${prefix}/usr/local/Trifox/");
list_file(ml,"Makefile","a");
}
TRIMpl runtime scripts can also be embedded into the