{basic for loop}
for _ = _ to _ do
	<code>
end for

{for loop with step}
for _ = _ to _ by _ do
	<code>
end for

{basic while loop}
while _ do
	<code>
end while

{basic repeat loop}
repeat
	<code>
until _

{loop through a list}
loop _ in _
	<code>
end loop

{basic if test}
if _ then
	<code>
end if

{if/else test}
if _ then
	<code>
else
	<code>
end if

{if/else if/else test}
if _ then
	<code>
else if _ then
	<code>
else
	<code>
end if

{when statement}
when
	<test> :
	<code>	
	end

	<test> :
	<code>
	end
end when

{case statement}
case _ of
	_ :
		<code>
		end

	_ :
		<code>
		end

	otherwise :
		<code>
		end
end case

{function with no parameters}
# ----------------------------------------------------------------------------
# Function      : func_name
#
# Author (date) : anonymous (--/--/2004)
#
# Description   : 
#
# Return value  : 
# ----------------------------------------------------------------------------

function func_name ()
end func_name

{function with general parameters}
# ----------------------------------------------------------------------------
# Function      : func_name
#
# Author (date) : anonymous (--/--/2004)
#
# Description   : 
#
# Parameters    : 
#
# Return value  : 
# ----------------------------------------------------------------------------

function func_name (param1, param2)
end func_name

{function with specific parameters}
# ----------------------------------------------------------------------------
# Function      : func_name
#
# Author (date) : anonymous (--/--/2004)
#
# Description   : 
#
# Parameters    : 
#
# Return value  : 
# ----------------------------------------------------------------------------

function func_name (param1: type, param2: type)
end func_name

{function with any no of parameters}
# ----------------------------------------------------------------------------
# Function      : func_name
#
# Author (date) : anonymous (--/--/2004)
#
# Description   : 
#
# Parameters    : 
#
# Return value  : 
# ----------------------------------------------------------------------------

function func_name
	loop arg in arguments()
	end loop
end func_name


{function for macro library}
# **************************************************************************
# Function      : name
#
# Syntax        : 
#
# Author (date) : Anonymous (--/--/----)
#
# Category      : 
#
# OneLineDesc   : 
#
# Description   : 
#
# Parameters    : 
#
# Return Value  : 
#
# Dependencies  : 
#
# Example Usage : 
#
# **************************************************************************

function func_name (param1: type, param2: type)
end func_name


{runmode tests}

# Execute specific code depending on the runmode

strMode = runmode()

case strMode of
	'execute':
		print ('Running in execute mode')
		end

	'visualise' :
		print ('Running in visualise mode')
		end

	'examine' :
		print ('Running in examine mode')
		end

	'save' :
		print ('Running in save mode')
		end

	'edit' :
		print ('Running in edit mode')
		end

	'batch' :
		print ('Running in batch mode')
		end

	'prepare' :
		print ('Running in prepare mode')
		end

	otherwise :
		fail ('Running in unknown mode - ' & strMode)
		end
end case


{plot export}
# depending on the run mode, write the plot to a PNG file
# or else use the default action, which is to plot to the screen.
# Other output formats are available, e.g. using ps_output()
# or pdf_output().

strMode = runmode()

if strMode = 'execute' or strMode = 'batch' then
    png = png_output (
             output_name : 'my_plot',
             output_resolution : 900
          )
    setoutput(png)
end if


{SCM interactive plot}
# we supply an empty parameter definition for the function, which will mean that
# a user interface will be brought up using default values

scm_plot_params = ()

mvl_plot_scm_data(scm_plot_params)

{SCM batch plot}
# we supply a parameter definition with some preferences. If mode = interactive,
# then a user interface will appear so that the user can make further selections;
# otherwise the macro will run using only the arguments defined here (and will
# produce a PostScript file).

scm_plot_params = 
(
    mode            : 'batch',  # 'interactive' or 'batch'
    netcdf_1        : 'scm_out.nc',
    #netcdf_2        : 'scm_out_2.nc', # should be nil, or omit the parameter if no comparison file
    comparison_mode : 'overlay',      # 'overlay' or 'difference'
    output_mode     : 'ps',       # 'ps' or 'screen'
    output_path     : 'scm_out',      # only if mode='batch'. Do not supply an extension.
    param_selection : 'list',         # 'list', 'file' or 'all'
    param_list_path : nil,            # path to a text file containing each parameter name on a new line
    param_list      : ['t_skin', 'top_lwrad_clr', 'u_wind_10m'] # if param_selection is 'list'
)


mvl_plot_scm_data(scm_plot_params)


