version 1.139, 1998/09/20 23:26:59
|
version 1.140, 1998/09/21 04:58:37
|
Line 31
|
Line 31
|
#include "amaya.h" |
#include "amaya.h" |
#include <sys/types.h> |
#include <sys/types.h> |
#include <fcntl.h> |
#include <fcntl.h> |
|
#include "HTEvtLst.h" |
|
|
#if defined(__svr4__) |
#if defined(__svr4__) |
#define CATCH_SIG |
#define CATCH_SIG |
Line 73 static HTList *converters = NULL; /
|
Line 74 static HTList *converters = NULL; /
|
static HTList *acceptTypes = NULL; /* List of types for the Accept header */ |
static HTList *acceptTypes = NULL; /* List of types for the Accept header */ |
static HTList *encodings = NULL; |
static HTList *encodings = NULL; |
static int object_counter = 0; /* loaded objects counter */ |
static int object_counter = 0; /* loaded objects counter */ |
static boolean AmayaAlive; /* set to 1 if the application is active; |
static boolean AmayaAlive_flag; /* set to 1 if the application is active; |
0 if we have killed */ |
0 if we have killed */ |
|
static boolean CanDoStop_flag; /* set to 1 if we can do a stop, 0 |
|
if we're inside a critical section */ |
#ifdef AMAYA_WWW_CACHE |
#ifdef AMAYA_WWW_CACHE |
static int fd_cachelock; /* open handle to the .lock cache file */ |
static int fd_cachelock; /* open handle to the .lock cache file */ |
#endif /* AMAYA_WWW_CACHE */ |
#endif /* AMAYA_WWW_CACHE */ |
Line 521 static void Thread_deleteAll ()
|
Line 524 static void Thread_deleteAll ()
|
RequestKillAllXtevents (me); |
RequestKillAllXtevents (me); |
#endif /* !_WINDOWS */ |
#endif /* !_WINDOWS */ |
|
|
if (me->request->net) |
if (!HTRequest_kill (me->request)) |
HTRequest_kill (me->request); |
AHTReqContext_delete (me); |
#ifndef _WINDOWS |
|
AHTReqContext_delete (me); |
|
#endif /* _WINDOWS */ |
|
} |
} |
} /* while */ |
} /* while */ |
|
|
Line 890 int status;
|
Line 890 int status;
|
} |
} |
|
|
/* to avoid a hangup while downloading css files */ |
/* to avoid a hangup while downloading css files */ |
if (AmayaAlive && (me->mode & AMAYA_LOAD_CSS)) |
if (AmayaAlive_flag && (me->mode & AMAYA_LOAD_CSS)) |
TtaSetStatus (me->docid, 1, |
TtaSetStatus (me->docid, 1, |
TtaGetMessage (AMAYA, AM_ELEMENT_LOADED), |
TtaGetMessage (AMAYA, AM_ELEMENT_LOADED), |
me->status_urlName); |
me->status_urlName); |
Line 931 int status;
|
Line 931 int status;
|
HTAlertCallback *cbf; |
HTAlertCallback *cbf; |
AHTDocId_Status *docid_status; |
AHTDocId_Status *docid_status; |
|
|
#ifdef _WINDOWS |
|
/* @@@ I have problems with the trace variables under windows */ |
|
return HT_OK; |
|
#endif /* _WINDOWS */ |
|
|
|
switch (status) |
switch (status) |
{ |
{ |
case HT_LOADED: |
case HT_LOADED: |
Line 1689 static void AmayaContextI
|
Line 1684 static void AmayaContextI
|
#endif |
#endif |
|
|
{ |
{ |
AmayaAlive = TRUE; |
AmayaAlive_flag = TRUE; |
/* Initialization of the global context */ |
/* Initialization of the global context */ |
Amaya = (AmayaContext *) TtaGetMemory (sizeof (AmayaContext)); |
Amaya = (AmayaContext *) TtaGetMemory (sizeof (AmayaContext)); |
Amaya->reqlist = HTList_new (); |
Amaya->reqlist = HTList_new (); |
Line 1710 void QueryInit ()
|
Line 1705 void QueryInit ()
|
|
|
AmayaContextInit (); |
AmayaContextInit (); |
AHTProfile_newAmaya (HTAppName, HTAppVersion); |
AHTProfile_newAmaya (HTAppName, HTAppVersion); |
libDoStop = 1; |
CanDoStop_set (TRUE); |
|
|
#ifdef _WINDOWS |
#ifdef _WINDOWS |
/*** AHTEventInit (); this was the call to my AHTEvent module HTEvtLst today***/ |
/*** AHTEventInit (); this was the call to my AHTEvent module HTEvtLst today***/ |
Line 1839 static int LoopForStop (AHTReqC
|
Line 1834 static int LoopForStop (AHTReqC
|
void QueryClose () |
void QueryClose () |
{ |
{ |
|
|
AmayaAlive = FALSE; |
AmayaAlive_flag = FALSE; |
|
|
/* remove all the handlers and callbacks that may output a message to |
/* remove all the handlers and callbacks that may output a message to |
a non-existent Amaya window */ |
a non-existent Amaya window */ |
Line 2241 char *content_type;
|
Line 2236 char *content_type;
|
|
|
/* @@@ may need some special windows error msg here */ |
/* @@@ may need some special windows error msg here */ |
/* control the errors */ |
/* control the errors */ |
/* @@@test the effect of HTRequest_kill () */ |
|
#if 0 |
|
/* doesn't look necessary anymore */ |
|
if (status == NO |
|
&& HTError_hasSeverity (HTRequest_error (me->request), ERR_NON_FATAL)) |
|
status = HT_ERROR; |
|
|
|
/** *this should go to term_d @@@@ */ |
|
if (me->reqStatus == HT_CACHE) |
|
{ |
|
AHTPrintPendingRequestStatus (me->docid, YES); |
|
/* free the memory allocated for async requests */ |
|
InvokeGetObjectWWW_callback (docid, urlName, outputfile, |
|
terminate_cbf, context_tcbf, HT_OK); |
|
AHTReqContext_delete (me); |
|
return HT_OK; |
|
} |
|
#endif |
|
|
|
if (status == NO) |
if (status == NO) |
/* the request invocation failed */ |
/* the request invocation failed */ |
Line 2283 char *content_type;
|
Line 2260 char *content_type;
|
/* wait here untilt the asynchronous request finishes */ |
/* wait here untilt the asynchronous request finishes */ |
status = LoopForStop (me); |
status = LoopForStop (me); |
/* if status returns HT_ERROR, should we invoke the callback? */ |
/* if status returns HT_ERROR, should we invoke the callback? */ |
/* @@@ this doesn't seem correct ... me->request may not exist ... */ |
|
if (!HTRequest_kill (me->request)) |
if (!HTRequest_kill (me->request)) |
AHTReqContext_delete (me); |
AHTReqContext_delete (me); |
} |
} |
Line 2487 void StopRequest (docid)
|
Line 2463 void StopRequest (docid)
|
int docid; |
int docid; |
#endif |
#endif |
{ |
{ |
AHTDocId_Status *docid_status; |
if (Amaya && CanDoStop ()) |
|
|
if (Amaya && libDoStop) |
|
{ |
{ |
#if 0 /* for later */ |
#if 0 /* for later */ |
/* verify if there are any requests at all associated with docid */ |
AHTDocId_Status *docid_status; |
|
/* verify if there are any requests at all associated with docid */ |
docid_status = (AHTDocId_Status *) GetDocIdStatus (docid, |
docid_status = (AHTDocId_Status *) GetDocIdStatus (docid, |
Amaya->docid_status); |
Amaya->docid_status); |
if (docid_status == (AHTDocId_Status *) NULL) |
if (docid_status == (AHTDocId_Status *) NULL) |
Line 2510 int docid;
|
Line 2485 int docid;
|
#ifdef __STDC__ |
#ifdef __STDC__ |
void StopAllRequests (int docid) |
void StopAllRequests (int docid) |
#else |
#else |
void StopRequest (docid) |
void StopAllRequests (docid) |
int docid; |
int docid; |
#endif |
#endif |
{ |
{ |
Line 2519 int docid;
|
Line 2494 int docid;
|
|
|
/* only do the stop if we're not being called while processing a |
/* only do the stop if we're not being called while processing a |
request */ |
request */ |
if (Amaya && libDoStop) |
if (Amaya && CanDoStop ()) |
{ |
{ |
|
|
#ifdef DEBUG_LIBWWW |
#ifdef DEBUG_LIBWWW |
Line 2533 int docid;
|
Line 2508 int docid;
|
cur = Amaya->reqlist; |
cur = Amaya->reqlist; |
while ((me = (AHTReqContext *) HTList_nextObject (cur))) |
while ((me = (AHTReqContext *) HTList_nextObject (cur))) |
{ |
{ |
if (AmayaIsAlive () && me->terminate_cbf) |
if (AmayaIsAlive ()) |
(*me->terminate_cbf) (me->docid, -1, me->urlName, me->outputfile, |
if (me->reqStatus != HT_END) |
me->content_type, me->context_tcbf); |
{ |
if (!HTRequest_kill (me->request)) |
if (me->terminate_cbf) |
AHTReqContext_delete (me); |
(*me->terminate_cbf) (me->docid, -1, me->urlName, |
|
me->outputfile, |
|
me->content_type, me->context_tcbf); |
|
fprintf (stderr,"StopRequest: killing req %p, url %s, status %d\n", me, me->urlName, me->reqStatus); |
|
AHTReqContext_delete (me); |
|
} |
|
/* to be on the safe side, remove all outstanding X events */ |
|
else ( RequestKillAllXtevents (me)); |
} |
} |
|
|
/* Delete remaining channels */ |
/* Delete remaining channels */ |
HTChannel_deleteAll(); |
HTChannel_deleteAll(); |
|
|
#ifdef DEBUG_LIBWWW |
#ifdef DEBUG_LIBWWW |
fprintf (stderr, "StopRequest: number of Amaya requests " |
fprintf (stderr, "StopRequest: number of Amaya requests " |
Line 2553 int docid;
|
Line 2534 int docid;
|
|
|
/*---------------------------------------------------------------------- |
/*---------------------------------------------------------------------- |
AmayaIsAlive |
AmayaIsAlive |
returns the status of the AmayaAlive flag |
returns the value of the AmayaAlive_flag |
----------------------------------------------------------------------*/ |
----------------------------------------------------------------------*/ |
#ifdef __STDC__ |
#ifdef __STDC__ |
boolean AmayaIsAlive (void) |
boolean AmayaIsAlive (void) |
Line 2561 boolean AmayaIsAlive (void)
|
Line 2542 boolean AmayaIsAlive (void)
|
boolean AmayaIsAlive () |
boolean AmayaIsAlive () |
#endif /* _STDC_ */ |
#endif /* _STDC_ */ |
{ |
{ |
return AmayaAlive; |
return AmayaAlive_flag; |
|
} |
|
|
|
/*---------------------------------------------------------------------- |
|
CanDoStop |
|
returns the value of the CanDoStop flag |
|
----------------------------------------------------------------------*/ |
|
#ifdef __STDC__ |
|
boolean CanDoStop (void) |
|
#else |
|
boolean CanDoStop () |
|
#endif /* _STDC_ */ |
|
{ |
|
return CanDoStop_flag; |
|
} |
|
|
|
/*---------------------------------------------------------------------- |
|
CanDoStop_set |
|
sets the value of the CanDoStop flag |
|
----------------------------------------------------------------------*/ |
|
#ifdef __STDC__ |
|
void CanDoStop_set (boolean value) |
|
#else |
|
void CanDoStop (value) |
|
boolean value; |
|
#endif /* _STDC_ */ |
|
{ |
|
CanDoStop_flag = value; |
} |
} |
|
|
#endif /* AMAYA_JAVA */ |
#endif /* AMAYA_JAVA */ |
Line 2571 boolean AmayaIsAlive ()
|
Line 2579 boolean AmayaIsAlive ()
|
*/ |
*/ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|