Beispiel #1
0
 // Close connection when things have gone wrong...
 void  close()
 {
     // System.out.println("Closing Connection...");
     try {
         sendTime = -1L;
         if (output != null)
         {
             output.close();
             output = null;
         }
         if (input != null)
         {
             input.Close();
             input = null;
         }
         if (connection != null)
         {
             connection.Close();
             connection = null;
         }
     } catch (Exception e) {
         if (PrologSession.debugging())
         {
             PrologSession.WriteStackTrace(e, Console.Error);
         }
     }
 }
Beispiel #2
0
 internal override PBTerm[] fastWritePrefix(FastWriter writer)
 {
     // [PM] 4.3.2 FIXME: it would be better to always write a string prefix (writeCharList) if possible, and then write the remainder regardless of whether the remainder is NIL or not.
     if (TrueString)
     {
         writer.writeString(getString());
         return(PBTerm.NO_TERMS);
     }
     else
     {
         return(base.fastWritePrefix(writer));
     }
 }
Beispiel #3
0
 internal virtual void  fastWrite(FastWriter writer)
 {
     foreach (string key in bindings.Keys)
     {
         PBTerm value = (PBTerm)bindings [key];
         writer.writeList();
         writer.writeCompound("=", 2);
         // Arg 1
         writer.writeAtom(key);
         // Arg 2
         writer.writeTerm(value);
     }
     writer.writeNIL();
 }
Beispiel #4
0
 void  connectToServer()
 {
     if (connection == null)
     {
         System.Net.Sockets.TcpClient conn = new System.Net.Sockets.TcpClient(host, port);
         if (debugging(2))
         {
             output = new FastWriter(new debugStream(conn.GetStream()));
         }
         else
         {
             output = new FastWriter(conn.GetStream());
         }
         input      = new System.IO.BufferedStream(conn.GetStream());
         connection = conn;
     }
 }
Beispiel #5
0
 internal override PBTerm[] fastWritePrefix(FastWriter writer)
 {
     writer.writeCompound(Name, arguments.Length);
     return(arguments);
 }
Beispiel #6
0
 /// <summary> Write fastrw prefix. Return array of arguments that should be written
 /// after the prefix. The returned array may be empty but never null. Note
 /// that the returned array may have no direct relationship to the arguments
 /// of the term, e.g. when writing a list in compact string notation.
 ///
 /// </summary>
 /// <throws>  IOException </throws>
 // [PM] 4.1.3
 internal abstract PBTerm[] fastWritePrefix(FastWriter writer);