$! 13 September 1995. SMS.
$!
$! Command procedure to test "CC" for DEC C.
$!
$! Method:
$!
$! Try to compile a test program which generates a syntax error under
$! DEC C, but which compiles without error under VAX C.
$!
$! This method works when "CC" has been defined as a symbol like
$! "CC /DECC", "CC /VAXC", or even "CC /DEFINE = (__DECC=1)".
$!
$! Result:
$!
$! If a symbol name is specified as P1, it will be set to "DECC" or
$! "VAXC". If no symbol name is specified as P1, the compiler type will
$! be written to SYS$OUTPUT.
$!
$!
$ SET NOON
$!
$ DEFINE /USER SYS$OUTPUT NL:
$ DEFINE /USER SYS$ERROR NL:
$ CC /NODEFINE /NOUNDEFINE /NOOBJ /NOLIST SYS$INPUT
/* 13 September 1995. SMS.
/*
/* Test source file to identify the DEC C compiler.
/*
/* Compiler Result
/* DEC C syntax error
/* VAX C no error
*/
#ifdef __DECC
Generate a syntax error. ;
#endif
void test_dummy()
{
}
$!
$ STS = $STATUS
$!
$ SET ON
$!
$ IF (P1 .NES. "")
$ THEN
$!
$! A symbol name was supplied. Set the symbol to the compiler type.
$!
$ IF (STS)
$ THEN
$ 'P1' == "VAXC"
$ ELSE
$ 'P1' == "DECC"
$ ENDIF
$!
$ ELSE
$!
$! No symbol name was supplied. Show the compiler type.
$!
$ IF (STS)
$ THEN
$ WRITE SYS$OUTPUT "VAX C"
$ ELSE
$ WRITE SYS$OUTPUT "DEC C"
$ ENDIF
$!
$ ENDIF
$!