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'; }
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; }
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 ); }