~ubuntu-branches/ubuntu/precise/vflib3/precise

« back to all changes in this revision

Viewing changes to src/mkmodelist.awk

  • Committer: Bazaar Package Importer
  • Author(s): Masayuki Hatta
  • Date: 2002-04-15 12:10:24 UTC
  • Revision ID: james.westby@ubuntu.com-20020415121024-cann32wucyfbq22f
Tags: upstream-3.6.12
ImportĀ upstreamĀ versionĀ 3.6.12

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# make a device mode list from 'modes.mf' file (given in stdin)
 
2
# by h.kakugawa
 
3
 
 
4
# Line: e.g.,  mode_def ljfour =                       % 600dpi HP LaserJet 4
 
5
 
 
6
/^mode_def/ { 
 
7
  mode=$2; 
 
8
  ppi=-1; 
 
9
  ppiv=-1; 
 
10
  asp=1.0;
 
11
  i=index($0, "%");
 
12
  x=substr($0, i);
 
13
  desc=substr($0, i + match(x, "[a-zA-Z0-9]") - 1);
 
14
}
 
15
 
 
16
 
 
17
# Line: e.g.,     mode_param (pixels_per_inch, 600);
 
18
 
 
19
/^[ \t]*mode_param[ \t]*\([ \t]*pixels_per_inch, [ \t]*[0-9.]+\);/ {
 
20
  match($3, "[0-9.]*");
 
21
  ppi=substr($3, 1, RLENGTH);
 
22
  ppiv=-1; 
 
23
}
 
24
 
 
25
 
 
26
### Currently, aspect ratio must be 1
 
27
 
 
28
# Line: e.g.,     mode_param (aspect_ratio, 4/3);
 
29
 
 
30
/^[ \t]*mode_param[ \t]*\([ \t]*aspect_ratio[ \t]*,[ \t]*[0-9./]+[ \t]*);/ {
 
31
  i=match($0, ",[ \t]*");
 
32
  s0=i+RLENGTH;
 
33
  x=substr($0, s0);
 
34
  len=match(x, ")");
 
35
  asp=substr($0, s0, len-1);
 
36
  ppiv=asp*ppi;
 
37
  ppi=-1; ### ignore this entry.
 
38
}
 
39
 
 
40
 
 
41
# Line: e.g.,   mode_param (aspect_ratio, 180 / pixels_per_inch);
 
42
 
 
43
/^[ \t]*mode_param[ \t]*\([ \t]*aspect_ratio, [ \t]*.*\/[ \t]*pixels_per_inch)/ {
 
44
  i=match($0, ",[ \t]*[0-9.]");
 
45
  x=substr($0, i+RLENGTH-1);
 
46
  s0=i+RLENGTH-1;
 
47
  match(x, "[ \t]*/");
 
48
  ppiv=substr($0, s0, RSTART-1);
 
49
  asp=ppi/ppiv;
 
50
  ppi=-1; ### ignore this entry.
 
51
}
 
52
 
 
53
 
 
54
# Line: e.g., enddef;
 
55
/^enddef/ {
 
56
  if ((mode != "") && (ppi > 0)){
 
57
    if ((ppiv < 0) && (mode == DEVNAME)){
 
58
      printf("%s\n", ppi); 
 
59
    }
 
60
    mode=""; 
 
61
    ppi=-1; 
 
62
    ppiv=-1; 
 
63
    desc="";
 
64
  }
 
65
}