Module: FFI::NCurses::ACS

Included in:
FFI::NCurses
Defined in:
lib/ffi-ncurses/acs.rb

Instance Method Summary collapse

Instance Method Details

#define_acs(name, char) ⇒ Object



13
14
15
# File 'lib/ffi-ncurses/acs.rb', line 13

def define_acs(name, char)
  maybe_const_set name, acs_map[char[0].ord]
end

#define_acs_constantsObject

We have to define these dynamically as =acs_map= is not initialized until =init_scr= has been called



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
# File 'lib/ffi-ncurses/acs.rb', line 18

def define_acs_constants
  #          Name           Default Description
  # -------------------------------------------
  define_acs :ACS_ULCORNER, 'l'   # upper left corner
  define_acs :ACS_LLCORNER, 'm'   # lower left corner
  define_acs :ACS_URCORNER ,'k'   # upper right corner
  define_acs :ACS_LRCORNER ,'j'   # lower right corner
  define_acs :ACS_LTEE     ,'t'   # tee pointing right
  define_acs :ACS_RTEE     ,'u'   # tee pointing left
  define_acs :ACS_BTEE     ,'v'   # tee pointing up
  define_acs :ACS_TTEE     ,'w'   # tee pointing down
  define_acs :ACS_HLINE    ,'q'   # horizontal line
  define_acs :ACS_VLINE    ,'x'   # vertical line
  define_acs :ACS_PLUS     ,'n'   # large plus or crossover
  define_acs :ACS_S1       ,'o'   # scan line 1
  define_acs :ACS_S9       ,'s'   # scan line 9
  define_acs :ACS_DIAMOND  ,'`'   # diamond
  define_acs :ACS_CKBOARD  ,'a'   # checker board (stipple)
  define_acs :ACS_DEGREE   ,'f'   # degree symbol
  define_acs :ACS_PLMINUS  ,'g'   # plus/minus
  define_acs :ACS_BULLET   ,'~'   # bullet
  # Teletype 5410v1 symbols begin here
  define_acs :ACS_LARROW   ,','   # arrow pointing left
  define_acs :ACS_RARROW   ,'+'   # arrow pointing right
  define_acs :ACS_DARROW   ,'.'   # arrow pointing down
  define_acs :ACS_UARROW   ,'-'   # arrow pointing up
  define_acs :ACS_BOARD    ,'h'   # board of squares
  define_acs :ACS_LANTERN  ,'i'   # lantern symbol
  define_acs :ACS_BLOCK    ,'0'   # solid square block

  # These aren't documented, but a lot of System Vs have them anyway
  # (you can spot pprryyzz{{||}} in a lot of AT&T terminfo strings).
  # The ACS_names may not match AT&T's, our source didn't know them.

  define_acs :ACS_S3       ,'p'   # scan line 3
  define_acs :ACS_S7       ,'r'   # scan line 7 - SOH: seems to be same as ACS_HLINE
  define_acs :ACS_LEQUAL   ,'y'   # less/equal
  define_acs :ACS_GEQUAL   ,'z'   # greater/equal
  define_acs :ACS_PI       ,'{'   # Pi
  define_acs :ACS_NEQUAL   ,'|'   # not equal
  define_acs :ACS_STERLING ,'}'   # UK pound sign

  # Line drawing ACS names are of the form ACS_trbl, where t is the top, r
  # is the right, b is the bottom, and l is the left.  t, r, b, and l might
  # be B (blank), S (single), D (double), or T (thick).  The subset defined
  # here only uses B and S.
  #
  # See the WACS_x_trbl constants below for the full set.

  maybe_const_set :ACS_BSSB, ACS_ULCORNER
  maybe_const_set :ACS_SSBB, ACS_LLCORNER
  maybe_const_set :ACS_BBSS, ACS_URCORNER
  maybe_const_set :ACS_SBBS, ACS_LRCORNER
  maybe_const_set :ACS_SBSS, ACS_RTEE
  maybe_const_set :ACS_SSSB, ACS_LTEE
  maybe_const_set :ACS_SSBS, ACS_BTEE
  maybe_const_set :ACS_BSSS, ACS_TTEE
  maybe_const_set :ACS_BSBS, ACS_HLINE
  maybe_const_set :ACS_SBSB, ACS_VLINE
  maybe_const_set :ACS_SSSS, ACS_PLUS
end

#maybe_const_set(name, value) ⇒ Object



7
8
9
10
11
# File 'lib/ffi-ncurses/acs.rb', line 7

def maybe_const_set(name, value)
  if !const_defined?(name)
    const_set name, value
  end
end