Prev Next src_example

Example Inclusion of Source Code

Inline Source Code
The following is an example of in-line source code

     extern std::set< std::string > string_set(const char* c_string);

Contents of src_example.py
Note that a newline is automatically added at the beginning of a file:
     #! /usr/bin/python3
     import sys
     # BEGIN USAGE
     usage = 'src_example.py value'
     # END USAGE
     if len(sys.argv) != 2 :
          sys.exit(usage)
     value  = float( sys.argv[1] )
     square = value * value
     output = 'value * value = ' + str(square)
     print(output)

Escape Character
Change the escape character from # to ! so # can be used normally as part of the start and stop sequences:

Just Usage Message
Note that the newline following # BEGIN USAGE is included:

     usage = 'src_example.py value'

Input File: getstarted/src_example.omh