2 * CDE - Common Desktop Environment
4 * Copyright (c) 1993-2012, The Open Group. All rights reserved.
6 * These libraries and programs are free software; you can
7 * redistribute them and/or modify them under the terms of the GNU
8 * Lesser General Public License as published by the Free Software
9 * Foundation; either version 2 of the License, or (at your option)
12 * These libraries and programs are distributed in the hope that
13 * they will be useful, but WITHOUT ANY WARRANTY; without even the
14 * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15 * PURPOSE. See the GNU Lesser General Public License for more
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with these librararies and programs; if not, write
20 * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
21 * Floor, Boston, MA 02110-1301 USA
23 // $XConsortium: olias_server.cc /main/3 1996/06/11 17:30:16 cde-hal $
24 /* Copyright (c) 1994 FUJITSU LIMITED */
25 /* All Rights Reserved */
28 * Copyright (c) 1992 HAL Computer Systems International, Ltd.
29 * All rights reserved. Unpublished -- rights reserved under
30 * the Copyright Laws of the United States. USE OF A COPYRIGHT
31 * NOTICE IS PRECAUTIONARY ONLY AND DOES NOT IMPLY PUBLICATION
34 * THIS SOFTWARE CONTAINS CONFIDENTIAL INFORMATION AND TRADE
35 * SECRETS OF HAL COMPUTER SYSTEMS INTERNATIONAL, LTD. USE,
36 * DISCLOSURE, OR REPRODUCTION IS PROHIBITED WITHOUT THE
37 * PRIOR EXPRESS WRITTEN PERMISSION OF HAL COMPUTER SYSTEMS
40 * RESTRICTED RIGHTS LEGEND
41 * Use, duplication, or disclosure by the Government is subject
42 * to the restrictions as set forth in subparagraph (c)(l)(ii)
43 * of the Rights in Technical Data and Computer Software clause
44 * at DFARS 252.227-7013.
46 * HAL COMPUTER SYSTEMS INTERNATIONAL, LTD.
52 #include "oliasdb/olias_server.h"
55 void demo_version_check(info_lib* infolibptr)
60 static char* demo_key = "DBzjcy94aK";
61 static char* demo_short_title = "02192ec285a9349ae85e3cc7";
62 static char* demo_long_title = "1e87fe1d9c927e9e24be85e3cc733598faeda88101ecb253";
64 if ( infolibptr == 0 )
68 int i = infolibptr -> first();
73 if ( x && (*(x -> get_set(NODE_SET_POS))) -> count() > 0 )
76 node_smart_ptr n(x, demo_key);
78 if ( strcmp(n.locator(), demo_key) != 0 ||
79 strcmp(n.short_title(), demo_short_title) != 0 ||
80 strcmp(n.long_title(), demo_long_title) != 0
82 debug(cerr, n.locator());
83 debug(cerr, n.short_title());
84 debug(cerr, n.long_title());
85 throw(demoException(x -> get_base_path(), x -> get_base_name()));
89 infolibptr -> next(i);
95 olias_server::olias_server(
96 Boolean delayed_infolib_init,
97 char* selected_base_name,
100 server(x_info_lib_path)
102 managers::template_mgr -> insert_template(&dlp_template);
103 managers::template_mgr -> insert_template(&doc_template);
104 managers::template_mgr -> insert_template(&graphic_template);
105 managers::template_mgr -> insert_template(&locator_template);
106 managers::template_mgr -> insert_template(&node_template);
107 managers::template_mgr -> insert_template(&toc_template);
108 managers::template_mgr -> insert_template(&mark_template);
109 managers::template_mgr -> insert_template(&pref_template);
110 managers::template_mgr -> insert_template(&stylesheet_template);
112 ///////////////////////////////
114 ///////////////////////////////
116 info_base_set_names = new charPtr[7];
118 info_base_set_names[0] = NODE_SET_NAME;
119 info_base_set_names[1] = TOC_SET_NAME;
120 info_base_set_names[2] = LOCATOR_SET_NAME;
121 info_base_set_names[3] = GRAPHIC_SET_NAME,
122 info_base_set_names[4] = DOC_SET_NAME;
123 info_base_set_names[5] = STYLESHEET_SET_NAME;
124 info_base_set_names[6] = 0;
126 info_base_list_names = new charPtr[2];
127 info_base_list_names[0] = DLP_LIST_NAME;
128 info_base_list_names[1] = 0;
130 if ( delayed_infolib_init == false ) {
131 infolibptr = new info_lib(
132 info_base_set_names, info_base_list_names,
133 info_lib_dir, selected_base_name
137 demo_version_check(infolibptr);
145 olias_server::~olias_server()
149 void olias_server::init_infolib()
151 if ( infolibptr == 0 ) {
152 infolibptr = new info_lib(
153 info_base_set_names, info_base_list_names,
157 demo_version_check(infolibptr);
162 info_base* olias_server::get_infobase(const char *locator_string, enum TestSelector sel)
165 if ( locator_string == 0 )
171 int ind = infolibptr -> first();
175 ib = (*infolibptr)(ind);
178 throw(stringException("null info_base ptr"));
180 try { // since an infobase may not have any graphics, we catch
181 // any exceptions there and try next infobase.
186 locator_smart_ptr loc(ib, locator_string);
188 //fprintf(stderr, "inside-loc-string=%s\n", loc.inside_node_locator_str());
189 //fprintf(stderr, "loc-string=%s\n", locator_string);
190 if ( strcmp( loc.inside_node_locator_str(), locator_string) == 0 ) {
197 graphic_smart_ptr graphic(ib, locator_string);
199 if ( strcmp( graphic.locator(), locator_string) == 0 ) {
206 catch (mmdbException &,e)
211 infolibptr -> next(ind);
217 info_base** olias_server::get_infobases(char **locator_strings, int count, enum TestSelector sel)
219 info_base** ibs = new info_basePtr[count];
220 for ( int i=0; i<count; ibs[i++] = 0 );
224 int ind = infolibptr -> first();
228 ib = (*infolibptr)(ind);
231 throw(stringException("null info_base ptr"));
233 for ( i=0; i<count; i++ ) {
237 if ( locator_strings[i] && ibs[i] == 0 ) {
241 locator_smart_ptr loc(ib, locator_strings[i]);
243 if ( strcmp( loc.inside_node_locator_str(),
244 locator_strings[i]) == 0
252 graphic_smart_ptr graphic(ib, locator_strings[i]);
254 if ( strcmp( graphic.locator(),
255 locator_strings[i]) == 0
264 catch (mmdbException &,e)
270 infolibptr -> next(ind);