/*-------------------------------------------------------------------+
|                Copyright (c) 1995, SAS Institute Inc.              |
|                  Unpublished - All Rights Reserved                 |
|                    S A S / C   S A M P L E                         |
|                                                                    |
|       NAME: PASCCXPP                                               |
|   LANGUAGE: PASCAL                                                 |
|    PURPOSE: THIS EXAMPLE DEMONSTRATES A PASCAL PROGRAM CALLING     |
|             A C++ FUNCTION, PASSING A PARAMETER LIST.              |
|             IT CONSISTS OF SAMPLE LIBRARY MEMBERS                  |
|             PASCCXPC, PASCCXPP, AND PASCCXPM.                      |
| MVS -                                                              |
|    COMPILE: USE JCL PROVIDED IN SAMPLE.AUX(PASCCXPM).              |
|       LINK: USE JCL PROVIDED IN SAMPLE.AUX(PASCCXPM).              |
|    EXECUTE: USE JCL PROVIDED IN SAMPLE.AUX(PASCCXPM).              |
| TSO -                                                              |
|    COMPILE: PASCAL - USE PASCAL COMPILER.                          |
|             C++ - LCXX   PASCCXPC USING INDEP OPTION.              |
|       LINK: ILCLINK, USING CONTROL CARDS IN SAMPLE.AUX(PASCCXPM).  |
|    EXECUTE: CALL .LOAD(PASCCXPM)                           |
| CMS -                                                              |
|    COMPILE: PASCAL - USE PASCAL COMPILER.                          |
|             C++ - LCXX  PASCCXPC USING INDEP OPTION.               |
|        LINK: ILCLINK, USING CONTROL CARDS IN SAMPLE.AUX(PASCCXPM). |
|     EXECUTE: CALL PASCCXPM                                         |
| MISC NOTES: THE FOLLOWING LSCL102 MESSAGES CAN BE IGNORED:         |
|   WARNING: CAN'T OPEN FILE DURING AUTOCALL: DDN:SYSLIB(AMPXRETC)   |
|   WARNING: CAN'T OPEN FILE DURING AUTOCALL: DDN:SYSLIB(AMPXHALT)   |
|   WARNING: CAN'T OPEN FILE DURING AUTOCALL: DDN:SYSLIB(AMPXSEGE)   |
+-------------------------------------------------------------------*/
  PROGRAM PASCAL2C;
  CONST
     STRSIZE = 32;
     PARM = 'PARM PASSED FROM PASCAL TO C++.';
  TYPE
     PARMSTR = STRING(STRSIZE);
  VAR
     TOKEN : INTEGER;
     ERRFLAG : INTEGER;
  procedure CFMWK(const LANG : STRING;
                  const COPTS : STRING;
                  const ILCOPTS : INTEGER;
                  var TOKEN : INTEGER);
      EXTERNAL;
  procedure DCFMWK(const TOKEN : INTEGER;
                  var ERRFLAG : INTEGER);
       EXTERNAL;
  PROCEDURE CPROG(const PARM1 : PARMSTR);
       EXTERNAL;
       const PARM1 = PARM;
  BEGIN
    CFMWK('PASCAL.','.', 1, TOKEN);
    WRITELN('PARM1 = ', PARM1);
    CPROG(PARM1);
    DCFMWK(TOKEN, ERRFLAG);
  END.