From 1c7b13862fd745321d8397101a2989ead04705a7 Mon Sep 17 00:00:00 2001 From: "jgellman%netscape.com" Date: Mon, 26 Oct 1998 22:22:30 +0000 Subject: [PATCH] test program and necessary build and bug fixes git-svn-id: svn://10.0.0.236/trunk@13493 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/rdf/include/nsIRDFService.h | 2 +- mozilla/rdf/include/rdf.h | 8 ++++++++ mozilla/rdf/include/rdfc.h | 3 ++- mozilla/rdf/makefile.win | 3 +++ mozilla/rdf/src/comwrap.cpp | 23 +++++++++++++++++------ mozilla/rdf/src/rdfht.c | 23 +++++++++++++++++++++-- mozilla/rdf/tests/makefile.win | 10 ++++++++++ mozilla/rdf/tests/rdftest.cpp | 10 ++++++---- 8 files changed, 68 insertions(+), 14 deletions(-) diff --git a/mozilla/rdf/include/nsIRDFService.h b/mozilla/rdf/include/nsIRDFService.h index 7451d5b2a66..790a943a93b 100644 --- a/mozilla/rdf/include/nsIRDFService.h +++ b/mozilla/rdf/include/nsIRDFService.h @@ -62,6 +62,6 @@ public: }; -extern nsresult NS_GetRDFService(nsIRDFService **); +PR_PUBLIC_API(nsresult) NS_GetRDFService(nsIRDFService **); #endif /* nsIRDFService_h__ */ diff --git a/mozilla/rdf/include/rdf.h b/mozilla/rdf/include/rdf.h index 8a6dcf057d5..f53aa091476 100644 --- a/mozilla/rdf/include/rdf.h +++ b/mozilla/rdf/include/rdf.h @@ -117,4 +117,12 @@ typedef struct RDF_EventStruct { NSPR_END_EXTERN_C +#ifdef __cplusplus +#include "nsIRDFDataSource.h" +#include "nsIRDFDataBase.h" +#include "nsIRDFObserver.h" +#include "nsIRDFService.h" +#include "nsIRDFCursor.h" +#endif + #endif /* rdf_h___ */ diff --git a/mozilla/rdf/include/rdfc.h b/mozilla/rdf/include/rdfc.h index 3ed92f4a518..2ae3ced5ab9 100644 --- a/mozilla/rdf/include/rdfc.h +++ b/mozilla/rdf/include/rdfc.h @@ -90,7 +90,8 @@ PR_PUBLIC_API(RDF_Error) RDF_Undo(RDF rdf); depends on them. */ /* PR_PUBLIC_API(RDF_Error) RDF_Init(char *profileDirURL); */ -PR_PUBLIC_API(RDF_Error) RDF_Init(RDF_InitParams params); +/* PR_PUBLIC_API(RDF_Error) RDF_Init(RDF_InitParams params); */ +PR_PUBLIC_API(RDF_Error) RDF_Init(void); PR_PUBLIC_API(RDF_Error) RDF_Shutdown(void); /* the stuff in vocab.h will supercede whats below. I am leaving this here diff --git a/mozilla/rdf/makefile.win b/mozilla/rdf/makefile.win index d8c2a65e745..ac2d8fce020 100644 --- a/mozilla/rdf/makefile.win +++ b/mozilla/rdf/makefile.win @@ -1,9 +1,12 @@ DEPTH=.. +MODULE = rdf + DIRS=\ include \ src \ + tests \ $(NULL) include <$(DEPTH)\config\rules.mak> diff --git a/mozilla/rdf/src/comwrap.cpp b/mozilla/rdf/src/comwrap.cpp index a6f4c146cb3..473823939f3 100644 --- a/mozilla/rdf/src/comwrap.cpp +++ b/mozilla/rdf/src/comwrap.cpp @@ -17,11 +17,6 @@ */ #include "rdf.h" -#include "nsIRDFDataSource.h" -#include "nsIRDFDataBase.h" -#include "nsIRDFObserver.h" -#include "nsIRDFService.h" -#include "nsIRDFCursor.h" #include "nspr.h" #include "plhash.h" @@ -159,6 +154,9 @@ private: class rdfServiceWrapper : public nsIRDFService { public: NS_DECL_ISUPPORTS + + rdfServiceWrapper(); + ~rdfServiceWrapper(); NS_METHOD CreateDatabase(const RDF_String* url, nsIRDFDataBase** db); @@ -547,6 +545,18 @@ rdfDatabaseWrapper::DeleteAllArcs(RDF_Resource resource) NS_IMPL_ISUPPORTS( rdfServiceWrapper, NS_IRDFSERVICE_IID ) +rdfServiceWrapper::rdfServiceWrapper() +{ + nsresult err = RDF_Init(); // this method currently cannot fail + PR_ASSERT( err == NS_OK ); // XXX +} + +rdfServiceWrapper::~rdfServiceWrapper() +{ + nsresult err = RDF_Shutdown(); // this method currently cannot fail + PR_ASSERT( err == NS_OK ); // XXX +} + NS_METHOD rdfServiceWrapper::CreateDatabase(const RDF_String* url_ary, nsIRDFDataBase **db) @@ -639,7 +649,8 @@ rdfServiceFactory::LockFactory(PRBool lock) return NS_ERROR_NOT_IMPLEMENTED; } -nsresult NS_GetRDFService(nsIRDFService **s) +PR_IMPLEMENT(nsresult) +NS_GetRDFService(nsIRDFService **s) { PR_ASSERT( s ); if( 0 == s ) diff --git a/mozilla/rdf/src/rdfht.c b/mozilla/rdf/src/rdfht.c index 11862a4eb58..bd9168ff9a0 100644 --- a/mozilla/rdf/src/rdfht.c +++ b/mozilla/rdf/src/rdfht.c @@ -81,7 +81,25 @@ walkThroughAllBookmarks (RDF_Resource u) } +#ifndef XXX +PR_PUBLIC_API(RDF_Error) +RDF_Init() +{ + if ( sRDFInitedB ) + return -1; + resourceHash = PL_NewHashTable(500, PL_HashString, PL_CompareStrings, + PL_CompareValues, NULL, NULL); + dataSourceHash = PL_NewHashTable(100, PL_HashString, PL_CompareStrings, + PL_CompareValues, NULL, NULL); + /* RDFglueInitialize(); */ + MakeRemoteStore("rdf:remoteStore"); + createVocabs(); + sRDFInitedB = PR_TRUE; + + return NS_OK; +} +#else /* XXX */ PR_PUBLIC_API(RDF_Error) RDF_Init(RDF_InitParams params) { @@ -134,6 +152,7 @@ RDF_Init(RDF_InitParams params) walkThroughAllBookmarks(RDF_GetResource(NULL, "NC:Bookmarks", true)); return 0; } +#endif /* XXX */ @@ -147,7 +166,7 @@ RDF_Shutdown () { #ifdef MOZILLA_CLIENT /* flushBookmarks(); */ - HT_Shutdown(); +/* HT_Shutdown(); */ /* RDFglueExit(); */ if (profileDirURL != NULL) { @@ -173,5 +192,5 @@ RDF_Shutdown () disposeAllDBs(); sRDFInitedB = PR_FALSE; - return 0; + return NS_OK; } diff --git a/mozilla/rdf/tests/makefile.win b/mozilla/rdf/tests/makefile.win index a20b2e023b4..2a7915a68e8 100644 --- a/mozilla/rdf/tests/makefile.win +++ b/mozilla/rdf/tests/makefile.win @@ -32,7 +32,17 @@ OBJS=.\$(OBJDIR)\rdftest.obj \ LINCS= -I$(PUBLIC)\rdf -I$(LIBNSPR) -I$(XPDIST)\public\xpcom -I$(PUBLIC)\netlib -I$(PUBLIC)\raptor +LLIBS= \ + $(DIST)\lib\rdf.lib \ + $(DIST)\lib\xpcom32.lib \ + $(DIST)\lib\raptorbase.lib \ + $(DIST)\lib\netlib.lib \ + $(DIST)\lib\libplc21.lib \ + $(LIBNSPR) + include <$(DEPTH)\config\rules.mak> +install:: $(PROGRAM) + $(MAKE_INSTALL) $(PROGRAM) $(DIST)\bin diff --git a/mozilla/rdf/tests/rdftest.cpp b/mozilla/rdf/tests/rdftest.cpp index dcf88e4af3e..ff127c2a641 100644 --- a/mozilla/rdf/tests/rdftest.cpp +++ b/mozilla/rdf/tests/rdftest.cpp @@ -23,20 +23,22 @@ main(int argc, char** argv) { nsIRDFService* pRDF = 0; - NS_RDFGetService( &pRDF ); + NS_GetRDFService( &pRDF ); PR_ASSERT( pRDF != 0 ); nsIRDFDataBase* pDB; - char* url[] = { "rdf:sitemap.rdf", NULL }; + char* url[] = { "file:///sitemap.rdf", NULL }; /* turn on logging */ pRDF->CreateDatabase( url, &pDB ); + PR_ASSERT( pDB != 0 ); /* execute queries */ - pDB->Release(); - pRDF->Release(); + pDB->Release(); /* destroy the DB */ + + pRDF->Release(); /* shutdown the RDF system */ return( 0 ); }