changeset 19:45f7cf8a80eb ML_lib_longjmp

Compiles and runs DKUTest
author coolicer@(none)
date Tue, 04 Mar 2014 12:45:08 -0800
parents 2d96f0ad026e
children f3cb11baf791
files PR__PI.h PR__WL.h PR__int.h PR__structs__common.h
diffstat 4 files changed, 418 insertions(+), 413 deletions(-) [+]
line diff
     1.1 --- a/PR__PI.h	Fri Feb 28 21:16:50 2014 +0100
     1.2 +++ b/PR__PI.h	Tue Mar 04 12:45:08 2014 -0800
     1.3 @@ -38,8 +38,8 @@
     1.4  //#define PR_PI__get_fresh_slaveVP   PR_int__create_slaveVP_helper
     1.5  
     1.6  inline
     1.7 -SlaveVP *
     1.8 -PR_PI__get_fresh_slaveVP( BirthFnPtr fnPtr, void *dataParam );
     1.9 +SlaveVP*
    1.10 +PR_PI__get_fresh_slaveVP( BirthFnPtr fnPtr, void *dataParam, SlaveVP* requestingSlv );
    1.11  
    1.12  //==============
    1.13  //=== Lang Data
     2.1 --- a/PR__WL.h	Fri Feb 28 21:16:50 2014 +0100
     2.2 +++ b/PR__WL.h	Tue Mar 04 12:45:08 2014 -0800
     2.3 @@ -1,142 +1,142 @@
     2.4 -/*
     2.5 - *  Copyright 2009 OpenSourceResearchInstitute.org
     2.6 - *  Licensed under GNU General Public License version 2
     2.7 - *
     2.8 - * Author: seanhalle@yahoo.com
     2.9 - * 
    2.10 - */
    2.11 -
    2.12 -#ifndef _PR__WL_H
    2.13 -#define	_PR__WL_H
    2.14 -#define _GNU_SOURCE
    2.15 -
    2.16 -#include <PR__include/PR__primitive_data_types.h>
    2.17 -#include <PR__include/PR__structs__common.h>
    2.18 -//=========================  Function Prototypes  ===========================
    2.19 -/* MEANING OF   WL  PI  SS  int PROS
    2.20 - * These indicate which places the function is safe to use.  They stand for:
    2.21 - * 
    2.22 - * WL   Wrapper Library -- wrapper lib code should only use these
    2.23 - * PI   Plugin          -- plugin code should only use these
    2.24 - * SS   Startup and Shutdown -- designates these relate to startup & shutdown
    2.25 - * int32internal to PR -- should not be used in wrapper lib or plugin
    2.26 - * PROS means "OS functions for applications to use"
    2.27 - * 
    2.28 - * PR_int__ functions touch internal PR data structs and are only safe
    2.29 - *  to be used inside the master lock.  However, occasionally, they appear
    2.30 - * in wrapper-lib or plugin code.  In those cases, very careful analysis
    2.31 - * has been done to be sure no concurrency issues could arise.
    2.32 - * 
    2.33 - * PR_WL__ functions are all safe for use outside the master lock.
    2.34 - * 
    2.35 - * PROS are only safe for applications to use -- they're like a second
    2.36 - * language mixed in -- but they can't be used inside plugin code, and
    2.37 - * aren't meant for use in wrapper libraries, because they are themselves
    2.38 - * wrapper-library calls!
    2.39 - */
    2.40 -
    2.41 -//============== Top level Fns called from main   ===============
    2.42 -void
    2.43 -PR__start();
    2.44 -
    2.45 -PRProcess *
    2.46 -PR__create_process( BirthFnPtr seed_Fn, void *seedData );
    2.47 -
    2.48 -void
    2.49 -PR__end_seedVP( SlaveVP *seedSlv );
    2.50 -
    2.51 -void
    2.52 -PR__end_process_from_inside( SlaveVP *seedSlv );
    2.53 -
    2.54 -void *
    2.55 -PR__give_results_from_process_when_ready( PRProcess *process );
    2.56 -
    2.57 -void
    2.58 -PR__wait_for_process_to_end( PRProcess *process );
    2.59 -
    2.60 -void
    2.61 -PR__wait_for_all_activity_to_end();
    2.62 -
    2.63 -void
    2.64 -PR__shutdown();
    2.65 -
    2.66 -#define \
    2.67 -PR__create_taskID_of_size   PR_WL__create_taskID_of_size
    2.68 -
    2.69 -inline
    2.70 -int32 *
    2.71 -PR__give_ID_from_slave( SlaveVP *animSlv, int32 magicNumber );
    2.72 -
    2.73 -inline
    2.74 -int32 *
    2.75 -PR__give_ID_from_lang_meta_task( void *_task );
    2.76 -
    2.77 -
    2.78 -//============== include internally used fn prototypes ================
    2.79 -#include "PR__int.h"
    2.80 -
    2.81 -#define PR_WL__give_lang_data  PR_int__give_lang_data_from_slave
    2.82 -
    2.83 -#define \
    2.84 -PR_WL__create_slaveVP   PR_int__create_slaveVP_helper
    2.85 -
    2.86 -#define \
    2.87 -PR_WL__give_lang_meta_task_from_slave   PR_int__give_lang_meta_task_from_slave
    2.88 -
    2.89 -#define \
    2.90 -PR_WL__give_prolog_of_lang_meta_task   PR_int__give_prolog_of_lang_meta_task
    2.91 -
    2.92 -//==============  Request Related  ===============
    2.93 -
    2.94 -void
    2.95 -PR_WL__suspend_slaveVP_and_send_req( SlaveVP *callingSlv );
    2.96 -
    2.97 -inline void
    2.98 -PR_WL__add_lang_request_in_mallocd_PRReqst( void *langReqData, 
    2.99 -                                                          SlaveVP *callingSlv );
   2.100 -
   2.101 -inline void
   2.102 -PR_WL__send_lang_request( void *langReq, RequestHandler handler, 
   2.103 -                                          SlaveVP *callingSlv, int32 magicNum );
   2.104 -
   2.105 -void
   2.106 -PR_WL__send_create_slaveVP_req( void *langReq, int32 *ID, CreateHandler handler, 
   2.107 -                                SlaveVP *reqstingSlv, int32 magicNum );
   2.108 -
   2.109 -void inline
   2.110 -PR_WL__send_end_slave_req( void *langReq, RequestHandler handler, 
   2.111 -                                       SlaveVP *slvToDissipate, int32 magicNum );
   2.112 -
   2.113 -inline void
   2.114 -PR_WL__send_service_request( void *langReqData, SlaveVP *callingSlv );
   2.115 -
   2.116 -inline void
   2.117 -PR_WL__send_lang_shutdown_request( SlaveVP *callingSlv, int32 magicNum );
   2.118 -
   2.119 -inline 
   2.120 -int32 *
   2.121 -PR_WL__create_taskID_of_size( int32 numInts );
   2.122 -
   2.123 -//======================== MEASUREMENT ======================
   2.124 -uint64
   2.125 -PR_WL__give_num_plugin_cycles();
   2.126 -uint32
   2.127 -PR_WL__give_num_plugin_animations();
   2.128 -
   2.129 -
   2.130 -//========================= Utilities =======================
   2.131 -void
   2.132 -PR_WL__throw_exception( char *msgStr, SlaveVP *reqstSlv,  PRExcp *excpData );
   2.133 -#define PR_App__throw_exception PR_WL__throw_exception
   2.134 -
   2.135 -
   2.136 -//=======================================================================
   2.137 -
   2.138 -//========================= Services =======================
   2.139 -//#include "Services_Offered_by_PR/Measurement_and_Stats/probes.h"
   2.140 -//#include  "Services_Offered_by_PR/Services_Language/PRServ.h"
   2.141 -//#include  "Services_Offered_by_PR/Services_Language/libPRServ.h"
   2.142 -
   2.143 -//================================================
   2.144 -#endif	/* _PR_H */
   2.145 -
   2.146 +/*
   2.147 + *  Copyright 2009 OpenSourceResearchInstitute.org
   2.148 + *  Licensed under GNU General Public License version 2
   2.149 + *
   2.150 + * Author: seanhalle@yahoo.com
   2.151 + * 
   2.152 + */
   2.153 +
   2.154 +#ifndef _PR__WL_H
   2.155 +#define	_PR__WL_H
   2.156 +#define _GNU_SOURCE
   2.157 +
   2.158 +#include <PR__include/PR__primitive_data_types.h>
   2.159 +#include <PR__include/PR__structs__common.h>
   2.160 +//=========================  Function Prototypes  ===========================
   2.161 +/* MEANING OF   WL  PI  SS  int PROS
   2.162 + * These indicate which places the function is safe to use.  They stand for:
   2.163 + * 
   2.164 + * WL   Wrapper Library -- wrapper lib code should only use these
   2.165 + * PI   Plugin          -- plugin code should only use these
   2.166 + * SS   Startup and Shutdown -- designates these relate to startup & shutdown
   2.167 + * int32internal to PR -- should not be used in wrapper lib or plugin
   2.168 + * PROS means "OS functions for applications to use"
   2.169 + * 
   2.170 + * PR_int__ functions touch internal PR data structs and are only safe
   2.171 + *  to be used inside the master lock.  However, occasionally, they appear
   2.172 + * in wrapper-lib or plugin code.  In those cases, very careful analysis
   2.173 + * has been done to be sure no concurrency issues could arise.
   2.174 + * 
   2.175 + * PR_WL__ functions are all safe for use outside the master lock.
   2.176 + * 
   2.177 + * PROS are only safe for applications to use -- they're like a second
   2.178 + * language mixed in -- but they can't be used inside plugin code, and
   2.179 + * aren't meant for use in wrapper libraries, because they are themselves
   2.180 + * wrapper-library calls!
   2.181 + */
   2.182 +
   2.183 +//============== Top level Fns called from main   ===============
   2.184 +void
   2.185 +PR__start();
   2.186 +
   2.187 +PRProcess *
   2.188 +PR__create_process( BirthFnPtr seed_Fn, void *seedData );
   2.189 +
   2.190 +void
   2.191 +PR__end_seedVP( SlaveVP *seedSlv );
   2.192 +
   2.193 +void
   2.194 +PR__end_process_from_inside( SlaveVP *seedSlv );
   2.195 +
   2.196 +void *
   2.197 +PR__give_results_from_process_when_ready( PRProcess *process );
   2.198 +
   2.199 +void
   2.200 +PR__wait_for_process_to_end( PRProcess *process );
   2.201 +
   2.202 +void
   2.203 +PR__wait_for_all_activity_to_end();
   2.204 +
   2.205 +void
   2.206 +PR__shutdown();
   2.207 +
   2.208 +#define \
   2.209 +PR__create_taskID_of_size   PR_WL__create_taskID_of_size
   2.210 +
   2.211 +inline
   2.212 +int32 *
   2.213 +PR__give_ID_from_slave( SlaveVP *animSlv, int32 magicNumber );
   2.214 +
   2.215 +inline
   2.216 +int32 *
   2.217 +PR__give_ID_from_lang_meta_task( void *_task );
   2.218 +
   2.219 +
   2.220 +//============== include internally used fn prototypes ================
   2.221 +#include "PR__int.h"
   2.222 +
   2.223 +#define PR_WL__give_lang_data  PR_int__give_lang_data_from_slave
   2.224 +
   2.225 +#define \
   2.226 +PR_WL__create_slaveVP   PR_int__create_slaveVP_struct
   2.227 +
   2.228 +#define \
   2.229 +PR_WL__give_lang_meta_task_from_slave   PR_int__give_lang_meta_task_from_slave
   2.230 +
   2.231 +#define \
   2.232 +PR_WL__give_prolog_of_lang_meta_task   PR_int__give_prolog_of_lang_meta_task
   2.233 +
   2.234 +//==============  Request Related  ===============
   2.235 +
   2.236 +void
   2.237 +PR_WL__suspend_slaveVP_and_send_req( SlaveVP *callingSlv );
   2.238 +
   2.239 +inline void
   2.240 +PR_WL__add_lang_request_in_mallocd_PRReqst( void *langReqData, 
   2.241 +                                                          SlaveVP *callingSlv );
   2.242 +
   2.243 +inline void
   2.244 +PR_WL__send_lang_request( void *langReq, RequestHandler handler, 
   2.245 +                                          SlaveVP *callingSlv, int32 magicNum );
   2.246 +
   2.247 +void
   2.248 +PR_WL__send_create_slaveVP_req( void *langReq, int32 *ID, CreateHandler handler, 
   2.249 +                                SlaveVP *reqstingSlv, int32 magicNum );
   2.250 +
   2.251 +void inline
   2.252 +PR_WL__send_end_slave_req( void *langReq, RequestHandler handler, 
   2.253 +                                       SlaveVP *slvToDissipate, int32 magicNum );
   2.254 +
   2.255 +inline void
   2.256 +PR_WL__send_service_request( void *langReqData, SlaveVP *callingSlv );
   2.257 +
   2.258 +inline void
   2.259 +PR_WL__send_lang_shutdown_request( SlaveVP *callingSlv, int32 magicNum );
   2.260 +
   2.261 +inline 
   2.262 +int32 *
   2.263 +PR_WL__create_taskID_of_size( int32 numInts );
   2.264 +
   2.265 +//======================== MEASUREMENT ======================
   2.266 +uint64
   2.267 +PR_WL__give_num_plugin_cycles();
   2.268 +uint32
   2.269 +PR_WL__give_num_plugin_animations();
   2.270 +
   2.271 +
   2.272 +//========================= Utilities =======================
   2.273 +void
   2.274 +PR_WL__throw_exception( char *msgStr, SlaveVP *reqstSlv,  PRExcp *excpData );
   2.275 +#define PR_App__throw_exception PR_WL__throw_exception
   2.276 +
   2.277 +
   2.278 +//=======================================================================
   2.279 +
   2.280 +//========================= Services =======================
   2.281 +//#include "Services_Offered_by_PR/Measurement_and_Stats/probes.h"
   2.282 +//#include  "Services_Offered_by_PR/Services_Language/PRServ.h"
   2.283 +//#include  "Services_Offered_by_PR/Services_Language/libPRServ.h"
   2.284 +
   2.285 +//================================================
   2.286 +#endif	/* _PR_H */
   2.287 +
     3.1 --- a/PR__int.h	Fri Feb 28 21:16:50 2014 +0100
     3.2 +++ b/PR__int.h	Tue Mar 04 12:45:08 2014 -0800
     3.3 @@ -1,269 +1,273 @@
     3.4 -/*
     3.5 - *  Copyright 2009 OpenSourceResearchInstitute.org
     3.6 - *  Licensed under GNU General Public License version 2
     3.7 - *
     3.8 - * Author: seanhalle@yahoo.com
     3.9 - * 
    3.10 - */
    3.11 -
    3.12 -#ifndef _PR_INT_H
    3.13 -#define	_PR_INT_H
    3.14 -#define _GNU_SOURCE
    3.15 -
    3.16 -
    3.17 -#define LOCKED 1
    3.18 -#define UNLOCKED 0
    3.19 -
    3.20 -/* MEANING OF   WL  PI  SS  int
    3.21 - * These indicate which places the function is safe to use.  They stand for:
    3.22 - * WL: Wrapper Library
    3.23 - * PI: Plugin 
    3.24 - * SS: Startup and Shutdown
    3.25 - * int: internal to the PR implementation
    3.26 - */
    3.27 -
    3.28 -inline
    3.29 -void
    3.30 -PR_int__reset_slaveVP_to_BirthFn( SlaveVP *slaveVP, BirthFnPtr fnPtr,
    3.31 -                              void    *dataParam);
    3.32 -
    3.33 -inline
    3.34 -void
    3.35 -PR_int__point_slaveVP_to_OneParamFn( SlaveVP *slaveVP, void *fnPtr,
    3.36 -                              void    *param);
    3.37 -
    3.38 -inline
    3.39 -void
    3.40 -PR_int__point_slaveVP_to_TwoParamFn( SlaveVP *slaveVP, void *fnPtr,
    3.41 -                             void    *param1, void *param2);
    3.42 -
    3.43 -//===========================================================================
    3.44 -//
    3.45 -//===========================================================================
    3.46 -inline
    3.47 -SlaveVP *
    3.48 -PR_int__create_slaveVP_helper( BirthFnPtr fnPtr, void *dataParam );
    3.49 -
    3.50 -inline
    3.51 -SlaveVP *
    3.52 -PR_int__create_slaveVP( BirthFnPtr fnPtr, void *dataParam, PRProcess *process );
    3.53 -
    3.54 -SlaveVP *
    3.55 -PR_int__get_recycled_slot_slave( );
    3.56 -
    3.57 -SlaveVP *
    3.58 -PR_int__create_slot_slave( );
    3.59 -
    3.60 -inline 
    3.61 -void
    3.62 -PR_int__replace_with_new_slot_slv( SlaveVP *slave );
    3.63 -
    3.64 -void 
    3.65 -idle_fn(void* data, SlaveVP *animatingSlv);
    3.66 -
    3.67 -inline
    3.68 -void
    3.69 -PR_int__put_task_into_slot( void *task, AnimSlot *slot );
    3.70 -
    3.71 -inline
    3.72 -void
    3.73 -PR_int__put_slave_into_slot( SlaveVP *slave, AnimSlot *slot );
    3.74 -
    3.75 -void inline
    3.76 -PRHandle__ServiceReq(  SlaveVP *requestingSlv );
    3.77 -
    3.78 -void
    3.79 -PR_int__free_slaveVP( SlaveVP *slave );
    3.80 -
    3.81 -void
    3.82 -PR_int__recycle_slaveVP( SlaveVP *slave );
    3.83 -
    3.84 -void
    3.85 -freeLangDataAsElem( void *elem );
    3.86 -
    3.87 -void
    3.88 -freeMetaTaskAsElem( void *elem );
    3.89 -
    3.90 -
    3.91 -//=============================
    3.92 -//=== Lange Env
    3.93 -//=
    3.94 -inline 
    3.95 -void *
    3.96 -PR_int__give_lang_env( PRLangEnv *protoLangEnv );
    3.97 -
    3.98 -inline 
    3.99 -PRLangEnv *
   3.100 -PR_int__give_proto_lang_env( void *langEnv );
   3.101 -
   3.102 -//inline
   3.103 -void *
   3.104 -PR_int__create_lang_env_in_process( int32 size, PRProcess *process, int32 magicNum );
   3.105 -
   3.106 -inline
   3.107 -void *
   3.108 -PR_int__remove_lang_env_from_process_and_free( void *langEnv );
   3.109 -
   3.110 -inline
   3.111 -void *
   3.112 -PR_int__give_lang_env_of_req( PRReqst *req, SlaveVP *requestingSlv );
   3.113 -
   3.114 -inline
   3.115 -void *
   3.116 -PR_int__give_lang_env_for_slave( SlaveVP *slave, int32 magicNum );
   3.117 -//No WL version -- not safe!  if use env in WL, be sure data rd & wr is stable
   3.118 -
   3.119 -inline
   3.120 -PRLangEnv *
   3.121 -PR_int__give_proto_lang_env_for_slave( SlaveVP *slave, int32 magicNumber );
   3.122 -//No WL version -- not safe!  if use env in WL, be sure data rd & wr is stable
   3.123 -
   3.124 -inline
   3.125 -void *
   3.126 -PR_int__give_lang_env_from_process( PRProcess *process, int32 magicNum );
   3.127 -//No WL version -- not safe!  if use env in WL, be sure data rd & wr is stable
   3.128 -
   3.129 -inline
   3.130 -PRLangEnv *
   3.131 -PR_int__give_proto_lang_env_from_process( PRProcess *process, int32 magicNum );
   3.132 -
   3.133 -//=======================
   3.134 -//=== Meta Task
   3.135 -//=
   3.136 -inline 
   3.137 -PRMetaTask *
   3.138 -PR_int__give_prolog_of_lang_meta_task( void *task );
   3.139 -
   3.140 -inline
   3.141 -void *
   3.142 -PR_int__give_lang_meta_task_of_prolog( PRMetaTask *metaTask);
   3.143 -
   3.144 -inline
   3.145 -void *
   3.146 -PR_int__create_lang_meta_task( int32 size, LangMetaTaskFreer freer, int32 magicNum );
   3.147 -
   3.148 -inline
   3.149 -void *
   3.150 -PR_int__create_lang_meta_task_in_slave( int32 size, LangMetaTaskFreer freer,
   3.151 -                                        SlaveVP *slave, int32 magicNum );
   3.152 -
   3.153 -inline
   3.154 -PRMetaTask *
   3.155 -PR_int__create_generic_slave_meta_task( void *initData );
   3.156 -
   3.157 -void
   3.158 -PR_int__free_lang_meta_task_and_remove_from_coll( void *langMetaTask );
   3.159 -
   3.160 -inline
   3.161 -void
   3.162 -PR_int__insert_meta_task_into_slave( PRMetaTask *task, SlaveVP *slave );
   3.163 -
   3.164 -inline
   3.165 -void
   3.166 -PR_int__insert_lang_meta_task_into_slave__ML( void *langMetaTask, SlaveVP *slave );
   3.167 -
   3.168 -inline
   3.169 -void *
   3.170 -PR_int__give_lang_meta_task_from_slave( SlaveVP *slave, int32 magicNumer );
   3.171 -
   3.172 -inline
   3.173 -SlaveVP *
   3.174 -PR_PI__give_slave_lang_meta_task_is_assigned_to( void *langMetaTask );
   3.175 -
   3.176 -//==============
   3.177 -//=== Lang Data
   3.178 -//=
   3.179 -inline
   3.180 -void *
   3.181 -PR_PI__create_lang_data_in_slave( int32 size, LangDataFreer freer,
   3.182 -                                   SlaveVP *slave, int32 magicNum );
   3.183 -
   3.184 -inline
   3.185 -void *
   3.186 -PR_int__give_lang_data_from_slave( SlaveVP *slave, int32 magicNumer );
   3.187 -
   3.188 -inline
   3.189 -void *
   3.190 -PR_int__give_lang_data_of_prolog( PRLangData *langData);
   3.191 -
   3.192 -//==================================================
   3.193 -//===  Collection
   3.194 -//=
   3.195 -PRCollElem ** //return an array of pointers
   3.196 -PR_int__make_collection_of_size( int32 numInColl );
   3.197 -
   3.198 -inline
   3.199 -void
   3.200 -PR_int__insert_elem_into_collection( PRCollElem *elem, PRCollElem **coll, int32 hash );
   3.201 -
   3.202 -inline
   3.203 -void
   3.204 -PR_int__replace_or_insert_elem_into_collection( PRCollElem *elem, 
   3.205 -                                                PRCollElem **coll, 
   3.206 -                                                int32 hash );
   3.207 -
   3.208 -inline
   3.209 -void *
   3.210 -PR_int__lookup_elem_in_collection( int32 hash, PRCollElem **coll );
   3.211 -
   3.212 -inline
   3.213 -void
   3.214 -PR_int__remove_elem_from_collection( int32 hash, PRCollElem **coll );
   3.215 -
   3.216 -inline
   3.217 -void
   3.218 -PR_int__set_collection_to_empty( PRCollElem **coll );
   3.219 -
   3.220 -inline
   3.221 -void
   3.222 -PR_int__apply_Fn_to_all_in_collection( void (*Fn)(void *), PRCollElem **coll );
   3.223 -
   3.224 -//===========
   3.225 -//===
   3.226 -//=
   3.227 -void
   3.228 -PR_int__error( char *msgStr );
   3.229 -
   3.230 -void
   3.231 -PR_int__throw_exception( char *msgStr, SlaveVP *reqstSlv, PRExcp *excpData );
   3.232 -
   3.233 -/*Some macro magic -- the __FILE__ turns into a string, and the 
   3.234 - * preprocessor merges the quotes.  But the __LINE__ turns into an int,
   3.235 - * so have to use the # operator to turn it into a string..  but the
   3.236 - * # operator doesn't expand what comes after, so have to do an extra
   3.237 - * level so that pre-processor first expands __LINE__ into number then 
   3.238 - * hands to the # operator, which turns into string (then it merges
   3.239 - * quotes)
   3.240 - */
   3.241 -#define PR__throw_simple_exception( throwingVP ) \
   3.242 -   do{ PR_int__throw_exception( __FILE__ ", " STR(__LINE__), throwingVP, NULL ); \
   3.243 -     } while(0)
   3.244 -
   3.245 -#define STR( s ) #s
   3.246 -
   3.247 -char *
   3.248 -PR_int__strDup( char *str );
   3.249 -
   3.250 -inline void
   3.251 -PR_int__get_wrapper_lock();
   3.252 -
   3.253 -inline void
   3.254 -PR_int__get_master_lock();
   3.255 -
   3.256 -inline void
   3.257 -PR_int__get_malloc_lock();
   3.258 -
   3.259 -#define PR_int__release_master_lock()  _PRTopEnv->masterLock  = UNLOCKED
   3.260 -
   3.261 -#define PR_int__release_wrapper_lock() _PRTopEnv->wrapperLock = UNLOCKED
   3.262 -
   3.263 -#define PR_int__release_malloc_lock()  _PRTopEnv->mallocLock  = UNLOCKED
   3.264 -
   3.265 -inline uint32_t
   3.266 -PR_int__randomNumber();
   3.267 -
   3.268 -inline void
   3.269 -PR_int__backoff_for_TooLongToGetLock( int32 numTriesToGetLock );
   3.270 -
   3.271 -#endif	/* _PR_INT_H */
   3.272 -
   3.273 +/*
   3.274 + *  Copyright 2009 OpenSourceResearchInstitute.org
   3.275 + *  Licensed under GNU General Public License version 2
   3.276 + *
   3.277 + * Author: seanhalle@yahoo.com
   3.278 + * 
   3.279 + */
   3.280 +
   3.281 +#ifndef _PR_INT_H
   3.282 +#define	_PR_INT_H
   3.283 +#define _GNU_SOURCE
   3.284 +
   3.285 +
   3.286 +#define LOCKED 1
   3.287 +#define UNLOCKED 0
   3.288 +
   3.289 +/* MEANING OF   WL  PI  SS  int
   3.290 + * These indicate which places the function is safe to use.  They stand for:
   3.291 + * WL: Wrapper Library
   3.292 + * PI: Plugin 
   3.293 + * SS: Startup and Shutdown
   3.294 + * int: internal to the PR implementation
   3.295 + */
   3.296 +
   3.297 +inline
   3.298 +void
   3.299 +PR_int__reset_slaveVP_to_BirthFn( SlaveVP *slaveVP, BirthFnPtr fnPtr,
   3.300 +                              void    *dataParam);
   3.301 +
   3.302 +inline
   3.303 +void
   3.304 +PR_int__point_slaveVP_to_OneParamFn( SlaveVP *slaveVP, void *fnPtr,
   3.305 +                              void    *param);
   3.306 +
   3.307 +inline
   3.308 +void
   3.309 +PR_int__point_slaveVP_to_TwoParamFn( SlaveVP *slaveVP, void *fnPtr,
   3.310 +                             void    *param1, void *param2);
   3.311 +
   3.312 +//===========================================================================
   3.313 +//
   3.314 +//===========================================================================
   3.315 +inline
   3.316 +SlaveVP *
   3.317 +PR_int__create_slaveVP_struct( BirthFnPtr fnPtr, void *dataParam );
   3.318 +
   3.319 +inline
   3.320 +SlaveVP *
   3.321 +PR_int__create_slaveVP( BirthFnPtr fnPtr, void *dataParam, int32 coreNum );
   3.322 +
   3.323 +SlaveVP *
   3.324 +PR_int__get_recycled_slot_slave( int32 coreNum );
   3.325 +
   3.326 +SlaveVP *
   3.327 +PR_int__create_slot_slave( int32 coreNum );
   3.328 +
   3.329 +inline 
   3.330 +void
   3.331 +PR_int__replace_with_new_slot_slv( SlaveVP *slave );
   3.332 +
   3.333 +void 
   3.334 +idle_fn(void* data, SlaveVP *animatingSlv);
   3.335 +
   3.336 +inline
   3.337 +void
   3.338 +PR_int__put_task_into_slot( void *task, AnimSlot *slot );
   3.339 +
   3.340 +inline
   3.341 +void
   3.342 +PR_int__put_slave_into_slot( SlaveVP *slave, AnimSlot *slot );
   3.343 +
   3.344 +void inline
   3.345 +PRHandle__ServiceReq(  SlaveVP *requestingSlv );
   3.346 +
   3.347 +void
   3.348 +PR_int__free_slaveVP( SlaveVP *slave );
   3.349 +
   3.350 +void
   3.351 +PR_int__recycle_slaveVP( SlaveVP *slave );
   3.352 +
   3.353 +void
   3.354 +freeLangDataAsElem( void *elem );
   3.355 +
   3.356 +void
   3.357 +freeMetaTaskAsElem( void *elem );
   3.358 +
   3.359 +
   3.360 +
   3.361 +//=============================
   3.362 +//=== Lange Env
   3.363 +//=
   3.364 +inline 
   3.365 +void *
   3.366 +PR_int__give_lang_env( PRLangEnv *protoLangEnv );
   3.367 +
   3.368 +inline 
   3.369 +PRLangEnv *
   3.370 +PR_int__give_proto_lang_env( void *langEnv );
   3.371 +
   3.372 +//inline
   3.373 +void *
   3.374 +PR_int__create_lang_env_in_process( int32 size, PRProcess *process, int32 magicNum );
   3.375 +
   3.376 +inline
   3.377 +void *
   3.378 +PR_int__remove_lang_env_from_process_and_free( void *langEnv );
   3.379 +
   3.380 +inline
   3.381 +void *
   3.382 +PR_int__give_lang_env_of_req( PRReqst *req, SlaveVP *requestingSlv );
   3.383 +
   3.384 +inline
   3.385 +void *
   3.386 +PR_int__give_lang_env_for_slave( SlaveVP *slave, int32 magicNum );
   3.387 +//No WL version -- not safe!  if use env in WL, be sure data rd & wr is stable
   3.388 +
   3.389 +inline
   3.390 +PRLangEnv *
   3.391 +PR_int__give_proto_lang_env_for_slave( SlaveVP *slave, int32 magicNumber );
   3.392 +//No WL version -- not safe!  if use env in WL, be sure data rd & wr is stable
   3.393 +
   3.394 +inline
   3.395 +void *
   3.396 +PR_int__give_lang_env_from_process( PRProcess *process, int32 magicNum );
   3.397 +//No WL version -- not safe!  if use env in WL, be sure data rd & wr is stable
   3.398 +
   3.399 +inline
   3.400 +PRLangEnv *
   3.401 +PR_int__give_proto_lang_env_from_process( PRProcess *process, int32 magicNum );
   3.402 +
   3.403 +//=======================
   3.404 +//=== Meta Task
   3.405 +//=
   3.406 +inline 
   3.407 +PRMetaTask *
   3.408 +PR_int__give_prolog_of_lang_meta_task( void *task );
   3.409 +
   3.410 +inline
   3.411 +void *
   3.412 +PR_int__give_lang_meta_task_of_prolog( PRMetaTask *metaTask);
   3.413 +
   3.414 +inline
   3.415 +void *
   3.416 +PR_int__create_lang_meta_task( int32 size, LangMetaTaskFreer freer, int32 magicNum );
   3.417 +
   3.418 +inline
   3.419 +void *
   3.420 +PR_int__create_lang_meta_task_in_slave( int32 size, LangMetaTaskFreer freer,
   3.421 +                                        SlaveVP *slave, int32 magicNum );
   3.422 +
   3.423 +inline
   3.424 +PRMetaTask *
   3.425 +PR_int__create_generic_slave_meta_task( void *initData );
   3.426 +
   3.427 +void
   3.428 +PR_int__free_lang_meta_task_and_remove_from_coll( void *langMetaTask );
   3.429 +
   3.430 +inline
   3.431 +void
   3.432 +PR_int__insert_meta_task_into_slave( PRMetaTask *task, SlaveVP *slave );
   3.433 +
   3.434 +inline
   3.435 +void
   3.436 +PR_int__insert_lang_meta_task_into_slave__ML( void *langMetaTask, SlaveVP *slave );
   3.437 +
   3.438 +inline
   3.439 +void *
   3.440 +PR_int__give_lang_meta_task_from_slave( SlaveVP *slave, int32 magicNumer );
   3.441 +
   3.442 +inline
   3.443 +SlaveVP *
   3.444 +PR_PI__give_slave_lang_meta_task_is_assigned_to( void *langMetaTask );
   3.445 +
   3.446 +//==============
   3.447 +//=== Lang Data
   3.448 +//=
   3.449 +inline
   3.450 +void *
   3.451 +PR_PI__create_lang_data_in_slave( int32 size, LangDataFreer freer,
   3.452 +                                   SlaveVP *slave, int32 magicNum );
   3.453 +
   3.454 +inline
   3.455 +void *
   3.456 +PR_int__give_lang_data_from_slave( SlaveVP *slave, int32 magicNumer );
   3.457 +
   3.458 +inline
   3.459 +void *
   3.460 +PR_int__give_lang_data_of_prolog( PRLangData *langData);
   3.461 +
   3.462 +//==================================================
   3.463 +//===  Collection
   3.464 +//=
   3.465 +PRCollElem ** //return an array of pointers
   3.466 +PR_int__make_collection_of_size( int32 numInColl );
   3.467 +
   3.468 +inline
   3.469 +void
   3.470 +PR_int__insert_elem_into_collection( PRCollElem *elem, PRCollElem **coll, int32 hash );
   3.471 +
   3.472 +inline
   3.473 +void
   3.474 +PR_int__replace_or_insert_elem_into_collection( PRCollElem *elem, 
   3.475 +                                                PRCollElem **coll, 
   3.476 +                                                int32 hash );
   3.477 +
   3.478 +inline
   3.479 +void *
   3.480 +PR_int__lookup_elem_in_collection( int32 hash, PRCollElem **coll );
   3.481 +
   3.482 +inline
   3.483 +void
   3.484 +PR_int__remove_elem_from_collection( int32 hash, PRCollElem **coll );
   3.485 +
   3.486 +inline
   3.487 +void
   3.488 +PR_int__set_collection_to_empty( PRCollElem **coll );
   3.489 +
   3.490 +inline
   3.491 +void
   3.492 +PR_int__apply_Fn_to_all_in_collection( void (*Fn)(void *), PRCollElem **coll );
   3.493 +
   3.494 +//===========
   3.495 +//===
   3.496 +//=
   3.497 +void
   3.498 +PR_int__error( char *msgStr );
   3.499 +
   3.500 +void
   3.501 +PR_int__throw_exception( char *msgStr, SlaveVP *reqstSlv, PRExcp *excpData );
   3.502 +
   3.503 +/*Some macro magic -- the __FILE__ turns into a string, and the 
   3.504 + * preprocessor merges the quotes.  But the __LINE__ turns into an int,
   3.505 + * so have to use the # operator to turn it into a string..  but the
   3.506 + * # operator doesn't expand what comes after, so have to do an extra
   3.507 + * level so that pre-processor first expands __LINE__ into number then 
   3.508 + * hands to the # operator, which turns into string (then it merges
   3.509 + * quotes)
   3.510 + */
   3.511 +#define PR__throw_simple_exception( throwingVP ) \
   3.512 +   do{ PR_int__throw_exception( __FILE__ ", " STR(__LINE__), throwingVP, NULL ); \
   3.513 +     } while(0)
   3.514 +
   3.515 +#define STR( s ) #s
   3.516 +
   3.517 +char *
   3.518 +PR_int__strDup( char *str );
   3.519 +
   3.520 +inline void
   3.521 +PR_int__get_wrapper_lock();
   3.522 +
   3.523 +inline void
   3.524 +PR_int__get_master_lock();
   3.525 +
   3.526 +inline void
   3.527 +PR_int__get_malloc_lock();
   3.528 +
   3.529 +inline void
   3.530 +PR_int__pthread_wait_for_condition(int32* condVar);
   3.531 +
   3.532 +#define PR_int__release_master_lock()  _PRTopEnv->masterLock  = UNLOCKED
   3.533 +
   3.534 +#define PR_int__release_wrapper_lock() _PRTopEnv->wrapperLock = UNLOCKED
   3.535 +
   3.536 +#define PR_int__release_malloc_lock()  _PRTopEnv->mallocLock  = UNLOCKED
   3.537 +
   3.538 +inline uint32_t
   3.539 +PR_int__randomNumber();
   3.540 +
   3.541 +inline void
   3.542 +PR_int__backoff_for_TooLongToGetLock( int32 numTriesToGetLock );
   3.543 +
   3.544 +#endif	/* _PR_INT_H */
   3.545 +
     4.1 --- a/PR__structs__common.h	Fri Feb 28 21:16:50 2014 +0100
     4.2 +++ b/PR__structs__common.h	Tue Mar 04 12:45:08 2014 -0800
     4.3 @@ -10,6 +10,7 @@
     4.4  #define	_PR__structs__common_H
     4.5  #define _GNU_SOURCE
     4.6  
     4.7 +#include <setjmp.h>
     4.8  #include <pthread.h>
     4.9  #include <sys/time.h>
    4.10