'LibPst'
pst2dii.cpp File Reference
#include <iostream>
#include <string>
#include <vector>
#include "define.h"
#include "lzfu.h"
Include dependency graph for pst2dii.cpp:

Go to the source code of this file.

Data Structures

struct  file_ll
 

Macros

#define C_TIME_SIZE   500
 

Functions

static void open_png ()
 
static void close_png ()
 
static void version ()
 
static void usage ()
 
static char * removeCR (char *c)
 
static char * skip_header_prologue (char *headers)
 
static void check_filename (string &fname)
 
static string write_separate_attachment (string fname, pst_item_attach *current_attach, int attach_num, pst_file *pst)
 
static void print_pdf_short (const char *line, int len, int color)
 
static void new_line ()
 
static void print_pdf_single (const char *line, int color)
 
static void print_pdf_only (char *line, int color)
 
static void print_pdf (char *line)
 
static void open_pdf (char *line)
 
static void close_pdf ()
 
static void write_simple (const char *tag, const char *value)
 
static void write_simple (const char *tag, string value)
 
static void write_simple (const char *tag, const char *value, const char *value2)
 
static string extract_header (char *headers, const char *field)
 
static void write_normal_email (file_ll &f, pst_item *item, pst_file *pst)
 
static void create_enter_dir (file_ll &f, file_ll *parent, pst_item *item)
 
static void close_enter_dir (file_ll &f)
 
static void process (pst_item *outeritem, file_ll *parent, pst_desc_tree *d_ptr)
 
int main (int argc, char *const *argv)
 

Variables

const char * convert = "/usr/bin/convert"
 
const char * prog_name = NULL
 
const char * bates_prefix = ""
 
int bates_index = 0
 
const char * output_directory = "."
 
const char * output_file = "load.dii"
 
char * font_file = NULL
 
int bates_color = 0xff0000
 
int email_sequence = 0
 
char * pdf_name = NULL
 
FILE * dii_file = NULL
 
pst_file pstfile
 
bool pdf_open = false
 
char * pst_folder
 
int page_sequence
 
string conversion
 
vector< string > png_names
 
bool png_open = false
 
int line_height
 
int char_width
 
int col_number
 
int col_max
 
int line_number
 
int line_max
 
int x_position
 
int y_position
 
int black
 
int red
 
gdImagePtr image
 
const int DPI = 300
 
const double sz = 10.0
 
const int margin = DPI/2
 
const int LINE_SIZE = 2000
 
const int PAGE_WIDTH = DPI*17/2
 
const int PAGE_HEIGHT = DPI*11
 

Macro Definition Documentation

◆ C_TIME_SIZE

#define C_TIME_SIZE   500

Definition at line 74 of file pst2dii.cpp.

Referenced by write_normal_email().

Function Documentation

◆ check_filename()

static void check_filename ( string &  fname)
static

Definition at line 146 of file pst2dii.cpp.

References DEBUG_ENT, and DEBUG_RET.

Referenced by write_separate_attachment().

◆ close_enter_dir()

static void close_enter_dir ( file_ll f)
static

Definition at line 597 of file pst2dii.cpp.

Referenced by process().

◆ close_pdf()

static void close_pdf ( )
static

Definition at line 381 of file pst2dii.cpp.

References close_png(), conversion, dii_file, pdf_name, and png_names.

Referenced by write_normal_email().

Here is the call graph for this function:

◆ close_png()

static void close_png ( )
static

Definition at line 343 of file pst2dii.cpp.

References conversion, image, page_sequence, png_names, png_open, and pst_malloc().

Referenced by close_pdf(), and print_pdf_short().

Here is the call graph for this function:

◆ create_enter_dir()

static void create_enter_dir ( file_ll f,
file_ll parent,
pst_item item 
)
static

Definition at line 587 of file pst2dii.cpp.

References pst_item::file_as, pst_item::folder, pst_item_folder::item_count, file_ll::name, pst_convert_utf8(), file_ll::stored_count, pst_string::str, file_ll::type, and pst_item::type.

Referenced by process().

Here is the call graph for this function:

◆ extract_header()

static string extract_header ( char *  headers,
const char *  field 
)
static

Definition at line 419 of file pst2dii.cpp.

Referenced by write_normal_email().

◆ main()

◆ new_line()

static void new_line ( )
static

Definition at line 251 of file pst2dii.cpp.

References col_number, line_height, line_number, margin, x_position, and y_position.

Referenced by print_pdf_only(), and print_pdf_single().

◆ open_pdf()

static void open_pdf ( char *  line)
static

Definition at line 364 of file pst2dii.cpp.

References conversion, convert, dii_file, email_sequence, open_png(), output_directory, page_sequence, pdf_name, png_names, pst_folder, and pst_malloc().

Referenced by write_normal_email().

Here is the call graph for this function:

◆ open_png()

static void open_png ( )
static

◆ print_pdf()

static void print_pdf ( char *  line)
static

Definition at line 298 of file pst2dii.cpp.

References black, dii_file, print_pdf_only(), and pst_fwrite().

Referenced by write_normal_email().

Here is the call graph for this function:

◆ print_pdf_only()

static void print_pdf_only ( char *  line,
int  color 
)
static

Definition at line 283 of file pst2dii.cpp.

References new_line(), and print_pdf_single().

Referenced by open_png(), print_pdf(), and write_normal_email().

Here is the call graph for this function:

◆ print_pdf_short()

static void print_pdf_short ( const char *  line,
int  len,
int  color 
)
static

Definition at line 215 of file pst2dii.cpp.

References close_png(), col_number, DPI, font_file, image, line_max, line_number, open_png(), sz, x_position, and y_position.

Referenced by print_pdf_single().

Here is the call graph for this function:

◆ print_pdf_single()

static void print_pdf_single ( const char *  line,
int  color 
)
static

Definition at line 261 of file pst2dii.cpp.

References col_max, col_number, new_line(), and print_pdf_short().

Referenced by print_pdf_only().

Here is the call graph for this function:

◆ process()

◆ removeCR()

static char * removeCR ( char *  c)
static

Definition at line 113 of file pst2dii.cpp.

References DEBUG_ENT, and DEBUG_RET.

Referenced by write_normal_email().

◆ skip_header_prologue()

static char * skip_header_prologue ( char *  headers)
static

Definition at line 134 of file pst2dii.cpp.

Referenced by write_normal_email().

◆ usage()

static void usage ( void  )
static

Definition at line 95 of file pst2dii.cpp.

References prog_name, and version().

Referenced by main().

Here is the call graph for this function:

◆ version()

static void version ( void  )
static

Definition at line 81 of file pst2dii.cpp.

References VERSION.

Referenced by main(), and usage().

◆ write_normal_email()

◆ write_separate_attachment()

static string write_separate_attachment ( string  fname,
pst_item_attach current_attach,
int  attach_num,
pst_file pst 
)
static

◆ write_simple() [1/3]

static void write_simple ( const char *  tag,
const char *  value 
)
static

Definition at line 395 of file pst2dii.cpp.

References dii_file.

Referenced by write_normal_email().

◆ write_simple() [2/3]

static void write_simple ( const char *  tag,
string  value 
)
static

Definition at line 402 of file pst2dii.cpp.

References dii_file.

◆ write_simple() [3/3]

static void write_simple ( const char *  tag,
const char *  value,
const char *  value2 
)
static

Definition at line 409 of file pst2dii.cpp.

References dii_file.

Variable Documentation

◆ bates_color

int bates_color = 0xff0000

Definition at line 43 of file pst2dii.cpp.

Referenced by main(), and open_png().

◆ bates_index

int bates_index = 0

Definition at line 39 of file pst2dii.cpp.

Referenced by main(), open_png(), and write_normal_email().

◆ bates_prefix

const char* bates_prefix = ""

Definition at line 38 of file pst2dii.cpp.

Referenced by main(), and open_png().

◆ black

int black

Definition at line 63 of file pst2dii.cpp.

Referenced by open_png(), print_pdf(), and write_normal_email().

◆ char_width

int char_width

Definition at line 59 of file pst2dii.cpp.

Referenced by open_png().

◆ col_max

int col_max

Definition at line 60 of file pst2dii.cpp.

Referenced by open_png(), and print_pdf_single().

◆ col_number

int col_number

Definition at line 60 of file pst2dii.cpp.

Referenced by new_line(), open_png(), print_pdf_short(), and print_pdf_single().

◆ conversion

string conversion

Definition at line 53 of file pst2dii.cpp.

Referenced by close_pdf(), close_png(), open_pdf(), and sbcs_conversion().

◆ convert

const char* convert = "/usr/bin/convert"

Definition at line 36 of file pst2dii.cpp.

Referenced by open_pdf().

◆ dii_file

FILE* dii_file = NULL

Definition at line 46 of file pst2dii.cpp.

Referenced by close_pdf(), main(), open_pdf(), print_pdf(), write_normal_email(), and write_simple().

◆ DPI

const int DPI = 300

Definition at line 66 of file pst2dii.cpp.

Referenced by open_png(), and print_pdf_short().

◆ email_sequence

int email_sequence = 0

Definition at line 44 of file pst2dii.cpp.

Referenced by open_pdf().

◆ font_file

char* font_file = NULL

Definition at line 42 of file pst2dii.cpp.

Referenced by main(), open_png(), and print_pdf_short().

◆ image

gdImagePtr image

Definition at line 64 of file pst2dii.cpp.

Referenced by close_png(), open_png(), and print_pdf_short().

◆ line_height

int line_height

Definition at line 58 of file pst2dii.cpp.

Referenced by new_line(), and open_png().

◆ line_max

int line_max

Definition at line 61 of file pst2dii.cpp.

Referenced by open_png(), and print_pdf_short().

◆ line_number

int line_number

Definition at line 61 of file pst2dii.cpp.

Referenced by new_line(), open_png(), and print_pdf_short().

◆ LINE_SIZE

const int LINE_SIZE = 2000

Definition at line 69 of file pst2dii.cpp.

Referenced by main(), open_png(), and write_normal_email().

◆ margin

const int margin = DPI/2

Definition at line 68 of file pst2dii.cpp.

Referenced by new_line(), and open_png().

◆ output_directory

const char* output_directory = "."

Definition at line 40 of file pst2dii.cpp.

Referenced by main(), open_pdf(), and write_separate_attachment().

◆ output_file

const char* output_file = "load.dii"

Definition at line 41 of file pst2dii.cpp.

Referenced by main().

◆ PAGE_HEIGHT

const int PAGE_HEIGHT = DPI*11

Definition at line 71 of file pst2dii.cpp.

Referenced by open_png().

◆ page_sequence

int page_sequence

Definition at line 52 of file pst2dii.cpp.

Referenced by close_png(), and open_pdf().

◆ PAGE_WIDTH

const int PAGE_WIDTH = DPI*17/2

Definition at line 70 of file pst2dii.cpp.

Referenced by open_png().

◆ pdf_name

char* pdf_name = NULL

Definition at line 45 of file pst2dii.cpp.

Referenced by close_pdf(), and open_pdf().

◆ pdf_open

bool pdf_open = false

Definition at line 50 of file pst2dii.cpp.

◆ png_names

vector<string> png_names

Definition at line 54 of file pst2dii.cpp.

Referenced by close_pdf(), close_png(), and open_pdf().

◆ png_open

bool png_open = false

Definition at line 57 of file pst2dii.cpp.

Referenced by close_png(), and open_png().

◆ prog_name

const char* prog_name = NULL

Definition at line 37 of file pst2dii.cpp.

Referenced by main(), and usage().

◆ pst_folder

char* pst_folder

Definition at line 51 of file pst2dii.cpp.

Referenced by open_pdf(), and open_png().

◆ pstfile

pst_file pstfile

Definition at line 47 of file pst2dii.cpp.

Referenced by main(), and process().

◆ red

int red

Definition at line 63 of file pst2dii.cpp.

Referenced by open_png().

◆ sz

const double sz = 10.0

Definition at line 67 of file pst2dii.cpp.

Referenced by open_png(), and print_pdf_short().

◆ x_position

int x_position

Definition at line 62 of file pst2dii.cpp.

Referenced by new_line(), open_png(), and print_pdf_short().

◆ y_position

int y_position

Definition at line 62 of file pst2dii.cpp.

Referenced by new_line(), open_png(), and print_pdf_short().