Artix Nettext v0.6 by Patrick Roberts

-----------------------------------------------------------------------------
Nettext is a set of secondary tools that handle web based text. They can be
qcalled from VP or from called from C with the supplied header file.
-----------------------------------------------------------------------------

NOTE: REQUIRES RICHARD COLLIER'S CLIP TOOLS BE INSTALLED (ftp.amigadev.net)

-----------------------------------------------------------------------------

To intstall:
 
   source INSTALL.sourceme

-----------------------------------------------------------------------------
Tools:
-----------------------------------------------------------------------------

/lib/nettext/bblxlate

  bblxlate takes the text on the clipboard and translates it to the
specified language, and replaces the clipboard text with the translation.
If an error occurs, bblxlate returns >0 and puts error text on the
clipboard instead.

 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

   VP Arguments: p0:i0

   C prototype: int bblxlate(char *langpair);  (#include <artix/nettext.h>)

 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Inputs:

   langpair (p0):  string containing the language pairs.  For example
                   to translate from English to French use "en_fr".
		   See bblgetlang() for a list of supported language
		   pairs.
		   
Return:

      bblxlate returns '0' if no errors occured, otherwise an error number
   below and a description of the error on the clipboard.
   
   	1 = Clipboard doesn't contain CLIP_TXT type data
	2 = Couldn't allocate memory for translation buffer.
        3 = Couldn't allocate memory for transmission buffer
        4 = Couldn't open socket.
        5 = Couldn't connect to host.
        6 = Translation error (possible bad language pair).
	
	
  
-----------------------------------------------------------------------------

/lib/nettext/bblgetpairs

  bblgetpairs returns a list of supported language pairs as a string
separated by spaces.

 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

   VP Arguments: -:P0

   C prototype: char* bbl_getParis();  (#include <artix/nettext.h>)

 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Inputs:

   <none>
		   
Return:

      List of supported language pairs or an error string.  (NOTE:
   Error strings always have their status number in the same place.)


-----------------------------------------------------------------------------

/lib/nettext/bblgetlang

  Returns a int which is actually a null terminated character string which
contains the user's specified default language.

 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

   VP Arguments: -:I0

   C prototype: int bbl_getLang();   (#include <artix/nettext.h>)

 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Inputs:

   <none>
		   
Return:

    Two character user specified default language as an int.  (It can
 be printed with a simple typecast.)


-----------------------------------------------------------------------------

/lib/nettext/b64decode

   Decodes base64 encoded data.
   
 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

   VP Arguments: p0 p1 i0 : i0

   C prototype: int b64Decode(char *intext, char *outbuf, int size);
                (#include <artix/nettext.h>)

 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Inputs:

   intext (p0):  String containing base-64 encoded data
   outbuf (p1):  Buffer to place translated text into.
   size   (i0):  Maximum size of outbuf (p1);
   
   
Return:

   Size in bytes of translated data placed into outbuf (p1).	
	
  
-----------------------------------------------------------------------------

/lib/nettext/wwwebget

   Retrieves a document via HTTP.

 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

   VP Arguments: p0 p1 i0 i1 : p0 i0

   C prototype:  webdoc wwwebget(char *url_addr, int port,
                                 char *command, int max_len)
                (#include <artix/nettext.h>)

 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Inputs:

   url_addr (p0):  IP address as a string -i.e. "192.168.1.1"
   
   port (i0)    :  Server port to connect to
   
   command (p1) :  Command to issue to server -i.e. "GET / HTTP/1.0\n\n"
   
   max_len (i1) :  Maximum number of bytes to get if server does not
                   supply a content-length: header tag.  If this argument
		   is 0, and the server doesn't supply the tag, -6 is
		   returned (see webdoc.size below).
   
Return:

    webdoc.data (p0) : Pointer to the document retrieved including headers
                       (NOTE: It is the calling program's responsibility to
		               free this memory buffer.)   

    webdoc.size (i1) : Number of bytes retrieved or an error number (<0):

            -4 = Could not get an output socket
            -5 = Could not connect to server
            -6 = Server did not supply content-length: and user specified
	         a max_len of 0.
  
-----------------------------------------------------------------------------
