#! /bin/sh usage() { cat <&2 fi while test $# -gt 0; do case "$1" in -*=*) optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;; *) optarg= ;; esac case $1 in --no-extra-data) no_extra_data=yes ;; --no-extra-method) no_extra_method=yes ;; --overload=*) methods="$methods $optarg" ;; --*) usage 1 1>&2 ;; *) if test -z "$Object"; then Object=$1 elif test -z "$ParentObject"; then ParentObject=$1 else usage 1 1>&2 fi ;; esac shift done if test -z "$Object" -o -z "$ParentObject"; then usage 1 1>&2 fi object=`form_name $Object` ObjectName=$Object if test "$no_extra_data" = "yes"; then Object=$ParentObject fi OBJECT=`echo $object | awk '{print toupper ($1)}'` if test "$no_extra_method" = "yes"; then ObjectClass=$ParentObject"Class" else ObjectClass=$ObjectName"Class" OBJECT_CLASS=$OBJECT"_CLASS" fi parent_object=`form_name $ParentObject` parent_object_class=$parent_object"_class" ParentObjectClass=$ParentObject"Class" object_class=$object"_class" cat <*/ $ParentObject parent; /*< public >*/ /* add extra data here (if public) */ }; EOF fi if test "$no_extra_method" != "yes"; then cat <*/ $ParentObjectClass parent_class; /*< public >*/ /* add extra methods here */ }; EOF fi if test "$no_extra_data" != "yes"; then cat <parent_class->destroy) (object); } EOF ;; read) object_read=$object"_read" cat <parent_class->read) (* GTS_OBJECT_CLASS ($object_class ())->parent_class->read) (o, fp); if (fp->type == GTS_ERROR) return; /* do object-specific read here */ /* do not forget to prepare for next read */ gts_file_next_token (fp); } EOF ;; write) object_write=$object"_write" cat <parent_class->write) (* GTS_OBJECT_CLASS ($object_class ())->parent_class->write) (o, fp); /* do object specific write here */ } EOF ;; color) object_color=$object"_color" cat <parent_class)->event) (event, sim)) { /* do object-specific event here */ return TRUE; } return FALSE; } EOF ;; *) echo "gtstemplate: unknown method '$method'" exit 1; ;; esac done if test -n "$methods" -o "$no_extra_method" != "yes"; then object_class_init=$object_class"_init" cat <event = $object_event; EOF fi if test -n "$object_read"; then cat <read = $object_read; EOF fi if test -n "$object_write"; then cat <write = $object_write; EOF fi if test -n "$object_color"; then cat <color = $object_color; EOF fi if test -n "$object_destroy"; then cat <destroy = $object_destroy; EOF fi cat <