From c0c85097014e5b007075ab71d9b5bee412e28dd5 Mon Sep 17 00:00:00 2001 From: Adam Dickmeiss Date: Fri, 5 Sep 1997 15:29:57 +0000 Subject: [PATCH] Changed prototype for chr_map_input - added const. Added support for C++, headers uses extern "C" for public definitions. --- CHANGELOG | 5 ++++ dfa/dfa.c | 19 ++++++++++----- dfa/dfap.h | 10 +++++--- dict/lookgrep.c | 9 +++++-- include/bfile.h | 16 ++++++++++-- include/bset.h | 16 ++++++++++-- include/charmap.h | 17 +++++++++++-- include/dfa.h | 19 ++++++++++++--- include/dict.h | 19 ++++++++++++--- include/isam.h | 16 ++++++++++-- include/isamc.h | 16 ++++++++++-- include/mfile.h | 13 +++++++++- include/recctrl.h | 27 +++++++++++++++++--- include/res.h | 17 +++++++++++-- include/rsbool.h | 16 ++++++++++-- include/rset.h | 16 ++++++++++-- include/rsisam.h | 16 ++++++++++-- include/rsisamc.h | 16 ++++++++++-- include/rsm_or.h | 16 ++++++++++-- include/rsnull.h | 16 ++++++++++-- include/rsrel.h | 16 ++++++++++-- include/rstemp.h | 16 ++++++++++-- include/set.h | 16 ++++++++++-- include/str.h | 14 ++++++++++- include/zebrautl.h | 8 ++++-- index/attribute.c | 15 +++++++----- index/index.h | 8 ++++-- index/zrpn.c | 47 ++++++++++++++++++++--------------- isam/memory.h | 15 +++++++++++- isam/physical.h | 15 +++++++++++- recctrl/recgrs.c | 21 ++++++++++------ util/charmap.c | 69 ++++++++++++++-------------------------------------- 32 files changed, 431 insertions(+), 144 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 48c0ab1..74a063c 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,8 @@ +Added support for C++, headers uses extern "C" for public definitions. + +New filter grs.marc. that reads MARC records in the ISO2709 +format. refers to the abstract syntax. + Bug fix: The show records facility (-s) only displayed information for the first record in a file (and not for every record in the file). diff --git a/dfa/dfa.c b/dfa/dfa.c index 199ebea..945adad 100644 --- a/dfa/dfa.c +++ b/dfa/dfa.c @@ -1,10 +1,14 @@ /* - * Copyright (C) 1994-1996, Index Data I/S + * Copyright (C) 1994-1997, Index Data I/S * All rights reserved. * Sebastian Hammer, Adam Dickmeiss * * $Log: dfa.c,v $ - * Revision 1.15 1997-02-10 10:19:20 adam + * Revision 1.16 1997-09-05 15:29:57 adam + * Changed prototype for chr_map_input - added const. + * Added support for C++, headers uses extern "C" for public definitions. + * + * Revision 1.15 1997/02/10 10:19:20 adam * Added facility for open character sets, eg [a-]. * * Revision 1.14 1996/10/29 13:57:22 adam @@ -418,7 +422,8 @@ static int read_charset (void) break; if (parse_info->cmap) { - char **mapto, mapfrom[2]; + const char **mapto; + char mapfrom[2]; const char *mcp = mapfrom; mapfrom[0] = ch0; mapto = (*parse_info->cmap)(&mcp, 1); @@ -447,7 +452,8 @@ static int read_charset (void) #endif if (!open_range && parse_info->cmap) { - char **mapto, mapfrom[2]; + const char **mapto; + char mapfrom[2]; const char *mcp = mapfrom; mapfrom[0] = ch1; mapto = (*parse_info->cmap) (&mcp, 1); @@ -474,7 +480,7 @@ static int read_charset (void) static int map_l_char (void) { - char **mapto; + const char **mapto; const char *cp0 = (const char *) (expr_ptr-1); int i = 0, len = strlen(cp0); @@ -1101,7 +1107,8 @@ struct DFA *dfa_init (void) return dfa; } -void dfa_set_cmap (struct DFA *dfa, char **(*cmap)(const char **from, int len)) +void dfa_set_cmap (struct DFA *dfa, + const char **(*cmap)(const char **from, int len)) { dfa->parse_info->cmap = cmap; } diff --git a/dfa/dfap.h b/dfa/dfap.h index 6265962..07051bb 100644 --- a/dfa/dfap.h +++ b/dfa/dfap.h @@ -1,10 +1,14 @@ /* - * Copyright (C) 1994, Index Data I/S + * Copyright (C) 1994-1997, Index Data I/S * All rights reserved. * Sebastian Hammer, Adam Dickmeiss * * $Log: dfap.h,v $ - * Revision 1.4 1996-06-04 10:20:03 adam + * Revision 1.5 1997-09-05 15:29:58 adam + * Changed prototype for chr_map_input - added const. + * Added support for C++, headers uses extern "C" for public definitions. + * + * Revision 1.4 1996/06/04 10:20:03 adam * Added support for character mapping. * * Revision 1.3 1996/01/08 09:09:19 adam @@ -38,7 +42,7 @@ struct DFA_parse { struct Tblock *end; /* end block of Tnodes */ int *charMap; int charMapSize; - char **(*cmap)(const char **from, int len); + const char **(*cmap)(const char **from, int len); }; typedef struct DFA_stateb_ { diff --git a/dict/lookgrep.c b/dict/lookgrep.c index 733be36..13eb8cb 100644 --- a/dict/lookgrep.c +++ b/dict/lookgrep.c @@ -4,7 +4,11 @@ * Sebastian Hammer, Adam Dickmeiss * * $Log: lookgrep.c,v $ - * Revision 1.17 1996-06-04 10:20:06 adam + * Revision 1.18 1997-09-05 15:29:58 adam + * Changed prototype for chr_map_input - added const. + * Added support for C++, headers uses extern "C" for public definitions. + * + * Revision 1.17 1996/06/04 10:20:06 adam * Added support for character mapping. * * Revision 1.16 1996/05/24 14:46:04 adam @@ -451,7 +455,8 @@ int dict_lookup_grep (Dict dict, const char *pattern, int range, void *client, return i; } -void dict_grep_cmap (Dict dict, char **(*cmap)(const char **from, int len)) +void dict_grep_cmap (Dict dict, + const char **(*cmap)(const char **from, int len)) { dict->grep_cmap = cmap; } diff --git a/include/bfile.h b/include/bfile.h index 101a4ac..8618b77 100644 --- a/include/bfile.h +++ b/include/bfile.h @@ -1,10 +1,14 @@ /* - * Copyright (C) 1994-1995, Index Data I/S + * Copyright (C) 1994-1997, Index Data I/S * All rights reserved. * Sebastian Hammer, Adam Dickmeiss * * $Log: bfile.h,v $ - * Revision 1.13 1996-10-29 13:43:07 adam + * Revision 1.14 1997-09-05 15:29:58 adam + * Changed prototype for chr_map_input - added const. + * Added support for C++, headers uses extern "C" for public definitions. + * + * Revision 1.13 1996/10/29 13:43:07 adam * Added a few comments. * * Revision 1.12 1996/03/26 16:00:44 adam @@ -45,6 +49,10 @@ #include +#ifdef __cplusplus +extern "C" { +#endif + #define bf_blocksize(bf) mf_blocksize(bf->mf) typedef struct BFile_struct @@ -93,4 +101,8 @@ void bf_commitExec (void); /* bf_commitClean: cleans commit files, etc */ void bf_commitClean (void); +#ifdef __cplusplus +} +#endif + #endif diff --git a/include/bset.h b/include/bset.h index 8c9966c..f61d4b5 100644 --- a/include/bset.h +++ b/include/bset.h @@ -1,16 +1,24 @@ /* - * Copyright (C) 1994, Index Data I/S + * Copyright (C) 1994-1997, Index Data I/S * All rights reserved. * Sebastian Hammer, Adam Dickmeiss * * $Log: bset.h,v $ - * Revision 1.1 1994-09-26 10:17:42 adam + * Revision 1.2 1997-09-05 15:29:59 adam + * Changed prototype for chr_map_input - added const. + * Added support for C++, headers uses extern "C" for public definitions. + * + * Revision 1.1 1994/09/26 10:17:42 adam * Dfa-module header files. * */ #ifndef BSET_H #define BSET_H +#ifdef __cplusplus +extern "C" { +#endif + typedef unsigned short BSetWord; typedef BSetWord *BSet; @@ -41,4 +49,8 @@ unsigned hash_BSet (BSetHandle *sh, BSet src); int eq_BSet (BSetHandle *sh, BSet dst, BSet src); void pr_charBSet (BSetHandle *sh, BSet src, void (*f)(int)); +#ifdef __cplusplus +} +#endif + #endif diff --git a/include/charmap.h b/include/charmap.h index a4b08d5..b653e97 100644 --- a/include/charmap.h +++ b/include/charmap.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 1995, Index Data. + * Copyright (c) 1995-1997, Index Data. * * All rights reserved. * @@ -35,11 +35,20 @@ * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. * + * $Log: charmap.h,v $ + * Revision 1.3 1997-09-05 15:29:59 adam + * Changed prototype for chr_map_input - added const. + * Added support for C++, headers uses extern "C" for public definitions. + * */ #ifndef CHARMAP_H #define CHARMAP_H +#ifdef __cplusplus +extern "C" { +#endif + extern const char *CHR_UNKNOWN; extern const char *CHR_SPACE; extern const char *CHR_BASE; @@ -58,6 +67,10 @@ typedef struct chrmaptab chrmaptab *chr_read_maptab(const char *tabpath, const char *name); int chr_map_chrs(chr_t_entry *t, char **from, int len, int *read, char **to, int max); -char **chr_map_input(chr_t_entry *t, char **from, int len); +const char **chr_map_input(chr_t_entry *t, const char **from, int len); + +#ifdef __cplusplus +} +#endif #endif diff --git a/include/dfa.h b/include/dfa.h index d4a4a44..0d59afa 100644 --- a/include/dfa.h +++ b/include/dfa.h @@ -1,10 +1,14 @@ /* - * Copyright (C) 1994-1996, Index Data I/S + * Copyright (C) 1994-1997, Index Data I/S * All rights reserved. * Sebastian Hammer, Adam Dickmeiss * * $Log: dfa.h,v $ - * Revision 1.6 1996-06-04 10:20:10 adam + * Revision 1.7 1997-09-05 15:29:59 adam + * Changed prototype for chr_map_input - added const. + * Added support for C++, headers uses extern "C" for public definitions. + * + * Revision 1.6 1996/06/04 10:20:10 adam * Added support for character mapping. * * Revision 1.5 1996/01/08 09:09:48 adam @@ -31,6 +35,10 @@ #include #include +#ifdef __cplusplus +extern "C" { +#endif + struct DFA_tran { unsigned char ch[2]; /* transition on ch[0] <= c <= ch[1] to */ unsigned short to; /* this state */ @@ -63,7 +71,7 @@ struct DFA { struct DFA *dfa_init (void); void dfa_set_cmap (struct DFA *dfa, - char **(*cmap)(const char **from, int len)); + const char **(*cmap)(const char **from, int len)); int dfa_parse (struct DFA *, const char **); void dfa_mkstate (struct DFA *); void dfa_delete (struct DFA **); @@ -99,4 +107,9 @@ extern unsigned short #define DFA_ERR_SYNTAX 1 #define DFA_ERR_LP 2 #define DFA_ERR_RP 3 + +#ifdef __cplusplus +} +#endif + #endif diff --git a/include/dict.h b/include/dict.h index 6367d94..0b94ffd 100644 --- a/include/dict.h +++ b/include/dict.h @@ -1,10 +1,14 @@ /* - * Copyright (C) 1994-1996, Index Data I/S + * Copyright (C) 1994-1997, Index Data I/S * All rights reserved. * Sebastian Hammer, Adam Dickmeiss * * $Log: dict.h,v $ - * Revision 1.23 1996-10-29 13:45:33 adam + * Revision 1.24 1997-09-05 15:30:00 adam + * Changed prototype for chr_map_input - added const. + * Added support for C++, headers uses extern "C" for public definitions. + * + * Revision 1.23 1996/10/29 13:45:33 adam * Changed definition of DICT_DEFAULT_PAGESIZE. * * Revision 1.22 1996/06/04 10:20:10 adam @@ -89,6 +93,10 @@ #include #include +#ifdef __cplusplus +extern "C" { +#endif + typedef unsigned Dict_ptr; typedef unsigned char Dict_char; @@ -128,7 +136,7 @@ typedef struct Dict_file_struct typedef struct Dict_struct { int rw; Dict_BFile dbf; - char **(*grep_cmap)(const char **from, int len); + const char **(*grep_cmap)(const char **from, int len); struct Dict_head head; } *Dict; @@ -162,7 +170,7 @@ int dict_scan (Dict dict, char *str, void *client)); void dict_grep_cmap (Dict dict, - char **(*cmap)(const char **from, int len)); + const char **(*cmap)(const char **from, int len)); #define DICT_EOS 0 @@ -186,6 +194,9 @@ void dict_grep_cmap (Dict dict, dir[0..nodir-1] ptr,info,string */ +#ifdef __cplusplus +} +#endif #endif diff --git a/include/isam.h b/include/isam.h index 2a7df4a..fc4ebb9 100644 --- a/include/isam.h +++ b/include/isam.h @@ -1,10 +1,14 @@ /* - * Copyright (C) 1994, Index Data I/S + * Copyright (C) 1994-1997, Index Data I/S * All rights reserved. * Sebastian Hammer, Adam Dickmeiss * * $Log: isam.h,v $ - * Revision 1.11 1996-10-29 13:43:44 adam + * Revision 1.12 1997-09-05 15:30:00 adam + * Changed prototype for chr_map_input - added const. + * Added support for C++, headers uses extern "C" for public definitions. + * + * Revision 1.11 1996/10/29 13:43:44 adam * Removed definition of SYSNO. * * Revision 1.10 1995/09/06 16:10:57 adam @@ -47,6 +51,10 @@ #include "../isam/memory.h" #include "../isam/physical.h" +#ifdef __cplusplus +extern "C" { +#endif + #define IS_MAX_BLOCKTYPES 4 #define IS_MAX_RECORD 512 #define IS_DEF_REPACK_PERCENT "30" /* how much relative change before repack */ @@ -133,4 +141,8 @@ void is_rewind(ISPT ip); ISAM_P is_merge(ISAM is, ISAM_P pos, int num, char *data); +#ifdef __cplusplus +} +#endif + #endif diff --git a/include/isamc.h b/include/isamc.h index c6d485e..b68b0d6 100644 --- a/include/isamc.h +++ b/include/isamc.h @@ -1,10 +1,14 @@ /* - * Copyright (c) 1995-1996, Index Data. + * Copyright (c) 1995-1997, Index Data. * See the file LICENSE for details. * Sebastian Hammer, Adam Dickmeiss * * $Log: isamc.h,v $ - * Revision 1.4 1996-11-08 11:08:01 adam + * Revision 1.5 1997-09-05 15:30:00 adam + * Changed prototype for chr_map_input - added const. + * Added support for C++, headers uses extern "C" for public definitions. + * + * Revision 1.4 1996/11/08 11:08:01 adam * New internal release. * * Revision 1.3 1996/11/01 13:35:03 adam @@ -22,6 +26,10 @@ #ifndef ISAMC_H #define ISAMC_H +#ifdef __cplusplus +extern "C" { +#endif + typedef struct ISAMC_s *ISAMC; typedef int ISAMC_P; typedef struct ISAMC_PP_s *ISAMC_PP; @@ -68,4 +76,8 @@ int isc_pp_num (ISAMC_PP pp); #define isc_type(x) ((x) & 7) #define isc_block(x) ((x) >> 3) +#ifdef __cplusplus +} +#endif + #endif diff --git a/include/mfile.h b/include/mfile.h index cc34f9e..ee6e6d5 100644 --- a/include/mfile.h +++ b/include/mfile.h @@ -4,7 +4,11 @@ * Sebastian Hammer, Adam Dickmeiss * * $Log: mfile.h,v $ - * Revision 1.6 1996-10-29 13:46:10 adam + * Revision 1.7 1997-09-05 15:30:01 adam + * Changed prototype for chr_map_input - added const. + * Added support for C++, headers uses extern "C" for public definitions. + * + * Revision 1.6 1996/10/29 13:46:10 adam * Removed obsolete headers alexpath, alexutil. Created zebrautl.h as * a replacement. * @@ -35,6 +39,10 @@ #define FILENAME_MAX MAXPATHLEN #endif +#ifdef __cplusplus +extern "C" { +#endif + #define MF_MIN_BLOCKS_CREAT 1 /* minimum free blocks in new dir */ #define MF_DEFAULT_AREA "register" /* Use if no mf_init */ #define MF_MAX_PARTS 28 /* max # of part-files per metafile */ @@ -125,5 +133,8 @@ int mf_unlink(MFile mf); * Unlink the file by name, rather than MFile-handle. */ int mf_unlink_name(MFile_area, const char *name); +#ifdef __cplusplus +} +#endif #endif diff --git a/include/recctrl.h b/include/recctrl.h index 13879d4..da9faf8 100644 --- a/include/recctrl.h +++ b/include/recctrl.h @@ -1,10 +1,14 @@ /* - * Copyright (C) 1994-1996, Index Data I/S + * Copyright (C) 1994-1997, Index Data I/S * All rights reserved. * Sebastian Hammer, Adam Dickmeiss * * $Log: recctrl.h,v $ - * Revision 1.18 1997-09-04 13:56:15 adam + * Revision 1.19 1997-09-05 15:30:02 adam + * Changed prototype for chr_map_input - added const. + * Added support for C++, headers uses extern "C" for public definitions. + * + * Revision 1.18 1997/09/04 13:56:15 adam * Added new filter grs.marc. where refers to * abstract syntax. New method tellf in extract/retrieve control * block. @@ -74,15 +78,28 @@ #include #include +#ifdef __cplusplus +extern "C" { +#endif + +typedef enum { + Word_String, + Word_Phrase, + Word_Numeric +} RecWordType; + /* single word entity */ typedef struct { int attrSet; int attrUse; + RecWordType which; +#if 0 enum { Word_String, Word_Phrase, Word_Numeric } which; +#endif union { char *string; int numeric; @@ -101,7 +118,7 @@ struct recExtractCtrl { char *subType; void (*init)(RecWord *p); void (*add)(const RecWord *p); - char **(*map_chrs_input)(char **from, int len); + const char **(*map_chrs_input)(const char **from, int len); int flagShowRecords; }; @@ -137,4 +154,8 @@ typedef struct recType RecType recType_byName (const char *name, char *subType); +#ifdef __cplusplus +} +#endif + #endif diff --git a/include/res.h b/include/res.h index d742fa7..0836dae 100644 --- a/include/res.h +++ b/include/res.h @@ -1,10 +1,14 @@ /* - * Copyright (C) 1994, Index Data I/S + * Copyright (C) 1994-1997, Index Data I/S * All rights reserved. * Sebastian Hammer, Adam Dickmeiss * * $Log: res.h,v $ - * Revision 1.6 1996-10-29 13:44:12 adam + * Revision 1.7 1997-09-05 15:30:02 adam + * Changed prototype for chr_map_input - added const. + * Added support for C++, headers uses extern "C" for public definitions. + * + * Revision 1.6 1996/10/29 13:44:12 adam * Added res_get_match. * * Revision 1.5 1994/09/16 14:37:46 quinn @@ -24,6 +28,10 @@ #ifndef RES_H #define RES_H +#ifdef __cplusplus +extern "C" { +#endif + struct res_entry { char *name; char *value; @@ -45,4 +53,9 @@ void res_put (Res r, const char *name, const char *value); void res_trav (Res r, const char *prefix, void (*f)(const char *name, const char *value)); int res_write (Res r); + +#ifdef __cplusplus +} +#endif + #endif diff --git a/include/rsbool.h b/include/rsbool.h index e3285d2..35ac8bc 100644 --- a/include/rsbool.h +++ b/include/rsbool.h @@ -1,10 +1,14 @@ /* - * Copyright (C) 1994-1995, Index Data I/S + * Copyright (C) 1994-1997, Index Data I/S * All rights reserved. * Sebastian Hammer, Adam Dickmeiss * * $Log: rsbool.h,v $ - * Revision 1.4 1995-12-11 09:07:53 adam + * Revision 1.5 1997-09-05 15:30:02 adam + * Changed prototype for chr_map_input - added const. + * Added support for C++, headers uses extern "C" for public definitions. + * + * Revision 1.4 1995/12/11 09:07:53 adam * New rset member 'flag', that holds various flags about a result set - * currently 'volatile' (set is register dependent) and 'ranked' (set is * ranked). @@ -29,6 +33,10 @@ #include +#ifdef __cplusplus +extern "C" { +#endif + extern const rset_control *rset_kind_and; extern const rset_control *rset_kind_or; extern const rset_control *rset_kind_not; @@ -45,4 +53,8 @@ typedef struct rset_bool_parms int (*cmp)(const void *p1, const void *p2); } rset_bool_parms; +#ifdef __cplusplus +} +#endif + #endif diff --git a/include/rset.h b/include/rset.h index e6bef93..2cfb23d 100644 --- a/include/rset.h +++ b/include/rset.h @@ -1,10 +1,14 @@ /* - * Copyright (C) 1994-1995, Index Data I/S + * Copyright (C) 1994-1997, Index Data I/S * All rights reserved. * Sebastian Hammer, Adam Dickmeiss * * $Log: rset.h,v $ - * Revision 1.11 1995-12-11 09:07:53 adam + * Revision 1.12 1997-09-05 15:30:03 adam + * Changed prototype for chr_map_input - added const. + * Added support for C++, headers uses extern "C" for public definitions. + * + * Revision 1.11 1995/12/11 09:07:53 adam * New rset member 'flag', that holds various flags about a result set - * currently 'volatile' (set is register dependent) and 'ranked' (set is * ranked). @@ -53,6 +57,9 @@ #include +#ifdef __cplusplus +extern "C" { +#endif typedef void *RSFD; typedef struct rset *RSET; @@ -118,4 +125,9 @@ void rset_delete(RSET rs); #define rset_is_volatile(rs) ((rs)->flags & RSET_FLAG_VOLATILE) #define rset_is_ranked(rs) ((rs)->flags & RSET_FLAG_RANKED) + +#ifdef __cplusplus +} +#endif + #endif diff --git a/include/rsisam.h b/include/rsisam.h index 0e74f86..ee47552 100644 --- a/include/rsisam.h +++ b/include/rsisam.h @@ -1,10 +1,14 @@ /* - * Copyright (C) 1994, Index Data I/S + * Copyright (C) 1994-1997, Index Data I/S * All rights reserved. * Sebastian Hammer, Adam Dickmeiss * * $Log: rsisam.h,v $ - * Revision 1.2 1995-09-04 09:09:53 adam + * Revision 1.3 1997-09-05 15:30:04 adam + * Changed prototype for chr_map_input - added const. + * Added support for C++, headers uses extern "C" for public definitions. + * + * Revision 1.2 1995/09/04 09:09:53 adam * String arg in dict lookup is const. * Minor changes. * @@ -19,6 +23,10 @@ #include #include +#ifdef __cplusplus +extern "C" { +#endif + extern const rset_control *rset_kind_isam; typedef struct rset_isam_parms @@ -27,4 +35,8 @@ typedef struct rset_isam_parms ISAM_P pos; } rset_isam_parms; +#ifdef __cplusplus +} +#endif + #endif diff --git a/include/rsisamc.h b/include/rsisamc.h index 1544f16..5b9d33b 100644 --- a/include/rsisamc.h +++ b/include/rsisamc.h @@ -1,10 +1,14 @@ /* - * Copyright (C) 1996, Index Data I/S + * Copyright (C) 1996-1997, Index Data I/S * All rights reserved. * Sebastian Hammer, Adam Dickmeiss * * $Log: rsisamc.h,v $ - * Revision 1.1 1996-10-29 13:41:33 adam + * Revision 1.2 1997-09-05 15:30:04 adam + * Changed prototype for chr_map_input - added const. + * Added support for C++, headers uses extern "C" for public definitions. + * + * Revision 1.1 1996/10/29 13:41:33 adam * First use of isamc. * */ @@ -15,6 +19,10 @@ #include #include +#ifdef __cplusplus +extern "C" { +#endif + extern const rset_control *rset_kind_isamc; typedef struct rset_isamc_parms @@ -23,4 +31,8 @@ typedef struct rset_isamc_parms ISAMC_P pos; } rset_isamc_parms; +#ifdef __cplusplus +} +#endif + #endif diff --git a/include/rsm_or.h b/include/rsm_or.h index 9de2b75..6007df4 100644 --- a/include/rsm_or.h +++ b/include/rsm_or.h @@ -1,10 +1,14 @@ /* - * Copyright (C) 1994-1996, Index Data I/S + * Copyright (C) 1994-1997, Index Data I/S * All rights reserved. * Sebastian Hammer, Adam Dickmeiss * * $Log: rsm_or.h,v $ - * Revision 1.2 1996-12-23 15:29:54 adam + * Revision 1.3 1997-09-05 15:30:04 adam + * Changed prototype for chr_map_input - added const. + * Added support for C++, headers uses extern "C" for public definitions. + * + * Revision 1.2 1996/12/23 15:29:54 adam * More work on truncation algorithm. * * Revision 1.1 1996/12/20 11:06:45 adam @@ -18,6 +22,10 @@ #include +#ifdef __cplusplus +extern "C" { +#endif + extern const rset_control *rset_kind_m_or; typedef struct rset_m_or_parms @@ -32,4 +40,8 @@ typedef struct rset_m_or_parms int no_save_positions; } rset_m_or_parms; +#ifdef __cplusplus +} +#endif + #endif diff --git a/include/rsnull.h b/include/rsnull.h index ff0a322..e4ac4c3 100644 --- a/include/rsnull.h +++ b/include/rsnull.h @@ -1,10 +1,14 @@ /* - * Copyright (C) 1994-1995, Index Data I/S + * Copyright (C) 1994-1997, Index Data I/S * All rights reserved. * Sebastian Hammer, Adam Dickmeiss * * $Log: rsnull.h,v $ - * Revision 1.1 1995-09-06 10:36:16 adam + * Revision 1.2 1997-09-05 15:30:05 adam + * Changed prototype for chr_map_input - added const. + * Added support for C++, headers uses extern "C" for public definitions. + * + * Revision 1.1 1995/09/06 10:36:16 adam * Null set implemented. * */ @@ -14,6 +18,14 @@ #include +#ifdef __cplusplus +extern "C" { +#endif + extern const rset_control *rset_kind_null; +#ifdef __cplusplus +} +#endif + #endif diff --git a/include/rsrel.h b/include/rsrel.h index 0323782..8188a5f 100644 --- a/include/rsrel.h +++ b/include/rsrel.h @@ -1,10 +1,14 @@ /* - * Copyright (C) 1994-1995, Index Data I/S + * Copyright (C) 1994-1997, Index Data I/S * All rights reserved. * Sebastian Hammer, Adam Dickmeiss * * $Log: rsrel.h,v $ - * Revision 1.3 1996-11-08 11:08:02 adam + * Revision 1.4 1997-09-05 15:30:05 adam + * Changed prototype for chr_map_input - added const. + * Added support for C++, headers uses extern "C" for public definitions. + * + * Revision 1.3 1996/11/08 11:08:02 adam * New internal release. * * Revision 1.2 1996/06/11 10:53:16 quinn @@ -20,6 +24,10 @@ #include +#ifdef __cplusplus +extern "C" { +#endif + extern const rset_control *rset_kind_relevance; typedef struct rset_relevance_parms @@ -37,4 +45,8 @@ typedef struct rset_relevance_parms int *term_no; } rset_relevance_parms; +#ifdef __cplusplus +} +#endif + #endif diff --git a/include/rstemp.h b/include/rstemp.h index 6fffa85..2ba086d 100644 --- a/include/rstemp.h +++ b/include/rstemp.h @@ -1,10 +1,14 @@ /* - * Copyright (C) 1994, Index Data I/S + * Copyright (C) 1994-1997, Index Data I/S * All rights reserved. * Sebastian Hammer, Adam Dickmeiss * * $Log: rstemp.h,v $ - * Revision 1.2 1995-09-04 15:20:13 adam + * Revision 1.3 1997-09-05 15:30:05 adam + * Changed prototype for chr_map_input - added const. + * Added support for C++, headers uses extern "C" for public definitions. + * + * Revision 1.2 1995/09/04 15:20:13 adam * More work on temp sets. is_open member removed. * * Revision 1.1 1994/11/04 13:21:23 quinn @@ -17,6 +21,10 @@ #include +#ifdef __cplusplus +extern "C" { +#endif + extern const rset_control *rset_kind_temp; typedef struct rset_temp_parms @@ -24,4 +32,8 @@ typedef struct rset_temp_parms int key_size; } rset_temp_parms; +#ifdef __cplusplus +} +#endif + #endif diff --git a/include/set.h b/include/set.h index ed31c8f..cee6618 100644 --- a/include/set.h +++ b/include/set.h @@ -1,16 +1,24 @@ /* - * Copyright (C) 1994, Index Data I/S + * Copyright (C) 1994-1997, Index Data I/S * All rights reserved. * Sebastian Hammer, Adam Dickmeiss * * $Log: set.h,v $ - * Revision 1.1 1994-09-26 10:17:44 adam + * Revision 1.2 1997-09-05 15:30:05 adam + * Changed prototype for chr_map_input - added const. + * Added support for C++, headers uses extern "C" for public definitions. + * + * Revision 1.1 1994/09/26 10:17:44 adam * Dfa-module header files. * */ #ifndef SET_H #define SET_H +#ifdef __cplusplus +extern "C" { +#endif + typedef struct SetElement_ { struct SetElement_ *next; int value; @@ -36,5 +44,9 @@ void pr_Set (SetType st, Set s); unsigned hash_Set (SetType st, Set s); int eq_Set (SetType s, Set s1, Set s2); +#ifdef __cplusplus +} +#endif + #endif diff --git a/include/str.h b/include/str.h index 38c92cb..b89bd52 100644 --- a/include/str.h +++ b/include/str.h @@ -4,7 +4,11 @@ * Sebastian Hammer, Adam Dickmeiss * * $Log: str.h,v $ - * Revision 1.2 1994-10-20 17:36:06 quinn + * Revision 1.3 1997-09-05 15:30:06 adam + * Changed prototype for chr_map_input - added const. + * Added support for C++, headers uses extern "C" for public definitions. + * + * Revision 1.2 1994/10/20 17:36:06 quinn * Minimal * * Revision 1.1 1994/10/20 13:46:36 quinn @@ -15,6 +19,10 @@ #ifndef STR_H #define STR_H +#ifdef __cplusplus +extern "C" { +#endif + typedef struct str_index { int size; @@ -33,4 +41,8 @@ void str_close(STRINGS st); char *str(STRINGS st, int num); char *strf(STRINGS st, int num, ...); +#ifdef __cplusplus +} +#endif + #endif diff --git a/include/zebrautl.h b/include/zebrautl.h index 82e6fe7..c18c9f1 100644 --- a/include/zebrautl.h +++ b/include/zebrautl.h @@ -1,10 +1,14 @@ /* - * Copyright (C) 1995-1996, Index Data I/S + * Copyright (C) 1995-1997, Index Data I/S * All rights reserved. * Sebastian Hammer, Adam Dickmeiss * * $Log: zebrautl.h,v $ - * Revision 1.1 1996-10-29 13:46:12 adam + * Revision 1.2 1997-09-05 15:30:06 adam + * Changed prototype for chr_map_input - added const. + * Added support for C++, headers uses extern "C" for public definitions. + * + * Revision 1.1 1996/10/29 13:46:12 adam * Removed obsolete headers alexpath, alexutil. Created zebrautl.h as * a replacement. * diff --git a/index/attribute.c b/index/attribute.c index a5cf209..78af3c1 100644 --- a/index/attribute.c +++ b/index/attribute.c @@ -4,7 +4,11 @@ * Sebastian Hammer, Adam Dickmeiss * * $Log: attribute.c,v $ - * Revision 1.4 1996-10-29 14:06:48 adam + * Revision 1.5 1997-09-05 15:30:08 adam + * Changed prototype for chr_map_input - added const. + * Added support for C++, headers uses extern "C" for public definitions. + * + * Revision 1.4 1996/10/29 14:06:48 adam * Include zebrautl.h instead of alexutil.h. * * Revision 1.3 1996/05/09 07:28:54 quinn @@ -32,16 +36,15 @@ static data1_attset *registered_sets = 0; static void att_loadset(const char *n, const char *name) { - data1_attset *new; + data1_attset *cnew; - if (!(new = data1_read_attset((char*) name))) + if (!(cnew = data1_read_attset((char*) name))) { logf(LOG_WARN|LOG_ERRNO, "%s", name); return; } - new->next = registered_sets; - registered_sets = new; - return; + cnew->next = registered_sets; + registered_sets = cnew; } static void load_atts() diff --git a/index/index.h b/index/index.h index a82f719..9f3e8bf 100644 --- a/index/index.h +++ b/index/index.h @@ -4,7 +4,11 @@ * Sebastian Hammer, Adam Dickmeiss * * $Log: index.h,v $ - * Revision 1.48 1997-02-12 20:39:45 adam + * Revision 1.49 1997-09-05 15:30:08 adam + * Changed prototype for chr_map_input - added const. + * Added support for C++, headers uses extern "C" for public definitions. + * + * Revision 1.48 1997/02/12 20:39:45 adam * Implemented options -f that limits the log to the first * records. * Changed some log messages also. @@ -289,5 +293,5 @@ int zebraLockNB (int fd, int wr); int zebraUnlock (int fd); void init_charmap(void); -char **map_chrs_input(char **from, int len); +const char **map_chrs_input(const char **from, int len); const char *map_chrs_output(const char **from); diff --git a/index/zrpn.c b/index/zrpn.c index f3b0479..f196a52 100644 --- a/index/zrpn.c +++ b/index/zrpn.c @@ -1,10 +1,14 @@ /* - * Copyright (C) 1994-1996, Index Data I/S + * Copyright (C) 1994-1997, Index Data I/S * All rights reserved. * Sebastian Hammer, Adam Dickmeiss * * $Log: zrpn.c,v $ - * Revision 1.61 1997-02-10 10:21:14 adam + * Revision 1.62 1997-09-05 15:30:09 adam + * Changed prototype for chr_map_input - added const. + * Added support for C++, headers uses extern "C" for public definitions. + * + * Revision 1.61 1997/02/10 10:21:14 adam * Bug fix: in search terms character (^) wasn't observed. * * Revision 1.60 1997/01/31 11:10:34 adam @@ -339,10 +343,10 @@ static int grep_handle (char *name, const char *info, void *p) return 0; } -static int term_pre (char **src, const char *ct1, const char *ct2) +static int term_pre (const char **src, const char *ct1, const char *ct2) { - char *s1, *s0 = *src; - char **map; + const char *s1, *s0 = *src; + const char **map; /* skip white space */ while (*s0) @@ -361,9 +365,10 @@ static int term_pre (char **src, const char *ct1, const char *ct2) return *s0; } -static int term_100 (char **src, char *dst, int space_split) +static int term_100 (const char **src, char *dst, int space_split) { - char *s0, *s1, **map; + const char *s0, *s1; + const char **map; int i = 0; if (!term_pre (src, NULL, NULL)) @@ -387,9 +392,10 @@ static int term_100 (char **src, char *dst, int space_split) return i; } -static int term_101 (char **src, char *dst, int space_split) +static int term_101 (const char **src, char *dst, int space_split) { - char *s0, *s1, **map; + const char *s0, *s1; + const char **map; int i = 0; if (!term_pre (src, "#", "#")) @@ -423,10 +429,11 @@ static int term_101 (char **src, char *dst, int space_split) } -static int term_103 (char **src, char *dst, int *errors, int space_split) +static int term_103 (const char **src, char *dst, int *errors, int space_split) { int i = 0; - char *s0, *s1, **map; + const char *s0, *s1; + const char **map; if (!term_pre (src, "^\\()[].*+?|", "(")) return 0; @@ -462,7 +469,7 @@ static int term_103 (char **src, char *dst, int *errors, int space_split) return i; } -static int term_102 (char **src, char *dst, int space_split) +static int term_102 (const char **src, char *dst, int space_split) { return term_103 (src, dst, NULL, space_split); } @@ -577,7 +584,7 @@ static void gen_regular_rel (char *dst, int val, int islt) } static int relational_term (ZServerInfo *zi, Z_AttributesPlusTerm *zapt, - char **term_sub, + const char **term_sub, char *term_dict, oid_value attributeSet, struct grep_info *grep_info, @@ -642,7 +649,7 @@ static int relational_term (ZServerInfo *zi, Z_AttributesPlusTerm *zapt, } static int field_term (ZServerInfo *zi, Z_AttributesPlusTerm *zapt, - char **term_sub, int regType, + const char **term_sub, int regType, oid_value attributeSet, struct grep_info *grep_info, int num_bases, char **basenames, int space_split) { @@ -653,7 +660,7 @@ static int field_term (ZServerInfo *zi, Z_AttributesPlusTerm *zapt, AttrType use; int use_value; oid_value curAttributeSet = attributeSet; - char *termp; + const char *termp; attr_init (&use, zapt, 1); use_value = attr_find (&use, &curAttributeSet); @@ -800,8 +807,8 @@ static void trans_scan_term (ZServerInfo *zi, Z_AttributesPlusTerm *zapt, char *termz) { Z_Term *term = zapt->term; - char **map; - char *cp = (char*) term->u.general->buf; + const char **map; + const char *cp = (const char *) term->u.general->buf; const char *cp_end = cp + term->u.general->len; const char *src; int i = 0; @@ -833,7 +840,7 @@ static RSET rpn_search_APT_relevance (ZServerInfo *zi, { rset_relevance_parms parms; char termz[IT_MAX_WORD+1]; - char *termp = termz; + const char *termp = termz; struct grep_info grep_info; RSET result; int term_index = 0; @@ -893,7 +900,7 @@ static RSET rpn_search_APT_cphrase (ZServerInfo *zi, char termz[IT_MAX_WORD+1]; struct grep_info grep_info; RSET result; - char *termp = termz; + const char *termp = termz; int r; if (zapt->term->which != Z_Term_general) @@ -1101,7 +1108,7 @@ static RSET rpn_search_APT_phrase (ZServerInfo *zi, int num_bases, char **basenames) { char termz[IT_MAX_WORD+1]; - char *termp = termz; + const char *termp = termz; RSET rset[60], result; int i, r, rset_no = 0; struct grep_info grep_info; diff --git a/isam/memory.h b/isam/memory.h index e1bd1f0..91ae95b 100644 --- a/isam/memory.h +++ b/isam/memory.h @@ -4,7 +4,11 @@ * Sebastian Hammer, Adam Dickmeiss * * $Log: memory.h,v $ - * Revision 1.5 1996-03-11 14:52:25 quinn + * Revision 1.6 1997-09-05 15:30:10 adam + * Changed prototype for chr_map_input - added const. + * Added support for C++, headers uses extern "C" for public definitions. + * + * Revision 1.5 1996/03/11 14:52:25 quinn * Fixed update bug. Repeated insertion in the same area sometimes caused * problems. * @@ -28,6 +32,10 @@ #ifndef MEMORY_H #define MEMORY_H +#ifdef __cplusplus +extern "C" { +#endif + extern int is_mbuf_size[3]; typedef unsigned int ISAM_P; @@ -105,4 +113,9 @@ int is_m_peek_record(is_mtable *tab, void *rec); int is_m_read_full(is_mtable *tab, is_mblock *mblock); int is_m_num_records(is_mtable *tab); +#ifdef __cplusplus +} +#endif + + #endif diff --git a/isam/physical.h b/isam/physical.h index fe0766c..56caf4d 100644 --- a/isam/physical.h +++ b/isam/physical.h @@ -4,7 +4,11 @@ * Sebastian Hammer, Adam Dickmeiss * * $Log: physical.h,v $ - * Revision 1.3 1994-09-26 17:11:32 quinn + * Revision 1.4 1997-09-05 15:30:10 adam + * Changed prototype for chr_map_input - added const. + * Added support for C++, headers uses extern "C" for public definitions. + * + * Revision 1.3 1994/09/26 17:11:32 quinn * Trivial * * Revision 1.2 1994/09/26 17:06:37 quinn @@ -20,6 +24,10 @@ #include "memory.h" +#ifdef __cplusplus +extern "C" { +#endif + void is_p_sync(is_mtable *tab); void is_p_unmap(is_mtable *tab); void is_p_align(is_mtable *tab); @@ -27,4 +35,9 @@ void is_p_remap(is_mtable *tab); int is_p_read_partial(is_mtable *tab, is_mblock *block); int is_p_read_full(is_mtable *tab, is_mblock *block); +#ifdef __cplusplus +} +#endif + + #endif diff --git a/recctrl/recgrs.c b/recctrl/recgrs.c index f23dbb1..3ca02e7 100644 --- a/recctrl/recgrs.c +++ b/recctrl/recgrs.c @@ -1,10 +1,14 @@ /* - * Copyright (C) 1994-1996, Index Data I/S + * Copyright (C) 1994-1997, Index Data I/S * All rights reserved. * Sebastian Hammer, Adam Dickmeiss * * $Log: recgrs.c,v $ - * Revision 1.6 1997-09-04 13:54:40 adam + * Revision 1.7 1997-09-05 15:30:10 adam + * Changed prototype for chr_map_input - added const. + * Added support for C++, headers uses extern "C" for public definitions. + * + * Revision 1.6 1997/09/04 13:54:40 adam * Added MARC filter - type grs.marc. where syntax refers * to abstract syntax. New method tellf in retrieve/extract method. * @@ -160,9 +164,9 @@ static void grs_init(void) static void dumpkeys_word(data1_node *n, struct recExtractCtrl *p, data1_att *att) { - char *b = n->u.data.data; + const char *b = n->u.data.data; int remain; - char **map = 0; + const char **map = 0; remain = n->u.data.len - (b - n->u.data.data); if (remain > 0) @@ -188,7 +192,7 @@ static void dumpkeys_word(data1_node *n, struct recExtractCtrl *p, i = 0; while (map && *map && **map != *CHR_SPACE) { - char *cp = *map; + const char *cp = *map; while (i < GRS_MAX_WORD && *cp) buf[i++] = *(cp++); @@ -214,8 +218,9 @@ static void dumpkeys_word(data1_node *n, struct recExtractCtrl *p, static void dumpkeys_phrase(data1_node *n, struct recExtractCtrl *p, data1_att *att) { - char *b = n->u.data.data; - char buf[GRS_MAX_WORD+1], **map = 0; + const char *b = n->u.data.data; + char buf[GRS_MAX_WORD+1]; + const char **map = 0; RecWord wrd; int i = 0, remain; @@ -240,7 +245,7 @@ static void dumpkeys_phrase(data1_node *n, struct recExtractCtrl *p, buf[i++] = *CHR_SPACE; while (map && *map && **map != *CHR_SPACE) { - char *cp = *map; + const char *cp = *map; if (i >= GRS_MAX_WORD) break; diff --git a/util/charmap.c b/util/charmap.c index 60bc254..8e95b00 100644 --- a/util/charmap.c +++ b/util/charmap.c @@ -1,10 +1,14 @@ /* - * Copyright (C) 1994, Index Data I/S + * Copyright (C) 1996-1997, Index Data I/S * All rights reserved. * Sebastian Hammer, Adam Dickmeiss * * $Log: charmap.c,v $ - * Revision 1.11 1997-09-05 09:52:32 adam + * Revision 1.12 1997-09-05 15:30:11 adam + * Changed prototype for chr_map_input - added const. + * Added support for C++, headers uses extern "C" for public definitions. + * + * Revision 1.11 1997/09/05 09:52:32 adam * Extra argument added to function chr_read_maptab (tab path). * * Revision 1.10 1997/07/01 13:01:08 adam @@ -83,8 +87,8 @@ typedef struct chrwork /* * Add an entry to the character map. */ -static chr_t_entry *set_map_string(chr_t_entry *root, char *from, int len, - char *to) +static chr_t_entry *set_map_string(chr_t_entry *root, const char *from, + int len, char *to) { if (!root) { @@ -143,15 +147,14 @@ int chr_map_chrs(chr_t_entry *t, char **from, int len, int *read, char **to, return i; } -#if 1 -static chr_t_entry *find_entry(chr_t_entry *t, char **from, int len) +static chr_t_entry *find_entry(chr_t_entry *t, const char **from, int len) { chr_t_entry *res; if (len && t->children && t->children[(unsigned char) **from]) { - char *pos = *from; + const char *pos = *from; (*from)++; if ((res = find_entry(t->children[(unsigned char) *pos], @@ -164,9 +167,9 @@ static chr_t_entry *find_entry(chr_t_entry *t, char **from, int len) return t->target ? t : 0; } -char **chr_map_input(chr_t_entry *t, char **from, int len) +const char **chr_map_input(chr_t_entry *t, const char **from, int len) { - static char *buf[2] = {0, 0}; + static const char *buf[2] = {0, 0}; chr_t_entry *res; if (!(res = find_entry(t, from, len))) @@ -175,42 +178,6 @@ char **chr_map_input(chr_t_entry *t, char **from, int len) return buf; } -#else - -char **chr_map_input(chr_t_entry *t, char **from, int len) -{ - static char *buf[2] = {0, 0}, str[2] = {0, 0}; - char *start = *from; - - if (t) - { - while (len && t->children && t->children[(unsigned char) **from]) - { - t = t->children[(unsigned char) **from]; - (*from)++; - len--; - } - buf[0] = (char*) t->target; - } - else /* null mapping */ - { - if (isalnum(**from)) - { - str[0] = **from; - buf[0] = str; - } - else if (isspace(**from)) - buf[0] = (char*) CHR_SPACE; - else - buf[0] = (char*) CHR_UNKNOWN; - } - if (start == *from) - (*from)++; - return buf; - /* return (char*) t->target; */ -} - -#endif static unsigned char prim(char **s) { @@ -245,7 +212,7 @@ static unsigned char prim(char **s) * Callback function. * Add an entry to the value space. */ -static void fun_addentry(char *s, void *data, int num) +static void fun_addentry(const char *s, void *data, int num) { chrmaptab *tab = data; char tmp[2]; @@ -259,7 +226,7 @@ static void fun_addentry(char *s, void *data, int num) * Callback function. * Add a space-entry to the value space. */ -static void fun_addspace(char *s, void *data, int num) +static void fun_addspace(const char *s, void *data, int num) { chrmaptab *tab = data; tab->input = set_map_string(tab->input, s, strlen(s), (char*) CHR_SPACE); @@ -268,10 +235,10 @@ static void fun_addspace(char *s, void *data, int num) /* * Create a string containing the mapped characters provided. */ -static void fun_mkstring(char *s, void *data, int num) +static void fun_mkstring(const char *s, void *data, int num) { chrwork *arg = data; - char **res, *p = s; + const char **res, *p = s; res = chr_map_input(arg->map->input, &s, strlen(s)); if (*res == (char*) CHR_UNKNOWN) @@ -283,7 +250,7 @@ static void fun_mkstring(char *s, void *data, int num) /* * Add a map to the string contained in the argument. */ -static void fun_addmap(char *s, void *data, int num) +static void fun_addmap(const char *s, void *data, int num) { chrwork *arg = data; @@ -291,7 +258,7 @@ static void fun_addmap(char *s, void *data, int num) set_map_string(arg->map->input, s, strlen(s), arg->string); } -static int scan_string(char *s, void (*fun)(char *c, void *data, int num), +static int scan_string(char *s, void (*fun)(const char *c, void *data, int num), void *data, int *num) { unsigned char c, str[1024], begin, end, *p; -- 1.7.10.4