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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
|
/*
* bibutils.h
*
* Copyright (c) Chris Putnam 2005-2019
*
* Source code released under GPL version 2
*
*/
#ifndef BIBUTILS_H
#define BIBUTILS_H
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
#include <stdio.h>
#include "bibl.h"
#include "slist.h"
#include "charsets.h"
#include "str_conv.h"
#define BIBL_OK (0)
#define BIBL_ERR_BADINPUT (-1)
#define BIBL_ERR_MEMERR (-2)
#define BIBL_ERR_CANTOPEN (-3)
#define BIBL_FIRSTIN (100)
#define BIBL_MODSIN (BIBL_FIRSTIN)
#define BIBL_BIBTEXIN (BIBL_FIRSTIN+1)
#define BIBL_RISIN (BIBL_FIRSTIN+2)
#define BIBL_ENDNOTEIN (BIBL_FIRSTIN+3)
#define BIBL_COPACIN (BIBL_FIRSTIN+4)
#define BIBL_ISIIN (BIBL_FIRSTIN+5)
#define BIBL_MEDLINEIN (BIBL_FIRSTIN+6)
#define BIBL_ENDNOTEXMLIN (BIBL_FIRSTIN+7)
#define BIBL_BIBLATEXIN (BIBL_FIRSTIN+8)
#define BIBL_EBIIN (BIBL_FIRSTIN+9)
#define BIBL_WORDIN (BIBL_FIRSTIN+10)
#define BIBL_NBIBIN (BIBL_FIRSTIN+11)
#define BIBL_LASTIN (BIBL_FIRSTIN+11)
#define BIBL_FIRSTOUT (200)
#define BIBL_MODSOUT (BIBL_FIRSTOUT)
#define BIBL_BIBTEXOUT (BIBL_FIRSTOUT+1)
#define BIBL_RISOUT (BIBL_FIRSTOUT+2)
#define BIBL_ENDNOTEOUT (BIBL_FIRSTOUT+3)
#define BIBL_ISIOUT (BIBL_FIRSTOUT+4)
#define BIBL_WORD2007OUT (BIBL_FIRSTOUT+5)
#define BIBL_ADSABSOUT (BIBL_FIRSTOUT+6)
#define BIBL_NBIBOUT (BIBL_FIRSTOUT+7)
#define BIBL_LASTOUT (BIBL_FIRSTOUT+7)
#define BIBL_FORMAT_VERBOSE (1)
#define BIBL_FORMAT_BIBOUT_FINALCOMMA (2)
#define BIBL_FORMAT_BIBOUT_SINGLEDASH (4)
#define BIBL_FORMAT_BIBOUT_WHITESPACE (8)
#define BIBL_FORMAT_BIBOUT_BRACKETS (16)
#define BIBL_FORMAT_BIBOUT_UPPERCASE (32)
#define BIBL_FORMAT_BIBOUT_STRICTKEY (64)
#define BIBL_FORMAT_BIBOUT_SHORTTITLE (128)
#define BIBL_FORMAT_BIBOUT_DROPKEY (256)
#define BIBL_FORMAT_MODSOUT_DROPKEY (512)
#define BIBL_RAW_WITHCHARCONVERT (4)
#define BIBL_RAW_WITHMAKEREFID (8)
#define BIBL_CHARSET_UNKNOWN CHARSET_UNKNOWN
#define BIBL_CHARSET_UNICODE CHARSET_UNICODE
#define BIBL_CHARSET_GB18030 CHARSET_GB18030
#define BIBL_CHARSET_DEFAULT CHARSET_DEFAULT
#define BIBL_CHARSET_UTF8_DEFAULT CHARSET_UTF8_DEFAULT
#define BIBL_CHARSET_BOM_DEFAULT CHARSET_BOM_DEFAULT
#define BIBL_SRC_DEFAULT (0) /* value from program default */
#define BIBL_SRC_FILE (1) /* value from file, priority over default */
#define BIBL_SRC_USER (2) /* value from user, priority over file, default */
#define BIBL_XMLOUT_FALSE STR_CONV_XMLOUT_FALSE
#define BIBL_XMLOUT_TRUE STR_CONV_XMLOUT_TRUE
#define BIBL_XMLOUT_ENTITIES STR_CONV_XMLOUT_ENTITIES
typedef unsigned char uchar;
typedef struct param {
int readformat;
int writeformat;
int charsetin;
uchar charsetin_src; /*BIBL_SRC_DEFAULT, BIBL_SRC_FILE, BIBL_SRC_USER*/
uchar latexin;
uchar utf8in;
uchar xmlin;
uchar nosplittitle;
int charsetout;
uchar charsetout_src; /* BIBL_SRC_PROG, BIBL_SRC_USER */
uchar latexout; /* If true, write Latex codes */
uchar utf8out; /* If true, write characters encoded by utf8 */
uchar utf8bom; /* If true, write utf8 byte-order-mark */
uchar xmlout; /* If true, write characters in XML entities */
int format_opts; /* options for specific formats */
int addcount; /* add reference count to reference id */
uchar output_raw;
uchar verbose;
uchar singlerefperfile;
slist asis; /* Names that shouldn't be mangled */
slist corps; /* Names that shouldn't be mangled-MODS corporation type */
char *progname;
int (*readf)(FILE*,char*,int,int*,str*,str*,int*);
int (*processf)(fields*,const char*,const char*,long,struct param*);
int (*cleanf)(bibl*,struct param*);
int (*typef) (fields*,const char*,int,struct param*);
int (*convertf)(fields*,fields*,int,struct param*);
void (*headerf)(FILE*,struct param*);
void (*footerf)(FILE*);
int (*assemblef)(fields*,fields*,struct param*,unsigned long);
int (*writef)(fields*,FILE*,struct param*,unsigned long);
variants *all;
int nall;
} param;
int bibl_initparams( param *p, int readmode, int writemode, char *progname );
void bibl_freeparams( param *p );
int bibl_readasis( param *p, char *filename );
int bibl_addtoasis( param *p, char *entry );
int bibl_readcorps( param *p, char *filename );
int bibl_addtocorps( param *p, char *entry );
int bibl_read( bibl *b, FILE *fp, char *filename, param *p );
int bibl_write( bibl *b, FILE *fp, param *p );
void bibl_reporterr( int err );
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif
|