Changeset 273838 in git


Ignore:
Timestamp:
Apr 17, 1997, 4:31:30 PM (26 years ago)
Author:
Jens Schmidt <schmidt@…>
Branches:
(u'spielwiese', '0d6b7fcd9813a1ca1ed4220cfa2b104b97a0a003')
Children:
8591c5247e9885df77234d8c0f31a9ad77cf7bf9
Parents:
50b2dfd4d9dbd3086efcc841c997bede4fe6b7a7
Message:
o makeheader.pl reads new format now


git-svn-id: file:///usr/local/Singular/svn/trunk@170 2c84dea3-7e68-4137-9b89-c4e89433aadc
File:
1 edited

Legend:

Unmodified
Added
Removed
  • factory/bin/makeheader.pl

    r50b2df r273838  
    11#!/usr/bin/perl
    2 # $ Id: $
     2# $Id: makeheader.pl,v 1.2 1997-04-17 14:31:30 schmidt Exp $
    33#
    4 # makeheader - generate a header file out of several header file (ver 1.2).
     4# makeheader.pl - generate a header file out of several header file (ver 1.2).
    55#
    66
     
    2727
    2828To include a header file into the generated header file
    29 \(= <outfile>) use the command `.INCLUDE <includefile>' on a
    30 single line in <templatefile>.
    31 This line is replaced by sections marked with /*BEGINPUBLIC*/
    32 and /*ENDPUBLIC*/ from <includefile>. <includefile> is looked up
    33 in all <includedir>s, then in the current directory, then in
    34 the base directory of <templatefile>.\n";
     29\(= <outfile>) use the two lines
     30
     31/*MAKEHEADER*/
     32#include \"<includefile>\"
     33
     34in <templatefile>.
     35
     36If you use the alternate form
     37
     38/*MAKEHEADER PUBLIC ONLY*/
     39#include \"<includefile>\"
     40
     41only sections marked with /*BEGINPUBLIC*/ and /*ENDPUBLIC*/ are
     42pasted from <includefile> into <outfile>.
     43
     44<includefile> is looked up in all <includedir>s, then in the
     45current directory, then in the base directory of
     46<templatefile>.\n";
    3547}
    3648
     
    6274
    6375while( <INFILE> ) {
    64     if ( /^\.INCLUDE/ ) {
    65         s/^\.INCLUDE //;
    66         chop;
    67         $inclfile = &searchpath( $_, $includes ) ||
    68             die "makeheader: Can not open included file $_ for reading!\n";
     76    if ( /^\/\*MAKEHEADER(.*)\*\/$/ ) {
     77        # check whether we have to read public part only
     78        if ( $1 eq " PUBLIC ONLY" ) {
     79            $public_only = 1;
     80        } else {
     81            $public_only = 0;
     82        }
     83
     84        # get name of file to include
     85        $_ = <INFILE>; chop;
     86        if ( /^\#include \"(.*)\"$/ ) {
     87            $inclfile = $1;
     88        } else {
     89            die "makeheader: $_ is not a valid include directive!\n";
     90        }
     91
     92        $inclfile = &searchpath( $inclfile, $includes ) ||
     93            die "makeheader: Can not open included file $inclfile for reading!\n";
    6994        open( INCLFILE, $inclfile ) ||
    70             die "makeheader: Can not open included file $_ for reading!\n";
     95            die "makeheader: Can not open included file $inclfile for reading!\n";
    7196
    72         print OUTFILE "/* Stuff from $_ */";
    73         while ( <INCLFILE> ) {
    74             if ( /\/\*BEGINPUBLIC\*\// ) {
    75                 while ( <INCLFILE> ) {
    76                     last if ( /\/\*ENDPUBLIC\*\// );
    77                     print OUTFILE $_;
     97        print OUTFILE "\n/* Stuff included from $inclfile */\n";
     98        if ( $public_only ) {
     99            # read public part only
     100            while ( <INCLFILE> ) {
     101                if ( /^\/\*BEGINPUBLIC\*\/$/ ) {
     102                    while ( <INCLFILE> ) {
     103                        last if ( /^\/\*ENDPUBLIC\*\/$/ );
     104                        print OUTFILE $_;
     105                    }
    78106                }
    79107            }
     108        } else {
     109            # just paste contents into output
     110            while ( <INCLFILE> ) { print OUTFILE $_; }
    80111        }
    81112        close INCLFILE;
Note: See TracChangeset for help on using the changeset viewer.