#! /bin/csh -f ########################################################################### # PROJECT: DEMETER # MODULE: SYSTEM # FILE: generate-productivity # SYSTEM: UNIX 4.3 BSD on sun #-------------------------------------------------------------------------- # COPYRIGHT (c) 1993 Northeastern University # Prof. Karl J. Lieberherr #-------------------------------------------------------------------------- # AUTHOR: Walter Hursch # DATE: December 9, 1991 # REVISED: May 5, 1992 # Allow arbitrary cd names # Fri Jul 9 15:32:34 1993 # replaced cut with awk # #-------------------------------------------------------------------------- # DESCRIPTION: # This is the script file to produce the file generate.benefit -- a # summary of how much code was generated by the Demeter C++ generate # command. # ########################################################################### # Test usage if ($#argv >= 2) then echo "Usage: generate-productivity [class_dictionary]" exit (1) else if ($#argv == 1) then set CD = $1 else set CD = cd.cd endif # make sure your in TOP directory (only plausibility test) if (! -f $CD) then echo "Generate-productivity error: Cannot find class dictionary." echo "Make sure you are in directory TOP." echo "" exit (1) endif # set output filename set OUT = generate.benefit # count character, words and lines generated set LINESGEN = `cat main.C.sample notmod/def/* scanner/lex-DEM.l | wc -l | cut -c1-8 | tail -1` # count character, words and lines user written set LINESWRT = `cat $CD | wc -l | tail -1 | awk '{ print $1}' ` # computation of percentages # Watch out: only integer arithmetic allowed! @ SUM = $LINESWRT + $LINESGEN @ PWRT = ( 1000 * $LINESWRT ) / $SUM @ PGEN = ( 1000 * $LINESGEN ) / $SUM # summaries on file version echo " *** generation productivity ***" echo "" date echo "Number of user-written lines (promille): $LINESWRT ($PWRT/1000)" echo " Files: cd" echo "Number of generated lines (promille): $LINESGEN ($PGEN/1000)" echo " Files: main.C.sample" echo " notmod/def/*" echo " scanner/lex-DEM.l" echo ""