file/src/ascmagic.c File Reference

#include "file.h"
#include "magic.h"
#include <stdio.h>
#include <string.h>
#include <memory.h>
#include <ctype.h>
#include <stdlib.h>
#include "names.h"

Include dependency graph for ascmagic.c:

Go to the source code of this file.

Defines

#define MAXLINELEN   300
#define ISSPC(x)
#define F   0
#define T   1
#define I   2
#define X   3

Typedefs

typedef unsigned long unichar

Functions

static const char * rcsid (const char *p)
static int looks_ascii (const unsigned char *buf, size_t nbytes, unichar *ubuf, size_t *ulen)
static int looks_utf8 (const unsigned char *buf, size_t nbytes, unichar *ubuf, size_t *ulen)
static int looks_unicode (const unsigned char *buf, size_t nbytes, unichar *ubuf, size_t *ulen)
static int looks_latin1 (const unsigned char *buf, size_t nbytes, unichar *ubuf, size_t *ulen)
static int looks_extended (const unsigned char *buf, size_t nbytes, unichar *ubuf, size_t *ulen)
static void from_ebcdic (const unsigned char *buf, size_t nbytes, unsigned char *out)
static int ascmatch (const unsigned char *s, const unichar *us, size_t ulen)
int file_ascmagic (struct magic_set *ms, const unsigned char *buf, size_t nbytes)

Variables

static char text_chars [256]
static unsigned char ebcdic_to_ascii []


Define Documentation

#define F   0

Definition at line 449 of file ascmagic.c.

Referenced by parseRCPOT().

#define I   2

Definition at line 451 of file ascmagic.c.

#define ISSPC (  ) 

Value:

((x) == ' ' || (x) == '\t' || (x) == '\r' || (x) == '\n' \
                  || (x) == 0x85 || (x) == '\f')

Definition at line 58 of file ascmagic.c.

Referenced by file_ascmagic().

#define MAXLINELEN   300

Definition at line 57 of file ascmagic.c.

#define T   1

Definition at line 450 of file ascmagic.c.

Referenced by looks_ascii(), looks_extended(), looks_latin1(), looks_unicode(), and looks_utf8().

#define X   3

Definition at line 452 of file ascmagic.c.

Referenced by looks_extended().


Typedef Documentation

typedef unsigned long unichar

Definition at line 55 of file ascmagic.c.


Function Documentation

static int ascmatch ( const unsigned char *  s,
const unichar us,
size_t  ulen 
) [static]

Definition at line 382 of file ascmagic.c.

Referenced by file_ascmagic().

int file_ascmagic ( struct magic_set ms,
const unsigned char *  buf,
size_t  nbytes 
)

Definition at line 83 of file ascmagic.c.

References ascmatch(), magic_set::flags, from_ebcdic(), ISSPC, looks_ascii(), looks_extended(), looks_latin1(), looks_unicode(), looks_utf8(), MAGIC_NO_CHECK_FORTRAN, MAGIC_NO_CHECK_TOKENS, MAGIC_NO_CHECK_TROFF, names::name, NNAMES, names::type, and types.

Referenced by file_buffer().

static void from_ebcdic ( const unsigned char *  buf,
size_t  nbytes,
unsigned char *  out 
) [static]

Definition at line 722 of file ascmagic.c.

Referenced by file_ascmagic().

static int looks_ascii ( const unsigned char *  buf,
size_t  nbytes,
unichar ubuf,
size_t *  ulen 
) [static]

Definition at line 478 of file ascmagic.c.

References T.

Referenced by file_ascmagic().

static int looks_extended ( const unsigned char *  buf,
size_t  nbytes,
unichar ubuf,
size_t *  ulen 
) [static]

Definition at line 517 of file ascmagic.c.

References T, and X.

Referenced by file_ascmagic().

static int looks_latin1 ( const unsigned char *  buf,
size_t  nbytes,
unichar ubuf,
size_t *  ulen 
) [static]

Definition at line 498 of file ascmagic.c.

References T.

Referenced by file_ascmagic().

static int looks_unicode ( const unsigned char *  buf,
size_t  nbytes,
unichar ubuf,
size_t *  ulen 
) [static]

Definition at line 600 of file ascmagic.c.

References T.

Referenced by file_ascmagic().

static int looks_utf8 ( const unsigned char *  buf,
size_t  nbytes,
unichar ubuf,
size_t *  ulen 
) [static]

Definition at line 537 of file ascmagic.c.

References T.

Referenced by file_ascmagic().

static const char* rcsid ( const char *  p  )  [static]

Definition at line 52 of file ascmagic.c.


Variable Documentation

unsigned char ebcdic_to_ascii[] [static]

Initial value:

 {
  0,   1,   2,   3, 156,   9, 134, 127, 151, 141, 142,  11,  12,  13,  14,  15,
 16,  17,  18,  19, 157, 133,   8, 135,  24,  25, 146, 143,  28,  29,  30,  31,
128, 129, 130, 131, 132,  10,  23,  27, 136, 137, 138, 139, 140,   5,   6,   7,
144, 145,  22, 147, 148, 149, 150,   4, 152, 153, 154, 155,  20,  21, 158,  26,
' ', 160, 161, 162, 163, 164, 165, 166, 167, 168, 213, '.', '<', '(', '+', '|',
'&', 169, 170, 171, 172, 173, 174, 175, 176, 177, '!', '$', '*', ')', ';', '~',
'-', '/', 178, 179, 180, 181, 182, 183, 184, 185, 203, ',', '%', '_', '>', '?',
186, 187, 188, 189, 190, 191, 192, 193, 194, '`', ':', '#', '@', '\'','=', '"',
195, 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 196, 197, 198, 199, 200, 201,
202, 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', '^', 204, 205, 206, 207, 208,
209, 229, 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', 210, 211, 212, '[', 214, 215,
216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, ']', 230, 231,
'{', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 232, 233, 234, 235, 236, 237,
'}', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 238, 239, 240, 241, 242, 243,
'\\',159, 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 244, 245, 246, 247, 248, 249,
'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 250, 251, 252, 253, 254, 255
}

Definition at line 664 of file ascmagic.c.

char text_chars[256] [static]

Initial value:

 {
        
         0  ,  0  ,  0  ,  0  ,  0  ,  0  ,  0  ,  1  ,  1  ,  1  ,  1  ,  0  ,  1  ,  1  ,  0  ,  0  ,  
        
         0  ,  0  ,  0  ,  0  ,  0  ,  0  ,  0  ,  0  ,  0  ,  0  ,  0  ,  1  ,  0  ,  0  ,  0  ,  0  ,  
         1  ,  1  ,  1  ,  1  ,  1  ,  1  ,  1  ,  1  ,  1  ,  1  ,  1  ,  1  ,  1  ,  1  ,  1  ,  1  ,  
         1  ,  1  ,  1  ,  1  ,  1  ,  1  ,  1  ,  1  ,  1  ,  1  ,  1  ,  1  ,  1  ,  1  ,  1  ,  1  ,  
         1  ,  1  ,  1  ,  1  ,  1  ,  1  ,  1  ,  1  ,  1  ,  1  ,  1  ,  1  ,  1  ,  1  ,  1  ,  1  ,  
         1  ,  1  ,  1  ,  1  ,  1  ,  1  ,  1  ,  1  ,  1  ,  1  ,  1  ,  1  ,  1  ,  1  ,  1  ,  1  ,  
         1  ,  1  ,  1  ,  1  ,  1  ,  1  ,  1  ,  1  ,  1  ,  1  ,  1  ,  1  ,  1  ,  1  ,  1  ,  1  ,  
         1  ,  1  ,  1  ,  1  ,  1  ,  1  ,  1  ,  1  ,  1  ,  1  ,  1  ,  1  ,  1  ,  1  ,  1  ,  0  ,  
        
         3  ,  3  ,  3  ,  3  ,  3  ,  1  ,  3  ,  3  ,  3  ,  3  ,  3  ,  3  ,  3  ,  3  ,  3  ,  3  ,  
         3  ,  3  ,  3  ,  3  ,  3  ,  3  ,  3  ,  3  ,  3  ,  3  ,  3  ,  3  ,  3  ,  3  ,  3  ,  3  ,  
         2  ,  2  ,  2  ,  2  ,  2  ,  2  ,  2  ,  2  ,  2  ,  2  ,  2  ,  2  ,  2  ,  2  ,  2  ,  2  ,  
         2  ,  2  ,  2  ,  2  ,  2  ,  2  ,  2  ,  2  ,  2  ,  2  ,  2  ,  2  ,  2  ,  2  ,  2  ,  2  ,  
         2  ,  2  ,  2  ,  2  ,  2  ,  2  ,  2  ,  2  ,  2  ,  2  ,  2  ,  2  ,  2  ,  2  ,  2  ,  2  ,  
         2  ,  2  ,  2  ,  2  ,  2  ,  2  ,  2  ,  2  ,  2  ,  2  ,  2  ,  2  ,  2  ,  2  ,  2  ,  2  ,  
         2  ,  2  ,  2  ,  2  ,  2  ,  2  ,  2  ,  2  ,  2  ,  2  ,  2  ,  2  ,  2  ,  2  ,  2  ,  2  ,  
         2  ,  2  ,  2  ,  2  ,  2  ,  2  ,  2  ,  2  ,  2  ,  2  ,  2  ,  2  ,  2  ,  2  ,  2  ,  2     
}

Definition at line 455 of file ascmagic.c.


Generated on Fri May 25 21:18:40 2007 for rpm by  doxygen 1.5.2