From 09e54097d4098e9ef4d9a0996fff321435dd05dc Mon Sep 17 00:00:00 2001 From: elliott_c Date: Thu, 3 Aug 2006 02:47:45 +0000 Subject: ChangeLogTag: Thu Aug 3 02:45:12 UTC 2006 Chad Elliott --- devtools/document_template.pl | 296 +++++++++++++++++++++++++++++++++++++++++ devtools/highlight_template.pl | 243 +++++++++++++++++++++++++++++++++ 2 files changed, 539 insertions(+) create mode 100755 devtools/document_template.pl create mode 100755 devtools/highlight_template.pl (limited to 'devtools') diff --git a/devtools/document_template.pl b/devtools/document_template.pl new file mode 100755 index 00000000..589f197c --- /dev/null +++ b/devtools/document_template.pl @@ -0,0 +1,296 @@ +eval '(exit $?0)' && eval 'exec perl -w -S $0 ${1+"$@"}' + & eval 'exec perl -w -S $0 $argv:q' + if 0; + +# ****************************************************************** +# Author: Chad Elliott +# Date: 7/12/2006 +# $Id: document_template.pl,v 1.1 2006/02/16 21:38:47 elliottc Exp $ +# ****************************************************************** + +# ****************************************************************** +# Pragma Section +# ****************************************************************** + +use strict; +use FileHandle; +use FindBin; +use File::Spec; +use File::Basename; + +my($basePath) = $FindBin::Bin; +if ($^O eq 'VMS') { + $basePath = File::Spec->rel2abs(dirname($0)) if ($basePath eq ''); + $basePath = VMS::Filespec::unixify($basePath); +} +$basePath = dirname($basePath); +unshift(@INC, $basePath . '/modules'); + +require ProjectCreator; +require TemplateParser; +require ConfigParser; +require StringProcessor; + +# ****************************************************************** +# Data Section +# ****************************************************************** + +my(%keywords) = (); +my(%arrow_op) = (); +my($doc_ext) = '.txt'; +my($version) = '1.1'; + +# ****************************************************************** +# Subroutine Section +# ****************************************************************** + +sub setup_keywords { + my($language) = shift; + + ## Get the main MPC keywords + my($keywords) = ProjectCreator::getKeywords(); + foreach my $key (keys %$keywords) { + $keywords{$key} = 1; + } + + ## Get the MPC valid components + $keywords = ProjectCreator::getValidComponents($language); + foreach my $key (keys %$keywords) { + $keywords{lc($key)} = 1; + } + + ## Get the pseudo template variables + my($pjc) = new ProjectCreator(); + $keywords = $pjc->get_command_subs(); + foreach my $key (keys %$keywords) { + $keywords{$key} = 1; + } + + ## Get the template function names + $keywords = TemplateParser::getKeywords(); + foreach my $key (keys %$keywords) { + $keywords{$key} = 1; + } + + ## Get the template parser arrow operator keys + $keywords = TemplateParser::getArrowOp(); + foreach my $key (keys %$keywords) { + $arrow_op{$key} = 1; + } +} + + +sub display_template { + my($fh) = shift; + my($cp) = shift; + my($input) = shift; + my($tkeys) = shift; + + print $fh '', "\n", + "\n", + " $input\n", + "\n", + "\n", + "

$input

\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n"; + foreach my $key (sort keys %$tkeys) { + my($desc) = $cp->get_value($key) || ' '; + my($def) = undef; + if (defined $$tkeys{$key}) { + foreach my $ikey (sort keys %{$$tkeys{$key}}) { + if (defined $def) { + $def .= ' or '; + } + else { + $def = ''; + } + $def .= StringProcessor::process_special(undef, $ikey); + } + } + print $fh " \n", + " \n", + " \n", + " \n", + " \n"; + } + print $fh "
Template VariableDefault ValueDescription
$key", (defined $def ? $def : ' '), "$desc
\n", + "\n"; +} + + +sub usageAndExit { + print "document_template.pl v$version\n", + "Usage: ", basename($0), "