Class: Dvi::Opcode::Bop

Inherits:
Base
  • Object
show all
Defined in:
lib/dvi/opcode.rb

Overview

Bop is a class for bop opcode. The bop opcode means “begging of a page.”

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

range, set_range

Constructor Details

#initialize(counters, previous) ⇒ Bop

Returns a new instance of Bop.

Raises:

  • (ArgumentError)


141
142
143
144
145
146
147
# File 'lib/dvi/opcode.rb', line 141

def initialize(counters, previous)
  raise ArgumentError if counters.size != 10
  # \count0 ... \count9
  @counters = counters
  # previous bop
  @previous = previous
end

Instance Attribute Details

#countersObject (readonly)

Returns the value of attribute counters.



139
140
141
# File 'lib/dvi/opcode.rb', line 139

def counters
  @counters
end

#previousObject (readonly)

Returns the value of attribute previous.



139
140
141
# File 'lib/dvi/opcode.rb', line 139

def previous
  @previous
end

Class Method Details

.read(cmd, io) ⇒ Object

:nodoc:



149
150
151
152
153
154
155
# File 'lib/dvi/opcode.rb', line 149

def self.read(cmd, io) #:nodoc:
  # read \count0 ... \count9
  counters = (0..9).map{ io.read_int4 }
  # read previous bop position
  previous = io.read_int4
  return self.new(counters, previous)
end

Instance Method Details

#interpret(ps) ⇒ Object



157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
# File 'lib/dvi/opcode.rb', line 157

def interpret(ps)
  # clear register
  ps.h = 0
  ps.v = 0
  ps.w = 0
  ps.x = 0
  ps.y = 0
  ps.z = 0
  # set the stack empty
  ps.stack.clear
  # set current font to an undefined value
  ps.font = nil
  # !!! NOT IMPLEMENTED !!!
  # Ci?
end