NetBSD port

This commit is contained in:
Ulrich Wilkens
2014-02-20 19:19:17 +01:00
committed by Jon Trulson
parent a4f9413950
commit 2712d5f787
94 changed files with 2443 additions and 302 deletions

View File

@@ -101,7 +101,7 @@ BookTab::set_tab (UAS_Pointer<UAS_Common> &tab_ptr)
{
f_tab_ptr = tab_ptr;
if (f_tab_ptr != (const int)NULL)
if (f_tab_ptr != (const int)0)
{
UAS_String st = f_tab_ptr->tab_title();
LabelString ((char *) st);
@@ -127,7 +127,7 @@ BookTab::set_tab (UAS_Pointer<UAS_Common> &tab_ptr)
void
BookTab::activate()
{
Xassert (f_tab_ptr != (const int)NULL);
Xassert (f_tab_ptr != (const int)0);
node_mgr().set_preferred_window (f_node_window_agent);
f_tab_ptr->retrieve();
}
@@ -141,7 +141,7 @@ BookTab::activate()
void
BookTab::select_if_same (UAS_Pointer<UAS_Common> &doc_ptr)
{
Xassert (f_tab_ptr != (const int)NULL);
Xassert (f_tab_ptr != (const int)0);
// If this tab points to the Node in question, select the tab,
// otherwise deselect the tab.
if (f_tab_ptr == doc_ptr)

View File

@@ -1224,7 +1224,7 @@ LibraryAgent::add_library(char* newLib, Widget parent)
parent);
}
if (d != (const int)NULL) {
if (d != (const int)0) {
d->retrieve ();
} else {
#ifdef DEBUG
@@ -1243,7 +1243,7 @@ LibraryAgent::add_library(char* newLib, Widget parent)
// but with keyword error.
// report error only if likely from retrieval; others handled already
if( d != (const int)NULL )
if( d != (const int)0 )
{
message_mgr().error_dialog(
(char*)UAS_String(CATGETS(Set_AddLibraryAgent, 4,
@@ -1538,7 +1538,7 @@ void
LibraryAgent::track_to (UAS_Pointer<UAS_Common> &node_ptr)
{
ON_DEBUG (printf ("LibraryAgent::track_to: popped_down = %d, track set = %d, node_ptr = %p\n", f_popped_down, XmToggleButtonGadgetGetState(f_auto_track),(UAS_Common *) node_ptr));
if (f_popped_down || !XmToggleButtonGadgetGetState(f_auto_track) || node_ptr == (const int)NULL)
if (f_popped_down || !XmToggleButtonGadgetGetState(f_auto_track) || node_ptr == (const int)0)
return;
Wait_Cursor bob;
ON_DEBUG (puts ("TRYING to locate document in doc tree!"));
@@ -1556,7 +1556,7 @@ LibraryAgent::track_to (UAS_Pointer<UAS_Common> &node_ptr)
// Trace up to the root.
free_tracking_hierarchy();
while (doc_root != (const int)NULL && !in_subtree)
while (doc_root != (const int)0 && !in_subtree)
{
f_tracking_hierarchy = new TrackingEntry(doc_root, f_tracking_hierarchy);
for (unsigned int i = 0; i < rootList.length(); i ++) {

View File

@@ -1199,12 +1199,12 @@ OutlineListView::activate (WCallback *wcb)
{
UAS_List<UAS_Common> kids =
((TOC_Element *)oe)->toc()->children();
if ( (kids != (const int)NULL)
&& (kids[0] != (const int)NULL)
if ( (kids != (const int)0)
&& (kids[0] != (const int)0)
&& (kids[0]->type() == UAS_BOOKCASE))
{
UAS_List<UAS_Common> bckids = kids[0]->children();
if (! (bckids[0] == (const int)NULL))
if (! (bckids[0] == (const int)0))
{
bckids[0]->retrieve();
}
@@ -1216,7 +1216,7 @@ OutlineListView::activate (WCallback *wcb)
{
UAS_List<UAS_Common> kids =
((TOC_Element *)oe)->toc()->children();
if (! (kids[0] == (const int)NULL))
if (! (kids[0] == (const int)0))
{
kids[0]->retrieve();
}

View File

@@ -1264,13 +1264,13 @@ SearchScopeAgent::generate_component_list()
OutlineElement *oe;
ADD (components, CATGETS(Set_Messages, 22, "Everything"), parts, True);
ADD (parts, CATGETS(Set_Messages, 23, "Titles"), NULL, False);
ADD (parts, CATGETS(Set_Messages, 24, "Body"), NULL, False);
ADD (parts, CATGETS(Set_Messages, 25, "Examples"), NULL, False);
ADD (parts, CATGETS(Set_Messages, 26, "Index"), NULL, False);
ADD (parts, CATGETS(Set_Messages, 27, "Tables"), NULL, False);
ADD (parts, CATGETS(Set_Messages, 23, "Titles"), 0, False);
ADD (parts, CATGETS(Set_Messages, 24, "Body"), 0, False);
ADD (parts, CATGETS(Set_Messages, 25, "Examples"), 0, False);
ADD (parts, CATGETS(Set_Messages, 26, "Index"), 0, False);
ADD (parts, CATGETS(Set_Messages, 27, "Tables"), 0, False);
#ifndef DtinfoClient
ADD (parts, CATGETS(Set_Messages, 28, "Graphics"), NULL, False);
ADD (parts, CATGETS(Set_Messages, 28, "Graphics"), 0, False);
#endif
return (components);

View File

@@ -144,7 +144,7 @@ UrlAgent::document( char *locator,
delete [] buffer;
// if no result, the unique ID was not found in a loaded infolib
if( d == (const int)NULL ) sts = NOT_FOUND ;
if( d == (const int)0 ) sts = NOT_FOUND ;
}
else if( strchr( locator, ':' ) && strchr( locator, '=' ) )
{
@@ -160,7 +160,7 @@ UrlAgent::document( char *locator,
sts = BAD_ARG_FORMAT ;
}
if( d != (const int)NULL )
if( d != (const int)0 )
{
// always use new window to display external requests
if( new_window ) node_mgr().force_new_window() ;
@@ -275,7 +275,7 @@ UrlAgent::print_document(char *locator)
delete [] buffer;
// if no result, the unique ID was not found in a loaded infolib
if( d == (const int)NULL ) sts = NOT_FOUND ;
if( d == (const int)0 ) sts = NOT_FOUND ;
}
else if( strchr( locator, ':' ) && strchr( locator, '=' ) )
{
@@ -294,7 +294,7 @@ UrlAgent::print_document(char *locator)
}
// if we have a setion add it to the print list
if( d != (const int)NULL ) {
if( d != (const int)0 ) {
// Need to put this single node on the print list so that
// reset_ui() can determine the number of nodes being printed

View File

@@ -24,7 +24,7 @@
* Campbell, CA 95008
*
*/
#if defined(SVR4) || defined(hpux) || defined(linux)
#if defined(SVR4) || defined(hpux) || defined(linux) || defined(__NetBSD__)
#include <limits.h>
#else
#include <sys/limits.h>

View File

@@ -237,7 +237,7 @@ LibraryMgr::display (UAS_Pointer<UAS_Common> &toc)
OutlineList *ol = new OutlineList(fObjList.length());
for (i = 0; i < fObjList.length(); i ++) {
ol->append (new TOC_Element (fObjList[i]));
if (toc->parent() == (const int)NULL) {
if (toc->parent() == (const int)0) {
BitHandle handle = ol->get_data_handle();
((OutlineElement *) (*ol)[i])->set_expanded (handle);
ol->free_data_handle (handle);

View File

@@ -276,7 +276,7 @@ ServiceMgr::process_olias_event (Window client,
char *buffer = new char[bufferlen];
snprintf (buffer, bufferlen, "mmdb:LOCATOR=%s", locator);
d = UAS_Common::create (buffer);
if (d != (const int)NULL)
if (d != (const int)0)
{
// (evil hack alert)
g_scroll_to_locator = TRUE;
@@ -296,7 +296,7 @@ ServiceMgr::process_olias_event (Window client,
}
end_try;
if (d != (const int)NULL)
if (d != (const int)0)
{
d->retrieve();
reply_to_client(client, OLIAS_SUCCESS);
@@ -423,7 +423,7 @@ olias_send_event (Widget, OliasEvent *event)
snprintf (buffer, bufferlen, "mmdb:LOCATOR=%s", locator);
d = UAS_Common::create (buffer);
delete [] buffer;
if (d != (const int)NULL)
if (d != (const int)0)
{
// (evil hack alert)
if (locator == NULL)
@@ -446,7 +446,7 @@ olias_send_event (Widget, OliasEvent *event)
d = NULL;
}
end_try;
if (d != (const int)NULL)
if (d != (const int)0)
{
d->retrieve();
return (OLIAS_SUCCESS);

View File

@@ -450,7 +450,7 @@ TtIpcMgr::do_print(Tt_message msg)
// add UAS_Common pointer to list of sections to print
if (d != (const int)NULL)
if (d != (const int)0)
{
print_list->append(d);
}

View File

@@ -132,7 +132,7 @@ UAS_Pointer<UAS_Common> &
Mark_mmdb::doc_ptr()
{
// If the doc_ptr isn't known yet, find it.
if (f_doc_ptr == (const int)NULL)
if (f_doc_ptr == (const int)0)
{
UAS_String url = "mmdb:LOCATOR=";

View File

@@ -246,7 +246,7 @@ UAS_Common::subtree_size()
int tree_size = 1;
for (unsigned int i = 0; i < num_kids; i++) {
if (! (kids[i] == (const int)NULL))
if (! (kids[i] == (const int)0))
tree_size += kids[i]->subtree_size();
}

View File

@@ -56,7 +56,7 @@ DtSR_BookcaseSearchEntry::DtSR_BookcaseSearchEntry(
{
f_dbname = DtSR_SearchEngine::search_engine().db_name(f_dbn);
if (f_dbname == (const int)NULL) {
if (f_dbname == (const int)0) {
#ifdef DEBUG
fprintf(stderr, "(ERROR) could not instantiate DtSR_BookcaseScopeEntry\n");
abort();
@@ -188,7 +188,7 @@ DtSR_BookcaseSearchEntry::_search_zones(UAS_SearchZones& search_zones)
UAS_List<DtSR_BookcaseSearchEntry>&
DtSR_BookcaseSearchEntry::bcases()
{
if (f_bcases == (const int)NULL)
if (f_bcases == (const int)0)
f_bcases = new UAS_List<DtSR_BookcaseSearchEntry>();
return *(UAS_List<DtSR_BookcaseSearchEntry>*)f_bcases;
}

View File

@@ -373,11 +373,11 @@ DtSR_SearchEngine::init(UAS_PtrList<const char> *bcases)
continue;
UAS_Pointer<UAS_Common> obj;
if ((obj = UAS_Factory::create(bookcase_url)) == (int)NULL)
if ((obj = UAS_Factory::create(bookcase_url)) == (int)0)
continue;
UAS_Pointer<UAS_Common> bookcase;
if ((bookcase =
((UAS_Collection*)(UAS_Common *)obj)->root()) == (int)NULL)
((UAS_Collection*)(UAS_Common *)obj)->root()) == (int)0)
continue;
new DtSR_BookcaseSearchEntry(dbn++, bookcase, True);
@@ -478,7 +478,7 @@ resolve_bookid(UAS_Pointer<UAS_Common> &bcase, int serial)
{
UAS_String rval;
if (bcase == (int)NULL || bcase->type() != UAS_BOOKCASE)
if (bcase == (int)0 || bcase->type() != UAS_BOOKCASE)
return rval;
if (serial < 1) // apparently wrong serial number
@@ -642,7 +642,7 @@ DtSR_SearchEngine::search(UAS_String oql, UAS_SearchScope& scope,
UAS_Pointer<UAS_List<UAS_SearchResultsEntry> > res;
if ((res = compress_DtSrResult(DtSr_res, rescount)) == (int)NULL)
if ((res = compress_DtSrResult(DtSr_res, rescount)) == (int)0)
continue;
// book#s specified, apply book-level scope here
@@ -683,7 +683,7 @@ DtSR_SearchEngine::search(UAS_String oql, UAS_SearchScope& scope,
}
for (i = 0; i < (int) res->length(); i++) {
if (res->item(i) == (int)NULL)
if (res->item(i) == (int)0)
res->remove_item(i--);
}
}
@@ -698,23 +698,23 @@ DtSR_SearchEngine::search(UAS_String oql, UAS_SearchScope& scope,
new DtSR_SearchResults(q, n, res, res->length(),
stems, scope.search_zones(), stype);
if (DtSR_result == (int)NULL)
if (DtSR_result == (int)0)
DtSR_result = DtSR_res;
else // merge uas_res into result
DtSR_result->merge(DtSR_res);
}
if (DtSR_result == (int)NULL)
if (DtSR_result == (int)0)
UAS_result = new UAS_SearchResults(new UAS_String(oql),
new UAS_String(scope.name()));
if (UAS_result == (int)NULL) {
assert( DtSR_result != (int)NULL );
if (UAS_result == (int)0) {
assert( DtSR_result != (int)0 );
UAS_result = (UAS_SearchResults*)(DtSR_SearchResults*)DtSR_result;
}
assert( UAS_result != (int)NULL );
assert( UAS_result != (int)0 );
if (current_bc != 0) {
targets.remove(current_bc);
@@ -750,7 +750,7 @@ DtSR_SearchEngine::compress_DtSrResult(DtSrResult*& res, long& count)
char* abstract = iter->abstractp;
UAS_Pointer<UAS_String> id, book, section;
if (DtSR_SearchResultsEntry::
parse_abstract(abstract, id, book, section) == (int)NULL) {
parse_abstract(abstract, id, book, section) == (int)0) {
#ifdef DEBUG
fprintf(stderr, "parse_abstract failed\n");
abort();
@@ -759,7 +759,7 @@ DtSR_SearchEngine::compress_DtSrResult(DtSrResult*& res, long& count)
}
UAS_String Id(*(UAS_String*)id);
UAS_Pointer<DtSR_SearchResultsEntry>& sre = map[Id];
if (sre == (int)NULL) { // not found in map, create one
if (sre == (int)0) { // not found in map, create one
#ifdef DEBUG
cerr << "(DEBUG) " << (char*)Id << ' ' <<
"not found in map" << '\n' << flush;

View File

@@ -102,7 +102,7 @@ DtSR_SearchResults::create_results(int index, int nres)
void
DtSR_SearchResults::merge(UAS_Pointer<DtSR_SearchResults> & res)
{
if (res == (const int)NULL || res->f_ndocs == 0) // nothing to merge
if (res == (const int)0 || res->f_ndocs == 0) // nothing to merge
return;
int i;

View File

@@ -196,7 +196,7 @@ DtSR_SearchResultsEntry::section_in_abstract(char* abstract, const char* id)
UAS_Pointer<UAS_String> section_id, book, section;
if (parse_abstract(abstract, section_id, book, section) == (const int)NULL) {
if (parse_abstract(abstract, section_id, book, section) == (const int)0) {
#ifdef DEBUG
fprintf(stderr, "(ERROR) parse_abstract failed\n");
#endif
@@ -221,7 +221,7 @@ static unsigned int proximity2relevance(int prox)
else
inv_prox = 1 / (float)prox; // 0 to 1;
return inv_prox * DtSR_SearchResultsEntry::Utmost_Relevance;
return (unsigned int)(inv_prox * DtSR_SearchResultsEntry::Utmost_Relevance);
}
unsigned int