test program and necessary build and bug fixes

This commit is contained in:
jgellman%netscape.com 1998-10-26 22:22:30 +00:00
Родитель 9ec55a311d
Коммит 5db5e6ef03
8 изменённых файлов: 68 добавлений и 14 удалений

Просмотреть файл

@ -62,6 +62,6 @@ public:
};
extern nsresult NS_GetRDFService(nsIRDFService **);
PR_PUBLIC_API(nsresult) NS_GetRDFService(nsIRDFService **);
#endif /* nsIRDFService_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___ */

Просмотреть файл

@ -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

Просмотреть файл

@ -1,9 +1,12 @@
DEPTH=..
MODULE = rdf
DIRS=\
include \
src \
tests \
$(NULL)
include <$(DEPTH)\config\rules.mak>

Просмотреть файл

@ -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 )

Просмотреть файл

@ -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;
}

Просмотреть файл

@ -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

Просмотреть файл

@ -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 );
}