w32tex
About: TeX Live provides a comprehensive TeX system including all the major TeX-related programs, macro packages, and fonts that are free software. Windows sources.
  Fossies Dox: w32tex-src.tar.xz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

parsepfa.c File Reference
#include "pfaedit.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ustring.h>
#include <utype.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include "psfont.h"
#include <locale.h>
Include dependency graph for parsepfa.c:

Go to the source code of this file.

Classes

struct  fontparse
 

Macros

#define c1   52845
 
#define c2   22719
 
#define EODMARKLEN   16
 
#define bgetc(extra, in)   (*(extra)=='\0' ? getc(in) : (unsigned char ) *(extra)++ )
 

Functions

static void copyenc (char *encoding[256], char *std[256])
 
static void setStdEnc (char *encoding[256])
 
static void setLatin1Enc (char *encoding[256])
 
static struct fontdictMakeEmptyFont (void)
 
static struct fontdictPSMakeEmptyFont (void)
 
static char * myfgets (char *str, int len, FILE *file)
 
static char * myfgetsNoNulls (char *str, int len, FILE *file)
 
static char * getstring (char *start, FILE *in)
 
static char * gettoken (char *start)
 
static int getbool (char *start)
 
static void fillintarray (int *array, char *start, int maxentries)
 
static void fillrealarray (double *array, char *start, int maxentries)
 
static void InitDict (struct psdict *dict, char *line)
 
static void InitChars (struct pschars *chars, char *line)
 
static void InitCharProcs (struct charprocs *cp, char *line)
 
static int mycmp (char *str, char *within, char *end)
 
static void ContinueValue (struct fontparse *fp, struct psdict *dict, char *line)
 
static void AddValue (struct fontparse *fp, struct psdict *dict, char *line, char *endtok)
 
static int hex (int ch1, int ch2)
 
static void initcode (void)
 
static int decode (unsigned char cypher)
 
static void dumpzeros (FILE *out, unsigned char *zeros, int zcnt)
 
static void decodestr (unsigned char *str, int len)
 
static void findstring (struct fontparse *fp, struct pschars *subrs, int index, char *nametok, char *str)
 
static void findnumbers (struct fontparse *fp, struct pschars *chars, char *str)
 
static char * rmbinary (char *line)
 
static void sfnts2tempfile (struct fontparse *fp, FILE *in, char *line)
 
static void ParseSimpleEncoding (struct fontparse *fp, char *line)
 
static void parseline (struct fontparse *fp, char *line, FILE *in)
 
static void addinfo (struct fontparse *fp, char *line, char *tok, char *binstart, int binlen, FILE *in)
 
static int glorpline (struct fontparse *fp, FILE *temp, char *rdtok)
 
static void decrypteexec (FILE *in, FILE *temp, int hassectionheads, char *extra)
 
static void decryptagain (struct fontparse *fp, FILE *temp, char *rdtok)
 
static void parsetype3 (struct fontparse *fp, FILE *in)
 
static unsigned char * readt1str (FILE *temp, int offset, int len, int leniv)
 
static void figurecids (struct fontparse *fp, FILE *temp)
 
static void dodata (struct fontparse *fp, FILE *in, FILE *temp)
 
static void realdecrypt (struct fontparse *fp, FILE *in, FILE *temp)
 
FontDict_ReadPSFont (FILE *in)
 
FontDictReadPSFont (char *fontname)
 
void PSCharsFree (struct pschars *chrs)
 
void PSDictFree (struct psdict *dict)
 
static void PrivateFree (struct private *prv)
 
static void FontInfoFree (struct fontinfo *fi)
 
void PSFontFree (FontDict *fd)
 
char ** _NamesReadPostscript (FILE *ps)
 
char ** NamesReadPostscript (char *filename)
 

Variables

char * AdobeStandardEncoding []
 
char * AdobeExpertEncoding []
 
unsigned short r
 
static int nrandombytes [4]
 

Macro Definition Documentation

◆ bgetc

#define bgetc (   extra,
  in 
)    (*(extra)=='\0' ? getc(in) : (unsigned char ) *(extra)++ )

Definition at line 2202 of file parsepfa.c.

◆ c1

#define c1   52845

Definition at line 1205 of file parsepfa.c.

◆ c2

#define c2   22719

Definition at line 1206 of file parsepfa.c.

◆ EODMARKLEN

#define EODMARKLEN   16

Definition at line 2200 of file parsepfa.c.

Function Documentation

◆ _NamesReadPostscript()

char** _NamesReadPostscript ( FILE ps)

Definition at line 2710 of file parsepfa.c.

References copyn(), end, fclose, fgets, galloc(), isspace, NULL, ps, pt, ret, strlen(), and strstr().

◆ _ReadPSFont()

FontDict* _ReadPSFont ( FILE in)

◆ addinfo()

static void addinfo ( struct fontparse fp,
char *  line,
char *  tok,
char *  binstart,
int  binlen,
FILE in 
)
static

◆ AddValue()

static void AddValue ( struct fontparse fp,
struct psdict dict,
char *  line,
char *  endtok 
)
static

◆ ContinueValue()

static void ContinueValue ( struct fontparse fp,
struct psdict dict,
char *  line 
)
static

Definition at line 1088 of file parsepfa.c.

References copyn(), fp, grealloc, isspace, len, psdict::next, NULL, fc-lang::off, strncmp(), and psdict::values.

Referenced by AddValue(), and parseline().

◆ copyenc()

static void copyenc ( char *  encoding[256],
char *  std[256] 
)
static

Definition at line 74 of file parsepfa.c.

References copy(), and i.

Referenced by setLatin1Enc(), and setStdEnc().

◆ decode()

static int decode ( unsigned char  cypher)
static

Definition at line 1212 of file parsepfa.c.

References c1, c2, and r.

Referenced by decrypteexec().

◆ decodestr()

static void decodestr ( unsigned char *  str,
int  len 
)
static

Definition at line 1223 of file parsepfa.c.

References c1, c2, len, r, and str.

Referenced by addinfo(), and findstring().

◆ decryptagain()

static void decryptagain ( struct fontparse fp,
FILE temp,
char *  rdtok 
)
static

Definition at line 2294 of file parsepfa.c.

References fp, glorpline(), and temp.

Referenced by realdecrypt().

◆ decrypteexec()

static void decrypteexec ( FILE in,
FILE temp,
int  hassectionheads,
char *  extra 
)
static

Definition at line 2204 of file parsepfa.c.

References bgetc, binary, ch2, ch3, ch4, decode(), dumpzeros(), EODMARKLEN, EOF, hex(), in, initcode(), isspace, nrandombytes, putc, temp, and ungetc.

Referenced by realdecrypt().

◆ dodata()

static void dodata ( struct fontparse fp,
FILE in,
FILE temp 
)
static

Definition at line 2419 of file parsepfa.c.

References _, _CFFParse(), binary, ch, ch2, cnt, EOF, figurecids(), fp, getc, hex(), in, isspace, len, LogError, pt, putc, temp, and ungetc.

Referenced by realdecrypt().

◆ dumpzeros()

static void dumpzeros ( FILE out,
unsigned char *  zeros,
int  zcnt 
)
static

Definition at line 1218 of file parsepfa.c.

References out.

Referenced by decrypteexec().

◆ figurecids()

◆ fillintarray()

static void fillintarray ( int array,
char *  start,
int  maxentries 
)
static

Definition at line 1001 of file parsepfa.c.

References end, i, int(), isspace, start, and strtod().

Referenced by parseline().

◆ fillrealarray()

static void fillrealarray ( double *  array,
char *  start,
int  maxentries 
)
static

Definition at line 1016 of file parsepfa.c.

References end, i, isdigit, isspace, start, strncmp(), and strtod().

Referenced by parseline().

◆ findnumbers()

static void findnumbers ( struct fontparse fp,
struct pschars chars,
char *  str 
)
static

Definition at line 1272 of file parsepfa.c.

References chars, copy(), end, forever, fp, index, isalnum, isspace, str, strtol(), val, and void.

Referenced by parseline().

◆ findstring()

static void findstring ( struct fontparse fp,
struct pschars subrs,
int  index,
char *  nametok,
char *  str 
)
static

Definition at line 1235 of file parsepfa.c.

References buffer, copy(), decodestr(), end, fp, galloc(), index, isdigit, isspace, memcpy, str, subrs, and val.

Referenced by parseline().

◆ FontInfoFree()

◆ getbool()

static int getbool ( char *  start)
static

Definition at line 992 of file parsepfa.c.

References isspace, and start.

Referenced by parseline().

◆ getstring()

static char* getstring ( char *  start,
FILE in 
)
static

Definition at line 938 of file parsepfa.c.

References buffer, copy(), end, forever, galloc(), grealloc, in, len, myfgetsNoNulls(), NULL, ret, start, and strncpy().

Referenced by parseline().

◆ gettoken()

static char* gettoken ( char *  start)
static

Definition at line 979 of file parsepfa.c.

References end, galloc(), isspace, ret, start, and strncpy().

Referenced by parseline().

◆ glorpline()

static int glorpline ( struct fontparse fp,
FILE temp,
char *  rdtok 
)
static

Definition at line 2039 of file parsepfa.c.

References addinfo(), buffer, ch, cnt, end, EOF, first, fp, galloc(), getc, grealloc, h, isdigit, ishexdigit, isspace, len, NULL, parseline(), pt, strcpy(), temp, ungetc, and val.

Referenced by decryptagain().

◆ hex()

static int hex ( int  ch1,
int  ch2 
)
static

Definition at line 1188 of file parsepfa.c.

References ch2.

Referenced by decrypteexec(), and dodata().

◆ InitCharProcs()

static void InitCharProcs ( struct charprocs cp,
char *  line 
)
static

Definition at line 1068 of file parsepfa.c.

References cp, ff_progress_change_total, gcalloc(), isspace, line, NULL, and strtol().

Referenced by parseline().

◆ InitChars()

static void InitChars ( struct pschars chars,
char *  line 
)
static

Definition at line 1056 of file parsepfa.c.

References chars, ff_progress_change_total, gcalloc(), isspace, line, NULL, and strtol().

Referenced by parseline(), and realdecrypt().

◆ initcode()

static void initcode ( void  )
static

Definition at line 1208 of file parsepfa.c.

References r.

Referenced by decrypteexec().

◆ InitDict()

static void InitDict ( struct psdict dict,
char *  line 
)
static

Definition at line 1040 of file parsepfa.c.

References cnt, psdict::cnt, gcalloc(), grealloc, i, isspace, psdict::keys, line, psdict::next, NULL, strtol(), and psdict::values.

Referenced by parseline().

◆ MakeEmptyFont()

static struct fontdict* MakeEmptyFont ( void  )
static

Definition at line 863 of file parsepfa.c.

References custom, gcalloc(), and ret.

Referenced by parseline().

◆ mycmp()

static int mycmp ( char *  str,
char *  within,
char *  end 
)
static

Definition at line 1079 of file parsepfa.c.

References end, str, and within.

Referenced by parseline().

◆ myfgets()

static char* myfgets ( char *  str,
int  len,
FILE file 
)
static

Definition at line 894 of file parsepfa.c.

References ch, end, EOF, getc, len, NULL, pt, str, and ungetc.

Referenced by realdecrypt().

◆ myfgetsNoNulls()

static char* myfgetsNoNulls ( char *  str,
int  len,
FILE file 
)
static

Definition at line 915 of file parsepfa.c.

References ch, end, EOF, getc, len, NULL, pt, str, and ungetc.

Referenced by getstring().

◆ NamesReadPostscript()

char** NamesReadPostscript ( char *  filename)

Definition at line 2737 of file parsepfa.c.

References _NamesReadPostscript(), filename, and fopen.

◆ parseline()

◆ ParseSimpleEncoding()

static void ParseSimpleEncoding ( struct fontparse fp,
char *  line 
)
static

Definition at line 1423 of file parsepfa.c.

References copy(), fp, isspace, line, pt, and tok().

Referenced by parseline().

◆ parsetype3()

static void parsetype3 ( struct fontparse fp,
FILE in 
)
static

Definition at line 2298 of file parsepfa.c.

References fp, in, and PSFontInterpretPS().

Referenced by realdecrypt().

◆ PrivateFree()

static void PrivateFree ( struct private prv)
static

Definition at line 2641 of file parsepfa.c.

References free, PSCharsFree(), and PSDictFree().

Referenced by PSFontFree().

◆ PSCharsFree()

void PSCharsFree ( struct pschars chrs)

Definition at line 2612 of file parsepfa.c.

References free, i, pschars::keys, pschars::lens, pschars::next, NULL, and pschars::values.

◆ PSDictFree()

void PSDictFree ( struct psdict dict)

Definition at line 2627 of file parsepfa.c.

References free, i, psdict::keys, psdict::next, NULL, and psdict::values.

◆ PSFontFree()

◆ PSMakeEmptyFont()

static struct fontdict* PSMakeEmptyFont ( void  )
static

Definition at line 878 of file parsepfa.c.

References custom, gcalloc(), and ret.

Referenced by _ReadPSFont().

◆ ReadPSFont()

FontDict* ReadPSFont ( char *  fontname)

Definition at line 2598 of file parsepfa.c.

References _, _ReadPSFont(), fclose, FILE, fontname, fopen, in, LogError, and NULL.

◆ readt1str()

static unsigned char* readt1str ( FILE temp,
int  offset,
int  len,
int  leniv 
)
static

Definition at line 2302 of file parsepfa.c.

References c1, c2, fseek, galloc(), getc, i, len, offset, pt, r, SEEK_SET, str, and temp.

Referenced by figurecids().

◆ realdecrypt()

static void realdecrypt ( struct fontparse fp,
FILE in,
FILE temp 
)
static

◆ rmbinary()

static char* rmbinary ( char *  line)
static

Definition at line 1301 of file parsepfa.c.

References pt, and strlen().

Referenced by addinfo(), and parseline().

◆ setLatin1Enc()

static void setLatin1Enc ( char *  encoding[256])
static

Definition at line 342 of file parsepfa.c.

References copyenc().

Referenced by parseline().

◆ setStdEnc()

static void setStdEnc ( char *  encoding[256])
static

Definition at line 338 of file parsepfa.c.

References AdobeStandardEncoding, and copyenc().

Referenced by parseline().

◆ sfnts2tempfile()

static void sfnts2tempfile ( struct fontparse fp,
FILE in,
char *  line 
)
static

Definition at line 1322 of file parsepfa.c.

References _, ch, EOF, fp, fseek, ftell, getc, in, instring, isdigit, isspace, LogError, NULL, pt, putc, SEEK_CUR, and strpbrk().

Referenced by parseline().

Variable Documentation

◆ AdobeExpertEncoding

char* AdobeExpertEncoding[]

Definition at line 604 of file parsepfa.c.

◆ AdobeStandardEncoding

char* AdobeStandardEncoding[]

Definition at line 80 of file parsepfa.c.

Referenced by readcffenc().

◆ nrandombytes

int nrandombytes[4]
static

Definition at line 2199 of file parsepfa.c.

Referenced by decrypteexec().

◆ r

unsigned short r

Definition at line 1204 of file parsepfa.c.