home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 5 / Apprentice-Release5.iso / Utilities / Programming / EnterAct 3.7.3 / Drag_on Modules / hAWK example progs / $StringCommentAlign < prev    next >
Encoding:
Text File  |  1994-01-26  |  585 b   |  23 lines  |  [TEXT/KEEN]

  1. #$StringCommentAlign
  2. #-input from lines in a string array, of the form
  3. #    "string", /*comment*/
  4. #one entry per line. Nudge comments to line them up nicely.
  5.  
  6.         {    
  7.         match($0, /".*,/)
  8.         one[++n] = substr($0, RSTART, RLENGTH)
  9.         match($0, /\/\*.*\*\//)
  10.         two[n] = substr($0, RSTART, RLENGTH)
  11.         
  12.         if (w1 < length(one[n]))
  13.             w1 = length(one[n])
  14.         if (w2 < length(two[n]))
  15.             w2 = length(two[n])
  16.  
  17.         }
  18.     END    {w1 += 2; w2 += 2;#a couple of spaces between columns
  19.         for (i = 1; i <= n; ++i)
  20.             ##printf "%-" w1 "s" "%-" w2 "s\n", one[i], two[i]
  21.             printf "%-" w1 "s" "%-s\n", one[i], two[i]
  22.         }
  23.