CAPS Universe documentation  1.0.4
All you need to know to be successful
Macros | Functions
encode_method_3.c File Reference

Macros

#define pDEBUG(x, ...)
 

Functions

static void c3_line_data_append (struct cm3_line *cline, uint8_t byte)
 
static void c3_line_delta_overflow_append (struct cm3_line *cline, unsigned value)
 
static void c3_line_delta_append (struct cm3_line *cline, unsigned offset, const uint8_t *pattern, size_t count)
 
static int c3_line_flush (FILE *outstream, struct cm3_line *cline)
 
static void c3_delta_loop (struct cm3_line *cline, unsigned rel_offset, unsigned count, const uint8_t *pattern)
 
static void c3_line_encode (struct cm3_line *cline, const struct dlist_entry *edit, const uint8_t *pattern)
 
static int hl_c3_page_encode (struct brother_doc *info)
 

Macro Definition Documentation

◆ pDEBUG

#define pDEBUG (   x,
  ... 
)

Function Documentation

◆ c3_line_data_append()

static void c3_line_data_append ( struct cm3_line cline,
uint8_t  byte 
)
static

Append a single byte to the end of the line data buffer

Parameters
[in,out]clineLine info
[in]byteThe byte to append to the end of the line data buffer
Todo:
This functions is always the same in all encoding methods

◆ c3_line_delta_overflow_append()

static void c3_line_delta_overflow_append ( struct cm3_line cline,
unsigned  value 
)
static

Add an overflow value to the line buffer

Parameters
[in,out]clineLine info
[in]valueOverflow value

An overflow value is a value which is larger then the first byte in the 'delta entry' can include. An overflow value is encoded into a sequence of bytes. A byte of 255 signals more bytes follows. The sequence terminates if a byte below 0xff is found.

E.g. value = 0 -> <0x00> value = 10 -> <0x0a> value = 255 -> <0xff> <0x00> value = 256 -> <0xff> <0x01> value = 512 -> <0xff> <0xff> <0x02>

This overflow value is used to form the 'offset' and 'count' values in the 'delta entries'

Todo:
Same function like in hl_c1030_overflow_append()

◆ c3_line_delta_append()

static void c3_line_delta_append ( struct cm3_line cline,
unsigned  offset,
const uint8_t *  pattern,
size_t  count 
)
static

Write one delta replacement entry

Parameters
[in,out]clineLine info
[in]offsetOffset to the previous change in the line
[in]patternWhat data to append
[in]countHow many bytes to append (minimal 1, maximal 8)

7654 3210 ^_^^^^_ offset ^^^_______ count (encoded here is count - 1)

The encoding is like the one in hl_c1030_repeat_edit_append(), only here are no overflows allowed for the 'count' component :)

◆ c3_line_flush()

static int c3_line_flush ( FILE *  outstream,
struct cm3_line cline 
)
static

Flush the encoded line data to the printer

Parameters
[in]outstreamThe stream to send the printer data to
[in]clineLine info
Return values
0on success
-errnoif the data flushing to the printer has failed

◆ c3_delta_loop()

static void c3_delta_loop ( struct cm3_line cline,
unsigned  rel_offset,
unsigned  count,
const uint8_t *  pattern 
)
static

Encode one non-matching 'edit'

Parameters
[in,out]clineThe line to encode the printer's wire data to
[in]rel_offsetOffset to the last write
[in]countCount of bytes to write
[in]patternStart of the pattern to write

◆ c3_line_encode()

static void c3_line_encode ( struct cm3_line cline,
const struct dlist_entry edit,
const uint8_t *  pattern 
)
static

Encode all non-matching 'edits' in a line

Parameters
[in,out]clineThe line to encode the printer's wire data to
[in]editThe start 'edit' in the line (can be NULL, but should not)
[in]patternStart of the pattern to write

◆ hl_c3_page_encode()

static int hl_c3_page_encode ( struct brother_doc *  info)
static

Encode the full page according to the 1030 method

Parameters
[in,out]infoJob info
Return values
0on success
-errnoon failures