The namespace SbsSW.SwiPlCs.Streams provides the delegates to redirect the read and write functions of the SWI-Prolog IO Streams.
When Initialize(array<String>[]()[][]) is called the *Sinput->functions.read is replaced by the .NET method 'Sread_function' and *Sinput->functions.write by 'Swrite_funktion'.
For further examples see the methods SetStreamFunctionWrite(PlStreamType, DelegateStreamWriteFunction) and SetStreamFunctionRead(PlStreamType, DelegateStreamReadFunction)
| All Types | Enumerations | Delegates |
| Icon | Type | Description |
|---|---|---|
| DelegateStreamReadFunction | ||
| DelegateStreamWriteFunction | ||
| PlStreamType |
The standard SWI-Prolog streams ( input output error )
|
| The reason for this is debugging. |
static internal long Swrite_function(IntPtr handle, string buf, long bufsize) { string s = buf.Substring(0, (int)bufsize); Console.Write(s); System.Diagnostics.Trace.WriteLine(s); return bufsize; } static internal long Sread_function(IntPtr handle, IntPtr buf, long bufsize) { throw new PlLibException("SwiPlCs: Prolog try to read from stdin"); } | |