arc> genprog aml example
/*$ID: example.aml v1.0 21.21.16 04/16/97 GENSPT Hanming Tu
/* ----------------------------------------------------------------
/* Purpose:
/* ----------------------------------------------------------------
/* Called-by: N/A
/* Calls-to : logaml.aml
/* Routines : bailout,warn - direct error and warn messages
/* CheckInputs - varifies inputs
/* ReserveEnv - keeps environmental variables
/* RestoreEnv - restores environmental variables
/* ----------------------------------------------------------------
/* Platforms: Esri ArcInfo 7.0.4
/* IBM/RS6000 AIX 4.1
/*
/* ================================================================
/*
&severity &error &routine bailout
&severity &warning &routine warn
&args type
&s aml = EXAMPLE
&s .run$status = OK
&s .log$arg = %type%
&if ^ [variable .log$on] &then
&s .log$on = .true.
&if %.log$on% &then
&r logaml start %aml%
&s typs = a b c
&s usg = &r %aml% <[upcase [subst [quote %typs%] ' ' |]]>
&s prg = [show program]
&s prog = 'ARC' 'ARCPLOT' 'ARCEDIT' 'GRID' 'TIN'
&call ReserveEnv
&call CheckInputs
&call MainRoutine
&call RestoreEnv
&return %aml%: All done!
/* --------------------------------
&routine CheckInputs
/* --------------------------------
&if not %prg% in {%prog%} &then &do
&if [null %type%] &then
&ty \Usage: %usg%\
&else &type
&return Run %aml% in %prog%!\
&end
&else &do
&if [null %type%] &then
&return \Usage: %usg%\
&end
&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%.
&return
/* --------------------------------
&routine ReserveEnv
/* --------------------------------
&s cur$wsp = [show &workspace]
&return
/* --------------------------------
&routine RestoreEnv
/* --------------------------------
&work %cur$wsp%
&if %.log$on% &then
&r logaml end
&return
/* --------------------------------
&routine MainRoutine
/* --------------------------------
&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%
&call RestoreEnv
&return \%aml% - %AML$ErrorFullFile% ~
\ Last Error: [value aml$message] ~
\ Thread: %aml$errorthread% ~
\ Line: %aml$errorline% \
Back to the paper