/*-------------------------------------------------------------------+
|                Copyright (c) 1995, SAS Institute Inc.              |
|                  Unpublished - All Rights Reserved                 |
|                    S A S / C   S A M P L E                         |
|                                                                    |
|       NAME: C2PASCPC                                               |
|   LANGUAGE: C                                                      |
|    PURPOSE: THIS EXAMPLE DEMONSTRATES A PASCAL PROGRAM CALLING     |
|             A C FUNCTION, PASSING A PARAMETER LIST.                |
|             IT CONSISTS OF SAMPLE LIBRARY MEMBERS                  |
|             C2PASCPC, C2PASCPP, AND C2PASCPM.                      |
| MVS -                                                              |
|    COMPILE: USE JCL PROVIDED IN SAMPLE.AUX(C2PASCPM).              |
|       LINK: USE JCL PROVIDED IN SAMPLE.AUX(C2PASCPM).              |
|    EXECUTE: USE JCL PROVIDED IN SAMPLE.AUX(C2PASCPM).              |
| TSO -                                                              |
|    COMPILE: PASCAL - USE PASCAL COMPILER.                          |
|             C - LC370C C2PASCPC                                    |
|       LINK: ILCLINK, USING CONTROL CARDS IN SAMPLE.AUX(C2PASCPM).  |
|    EXECUTE: CALL .LOAD(C2PASCPM)                           |
| CMS -                                                              |
|    COMPILE: PASCAL - USE PASCAL COMPILER.                          |
|             C - LC370 C2PASCPC                                     |
|        LINK: ILCLINK, USING CONTROL CARDS IN SAMPLE.AUX(C2PASCPM). |
|     EXECUTE: CALL C2PASCPM                                         |
|   MISC NOTES: THE FOLLOWING LSCL1028 MESSAGES CAN BE IGNORED:      |
|     THE FILE "SYSLIB(AMPXRETC)" COULD NOT BE OPENED FOR AUTOCALL.  |
|     THE FILE "SYSLIB(AMPXHALT)" COULD NOT BE OPENED FOR AUTOCALL.  |
|     THE FILE "SYSLIB(AMPXSEGE)" COULD NOT BE OPENED FOR AUTOCALL.  |
|     THE FILE "SYSLIB(AMPXSTRT)" COULD NOT BE OPENED FOR AUTOCALL.  |
|     THE FILE "SYSLIB(AMPXPARM)" COULD NOT BE OPENED FOR AUTOCALL.  |
|     THE FILE "SYSLIB(PASCPROC)" COULD NOT BE OPENED FOR AUTOCALL.  |
+-------------------------------------------------------------------*/
#include 
#include 
#include 

__pascal void PASCPROC();

void main()
  {
   struct string
     {
     short len;
     char text(|30|);
     };
   struct string pascparm = { 0, "Hello from PASCAL" };
   void *token;

   pascparm.len = strlen(pascparm.text);
   printf("Hello, from the C program!\n");
   token = mkfmwk("PASCAL","");
   if (!token)
    {
     printf("Can't create the Pascal framework!\n");
     exit(12);
    }
   printf("Hello World C calling PASCAL\n");
   PASCPROC(pascparm);
   printf("Successful return from PASCAL\n");
   dlfmwk(token);
  }