libextractor  1.11
About: GNU libextractor is a library used to extract meta-data from files of arbitrary type.
  Fossies Dox: libextractor-1.11.tar.gz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

ps_extractor.c File Reference

plugin to support PostScript files More...

#include "platform.h"
#include "extractor.h"
Include dependency graph for ps_extractor.c:

Go to the source code of this file.

Data Structures

struct  Matches
 

Macros

#define MAX_LINE   (1024)
 
#define PS_HEADER   "%!PS-Adobe"
 

Functions

static char * readline (struct EXTRACTOR_ExtractContext *ec)
 
void EXTRACTOR_ps_extract_method (struct EXTRACTOR_ExtractContext *ec)
 

Variables

static struct Matches tests []
 

Detailed Description

plugin to support PostScript files

Author
Christian Grothoff

Definition in file ps_extractor.c.

Macro Definition Documentation

◆ MAX_LINE

#define MAX_LINE   (1024)

Maximum length of a single line in the PostScript file we're willing to look at. While the body of the file can have longer lines, this should be a sane limit for the lines in the header with the meta data.

Definition at line 35 of file ps_extractor.c.

◆ PS_HEADER

#define PS_HEADER   "%!PS-Adobe"

Header of a PostScript file.

Definition at line 40 of file ps_extractor.c.

Function Documentation

◆ EXTRACTOR_ps_extract_method()

void EXTRACTOR_ps_extract_method ( struct EXTRACTOR_ExtractContext ec)

Main entry method for the 'application/postscript' extraction plugin.

Parameters
ecextraction context provided to the plugin

Definition at line 128 of file ps_extractor.c.

References EXTRACTOR_ExtractContext::cls, EXTRACTOR_METAFORMAT_UTF8, EXTRACTOR_METATYPE_MIMETYPE, NULL, Matches::prefix, EXTRACTOR_ExtractContext::proc, PS_HEADER, readline(), tests, and Matches::type.

◆ readline()

static char* readline ( struct EXTRACTOR_ExtractContext ec)
static

Read a single ('
'-terminated) line of input.

Parameters
eccontext for IO
Returns
NULL on end-of-file (or if next line exceeds limit)

Definition at line 98 of file ps_extractor.c.

References EXTRACTOR_ExtractContext::cls, MAX_LINE, NULL, EXTRACTOR_ExtractContext::read, and EXTRACTOR_ExtractContext::seek.

Referenced by EXTRACTOR_ps_extract_method().

Variable Documentation

◆ tests

struct Matches tests[]
static
Initial value:
= {
{ "%%Title: ", EXTRACTOR_METATYPE_TITLE },
{ "% Subject: ", EXTRACTOR_METATYPE_SUBJECT },
{ "%%Author: ", EXTRACTOR_METATYPE_AUTHOR_NAME },
{ "%%CreationDate: ", EXTRACTOR_METATYPE_CREATION_DATE },
{ "%%Orientation: ", EXTRACTOR_METATYPE_PAGE_ORIENTATION },
{ "%%DocumentPaperSizes: ", EXTRACTOR_METATYPE_PAPER_SIZE },
{ "%%PageOrder: ", EXTRACTOR_METATYPE_PAGE_ORDER },
{ "%%LanguageLevel: ", EXTRACTOR_METATYPE_FORMAT_VERSION },
{ "%%Magnification: ", EXTRACTOR_METATYPE_MAGNIFICATION },
{ NULL, 0 }
}
#define NULL
Definition: getopt1.c:60
@ EXTRACTOR_METATYPE_UNKNOWN_DATE
Definition: extractor.h:195
@ EXTRACTOR_METATYPE_PAGE_ORDER
Definition: extractor.h:295
@ EXTRACTOR_METATYPE_REVISION_NUMBER
Definition: extractor.h:274
@ EXTRACTOR_METATYPE_AUTHOR_NAME
Definition: extractor.h:143
@ EXTRACTOR_METATYPE_FORMAT_VERSION
Definition: extractor.h:191
@ EXTRACTOR_METATYPE_TITLE
Definition: extractor.h:134
@ EXTRACTOR_METATYPE_CREATED_BY_SOFTWARE
Definition: extractor.h:194
@ EXTRACTOR_METATYPE_PAGE_ORIENTATION
Definition: extractor.h:269
@ EXTRACTOR_METATYPE_MAGNIFICATION
Definition: extractor.h:254
@ EXTRACTOR_METATYPE_CREATION_DATE
Definition: extractor.h:196
@ EXTRACTOR_METATYPE_PAGE_COUNT
Definition: extractor.h:141
@ EXTRACTOR_METATYPE_PAPER_SIZE
Definition: extractor.h:270
@ EXTRACTOR_METATYPE_SUBJECT
Definition: extractor.h:188

Map of PS prefixes to LE types.

Definition at line 1 of file ps_extractor.c.

Referenced by EXTRACTOR_ps_extract_method().