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)  

psutil.c File Reference
#include "config.h"
#include "psutil.h"
#include "psspec.h"
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <stdio.h>
#include "progname.h"
#include "xvasprintf.h"
#include "verror.h"
Include dependency graph for psutil.c:

Go to the source code of this file.

Macros

#define _FILE_OFFSET_BITS   64
 
#define iscomment(x, y)   (strncmp(x,y,strlen(y)) == 0)
 

Functions

void usage (void)
 
void argerror (void)
 
void die (const char *format,...)
 
FILEseekable (FILE *fp)
 
static int fcopy (off_t upto, off_t *ignorelist)
 
void scanpages (off_t *sizeheaders)
 
void seekpage (int p)
 
void writestring (const char *s)
 
void writepageheader (const char *label, int page)
 
void writepagesetup (void)
 
void writepagebody (int p)
 
void writepage (int p)
 
void writeheader (int p, off_t *ignore)
 
void writeheadermedia (int p, off_t *ignore, double width, double height)
 
int writepartprolog (void)
 
void writeprolog (void)
 
void writesetup (void)
 
void writetrailer (void)
 
void writeemptypage (void)
 

Variables

int pages
 
int verbose
 
FILEinfile
 
FILEoutfile
 
char pagelabel [BUFSIZ]
 
int pageno
 
static char buffer [BUFSIZ]
 
static long bytes = 0
 
static off_t pagescmt = 0
 
static off_t headerpos = 0
 
static off_t endsetup = 0
 
static off_t beginprocset = 0
 
static off_t endprocset = 0
 
static int outputpage = 0
 
static int maxpages = 100
 
static off_tpageptr
 

Macro Definition Documentation

◆ _FILE_OFFSET_BITS

#define _FILE_OFFSET_BITS   64

Definition at line 11 of file psutil.c.

◆ iscomment

#define iscomment (   x,
  y 
)    (strncmp(x,y,strlen(y)) == 0)

Definition at line 25 of file psutil.c.

Function Documentation

◆ argerror()

void argerror ( void  )

Definition at line 51 of file psutil.c.

References argerr_message, and die().

Referenced by parsedouble(), parseint(), and parsespecs().

◆ die()

◆ fcopy()

static int fcopy ( off_t  upto,
off_t ignorelist 
)
static

Definition at line 139 of file psutil.c.

References BUFSIZ, bytes, fgets, fread, ftello, fwrite(), infile, NULL, outfile, and r.

Referenced by writeheadermedia(), writepagebody(), writepartprolog(), writeprolog(), and writesetup().

◆ scanpages()

void scanpages ( off_t sizeheaders)

◆ seekable()

FILE* seekable ( FILE fp)

Definition at line 101 of file psutil.c.

References BUFSIZ, fclose, feof, FILE, fp, fread, fseeko, ftello, fwrite(), NULL, p, r, SEEK_END, SEEK_SET, void, and w.

Referenced by main(), and zlib_tr_flush_block().

◆ seekpage()

void seekpage ( int  p)

Definition at line 255 of file psutil.c.

References atoi(), BUFSIZ, die(), end, fgets, fseeko, infile, iscomment, isspace, NULL, p, pagelabel, pageno, pageptr, SEEK_SET, start, and strncpy().

Referenced by pstops_write(), and writepage().

◆ usage()

void usage ( void  uerr)

Definition at line 45 of file psutil.c.

References COPYRIGHT_STRING, exit(), fprintf, PACKAGE_VERSION, program_name, and syntax.

◆ writeemptypage()

void writeemptypage ( void  )

Definition at line 397 of file psutil.c.

References beginprocset, fprintf, outputpage, sprintf, verbose, and writestring().

Referenced by main().

◆ writeheader()

void writeheader ( int  p,
off_t ignore 
)

Definition at line 336 of file psutil.c.

References ignore, p, and writeheadermedia().

Referenced by main().

◆ writeheadermedia()

void writeheadermedia ( int  p,
off_t ignore,
double  width,
double  height 
)

Definition at line 341 of file psutil.c.

References BUFSIZ, die(), fcopy(), fgets, fseeko, headerpos, height, ignore, infile, NULL, p, pagescmt, SEEK_SET, sprintf, width, and writestring().

Referenced by pstops_write(), and writeheader().

◆ writepage()

void writepage ( int  p)

Definition at line 328 of file psutil.c.

References p, pagelabel, seekpage(), writepagebody(), and writepageheader().

Referenced by main().

◆ writepagebody()

void writepagebody ( int  p)

Definition at line 321 of file psutil.c.

References die(), fcopy(), NULL, outputpage, p, and pageptr.

Referenced by pstops_write(), and writepage().

◆ writepageheader()

void writepageheader ( const char *  label,
int  page 
)

Definition at line 295 of file psutil.c.

References fprintf, label, outputpage, sprintf, verbose, and writestring().

Referenced by pstops_write(), and writepage().

◆ writepagesetup()

void writepagesetup ( void  )

Definition at line 304 of file psutil.c.

References beginprocset, BUFSIZ, bytes, die(), EOF, fgets, fputs, infile, NULL, outfile, outputpage, strlen(), and strncmp().

Referenced by pstops_write().

◆ writepartprolog()

int writepartprolog ( void  )

Definition at line 361 of file psutil.c.

References beginprocset, die(), endprocset, fcopy(), fseeko, infile, NULL, SEEK_SET, and writeprolog().

Referenced by pstops_write().

◆ writeprolog()

void writeprolog ( void  )

Definition at line 372 of file psutil.c.

References die(), endsetup, fcopy(), and NULL.

Referenced by main(), and writepartprolog().

◆ writesetup()

void writesetup ( void  )

Definition at line 379 of file psutil.c.

References die(), fcopy(), NULL, and pageptr.

Referenced by main(), and pstops_write().

◆ writestring()

void writestring ( const char *  s)

Definition at line 288 of file psutil.c.

References bytes, fputs, outfile, s, and strlen().

Referenced by pstops_write(), writeemptypage(), writeheadermedia(), writepageheader(), and writetrailer().

◆ writetrailer()

void writetrailer ( void  )

Definition at line 386 of file psutil.c.

References BUFSIZ, bytes, fgets, fprintf, fseeko, infile, NULL, outputpage, pageptr, SEEK_SET, verbose, and writestring().

Referenced by main(), and pstops_write().

Variable Documentation

◆ beginprocset

off_t beginprocset = 0
static

Definition at line 39 of file psutil.c.

Referenced by scanpages(), writeemptypage(), writepagesetup(), and writepartprolog().

◆ buffer

char buffer[BUFSIZ]
static

Definition at line 34 of file psutil.c.

◆ bytes

long bytes = 0
static

Definition at line 35 of file psutil.c.

Referenced by _2022ToSJIS(), __gmpz_out_raw(), _bdf_readstream(), _Bocu1ToUnicode(), _Bocu1ToUnicodeWithOffsets(), _cairo_gl_composite_emit_alpha_vertex(), _cairo_gl_composite_emit_solid_span(), _cairo_gl_gradient_render(), _cairo_hash_bytes(), _cairo_mempool_alloc(), _cairo_mempool_init(), _cairo_ucs4_to_utf8(), _EBCDICSwapLFNL(), _extFromU(), _fill_xrender_bitmap(), _gcry_burn_stack(), _IMAPToUnicodeWithOffsets(), _LMBCSGetNextUCharWorker(), _UTF16BEGetNextUChar(), _UTF16LEGetNextUChar(), _UTF7ToUnicodeWithOffsets(), SortKeyByteSink::Append(), CharStringByteSink::Append(), U_NAMESPACE_BEGIN::FixedSortKeyByteSink::AppendBeyondCapacity(), CollationKeyByteSink::AppendBeyondCapacity(), appendUtf8(), OT::gvar::accelerator_t::apply_deltas_to_points(), U_NAMESPACE_BEGIN::MutableCodePointTrie::build(), Compiler::buildTable(), cairo_truetype_font_write_glyf_table(), cff_index_get_name(), clear_bits(), CnvExtIsValid(), compress_row(), convsample_20_didSubstitute(), convsample_21_didSubstitute(), digest_hex(), XXHashFunction< HASH_BYTES >::digestBytes(), encode_row(), EncodeData(), ExtendLastCommand(), fcopy(), file_load(), file_read(), file_stream_load(), file_stream_read(), file_stream_write(), file_write(), FontCache::fontinfo(), fromUWriteUInt8(), gabc_update_location(), gbase64Encode(), gdImageCreateFromXbm(), generateToUTable(), OT::VarData::get_delta(), get_low_endian_quad(), getFromUBytesValue(), gmallocn(), gmallocn3(), greallocn(), hb_ot_name_convert_utf(), hb_ot_name_get_utf(), iof_file_ensure(), iof_file_read(), iof_file_write(), iof_reader(), iof_repc(), iof_skip(), iof_string_reader(), iof_writer(), iofile_load(), iofile_read(), iofile_stream_load(), iofile_stream_read(), iofile_stream_write(), iofile_write(), Load_TrueType_Names(), LoadAChar(), MBCSAddFromUnicode(), MBCSAddToUnicode(), MBCSIsValid(), MBCSOkForBaseFromUnicode(), MBCSSingleAddFromUnicode(), MemFree(), mfgets(), mpz_export(), mpz_import(), mrb_str_reverse_bang(), mymalloc(), our_read(), PCF_Glyph_Load(), PCHG_MakeMask(), pdf_out_bytes(), pixCopy(), ppstring_inline(), print_as_hex(), printBytes(), printMapping(), ps_hints_t2counter(), ps_hints_t2mask(), ps_parser_to_bytes(), PSCharStringToBB(), PSCharStringToSplines(), FontCache::read(), CachedFile::read(), read_backing_store(), read_ilbm_plane(), read_pair(), read_unsigned(), ReadBitmapFile(), StreamReader::readBytes(), readHeader(), GFReader::readSigned(), GFReader::readString(), GFReader::readUnsigned(), RingBufferWrite(), RingBufferWriteTail(), scan_file_name(), sha1_finish_ctx(), ShouldCompress(), TestLenient8Iterator(), ucm_addMapping(), ucm_addMappingAuto(), ucm_addMappingFromLine(), ucm_countChars(), ucm_mappingType(), ucm_parseBytes(), ucm_parseMappingLine(), ucnv_fromUWriteBytes_68(), ucnv_MBCSDoubleFromUnicodeWithOffsets(), ucnv_MBCSFromUnicodeWithOffsets_68(), ucnv_MBCSGetFilteredUnicodeSetForUnicode_68(), ucnv_MBCSGetNextUChar(), ucnv_MBCSToUnicodeWithOffsets_68(), ucptrie_toBinary_68(), udata_create(), ufmt_utop(), OT::GlyphVariationData::unpack_deltas(), OT::GlyphVariationData::unpack_points(), utf8_count(), vm_alloc(), write_backing_store(), StreamWriter::writeBytes(), WriteMetaBlockInternal(), writepagesetup(), writeStage3Roundtrip(), writestring(), writetrailer(), and xmalloc().

◆ endprocset

off_t endprocset = 0
static

Definition at line 40 of file psutil.c.

Referenced by scanpages(), and writepartprolog().

◆ endsetup

off_t endsetup = 0
static

Definition at line 38 of file psutil.c.

Referenced by scanpages(), and writeprolog().

◆ headerpos

off_t headerpos = 0
static

Definition at line 37 of file psutil.c.

Referenced by scanpages(), and writeheadermedia().

◆ infile

FILE* infile

◆ maxpages

int maxpages = 100
static

Definition at line 42 of file psutil.c.

Referenced by scanpages().

◆ outfile

FILE* outfile

Definition at line 30 of file psutil.c.

Referenced by fcopy(), writepagesetup(), and writestring().

◆ outputpage

int outputpage = 0
static

Definition at line 41 of file psutil.c.

Referenced by writeemptypage(), writepagebody(), writepageheader(), writepagesetup(), and writetrailer().

◆ pagelabel

char pagelabel[BUFSIZ]

Definition at line 31 of file psutil.c.

Referenced by pstops_write(), seekpage(), and writepage().

◆ pageno

int pageno

Definition at line 32 of file psutil.c.

Referenced by seekpage().

◆ pageptr

off_t* pageptr
static

Definition at line 43 of file psutil.c.

Referenced by scanpages(), seekpage(), writepagebody(), writesetup(), and writetrailer().

◆ pages

Definition at line 27 of file psutil.c.

Referenced by scanpages().

◆ pagescmt

off_t pagescmt = 0
static

Definition at line 36 of file psutil.c.

Referenced by scanpages(), and writeheadermedia().

◆ verbose

int verbose

Definition at line 28 of file psutil.c.

Referenced by die(), writeemptypage(), writepageheader(), and writetrailer().