зеркало из https://github.com/mozilla/pjs.git
smore cleanup and bug fixes
This commit is contained in:
Родитель
726cd48ecd
Коммит
0d6c9e4ad9
|
@ -41,7 +41,6 @@ CSRCS = bmk2mcf.c \
|
||||||
pm2rdf.c \
|
pm2rdf.c \
|
||||||
es2mcf.c \
|
es2mcf.c \
|
||||||
columns.c \
|
columns.c \
|
||||||
scook.c \
|
|
||||||
rdfjava.c \
|
rdfjava.c \
|
||||||
mcf.c \
|
mcf.c \
|
||||||
ht.c \
|
ht.c \
|
||||||
|
|
|
@ -29,6 +29,7 @@
|
||||||
|
|
||||||
/* externs */
|
/* externs */
|
||||||
extern RDF gNCDB;
|
extern RDF gNCDB;
|
||||||
|
#define ESFTPRT(x) ((resourceType((RDF_Resource)x) == ES_RT) || (resourceType((RDF_Resource)x) == FTP_RT))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -38,24 +39,24 @@ MakeESFTPStore (char* url)
|
||||||
RDFT ntr = (RDFT)getMem(sizeof(struct RDF_TranslatorStruct));
|
RDFT ntr = (RDFT)getMem(sizeof(struct RDF_TranslatorStruct));
|
||||||
ntr->assert = ESAssert;
|
ntr->assert = ESAssert;
|
||||||
ntr->unassert = ESUnassert;
|
ntr->unassert = ESUnassert;
|
||||||
ntr->getSlotValue = ESGetSlotValue;
|
ntr->getSlotValue = remoteStoreGetSlotValue;
|
||||||
ntr->getSlotValues = ESGetSlotValues;
|
ntr->getSlotValues = remoteStoreGetSlotValues;
|
||||||
ntr->hasAssertion = ESHasAssertion;
|
ntr->hasAssertion = remoteStoreHasAssertion;
|
||||||
ntr->nextValue = ESNextValue;
|
ntr->nextValue = remoteStoreNextValue;
|
||||||
ntr->disposeCursor = ESDisposeCursor;
|
ntr->disposeCursor = remoteStoreDisposeCursor;
|
||||||
|
ntr->possiblyAccessFile = ESFTPPossiblyAccessFile;
|
||||||
ntr->url = copyString(url);
|
ntr->url = copyString(url);
|
||||||
return ntr;
|
return ntr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void ESFTPPossiblyAccessFile (RDFT rdf, RDF_Resource u, RDF_Resource s, PRBool inversep) {
|
||||||
PRBool
|
if (((resourceType(u) == ES_RT) || (resourceType(u) == FTP_RT)) &&
|
||||||
ESFTPRT (RDF_Resource u)
|
(s == gCoreVocab->RDF_parent) && (containerp(u))) {
|
||||||
{
|
char* id = resourceID(u);
|
||||||
return ((resourceType(u) == ES_RT) ||
|
readRDFFile((resourceType(u) == ES_RT ? &id[4] : id), u, false, rdf);
|
||||||
(resourceType(u) == FTP_RT));
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
PRBool
|
PRBool
|
||||||
|
@ -88,173 +89,6 @@ ESUnassert (RDFT rdf, RDF_Resource u, RDF_Resource s, void* v,
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
PRBool
|
|
||||||
ESDBAdd (RDFT rdf, RDF_Resource u, RDF_Resource s, void* v,
|
|
||||||
RDF_ValueType type)
|
|
||||||
{
|
|
||||||
Assertion nextAs, prevAs, newAs;
|
|
||||||
if ((s == gCoreVocab->RDF_instanceOf) && (v == gWebData->RDF_Container)) {
|
|
||||||
setContainerp(u, true);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
nextAs = prevAs = u->rarg1;
|
|
||||||
while (nextAs != null) {
|
|
||||||
if (asEqual(nextAs, u, s, v, type)) return 1;
|
|
||||||
prevAs = nextAs;
|
|
||||||
nextAs = nextAs->next;
|
|
||||||
}
|
|
||||||
newAs = makeNewAssertion(u, s, v, type, 1);
|
|
||||||
if (prevAs == null) {
|
|
||||||
u->rarg1 = newAs;
|
|
||||||
} else {
|
|
||||||
prevAs->next = newAs;
|
|
||||||
}
|
|
||||||
if (type == RDF_RESOURCE_TYPE) {
|
|
||||||
nextAs = prevAs = ((RDF_Resource)v)->rarg2;
|
|
||||||
while (nextAs != null) {
|
|
||||||
prevAs = nextAs;
|
|
||||||
nextAs = nextAs->invNext;
|
|
||||||
}
|
|
||||||
if (prevAs == null) {
|
|
||||||
((RDF_Resource)v)->rarg2 = newAs;
|
|
||||||
} else {
|
|
||||||
prevAs->invNext = newAs;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
sendNotifications2(rdf, RDF_ASSERT_NOTIFY, u, s, v, type, 1);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
PRBool
|
|
||||||
ESDBRemove (RDFT rdf, RDF_Resource u, RDF_Resource s, void* v, RDF_ValueType type)
|
|
||||||
{
|
|
||||||
Assertion nextAs, prevAs, ans;
|
|
||||||
PRBool found = false;
|
|
||||||
nextAs = prevAs = u->rarg1;
|
|
||||||
while (nextAs != null) {
|
|
||||||
if (asEqual(nextAs, u, s, v, type)) {
|
|
||||||
if (prevAs == null) {
|
|
||||||
u->rarg1 = nextAs->next;
|
|
||||||
} else {
|
|
||||||
prevAs->next = nextAs->next;
|
|
||||||
}
|
|
||||||
found = true;
|
|
||||||
ans = nextAs;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
prevAs = nextAs;
|
|
||||||
nextAs = nextAs->next;
|
|
||||||
}
|
|
||||||
if (found == false) return false;
|
|
||||||
if (type == RDF_RESOURCE_TYPE) {
|
|
||||||
nextAs = prevAs = ((RDF_Resource)v)->rarg2;
|
|
||||||
while (nextAs != null) {
|
|
||||||
if (nextAs == ans) {
|
|
||||||
if (prevAs == nextAs) {
|
|
||||||
((RDF_Resource)v)->rarg2 = nextAs->invNext;
|
|
||||||
} else {
|
|
||||||
prevAs->invNext = nextAs->invNext;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
prevAs = nextAs;
|
|
||||||
nextAs = nextAs->invNext;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
sendNotifications2(rdf, RDF_DELETE_NOTIFY, u, s, v, type, 1);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
PRBool
|
|
||||||
ESHasAssertion (RDFT rdf, RDF_Resource u, RDF_Resource s, void* v,
|
|
||||||
RDF_ValueType type, PRBool tv)
|
|
||||||
{
|
|
||||||
Assertion nextAs;
|
|
||||||
|
|
||||||
if (!ESFTPRT(u)) return 0;
|
|
||||||
|
|
||||||
nextAs = u->rarg1;
|
|
||||||
while (nextAs != NULL)
|
|
||||||
{
|
|
||||||
if (asEqual(nextAs, u, s, v, type) && (nextAs->tv == tv))
|
|
||||||
{
|
|
||||||
return(true);
|
|
||||||
}
|
|
||||||
nextAs = nextAs->next;
|
|
||||||
}
|
|
||||||
possiblyAccessES(rdf, u, s, false);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void *
|
|
||||||
ESGetSlotValue (RDFT rdf, RDF_Resource u, RDF_Resource s, RDF_ValueType type,
|
|
||||||
PRBool inversep, PRBool tv)
|
|
||||||
{
|
|
||||||
if (!ESFTPRT(u)) return NULL;
|
|
||||||
|
|
||||||
if ((s == gCoreVocab->RDF_name) && (type == RDF_STRING_TYPE) && (tv))
|
|
||||||
{
|
|
||||||
char *pathname, *name = NULL;
|
|
||||||
int16 n,len;
|
|
||||||
|
|
||||||
if (pathname = copyString(resourceID(u)))
|
|
||||||
{
|
|
||||||
len = strlen(pathname);
|
|
||||||
if (pathname[len-1] == '/') pathname[--len] = '\0';
|
|
||||||
n = revCharSearch('/', pathname);
|
|
||||||
name = unescapeURL(&pathname[n+1]);
|
|
||||||
freeMem(pathname);
|
|
||||||
}
|
|
||||||
return(name);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
if (u->rarg1 == NULL) possiblyAccessES(rdf, u, s, inversep);
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
RDF_Cursor
|
|
||||||
ESGetSlotValues (RDFT rdf, RDF_Resource u, RDF_Resource s,
|
|
||||||
RDF_ValueType type, PRBool inversep, PRBool tv)
|
|
||||||
{
|
|
||||||
Assertion as;
|
|
||||||
if (!ESFTPRT(u)) return 0;
|
|
||||||
as = (inversep ? u->rarg2 : u->rarg1);
|
|
||||||
if (as == null) {
|
|
||||||
possiblyAccessES(rdf, u, s, inversep);
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void *
|
|
||||||
ESNextValue (RDFT mcf, RDF_Cursor c)
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
RDF_Error
|
|
||||||
ESDisposeCursor (RDFT mcf, RDF_Cursor c)
|
|
||||||
{
|
|
||||||
freeMem(c);
|
|
||||||
return noRDFErr;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/** To be written **/
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -450,18 +284,6 @@ ESRemoveChild (RDF_Resource parent, RDF_Resource child)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void
|
|
||||||
possiblyAccessES(RDFT rdf, RDF_Resource u, RDF_Resource s, PRBool inversep)
|
|
||||||
{
|
|
||||||
if ((ESFTPRT(u)) &&
|
|
||||||
(s == gCoreVocab->RDF_parent) && (containerp(u))) {
|
|
||||||
char* id = resourceID(u);
|
|
||||||
readRDFFile((resourceType(u) == ES_RT ? &id[4] : id), u, false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
parseNextESFTPLine (RDFFile f, char* line)
|
parseNextESFTPLine (RDFFile f, char* line)
|
||||||
{
|
{
|
||||||
|
@ -496,10 +318,7 @@ parseNextESFTPLine (RDFFile f, char* line)
|
||||||
ru = RDF_GetResource(NULL, url, 1);
|
ru = RDF_GetResource(NULL, url, 1);
|
||||||
setResourceType(ru, resourceType(f->top));
|
setResourceType(ru, resourceType(f->top));
|
||||||
if (directoryp) setContainerp(ru, 1);
|
if (directoryp) setContainerp(ru, 1);
|
||||||
/*
|
addSlotValue(f, ru, gCoreVocab->RDF_parent, f->top, RDF_RESOURCE_TYPE, 1);
|
||||||
remoteStoreAdd(gRemoteStore, ru, gCoreVocab->RDF_name, NET_UnEscape(line), RDF_STRING_TYPE, 1);
|
|
||||||
*/
|
|
||||||
remoteStoreAdd(gRemoteStore, ru, gCoreVocab->RDF_parent, f->top, RDF_RESOURCE_TYPE, 1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -544,3 +363,4 @@ parseNextESFTPBlob(NET_StreamClass *stream, char* blob, int32 size)
|
||||||
return(size);
|
return(size);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -41,6 +41,7 @@ XP_BEGIN_PROTOS
|
||||||
RDFT MakeESFTPStore (char* url);
|
RDFT MakeESFTPStore (char* url);
|
||||||
_esFEData * esMakeFEData(RDF_Resource parent, RDF_Resource child, int method);
|
_esFEData * esMakeFEData(RDF_Resource parent, RDF_Resource child, int method);
|
||||||
void esFreeFEData(_esFEData *feData);
|
void esFreeFEData(_esFEData *feData);
|
||||||
|
void ESFTPPossiblyAccessFile (RDFT rdf, RDF_Resource u, RDF_Resource s, PRBool inversep) ;
|
||||||
RDF_Error ESInit (RDFT ntr);
|
RDF_Error ESInit (RDFT ntr);
|
||||||
PRBool ESFTPRT (RDF_Resource u);
|
PRBool ESFTPRT (RDF_Resource u);
|
||||||
PRBool ESAssert (RDFT rdf, RDF_Resource u, RDF_Resource s, void* v, RDF_ValueType type, PRBool tv);
|
PRBool ESAssert (RDFT rdf, RDF_Resource u, RDF_Resource s, void* v, RDF_ValueType type, PRBool tv);
|
||||||
|
|
|
@ -43,7 +43,7 @@ extern int RDF_RELATEDLINKSNAME;
|
||||||
|
|
||||||
/* globals */
|
/* globals */
|
||||||
PLHashTable *hostHash = 0;
|
PLHashTable *hostHash = 0;
|
||||||
RDF grdf = NULL;
|
RDFT grdf = NULL;
|
||||||
RDFT gHistoryStore = 0;
|
RDFT gHistoryStore = 0;
|
||||||
PRBool ByDateOpened = 0;
|
PRBool ByDateOpened = 0;
|
||||||
|
|
||||||
|
@ -66,7 +66,7 @@ char *intermediateList[] = {
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
collateHistory (RDF r, RDF_Resource u, PRBool byDateFlag)
|
collateHistory (RDFT r, RDF_Resource u, PRBool byDateFlag)
|
||||||
{
|
{
|
||||||
HASHINFO hash = { 4*1024, 0, 0, 0, 0, 0};
|
HASHINFO hash = { 4*1024, 0, 0, 0, 0, 0};
|
||||||
DBT key, data;
|
DBT key, data;
|
||||||
|
@ -103,7 +103,7 @@ collateHistory (RDF r, RDF_Resource u, PRBool byDateFlag)
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
collateOneHist (RDF r, RDF_Resource u, char* url, char* title, time_t lastAccessDate,
|
collateOneHist (RDFT r, RDF_Resource u, char* url, char* title, time_t lastAccessDate,
|
||||||
time_t firstAccessDate, uint32 numAccesses, PRBool byDateFlag)
|
time_t firstAccessDate, uint32 numAccesses, PRBool byDateFlag)
|
||||||
{
|
{
|
||||||
RDF_Resource hostUnit, urlUnit;
|
RDF_Resource hostUnit, urlUnit;
|
||||||
|
@ -126,17 +126,17 @@ collateOneHist (RDF r, RDF_Resource u, char* url, char* title, time_t lastAccess
|
||||||
if (hostUnit != urlUnit) remoteAddParent(urlUnit, hostUnit);
|
if (hostUnit != urlUnit) remoteAddParent(urlUnit, hostUnit);
|
||||||
remoteStoreAdd(gRemoteStore, urlUnit, gWebData->RDF_lastVisitDate,
|
remoteStoreAdd(gRemoteStore, urlUnit, gWebData->RDF_lastVisitDate,
|
||||||
(void *)lastAccessDate, RDF_INT_TYPE, 1);
|
(void *)lastAccessDate, RDF_INT_TYPE, 1);
|
||||||
remoteStoreAdd(gRemoteStore, urlUnit, gWebData->RDF_firstVisitDate,
|
remoteStoreAdd(gHistoryStore, urlUnit, gWebData->RDF_firstVisitDate,
|
||||||
(void *)firstAccessDate, RDF_INT_TYPE, 1);
|
(void *)firstAccessDate, RDF_INT_TYPE, 1);
|
||||||
if (numAccesses==0) ++numAccesses;
|
if (numAccesses==0) ++numAccesses;
|
||||||
remoteStoreAdd(gRemoteStore, urlUnit, gWebData->RDF_numAccesses,
|
remoteStoreAdd(gHistoryStore, urlUnit, gWebData->RDF_numAccesses,
|
||||||
(void *)numAccesses, RDF_INT_TYPE, 1);
|
(void *)numAccesses, RDF_INT_TYPE, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
RDF_Resource
|
RDF_Resource
|
||||||
hostUnitOfURL (RDF r, RDF_Resource top, RDF_Resource nu, char* title)
|
hostUnitOfURL (RDFT r, RDF_Resource top, RDF_Resource nu, char* title)
|
||||||
{
|
{
|
||||||
char host[100];
|
char host[100];
|
||||||
char* url = resourceID(nu);
|
char* url = resourceID(nu);
|
||||||
|
@ -166,7 +166,7 @@ hostUnitOfURL (RDF r, RDF_Resource top, RDF_Resource nu, char* title)
|
||||||
} else if (existing == top) {
|
} else if (existing == top) {
|
||||||
return hostResource;
|
return hostResource;
|
||||||
} else {
|
} else {
|
||||||
remoteStoreRemove(gRemoteStore, existing, gCoreVocab->RDF_parent, top, RDF_RESOURCE_TYPE);
|
remoteStoreRemove(gHistoryStore, existing, gCoreVocab->RDF_parent, top, RDF_RESOURCE_TYPE);
|
||||||
histAddParent(existing, hostResource);
|
histAddParent(existing, hostResource);
|
||||||
histAddParent(hostResource, top);
|
histAddParent(hostResource, top);
|
||||||
PL_HashTableAdd(hostHash, hostResource, top);
|
PL_HashTableAdd(hostHash, hostResource, top);
|
||||||
|
@ -197,7 +197,7 @@ hourRange(char *buffer, struct tm *theTm)
|
||||||
|
|
||||||
|
|
||||||
RDF_Resource
|
RDF_Resource
|
||||||
hostUnitOfDate (RDF r, RDF_Resource u, time_t lastAccessDate)
|
hostUnitOfDate (RDFT r, RDF_Resource u, time_t lastAccessDate)
|
||||||
{
|
{
|
||||||
RDF_Resource node = NULL, parentNode;
|
RDF_Resource node = NULL, parentNode;
|
||||||
/*
|
/*
|
||||||
|
@ -294,9 +294,9 @@ hostUnitOfDate (RDF r, RDF_Resource u, time_t lastAccessDate)
|
||||||
}
|
}
|
||||||
setContainerp(node, 1);
|
setContainerp(node, 1);
|
||||||
setResourceType(node, HISTORY_RT);
|
setResourceType(node, HISTORY_RT);
|
||||||
remoteStoreAdd(gRemoteStore, node, gCoreVocab->RDF_parent,
|
remoteStoreAdd(gHistoryStore, node, gCoreVocab->RDF_parent,
|
||||||
parentNode, RDF_RESOURCE_TYPE, 1);
|
parentNode, RDF_RESOURCE_TYPE, 1);
|
||||||
remoteStoreAdd(gRemoteStore, node, gCoreVocab->RDF_name,
|
remoteStoreAdd(gHistoryStore, node, gCoreVocab->RDF_name,
|
||||||
copyString(weekBuffer), RDF_STRING_TYPE, 1);
|
copyString(weekBuffer), RDF_STRING_TYPE, 1);
|
||||||
parentNode = node;
|
parentNode = node;
|
||||||
}
|
}
|
||||||
|
@ -314,7 +314,7 @@ hostUnitOfDate (RDF r, RDF_Resource u, time_t lastAccessDate)
|
||||||
setResourceType(node, HISTORY_RT);
|
setResourceType(node, HISTORY_RT);
|
||||||
histAddParent(node, parentNode);
|
histAddParent(node, parentNode);
|
||||||
sprintf(bigBuffer,"%s - %s",weekBuffer,dayBuffer);
|
sprintf(bigBuffer,"%s - %s",weekBuffer,dayBuffer);
|
||||||
remoteStoreAdd(gRemoteStore, node, gCoreVocab->RDF_name,
|
remoteStoreAdd(gHistoryStore, node, gCoreVocab->RDF_name,
|
||||||
copyString(dayBuffer), RDF_STRING_TYPE, 1);
|
copyString(dayBuffer), RDF_STRING_TYPE, 1);
|
||||||
parentNode = node;
|
parentNode = node;
|
||||||
}
|
}
|
||||||
|
@ -328,9 +328,9 @@ hostUnitOfDate (RDF r, RDF_Resource u, time_t lastAccessDate)
|
||||||
}
|
}
|
||||||
setContainerp(node, 1);
|
setContainerp(node, 1);
|
||||||
setResourceType(node, HISTORY_RT);
|
setResourceType(node, HISTORY_RT);
|
||||||
remoteStoreAdd(gRemoteStore, node, gCoreVocab->RDF_parent,
|
remoteStoreAdd(gHistoryStore, node, gCoreVocab->RDF_parent,
|
||||||
parentNode, RDF_RESOURCE_TYPE, 1);
|
parentNode, RDF_RESOURCE_TYPE, 1);
|
||||||
remoteStoreAdd(gRemoteStore, node, gCoreVocab->RDF_name,
|
remoteStoreAdd(gHistoryStore, node, gCoreVocab->RDF_name,
|
||||||
copyString(hourBuffer), RDF_STRING_TYPE, 1);
|
copyString(hourBuffer), RDF_STRING_TYPE, 1);
|
||||||
parentNode = node;
|
parentNode = node;
|
||||||
}
|
}
|
||||||
|
@ -338,28 +338,6 @@ hostUnitOfDate (RDF r, RDF_Resource u, time_t lastAccessDate)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void
|
|
||||||
deleteCurrentSitemaps (char *address)
|
|
||||||
{
|
|
||||||
RDF_Resource children[40];
|
|
||||||
int16 n = 0;
|
|
||||||
RDF_Cursor c = remoteStoreGetSlotValues(gRemoteStore, gNavCenter->RDF_Sitemaps, gCoreVocab->RDF_parent,
|
|
||||||
RDF_RESOURCE_TYPE,1, 1);
|
|
||||||
RDF_Resource child;
|
|
||||||
while (c && (child = remoteStoreNextValue(gRemoteStore, c))) {
|
|
||||||
children[n++] = child;
|
|
||||||
}
|
|
||||||
remoteStoreDisposeCursor(gRemoteStore, c);
|
|
||||||
n--;
|
|
||||||
while (n > -1) {
|
|
||||||
remoteStoreRemove(gRemoteStore, children[n--],
|
|
||||||
gCoreVocab->RDF_parent, gNavCenter->RDF_Sitemaps, RDF_RESOURCE_TYPE);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
PR_PUBLIC_API(void)
|
PR_PUBLIC_API(void)
|
||||||
updateNewHistItem (DBT *key, DBT *data)
|
updateNewHistItem (DBT *key, DBT *data)
|
||||||
{
|
{
|
||||||
|
@ -455,11 +433,11 @@ histAddParent (RDF_Resource child, RDF_Resource parent)
|
||||||
RDF_ValueType type = RDF_RESOURCE_TYPE;
|
RDF_ValueType type = RDF_RESOURCE_TYPE;
|
||||||
nextAs = prevAs = child->rarg1;
|
nextAs = prevAs = child->rarg1;
|
||||||
while (nextAs != null) {
|
while (nextAs != null) {
|
||||||
if (asEqual(nextAs, child, s, parent, type)) return null;
|
if (asEqual(gHistoryStore, nextAs, child, s, parent, type)) return null;
|
||||||
prevAs = nextAs;
|
prevAs = nextAs;
|
||||||
nextAs = nextAs->next;
|
nextAs = nextAs->next;
|
||||||
}
|
}
|
||||||
newAs = makeNewAssertion(child, s, parent, type, 1);
|
newAs = makeNewAssertion(gHistoryStore, child, s, parent, type, 1);
|
||||||
if (prevAs == null) {
|
if (prevAs == null) {
|
||||||
child->rarg1 = newAs;
|
child->rarg1 = newAs;
|
||||||
} else {
|
} else {
|
||||||
|
@ -492,7 +470,7 @@ histAddParent (RDF_Resource child, RDF_Resource parent)
|
||||||
}
|
}
|
||||||
sendNotifications2(gHistoryStore, RDF_ASSERT_NOTIFY, child, s, parent, type, 1);
|
sendNotifications2(gHistoryStore, RDF_ASSERT_NOTIFY, child, s, parent, type, 1);
|
||||||
/* XXX have to mark the entire subtree XXX */
|
/* XXX have to mark the entire subtree XXX */
|
||||||
/* sendNotifications(gRemoteStore->rdf, RDF_ASSERT_NOTIFY, child, s, parent, type, 1); */
|
/* sendNotifications(gHistoryStore->rdf, RDF_ASSERT_NOTIFY, child, s, parent, type, 1); */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -518,7 +496,7 @@ historyUnassert (RDFT hst, RDF_Resource u, RDF_Resource s, void* v,
|
||||||
while (n > 0) {
|
while (n > 0) {
|
||||||
n = n - 1;
|
n = n - 1;
|
||||||
if (parents[n]) {
|
if (parents[n]) {
|
||||||
Assertion nas = remoteStoreRemove (gRemoteStore, u, gCoreVocab->RDF_parent,
|
Assertion nas = remoteStoreRemove (gHistoryStore, u, gCoreVocab->RDF_parent,
|
||||||
parents[n], RDF_RESOURCE_TYPE);
|
parents[n], RDF_RESOURCE_TYPE);
|
||||||
freeMem(nas);
|
freeMem(nas);
|
||||||
}
|
}
|
||||||
|
@ -528,35 +506,13 @@ historyUnassert (RDFT hst, RDF_Resource u, RDF_Resource s, void* v,
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void HistPossiblyAccessFile (RDFT rdf, RDF_Resource u, RDF_Resource s, PRBool inversep) {
|
||||||
|
if ((s == gCoreVocab->RDF_parent) && inversep && (rdf == gHistoryStore) &&
|
||||||
RDF_Cursor
|
((u == gNavCenter->RDF_HistoryByDate) || (u == gNavCenter->RDF_HistoryBySite))) {
|
||||||
historyStoreGetSlotValuesInt (RDFT mcf, RDF_Resource u, RDF_Resource s, RDF_ValueType type,
|
collateHistory(rdf, u, (u == gNavCenter->RDF_HistoryByDate));
|
||||||
PRBool inversep, PRBool tv)
|
|
||||||
{
|
|
||||||
if ((type == RDF_RESOURCE_TYPE) && (resourceType(u) == HISTORY_RT) && inversep &&
|
|
||||||
(s == gCoreVocab->RDF_parent)) {
|
|
||||||
return remoteStoreGetSlotValuesInt(mcf, u, s, type, inversep, tv);
|
|
||||||
} else {
|
|
||||||
return NULL;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
PRBool
|
|
||||||
historyStoreHasAssertion (RDFT mcf, RDF_Resource u, RDF_Resource s, void* v, RDF_ValueType type, PRBool tv)
|
|
||||||
{
|
|
||||||
if ((s == gCoreVocab->RDF_parent) && (type == RDF_RESOURCE_TYPE) && (resourceType((RDF_Resource)v) == HISTORY_RT))
|
|
||||||
{
|
|
||||||
remoteStoreHasAssertionInt(mcf, u, s, v, type, tv);
|
|
||||||
} else {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
RDFT
|
RDFT
|
||||||
MakeHistoryStore (char* url)
|
MakeHistoryStore (char* url)
|
||||||
{
|
{
|
||||||
|
@ -566,10 +522,11 @@ MakeHistoryStore (char* url)
|
||||||
ntr->assert = NULL;
|
ntr->assert = NULL;
|
||||||
ntr->unassert = historyUnassert;
|
ntr->unassert = historyUnassert;
|
||||||
ntr->getSlotValue = remoteStoreGetSlotValue;
|
ntr->getSlotValue = remoteStoreGetSlotValue;
|
||||||
ntr->getSlotValues = historyStoreGetSlotValuesInt;
|
ntr->getSlotValues = remoteStoreGetSlotValues;
|
||||||
ntr->hasAssertion = historyStoreHasAssertion;
|
ntr->hasAssertion = remoteStoreHasAssertion;
|
||||||
ntr->nextValue = remoteStoreNextValue;
|
ntr->nextValue = remoteStoreNextValue;
|
||||||
ntr->disposeCursor = remoteStoreDisposeCursor;
|
ntr->disposeCursor = remoteStoreDisposeCursor;
|
||||||
|
ntr->possiblyAccessFile = HistPossiblyAccessFile;
|
||||||
gHistoryStore = ntr;
|
gHistoryStore = ntr;
|
||||||
ntr->url = copyString(url);
|
ntr->url = copyString(url);
|
||||||
return ntr;
|
return ntr;
|
||||||
|
@ -579,7 +536,7 @@ MakeHistoryStore (char* url)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
void
|
void
|
||||||
dumpHist ()
|
dumpHist ()
|
||||||
{
|
{
|
||||||
|
@ -602,3 +559,5 @@ dumpHist ()
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
(*db->close)(db);
|
(*db->close)(db);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
|
@ -75,11 +75,11 @@
|
||||||
|
|
||||||
XP_BEGIN_PROTOS
|
XP_BEGIN_PROTOS
|
||||||
|
|
||||||
void collateHistory (RDF r, RDF_Resource u, PRBool byDateFlag);
|
void collateHistory (RDFT r, RDF_Resource u, PRBool byDateFlag);
|
||||||
void collateOneHist (RDF r, RDF_Resource u, char* url, char* title, time_t lastAccessDate, time_t firstAccessDate, uint32 numAccesses, PRBool byDateFlag);
|
void collateOneHist (RDFT r, RDF_Resource u, char* url, char* title, time_t lastAccessDate, time_t firstAccessDate, uint32 numAccesses, PRBool byDateFlag);
|
||||||
RDF_Resource hostUnitOfURL (RDF r, RDF_Resource top, RDF_Resource nu, char* title);
|
RDF_Resource hostUnitOfURL (RDFT r, RDF_Resource top, RDF_Resource nu, char* title);
|
||||||
void hourRange(char *buffer, struct tm *theTm);
|
void hourRange(char *buffer, struct tm *theTm);
|
||||||
RDF_Resource hostUnitOfDate (RDF r, RDF_Resource u, time_t lastAccessDate);
|
RDF_Resource hostUnitOfDate (RDFT r, RDF_Resource u, time_t lastAccessDate);
|
||||||
void deleteCurrentSitemaps (char *address);
|
void deleteCurrentSitemaps (char *address);
|
||||||
void addRelatedLinks (char* address);
|
void addRelatedLinks (char* address);
|
||||||
PRBool displayHistoryItem (char* url);
|
PRBool displayHistoryItem (char* url);
|
||||||
|
|
|
@ -913,7 +913,7 @@ newHTPaneDB()
|
||||||
char *
|
char *
|
||||||
gNavCenterDataSources1[15] =
|
gNavCenterDataSources1[15] =
|
||||||
{
|
{
|
||||||
"rdf:localStore", "rdf:remoteStore", "rdf:history",
|
"rdf:localStore", "rdf:remoteStore", "rdf:remoteStore", "rdf:history",
|
||||||
/* "rdf:ldap", */
|
/* "rdf:ldap", */
|
||||||
"rdf:esftp", "rdf:mail",
|
"rdf:esftp", "rdf:mail",
|
||||||
|
|
||||||
|
@ -925,6 +925,22 @@ gNavCenterDataSources1[15] =
|
||||||
"rdf:columns", NULL
|
"rdf:columns", NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
|
RDF HTRDF_GetDB () {
|
||||||
|
RDF ans;
|
||||||
|
char* navCenterURL;
|
||||||
|
PREF_SetDefaultCharPref("browser.NavCenter", "http://rdf.netscape.com/rdf/navcntr.rdf");
|
||||||
|
PREF_CopyCharPref("browser.NavCenter", &navCenterURL);
|
||||||
|
if (!strchr(navCenterURL, ':')) {
|
||||||
|
navCenterURL = makeDBURL(navCenterURL);
|
||||||
|
} else {
|
||||||
|
copyString(navCenterURL);
|
||||||
|
}
|
||||||
|
*(gNavCenterDataSources1 + 1) = copyString(navCenterURL);
|
||||||
|
ans = RDF_GetDB(gNavCenterDataSources1);
|
||||||
|
freeMem(navCenterURL);
|
||||||
|
return ans;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
PR_PUBLIC_API(HT_Pane)
|
PR_PUBLIC_API(HT_Pane)
|
||||||
|
@ -951,7 +967,7 @@ HT_NewPane (HT_Notification notify)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
ev->eventType = HT_EVENT_DEFAULT_NOTIFICATION_MASK;
|
ev->eventType = HT_EVENT_DEFAULT_NOTIFICATION_MASK;
|
||||||
pane->db = RDF_GetDB((char**)gNavCenterDataSources1);
|
pane->db = HTRDF_GetDB();
|
||||||
pane->rns = RDF_AddNotifiable(pane->db, htrdfNotifFunc, ev, pane);
|
pane->rns = RDF_AddNotifiable(pane->db, htrdfNotifFunc, ev, pane);
|
||||||
freeMem(ev);
|
freeMem(ev);
|
||||||
|
|
||||||
|
@ -6839,7 +6855,8 @@ RDF_GetNavCenterDB()
|
||||||
#define RDF_RELATED_LINKS 2
|
#define RDF_RELATED_LINKS 2
|
||||||
#define FROM_PAGE 1
|
#define FROM_PAGE 1
|
||||||
#define GUESS_FROM_PREVIOUS_PAGE 2
|
#define GUESS_FROM_PREVIOUS_PAGE 2
|
||||||
|
#define HTADD remoteStoreAdd
|
||||||
|
#define HTDEL remoteStoreRemove
|
||||||
|
|
||||||
HT_URLSiteMapAssoc *
|
HT_URLSiteMapAssoc *
|
||||||
makeNewSMP (HT_Pane htPane, char* pUrl, char* sitemapUrl)
|
makeNewSMP (HT_Pane htPane, char* pUrl, char* sitemapUrl)
|
||||||
|
@ -6872,6 +6889,7 @@ HT_AddSitemapFor(HT_Pane htPane, char *pUrl, char *pSitemapUrl, char* name)
|
||||||
|
|
||||||
|
|
||||||
sp = RDFTNamed(htPane->db, "rdf:ht");
|
sp = RDFTNamed(htPane->db, "rdf:ht");
|
||||||
|
if (sp == NULL) return;
|
||||||
nu = RDF_GetResource(htPane->db, pSitemapUrl, 1);
|
nu = RDF_GetResource(htPane->db, pSitemapUrl, 1);
|
||||||
nsmp = makeNewSMP(htPane, pUrl, pSitemapUrl);
|
nsmp = makeNewSMP(htPane, pUrl, pSitemapUrl);
|
||||||
nsmp->sitemap = nu;
|
nsmp->sitemap = nu;
|
||||||
|
@ -6891,8 +6909,8 @@ HT_AddSitemapFor(HT_Pane htPane, char *pUrl, char *pSitemapUrl, char* name)
|
||||||
|
|
||||||
nsmp->origin = FROM_PAGE;
|
nsmp->origin = FROM_PAGE;
|
||||||
nsmp->onDisplayp = 1;
|
nsmp->onDisplayp = 1;
|
||||||
SCookAssert3(sp, nu, gCoreVocab->RDF_name, nm, RDF_STRING_TYPE, 1);
|
HTADD(sp, nu, gCoreVocab->RDF_name, nm, RDF_STRING_TYPE, 1);
|
||||||
SCookAssert3(sp, nu, gCoreVocab->RDF_parent, gNavCenter->RDF_Top,
|
HTADD(sp, nu, gCoreVocab->RDF_parent, gNavCenter->RDF_Top,
|
||||||
RDF_RESOURCE_TYPE, 1);
|
RDF_RESOURCE_TYPE, 1);
|
||||||
|
|
||||||
|
|
||||||
|
@ -6907,6 +6925,7 @@ RetainOldSitemaps (HT_Pane htPane, char *pUrl)
|
||||||
RDFT sp;
|
RDFT sp;
|
||||||
|
|
||||||
sp = RDFTNamed(htPane->db, "rdf:ht");
|
sp = RDFTNamed(htPane->db, "rdf:ht");
|
||||||
|
if (sp == NULL) return;
|
||||||
nsmp = htPane->smp;
|
nsmp = htPane->smp;
|
||||||
while (nsmp != NULL) {
|
while (nsmp != NULL) {
|
||||||
if ((nsmp->siteToolType == RDF_SITEMAP)) {
|
if ((nsmp->siteToolType == RDF_SITEMAP)) {
|
||||||
|
@ -6918,13 +6937,13 @@ RetainOldSitemaps (HT_Pane htPane, char *pUrl)
|
||||||
nsmp->sitemap = nu;
|
nsmp->sitemap = nu;
|
||||||
nsmp->origin = GUESS_FROM_PREVIOUS_PAGE;
|
nsmp->origin = GUESS_FROM_PREVIOUS_PAGE;
|
||||||
nsmp->onDisplayp = 1;
|
nsmp->onDisplayp = 1;
|
||||||
SCookAssert3(sp, nu, gCoreVocab->RDF_name, copyString(nsmp->name),
|
HTADD(sp, nu, gCoreVocab->RDF_name, copyString(nsmp->name),
|
||||||
RDF_STRING_TYPE, 1);
|
RDF_STRING_TYPE, 1);
|
||||||
SCookAssert3(sp, nu, gCoreVocab->RDF_parent,
|
HTADD(sp, nu, gCoreVocab->RDF_parent,
|
||||||
gNavCenter->RDF_Top, RDF_RESOURCE_TYPE, 1);
|
gNavCenter->RDF_Top, RDF_RESOURCE_TYPE, 1);
|
||||||
}
|
}
|
||||||
} else if (nsmp->onDisplayp) {
|
} else if (nsmp->onDisplayp) {
|
||||||
SCookUnassert(sp, nsmp->sitemap, gCoreVocab->RDF_parent,
|
HTDEL(sp, nsmp->sitemap, gCoreVocab->RDF_parent,
|
||||||
gNavCenter->RDF_Top, RDF_RESOURCE_TYPE);
|
gNavCenter->RDF_Top, RDF_RESOURCE_TYPE);
|
||||||
nsmp->onDisplayp = 0;
|
nsmp->onDisplayp = 0;
|
||||||
}
|
}
|
||||||
|
@ -6945,7 +6964,7 @@ HT_ExitPage(HT_Pane htPane, char *pUrl)
|
||||||
nsmp = htPane->sbp;
|
nsmp = htPane->sbp;
|
||||||
while (nsmp != NULL) {
|
while (nsmp != NULL) {
|
||||||
HT_URLSiteMapAssoc *next;
|
HT_URLSiteMapAssoc *next;
|
||||||
SCookUnassert(sp, nsmp->sitemap, gCoreVocab->RDF_parent,
|
HTDEL(sp, nsmp->sitemap, gCoreVocab->RDF_parent,
|
||||||
gNavCenter->RDF_Sitemaps, RDF_RESOURCE_TYPE);
|
gNavCenter->RDF_Sitemaps, RDF_RESOURCE_TYPE);
|
||||||
next = nsmp->next;
|
next = nsmp->next;
|
||||||
freeMem(nsmp->url);
|
freeMem(nsmp->url);
|
||||||
|
@ -7156,8 +7175,8 @@ HT_AddRelatedLinksFor(HT_Pane htPane, char *pUrl)
|
||||||
nsmp->next = htPane->sbp;
|
nsmp->next = htPane->sbp;
|
||||||
htPane->sbp = nsmp;
|
htPane->sbp = nsmp;
|
||||||
nsmp->siteToolType = RDF_RELATED_LINKS;
|
nsmp->siteToolType = RDF_RELATED_LINKS;
|
||||||
SCookAssert3(sp, nu, gCoreVocab->RDF_name, copyString(prov->name), RDF_STRING_TYPE, 1);
|
HTADD(sp, nu, gCoreVocab->RDF_name, copyString(prov->name), RDF_STRING_TYPE, 1);
|
||||||
SCookAssert3(sp, nu, gCoreVocab->RDF_parent, gNavCenter->RDF_Sitemaps, RDF_RESOURCE_TYPE, 1);
|
HTADD(sp, nu, gCoreVocab->RDF_parent, gNavCenter->RDF_Sitemaps, RDF_RESOURCE_TYPE, 1);
|
||||||
prov = prov->next;
|
prov = prov->next;
|
||||||
freeMem(buffer);
|
freeMem(buffer);
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,7 +46,7 @@ REQUIRES=nspr dbm java js htmldlgs util img layer pref
|
||||||
CSRCS=bmk2mcf.c vocab.c nlcstore.c mcf.c mcff2mcf.c rdfht.c \
|
CSRCS=bmk2mcf.c vocab.c nlcstore.c mcf.c mcff2mcf.c rdfht.c \
|
||||||
remstore.c ht.c glue.c utils.c fs2rdf.c hist2rdf.c \
|
remstore.c ht.c glue.c utils.c fs2rdf.c hist2rdf.c \
|
||||||
rdfparse.c es2mcf.c columns.c \
|
rdfparse.c es2mcf.c columns.c \
|
||||||
scook.c \
|
|
||||||
|
|
||||||
C_OBJS=.\$(OBJDIR)\bmk2mcf.obj .\$(OBJDIR)\vocab.obj \
|
C_OBJS=.\$(OBJDIR)\bmk2mcf.obj .\$(OBJDIR)\vocab.obj \
|
||||||
.\$(OBJDIR)\nlcstore.obj \
|
.\$(OBJDIR)\nlcstore.obj \
|
||||||
|
@ -54,9 +54,7 @@ C_OBJS=.\$(OBJDIR)\bmk2mcf.obj .\$(OBJDIR)\vocab.obj \
|
||||||
.\$(OBJDIR)\remstore.obj .\$(OBJDIR)\ht.obj \
|
.\$(OBJDIR)\remstore.obj .\$(OBJDIR)\ht.obj \
|
||||||
.\$(OBJDIR)\glue.obj .\$(OBJDIR)\utils.obj .\$(OBJDIR)\fs2rdf.obj \
|
.\$(OBJDIR)\glue.obj .\$(OBJDIR)\utils.obj .\$(OBJDIR)\fs2rdf.obj \
|
||||||
.\$(OBJDIR)\hist2rdf.obj .\$(OBJDIR)\rdfparse.obj \
|
.\$(OBJDIR)\hist2rdf.obj .\$(OBJDIR)\rdfparse.obj \
|
||||||
.\$(OBJDIR)\es2mcf.obj \
|
.\$(OBJDIR)\es2mcf.obj .\$(OBJDIR)\columns.obj
|
||||||
.\$(OBJDIR)\columns.obj \
|
|
||||||
.\$(OBJDIR)\scook.obj
|
|
||||||
!if "$(MOZ_BITS)" != "16"
|
!if "$(MOZ_BITS)" != "16"
|
||||||
LINCS=-I$(XPDIST)\public\nspr -I$(XPDIST)\public\dbm \
|
LINCS=-I$(XPDIST)\public\nspr -I$(XPDIST)\public\dbm \
|
||||||
-I$(XPDIST)\public\java -I$(XPDIST)\public\js \
|
-I$(XPDIST)\public\java -I$(XPDIST)\public\js \
|
||||||
|
|
|
@ -219,6 +219,31 @@ RDF_AssertFalse (RDF rdf, RDF_Resource u, RDF_Resource s, void* value, RDF_Valu
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
PR_PUBLIC_API(PRBool)
|
||||||
|
RDF_CanAssert(RDF r, RDF_Resource u, RDF_Resource s,
|
||||||
|
void* v, RDF_ValueType type)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
PR_PUBLIC_API(PRBool)
|
||||||
|
RDF_CanAssertFalse(RDF r, RDF_Resource u, RDF_Resource s, void* v, RDF_ValueType type)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
PR_PUBLIC_API(PRBool)
|
||||||
|
RDF_CanUnassert(RDF r, RDF_Resource u, RDF_Resource s, void* v, RDF_ValueType type)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
PR_PUBLIC_API(PRBool)
|
PR_PUBLIC_API(PRBool)
|
||||||
RDF_Unassert (RDF rdf, RDF_Resource u, RDF_Resource s, void* value, RDF_ValueType type)
|
RDF_Unassert (RDF rdf, RDF_Resource u, RDF_Resource s, void* value, RDF_ValueType type)
|
||||||
{
|
{
|
||||||
|
@ -263,7 +288,7 @@ makeNewID ()
|
||||||
id = (char *)getMem(ID_BUF_SIZE);
|
id = (char *)getMem(ID_BUF_SIZE);
|
||||||
|
|
||||||
#ifdef HAVE_LONG_LONG
|
#ifdef HAVE_LONG_LONG
|
||||||
PR_snprintf(id, ID_BUF_SIZE, "%u", (double)tm);
|
PR_snprintf(id, ID_BUF_SIZE, "%1.0f", (double)tm);
|
||||||
#else
|
#else
|
||||||
LL_L2D(doubletm, tm);
|
LL_L2D(doubletm, tm);
|
||||||
PR_snprintf(id, ID_BUF_SIZE, "%1.0f", doubletm);
|
PR_snprintf(id, ID_BUF_SIZE, "%1.0f", doubletm);
|
||||||
|
@ -274,7 +299,7 @@ makeNewID ()
|
||||||
{
|
{
|
||||||
#ifdef HAVE_LONG_LONG
|
#ifdef HAVE_LONG_LONG
|
||||||
tm = tm + (PR_MSEC_PER_SEC * 60); /* fix me - not sure what the increment should be */
|
tm = tm + (PR_MSEC_PER_SEC * 60); /* fix me - not sure what the increment should be */
|
||||||
PR_snprintf(id, ID_BUF_SIZE, "%u", (double)tm);
|
PR_snprintf(id, ID_BUF_SIZE, "%1.0f", (double)tm);
|
||||||
#else
|
#else
|
||||||
int64 incr;
|
int64 incr;
|
||||||
LL_I2L(incr, (PR_MSEC_PER_SEC * 60));
|
LL_I2L(incr, (PR_MSEC_PER_SEC * 60));
|
||||||
|
|
|
@ -159,7 +159,7 @@ typedef RDF_Error (*destroyProc)(struct RDF_TranslatorStruct*);
|
||||||
typedef RDF_Cursor (*arcLabelsOutProc)(RDFT r, RDF_Resource u);
|
typedef RDF_Cursor (*arcLabelsOutProc)(RDFT r, RDF_Resource u);
|
||||||
typedef RDF_Cursor (*arcLabelsInProc)(RDFT r, RDF_Resource u);
|
typedef RDF_Cursor (*arcLabelsInProc)(RDFT r, RDF_Resource u);
|
||||||
typedef PRBool (*fAssert1Proc) (RDFFile file, RDFT mcf, RDF_Resource u, RDF_Resource s, void* v, RDF_ValueType type, PRBool tv) ;
|
typedef PRBool (*fAssert1Proc) (RDFFile file, RDFT mcf, RDF_Resource u, RDF_Resource s, void* v, RDF_ValueType type, PRBool tv) ;
|
||||||
|
typedef void (*accessFileProc) (RDFT rdf, RDF_Resource u, RDF_Resource s, PRBool inversep) ;
|
||||||
struct RDF_ListStruct {
|
struct RDF_ListStruct {
|
||||||
struct RDF_DBStruct* rdf;
|
struct RDF_DBStruct* rdf;
|
||||||
struct RDF_ListStruct* next;
|
struct RDF_ListStruct* next;
|
||||||
|
@ -182,6 +182,7 @@ struct RDF_TranslatorStruct {
|
||||||
disposeResourceProc disposeResource;
|
disposeResourceProc disposeResource;
|
||||||
arcLabelsInProc arcLabelsIn;
|
arcLabelsInProc arcLabelsIn;
|
||||||
arcLabelsInProc arcLabelsOut;
|
arcLabelsInProc arcLabelsOut;
|
||||||
|
accessFileProc possiblyAccessFile;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -252,7 +253,7 @@ struct RDF_FileStruct {
|
||||||
RDF_Resource nextFindValue (RDF_Cursor c) ;
|
RDF_Resource nextFindValue (RDF_Cursor c) ;
|
||||||
PRBool isTypeOf (RDF rdf, RDF_Resource u, RDF_Resource v);
|
PRBool isTypeOf (RDF rdf, RDF_Resource u, RDF_Resource v);
|
||||||
RDF getRDFDB (void);
|
RDF getRDFDB (void);
|
||||||
RDFFile readRDFFile (char* url, RDF_Resource top, PRBool localp);
|
RDFFile readRDFFile (char* url, RDF_Resource top, PRBool localp, RDFT rdf);
|
||||||
void sendNotifications (RDF rdf, RDF_EventType opType, RDF_Resource u, RDF_Resource s, void* v, RDF_ValueType type, PRBool tv, char* ds);
|
void sendNotifications (RDF rdf, RDF_EventType opType, RDF_Resource u, RDF_Resource s, void* v, RDF_ValueType type, PRBool tv, char* ds);
|
||||||
void sendNotifications2 (RDFT rdf, RDF_EventType opType, RDF_Resource u, RDF_Resource s, void* v, RDF_ValueType type, PRBool tv) ;
|
void sendNotifications2 (RDFT rdf, RDF_EventType opType, RDF_Resource u, RDF_Resource s, void* v, RDF_ValueType type, PRBool tv) ;
|
||||||
RDF_Error exitRDF (RDF rdf);
|
RDF_Error exitRDF (RDF rdf);
|
||||||
|
@ -270,8 +271,9 @@ uint8 resourceType (RDF_Resource r);
|
||||||
void setResourceType (RDF_Resource r, uint8 type);
|
void setResourceType (RDF_Resource r, uint8 type);
|
||||||
char* getBaseURL (const char* url) ;
|
char* getBaseURL (const char* url) ;
|
||||||
void freeNamespaces (RDFFile f) ;
|
void freeNamespaces (RDFFile f) ;
|
||||||
PRBool asEqual(Assertion as, RDF_Resource u, RDF_Resource s, void* v, RDF_ValueType type);
|
PRBool asEqual(RDFT r, Assertion as, RDF_Resource u, RDF_Resource s, void* v, RDF_ValueType type);
|
||||||
Assertion makeNewAssertion (RDF_Resource u, RDF_Resource s, void* v, RDF_ValueType type, PRBool tv);
|
Assertion makeNewAssertion (RDFT r, RDF_Resource u, RDF_Resource s, void* v, RDF_ValueType type, PRBool tv);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void readResourceFile(RDF rdf, RDF_Resource u);
|
void readResourceFile(RDF rdf, RDF_Resource u);
|
||||||
|
|
|
@ -43,7 +43,7 @@ static PRBool sRDFInitedB = PR_FALSE;
|
||||||
|
|
||||||
|
|
||||||
char * gNavCenterDataSources[15] =
|
char * gNavCenterDataSources[15] =
|
||||||
{"rdf:localStore", "rdf:remoteStore", "rdf:history",
|
{"rdf:localStore", "rdf:remoteStore", "rdf:remoteStore", "rdf:history",
|
||||||
/* "rdf:ldap", */
|
/* "rdf:ldap", */
|
||||||
"rdf:esftp",
|
"rdf:esftp",
|
||||||
"rdf:lfs",
|
"rdf:lfs",
|
||||||
|
@ -69,6 +69,7 @@ RDF_Init(RDF_InitParams params)
|
||||||
resourceHash = PL_NewHashTable(500, PL_HashString, PL_CompareStrings, PL_CompareValues,
|
resourceHash = PL_NewHashTable(500, PL_HashString, PL_CompareStrings, PL_CompareValues,
|
||||||
NULL, NULL);
|
NULL, NULL);
|
||||||
RDFglueInitialize();
|
RDFglueInitialize();
|
||||||
|
MakeRemoteStore("rdf:remoteStore");
|
||||||
createVocabs();
|
createVocabs();
|
||||||
sRDFInitedB = PR_TRUE;
|
sRDFInitedB = PR_TRUE;
|
||||||
|
|
||||||
|
@ -136,27 +137,3 @@ RDF_Shutdown ()
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
PR_PUBLIC_API(PRBool)
|
|
||||||
RDF_CanAssert(RDF r, RDF_Resource u, RDF_Resource s,
|
|
||||||
void* v, RDF_ValueType type)
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
PR_PUBLIC_API(PRBool)
|
|
||||||
RDF_CanAssertFalse(RDF r, RDF_Resource u, RDF_Resource s, void* v, RDF_ValueType type)
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
PR_PUBLIC_API(PRBool)
|
|
||||||
RDF_CanUnassert(RDF r, RDF_Resource u, RDF_Resource s, void* v, RDF_ValueType type)
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
|
@ -30,7 +30,7 @@
|
||||||
#include "bmk2mcf.h"
|
#include "bmk2mcf.h"
|
||||||
|
|
||||||
/* globals */
|
/* globals */
|
||||||
RDFFile rdfFiles = 0;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -47,6 +47,7 @@ MakeRemoteStore (char* url)
|
||||||
ntr->hasAssertion = remoteStoreHasAssertion;
|
ntr->hasAssertion = remoteStoreHasAssertion;
|
||||||
ntr->nextValue = remoteStoreNextValue;
|
ntr->nextValue = remoteStoreNextValue;
|
||||||
ntr->disposeCursor = remoteStoreDisposeCursor;
|
ntr->disposeCursor = remoteStoreDisposeCursor;
|
||||||
|
ntr->possiblyAccessFile = RDFFilePossiblyAccessFile ;
|
||||||
gRemoteStore = ntr;
|
gRemoteStore = ntr;
|
||||||
ntr->url = copyString(url);
|
ntr->url = copyString(url);
|
||||||
return ntr;
|
return ntr;
|
||||||
|
@ -54,25 +55,44 @@ MakeRemoteStore (char* url)
|
||||||
} else return NULL;
|
} else return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
PLHashTable* RDFFileDBHash = 0;
|
||||||
|
|
||||||
|
RDFT existingRDFFileDB (char* url) {
|
||||||
|
if (RDFFileDBHash == 0)
|
||||||
|
RDFFileDBHash = PL_NewHashTable(100, PL_HashString, PL_CompareStrings, PL_CompareValues, NULL, NULL);
|
||||||
|
return PL_HashTableLookup(RDFFileDBHash, url);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
RDFT
|
RDFT
|
||||||
MakeFileDB (char* url)
|
MakeFileDB (char* url)
|
||||||
{
|
{
|
||||||
if (endsWith(".rdf", url) || endsWith(".mcf", url)) {
|
if (endsWith(".rdf", url) || endsWith(".mcf", url)) {
|
||||||
if (gRemoteStore == 0) MakeRemoteStore("rdf:remoteStore");
|
RDFT ntr = existingRDFFileDB(url);
|
||||||
if (!fileReadp(url, 1)) readRDFFile(url, NULL, 1);
|
if (ntr) return ntr;
|
||||||
return gRemoteStore;
|
ntr = (RDFT)getMem(sizeof(struct RDF_TranslatorStruct));
|
||||||
|
ntr->assert = NULL;
|
||||||
|
ntr->unassert = NULL;
|
||||||
|
ntr->getSlotValue = remoteStoreGetSlotValue;
|
||||||
|
ntr->getSlotValues = remoteStoreGetSlotValues;
|
||||||
|
ntr->hasAssertion = remoteStoreHasAssertion;
|
||||||
|
ntr->nextValue = remoteStoreNextValue;
|
||||||
|
ntr->disposeCursor = remoteStoreDisposeCursor;
|
||||||
|
ntr->possiblyAccessFile = RDFFilePossiblyAccessFile ;
|
||||||
|
ntr->url = copyString(url);
|
||||||
|
PL_HashTableAdd(RDFFileDBHash, url, ntr);
|
||||||
|
readRDFFile(url, NULL, 1, ntr);
|
||||||
|
return ntr;
|
||||||
} else return NULL;
|
} else return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
PRBool
|
PRBool
|
||||||
asEqual(Assertion as, RDF_Resource u, RDF_Resource s, void* v,
|
asEqual(RDFT r, Assertion as, RDF_Resource u, RDF_Resource s, void* v,
|
||||||
RDF_ValueType type)
|
RDF_ValueType type)
|
||||||
{
|
{
|
||||||
return ((as->u == u) && (as->s == s) && (as->type == type) &&
|
return ((as->db == r) && (as->u == u) && (as->s == s) && (as->type == type) &&
|
||||||
((as->value == v) ||
|
((as->value == v) ||
|
||||||
((type == RDF_STRING_TYPE) && (strcmp(v, as->value) == 0))));
|
((type == RDF_STRING_TYPE) && (strcmp(v, as->value) == 0))));
|
||||||
}
|
}
|
||||||
|
@ -80,7 +100,7 @@ asEqual(Assertion as, RDF_Resource u, RDF_Resource s, void* v,
|
||||||
|
|
||||||
|
|
||||||
Assertion
|
Assertion
|
||||||
makeNewAssertion (RDF_Resource u, RDF_Resource s, void* v,
|
makeNewAssertion (RDFT r, RDF_Resource u, RDF_Resource s, void* v,
|
||||||
RDF_ValueType type, PRBool tv)
|
RDF_ValueType type, PRBool tv)
|
||||||
{
|
{
|
||||||
Assertion newAs = (Assertion) getMem(sizeof(struct RDF_AssertionStruct));
|
Assertion newAs = (Assertion) getMem(sizeof(struct RDF_AssertionStruct));
|
||||||
|
@ -89,6 +109,10 @@ makeNewAssertion (RDF_Resource u, RDF_Resource s, void* v,
|
||||||
newAs->value = v;
|
newAs->value = v;
|
||||||
newAs->type = type;
|
newAs->type = type;
|
||||||
newAs->tv = tv;
|
newAs->tv = tv;
|
||||||
|
newAs->db = r;
|
||||||
|
if (strcmp(r->url, "rdf:history")) {
|
||||||
|
int n = 0;
|
||||||
|
}
|
||||||
return newAs;
|
return newAs;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -127,11 +151,11 @@ remoteStoreAdd (RDFT mcf, RDF_Resource u, RDF_Resource s, void* v,
|
||||||
nextAs = prevAs = u->rarg1;
|
nextAs = prevAs = u->rarg1;
|
||||||
|
|
||||||
while (nextAs != null) {
|
while (nextAs != null) {
|
||||||
if (asEqual(nextAs, u, s, v, type)) return null;
|
if (asEqual(mcf, nextAs, u, s, v, type)) return null;
|
||||||
prevAs = nextAs;
|
prevAs = nextAs;
|
||||||
nextAs = nextAs->next;
|
nextAs = nextAs->next;
|
||||||
}
|
}
|
||||||
newAs = makeNewAssertion(u, s, v, type, tv);
|
newAs = makeNewAssertion(mcf, u, s, v, type, tv);
|
||||||
if (prevAs == null) {
|
if (prevAs == null) {
|
||||||
u->rarg1 = newAs;
|
u->rarg1 = newAs;
|
||||||
} else {
|
} else {
|
||||||
|
@ -163,7 +187,7 @@ remoteStoreRemove (RDFT mcf, RDF_Resource u, RDF_Resource s,
|
||||||
PRBool found = false;
|
PRBool found = false;
|
||||||
nextAs = prevAs = u->rarg1;
|
nextAs = prevAs = u->rarg1;
|
||||||
while (nextAs != null) {
|
while (nextAs != null) {
|
||||||
if (asEqual(nextAs, u, s, v, type)) {
|
if (asEqual(mcf, nextAs, u, s, v, type)) {
|
||||||
if (prevAs == null) {
|
if (prevAs == null) {
|
||||||
u->rarg1 = nextAs->next;
|
u->rarg1 = nextAs->next;
|
||||||
} else {
|
} else {
|
||||||
|
@ -198,9 +222,10 @@ remoteStoreRemove (RDFT mcf, RDF_Resource u, RDF_Resource s,
|
||||||
|
|
||||||
|
|
||||||
static PRBool
|
static PRBool
|
||||||
fileReadp (char* url, PRBool mark)
|
fileReadp (RDFT rdf, char* url, PRBool mark)
|
||||||
{
|
{
|
||||||
RDFFile f;
|
RDFFile f;
|
||||||
|
RDFFile rdfFiles = (RDFFile) rdf->pdata;
|
||||||
uint n = 0;
|
uint n = 0;
|
||||||
for (f = rdfFiles; (f != NULL) ; f = f->next) {
|
for (f = rdfFiles; (f != NULL) ; f = f->next) {
|
||||||
if (urlEquals(url, f->url)) {
|
if (urlEquals(url, f->url)) {
|
||||||
|
@ -216,46 +241,32 @@ fileReadp (char* url, PRBool mark)
|
||||||
static void
|
static void
|
||||||
possiblyAccessFile (RDFT mcf, RDF_Resource u, RDF_Resource s, PRBool inversep)
|
possiblyAccessFile (RDFT mcf, RDF_Resource u, RDF_Resource s, PRBool inversep)
|
||||||
{
|
{
|
||||||
if ((s == gCoreVocab->RDF_parent) && inversep &&
|
if (mcf->possiblyAccessFile) (*(mcf->possiblyAccessFile))(mcf, u, s, inversep);
|
||||||
((u == gNavCenter->RDF_HistoryByDate) || (u == gNavCenter->RDF_HistoryBySite))) {
|
}
|
||||||
collateHistory(mcf->rdf->rdf, u, (u == gNavCenter->RDF_HistoryByDate));
|
|
||||||
} else if ((resourceType(u) == RDF_RT) &&
|
void RDFFilePossiblyAccessFile (RDFT rdf, RDF_Resource u, RDF_Resource s, PRBool inversep) {
|
||||||
(s == gCoreVocab->RDF_parent) && (containerp(u)) && (strstr(resourceID(u), ":/") !=NULL)
|
if ((resourceType(u) == RDF_RT) && (strstr(rdf->url, ".rdf") || strstr(rdf->url, ".mcf")) &&
|
||||||
&& (!fileReadp(resourceID(u), true))) {
|
(strstr(resourceID(u), ".rdf") || strstr(resourceID(u), ".mcf")) &&
|
||||||
RDFFile newFile = readRDFFile( resourceID(u), u, false);
|
(s == gCoreVocab->RDF_parent) && (containerp(u))) {
|
||||||
|
RDFFile newFile = readRDFFile( resourceID(u), u, false, rdf);
|
||||||
if(newFile) newFile->lastReadTime = PR_Now();
|
if(newFile) newFile->lastReadTime = PR_Now();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
PRBool
|
|
||||||
remoteStoreHasAssertionInt (RDFT mcf, RDF_Resource u, RDF_Resource s, void* v, RDF_ValueType type, PRBool tv)
|
|
||||||
{
|
|
||||||
Assertion nextAs;
|
|
||||||
nextAs = u->rarg1;
|
|
||||||
while (nextAs != null) {
|
|
||||||
if (asEqual(nextAs, u, s, v, type) && (nextAs->tv == tv)) return true;
|
|
||||||
nextAs = nextAs->next;
|
|
||||||
}
|
|
||||||
possiblyAccessFile(mcf, u, s, 0);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
PRBool
|
PRBool
|
||||||
remoteStoreHasAssertion (RDFT mcf, RDF_Resource u, RDF_Resource s, void* v, RDF_ValueType type, PRBool tv)
|
remoteStoreHasAssertion (RDFT mcf, RDF_Resource u, RDF_Resource s, void* v, RDF_ValueType type, PRBool tv)
|
||||||
{
|
{
|
||||||
if (!((s == gCoreVocab->RDF_parent) &&
|
Assertion nextAs;
|
||||||
(type == RDF_RESOURCE_TYPE) &&
|
nextAs = u->rarg1;
|
||||||
((resourceType((RDF_Resource)v) == HISTORY_RT) ||
|
while (nextAs != null) {
|
||||||
(resourceType((RDF_Resource)v) == ES_RT) ||
|
if (asEqual(mcf, nextAs, u, s, v, type) && (nextAs->tv == tv)) return true;
|
||||||
(resourceType((RDF_Resource)v) == FTP_RT)))) {
|
nextAs = nextAs->next;
|
||||||
return remoteStoreHasAssertionInt(mcf, u, s, v, type, tv);
|
|
||||||
} else {
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
possiblyAccessFile(mcf, u, s, 0);
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -266,7 +277,7 @@ remoteStoreGetSlotValue (RDFT mcf, RDF_Resource u, RDF_Resource s, RDF_ValueType
|
||||||
Assertion nextAs;
|
Assertion nextAs;
|
||||||
nextAs = (inversep ? u->rarg2 : u->rarg1);
|
nextAs = (inversep ? u->rarg2 : u->rarg1);
|
||||||
while (nextAs != null) {
|
while (nextAs != null) {
|
||||||
if ((nextAs->s == s) && (nextAs->tv == tv) && (nextAs->type == type)) {
|
if ((nextAs->db == mcf) && (nextAs->s == s) && (nextAs->tv == tv) && (nextAs->type == type)) {
|
||||||
void* ans = (inversep ? nextAs->u : nextAs->value);
|
void* ans = (inversep ? nextAs->u : nextAs->value);
|
||||||
if (type == RDF_STRING_TYPE) {
|
if (type == RDF_STRING_TYPE) {
|
||||||
#ifdef DEBUG_RDF_GetSlotValue_Memory_Needs_Freedom
|
#ifdef DEBUG_RDF_GetSlotValue_Memory_Needs_Freedom
|
||||||
|
@ -310,7 +321,7 @@ remoteStoreGetSlotValuesInt (RDFT mcf, RDF_Resource u, RDF_Resource s, RDF_Value
|
||||||
RDF_Cursor
|
RDF_Cursor
|
||||||
remoteStoreGetSlotValues (RDFT mcf, RDF_Resource u, RDF_Resource s, RDF_ValueType type, PRBool inversep, PRBool tv)
|
remoteStoreGetSlotValues (RDFT mcf, RDF_Resource u, RDF_Resource s, RDF_ValueType type, PRBool inversep, PRBool tv)
|
||||||
{
|
{
|
||||||
if (resourceType(u) == HISTORY_RT) return NULL;
|
|
||||||
return remoteStoreGetSlotValuesInt(mcf, u, s, type, inversep, tv);
|
return remoteStoreGetSlotValuesInt(mcf, u, s, type, inversep, tv);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -321,7 +332,7 @@ remoteStoreNextValue (RDFT mcf, RDF_Cursor c)
|
||||||
{
|
{
|
||||||
while (c->pdata != null) {
|
while (c->pdata != null) {
|
||||||
Assertion as = (Assertion) c->pdata;
|
Assertion as = (Assertion) c->pdata;
|
||||||
if ((as->s == c->s) && (as->tv == c->tv) && (c->type == as->type)) {
|
if ((as->db == mcf) && (as->s == c->s) && (as->tv == c->tv) && (c->type == as->type)) {
|
||||||
if (c->s == gCoreVocab->RDF_slotsHere) {
|
if (c->s == gCoreVocab->RDF_slotsHere) {
|
||||||
c->value = as->s;
|
c->value = as->s;
|
||||||
} else {
|
} else {
|
||||||
|
@ -377,14 +388,12 @@ void
|
||||||
gcRDFFile (RDFFile f)
|
gcRDFFile (RDFFile f)
|
||||||
{
|
{
|
||||||
int16 n = 0;
|
int16 n = 0;
|
||||||
RDFFile f1;
|
RDFFile f1 = (RDFFile) f->db->pdata;
|
||||||
|
|
||||||
f1 = rdfFiles;
|
|
||||||
|
|
||||||
if (f->locked) return;
|
if (f->locked) return;
|
||||||
|
|
||||||
if (f == f1) {
|
if (f == f1) {
|
||||||
rdfFiles = f->next;
|
f->db->pdata = f->next;
|
||||||
} else {
|
} else {
|
||||||
RDFFile prev = f1;
|
RDFFile prev = f1;
|
||||||
while (f1 != NULL) {
|
while (f1 != NULL) {
|
||||||
|
@ -399,7 +408,7 @@ gcRDFFile (RDFFile f)
|
||||||
|
|
||||||
while (n < f->assertionCount) {
|
while (n < f->assertionCount) {
|
||||||
Assertion as = *(f->assertionList + n);
|
Assertion as = *(f->assertionList + n);
|
||||||
remoteStoreRemove(gRemoteStore, as->u, as->s, as->value, as->type);
|
remoteStoreRemove(f->db, as->u, as->s, as->value, as->type);
|
||||||
freeAssertion(as);
|
freeAssertion(as);
|
||||||
*(f->assertionList + n) = NULL;
|
*(f->assertionList + n) = NULL;
|
||||||
n++;
|
n++;
|
||||||
|
@ -432,16 +441,19 @@ freeSomeRDFSpace (RDF mcf)
|
||||||
|
|
||||||
|
|
||||||
RDFFile
|
RDFFile
|
||||||
readRDFFile (char* url, RDF_Resource top, PRBool localp)
|
readRDFFile (char* url, RDF_Resource top, PRBool localp, RDFT db)
|
||||||
{
|
{
|
||||||
RDFFile newFile = makeRDFFile(url, top, localp);
|
if ((!strstr(url, ":/")) ||
|
||||||
if (rdfFiles) {
|
(fileReadp(db, url, true))) {
|
||||||
newFile->next = rdfFiles;
|
return NULL;
|
||||||
rdfFiles = newFile;
|
|
||||||
} else {
|
} else {
|
||||||
rdfFiles = newFile;
|
RDFFile newFile = makeRDFFile(url, top, localp);
|
||||||
|
if (db->pdata) {
|
||||||
|
newFile->next = (RDFFile) db->pdata;
|
||||||
|
db->pdata = newFile;
|
||||||
|
} else {
|
||||||
|
db->pdata = (RDFFile) newFile;
|
||||||
}
|
}
|
||||||
newFile->db = gRemoteStore;
|
|
||||||
newFile->assert = remoteAssert3;
|
newFile->assert = remoteAssert3;
|
||||||
if (top) {
|
if (top) {
|
||||||
if (resourceType(top) == RDF_RT) {
|
if (resourceType(top) == RDF_RT) {
|
||||||
|
@ -454,16 +466,18 @@ readRDFFile (char* url, RDF_Resource top, PRBool localp)
|
||||||
newFile->fileType = resourceType(top);
|
newFile->fileType = resourceType(top);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
newFile->db = db;
|
||||||
beginReadingRDFFile(newFile);
|
beginReadingRDFFile(newFile);
|
||||||
return newFile;
|
return newFile;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
possiblyRefreshRDFFiles ()
|
possiblyRefreshRDFFiles ()
|
||||||
{
|
{
|
||||||
RDFFile f = rdfFiles;
|
RDFFile f = (RDFFile)gRemoteStore->pdata;
|
||||||
PRTime tm = PR_Now();
|
PRTime tm = PR_Now();
|
||||||
while (f != NULL) {
|
while (f != NULL) {
|
||||||
if (f->expiryTime != NULL) {
|
if (f->expiryTime != NULL) {
|
||||||
|
@ -474,7 +488,7 @@ possiblyRefreshRDFFiles ()
|
||||||
int64 result;
|
int64 result;
|
||||||
LL_SUB(result, tm, *expiry);
|
LL_SUB(result, tm, *expiry);
|
||||||
if ((!LL_IS_ZERO(result) && LL_GE_ZERO(result)))
|
if ((!LL_IS_ZERO(result) && LL_GE_ZERO(result)))
|
||||||
#endif /* !HAVE_LONG_LONG */
|
#endif
|
||||||
{
|
{
|
||||||
gcRDFFile (f);
|
gcRDFFile (f);
|
||||||
initRDFFile(f);
|
initRDFFile(f);
|
||||||
|
@ -483,5 +497,37 @@ possiblyRefreshRDFFiles ()
|
||||||
}
|
}
|
||||||
f = f->next;
|
f = f->next;
|
||||||
}
|
}
|
||||||
/* flushBookmarks(); */
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void SCookPossiblyAccessFile (RDFT rdf, RDF_Resource u, RDF_Resource s, PRBool inversep) {
|
||||||
|
if ((resourceType(u) == RDF_RT) && (strcmp(rdf->url, "rdf:ht") ==0) &&
|
||||||
|
(strstr(resourceID(u), ".rdf") || strstr(resourceID(u), ".mcf")) &&
|
||||||
|
(s == gCoreVocab->RDF_parent) &&
|
||||||
|
(containerp(u))) {
|
||||||
|
RDFFile newFile = readRDFFile( resourceID(u), u, false, rdf);
|
||||||
|
if(newFile) newFile->lastReadTime = PR_Now();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
RDFT
|
||||||
|
MakeSCookDB (char* url)
|
||||||
|
{
|
||||||
|
if (startsWith("rdf:scook:", url) || (startsWith("rdf:ht", url))) {
|
||||||
|
RDFT ntr = (RDFT)getMem(sizeof(struct RDF_TranslatorStruct));
|
||||||
|
ntr->assert = NULL;
|
||||||
|
ntr->unassert = NULL;
|
||||||
|
ntr->getSlotValue = remoteStoreGetSlotValue;
|
||||||
|
ntr->getSlotValues = remoteStoreGetSlotValues;
|
||||||
|
ntr->hasAssertion = remoteStoreHasAssertion;
|
||||||
|
ntr->nextValue = remoteStoreNextValue;
|
||||||
|
ntr->disposeCursor = remoteStoreDisposeCursor;
|
||||||
|
ntr->possiblyAccessFile = RDFFilePossiblyAccessFile ;
|
||||||
|
ntr->url = copyString(url);
|
||||||
|
return ntr;
|
||||||
|
} else return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -41,8 +41,6 @@ XP_BEGIN_PROTOS
|
||||||
|
|
||||||
RDFT MakeRemoteStore (char* url);
|
RDFT MakeRemoteStore (char* url);
|
||||||
RDFT MakeFileDB (char* url);
|
RDFT MakeFileDB (char* url);
|
||||||
PRBool asEqual(Assertion as, RDF_Resource u, RDF_Resource s, void* v, RDF_ValueType type);
|
|
||||||
Assertion makeNewAssertion (RDF_Resource u, RDF_Resource s, void* v, RDF_ValueType type, PRBool tv);
|
|
||||||
void freeAssertion (Assertion as);
|
void freeAssertion (Assertion as);
|
||||||
PRBool remoteAssert3 (RDFFile fi, RDFT mcf, RDF_Resource u, RDF_Resource s, void* v, RDF_ValueType type, PRBool tv);
|
PRBool remoteAssert3 (RDFFile fi, RDFT mcf, RDF_Resource u, RDF_Resource s, void* v, RDF_ValueType type, PRBool tv);
|
||||||
Assertion remoteStoreAdd (RDFT mcf, RDF_Resource u, RDF_Resource s, void* v, RDF_ValueType type, PRBool tv);
|
Assertion remoteStoreAdd (RDFT mcf, RDF_Resource u, RDF_Resource s, void* v, RDF_ValueType type, PRBool tv);
|
||||||
|
@ -56,10 +54,10 @@ RDF_Cursor remoteStoreGetSlotValues (RDFT mcf, RDF_Resource u, RDF_Resource s, R
|
||||||
void * remoteStoreNextValue (RDFT mcf, RDF_Cursor c);
|
void * remoteStoreNextValue (RDFT mcf, RDF_Cursor c);
|
||||||
RDF_Error remoteStoreDisposeCursor (RDFT mcf, RDF_Cursor c);
|
RDF_Error remoteStoreDisposeCursor (RDFT mcf, RDF_Cursor c);
|
||||||
void gcRDFFile (RDFFile f);
|
void gcRDFFile (RDFFile f);
|
||||||
RDFFile readRDFFile (char* url, RDF_Resource top, PRBool localp);
|
void RDFFilePossiblyAccessFile (RDFT rdf, RDF_Resource u, RDF_Resource s, PRBool inversep) ;
|
||||||
void possiblyRefreshRDFFiles ();
|
void possiblyRefreshRDFFiles ();
|
||||||
|
|
||||||
static PRBool fileReadp (char* url, PRBool mark);
|
static PRBool fileReadp (RDFT rdf, char* url, PRBool mark);
|
||||||
static void possiblyAccessFile (RDFT mcf, RDF_Resource u, RDF_Resource s, PRBool inversep);
|
static void possiblyAccessFile (RDFT mcf, RDF_Resource u, RDF_Resource s, PRBool inversep);
|
||||||
static RDFFile leastRecentlyUsedRDFFile (RDF mcf);
|
static RDFFile leastRecentlyUsedRDFFile (RDF mcf);
|
||||||
static PRBool freeSomeRDFSpace (RDF mcf);
|
static PRBool freeSomeRDFSpace (RDF mcf);
|
||||||
|
|
|
@ -99,11 +99,11 @@ SCookAssert (RDFT mcf, RDF_Resource u, RDF_Resource s, void* v,
|
||||||
Assertion nextAs, prevAs, newAs;
|
Assertion nextAs, prevAs, newAs;
|
||||||
nextAs = prevAs = getArg1(mcf, u);
|
nextAs = prevAs = getArg1(mcf, u);
|
||||||
while (nextAs != null) {
|
while (nextAs != null) {
|
||||||
if (asEqual(nextAs, u, s, v, type)) return null;
|
if (asEqual(mcf, nextAs, u, s, v, type)) return null;
|
||||||
prevAs = nextAs;
|
prevAs = nextAs;
|
||||||
nextAs = nextAs->next;
|
nextAs = nextAs->next;
|
||||||
}
|
}
|
||||||
newAs = makeNewAssertion(u, s, v, type, tv);
|
newAs = makeNewAssertion(mcf, u, s, v, type, tv);
|
||||||
if (prevAs == null) {
|
if (prevAs == null) {
|
||||||
setArg1(mcf, u, newAs);
|
setArg1(mcf, u, newAs);
|
||||||
} else {
|
} else {
|
||||||
|
@ -147,7 +147,7 @@ SCookRemove (RDFT mcf, RDF_Resource u, RDF_Resource s,
|
||||||
PRBool found = false;
|
PRBool found = false;
|
||||||
nextAs = prevAs = getArg1(mcf, u);
|
nextAs = prevAs = getArg1(mcf, u);
|
||||||
while (nextAs != null) {
|
while (nextAs != null) {
|
||||||
if (asEqual(nextAs, u, s, v, type)) {
|
if (asEqual(mcf, nextAs, u, s, v, type)) {
|
||||||
if (prevAs == nextAs) {
|
if (prevAs == nextAs) {
|
||||||
setArg1(mcf, u, nextAs->next);
|
setArg1(mcf, u, nextAs->next);
|
||||||
} else {
|
} else {
|
||||||
|
@ -189,7 +189,7 @@ SCookHasAssertion (RDFT mcf, RDF_Resource u, RDF_Resource s, void* v, RDF_ValueT
|
||||||
Assertion nextAs;
|
Assertion nextAs;
|
||||||
nextAs = getArg1(mcf, u);
|
nextAs = getArg1(mcf, u);
|
||||||
while (nextAs != null) {
|
while (nextAs != null) {
|
||||||
if (asEqual(nextAs, u, s, v, type) && (nextAs->tv == tv)) return true;
|
if (asEqual(mcf, nextAs, u, s, v, type) && (nextAs->tv == tv)) return true;
|
||||||
nextAs = nextAs->next;
|
nextAs = nextAs->next;
|
||||||
}
|
}
|
||||||
possiblyAccessSCookFile(mcf, u, s, 0);
|
possiblyAccessSCookFile(mcf, u, s, 0);
|
||||||
|
@ -410,32 +410,30 @@ possiblyAccessSCookFile (RDFT mcf, RDF_Resource u, RDF_Resource s, PRBool invers
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SCookPossiblyAccessFile1 (RDFT rdf, RDF_Resource u, RDF_Resource s, PRBool inversep) {
|
||||||
|
if ((resourceType(u) == RDF_RT) && (strcmp(rdf->url, "rdf:ht") ==0) &&
|
||||||
|
(strstr(resourceID(u), ".rdf") || strstr(resourceID(u), ".mcf")) &&
|
||||||
|
(s == gCoreVocab->RDF_parent) &&
|
||||||
|
(containerp(u))) {
|
||||||
|
RDFFile newFile = readRDFFile( resourceID(u), u, false, rdf);
|
||||||
|
if(newFile) newFile->lastReadTime = PR_Now();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
RDFT
|
RDFT
|
||||||
MakeSCookDB (char* url)
|
MakeSCookDB1 (char* url)
|
||||||
{
|
{
|
||||||
if (startsWith("rdf:scook:", url) || (startsWith("rdf:ht", url))) {
|
if (startsWith("rdf:scook:", url) || (startsWith("rdf:ht", url))) {
|
||||||
RDFT ntr = (RDFT)getMem(sizeof(struct RDF_TranslatorStruct));
|
RDFT ntr = (RDFT)getMem(sizeof(struct RDF_TranslatorStruct));
|
||||||
SCookDB sk = (SCookDB)getMem(sizeof(SCookDBStruct));
|
ntr->assert = NULL;
|
||||||
ntr->pdata = sk;
|
ntr->unassert = NULL;
|
||||||
sk->db = ntr;
|
ntr->getSlotValue = remoteStoreGetSlotValue;
|
||||||
sk->lhash = PL_NewHashTable(500, idenHash, PL_CompareValues, PL_CompareValues, NULL, NULL);
|
ntr->getSlotValues = remoteStoreGetSlotValues;
|
||||||
sk->rhash = PL_NewHashTable(500, idenHash, PL_CompareValues, PL_CompareValues, NULL, NULL);
|
ntr->hasAssertion = remoteStoreHasAssertion;
|
||||||
ntr->assert = (startsWith("rdf:scook", url) ? SCookAssert3 : SCookAssert1);
|
ntr->nextValue = remoteStoreNextValue;
|
||||||
ntr->unassert = SCookUnassert;
|
ntr->disposeCursor = remoteStoreDisposeCursor;
|
||||||
ntr->getSlotValue = SCookGetSlotValue;
|
ntr->possiblyAccessFile = RDFFilePossiblyAccessFile ;
|
||||||
ntr->getSlotValues = SCookGetSlotValues;
|
|
||||||
ntr->hasAssertion = SCookHasAssertion;
|
|
||||||
ntr->nextValue = SCookNextValue;
|
|
||||||
ntr->disposeCursor = SCookDisposeCursor;
|
|
||||||
if (startsWith("rdf:scook:", url)) {
|
|
||||||
sk->rf = makeRDFFile(makeSCookPathname(&url[10]), NULL, 0);
|
|
||||||
sk->rf->db = (RDFT)ntr;
|
|
||||||
sk->rf->assert = SCookAssert2;
|
|
||||||
sk->rf->localp = 1;
|
|
||||||
beginReadingRDFFile(sk->rf);
|
|
||||||
}
|
|
||||||
ntr->url = copyString(url);
|
ntr->url = copyString(url);
|
||||||
return ntr;
|
return ntr;
|
||||||
} else return NULL;
|
} else return NULL;
|
||||||
|
|
Загрузка…
Ссылка в новой задаче