Back to the paper
/*$ID: CTOOLS v1.0 14.51.30 04/10/97 AutoAML Hanming Tu
/* ----------------------------------------------------------------
/* Purpose: routine library containing common routines.
/* ----------------------------------------------------------------
/* Called-by: autoaml.aml,genprog.aml.genhtml.aml,gettimes.aml,
/* findprog.aml
/* Calls-to : N/A
/* Routines : bailout,warn - direct error and warn messages
/* ----------------------------------------------------------------
/* Platforms: Esri ArcInfo 7.0.4
/* IBM/RS6000 AIX 4.1
/*
/* ================================================================
/*
&args type file proj
&severity &error &routine bailout
&severity &warning &routine warn
&s types = cancel help init
&s aml = CTOOLS
&s usg = %aml% {project_name}
&call CheckInputs
&call %type%
&return
/* --------------------------------
&routine CheckInputs
/* --------------------------------
&if [null %type%] or [null %file%] &then
&return \Usage: %usg%\
&if [null %type%] or %type%_ = #_ &then
&s type = [extract 1 %types%]
&s type = [upcase %type%]
&if [keyword %type% %types%] le 0 &then
&return %aml%: Invalid input %type% in %types%.
&ty %file%
&s name = [before %file% .]
&s ext = [after %file% .]
&if [null %proj%] or %proj%_ = #_ &then
&s proj = xxx
&return
/* --------------------------------
&routine Help
/* --------------------------------
/* Displays help about this menu
/* Look for the help file in the current AMLPATH directories.
/*
/* Check that amlpath has been set.
&if [null [show &amlpath]] &then
&return No &amlpath has been set.
/*
/* look for the help file
&if [null [after %file% .]] &then
&set helpfile = [locase %file%.hlp]
&else &set helpfile = %file%
/* keep track of the amlpaths to extract from the list of paths
&set i = 1
&set done = .FALSE.
&do &while not %done%
&set path = [extract %i% [show &amlpath]]; &set i = %i% + 1
&if [exists [joinfile %path% %helpfile% -file]] &then
&do
&popup [joinfile %path% %helpfile% -file]
&set done = .TRUE.
&end
&else
&if [null %path%] &then
&do
&set done = .TRUE.
/*&run msinform [quote Help file %helpfile% not found]
&s .%name%$msg = Help file %helpfile% not found!
/* &run msinform [quote Help not yet available for %file%]
&end
&end
/*
&return
/* --------------------------------
&routine Cancel
/* --------------------------------
&dv .%file%$*
&s mnu = %proj%$%file%
&if [show &thread &exists %mnu%] &then
&thread &delete %mnu%
&else &do
&thread &delete &self
&end
&return
/* --------------------------------
&routine Warn
/* --------------------------------
&severity &warning &ignore
&type %aml%: A warning condition occurred
&return
/* --------------------------------
&routine BailOut
/* --------------------------------
&severity &error &fail
&s .run$status = FAIL:%aml$errorfile%:%aml$errorline%
&return \%aml% - %AML$ErrorFullFile% ~
\ Last Error: [value aml$message] ~
\ Thread: %aml$errorthread% ~
\ Line: %aml$errorline% \
Back to the paper