Simple Example to Document a SPEC Macro File

This example demonstrates how a file with simple reST markup will be documented.:

.. autospecmacro:: simple.mac

SPEC Macro File: simple.mac

source code: simple.mac

Example SPEC Macro Source code file for demonstration purposes only.

$Id: simple.mac 1045 2012-07-17 20:09:45Z jemian $

This file is used to demonstrate how to document SPEC [1] macro files using Sphinx [2] and restructured text (reST) [3] markup.

Provides:

  • inc1scan
  • CheckSaveToFile

Footnote

[1]SPEC: http://www.certif.com
[2]Sphinx: http://sphinx.pocoo.org/
[3]reST: http://docutils.sf.net/rst.html

example_global

global variable declaration

this is an example of a global variable
A_keV

constant declaration

Conversion constant between wavelength (A) and photon energy (keV) ( Eλ=hc)
inc1scan

def macro declaration

specify a single motor scan with interval rather than # of intervals

CheckSaveToFile

def macro declaration

Helps prevent user from writing data to /dev/null by accident.

This macro will run when SPEC starts and checks if the output is directed into a file or might be ignored (written to /dev/null). It runs newsample if the output might be ignored.

begin_mac

cdef macro declaration

register CheckSaveToFile to run on startup

Variable Declarations (simple.mac)

objtype name start_line summary
global example_global 33 this is an example of a global variable
constant A_keV 37 Conversion constant between wavelength (A) and photon energy (keV) ( Eλ=hc)

Macro Declarations (simple.mac)

objtype name start_line end_line summary
def inc1scan 39 46 specify a single motor scan with interval rather than # of intervals
def CheckSaveToFile 48 62 Helps prevent user from writing data to /dev/null by accident.
cdef begin_mac 64 64 register CheckSaveToFile to run on startup