1 // This may look like C code, but it is really -*- C++ -*-
2
3 // ------------------------------------------------------------------
4 // The Goldware Library
5 // Copyright (C) 1990-1999 Odinn Sorensen
6 // Copyright (C) 1999-2000 Alex. S. Aganichev
7 // ------------------------------------------------------------------
8 // This library is free software; you can redistribute it and/or
9 // modify it under the terms of the GNU Library General Public
10 // License as published by the Free Software Foundation; either
11 // version 2 of the License, or (at your option) any later version.
12 //
13 // This library is distributed in the hope that it will be useful,
14 // but WITHOUT ANY WARRANTY; without even the implied warranty of
15 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 // Library General Public License for more details.
17 //
18 // You should have received a copy of the GNU Library General Public
19 // License along with this program; if not, write to the Free
20 // Software Foundation, Inc., 59 Temple Place, Suite 330, Boston,
21 // MA 02111-1307, USA
22 // ------------------------------------------------------------------
23 // $Id: gmohuds.cpp,v 1.2 2005/10/07 12:41:11 stas_degteff Exp $
24 // ------------------------------------------------------------------
25 // Hudson/GoldBase messagebase engine.
26 // ------------------------------------------------------------------
27
28 #include <cerrno>
29 #include <gmoprot.h>
30 #include <gmohuds.h>
31
32
33 // ------------------------------------------------------------------
34
35 HudsWide* hudsonwide = NULL;
36 GoldWide* goldbasewide = NULL;
37
38
39 // ------------------------------------------------------------------
40
HudsWideOpen()41 void HudsWideOpen() {
42
43 hudsonwide->open();
44 }
45
46
47 // ------------------------------------------------------------------
48
GoldWideOpen()49 void GoldWideOpen() {
50
51 goldbasewide->open();
52 }
53
54
55 // ------------------------------------------------------------------
56
HudsWideClose()57 void HudsWideClose() {
58
59 hudsonwide->close();
60 }
61
62
63 // ------------------------------------------------------------------
64
GoldWideClose()65 void GoldWideClose() {
66
67 goldbasewide->close();
68 }
69
70
71 // ------------------------------------------------------------------
72
HudsExit()73 void HudsExit() {
74
75 if(hudsonwide)
76 hudsonwide->exit();
77 throw_xrelease(hudsonwide);
78 }
79
80
81 // ------------------------------------------------------------------
82
GoldExit()83 void GoldExit() {
84
85 if(goldbasewide)
86 goldbasewide->exit();
87 throw_xrelease(goldbasewide);
88 }
89
90
91 // ------------------------------------------------------------------
92
HudsInit(const char * path,const char * syspath,int userno,int32_t sizewarn,int ra2usersbbs)93 void HudsInit(const char* path, const char* syspath, int userno, int32_t sizewarn, int ra2usersbbs) {
94
95 // Initialize msgbase-wide data
96 hudsonwide = (HudsWide*)throw_calloc(1, sizeof(HudsWide));
97 hudsonwide->path = path;
98 hudsonwide->syspath = syspath;
99 hudsonwide->userno = userno;
100 hudsonwide->sizewarn = sizewarn;
101 hudsonwide->ra2usersbbs = ra2usersbbs;
102 hudsonwide->init();
103 }
104
105
106 // ------------------------------------------------------------------
107
GoldInit(const char * path,const char * syspath,int userno,int32_t sizewarn,int ra2usersbbs)108 void GoldInit(const char* path, const char* syspath, int userno, int32_t sizewarn, int ra2usersbbs) {
109
110 // Initialize msgbase-wide data
111 goldbasewide = (GoldWide*)throw_calloc(1, sizeof(GoldWide));
112 goldbasewide->path = path;
113 goldbasewide->syspath = syspath;
114 goldbasewide->userno = userno;
115 NW(sizewarn);
116 NW(ra2usersbbs);
117 goldbasewide->init();
118 }
119
120
121 // ------------------------------------------------------------------
122