PWSTR WStrFromScalar(PERL_CALL SV *string, BOOL isRef) { if(!string) return NULL; if(isRef && !(string = SvROK(string) ? SvRV(string) : NULL)) return NULL; return S2W(SvPV(string, PL_na)); }
U0 Zoom(F64 d) { F64 sx,sy,wx,wy; I64 i,x=ipx,y=ipy; d=Exp(Ln(d)/ZOOM_STEPS); for (i=0;i<ZOOM_STEPS;i++) { S2W(x,y,&wx,&wy); zoom=Limit(zoom*d,0.02,50); W2S(wx,wy,&sx,&sy); task->win_scroll_x=ipx-sx-task->win_pixel_left; task->win_scroll_y=ipy-sy-task->win_pixel_top; Sleep(10); } }
PWSTR NonEmptyWStrFromScalar(PERL_CALL SV *string, BOOL isRef) { if(!string) return NULL; if(isRef && !(string = SvROK(string) ? SvRV(string) : NULL)) return NULL; PSTR str = SvPV(string, PL_na); if(str && *str) return S2W(str); return NULL; }
PWSTR WStrFromHash(PERL_CALL HV *hash, PSTR idx, BOOL isRef) { if(isRef && hash) { if(!(hash = SvROK(hash) ? (HV*)SvRV(hash) : NULL)) return NULL; if(SvTYPE(hash) != SVt_PVHV) return NULL; } SV **item = hash ? hv_fetch(hash, idx, strlen(idx), 0) : NULL; if(item && *item) return S2W(SvPV(*item, PL_na)); else return NULL; }
PWSTR WStrFromArray(PERL_CALL AV *array, int idx, BOOL isRef) { if(isRef && array) { if(!(array = SvROK(array) ? (AV*)SvRV(array) : NULL)) return NULL; if(SvTYPE(array) != SVt_PVAV) return NULL; } SV **item = array ? av_fetch(array, idx, 0) : NULL; if(item && *item) return S2W(SvPV(*item, PL_na)); else return NULL; }