This section shows some of the source files provided in the $DLC/oebuild/hlc/examples directory.

This loaddb.p procedure automatically loads the data definitions for the sample application.

loaddb.p

hide all.
display skip(2)
        " ********* LOADING the database ********* " skip(1)
        " ********* please stand by............." 
        with title "WELCOME TO HLC DEMO PROGRAM" 
                 row 5 centered frame hdr.

output to hldemout.
run prodict/load_df.p ("customer.df").
run prodict/load_df.p ("agedar.df").
run prodict/load_df.p ("monthly.df").
run prodict/load_df.p ("tank.df").
/* create signal file to indicate success */
if opsys = "unix" then do:
   unix cat >hlcsigfile & .
end.
hide all.

The hlprodsp.c file is the ABL prototype in which you define the application's HLC routine identifiers and the corresponding C function names.

hlprodsp.c

#include "hlc.h"
/*   File:   hlprodsp.c               */

#define FUNCTEST(nam, rout)  \
        if (strcmp(nam, pfunnam) == 0) \
	    return rout(argc,argv);

/* PROGRAM: PRODSP
 * 
 *   This is the interface to all C routines that 
 *   PROGRESS has associated 'call' statements to.   
 */

long
PRODSP(pfunnam, argc, argv)

     char   *pfunnam;    /* Name of function to call */
     int     argc;
     char   *argv[];

{
/* Interface to installation test */
    FUNCTEST( "SUBVRD", subvrd)
    FUNCTEST( "SUBVWT", subvwt)
    FUNCTEST( "SUBFRD", subfrd)	
    FUNCTEST( "SUBFWT", subfwt)
    FUNCTEST( "SUBFIX", subfix)
    FUNCTEST( "SUBVIX", subvix)	
    FUNCTEST( "SUBARG", subarg) 
    FUNCTEST( "SUBCLR", subclr) 
    FUNCTEST( "SUBCLS", subcls) 
    FUNCTEST( "SUBINT", subint)
/* Interface to 'screen' examples */
    FUNCTEST ("EXAMPLE1", example1);
    FUNCTEST ("EXAMPLE2", example2);
/* Interface to 'tank' example  */
    FUNCTEST ("AVCALC", hlvcalc);
    return 1;
}

int proHLC_IsThreadSafe()
{
    return 0; /* return 1 if you've confirmed that your code is thread safe */
}

struct myglobaldata
{
	int a;
/*
 * Put your non-constant global data that you need access to for this ABL Session
 */
};

int proHLC_InitSession() 
{
    void *ptr = promalloc(sizeof(struct myglobaldata));
    /* Initialize myglobaldata structure with your non-constant
     * global data that you need access to for this ABL Session
     */
    proSetGlobalStruct(ptr); /* stash it so we can get it later */
}

int proHLC_ExitSession() 
{
    struct myglobaldata *ptr = (void *)proGetGlobalStruct();
    /* First deallocate any allocated memory
     * referenced from myglobaldata */
    if (ptr)
        profree((void *)ptr); /* free up the structure itself */
    proSetGlobalStruct((void *) 0); /* so we don't dereference */
}

The hldemo.p example is the front end to the sample test application.

hldemo.p

DEFINE VARIABLE answer AS CHARACTER NO-UNDO FORMAT "9".
DEFINE VARIABLE choice AS CHARACTER NO-UNDO INITIAL "1,2,3,4".
DEFINE VARIABLE last1  AS LOGICAL   NO-UNDO INITIAL TRUE.
DEFINE VARIABLE last2  AS LOGICAL   NO-UNDO INITIAL TRUE.

RUN loaddb.p.

INPUT FROM TERMINAL.
OUTPUT TO TERMINAL.

FORM SKIP(4) SPACE(4)
  " 1 - Installation Test" SKIP(1) SPACE(4)
  " 2 - TANK Capacity Calculation demo " SKIP(1) SPACE(4)
  " 3 - Screen raw/cooked demo " SKIP(1) SPACE(4)
  " 4 - Exit Session" SKIP(2) SPACE(4)
  " Enter example selection ===> " answer no-label
  WITH CENTERED TITLE " EXAMPLE MENU " FRAME example.

FORM last1 last2 WITH FRAME lastcheck.

REPEAT:
  HIDE ALL.
  UPDATE answer AUTO-RETURN
  VALIDATE(LOOKUP(answer,choice) <> 0,"Enter one of choices displayed.")
  WITH FRAME example.
  HIDE ALL.
  IF answer = "1" THEN DO:
    /* Check to see if need to reinitialize database. */
    IF last1 THEN DO:
      last1 = TRUE.
      last2 = FALSE.
      RUN initdb.p.
      HIDE ALL.
    END.
    last1 = TRUE.
    RUN hltest.p.
  END.
  ELSE IF answer = "2" THEN DO:
    /* Check to see if need to reinitialize database. */
    IF last2 THEN DO:
      last2 = TRUE.
      last1 = FALSE.
      RUN initdb.p.
      HIDE ALL.
    END.
    last2 = TRUE.
    RUN hltank.p.
  END.
  ELSE IF answer = "3" THEN RUN hlscreen.p.
  ELSE IF answer = "4" THEN QUIT.
end.
HIDE ALL.
QUIT.