static void *pv_setmodvar( HSPEXINFO *hei, PVal *pv, int offset, int id, int size ) { // モジュール変数の内容を新規に設定する // PDAT *p; HspVarProc *varproc; FlexValue fv; FlexValue *target; char *newmem; fv.customid = id; fv.clonetype = 0; fv.size = size; fv.ptr = NULL; pv->offset=offset; varproc = hei->HspFunc_getproc( pv->flag ); p = varproc->GetPtr( pv ); varproc->Set( pv, p, &fv ); newmem = hei->HspFunc_malloc( size ); target = (FlexValue *)p; target->type = FLEXVAL_TYPE_ALLOC; target->ptr = (void *)newmem; return newmem; }
void HspVarCoreReDim( PVal *pval, int lenid, int len ) { // 配列を拡張する // HspVarProc *p; p = &hspvarproc[ pval->flag ]; pval->len[lenid] = len; p->Alloc( pval, pval ); }
static FlexValue *pv_getfv( HSPEXINFO *hei, PVal *pv, int offset ) { PDAT *p; HspVarProc *varproc; pv->offset=offset; varproc = hei->HspFunc_getproc( pv->flag ); p = varproc->GetPtr( pv ); return (FlexValue *)p; }
static void pv_allocblock( HSPEXINFO *hei, PVal *pv, int offset, int size ) { PDAT *p; HspVarProc *varproc; pv->offset=offset; varproc = hei->HspFunc_getproc( pv->flag ); p = varproc->GetPtr( pv ); varproc->AllocBlock( pv, p, size ); }
static char *pv_getblock( HSPEXINFO *hei, PVal *pv, int offset, int *size ) { PDAT *p; HspVarProc *varproc; pv->offset=offset; varproc = hei->HspFunc_getproc( pv->flag ); p = varproc->GetPtr( pv ); varproc->GetBlockSize( pv, p, size ); return (char *)p; }
static void *Hsp3GetBlockSize( HSPEXINFO *hei, PVal *pv, APTR ap, int *size ) { // (HSP3用) // pv,apからメモリブロックを取得する // PDAT *pd; HspVarProc *proc; proc = hei->HspFunc_getproc( pv->flag ); pv->offset = ap; pd = proc->GetPtr( pv ); return proc->GetBlockSize( pv,pd,size ); }
static void var_set_str_len( PVal *pval, APTR aptr, char *str, int len ) { // 変数にstrからlenバイトの文字列を代入する // HspVarProc *proc = HspVarCoreGetProc( HSPVAR_FLAG_STR ); if ( pval->flag != HSPVAR_FLAG_STR ) { if ( aptr != 0 ) throw HSPERR_INVALID_ARRAYSTORE; HspVarCoreClear( pval, HSPVAR_FLAG_STR ); } pval->offset = aptr; HspVarCoreAllocBlock( pval, proc->GetPtr( pval ), len + 1 ); char *ptr = (char *)proc->GetPtr( pval ); memcpy( ptr, str, len ); ptr[len] = '\0'; }
void HspVarCoreDimFlex( PVal *pval, int flag, int len0, int len1, int len2, int len3, int len4 ) { // 配列を確保する(可変長配列用) // (len1~len4は、4byte単位なので注意) // HspVarProc *p; p = &hspvarproc[ flag ]; if ((len1<0)||(len2<0)||(len3<0)||(len4<0)) throw HSPVAR_ERROR_ILLEGALPRM; HspVarCoreDispose( pval ); pval->flag = flag; pval->len[0] = len0; pval->offset = 0; pval->arraycnt = 0; pval->support = p->support; pval->len[1] = len1; pval->len[2] = len2; pval->len[3] = len3; pval->len[4] = len4; p->Alloc( pval, NULL ); pval->len[0] = 1; }
static void pv_alloc( HSPEXINFO *hei, PVal *pv, PVal *pv2 ) { HspVarProc *varproc; varproc = hei->HspFunc_getproc( pv->flag ); varproc->Alloc( pv, pv2 ); }
static void pv_dispose( HSPEXINFO *hei, PVal *pv ) { HspVarProc *varproc; varproc = hei->HspFunc_getproc( pv->flag ); varproc->Free( pv ); }