action.c: UpdatePackage() reloads from disk
[geda-pcb/whiteaudio.git] / doc / ascii2texi.awk
blobb8e3a7244ebc49b4514d5a66ca7e89006f5eb096
1 #!/usr/bin/awk -f
3 BEGIN {
4 first = 1;
5 col = 1;
8 /^[ \t]*#/ {
9 # skip comment lines
10 next;
13 /^[ \t]*$/ {
14 # skip blank
15 next;
18 # we do this 'first' song and dance because variables set
19 # on the command line are not available in the BEGIN section
20 first == 1 {
21 first = 0;
22 printf("@c Generated file. Do not edit directly\n");
23 printf("@multitable @columnfractions ");
24 for(i = 1 ; i <= 2*ncol ; i = i + 1) {
25 printf("%.3g ", 0.5 / ncol);
27 printf("\n");
29 printf("@item ");
30 for(i = 1 ; i <= ncol ; i = i + 1) {
31 if( i > 1 ) { printf("@tab "); }
32 printf("Drill @tab Diameter ");
34 printf("\n");
36 printf("@item ");
37 for(i = 1 ; i <= ncol ; i = i + 1) {
38 if( i > 1 ) { printf("@tab "); }
39 printf("Size @tab (inches) ");
41 printf("\n");
43 printf("\n");
47 if( col == 1 ) {
48 printf("@item ");
49 } else {
50 printf("@tab ");
52 drl = $1;
53 dia = $2;
54 gsub(/_/, " ", drl);
55 printf("%s @tab %s ", drl, dia);
56 col = col + 1;
57 if( col > ncol ) {
58 col = 1;
59 printf("\n");
63 END {
64 while( (col > 1) && (col <= ncol ) ) {
65 printf("@tab @tab ");
66 col = col + 1;
69 printf("@end multitable\n\n");