From 48a7fa31f918a6fc88719b3c9393a9ba2829f42a Mon Sep 17 00:00:00 2001 From: Joel Sherrill Date: Tue, 15 Nov 2016 10:37:59 -0600 Subject: Remove texinfo format documentation. Replaced by Sphinx formatted documentation. closes #2812. --- doc/tools/Makefile.am | 6 - doc/tools/bmenu/Makefile.am | 9 - doc/tools/bmenu/address.h | 35 -- doc/tools/bmenu/base.h | 96 ---- doc/tools/bmenu/bmenu2.c | 1045 ------------------------------------------- doc/tools/bmenu/chain.c | 189 -------- doc/tools/bmenu/chain.h | 347 -------------- doc/tools/bmenu/chain.inl | 234 ---------- doc/tools/bmenu/system.h | 29 -- doc/tools/configure.ac | 28 -- doc/tools/word-replace2 | 98 ---- 11 files changed, 2116 deletions(-) delete mode 100644 doc/tools/Makefile.am delete mode 100644 doc/tools/bmenu/Makefile.am delete mode 100644 doc/tools/bmenu/address.h delete mode 100644 doc/tools/bmenu/base.h delete mode 100644 doc/tools/bmenu/bmenu2.c delete mode 100644 doc/tools/bmenu/chain.c delete mode 100644 doc/tools/bmenu/chain.h delete mode 100644 doc/tools/bmenu/chain.inl delete mode 100644 doc/tools/bmenu/system.h delete mode 100644 doc/tools/configure.ac delete mode 100644 doc/tools/word-replace2 (limited to 'doc/tools') diff --git a/doc/tools/Makefile.am b/doc/tools/Makefile.am deleted file mode 100644 index 75db2d77b0..0000000000 --- a/doc/tools/Makefile.am +++ /dev/null @@ -1,6 +0,0 @@ -ACLOCAL_AMFLAGS = -I ../../aclocal - -EXTRA_DIST = word-replace2 - -SUBDIRS = bmenu -#texi2www diff --git a/doc/tools/bmenu/Makefile.am b/doc/tools/bmenu/Makefile.am deleted file mode 100644 index 53ca36cd35..0000000000 --- a/doc/tools/bmenu/Makefile.am +++ /dev/null @@ -1,9 +0,0 @@ -# -# COPYRIGHT (c) 1988-2002. -# On-Line Applications Research Corporation (OAR). -# All rights reserved. - -noinst_PROGRAMS = bmenu2 - -bmenu2_SOURCES = address.h chain.c chain.h bmenu2.c base.h \ - chain.inl system.h diff --git a/doc/tools/bmenu/address.h b/doc/tools/bmenu/address.h deleted file mode 100644 index 9b19615c74..0000000000 --- a/doc/tools/bmenu/address.h +++ /dev/null @@ -1,35 +0,0 @@ -/* - * This include file contains the information required to manipulate - * physical addresses. - */ - -/* - * COPYRIGHT (c) 1988-2002. - * On-Line Applications Research Corporation (OAR). - * All rights reserved. - */ - -#ifndef __ADDRESSES_h -#define __ADDRESSES_h - -#include - -/* - * _Addresses_Add_offset - * - * DESCRIPTION: - * - * This function is used to add an offset to a base address. - * It returns the resulting address. This address is typically - * converted to an access type before being used further. - */ -STATIC INLINE void *_Addresses_Add_offset ( - void *base, - size_t offset -) -{ - return (base + offset); -} - -#endif -/* end of include file */ diff --git a/doc/tools/bmenu/base.h b/doc/tools/bmenu/base.h deleted file mode 100644 index 7e0b477cb4..0000000000 --- a/doc/tools/bmenu/base.h +++ /dev/null @@ -1,96 +0,0 @@ -/* - * COPYRIGHT (c) 1988-2002. - * On-Line Applications Research Corporation (OAR). - * All rights reserved. - */ - -#ifndef __PDL2AMI_h -#define __PDL2AMI_h - -#include "system.h" -#include "chain.h" - -/* - * Paragraph size should be kept down because it is allocated for each - * Line_Control. If this number is large, the memory requirements for - * the program increase significantly. - */ - -#define BUFFER_SIZE (2 * 1024) -#define PARAGRAPH_SIZE (2 * 1024) - -#define NUMBER_ELEMENTS( _x ) (sizeof(_x) / sizeof _x[0]) - -void exit_application( - int status -); - -void ProcessFile( - char *inname, - char *outname -); - -void strtolower( - char *dest, - char *src -); - -void strtoInitialCaps( - char *dest, - char *src -); - -void StripBlanks( void ); - -void MergeParagraphs( void ); - -int CheckForIncomplete( void ); - -int CheckOutline( void ); - -int CheckSections( void ); - -void GenerateLists( void ); - -void GenerateAList( - char *section, - Chain_Control *the_list -); - -void LookForInternalInconsistencies( void ); - -int Match_Argument( - char **array, - int entries, - char *users -); - -void usage( void ); - -void ReadFileIntoChain( - char *inname -); - -int MergeText( void ); - -int CheckForBadWhiteSpace(); - -void RemoveCopyright(); - -void RemovePagebreaks(); - -int RemoveExtraBlankLines(); - -void FormatToTexinfo( void ); - -void PrintFile( - char *out -); - -void DumpList( - Chain_Control *the_list -); - -void ReleaseFile(); - -#endif diff --git a/doc/tools/bmenu/bmenu2.c b/doc/tools/bmenu/bmenu2.c deleted file mode 100644 index 7cb0188802..0000000000 --- a/doc/tools/bmenu/bmenu2.c +++ /dev/null @@ -1,1045 +0,0 @@ -/* - * main.c - * - * This program takes a texinfo file without node and menu commands, - * build those commands and inserts them. - * - * It works by reading the input file into a linked list of lines - * and then performing sweeps on that list until all formatting is - * complete. After the program is run, there is still a little - * clean up to be performed by hand. The following have to be fixed - * by hand: - * + previous of the first node - * + next of the last node - * - * COPYRIGHT (c) 1989-2011. - * On-Line Applications Research Corporation (OAR). - * All rights reserved. - */ - -#include -#include -#include -#include -#include -#include - -/* XXX -- just for testing -- these should be set by options */ -char TopString[] = "Top"; -char EmptyString[] = ""; - -char *DocsNextNode; -char *DocsPreviousNode; -char *DocsUpNode; -int NodeNameIncludesChapter = 1; - -extern int optind; /* Why is this not in ? */ -extern char *optarg; /* Why is this not in ? */ - -#ifndef NAME_MAX -#define NAME_MAX 14 /* Why is the one in limits.h not showing up? */ -#endif -#define INIT_DATA - -#include "base.h" - -boolean Verbose; /* status/debug msgs */ -Chain_Control Lines; - -FILE *OutFile; - -static void ProcessFile2( - FILE *infile, - FILE *outfile ); -static void PrintFile2( - FILE *outfile ); -static void ReadFileIntoChain2( - FILE *InFile ); - -/************************************************************************* - ************************************************************************* - ***** DATA TYPES AND CONSTANT TABLES ***** - ************************************************************************* - *************************************************************************/ -/* - * Usage Information - */ - -char *Usage_Strings[] = { - "\n", - "usage: cmd [-cv] [-p prev] [-n next] [-u up] \n", - "\n", - "EOF" -}; - -/* - * The page separator is not really a keyword and will be purged before - * it is seen elsewhere. - */ - -#define PAGE_SEPARATOR "#PAGE" - -/* - * Section Delimiter Keywords - */ - -#define MAXIMUM_KEYWORD_LENGTH 32 - -/* - * Level indicates where in the format the delimiter is allowed to occur. - * 1 indicates a major section divider (e.g. "ATTRIBUTE DESCRIPTIONS:"). - * 2 indicates a subsection (e.g. "ATTRIBUTE:"). - * 3 indicates a heading (e.g. "DESCRIPTION:"). - */ - -#define TEXT 0 -#define SECTION 1 -#define SUBSECTION 2 -#define SUBSUBSECTION 3 -#define HEADING 4 - -typedef enum { - UNUSED, /* dummy 0 slot */ - KEYWORD_CHAPTER, - KEYWORD_APPENDIX, - KEYWORD_PREFACE, - KEYWORD_CHAPHEADING, - KEYWORD_SECTION, - KEYWORD_SUBSECTION, - KEYWORD_SUBSUBSECTION, - KEYWORD_RAISE, - KEYWORD_LOWER, - KEYWORD_OTHER, - KEYWORD_END - -} Keyword_indices_t; - -#define KEYWORD_FIRST KEYOWRD_CHAPTER -#define KEYWORD_LAST KEYWORD_END - -/* - * Line Management Structure - */ - -typedef enum { - NO_EXTRA_FORMATTING_INFO, - RAW_OUTPUT, - PARAGRAPH_OUTPUT -} ExtraFormat_info_t; - -typedef struct { - Chain_Node Node; - Keyword_indices_t keyword; /* unused is unknown/undecided */ - ExtraFormat_info_t format; - int number; - int level; - char Contents[ PARAGRAPH_SIZE ]; -} Line_Control; - -typedef enum { - RT_FORBIDDEN, /* no text to right allowed */ - RT_OPTIONAL, /* text to right optional -- none below */ - RT_NONE, /* text to right is "none" or nothing -- none below */ - RT_REQUIRED, /* text to right required -- none below */ - RT_BELOW, /* text to right forbidden -- text below required */ - RT_NONE_OR_BELOW, /* text to right is "none" OR there is text below */ - RT_EITHER, /* text to right OR below */ - RT_BOTH /* text to right AND below */ -} Keywords_text_mode_t; - -typedef enum { - BL_FORBIDDEN, /* text below forbidden */ - BL_FORMATTED, /* text below is to be formatted as paragraphs */ - BL_RAW, /* text below is to be unprocessed by this program */ -} Keywords_text_below_t; - -typedef (*Keyword_validater_t)( Line_Control * ); - -typedef struct { - char Name[ MAXIMUM_KEYWORD_LENGTH ]; - int level; - Keywords_text_mode_t text_mode; - Keywords_text_below_t text_below_mode; - Keyword_validater_t keyword_validation_routine; -} Keyword_info_t; - -Keyword_info_t Keywords[] = { - { "unused", 0, 0, 0, NULL }, /* so 0 can be invalid */ - { "@chapter", SECTION, RT_FORBIDDEN, BL_FORBIDDEN, NULL }, - { "@appendix", SECTION, RT_FORBIDDEN, BL_FORBIDDEN, NULL }, - { "@preface", SECTION, RT_FORBIDDEN, BL_FORBIDDEN, NULL }, - { "@chapheading", SECTION, RT_FORBIDDEN, BL_FORBIDDEN, NULL }, - { "@section", SECTION, RT_FORBIDDEN, BL_FORBIDDEN, NULL }, - { "@subsection", SUBSECTION, RT_FORBIDDEN, BL_FORBIDDEN, NULL }, - { "@subsubsection", SUBSUBSECTION, RT_FORBIDDEN, BL_FORBIDDEN, NULL }, - { "@raise", SUBSECTION, RT_FORBIDDEN, BL_FORBIDDEN, NULL }, - { "@lower", SUBSECTION, RT_FORBIDDEN, BL_FORBIDDEN, NULL }, - { "", HEADING, RT_FORBIDDEN, BL_FORBIDDEN, NULL }, - { "END OF FILE", SECTION, RT_FORBIDDEN, BL_FORBIDDEN, NULL } -}; - -#define NUMBER_OF_KEYWORDS \ - ( sizeof( Keywords ) / sizeof( Keyword_info_t ) ) - 2 - -/* - * exit_application - */ - -void exit_application( - int status -) -{ - fprintf( stderr, "*** Error encountered ***\n" ); -/* - fprintf( stderr, "*** Error encountered on line %d ***\n", CurrentLine ); -*/ - fclose( OutFile ); - exit( status ); -} - -/************************************************************************* - ************************************************************************* - ***** LINE MANIPULATION ROUTINES ***** - ************************************************************************* - *************************************************************************/ - -/* - * PrintLine - */ - -void PrintLine( - Line_Control *line -) -{ - assert( line ); - - if ( line->number == -1 ) - fprintf( stderr, " " ); - else - fprintf( stderr, "%5d", line->number ); - -#if 0 - fprintf( stderr, "%s\n", line->Contents ); -#else - /* - * Include some debugging information - */ - fprintf( - stderr, - "<%d,%d,%d>:%s\n", - line->keyword, - line->format, - line->level, - line->Contents - ); -#endif -} - -Chain_Control Line_Pool; - -/* - * FillLinePool - */ - -void FillLinePool( void ) -{ - void *pool; - -#define LINE_POOL_FILL_COUNT 100 - - pool = malloc( sizeof( Line_Control ) * LINE_POOL_FILL_COUNT ); - assert( pool ); - - _Chain_Initialize( - &Line_Pool, - pool, - LINE_POOL_FILL_COUNT, - sizeof( Line_Control ) - ); -} - -/* - * AllocateLine - */ - -Line_Control *AllocateLine( void ) -{ - Line_Control *new_line; - - new_line = (Line_Control *) _Chain_Get( &Line_Pool ); - if ( !new_line ) { - FillLinePool(); - new_line = (Line_Control *) _Chain_Get( &Line_Pool ); - assert( new_line ); - } - -/* - * This is commented out because although it is helpful during debug, - * it consumes a significant percentage of the program's execution time. - - memset( new_line->Contents, '\0', sizeof( new_line->Contents ) ); -*/ - new_line->number = -1; - new_line->level = -1; - - new_line->keyword = UNUSED; - new_line->format = NO_EXTRA_FORMATTING_INFO; - - new_line->Node.next = NULL; - new_line->Node.previous = NULL; - - return new_line; -} - -/* - * FreeLine - */ - -void FreeLine( - Line_Control *line -) -{ - fflush( stdout ); - _Chain_Append( &Line_Pool, &line->Node ); -} - -/* - * DeleteLine - */ - -Line_Control *DeleteLine( - Line_Control *line -) -{ - Line_Control *next; - - next = (Line_Control *)line->Node.next; - _Chain_Extract( &line->Node ); - FreeLine( line ); - return next; -} - -/* - * PrintSurroundingLines - */ - -void PrintSurroundingLines( - Line_Control *line, - int backward, - int forward -) -{ - int i; - int real_backward; - Line_Control *local; - - for ( local=line, real_backward=0, i=1 ; - i<=backward ; - i++, real_backward++ ) { - if ( &local->Node == Lines.first ) - break; - local = (Line_Control *) local->Node.previous; - } - - for ( i=1 ; i<=real_backward ; i++ ) { - PrintLine( local ); - local = (Line_Control *) local->Node.next; - } - - PrintLine( local ); - - for ( i=1 ; i<=forward ; i++ ) { - local = (Line_Control *) local->Node.next; - if ( _Chain_Is_last( &local->Node ) ) - break; - PrintLine( local ); - } - -} - -/* - * SetLineFormat - */ - -void SetLineFormat( - Line_Control *line, - ExtraFormat_info_t format -) -{ - if ( line->format != NO_EXTRA_FORMATTING_INFO ) { - fprintf( stderr, "Line %d is already formatted\n", line->number ); - PrintLine( line ); - assert( FALSE ); - } - - line->format = format; -} - -/* - * LineCopyFromRight - */ - -void LineCopyFromRight( - Line_Control *line, - char *dest -) -{ - char *p; - - for ( p=line->Contents ; *p != ' ' ; p++ ) - ; - p++; /* skip the ' ' */ - for ( ; isspace( *p ) ; p++ ) - ; - - strcpy( dest, p ); - -} - -/* - * LineCopySectionName - */ - -void LineCopySectionName( - Line_Control *line, - char *dest -) -{ - char *p; - char *d; - - p = line->Contents; - d = dest; - - if ( *p == '@' ) { /* skip texinfo command */ - while ( !isspace( *p++ ) ) - ; - } - - for ( ; *p ; ) - *d++ = *p++; - - *d = '\0'; -} - -/************************************************************************* - ************************************************************************* - ***** END OF LINE MANIPULATION ROUTINES ***** - ************************************************************************* - *************************************************************************/ - -/* - * main - */ - -int main( - int argc, - char **argv -) -{ - int c; - int index; - boolean single_file_mode; - - OutFile = stdout; - Verbose = FALSE; - DocsNextNode = EmptyString; - DocsPreviousNode = TopString; - DocsUpNode = TopString; - - while ((c = getopt(argc, argv, "vcp:n:u:")) != EOF) { - switch (c) { - case 'v': - Verbose = TRUE; - break; - case 'c': - NodeNameIncludesChapter = 0; - break; - case 'p': - DocsPreviousNode = strdup(optarg); - break; - case 'n': - DocsNextNode = strdup(optarg); - break; - case 'u': - DocsUpNode = strdup(optarg); - break; - - case '?': - usage(); - return 0; - } - } - - if ( optind != argc ) - { - usage(); - return 0 ; - } - - if ( Verbose ) - fprintf( stderr, "Arguments successfully parsed\n" ); - - FillLinePool(); - - ProcessFile2( stdin, stdout ); - - if ( Verbose ) - fprintf( stderr, "Exitting\n" ); - - return 0; -} - -/* - * ProcessFile - */ - -void ProcessFile2( - FILE *infile, - FILE *outfile -) -{ - int index; - - /* - * Read the file into our internal data structure - */ - - if ( Verbose ) - printf( "Processing (%s) -> (%s)\n", "stdin", "stdout" ); - - ReadFileIntoChain2( infile ); - - if ( Verbose ) - fprintf( stderr, "-------->FILE READ IN\n" ); - - /* - * Remove any spaces before the keyword and mark each keyword line as - * such. Also remove extra white space at the end of lines. - */ - - StripBlanks(); - - if ( Verbose ) - fprintf( stderr, "-------->BLANKS BEFORE KEYWORDS STRIPPED\n" ); - - - FormatToTexinfo(); - - if ( Verbose ) - fprintf( stderr, "-------->FILE FORMATTED TO TEXINFO\n" ); - - /* - * Print the file - */ - - PrintFile2( outfile ); - - if ( Verbose ) - fprintf( stderr, "-------->FILE PRINTED\n" ); - - /* - * Clean Up - */ - - ReleaseFile(); - - if ( Verbose ) - fprintf( stderr, "-------->FILE RELEASED\n" ); -} - -/* - * usage - */ - -void usage( void ) -{ - int index; - - for ( index=0 ; strcmp( Usage_Strings[ index ], "EOF" ) ; index++ ) - fprintf( stderr, Usage_Strings[ index ] ); -} - -/* - * ReadFileIntoChain - */ - -void ReadFileIntoChain2( - FILE *InFile -) -{ - int line_count; - int max_length; - char *line; - char Buffer[ BUFFER_SIZE ]; - Line_Control *new_line; - - if ( !InFile ) { - fprintf( stderr, "Unable to open (%s)\n", "stdin" ); - exit( 1 ); - } - assert( InFile ); - - max_length = 0; - line_count = 0; - - _Chain_Initialize_empty( &Lines ); - - for ( ;; ) { - line = fgets( Buffer, BUFFER_SIZE, InFile ); - if ( !line ) - break; - - Buffer[ strlen( Buffer ) - 1 ] = '\0'; - - new_line = AllocateLine(); - - strcpy( new_line->Contents, Buffer ); - - new_line->number = ++line_count; - - _Chain_Append( &Lines, &new_line->Node ); - } - - fclose( InFile ); -} - -/* - * StripBlanks - */ - -void StripBlanks( void ) -{ - Line_Control *line; - Keyword_indices_t index; - int indentation; - int length; - - for ( line = (Line_Control *) Lines.first ; - !_Chain_Is_last( &line->Node ) ; - line = (Line_Control *) line->Node.next - ) { - - /* - * Strip white space from the end of each line - */ - - length = strlen( line->Contents ); - - while ( isspace( line->Contents[ --length ] ) ) - line->Contents[ length ] = '\0'; - - if ( strstr( line->Contents, "@chapter" ) ) - line->keyword = KEYWORD_CHAPTER; - else if ( strstr( line->Contents, "@appendix" ) ) - line->keyword = KEYWORD_APPENDIX; - else if ( strstr( line->Contents, "@preface" ) ) - line->keyword = KEYWORD_PREFACE; - else if ( strstr( line->Contents, "@chapheading" ) ) - line->keyword = KEYWORD_CHAPHEADING; - else if ( strstr( line->Contents, "@section" ) ) - line->keyword = KEYWORD_SECTION; - else if ( strstr( line->Contents, "@subsection" ) ) - line->keyword = KEYWORD_SUBSECTION; - else if ( strstr( line->Contents, "@subsubsection" ) ) - line->keyword = KEYWORD_SUBSUBSECTION; - else if ( strstr( line->Contents, "@raise" ) ) - line->keyword = KEYWORD_RAISE; - else if ( strstr( line->Contents, "@lower" ) ) - line->keyword = KEYWORD_LOWER; - else - line->keyword = KEYWORD_OTHER; - - } - line = AllocateLine(); - line->keyword = KEYWORD_END; - _Chain_Append( &Lines, &line->Node ); -} - -/* - * strIsAllSpace - */ - -boolean strIsAllSpace( - char *s -) -{ - char *p; - - for ( p = s ; *p ; p++ ) - if ( !isspace( *p ) ) - return FALSE; - - return TRUE; -} - -/* - * BuildTexinfoNodes - */ - -void BuildTexinfoNodes( void ) -{ - char Buffer[ BUFFER_SIZE ]; - Line_Control *line; - Line_Control *next_node; - Line_Control *up_node; - Line_Control *new_line; - Line_Control *menu_insert_point; - Line_Control *node_line; - int next_found; - int menu_items; - Keyword_indices_t index; - char ChapterName[ BUFFER_SIZE ]; - char NodeName[ BUFFER_SIZE ]; - char UpNodeName[ BUFFER_SIZE ]; - char NextNodeName[ BUFFER_SIZE ]; - char PreviousNodeName[ BUFFER_SIZE ]; - - /* - * Set Initial Previous Node Name - */ - - strcpy( PreviousNodeName, DocsPreviousNode ); - - for ( line = (Line_Control *) Lines.first ; - !_Chain_Is_last( &line->Node ) ; - line = (Line_Control *) line->Node.next - ) { - - if ( line->level == -1 ) - continue; - - LineCopyFromRight( line, NodeName ); - - if ( line->keyword == KEYWORD_CHAPTER || - line->keyword == KEYWORD_APPENDIX || - line->keyword == KEYWORD_PREFACE || - line->keyword == KEYWORD_CHAPHEADING ) { - - strcpy( ChapterName, NodeName ); - - } else if ( NodeNameIncludesChapter ) { - - sprintf( Buffer, "%s %s", ChapterName, NodeName ); - strcpy( NodeName, Buffer ); - } - - /* - * Set Default Next Node Name - */ - - next_found = FALSE; - strcpy( NextNodeName, DocsNextNode ); - - /* - * Go ahead and put it on the chain in the right order (ahead of - * the menu) and we can fill it in later (after the menu is built). - */ - - new_line = AllocateLine(); - strcpy( new_line->Contents, "" ); /*"@ifinfo" ); */ - _Chain_Insert( line->Node.previous, &new_line->Node ); - - node_line = AllocateLine(); - _Chain_Insert( line->Node.previous, &node_line->Node ); - - new_line = AllocateLine(); - strcpy( new_line->Contents, "" ); /* "@end ifinfo" ); */ - _Chain_Insert( line->Node.previous, &new_line->Node ); - - next_node = (Line_Control *) line->Node.next; - menu_insert_point = next_node; - menu_items = 0; - - for ( ; ; ) { - if ( next_node->keyword == KEYWORD_END ) - break; - - if ( next_node->level == -1 ) - goto continue_menu_loop; - - LineCopySectionName( next_node, Buffer ); - if ( !next_found ) { - next_found = TRUE; - if (NodeNameIncludesChapter) - sprintf( NextNodeName, "%s %s", ChapterName, Buffer ); - else - sprintf( NextNodeName, "%s", Buffer ); - } - - if ( next_node->level <= line->level ) - break; - - if ( next_node->level != (line->level + 1) ) - goto continue_menu_loop; - - if ( menu_items == 0 ) { - new_line = AllocateLine(); - strcpy( new_line->Contents, "" ); /* "@ifinfo" ); */ - _Chain_Insert( menu_insert_point->Node.previous, &new_line->Node ); - - new_line = AllocateLine(); - strcpy( new_line->Contents, "@menu" ); - _Chain_Insert( menu_insert_point->Node.previous, &new_line->Node ); - } - - menu_items++; - - new_line = AllocateLine(); - if (NodeNameIncludesChapter) - sprintf( new_line->Contents, "* %s %s::", ChapterName, Buffer ); - else - sprintf( new_line->Contents, "* %s::", Buffer ); - _Chain_Insert( menu_insert_point->Node.previous, &new_line->Node ); - -continue_menu_loop: - next_node = (Line_Control *) next_node->Node.next; - } - - /* - * If menu items were generated, then insert the end of menu stuff. - */ - - if ( menu_items ) { - new_line = AllocateLine(); - strcpy( new_line->Contents, "@end menu" ); - _Chain_Insert( menu_insert_point->Node.previous, &new_line->Node ); - - new_line = AllocateLine(); - strcpy( new_line->Contents, "" ); /* "@end ifinfo" ); */ - _Chain_Insert( menu_insert_point->Node.previous, &new_line->Node ); - } - - /* - * Find the UpNodeName - */ - -/* DumpList( &Lines ); */ - - if ( line->level == 0 ) { - strcpy( UpNodeName, DocsUpNode ); - } else { - for ( up_node = line; - up_node && !_Chain_Is_first((Chain_Node *)up_node) ; - up_node = (Line_Control *) up_node->Node.previous - ) { - - if ( (up_node->level == -1) ) - continue; - - if ( up_node->level == (line->level - 1) ) { - LineCopySectionName( up_node, Buffer ); - if (NodeNameIncludesChapter) { - if (!strcmp(ChapterName, Buffer)) - sprintf( UpNodeName, "%s", Buffer ); - else - sprintf( UpNodeName, "%s %s", ChapterName, Buffer ); - } else - sprintf( UpNodeName, "%s", Buffer ); - break; - } - } - } - - /* - * Update the node information - */ - -#if 0 - fprintf( - stderr, - "@node %s, %s, %s, %s\n", - NodeName, - NextNodeName, - PreviousNodeName, - UpNodeName - ); -#endif - - /* node_line was previously inserted */ - if (!NodeNameIncludesChapter) { - sprintf( - node_line->Contents, - "@node %s, %s, %s, %s", - NodeName, - NextNodeName, - PreviousNodeName, - UpNodeName - ); - } else { - sprintf( - node_line->Contents, - "@node %s, %s, %s, %s", - NodeName, - NextNodeName, - PreviousNodeName, - UpNodeName - ); - } - - strcpy( PreviousNodeName, NodeName ); - - /* PrintLine( line ); */ - } -} - -/* - * FormatToTexinfo - */ - -void FormatToTexinfo( void ) -{ - Line_Control *line; - int baselevel = 0; - int currentlevel; - - if ( Verbose ) - fprintf( stderr, "-------->INSERTING TEXINFO MENUS\n" ); - - for ( line = (Line_Control *) Lines.first ; - !_Chain_Is_last( &line->Node ) ; - line = (Line_Control *) line->Node.next ) { - - switch (line->keyword) { - case UNUSED: - case KEYWORD_OTHER: - case KEYWORD_END: - line->level = -1; - break; - case KEYWORD_CHAPTER: - case KEYWORD_APPENDIX: - case KEYWORD_PREFACE: - case KEYWORD_CHAPHEADING: - currentlevel = 0; - line->level = baselevel + currentlevel; - break; - case KEYWORD_SECTION: - currentlevel = 1; - line->level = baselevel + currentlevel; - break; - case KEYWORD_SUBSECTION: - currentlevel = 2; - line->level = baselevel + currentlevel; - break; - case KEYWORD_SUBSUBSECTION: - currentlevel = 3; - line->level = baselevel + currentlevel; - break; - case KEYWORD_RAISE: - assert( baselevel ); - baselevel--; - line->level = -1; - break; - case KEYWORD_LOWER: - baselevel++; - line->level = -1; - break; - } - } - - BuildTexinfoNodes(); -} - -/* - * PrintFile - */ - -void PrintFile2( - FILE *OutFile -) -{ - Line_Control *line; - - if ( !OutFile ) { - fprintf( stderr, "Unable to open (%s) for output\n", "stdout" ); - exit_application( 1 ); - } - assert( OutFile ); - - for ( line = (Line_Control *) Lines.first ; - !_Chain_Is_last( &line->Node ) ; - line = (Line_Control *) line->Node.next ) { - fprintf( OutFile, "%s\n", line->Contents ); -/* - fprintf( - OutFile, - "(%d,%d)%s\n", - line->keyword, - line->format, - line->Contents - ); -*/ - } -} - -/* - * DumpList - */ - -void DumpList( - Chain_Control *the_list -) -{ - Line_Control *line; - - fprintf( stderr, "---> Dumping list (%p)\n", the_list ); - - for ( line = (Line_Control *) the_list->first ; - !_Chain_Is_last( &line->Node ) ; - line = (Line_Control *) line->Node.next ) { - /* if (line->level != -1) */ - PrintLine( line ); - /* fprintf( stderr, "%s\n", line->Contents ); */ - } -} - -/* - * ReleaseFile - */ - -void ReleaseFile() -{ - Line_Control *line; - Line_Control *next; - - for ( line = (Line_Control *) Lines.first ; - !_Chain_Is_last( &line->Node ) ; - ) { - next = (Line_Control *) line->Node.next; - line = next; - } -} - -/* - * strtoInitialCaps - */ - -void strtoInitialCaps( - char *dest, - char *src -) -{ - char *source = src; - char *destination = dest; - - source = src; - destination = (dest) ? dest : src; - - while ( *source ) { - while ( isspace( *source ) ) - *destination++ = *source++; - - if ( !*source ) - break; - - *destination++ = toupper( *source++ ); - - for ( ; *source && !isspace( *source ) ; source++ ) - *destination++ = tolower( *source ); - - if ( !*source ) - break; - } - - *destination = '\0'; -} diff --git a/doc/tools/bmenu/chain.c b/doc/tools/bmenu/chain.c deleted file mode 100644 index e50c06fd28..0000000000 --- a/doc/tools/bmenu/chain.c +++ /dev/null @@ -1,189 +0,0 @@ -/* - * Chain Handler - * - * COPYRIGHT (c) 1988-2002. - * On-Line Applications Research Corporation (OAR). - * All rights reserved. - */ - -#include "system.h" -#include "address.h" -#include "chain.h" - -/*PAGE - * - * _Chain_Initialize - * - * This kernel routine initializes a doubly linked chain. - * - * Input parameters: - * the_chain - pointer to chain header - * starting_address - starting address of first node - * number_nodes - number of nodes in chain - * node_size - size of node in bytes - * - * Output parameters: NONE - */ - -void _Chain_Initialize( - Chain_Control *the_chain, - void *starting_address, - size_t number_nodes, - size_t node_size -) -{ - size_t count; - Chain_Node *current; - Chain_Node *next; - - count = number_nodes; - current = _Chain_Head( the_chain ); - the_chain->permanent_null = NULL; - next = (Chain_Node *)starting_address; - while ( count-- ) { - current->next = next; - next->previous = current; - current = next; - next = (Chain_Node *) - _Addresses_Add_offset( (void *) next, node_size ); - } - current->next = _Chain_Tail( the_chain ); - the_chain->last = current; -} - -/*PAGE - * - * _Chain_Get - * - * This kernel routine returns a pointer to a node taken from the - * given chain. - * - * Input parameters: - * the_chain - pointer to chain header - * - * Output parameters: - * return_node - pointer to node in chain allocated - * CHAIN_END - if no nodes available - * - * INTERRUPT LATENCY: - * only case - */ - -Chain_Node *_Chain_Get( - Chain_Control *the_chain -) -{ - Chain_Node *return_node; - - return_node = NULL; - if ( !_Chain_Is_empty( the_chain ) ) - return_node = _Chain_Get_first_unprotected( the_chain ); - return return_node; -} - -/*PAGE - * - * _Chain_Append - * - * This kernel routine puts a node on the end of the specified chain. - * - * Input parameters: - * the_chain - pointer to chain header - * node - address of node to put at rear of chain - * - * Output parameters: NONE - * - * INTERRUPT LATENCY: - * only case - */ - -void _Chain_Append( - Chain_Control *the_chain, - Chain_Node *node -) -{ - _Chain_Append_unprotected( the_chain, node ); -} - -/*PAGE - * - * _Chain_Extract - * - * This kernel routine deletes the given node from a chain. - * - * Input parameters: - * node - pointer to node in chain to be deleted - * - * Output parameters: NONE - * - * INTERRUPT LATENCY: - * only case - */ - -void _Chain_Extract( - Chain_Node *node -) -{ - _Chain_Extract_unprotected( node ); -} - -/*PAGE - * - * _Chain_Insert - * - * This kernel routine inserts a given node after a specified node - * a requested chain. - * - * Input parameters: - * after_node - pointer to node in chain to be inserted after - * node - pointer to node to be inserted - * - * Output parameters: NONE - * - * INTERRUPT LATENCY: - * only case - */ - -void _Chain_Insert( - Chain_Node *after_node, - Chain_Node *node -) -{ - _Chain_Insert_unprotected( after_node, node ); -} - -/*PAGE - * - * _Chain_Insert_chain - * - * This routine inserts a chain after the specified node in another - * chain. It is assumed that the insert after node is not on the - * second chain. - * - * Input parameters: - * insert_after - insert the chain after this node - * to_insert - the chain to insert - */ - -void _Chain_Insert_chain( - Chain_Node *insert_after, - Chain_Control *to_insert -) -{ - Chain_Node *first; - Chain_Node *last; - Chain_Node *insert_after_next; - - first = to_insert->first; - last = to_insert->last; - - insert_after_next = insert_after->next; - - insert_after->next = first; - first->previous = insert_after; - - insert_after_next->previous = last; - last->next = insert_after_next; - - _Chain_Initialize_empty( to_insert ); -} diff --git a/doc/tools/bmenu/chain.h b/doc/tools/bmenu/chain.h deleted file mode 100644 index 9b1b009d30..0000000000 --- a/doc/tools/bmenu/chain.h +++ /dev/null @@ -1,347 +0,0 @@ -/* chain.h - * - * This include file contains all the constants and structures associated - * with the Doubly Linked Chain Handler. - * - * COPYRIGHT (c) 1988-2002. - * On-Line Applications Research Corporation (OAR). - * All rights reserved. - */ - -#ifndef __CHAIN_h -#define __CHAIN_h - -#include - -#include "address.h" - -/* - * This is used to manage each element (node) which is placed - * on a chain. - * - * NOTE: Typically, a more complicated structure will use the - * chain package. The more complicated structure will - * include a chain node as the first element in its - * control structure. It will then call the chain package - * with a pointer to that node element. The node pointer - * and the higher level structure start at the same address - * so the user can cast the pointers back and forth. - */ - -typedef struct Chain_Node_struct Chain_Node; - -struct Chain_Node_struct { - Chain_Node *next; - Chain_Node *previous; -}; - -/* - * This is used to manage a chain. A chain consists of a doubly - * linked list of zero or more nodes. - * - * NOTE: This implementation does not require special checks for - * manipulating the first and last elements on the chain. - * To accomplish this the chain control structure is - * treated as two overlapping chain nodes. The permanent - * head of the chain overlays a node structure on the - * first and permanent_null fields. The permanent tail - * of the chain overlays a node structure on the - * permanent_null and last elements of the structure. - */ - -typedef struct { - Chain_Node *first; - Chain_Node *permanent_null; - Chain_Node *last; -} Chain_Control; - -/* - * _Chain_Initialize - * - * This routine initializes the_chain structure to manage the - * contiguous array of number_nodes nodes which starts at - * starting_address. Each node is of node_size bytes. - */ - -void _Chain_Initialize( - Chain_Control *the_chain, - void *starting_address, - size_t number_nodes, - size_t node_size -); - -/* - * _Chain_Initialize_empty - * - * This routine initializes the specified chain to contain zero nodes. - */ - -STATIC INLINE void _Chain_Initialize_empty( - Chain_Control *the_chain -); - -/* - * _Chain_Extract_unprotected - * - * This routine extracts the_node from the chain on which it resides. - * It does NOT disable interrupts to insure the atomicity of the - * extract operation. - */ - -STATIC INLINE void _Chain_Extract_unprotected( - Chain_Node *the_node -); - -/* - * _Chain_Extract - * - * This routine extracts the_node from the chain on which it resides. - * It disables interrupts to insure the atomicity of the - * extract operation. - */ - -void _Chain_Extract( - Chain_Node *the_node -); - -/* - * _Chain_Get_unprotected - * - * This function removes the first node from the_chain and returns - * a pointer to that node. If the_chain is empty, then NULL is returned. - * It does NOT disable interrupts to insure the atomicity of the - * get operation. - */ - -STATIC INLINE Chain_Node *_Chain_Get_unprotected( - Chain_Control *the_chain -); - -/* - * _Chain_Get - * - * This function removes the first node from the_chain and returns - * a pointer to that node. If the_chain is empty, then NULL is returned. - * It disables interrupts to insure the atomicity of the - * get operation. - */ - -Chain_Node *_Chain_Get( - Chain_Control *the_chain -); - -/* - * _Chain_Get_first_unprotected - * - * This function removes the first node from the_chain and returns - * a pointer to that node. It does NOT disable interrupts to insure - * the atomicity of the get operation. - */ - -STATIC INLINE Chain_Node *_Chain_Get_first_unprotected( - Chain_Control *the_chain -); - -/* - * _Chain_Insert_unprotected - * - * This routine inserts the_node on a chain immediately following - * after_node. It does NOT disable interrupts to insure the atomicity - * of the extract operation. - */ - -STATIC INLINE void _Chain_Insert_unprotected( - Chain_Node *after_node, - Chain_Node *the_node -); - -/* - * _Chain_Insert - * - * This routine inserts the_node on a chain immediately following - * after_node. It disables interrupts to insure the atomicity - * of the extract operation. - */ - -void _Chain_Insert( - Chain_Node *after_node, - Chain_Node *the_node -); - -/* - * _Chain_Append_unprotected - * - * This routine appends the_node onto the end of the_chain. - * It does NOT disable interrupts to insure the atomicity of the - * append operation. - */ - -STATIC INLINE void _Chain_Append_unprotected( - Chain_Control *the_chain, - Chain_Node *the_node -); - -/* - * _Chain_Append - * - * This routine appends the_node onto the end of the_chain. - * It disables interrupts to insure the atomicity of the - * append operation. - */ - -void _Chain_Append( - Chain_Control *the_chain, - Chain_Node *the_node -); - -/* - * _Chain_Prepend_unprotected - * - * This routine prepends the_node onto the front of the_chain. - * It does NOT disable interrupts to insure the atomicity of the - * prepend operation. - */ - -STATIC INLINE void _Chain_Prepend_unprotected( - Chain_Control *the_chain, - Chain_Node *the_node -); - -/* - * _Chain_Prepend - * - * This routine prepends the_node onto the front of the_chain. - * It disables interrupts to insure the atomicity of the - * prepend operation. - */ - -STATIC INLINE void _Chain_Prepend( - Chain_Control *the_chain, - Chain_Node *the_node -); - -/* - * _Chain_Insert_chain - * - * This routine inserts a chain after the specified node in another - * chain. It is assumed that the insert after node is not on the - * second chain. - */ - -void _Chain_Insert_chain( - Chain_Node *insert_after, - Chain_Control *to_insert -); - -/* - * _Chain_Head - * - * This function returns a pointer to the first node on the chain. - */ - -STATIC INLINE Chain_Node *_Chain_Head( - Chain_Control *the_chain -); - -/* - * _Chain_Tail - * - * This function returns a pointer to the last node on the chain. - */ - -STATIC INLINE Chain_Node *_Chain_Tail( - Chain_Control *the_chain -); - -/* - * _Chain_Is_head - * - * This function returns TRUE if the_node is the head of the_chain and - * FALSE otherwise. - */ - -STATIC INLINE boolean _Chain_Is_head( - Chain_Control *the_chain, - Chain_Node *the_node -); - -/* - * _Chain_Is_tail - * - * This function returns TRUE if the_node is the tail of the_chain and - * FALSE otherwise. - */ - -STATIC INLINE boolean _Chain_Is_tail( - Chain_Control *the_chain, - Chain_Node *the_node -); - -/* - * _Chain_Is_first - * - * This function returns TRUE if the_node is the first node on a chain and - * FALSE otherwise. - */ - -STATIC INLINE boolean _Chain_Is_first( - Chain_Node *the_node -); - -/* - * _Chain_Is_last - * - * This function returns TRUE if the_node is the last node on a chain and - * FALSE otherwise. - */ - -STATIC INLINE boolean _Chain_Is_last( - Chain_Node *the_node -); - -/* - * _Chain_Is_empty - * - * This function returns TRUE if there a no nodes on the_chain and - * FALSE otherwise. - */ - -STATIC INLINE boolean _Chain_Is_empty( - Chain_Control *the_chain -); - -/* - * _Chain_Has_only_one_node - * - * This function returns TRUE if there is only one node on the_chain and - * FALSE otherwise. - */ - -STATIC INLINE boolean _Chain_Has_only_one_node( - Chain_Control *the_chain -); - -/* - * _Chain_Is_null - * - * This function returns TRUE if the_chain is NULL and FALSE otherwise. - */ - -STATIC INLINE boolean _Chain_Is_null( - Chain_Control *the_chain -); - -/* - * _Chain_Is_null_node - * - * This function returns TRUE if the_node is NULL and FALSE otherwise. - */ - -STATIC INLINE boolean _Chain_Is_null_node( - Chain_Node *the_node -); - -#include "chain.inl" - -#endif -/* end of include file */ diff --git a/doc/tools/bmenu/chain.inl b/doc/tools/bmenu/chain.inl deleted file mode 100644 index 2ea53edebb..0000000000 --- a/doc/tools/bmenu/chain.inl +++ /dev/null @@ -1,234 +0,0 @@ -/* - * This include file contains the bodies of the routines which are - * associated with doubly linked chains and inlined. - */ - -/* - * COPYRIGHT (c) 1988-2002. - * On-Line Applications Research Corporation (OAR). - * All rights reserved. - */ - -#ifndef __INLINE_CHAIN_inl -#define __INLINE_CHAIN_inl - -/* - * _Chain_Is_null - */ -STATIC INLINE boolean _Chain_Is_null( - Chain_Control *the_chain -) -{ - return ( the_chain == NULL ); -} - -/* - * _Chain_Is_null_node - */ -STATIC INLINE boolean _Chain_Is_null_node( - Chain_Node *the_node -) -{ - return ( the_node == NULL ); -} - -/* - * _Chain_Head - */ -STATIC INLINE Chain_Node *_Chain_Head( - Chain_Control *the_chain -) -{ - return (Chain_Node *) the_chain; -} - -/* - * _Chain_Tail - */ -STATIC INLINE Chain_Node *_Chain_Tail( - Chain_Control *the_chain -) -{ - return (Chain_Node *) &the_chain->permanent_null; -} - -/* - * _Chain_Is_empty - */ -STATIC INLINE boolean _Chain_Is_empty( - Chain_Control *the_chain -) -{ - return ( the_chain->first == _Chain_Tail( the_chain ) ); -} - -/* - * _Chain_Is_first - */ -STATIC INLINE boolean _Chain_Is_first( - Chain_Node *the_node -) -{ - return ( the_node->previous == NULL ); -} - -/* - * _Chain_Is_last - */ -STATIC INLINE boolean _Chain_Is_last( - Chain_Node *the_node -) -{ - return ( the_node->next == NULL ); -} - -/* - * _Chain_Has_only_one_node - */ -STATIC INLINE boolean _Chain_Has_only_one_node( - Chain_Control *the_chain -) -{ - return ( the_chain->first == the_chain->last ); -} - -/* - * _Chain_Is_head - */ -STATIC INLINE boolean _Chain_Is_head( - Chain_Control *the_chain, - Chain_Node *the_node -) -{ - return ( the_node == _Chain_Head( the_chain ) ); -} - -/* - * _Chain_Is_tail - */ -STATIC INLINE boolean _Chain_Is_tail( - Chain_Control *the_chain, - Chain_Node *the_node -) -{ - return ( the_node == _Chain_Tail( the_chain ) ); -} - -/* - * Chain_Initialize_empty - */ -STATIC INLINE void _Chain_Initialize_empty( - Chain_Control *the_chain -) -{ - the_chain->first = _Chain_Tail( the_chain ); - the_chain->permanent_null = NULL; - the_chain->last = _Chain_Head( the_chain ); -} - -/* - * _Chain_Extract_unprotected - */ -STATIC INLINE void _Chain_Extract_unprotected( - Chain_Node *the_node -) -{ - Chain_Node *next; - Chain_Node *previous; - - next = the_node->next; - previous = the_node->previous; - next->previous = previous; - previous->next = next; -} - -/* - * _Chain_Get_first_unprotected - */ -STATIC INLINE Chain_Node *_Chain_Get_first_unprotected( - Chain_Control *the_chain -) -{ - Chain_Node *return_node; - Chain_Node *new_first; - - return_node = the_chain->first; - new_first = return_node->next; - the_chain->first = new_first; - new_first->previous = _Chain_Head( the_chain ); - - return return_node; -} - -/* - * Chain_Get_unprotected - */ -STATIC INLINE Chain_Node *_Chain_Get_unprotected( - Chain_Control *the_chain -) -{ - if ( !_Chain_Is_empty( the_chain ) ) - return _Chain_Get_first_unprotected( the_chain ); - else - return NULL; -} - -/* - * _Chain_Insert_unprotected - */ -STATIC INLINE void _Chain_Insert_unprotected( - Chain_Node *after_node, - Chain_Node *the_node -) -{ - Chain_Node *before_node; - - the_node->previous = after_node; - before_node = after_node->next; - after_node->next = the_node; - the_node->next = before_node; - before_node->previous = the_node; -} - -/* - * _Chain_Append_unprotected - */ -STATIC INLINE void _Chain_Append_unprotected( - Chain_Control *the_chain, - Chain_Node *the_node -) -{ - Chain_Node *old_last_node; - - the_node->next = _Chain_Tail( the_chain ); - old_last_node = the_chain->last; - the_chain->last = the_node; - old_last_node->next = the_node; - the_node->previous = old_last_node; -} - -/* - * _Chain_Prepend_unprotected - */ -STATIC INLINE void _Chain_Prepend_unprotected( - Chain_Control *the_chain, - Chain_Node *the_node -) -{ - _Chain_Insert_unprotected( _Chain_Head( the_chain ), the_node ); - -} - -/* - * _Chain_Prepend - */ -STATIC INLINE void _Chain_Prepend( - Chain_Control *the_chain, - Chain_Node *the_node -) -{ - _Chain_Insert( _Chain_Head( the_chain ), the_node ); -} - -#endif -/* end of include file */ diff --git a/doc/tools/bmenu/system.h b/doc/tools/bmenu/system.h deleted file mode 100644 index c1dec959ed..0000000000 --- a/doc/tools/bmenu/system.h +++ /dev/null @@ -1,29 +0,0 @@ -/* - * COPYRIGHT (c) 1988-2002. - * On-Line Applications Research Corporation (OAR). - * All rights reserved. - */ - -#ifndef __SYSTEM_h -#define __SYSTEM_h - -#define STATIC static -#define INLINE inline - -#ifndef NULL -#define NULL 0 -#endif - -typedef unsigned int boolean; - -#if !defined( TRUE ) || (TRUE != 1) -#undef TRUE -#define TRUE (1) -#endif - -#if !defined( FALSE ) || (FALSE != 0) -#undef FALSE -#define FALSE 0 -#endif - -#endif diff --git a/doc/tools/configure.ac b/doc/tools/configure.ac deleted file mode 100644 index f67f450706..0000000000 --- a/doc/tools/configure.ac +++ /dev/null @@ -1,28 +0,0 @@ -dnl Process this file with autoconf to produce a configure script. -dnl NOTE: This is a very coarse port to automake -AC_PREREQ([2.69]) - -AC_INIT([rtems-doc-tools],[_RTEMS_VERSION],[https://devel.rtems.org/newticket]) -AC_CONFIG_SRCDIR([word-replace2]) -RTEMS_TOP([../..]) - -AM_INIT_AUTOMAKE([no-define foreign 1.12.2]) -dnl Checks for programs. -AC_PROG_CC - -dnl Checks for libraries. - -dnl Checks for header files. -AC_HEADER_STDC -AC_CHECK_HEADERS(limits.h) - -dnl Checks for typedefs, structures, and compiler characteristics. - -dnl Checks for library functions. -AC_CHECK_FUNCS(strdup strstr) - -# texi2www/Makefile -AC_CONFIG_FILES([Makefile -bmenu/Makefile -]) -AC_OUTPUT diff --git a/doc/tools/word-replace2 b/doc/tools/word-replace2 deleted file mode 100644 index 31d36a6ca5..0000000000 --- a/doc/tools/word-replace2 +++ /dev/null @@ -1,98 +0,0 @@ -#!/usr/bin/perl - -eval "exec /usr/local/bin/perl -S $0 $*" - if $running_under_some_shell; - -require 'getopts.pl'; -&Getopts("p:vh"); # help, pattern file, verbose, - -if ($opt_h || ! $opt_p) { - print STDERR <) -{ - chop; - s/#.*//; - next if /^$/; - ($orig, $new, $junk, @rest) = split; - next if ( ! $orig || ! $new || $junk); # <2 or >2 patterns - die "pattern appears 2x: '$orig' in '$pattern_file'--" if defined($patterns{$orig}); - $patterns{$orig} = $new; -} -close PATTERNS; -# walk thru each line in each file - -$infile = '-' ; -$outfile = '-' ; - -if ( $#ARGV > -1 ) -{ - $infile = "@ARGV[0]" ; - shift @ARGV ; -} - -if ( $#ARGV > -1 ) -{ - $outfile = "@ARGV[0]" ; - shift @ARGV ; -} - -open (INFILE, "<$infile") || - die "could not open input file $infile: $!"; -$line = join('',) ; -close INFILE; - - -print STDERR "$outfile\t"; - -open (OUTFILE, ">$outfile") || - die "could not open output file $outfile: $!"; - -foreach $key (keys %patterns) -{ - if ( $line =~ s/\b$key\b/$patterns{$key}/ge ) - { - print STDERR "." ; - } -} - -print OUTFILE $line ; - -print STDERR "\n"; -close OUTFILE; -- cgit v1.2.3