Changeset 972dc40 in rtems


Ignore:
Timestamp:
Jan 21, 1998, 3:15:12 PM (23 years ago)
Author:
Joel Sherrill <joel.sherrill@…>
Branches:
4.10, 4.11, 4.8, 4.9, 5, master
Children:
419fdf1
Parents:
6ab91d9
Message:

Added Code to dop the output in a format which a custom Visual Basic
Application Cindy has written can transform into a nice Word document.

Location:
doc/tools/pdl2texi
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • doc/tools/pdl2texi/Makefile

    r6ab91d9 r972dc40  
    6161        ./$(PROG) -v t1.d
    6262
     63wtest:
     64        rm -f $(BASE).txt
     65        ./$(PROG) -w -v -p "Turret Subsystem" -u "Turret Subsystem" $(BASE).d
     66
    6367clean:
    6468        rm -f *.o $(PROG) *.txt core *.html $(PROJECT) Drive.texi
  • doc/tools/pdl2texi/base.h

    r6ab91d9 r972dc40  
    9090void FormatToTexinfo( void );
    9191
     92void FormatToWord( void );
     93
    9294void PrintFile(
    9395   char *out
     
    102104EXTERN boolean          Verbose;                 /* status/debug msgs */
    103105EXTERN boolean          Statistics;              /* statistics msgs */
     106EXTERN boolean          OutputWord;              /* Output MS-Word */
    104107EXTERN boolean          IncompletesAreErrors;
    105108EXTERN boolean          InsertTBDs;
  • doc/tools/pdl2texi/main.c

    r6ab91d9 r972dc40  
    988988  Verbose = FALSE;
    989989  Statistics = FALSE;
     990  OutputWord = FALSE;
    990991  IncompletesAreErrors = TRUE;
    991992  InsertTBDs = FALSE;
    992993
    993   while ((c = getopt(argc, argv, "istv?n:p:u:")) != EOF) {
     994  while ((c = getopt(argc, argv, "istvw?n:p:u:")) != EOF) {
    994995    switch (c) {
    995996      case 'i':
     
    10141015         Statistics = TRUE;
    10151016         break;
     1017      case 'w':
     1018         OutputWord = TRUE;
     1019         break;
    10161020      case '?':
    10171021        usage();
     
    10251029    fprintf( stderr, "Previous Node = (%s)\n", DocsPreviousNode );
    10261030    fprintf( stderr, "Up Node = (%s)\n", DocsUpNode );
     1031    fprintf( stderr, "Output Format = (%s)\n", (OutputWord) ? "Word" : "Texi" );
    10271032  }
    10281033
     
    10651070     }
    10661071
    1067      out[ out_index++ ] = '.';
    1068      out[ out_index++ ] = 't';
    1069      out[ out_index++ ] = 'e';
    1070      out[ out_index++ ] = 'x';
    1071      out[ out_index++ ] = 'i';
     1072     if ( OutputWord ) {
     1073       out[ out_index++ ] = '.';
     1074       out[ out_index++ ] = 't';
     1075       out[ out_index++ ] = 'x';
     1076       out[ out_index++ ] = 't';
     1077     } else {
     1078       out[ out_index++ ] = '.';
     1079       out[ out_index++ ] = 't';
     1080       out[ out_index++ ] = 'e';
     1081       out[ out_index++ ] = 'x';
     1082       out[ out_index++ ] = 'i';
     1083     }
    10721084     out[ out_index ] = '\0';
    10731085
     
    11911203    */
    11921204
    1193    FormatToTexinfo();
    1194 
    1195    if ( Verbose )
    1196      fprintf( stderr, "-------->FILE FORMATTED TO TEXINFO\n" );
     1205   if ( OutputWord ) {
     1206     FormatToWord();
     1207     if ( Verbose )
     1208       fprintf( stderr, "-------->FILE FORMATTED TO WORD\n" );
     1209   } else {
     1210     FormatToTexinfo();
     1211     if ( Verbose )
     1212       fprintf( stderr, "-------->FILE FORMATTED TO TEXINFO\n" );
     1213   }
    11971214
    11981215   /*
     
    27532770
    27542771/*
     2772 *  FormatToWord
     2773 */
     2774
     2775void FormatToWord( void )
     2776{
     2777  Line_Control *line;
     2778  Line_Control *new_line;
     2779  char          Buffer[ PARAGRAPH_SIZE ];
     2780  int           i;
     2781  char          ChapterTitle[ PARAGRAPH_SIZE ];
     2782  char          InfoFile[ PARAGRAPH_SIZE ];
     2783  char         *p;
     2784  boolean       new_section;
     2785  boolean       in_bullets;
     2786
     2787  for ( line = (Line_Control *) Lines.first ;
     2788        !_Chain_Is_last( &line->Node ) ;
     2789      ) {
     2790
     2791    switch ( line->keyword ) {
     2792      case UNUSED:
     2793        line = (Line_Control *) line->Node.next;
     2794        break;
     2795
     2796      case OBJECT:
     2797        LineCopyFromRight( line, ChapterTitle );
     2798        strcpy( InfoFile, ChapterTitle );
     2799
     2800        for ( p=InfoFile ; *p ; *p++ )   /* turn this into a file name */
     2801          if ( isspace( *p ) )
     2802            *p = '_';             
     2803
     2804        sprintf( Buffer, "@Chapter = %s", line->Contents );
     2805        strcpy( line->Contents, Buffer );
     2806        line = (Line_Control *) line->Node.next;
     2807        break;
     2808
     2809      case ATTRIBUTE_DESCRIPTIONS:
     2810      case ASSOCIATION_DESCRIPTIONS:
     2811      case ABSTRACT_TYPE_DESCRIPTIONS:
     2812      case DATA_ITEM_DESCRIPTIONS:
     2813      case METHOD_DESCRIPTIONS:
     2814      case TASK_DESCRIPTIONS:
     2815        sprintf( Buffer, "@Section = %s", line->Contents );
     2816        strcpy( line->Contents, Buffer );
     2817
     2818        new_line = AllocateLine();
     2819        strcpy( new_line->Contents, "@Page" );
     2820        _Chain_Insert( line->Node.previous, &new_line->Node );
     2821
     2822        line = (Line_Control *) line->Node.next;
     2823        new_section = TRUE;
     2824        break;
     2825
     2826      case END_OBJECT:
     2827        line->Contents[ 0 ] = '\0';
     2828        goto bottom;
     2829
     2830      case ATTRIBUTE:
     2831      case ASSOCIATION:
     2832      case ABSTRACT_TYPE:
     2833      case DATA_ITEM:
     2834        if ( !new_section ) {
     2835          /*
     2836           *  Do something with the style to keep subsection
     2837           *  contents together
     2838           */
     2839          ;
     2840        }
     2841        new_section = FALSE;
     2842        sprintf( Buffer, "@Subsection = %s", line->Contents );
     2843        strcpy( line->Contents, Buffer );
     2844        line = (Line_Control *) line->Node.next;
     2845        break;
     2846
     2847      case METHOD:
     2848      case TASK:
     2849        if ( !new_section ) {
     2850          new_line = AllocateLine();
     2851          strcpy( new_line->Contents, "@Page" );
     2852          _Chain_Insert( line->Node.previous, &new_line->Node );
     2853        }
     2854        new_section = FALSE;
     2855        sprintf( Buffer, "@Subsection = %s", line->Contents );
     2856        strcpy( line->Contents, Buffer );
     2857        line = (Line_Control *) line->Node.next;
     2858        break;
     2859
     2860      case DESCRIPTION:
     2861      case COPYRIGHT:
     2862      case PORTING:
     2863      case THEORY_OF_OPERATION:
     2864      case DEPENDENCIES:
     2865      case NOTES:
     2866        sprintf( Buffer, "@Subheading = %s\n", line->Contents );
     2867        strcpy( line->Contents, Buffer );
     2868        line = (Line_Control *) line->Node.next;
     2869
     2870        /* now take care of the paragraphs which are here */
     2871
     2872        in_bullets = FALSE;
     2873        do {
     2874          line = (Line_Control *) line->Node.next;
     2875          if ( line->format == BULLET_OUTPUT ) {
     2876            if ( !in_bullets ) {
     2877              in_bullets = TRUE;
     2878
     2879              new_line = AllocateLine();
     2880              _Chain_Insert( line->Node.previous, &new_line->Node );
     2881            }
     2882            sprintf( Buffer, "@Bullet = %s\n", line->Contents );
     2883            strcpy( line->Contents, Buffer );
     2884          } else if ( in_bullets ) {
     2885            in_bullets = FALSE;
     2886
     2887            new_line = AllocateLine();
     2888            _Chain_Insert( line->Node.previous, &new_line->Node );
     2889          } else {
     2890            new_line = AllocateLine();
     2891            _Chain_Insert( line->Node.previous, &new_line->Node );
     2892          }
     2893        } while ( !line->keyword );
     2894
     2895        break;
     2896
     2897      case DERIVATION:
     2898      case TYPE:
     2899      case RANGE:
     2900      case UNITS:
     2901      case SCALE_FACTOR:
     2902      case TOLERANCE:
     2903      case VISIBILITY:
     2904      case ASSOCIATED_WITH:
     2905      case MULTIPLICITY:
     2906      case TIMING:
     2907        sprintf( Buffer, "@Subheading = %s\n", line->Contents );
     2908        strcpy( line->Contents, Buffer );
     2909        line = (Line_Control *) line->Node.next;
     2910        break;
     2911
     2912      case MEMBERS:
     2913      case DEFAULT:
     2914      case REQUIREMENTS:
     2915      case REFERENCES:
     2916      case INPUTS:
     2917      case OUTPUTS:
     2918      case PDL:
     2919      case SYNCHRONIZATION:
     2920        sprintf( Buffer, "@Subheading = %s\n", line->Contents );
     2921        strcpy( line->Contents, Buffer );
     2922
     2923        /* now take care of the raw text which is here */
     2924
     2925         line = (Line_Control *) line->Node.next;
     2926        while ( !line->keyword ) {
     2927          sprintf( Buffer, "@Example = %s\n", line->Contents );
     2928          strcpy( line->Contents, Buffer );
     2929          line = (Line_Control *) line->Node.next;
     2930        }
     2931
     2932        /* at this point line points to the next keyword */
     2933        break;
     2934    }   
     2935  }
     2936
     2937bottom:
     2938}
     2939
     2940/*
    27552941 *  PrintFile
    27562942 */
Note: See TracChangeset for help on using the changeset viewer.