Re: Phix : variable types
- Posted by petelomax Dec 08, 2016
- 1366 views
Here is a long list of win32lib tweaks you might need (some others may be missing).
You should of course convince yourself these are individually correct before/when applying.
All of these are intended to make things compatible with both Phix and OpenEuphoria.
w32support or w32memory:
function l_SafePeek(object addr) --PL 29/4/09: -- if object(addr) then return {} -- else -- return 0 -- end if
ditto for l_SafePeek4s and l_SafePeek4u
w32support or w32utils:
global function w32rand32(atom N) --/**/ d = sq_mul(vOldSeed,d) --/* Phix d = vOldSeed * d -- RDS */
series.e:
global function next_number(object pName) -- sequence lRC -- PL 29/4/09
global function current_number(object pName) -- atom lNextNum -- PL 29/4/09
compat02.ew:
global function fetch_SYSTEMTIME( atom st ) -- PL 29/4/09: --return w32from_memory(ID_SYSTEMTIME, st ) return w32from_memory(st,ID_SYSTEMTIME) end function global function fetch_CHARFORMAT( atom CHARFORMAT ) --PL 29/4/09: --return w32from_memory(ID_CHARFORMAT, CHARFORMAT) return w32from_memory(CHARFORMAT,ID_CHARFORMAT) end function --PL 29/4/09??? --/**/ TVDISPINFO_TVITEMcchTextMax = {TVDISPINFO_item,sq_add(TVITEM_pszText,4)}, --/* Phix TVDISPINFO_TVITEMcchTextMax = {TVDISPINFO_item,TVITEM_pszText+4}, -- RDS */ integer xxxx global procedure w32release_all_mem() -- No longer needed. xxxx=1 -- suppress warnings -- PL 29/4/09 end procedure
rttext.e:
-- PL 29/4/09 --global function setContainer(sequence pNew) global function setContainer(object pNew)
w32file.e:
--constant WM_USER = #400 -- PL 29/4/09 global function getFullPathName(sequence pFile, integer pOption) -- sequence lShortFile -- PL 29/4/09 -- PL 29/4/09 --global function setSearchPaths(sequence pPaths) global function setSearchPaths(object pPaths)
w32memory:
-- PL 29/4/09 --xIsBadCodePtr = define_c_func(kernel32, "IsBadReadPtr", {C_LONG, C_LONG}, C_LONG), procedure l_MyFreeMem(atom pAddress) -- integer lMemSize -- PL 29/4/09 global function w32allot( object pDataType ) -- atom a -- PL 29/4/09 -- PL 29/4/09 (we just set this to 1!!) -- fieldv=sequence(lCnt) -- fieldv=0 (and fieldv is guaranteed to be 0 here anyway) function fetchSize(atom struct,atom at,sequence s,integer flag) -- PL 29/4/09 -- integer strlen,wsize,strtype integer strlen,wsize -- object x -- PL 29/4/09 function w32ElemAddr(atom struct,sequence s) -- atom at -- PL 29/4/09 -- object x -- PL 29/4/09 global procedure w32copy_field(atom struct,sequence s,atom origin) -- PL 29/4/09 -- integer size,sel,var,units integer sel,var,units global procedure w32poke_words(atom at,object words) --/**/ words = sq_floor(sq_rmdr(words,65536)) --/* -- Phix words = floor(remainder(words,65536)) --*/ -- RDS function internal_fetch( atom struct, sequence s ) -- sequence s0, result -- PL 29/4/09 function virtualise_blank(object strtype) --/**/ sm2 = sq_sub(s0,2) --/* -- Phix sm2 = s0-2 --*/ -- RDS function fetchSize(atom struct,atom at,sequence s,integer flag) -- PL 29/4/09 -- integer strlen,wsize,strtype integer strlen,wsize -- object x -- PL 29/4/09 --/**/ s[arrayPos..length(s)]=sq_sub(s[arrayPos..length(s)],1) --/* -- Phix s[arrayPos..length(s)]-=1 --*/ -- RDS
procedure l_SafePoke(atom addr, object thedata) -- PL 29/4/09 -- atom a, l
ditto for l_SafePoke4
w32msgs:
procedure fCleanUp(integer pErrCode, sequence pDispMsg) -- PL 29/4/09 --integer lRC, lNumUserIds, lCurControl integer lRC, lNumUserIds
w32utils
global function w32remainder(object a,object b) elsif sequence(b) then --PL 27/07/09: (DEV: untested) -- for i=1 to length(a) do for i=1 to length(b) do global function w32round(object a,object b,integer flag) elsif sequence(b) then --PL 27/07/09: (DEV: untested) -- for i=1 to length(a) do for i=1 to length(b) do
w32resources:
global function textToBitmap(sequence s) -- all spaces become 1 and all non-spaces become 0. --/**/ s = sq_eq(s,' ') --/* Phix s = ( s = ' ' ) -- RDS */ global function createMousePointer(integer x, integer y, sequence image) -- create the and mask --/**/ maskBits = sq_eq(image,' ') --/* Phix maskBits = ( image = ' ' ) -- RDS */ -- create the xor mask --/**/ maskBits = sq_eq(image,'.') --/* Phix maskBits = (image = '.') -- RDS */