17f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/*
27f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project * Copyright (C) 2008 The Android Open Source Project
37f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project *
47f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project * Licensed under the Apache License, Version 2.0 (the "License");
57f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project * you may not use this file except in compliance with the License.
67f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project * You may obtain a copy of the License at
77f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project *
87f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project *      http://www.apache.org/licenses/LICENSE-2.0
97f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project *
107f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project * Unless required by applicable law or agreed to in writing, software
117f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project * distributed under the License is distributed on an "AS IS" BASIS,
127f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
137f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project * See the License for the specific language governing permissions and
147f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project * limitations under the License.
157f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project */
167f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project
177f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project#ifndef bbs_CONTEXT_EM_H
187f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project#define bbs_CONTEXT_EM_H
197f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project
207f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/* ---- includes ----------------------------------------------------------- */
217f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project
227f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project#include "b_BasicEm/Basic.h"
237f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project#include "b_BasicEm/MemTbl.h"
247f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project#include "b_BasicEm/DynMemManager.h"
257f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project
267f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/* ---- related objects  --------------------------------------------------- */
277f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project
287f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Projectstruct bbs_Context;
297f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project
307f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/* ---- typedefs ----------------------------------------------------------- */
317f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project
327f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/** error handler function pointer */
337f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Projecttypedef void ( *bbs_errorFPtr )( struct bbs_Context* cpA );
347f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project
357f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/** callback handler function pointer */
367f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Projecttypedef uint32 ( *bbs_callbackFPtr )( struct bbs_Context* cpA );
377f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project
387f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/* ---- constants ---------------------------------------------------------- */
397f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project
407f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project#define bbs_CONTEXT_MAX_ERRORS			8
417f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project#define bbs_CONTEXT_MAX_MEM_MANAGERS	8
427f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project
437f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project#ifdef bbs_COMPACT_MESSAGE_HANDLING
447f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/* characters allocated for file name string (string is stored rightbound) (minimum 1)*/
457f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project#define bbs_ERROR_MAX_FILE_CHARS	24
467f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/* characters allocated for text message (minimum 1) */
477f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project#define bbs_ERROR_MAX_TEXT_CHARS	1
487f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project#else
497f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/* characters allocated for file name string (string is stored rightbound) (minimum 1)*/
507f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project#define bbs_ERROR_MAX_FILE_CHARS	52
517f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/* characters allocated for text message (minimum 1) */
527f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project#define bbs_ERROR_MAX_TEXT_CHARS	256
537f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project#endif
547f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project
557f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/* defined error codes */
567f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project#define bbs_ERR_OK						0	/* no error condition */
577f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project#define bbs_ERR_ERROR					1	/* generic error */
587f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project#define bbs_ERR_OUT_OF_MEMORY			2	/* malloc handler returns with NULL*/
597f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project#define bbs_ERR_MEMORY_OVERFLOW			3	/* not enough memory in a segment or no segment */
607f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project#define bbs_ERR_WRONG_VERSION			4	/* incompatible version in ..._memRead() */
617f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project#define bbs_ERR_CORRUPT_DATA			5	/* corrupt data in ..._memRead()*/
627f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project#define bbs_ERR_CALLBACK_ERROR			6	/* a defined error originiating from a callback function */
637f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project
647f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/* ---- object definition -------------------------------------------------- */
657f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project
667f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/** error object */
677f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Projectstruct bbs_Error
687f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project{
697f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project	/* error code */
707f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project	uint32 errorE;
717f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project
727f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project	/* line number */
737f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project	uint32 lineE;
747f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project
757f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project	/* file name */
767f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project	char fileE[ bbs_ERROR_MAX_FILE_CHARS ];
777f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project
787f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project	/* error text */
797f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project	char textE[ bbs_ERROR_MAX_TEXT_CHARS ];
807f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project};
817f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project
827f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/* ------------------------------------------------------------------------- */
837f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project
847f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/** context object */
857f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Projectstruct bbs_Context
867f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project{
877f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project
887f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project	/* ---- private data --------------------------------------------------- */
897f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project
907f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project	/** error stack */
917f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project	struct bbs_Error errStackE[ bbs_CONTEXT_MAX_ERRORS ];
927f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project
937f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project	/** error stack index */
947f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project	uint32 errIndexE;
957f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project
967f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project	/** memory table */
977f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project	struct bbs_MemTbl memTblE;
987f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project
997f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project	/** multiple purpose dynamic memory managers */
1007f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project	struct bbs_DynMemManager dynMemManagerArrE[ bbs_CONTEXT_MAX_MEM_MANAGERS ];
1017f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project
1027f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project	/** number of used memory managers */
1037f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project	uint32 dynMemManagerArrSizeE;
1047f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project
1057f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project	/** error function handler */
1067f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project	bbs_errorFPtr errorHandlerE;
1077f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project
1087f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project	/** callback function handler */
1097f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project	bbs_callbackFPtr callbackHandlerE;
1107f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project
1117f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project	/** user-defined pointer */
1127f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project	void* userPtrE;
1137f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project
1147f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project	/* ---- public data ---------------------------------------------------- */
1157f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project
1167f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project};
1177f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project
1187f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/* ---- associated objects ------------------------------------------------- */
1197f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project
1207f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/* ---- external functions ------------------------------------------------- */
1217f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project
1227f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/* ---- \ghd{ constructor/destructor } ------------------------------------- */
1237f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project
1247f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/** initializes bbs_Context  */
1257f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Projectvoid bbs_Context_init( struct bbs_Context* cpA );
1267f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project
1277f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/** frees bbs_Context  */
1287f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Projectvoid bbs_Context_exit( struct bbs_Context* cpA );
1297f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project
1307f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/* ---- \ghd{ operators } -------------------------------------------------- */
1317f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project
1327f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/** copy operator */
1337f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Projectvoid bbs_Context_copy( struct bbs_Context* cpA, const struct bbs_Context* srcPtrA );
1347f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project
1357f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/* ---- \ghd{ query functions } -------------------------------------------- */
1367f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project
1377f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/* ---- \ghd{ modify functions } ------------------------------------------- */
1387f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project
1397f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/** composes an error object */
1407f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Projectstruct bbs_Error bbs_Error_create( uint32 errorA, uint32 lineA, const char* fileA, const char* textA, ... );
1417f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project
1427f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/* ---- \ghd{ memory I/O } ------------------------------------------------- */
1437f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project
1447f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/* ---- \ghd{ exec functions } --------------------------------------------- */
1457f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project
1467f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/****** ERROR HANDLING *********/
1477f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project
1487f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/** puts an error onto the error stack (returns false if stack was already full) */
1497f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Projectflag bbs_Context_pushError( struct bbs_Context* cpA, struct bbs_Error errorA );
1507f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project
1517f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/** takes the last error from stack and returns it (when stack is empty: returns the error at stack position 0)*/
1527f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Projectstruct bbs_Error bbs_Context_popError( struct bbs_Context* cpA );
1537f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project
1547f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/** returns the last error of stack without removing it (when stack is empty: returns the error at stack position 0)*/
1557f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Projectstruct bbs_Error bbs_Context_peekError( struct bbs_Context* cpA );
1567f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project
1577f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/** returns true if the error stack is not empty */
1587f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Projectflag bbs_Context_error( struct bbs_Context* cpA );
1597f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project
1607f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/** sets error handler; returns pointer to previous error handler
1617f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project *  Pointer to Error handler can be NULL (->no handler call)
1627f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project *  The error handler is called by function pushError diectly after an error was posted
1637f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project */
1647f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Projectbbs_errorFPtr bbs_Context_setErrorHandler( struct bbs_Context* cpA,
1657f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project									       bbs_errorFPtr errorHandlerA );
1667f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project
1677f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/*******************************/
1687f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project
1697f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/****** CALLBACK HANDLING ******/
1707f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project
1717f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/** call the callback handler, push error if return value is != bbs_ERR_OK */
1727f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Projectvoid bbs_Context_doCallback( struct bbs_Context* cpA );
1737f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project
1747f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/** sets callback handler; returns pointer to previous callback handler
1757f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project *  Pointer to callback handler can be NULL (->no handler call)
1767f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project *  The callback handler is called by function doCallback
1777f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project */
1787f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Projectbbs_callbackFPtr bbs_Context_setCallbackHandler( struct bbs_Context* cpA,
1797f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project									             bbs_callbackFPtr callbackHandlerA );
1807f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project
1817f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/*******************************/
1827f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project
1837f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/******* MEMORY HANDLING *******/
1847f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project
1857f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/** adds a static memory segment to memory table of context */
1867f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Projectvoid bbs_Context_addStaticSeg(	struct bbs_Context* cpA,
1877f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project							    uint16* memPtrA, /* pointer to memory (32bit aligned)*/
1887f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project								uint32 sizeA,    /* size of memory segment in 16 bit units */
1897f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project								flag sharedA,    /* Indicates that this segment is to be shared among multiple objects */
1907f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project								uint32 idA );    /* ID of segment, id=0: unspecified */
1917f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project
1927f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/* adds a dynamic memory segment to memory table of context
1937f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project * Upon destruction of the context object any residual will be freed automatically
1947f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project */
1957f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Projectvoid bbs_Context_addDynamicSeg(	struct bbs_Context* cpA,
1967f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project								bbs_mallocFPtr mallocFPtrA,	/* function pointer to external mem alloc function (s. comment of type declaration)*/
1977f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project								bbs_freeFPtr freeFPtrA,     /* function pointer to external mem free function */
1987f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project								flag sharedA,    /* Indicates that this segment is to be shared among multiple objects */
1997f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project								uint32 idA );    /* ID of segment, id=0: unspecified */
2007f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project
2017f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project
2027f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/** Returns allocated memory in selected exclusive segment in units of 16bits */
2037f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Projectuint32 bbs_Context_exclAllocSize( struct bbs_Context* cpA, uint32 segIndexA );
2047f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project
2057f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/** Returns allocated memory in selected exclusive segment in units of 16bits
2067f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project *  Note that in case of static memory the return value might not reflect
2077f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project *  the actually allocated memory amount.
2087f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project */
2097f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Projectuint32 bbs_Context_shrdAllocSize( struct bbs_Context* cpA, uint32 segIndexA );
2107f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project
2117f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/*******************************/
2127f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project
2137f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project
2147f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/** quick compact setup for dynamic memory management environment
2157f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project *  creates an initialized segment with
2167f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project *  - one dynamic exclusive segment
2177f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project *  - one dynamic shared segment
2187f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project *  - error handler (can be NULL)
2197f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project *
2207f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project * Don't forget to call bbs_Context_exit on returned context if it goes out of scope
2217f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project */
2227f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Projectvoid bbs_Context_quickInit( struct bbs_Context* cpA,
2237f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project	 					    bbs_mallocFPtr mallocFPtrA,	/* function pointer to external mem alloc function (s. comment of type declaration)*/
2247f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project						    bbs_freeFPtr freeFPtrA,
2257f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project						    bbs_errorFPtr errorHandlerA );
2267f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project
2277f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project
2287f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project#endif /* bbs_CONTEXT_EM_H */
2297f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project
230