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)  

rdjpgcom.c File Reference
#include "jinclude.h"
#include <ctype.h>
Include dependency graph for rdjpgcom.c:

Go to the source code of this file.

Macros

#define JPEG_CJPEG_DJPEG   /* to get the command-line config symbols */
 
#define READ_BINARY   "rb"
 
#define EXIT_FAILURE   1
 
#define EXIT_SUCCESS   0
 
#define NEXTBYTE()   getc(infile)
 
#define ERREXIT(msg)   (fprintf(stderr, "%s\n", msg), exit(EXIT_FAILURE))
 
#define M_SOF0   0xC0 /* Start Of Frame N */
 
#define M_SOF1   0xC1 /* N indicates which compression process */
 
#define M_SOF2   0xC2 /* Only SOF0-SOF2 are now in common use */
 
#define M_SOF3   0xC3
 
#define M_SOF5   0xC5 /* NB: codes C4 and CC are NOT SOF markers */
 
#define M_SOF6   0xC6
 
#define M_SOF7   0xC7
 
#define M_SOF9   0xC9
 
#define M_SOF10   0xCA
 
#define M_SOF11   0xCB
 
#define M_SOF13   0xCD
 
#define M_SOF14   0xCE
 
#define M_SOF15   0xCF
 
#define M_SOI   0xD8 /* Start Of Image (beginning of datastream) */
 
#define M_EOI   0xD9 /* End Of Image (end of datastream) */
 
#define M_SOS   0xDA /* Start Of Scan (begins compressed data) */
 
#define M_APP0   0xE0 /* Application-specific marker, type N */
 
#define M_APP12   0xEC /* (we don't bother to list all 16 APPn's) */
 
#define M_COM   0xFE /* COMment */
 

Functions

static int read_1_byte (void)
 
static unsigned int read_2_bytes (void)
 
static int next_marker (void)
 
static int first_marker (void)
 
static void skip_variable (void)
 
static void process_COM (void)
 
static void process_SOFn (int marker)
 
static int scan_JPEG_header (int verbose)
 
static void usage (void)
 
static int keymatch (char *arg, const char *keyword, int minchars)
 
int main (int argc, char **argv)
 

Variables

static FILEinfile
 
static const char * progname
 

Macro Definition Documentation

◆ ERREXIT

#define ERREXIT (   msg)    (fprintf(stderr, "%s\n", msg), exit(EXIT_FAILURE))

Definition at line 68 of file rdjpgcom.c.

◆ EXIT_FAILURE

#define EXIT_FAILURE   1

Definition at line 45 of file rdjpgcom.c.

◆ EXIT_SUCCESS

#define EXIT_SUCCESS   0

Definition at line 51 of file rdjpgcom.c.

◆ JPEG_CJPEG_DJPEG

#define JPEG_CJPEG_DJPEG   /* to get the command-line config symbols */

Definition at line 14 of file rdjpgcom.c.

◆ M_APP0

#define M_APP0   0xE0 /* Application-specific marker, type N */

Definition at line 122 of file rdjpgcom.c.

◆ M_APP12

#define M_APP12   0xEC /* (we don't bother to list all 16 APPn's) */

Definition at line 123 of file rdjpgcom.c.

◆ M_COM

#define M_COM   0xFE /* COMment */

Definition at line 124 of file rdjpgcom.c.

◆ M_EOI

#define M_EOI   0xD9 /* End Of Image (end of datastream) */

Definition at line 120 of file rdjpgcom.c.

◆ M_SOF0

#define M_SOF0   0xC0 /* Start Of Frame N */

Definition at line 106 of file rdjpgcom.c.

◆ M_SOF1

#define M_SOF1   0xC1 /* N indicates which compression process */

Definition at line 107 of file rdjpgcom.c.

◆ M_SOF10

#define M_SOF10   0xCA

Definition at line 114 of file rdjpgcom.c.

◆ M_SOF11

#define M_SOF11   0xCB

Definition at line 115 of file rdjpgcom.c.

◆ M_SOF13

#define M_SOF13   0xCD

Definition at line 116 of file rdjpgcom.c.

◆ M_SOF14

#define M_SOF14   0xCE

Definition at line 117 of file rdjpgcom.c.

◆ M_SOF15

#define M_SOF15   0xCF

Definition at line 118 of file rdjpgcom.c.

◆ M_SOF2

#define M_SOF2   0xC2 /* Only SOF0-SOF2 are now in common use */

Definition at line 108 of file rdjpgcom.c.

◆ M_SOF3

#define M_SOF3   0xC3

Definition at line 109 of file rdjpgcom.c.

◆ M_SOF5

#define M_SOF5   0xC5 /* NB: codes C4 and CC are NOT SOF markers */

Definition at line 110 of file rdjpgcom.c.

◆ M_SOF6

#define M_SOF6   0xC6

Definition at line 111 of file rdjpgcom.c.

◆ M_SOF7

#define M_SOF7   0xC7

Definition at line 112 of file rdjpgcom.c.

◆ M_SOF9

#define M_SOF9   0xC9

Definition at line 113 of file rdjpgcom.c.

◆ M_SOI

#define M_SOI   0xD8 /* Start Of Image (beginning of datastream) */

Definition at line 119 of file rdjpgcom.c.

◆ M_SOS

#define M_SOS   0xDA /* Start Of Scan (begins compressed data) */

Definition at line 121 of file rdjpgcom.c.

◆ NEXTBYTE

#define NEXTBYTE ( )    getc(infile)

Definition at line 64 of file rdjpgcom.c.

◆ READ_BINARY

#define READ_BINARY   "rb"

Definition at line 40 of file rdjpgcom.c.

Function Documentation

◆ first_marker()

static int first_marker ( void  )
static

Definition at line 173 of file rdjpgcom.c.

References c1, c2, ERREXIT, M_SOI, and NEXTBYTE.

Referenced by scan_JPEG_header().

◆ keymatch()

static int keymatch ( char *  arg,
const char *  keyword,
int  minchars 
)
static

Definition at line 408 of file rdjpgcom.c.

References isupper, keyword, and tolower.

Referenced by main().

◆ main()

int main ( int  argc,
char **  argv 
)

◆ next_marker()

static int next_marker ( void  )
static

Definition at line 138 of file rdjpgcom.c.

References c, fprintf, and read_1_byte().

Referenced by scan_JPEG_header().

◆ process_COM()

static void process_COM ( void  )
static

Definition at line 221 of file rdjpgcom.c.

References ch, ERREXIT, lastch, length, printf(), putc, read_1_byte(), read_2_bytes(), and fc-lang::stdout.

Referenced by scan_JPEG_header().

◆ process_SOFn()

static void process_SOFn ( int  marker)
static

◆ read_1_byte()

static int read_1_byte ( void  )
static

Definition at line 73 of file rdjpgcom.c.

References c, EOF, ERREXIT, and NEXTBYTE.

Referenced by next_marker(), process_COM(), process_SOFn(), and skip_variable().

◆ read_2_bytes()

static unsigned int read_2_bytes ( void  )
static

Definition at line 86 of file rdjpgcom.c.

References c1, c2, EOF, ERREXIT, int(), and NEXTBYTE.

Referenced by process_COM(), process_SOFn(), and skip_variable().

◆ scan_JPEG_header()

◆ skip_variable()

static void skip_variable ( void  )
static

Definition at line 195 of file rdjpgcom.c.

References ERREXIT, length, read_1_byte(), read_2_bytes(), and void.

Referenced by scan_JPEG_header().

◆ usage()

static void usage ( void  )
static

Definition at line 393 of file rdjpgcom.c.

References exit(), EXIT_FAILURE, fprintf, and progname.

Referenced by main().

Variable Documentation

◆ infile

◆ progname

const char* progname
static

Definition at line 389 of file rdjpgcom.c.

Referenced by main(), and usage().