All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
blread.cpp File Reference
#include <stdlib.h>
#include "scanutils.h"
#include "fileerr.h"
#include "blread.h"

Go to the source code of this file.

Macros

#define UNLV_EXT   ".uzn"
 

Functions

bool read_unlv_file (STRING name, inT32 xsize, inT32 ysize, BLOCK_LIST *blocks)
 
void FullPageBlock (int width, int height, BLOCK_LIST *blocks)
 

Macro Definition Documentation

#define UNLV_EXT   ".uzn"

Definition at line 28 of file blread.cpp.

Function Documentation

void FullPageBlock ( int  width,
int  height,
BLOCK_LIST *  blocks 
)

Definition at line 67 of file blread.cpp.

67  {
68  BLOCK_IT block_it(blocks);
69  BLOCK* block = new BLOCK("", TRUE, 0, 0, 0, 0, width, height);
70  block_it.add_to_end(block);
71 }
Definition: ocrblock.h:30
#define TRUE
Definition: capi.h:28
bool read_unlv_file ( STRING  name,
inT32  xsize,
inT32  ysize,
BLOCK_LIST *  blocks 
)

Definition at line 36 of file blread.cpp.

41  {
42  FILE *pdfp; //file pointer
43  BLOCK *block; //current block
44  int x; //current top-down coords
45  int y;
46  int width; //of current block
47  int height;
48  BLOCK_IT block_it = blocks; //block iterator
49 
50  name += UNLV_EXT; //add extension
51  if ((pdfp = fopen (name.string (), "rb")) == NULL) {
52  return false; //didn't read one
53  } else {
54  while (tfscanf(pdfp, "%d %d %d %d %*s", &x, &y, &width, &height) >= 4) {
55  //make rect block
56  block = new BLOCK (name.string (), TRUE, 0, 0,
57  (inT16) x, (inT16) (ysize - y - height),
58  (inT16) (x + width), (inT16) (ysize - y));
59  //on end of list
60  block_it.add_to_end (block);
61  }
62  fclose(pdfp);
63  }
64  return true;
65 }
int tfscanf(FILE *stream, const char *format,...)
Definition: scanutils.cpp:229
#define UNLV_EXT
Definition: blread.cpp:28
Definition: ocrblock.h:30
#define TRUE
Definition: capi.h:28
#define NULL
Definition: host.h:144
const char * string() const
Definition: strngs.cpp:193
short inT16
Definition: host.h:100