#!/bin/bash # Author: Kevin Sweeney # Date: 4 May 2011 if [[ -n $RESUME_SUBR_H ]]; then true else RESUME_SUBR_H=true function define_class { local classname="$1" shift define_function "$classname:" \ "define_object \$1 $*" } function define_object { local namespace="$1" local instance_field="" shift for instance_field in "$@" do add_instance_field "$namespace" "$instance_field" done if [[ -z $NOAPPEND ]]; then define_function $namespace+ \ "${namespace}__BULLETS[\${#${namespace}__BULLETS[*]}]=\"\$1\"" define_function ${namespace}:__BULLETS \ "echo \"\$${namespace}__BULLETS[@]\"" fi } function add_instance_field { local DOT="." [[ -n $NODOT ]] && DOT="" local namespace="$1" local instance_field="$2" define_function "${namespace}${DOT}${instance_field}:" \ "define_function '${namespace}${DOT}${instance_field}?' \"echo \\\"\$*\\\"\"" } function define_function { local function_name="$1" local function_body="$2" eval "$function_name () { $function_body; }" } NOAPPEND=true NODOT=true define_object "" \ name streetaddress city state zipcode telephone mobilephone telefax \ emailaddress objective define_class section title define_class education name degree graddate define_class position title startdate enddate employer fi # RESUME_SUBR_H