8.3 Binarysocket Interface

ORIGIN 'basicsocket';
LIB_DEF 'processbinary' '../lib';

(*
 * COPYRIGHT
 *       Copyright (C) Mjolner Informatics 1995-97
 *       All rights reserved.
 *)

BODY 'private/binarysocketbody';
INCLUDE '~beta/sysutils/RepetitionObject';
INCLUDE 'repstream/extendedRepstream';

--- systemlib: attributes ---
BinarySocket: basicSocket
  (# <<SLOT binarysocketlib: attributes>>;
     
     (* send an integer *)
     putIntPattern: withIdle
       (# i: @integer;
       enter i
       ...
       #);

     (* receive an integer *)
     getIntPattern: withIdle
       (# i: @integer;
       ...
       exit i
       #);

     (* send contents of an ExtendedRepstream *)
     putRepPattern: repIO
       (# 
       enter header
       ...
       #);

     (* receive contents to an ExtendedRepstream *)
     getRepPattern: repIO
       (# 
       ...
       exit header
       #);

     (* send contents from RepetitionObject *) 
     putRepObjPattern: repObjIO
       (#
       ...
       #);

     (* receive contents to RepetitionObject.
      * Furtherbinding maxLongs can be used to limit the size of 
      * packets being received, which is useful in particular when
      * the sender cannot be trusted.
      *)
     getRepObjPattern: repObjIO
       (# maxLongs:< IntegerValue
            (# do MaxInt div 4 -> value; INNER #);
          MaxlongsExceeded:< Object;
       ...
       #);

     repIO: withIdle
       (* Read/write a block to/from 'rep',
        * returning/using 'header'. The length of the block is
        * stored in/retrived from 'rep.end'.
        *)
       (# rep: ^ExtendedRepstream;
          header: @integer;
       enter rep[]
       do INNER
       #);

     repObjIO: withIdle
       (# 
          (* Read/write a block to/from 'rep'. 
           * The length of the block is stored
           * in/retrived from 'rep.end'.
           *)
          rep: ^RepetitionObject;
       enter rep[]
       do INNER
       #);

     endOfData: @endOfDataPattern;
     putInt: @putIntPattern;
     getInt: @getIntPattern;
     putRep: @putRepPattern;
     getRep: @getRepPattern;
     putRepObj: @putRepObjPattern;
     getRepObj: @getRepObjPattern;
     
     binpriv: @...;
  #)


8.3 Binarysocket Interface
© 1994-2002 Mjølner Informatics
[Modified: Thursday August 6th 1998 at 13:55]