OpenVMS Source Code Demos

mysql_demo0x_c_cxx

$!=============================================================================================
$! title       : mysql_demo0x_c_cxx.com
$! author      : Neil Rieck (https://neilrieck.net)
$!             : Waterloo, Ontario, Canada.
$! created     : 2014-01-20 (Alpha only)
$! modified    : 2017-04-20 (supports Alpha or Itanium)
$! platform    : MariaDB-5.5-25 on OpenVMS-8.4
$! dependancies: you need an up-to-date version of zlib (1.2.6 or higher). I used this one:
$!			http://fafner.dyndns.org/~alexey/libsdl/ZLIB-1_2_7.ZIP
$! caveat      : "C" Linking is noisy on Alpha but not Itanium
$!=============================================================================================
$	say :== write sys$output
$	ask :== inquire/nopunct
$	say	""
$	say	"-i-script:",f$environment("procedure")
$	say	"   (a build program for MySQL/MariaDB clients on OpenVMS)"
$	if p1 .eqs. ""
$	then
$		say "-i-usage: @MYSQL_DEMO_C_CXX program.c"
$		say "-i-looking for filenames of the form: MYSQL_DEMO*.c"
$		say "   ================================================"
$		dir/col=1/width=file=52/nohead/notrail/date mysql*.c;
$		savedstatus = $STATUS
$		if ((f$integer(savedstatus).and.7).ne.1)
$		then
$			say "-w-oops, none found"
$			exit
$		endif
$       	say ""
$       	inquire/nopunct junk "build which file? "
$       	if junk .eqs. "" then goto fini
$		p1 = junk
$	endif
$	fname = f$parse(p1,,,"NAME")		! drop the extension
$!
$       arch    = f$getsyi("ARCH_NAME")         !
$       yada    = f$trnlnm("mysql055_root")     ! eg. KAWC90$DKB1:[MYSQL055.]
$       yada    = yada - "]"                    !
$       yada    = yada + "lib."'arch'"]"        ! eg. KAWC09$DKB1:[MYSQL055.lib.ia64]
$!
$!      create a logical because LINK "sys$input/opt" does not support DCL symbol substitution
$!
$       def/process     tmp_path  'yada'        !
$!
$	say "-i-will compile ",fname,".c"
$	say "1) compile with c   (default  )"
$	say "2) compile with c++ (preferred)"
$	ask choice "choice? (default=1) "
$	kind = 1
$	if choice .eqs. "2" then kind = 2
$	if kind .eq. 1
$	then
$		say "-i-compling with C"
$		cc	/float=ieee				-
			/ieee=denorm				-
			/name=(as_is,shortened)			-
			/include=mysql055_root:[include.mysql]	-
			'fname'.C
$	else
$		say "-i-compling with C++"
$		cxx	/float=ieee				-
			/ieee=denorm				-
			/name=(as_is,shortened)			-
			/include=mysql055_root:[include.mysql]	-
			'fname'.C
$	endif
$!
$ if kind .eq. 1
$ then
$	say "-i- c linking ",fname
$	link	/exec					-
		'fname'.obj		,		-
		sys$input/opt
		tmp_path:libclientlib.olb/library
		tmp_path:libdbug.olb/library
		tmp_path:libmysys.olb/library
		tmp_path:libsql.olb/library
		tmp_path:libstrings.olb/library
		tmp_path:libvio.olb/library
		tmp_path:libyassl.olb/library
		sys$share:LIBZSHR.EXE/share
$		savedstatus = $STATUS
$ else
$	say "-i- c++ linking ",fname
$	cxxlink	/exec					-
		'fname'.obj		,		-
		sys$input/opt
		tmp_path:libclientlib.olb/library
		tmp_path:libdbug.olb/library
		tmp_path:libmysys.olb/library
		tmp_path:libsql.olb/library
		tmp_path:libstrings.olb/library
		tmp_path:libvio.olb/library
		tmp_path:libyassl.olb/library
		sys$share:LIBZSHR.EXE/share
$		savedstatus = $STATUS
$ endif
$	say "-i-directory cleanup"
$	pur/nolog/noco 'fname'.exe
$	pur/nolog/noco 'fname'.obj
$	say "-i-linking on Alpha without MMK is noisy so here is a summary:"
$	say "-i-exit status: ",savedstatus
$	if ((savedstatus .and. 1).eq.0) then say "-i-there were LINKER warnings"
$	if ((savedstatus .and. 2).eq.2) then say "-i-there were LINKER errors"
$	if ((savedstatus .and. 4).eq.4) then say "-i-there were LINKER fatals"
$	if ((savedstatus .and. 6).ne.6)
$	then
$		say "-i-there were NO LINKER errors"
$		say "-i-look what I built:"
$		say "==========================================="
$		dir/col=1/date/width=file=50/nohead/notrail/since="-0 0:0:59" 'prgm'*.exe;
$		say "==========================================="
$	endif
$fini:
$	deas/process tmp_path
$	say "-i-normal exit at: ",f$cvtime()