From 02d19d8123a1c984893b8100563a8a921d7c88fe Mon Sep 17 00:00:00 2001 From: Joel Sherrill Date: Thu, 5 Feb 1998 20:05:26 +0000 Subject: Added code to more correctly process abstract types (handle, range, etc). --- doc/tools/pdl2texi/Makefile | 11 ++++++ doc/tools/pdl2texi/main.c | 87 +++++++++++++++++++++++++++++++++------------ 2 files changed, 76 insertions(+), 22 deletions(-) (limited to 'doc/tools') diff --git a/doc/tools/pdl2texi/Makefile b/doc/tools/pdl2texi/Makefile index 51a34f39fd..4d72b9462e 100644 --- a/doc/tools/pdl2texi/Makefile +++ b/doc/tools/pdl2texi/Makefile @@ -64,7 +64,18 @@ wtest: rm -f $(BASE).txt ./$(PROG) -w -v -p "Turret Subsystem" -u "Turret Subsystem" $(BASE).d +enum: + ./$(PROG) -w -v -p "Magic Subsystem" \ + -u "Magic Subsystem" test_cases/enum.d + ./$(PROG) -w -v -p "Magic Subsystem" \ + -u "Magic Subsystem" test_cases/enumbad.d + +avdas: + ./$(PROG) -v -p "Magic Subsystem" \ + -u "Magic Subsystem" test_cases/avdas.d + clean: rm -f *.o $(PROG) *.txt core *.html $(PROJECT) Drive.texi rm -f *.dvi *.ps *.log *.aux *.cp *.fn *.ky *.pg *.toc *.tp *.vr $(BASE) + rm -f test_cases/*.txt test_cases/*.texi diff --git a/doc/tools/pdl2texi/main.c b/doc/tools/pdl2texi/main.c index 16ef41197e..f2592c2310 100644 --- a/doc/tools/pdl2texi/main.c +++ b/doc/tools/pdl2texi/main.c @@ -9,12 +9,15 @@ * FEATURES: * + rudimentary statistics * + forgiveness features + * + output in Texinfo format + * + output in a form that a sibling MS-Word VBA program can format * * CHECKS PERFORMED: * + unable to open file * + unexpected end of file * + line should have a colon - * + basic text (to right or below) associated with keyword improperly placed + * + basic text (to right or below) associated with keyword + * improperly placed * + an "incomplete marker" is still in place * + missing keywords within a subsection * + duplicated keywords withing a subsection @@ -2940,7 +2943,7 @@ void FormatToWord( void ) _Chain_Insert( line->Node.previous, &new_line->Node ); strcpy( new_line->Contents, "@Example = " ); - do { + while ( !line->keyword ) { if ( strlen( line->Contents ) ) { new_line->keyword = line->keyword; new_line->format = line->format; @@ -2959,7 +2962,7 @@ void FormatToWord( void ) _Chain_Insert( line->Node.previous, &new_line->Node ); strcpy( new_line->Contents, "@Example = " ); } - } while ( !line->keyword ); + } /* at this point line points to the next keyword */ break; @@ -3252,6 +3255,7 @@ int Validate_abstract_type( boolean range_found = FALSE; boolean members_found = FALSE; boolean enumerated_found = FALSE; + boolean no_range_or_members = FALSE; boolean true_found = FALSE; boolean false_found = FALSE; Line_Control *line; @@ -3264,21 +3268,70 @@ int Validate_abstract_type( range_found = TRUE; else if ( line->keyword == MEMBERS ) { members_found = TRUE; - } else if ( line->keyword == TYPE || line->keyword == DERIVATION ) { + } else if ( line->keyword == TYPE ) { if ( strstr( line->Contents, "enumerated" ) || strstr( line->Contents, "structure" ) ) enumerated_found = TRUE; + } else if ( line->keyword == DERIVATION ) { + if ( strstr( line->Contents, "enumerated" ) || + strstr( line->Contents, "structure" ) ) { + enumerated_found = TRUE; + } else if ( strstr( line->Contents, "handle" ) || + strstr( line->Contents, "array" ) || + strstr( line->Contents, "string" ) ) { + no_range_or_members = TRUE; + } } } - if ( !range_found && !members_found ) { - fprintf( - stderr, - "Neither range nor members keyword present in " - "subsection starting at line %d\n", - start->number - ); - errors++; + if ( no_range_or_members ) { +/* This code does not like: + +ABSTRACT TYPE: Times + DESCRIPTION: + This type specifies mode elapsed times. + VISIBILITY: public + DERIVATION: array of Elapsed_Seconds of Timeutil + RANGE: COMM - ENGAGE of Current_mode_t + + if ( range_found ) { + fprintf( + stderr, + "Range should not be specified in subsection starting at line %d\n", + start->number + ); + errors++; + } +*/ + if ( members_found ) { + fprintf( + stderr, + "Members should not be specified in subsection starting at line %d\n", + start->number + ); + errors++; + } + } else { + if ( !range_found && !members_found ) { + fprintf( + stderr, + "Neither range nor members keyword present in " + "subsection starting at line %d\n", + start->number + ); + errors++; + } + + if ( !enumerated_found && !range_found ) { + fprintf( + stderr, + "Type does not have range specified in " + "subsection starting at line %d\n", + start->number + ); + errors++; + } + } if ( !InsertTBDs ) { @@ -3303,16 +3356,6 @@ int Validate_abstract_type( errors++; } - if ( !enumerated_found && !range_found ) { - fprintf( - stderr, - "Type does not have range specified in " - "subsection starting at line %d\n", - start->number - ); - errors++; - } - return (errors) ? -1 : 0; } -- cgit v1.2.3