TERMINATE - Intrinsic in c and Pascal (138 Views)
Reply
Regular Advisor
Stephen Badgett
Posts: 148
Registered: ‎06-22-2003
Message 1 of 4 (138 Views)
Accepted Solution

TERMINATE - Intrinsic in c and Pascal

Writing a c program (attached file) and using the TERMINATE intrinsic in MPE and the PROGRAM does not TERMINATE with the TERMINATE statement like it does in PASCAL. ...

$Title 'testin TERMINATE intrinsic'$

PROGRAM TERM (input, output);

CONST Version = '1.00';

TYPE Str255 = String[255];
Int16 = -32768..32767;

VAR infostring : Str255;
infolength : Int16;
parm : Int16;

Procedure Terminate ; Intrinsic;

begin

WriteLn;
WriteLn('------------------------------');
WriteLn('-- Will call TERMINATE now! --');
Terminate;
WriteLn('-- After Terminate --');
WriteLn('------------------------------');
end.

------------

Also where is the intrinsic file in MPE and how does the c program know where to look for the intrinsics?

thank you,
Steve
Not as is, is now
Please use plain text.
Esteemed Contributor
Dan Clifford
Posts: 201
Registered: ‎03-25-1998
Message 2 of 4 (138 Views)

Re: TERMINATE - Intrinsic in c and Pascal

Steve,

The program you sent works just fine when compiled with pascal. Do you have a 'c' version of the program? If so, please show us that version.

The file system intrinsics are in NL.PUB.SYS and the database system intrinsics are in XL.PUB.SYS. To use them in a C program, use a 'pragma intrinsic' statement at the top of your program. It is described in the HP C/iX Reference Manual at http://www.docs.hp.com/cgi-bin/doc3k/B3150690011.11986/118.

Example:

#include
#pragma intrinsic TERMINATE

main()
{

printf;
printf("------------------------------\n");
printf("-- Will call TERMINATE now! --\n");
TERMINATE;
printf("-- After Terminate --\n");
printf("------------------------------\n");
return 0;

}

If that doesn't work for you go ahead and send your sample program.

Dan
Please use plain text.
Esteemed Contributor
Dan Clifford
Posts: 201
Registered: ‎03-25-1998
Message 3 of 4 (138 Views)

Re: TERMINATE - Intrinsic in c and Pascal

Steve,

I showed a developer and she said this:

If you code it like this:

#include
#pragma intrinsic TERMINATE

main()
{

printf;
printf("------------------------------\n");
printf("-- Will call TERMINATE now! --\n");
TERMINATE;
printf("-- After Terminate --\n");
printf("------------------------------\n");
return 0;
}

you will get this output:

:RUN TERMPC

------------------------------
-- Will call TERMINATE now! --
-- After Terminate --
------------------------------

END OF PROGRAM


If you code it like this:

#include
#pragma intrinsic TERMINATE

main()
{

printf;
printf("------------------------------\n");
printf("-- Will call TERMINATE now! --\n");
TERMINATE();
printf("-- After Terminate --\n");
printf("------------------------------\n");
return 0;
}


You will get the same results as the pascal version:

:run termpc

------------------------------
-- Will call TERMINATE now! --

END OF PROGRAM

Hope this helps.
Please use plain text.
Regular Advisor
Stephen Badgett
Posts: 148
Registered: ‎06-22-2003
Message 4 of 4 (138 Views)

Re: TERMINATE - Intrinsic in c and Pascal

Oh, Let me try that terminate() style
Thank you
Not as is, is now
Please use plain text.
The opinions expressed above are the personal opinions of the authors, not of HP. By using this site, you accept the Terms of Use and Rules of Participation