summaryrefslogtreecommitdiff
path: root/support/word2x/lib.h
blob: 5c6236b20777dadf72f4c958a6da0672a3cacf97 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
/* $Id: lib.h,v 1.21 1998/02/17 12:27:18 dps Exp $ */

#ifndef __word2x_lib_h__
#define __word2x_lib_h__
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif /* HAVE_CONFIG_H */
#include <stdio.h>
#include <stddef.h>

#ifdef __cplusplus
#include "tblock.h"
#include "interface.h"
#endif /* __cplusplus */


/* Maximum section number */
#define MAX_START_NUM 100

typedef struct
{
    int wd[2];
    int dot_pos;
    int has_sign;
} num_info;

typedef enum { ALIGN_LEFT, ALIGN_CENTER, ALIGN_RIGHT, ALIGN_DP } align_t;

struct wd_info
{
    int width;
    int dp_col;
    int has_sign;
    align_t align;
};

/* Unit information */
struct unit_info
{
    int unit_type;
    int unit_number[NUNITS];
};

/* Numbered unit probing */
struct unit_number
{
    int unit_num;
    int offset;
};

#ifndef N
#define N(a) (sizeof(a)/sizeof(a[0]))
#endif


/*
 * Functions that need only C stuff are declared as C linkage here
 */
#ifdef __cplusplus
extern "C" {
#endif

extern struct wd_info find_width(int, const char *const *);
extern num_info scan_num(const char *);
extern struct unit_number n_unit_probe(const char *, struct unit_info *);
extern int get_part_num(const char *, const char *);

#ifndef HAVE_STRCASECMP
extern int strcasecmp(const char *s, const char *t);
#endif /* HAVE_STRCASECMP */
#ifndef HAVE_STRNCASECMP
extern int strncasecmp(const char *s, const char *t, int n);
#endif /* HAVE_STRNCASECMP */
#ifndef HAVE_STRDUP
extern char *strdup(const char *s);
#endif /* HAVE_STRDUP */

/* Date formats */
#ifdef HAVE_TIME_H
#include <time.h>
#endif /* HAVE_TIME_H */
extern char *uk_date(time_t);
extern char *us_date(time_t);
extern char *de_date(time_t);
extern char *deHTML_date(time_t);
extern char *deL1_date(time_t);

/* Basic stuff for reading numbers from files */
extern unsigned long read_ulong(FILE *);
extern long read_long(FILE *);
extern short read_ushort(FILE *);
extern unsigned short read_short(FILE *);

#ifdef __cplusplus
}
#endif

#ifdef __cplusplus

#ifndef N
#define N(x) (sizeof(x)/sizeof(x[0]))
#endif /* N */
#include "tblock.h"
#include "reader.h"

#ifndef __EXCLUDE_READER_CLASSES
extern void null_proc(const tok_seq::tok *, const docfmt *, FILE *, void *);
extern void error_proc(const tok_seq::tok *, const docfmt *, FILE *, void *);
#endif /* __EXCLUDE_READER_CLASSES */
extern tblock *word_wrap(const char *, const char *,const char *, const int,
			 const int=0);
extern tblock *__map_string(const char *, const cmap *, int);
#define map_string(a,b) __map_string(a, b, N(b));
#endif /* __cplusplus */

#endif /* __word2x_lib_h__ */