#! /usr/bin/awk -f # Important : This software is protected by Copyright and the information # contained herein is confidential. Distribution, reproduction # as well as exploitation and transmission of its contents is # not allowed except if expressly permitted. Infringments # result in damage claims. # Copyright Wavecom S.A. (c) 2004 # # **************************************************************************** # * File : $Workfile: wmgccstackfactor.awk $ # * $Revision: 1.0 $ # *--------------------------------------------------------------------------* # * * # * Changes : * # $LogWavecom: U:\projet\mmi\pvcsarch\archives\open-at\DEVTOOLS\wmgccstackfactor.awk-arc $ # -------------------------------------------------------------------------- # Date | Author | Revision | Description # ----------+--------+----------------+------------------------------------- # 05.05.04 | DPO | 1.0 | Initial revision. # ----------+--------+----------------+------------------------------------- # **************************************************************************** # Get factor BEGIN { # Check parameters Nb if ( ARGC != 3 ) { print "[wmgccstackfactor.awk] Bad arguments number : " ARGC; exit; } # Get Factor StackFactor = ARGV [ 1 ]; ARGV [ 1 ] = ""; # Check factor if ( int ( StackFactor ) == 0 ) { print "[wmgccstackfactor.awk] Bad stack factor : " StackFactor; exit; } } # Match All lines { # Search Stack Size keyword if ( match ( $0, /u32[^0-9]+wm_apmCustomStack[^a-zA-Z]+/ ) > 0 ) { # Get source stack size position SizePosBegin = index ( $0, "wm_apmCustomStack" ) + length ( "wm_apmCustomStack" ); StringToParse = substr ( $0, SizePosBegin, length ( $0 ) ); # Get source stack size SizePos = match ( StringToParse, /[0-9]+/ ); StackSize = substr ( StringToParse, SizePos, RLENGTH ); # Get source code line LineToPrint = substr ( $0, 1, SizePosBegin + SizePos - 2 ); # Update stack size with factor StackSize = int ( StackSize * StackFactor ); # Print updated line print LineToPrint StackSize " ]; // Pre-processed with [wmgccstackfactor.awk] (factor " StackFactor ")"; } else { # Just print line print; } }