Diff for /Amaya/amaya/AHTBridge.c between versions 1.9 and 1.10

version 1.9, 1996/12/25 13:09:09 version 1.10, 1996/12/27 08:16:25
Line 15 Line 15
  *      the Xt, libwww, and Amaya procedures   *      the Xt, libwww, and Amaya procedures
  *   *
  * History:   * History:
  *      May 02 96 JK    First semi-stable version, Jose Kahan   *
  *      June 01 96 JK   First almost-complete version, Jose Kahan   
  */   */
   
 /* Unix/C/X */  #define EXPORT extern
 #include "thot_gui.h"  
 #include "thot_sys.h"  
 #include "message.h"  
 #include "dialog.h"  
 #include "application.h"  
 #include "content.h"  
 #include "view.h"  
 #include "interface.h"  
 #include "amaya.h"  #include "amaya.h"
   #include "AHTBridge_f.h"
 #if 0  #include "AHTFWrite_f.h"
 #include "AHTCommon.h"  #include "query_f.h"
 #include "query.h"  #include "answer_f.h"
 #endif  
   
 #include "AHTBridge.h"          /* implemented here */  
   
 #ifdef WWW_XWINDOWS  #ifdef WWW_XWINDOWS
 /* Amaya's X appcontext */  /* Amaya's X appcontext */
Line 45  extern XtAppContext app_cont; Line 33  extern XtAppContext app_cont;
   
   
 #ifndef HACK_WWW  #ifndef HACK_WWW
 extern PUBLIC HTEventCallback *HTEvent_Retrieve (SOCKET, SockOps, HTRequest ** arp);  extern  HTEventCallback *HTEvent_Retrieve (SOCKET, SockOps, HTRequest ** arp);
   
 #endif  #endif
   
Line 76  static void         RequestKillExceptXte Line 64  static void         RequestKillExceptXte
  * if the connection has been closed, the socket will appear readable under   * if the connection has been closed, the socket will appear readable under
  * BSD Unix semantics    * BSD Unix semantics 
  */   */
 PRIVATE const SockOps ReadBits = FD_READ | FD_ACCEPT | FD_CLOSE;  static const SockOps ReadBits = FD_READ | FD_ACCEPT | FD_CLOSE;
 PRIVATE const SockOps WriteBits = FD_WRITE | FD_CONNECT;  static const SockOps WriteBits = FD_WRITE | FD_CONNECT;
 PRIVATE const SockOps ExceptBits = FD_OOB;  static const SockOps ExceptBits = FD_OOB;
   
 /*  /*
  * Private functions   * Private functions
  */   */
   
 /*  /*--------------------------------------------------------------------
  * Callback that acts as a bridge between X and wwwlib.    AHTCallback_bridge
  * This function is equivalent to the library's __DoCallback()    Callback that acts as a bridge between X and wwwlib.
  * function, but with a different API, to conform to Xt's event loop    This function is equivalent to the library's __DoCallback()
  * specifications. For more info, cf. the library's HTEvntrg.c module.    function, but with a different API, to conform to Xt's event loop
  */    specifications. For more info, cf. the library's HTEvntrg.c module.
     -------------------------------------------------------------------*/
   
 #ifdef WWW_XWINDOWS  
 #ifdef __STDC__  #ifdef __STDC__
 XtInputCallbackProc AHTCallback_bridge (caddr_t cd, int *s, XtInputId * id)  XtInputCallbackProc AHTCallback_bridge (caddr_t cd, int *s, XtInputId * id)
 #else  #else
Line 99  XtInputCallbackProc AHTCallback_bridge ( Line 87  XtInputCallbackProc AHTCallback_bridge (
 caddr_t             cd;  caddr_t             cd;
 int                *s;  int                *s;
 XtInputId          *id;  XtInputId          *id;
   
 #endif /* __STDC__ */  #endif /* __STDC__ */
   /** JK: 26/Dec/96: Took out this code as Cextract has problems to
 #else  /* WWW_XWINDOWS */  generate a prototype when there are 2 imbricated ifdefs. ***/
   #ifdef 0
   /* Windows prototype */
 /* some winproc someday? */  /* some winproc someday? */
 LONG                AHTCallback_bridge (caddr_t cd, int *s)  LONG                AHTCallback_bridge (caddr_t cd, int *s)
 #endif                          /* !WWW_XWINDOWS */  #endif                          /* !WWW_XWINDOWS */
Line 111  LONG                AHTCallback_bridge ( Line 100  LONG                AHTCallback_bridge (
    HTRequest          *rqp = NULL;     HTRequest          *rqp = NULL;
    AHTReqContext      *me;     AHTReqContext      *me;
    SOCKET              sock;     SOCKET              sock;
    SockOps             ops;     /* what value goes here ? Ask eric */     SockOps             ops=0;   
   
    /* Libwww 4.1 does not take into account the third parameter     /* Libwww 5.0a does not take into account the ops parameter
       for this function call */        for this function call */
   
 #ifdef HACK_WWW  #ifdef HACK_WWW
Line 125  LONG                AHTCallback_bridge ( Line 114  LONG                AHTCallback_bridge (
 #endif  #endif
    me = HTRequest_context (rqp);     me = HTRequest_context (rqp);
   
 #if 0  
    switch ((XtInputId) cd)  
          {  
             case XtInputReadMask:  
                ops = me->read_ops;  
                if (me->read_xtinput_id)  
                  {  
                     XtRemoveInput (me->read_xtinput_id);  
                     if (THD_TRACE)  
                        fprintf (stderr, "(BT) removing Xtinput %lu R (AHTBridge before cbf), sock %d\n", me->read_xtinput_id, *s);  
                     me->read_xtinput_id = 0;  
                  }  
                break;  
             case XtInputWriteMask:  
                ops = me->write_ops;  
                if (me->write_xtinput_id)  
                  {  
                     XtRemoveInput (me->write_xtinput_id);  
                     if (THD_TRACE)  
                        fprintf (stderr, "(BT) removing Xtinput %lu W (AHTBridge before cbf), sock %d\n", me->write_xtinput_id, *s);  
                     me->write_xtinput_id = 0;  
                  }  
                break;  
             case XtInputExceptMask:  
                ops = me->except_ops;  
                if (me->except_xtinput_id)  
                  {  
                     XtRemoveInput (me->except_xtinput_id);  
                     if (THD_TRACE)  
                        fprintf (stderr, "(BT) removing Xtinput %lu E (AHTBridge before cbf), sock %d\n", me->except_xtinput_id, *s);  
                     me->except_xtinput_id = 0;  
                  }  
                break;  
          }                      /* switch */  
 #endif  
   
    if (THD_TRACE)     if (THD_TRACE)
       fprintf (stderr, "AHTBridge: Processing url %s \n", me->urlName);       fprintf (stderr, "AHTBridge: Processing url %s \n", me->urlName);
   
   
 #ifdef WWW_XWINDOWS  #ifdef WWW_XWINDOWS
Line 257  LONG                AHTCallback_bridge ( Line 210  LONG                AHTCallback_bridge (
         return (0);          return (0);
      }       }
   
   
    /* verify if the request is still alive !! */     /* verify if the request is still alive !! */
   
    if ((me->request->net == (HTNet *) NULL) || (me->reqStatus == HT_END || me->reqStatus == HT_ERR))     if ((me->request->net == (HTNet *) NULL) || (me->reqStatus == HT_END || me->reqStatus == HT_ERR))
Line 281  LONG                AHTCallback_bridge ( Line 233  LONG                AHTCallback_bridge (
 }  }
   
   
 /*   /*----------------------------------------------------------------
  * This function is called whenever a socket is available    Add_NewSocket_to_Loop
  * for a request. It  the necessary events to the Xt    This function is called whenever a socket is available
  * A small interface to the HTLoadAnchor libwww function.    for a request. It prepares Xt to handle the
  * It prepares Xt to handle the asynchronous data requests.    asynchronous data requests.
  */    ----------------------------------------------------------------*/
   
 #ifdef __STDC__  #ifdef __STDC__
 int                 Add_NewSocket_to_Loop (HTRequest * request, HTAlertOpcode op, int msgnum, const char *dfault, void *input, HTAlertPar * reply)  int                 Add_NewSocket_to_Loop (HTRequest * request, HTAlertOpcode op, int msgnum, const char *dfault, void *input, HTAlertPar * reply)
 #else  #else
Line 304  HTAlertPar         *reply; Line 255  HTAlertPar         *reply;
    SOCKET              req_socket;     SOCKET              req_socket;
    AHTReqContext      *me = HTRequest_context (request);     AHTReqContext      *me = HTRequest_context (request);
   
    /* AmayaOpenRequests *reqState; */  
   
    if (me->reqStatus == HT_NEW_PENDING)     if (me->reqStatus == HT_NEW_PENDING)
      {       {
         /* we are opening a pending request */          /* we are opening a pending request */
Line 330  HTAlertPar         *reply; Line 279  HTAlertPar         *reply;
   
    /* reusing this function to save on file descriptors */     /* reusing this function to save on file descriptors */
   
   
    return (HT_OK);     return (HT_OK);
   
     /***  
     if(me->method == METHOD_PUT || me->method == METHOD_POST)  
         return (HT_OK);  
     ***/  
   
    /* get the socket number associated to the request */     /* get the socket number associated to the request */
   
    req_socket = HTNet_socket (request->net);     req_socket = HTNet_socket (request->net);
Line 366  HTAlertPar         *reply; Line 309  HTAlertPar         *reply;
      }       }
   
 #endif /* WWW_XWINDOWS */  #endif /* WWW_XWINDOWS */
    /* To speed up the stop performances, we move the active requests to the top of the Amaya list */  
   
    /*  
       reqState  = DocRequestState(Amaya->open_requests, me->docid);  
   
       if(reqState->counter > 1) {  
       HTList_removeObject (Amaya->reqlist, (void *) me);  
       HTList_addObject (Amaya->reqlist, (void *) me);  
       }  
     */  
    return (HT_OK);     return (HT_OK);
 }  }
   

Removed from v.1.9  
changed lines
  Added in v.1.10


Webmaster