Language
Showing results for 
Search instead for 
Do you mean 

TERMINATE - Intrinsic in c and Pascal

SOLVED
Go to Solution
Highlighted
Regular Advisor

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
3 REPLIES
Esteemed Contributor [Founder]

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
Esteemed Contributor [Founder]

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.
Regular Advisor

Re: TERMINATE - Intrinsic in c and Pascal

Oh, Let me try that terminate() style
Thank you
Not as is, is now