// PADLINES2 - Pad all lines in a file so that they have the same length: // the length of the longest line. // // Based on PADLINES.VDM by Theodore Green, Greenview Data, Inc. // (from: 02/19/03) // // Last change: 09/13/2004 by Christian Ziemski // // Requires: VEDIT 6.02 or later. // // From VEDIT: Select {Misc, Load/execute user macro, ...}. // // Description: It adds spaces at the end of each line to pad it to the // length of the longest original line. // All lines will then have the same length. // // From OS: VPW [-w] -X PADLINES2 filename // // When the end of file is reached, the file is saved and // Vedit terminates. // // The optional parameter "-w" hides the File Selector window. // //////////////// // // if (Config(F_F_TYPE) >=8) { if (OS_Type==1) { DI1(103,"`ERROR - Pad lines to same length`,`This function is not available in Binary/Record mode!\nE.g. when {CONFIG, File handling, File type} >= 8`",APP+CENTER,0,0) } else { Get_Key("This function is not available in Binary/Record mode!",STATLINE) } return(-1) } Message("Scanning..... (About 2 sec / Megabyte) -- Press to abort ",STATLINE) #103=0 Begin_Of_File() while (! AT_EOF) { EOL() if (Cur_Col>#103) { #103=Cur_Col } Line(1,ERRBREAK) } // // Loop to perform the padding. // Message("Processing... (About 2 sec / Megabyte) -- Press to abort ",STATLINE) BOF() while (! At_EOF) { EOL() Ins_Char(' ',COUNT,#103-Cur_Col+1) Line(1,ERRBREAK) } if (Is_Auto_Execution && Macro_Num == 100) { Xall() }