diff VMSHW.h @ 1:06ca89bafbb8

1st working version -- as far as can tell due to SEH bugs
author Me
date Wed, 07 Jul 2010 13:15:29 -0700
parents 35b53e6de714
children 9f2e23d38ff2
line diff
     1.1 --- a/VMSHW.h	Sat May 22 19:33:11 2010 -0700
     1.2 +++ b/VMSHW.h	Wed Jul 07 13:15:29 2010 -0700
     1.3 @@ -9,38 +9,117 @@
     1.4  #ifndef _VMSHW_H
     1.5  #define	_VMSHW_H
     1.6  
     1.7 -#include "VMS/VMS_primitive_data_types.h"
     1.8 -#include "VMS/Queue_impl/BlockingQueue.h"
     1.9 +#include "VMS/Queue_impl/PrivateQueue.h"
    1.10 +#include "VMS/Hash_impl/PrivateHash.h"
    1.11 +#include "VMS/VMS.h"
    1.12  
    1.13  /*This header defines everything specific to the VMSHW semantic plug-in
    1.14   */
    1.15 -typedef struct VMSHWReqData VMSHWReqData;
    1.16 +typedef struct _VMSHWSemReq   VMSHWSemReq;
    1.17  
    1.18 -typedef struct
    1.19 - {
    1.20 - }
    1.21 -VMSHWProcr;
    1.22  
    1.23  /*Semantic layer-specific data sent inside a request from lib called in app
    1.24   * to request handler called in MasterLoop
    1.25   */
    1.26 -enum VMSHW_ReqType
    1.27 +enum VMSHWReqType
    1.28   {
    1.29 -   receive,
    1.30 -   send,
    1.31 -   create
    1.32 +   send_type = 1,
    1.33 +   send_from_to,
    1.34 +   receive_any,    //order and grouping matter -- send before receive
    1.35 +   receive_type,   // and receive_any first of the receives -- Handlers
    1.36 +   receive_from_to,// rely upon this ordering of enum
    1.37 +   transfer_to,
    1.38 +   transfer_out
    1.39   };
    1.40  
    1.41 -struct VMSHWReqData
    1.42 - { VMSHW_ReqType   reqType;
    1.43 -   
    1.44 - };
    1.45 +struct _VMSHWSemReq
    1.46 + { enum VMSHWReqType    reqType;
    1.47 +   VirtProcr           *sendPr;
    1.48 +   VirtProcr           *receivePr;
    1.49 +   int32                msgType;
    1.50 +   void                *msg;
    1.51 +   VMSHWSemReq         *nextReqInHashEntry;
    1.52 + }
    1.53 +/* VMSHWSemReq */;
    1.54  
    1.55  typedef struct
    1.56   {
    1.57 +   PrivQueueStruc *readyVirtProcrQ;
    1.58 +   HashTable      *commHashTbl;
    1.59 +   int             numVirtPr;
    1.60 + }
    1.61 +VMSHWSemEnv;
    1.62  
    1.63 - }
    1.64 -VMSHWSemanticEnv;
    1.65 +
    1.66 +//===========================================================================
    1.67 +
    1.68 +void
    1.69 +VMSHW__create_seed_procr_and_do_work( VirtProcrFnPtr fn, void *initData );
    1.70 +
    1.71 +//=======================
    1.72 +
    1.73 +void
    1.74 +VMSHW__init();
    1.75 +
    1.76 +void
    1.77 +VMSHW__shutdown();
    1.78 +
    1.79 +//=======================
    1.80 +
    1.81 +inline VirtProcr *
    1.82 +VMSHW__create_procr_with( VirtProcrFnPtr fnPtr, void *initData,
    1.83 +                          VirtProcr *creatingPr );
    1.84 +
    1.85 +void
    1.86 +VMSHW__dissipate_procr( VirtProcr *procrToDissipate );
    1.87 +
    1.88 +//=======================
    1.89 +void *
    1.90 +VMSHW__malloc_size_to( int numBytes, VirtProcr *ownerPr );
    1.91 +
    1.92 +void
    1.93 +VMSHW__transfer_ownership_of_from_to( void *data, VirtProcr *oldOwnerPr,
    1.94 +                                                    VirtProcr *newOwnerPr );
    1.95 +                                                    
    1.96 +void
    1.97 +VMSHW__add_ownership_by_to( VirtProcr *newOwnerPr, void *data );
    1.98 +
    1.99 +void
   1.100 +VMSHW__remove_ownership_by_from( VirtProcr *loserPr, void *dataLosing );
   1.101 +
   1.102 +void
   1.103 +VMSHW__transfer_ownership_to_outside( void *dataToTransferOwnershipOf );
   1.104 +
   1.105 +
   1.106 +
   1.107 +//=======================
   1.108 +void
   1.109 +VMSHW__send_of_type_to( VirtProcr *sendPr, void *msg, const int type,
   1.110 +                        VirtProcr *receivePr);
   1.111 +
   1.112 +void
   1.113 +VMSHW__send_from_to( void *msg, VirtProcr *sendPr, VirtProcr *receivePr);
   1.114 +
   1.115 +void *
   1.116 +VMSHW__receive_type_to( const int type, VirtProcr *receivePr );
   1.117 +
   1.118 +void *
   1.119 +VMSHW__receive_from_to( VirtProcr *sendPr, VirtProcr *receivePr );
   1.120 +
   1.121 +
   1.122 +//=======================
   1.123 +
   1.124 +void
   1.125 +VMSHW__free_semantic_request( VMSHWSemReq *semReq );
   1.126 +
   1.127 +
   1.128 +//=========================  Internal use only  =============================
   1.129 +void
   1.130 +VMSHW__Request_Handler( VirtProcr *requestingPr, void *_semEnv );
   1.131 +
   1.132 +VirtProcr *
   1.133 +VMSHW__schedule_virt_procr( void *_semEnv );
   1.134 +
   1.135  
   1.136  #endif	/* _VMSHW_H */
   1.137