1. Phix : win32lib7 project

Hi

Phix is shipped with win32lib 0.60. In order to run IDE 1.04, you need win32lib 0.70.4. We will call this win32lib7 for brevity. I am currently in the process of modifying win32lib7 so that it runs with Phix, the ultimate goal being a working IDE.

Up to now, in the demos, I have working
advanc.exe
kalaidascope.exw
appselect.exw
boxes.exw
minmax.exw
listviewstyles.exw
scroller.exw
simple_flattoolbar.exw

Most of the others are producing this error

C:\euphoria\Phix\demo\win32lib7\win32lib.ew:7498 in procedure setBackground() 
fatal exception #80000003 at #005FC661 
    id = {15} 
    flag = 0 
    bkData = -16 
    lNewBrush = 0 
    lOldBrush = <novalue> 
    lFillBrush = <novalue> 
    lNeedsBrush = 0 
    lStyles = <novalue> 
    lId = 15 
    lColor = 15790320 
    lHatched = 0 
    lComboEditId = <novalue> 
    hdc = <novalue> 
    rect = <novalue> 
    s = <novalue> 
    i = 1 
... called from C:\euphoria\Phix\demo\win32lib7\win32lib.ew:13638 in function createEx() 
    pControl = 17 
    pCaption = "LText3" 
    pOwner = 3 
    pLeft = 228'ä' 
    pTop = 80'P' 
    pWidth = 148'”' 
    pHeight = 20 
    styleFlags = 0 
    exFlags = 0 
    id = 15 
    at = <novalue> 
    hotkey = <novalue> 
    bgControl = <novalue> 
    style = <novalue> 
    result = <novalue> 
    hWnd = 2295218 
    flags = 1409286400.0 
    extendedflags = 0 
    lParenthWnd = 1707104 
    szClassName = 3566732 
    szCaption = 39090852 
    hMenu = 0 
    newhWnd = <novalue> 
    pstr = <novalue> 
    struct = <novalue> 
    ok = <novalue> 
    newobj = <novalue> 
    BBox = {228'ä',80'P',148'”',20} 
    lvcol = <novalue> 
    sbPanels = <novalue> 
    lHintText = "" 
    iIconInfo = <novalue> 
    autoclose = 0 
    lBGColor = -16 
    lBGType = 0 
    lUserPre = {} 
    lUserPost = <novalue> 
    lTemp = <novalue> 
    lControl = 17 
    cloneIt = 0 
    i = <novalue> 
... called from C:\euphoria\Phix\demo\Win32Demo\tvclick.exw:8 

at this point

                    lColor = colorValue(bkData) 
                    if ctrl_Bg_Brush[lId] = 0 then 
                        ctrl_Bg_Brush[lId] = w32Func(xCreateSolidBrush,{lColor}) 
                    end if 
                     
 >>>7498                if lColor != colorValue(ctrl_Bg_Color[ lId ]) then 
                        ctrl_Bg_Color[ lId ] = bkData 
         
                        -- create a new brush 
                        lNewBrush = w32Func( xCreateSolidBrush, {lColor} ) 
                    else 
                        repaintWindow(lId) 
                        lNewBrush = 0 
                    end if 
 

Any ideas or pointers gratefully received.

Cheers

Chris

new topic     » topic index » view message » categorize

2. Re: Phix : win32lib7 project

Hi

I've fixed the background color issue with

--in global function colorValue() 
    --Phix erroring out when passed an empty sequence - will set it to return Black 
    if sequence(pColor) and length(pColor) = 0 then 
        return 0 
    end if 
 

discovered by

? lColor 
? ctrl_Bg_Color[ lId ] 
? colorValue(ctrl_Bg_Color[ lId ]) 

Now ALL the win32demos shipped with Phix work. Will be working through the win32lib demos shipped with win32lib7 next. Unfortunately the IDE still doesn't work - it produces this error

D:\Phix\pEmit2.e:3738 in procedure Or_K_ridt() 
index 0 out of bounds, reading sequence length 44000 
    symidx = 43259 
    flags = 131073 
    p = 0 
    maxparams = 2 
... called from D:\Phix\pmain.e:3106 in function resolveRoutineId() 
    nsi = 0 
    k = 8 
    emsg = <novalue> 
... called from D:\Phix\pmain.e:3900 in function ParamList() 
    signature = {12} 
    paramsOnStack = 0 
    sig = <novalue> 
    act = <novalue> 
    k = <novalue> 
    pidx = 0 
    v = <novalue> 
    pfirst = <novalue> 
    pthis = <novalue> 
    pN = <novalue> 
    mcode = <novalue> 
    siglen = 1 
    sigidx = 1 
    ltype = <novalue> 
    actsig = {} 
    wasRoutineNo = 354 
    bpset = {{700676,1,43259}} 
    txids = {} 
    txcols = <novalue> 
    pmap = <novalue> 
    pdone = <novalue> 
    thisttidx = 15864 
    bpcol = <novalue> 
    rest_must_be_named = 0 
    minsiglen = 1 
    ptext = <novalue> 
    maxparms = <novalue> 
    i = <novalue> 
    j = <novalue> 
    i = <novalue> 
... called from D:\Phix\pmain.e:4883 in procedure Call() 
    rtnNo = 354 
    signature = <novalue> 
    rType = 70'F' 
    paramsOnStack = 0 
    R = <novalue> 
    s1 = 70'F' 
    opcode = <novalue> 
etc.... 

Again any suggestions pointers gratefully accepted

Cheers

Chris

new topic     » goto parent     » topic index » view message » categorize

3. Re: Phix : win32lib7 project

Hi

Looks like pretty much all the win32lib7 demos now work with Phix. Just have to re jig rand(), as it looks like Phix can't take a big a seed as Eu.

Chris

new topic     » goto parent     » topic index » view message » categorize

4. Re: Phix : win32lib7 project

ChrisB said...

Most of the others are producing this error

C:\euphoria\Phix\demo\win32lib7\win32lib.ew:7498 in procedure setBackground() 
fatal exception #80000003 at #005FC661 

Any ideas or pointers gratefully received.

Firstly, I fixed builtins\VM\pUnary such that e1407souma was like e1406sofa but set edi to 7, to get a proper error message.
I see you have identified the problem is in colorValue, which I changed like this:

--/**/      lPos = find(w32trim(sq_uminus(upper(pColor))), w32ColorNames)   --/* -- Phix 
            lPos = find(w32trim(-upper(pColor)), w32ColorNames)             --*/ -- RDS 

I'll try and see if I can get anywhere with the IDE tomorrow.

Regards, Pete

new topic     » goto parent     » topic index » view message » categorize

5. Re: Phix : win32lib7 project

Hi Pete

looking through procedure Or_K_ridt(), I just can't understand why p stays as 0, I can't debug it, as there is no relationship to any symbols in IDE, and the feedback it gives is limited to pEmit2. Sorry Pete, but at the moment this is beyond me. If I start messing with variables no doubt the law of unintended consequences will have a knock on effect somewhere else.

Cheers

Chris

new topic     » goto parent     » topic index » view message » categorize

6. Re: Phix : win32lib7 project

I have uploaded the tweaked for Phix win32lib7 (0.70.4) to Box.com for anyone interested

Cheers

Chris

new topic     » goto parent     » topic index » view message » categorize

7. Re: Phix : win32lib7 project

ChrisB said...

Unfortunately the IDE still doesn't work - it produces this error

D:\Phix\pEmit2.e:3738 in procedure Or_K_ridt() 
index 0 out of bounds, reading sequence length 44000 

Good news, I've found a quick fix. It appears to be struggling (IDE.exw line 14800/14908) with a routine_id mid-routine of the target routine/itself, presumably because it has not properly finalised the parameter link chains needed for type inference:

procedure click_OpenRecentFile(integer Self, integer Event, sequence Params) 
    setHandler(hold, w32HClick, routine_id("click_OpenRecentFile")) 
end procedure 

So I suggest changing it to:

atom r_click_OpenRecentFile 
procedure click_OpenRecentFile(integer Self, integer Event, sequence Params) 
--  setHandler(hold, w32HClick, routine_id("click_OpenRecentFile")) 
    setHandler(hold, w32HClick, r_click_OpenRecentFile) 
end procedure 
r_click_OpenRecentFile = routine_id("click_OpenRecentFile") 

(In my tests I replaced several other routine_id("click_OpenRecentFile") with r_click_OpenRecentFile)
I'll press on with a proper fix for this.

Regards, Pete

PS: I totally winged it for the "and/or need parenthesis" errors - and would be interested to compare with what you did.

new topic     » goto parent     » topic index » view message » categorize

8. Re: Phix : win32lib7 project

Hi

That's great news.

As far as the add parenthesis Phix 'suggestion' I added parenthesis trying to maintain operator precedence (and before or), and hoped. So far so good.

Look at the box.com files - search for CMB - most of the tweaks are labelled.

Cheers

Chris

new topic     » goto parent     » topic index » view message » categorize

9. Re: Phix : win32lib7 project

Hi

Currently stalled on w32Remainder() - Theres issues with remaindering sequences that differ between Phix and Eu - will probably just rewrite to take account of as many different scenarios as possible. ie

object w32Remainder(object a, object b)

a atom, b atom, return atom
a sequence (of atoms), b atom, return sequence of remainders of length a
a atom, b sequence (of atoms) return sequence of remainders of length b
a sequence, b sequence, sequence length same, return sequence of remainders of length a (= length b)
a sequence, b sequence, return error (crash message)

Oh, and Phix has no crashmessage (afaict), so commented this out for now.

Chris

new topic     » goto parent     » topic index » view message » categorize

10. Re: Phix : win32lib7 project

ChrisB said...

Currently stalled on w32Remainder() - Theres issues with remaindering sequences that differ between Phix and Eu - will probably just rewrite to take account of as many different scenarios as possible. ie

I thought that was sorted, anyway have you tried this:

global function w32remainder(object a,object b) 
    if sequence(a) then 
        for i=1 to length(a) do 
--          a[i]=remainder(a[i],b) 
            a[i]=w32remainder(a[i],b) 
        end for 
        return a 
    elsif sequence(b) then 
--      for i=1 to length(a) do 
        for i=1 to length(b) do 
--          b[i]=remainder(a,b[i]) 
            b[i]=w32remainder(a,b[i]) 
        end for 
        return b 
    end if 
    if compare(a,0.0)=compare(b,0.0) then 
        return remainder(a,b) 
    else 
        return b+remainder(a,b) 
    end if 
end function 

There is also sq_rmdr(), maybe this would be better:

global function w32remainder(object a,object b) 
    if sequence(a) then 
        for i=1 to length(a) do 
--/**/      a[i]=sq_rmdr(a[i],b)    --/* -- Phix 
            a[i]=remainder(a[i],b)  --*/ -- RDS 
        end for 
        return a 
    elsif sequence(b) then 
--      for i=1 to length(a) do 
        for i=1 to length(b) do 
--/**/      b[i]=sq_rmdr(a,b[i])    --/* -- Phix 
            b[i]=remainder(a,b[i])  --*/ -- RDS 
        end for 
        return b 
    end if 
    if compare(a,0.0)=compare(b,0.0) then 
        return remainder(a,b) 
    else 
        return b+remainder(a,b) 
    end if 
end function 

If neither of those work, can you give me some example parameters that go wrong, and what they should return.

ChrisB said...

Oh, and Phix has no crashmessage (afaict), so commented this out for now.

Thanks, I had spotted that too and have started work on it.

Pete

new topic     » goto parent     » topic index » view message » categorize

11. Re: Phix : win32lib7 project

Hi

Sure, and I thought it was sorted too, but I think its the number of permutations of atoms / sequences that w32Remider accepts. My feeling is that it should be left to the coder to use, and for w32Reminder to accept only atoms. It also makes no sense to send sequences of different lengths - how would you resolve w32Remainde({10,73,28}, {11, 3, 2 ,6, 14}) - but it is possible to do so with it currently.

Oh, the error is coming from a call from w32Round() - I could potentially simplify that too.

Cheers

Chris

new topic     » goto parent     » topic index » view message » categorize

12. Re: Phix : win32lib7 project

ChrisB said...

how would you resolve w32Remainde({10,73,28}, {11, 3, 2 ,6, 14})

I am officially confused now. Test code:

function w32remainder(object a,object b)  
    if sequence(a) then  
        for i=1 to length(a) do  
--          a[i]=remainder(a[i],b)  
            a[i]=w32remainder(a[i],b)  
        end for  
        return a  
    elsif sequence(b) then  
--      for i=1 to length(a) do  
        for i=1 to length(b) do  
--          b[i]=remainder(a,b[i])  
            b[i]=w32remainder(a,b[i])  
        end for  
        return b  
    end if  
    if compare(a,0.0)=compare(b,0.0) then  
        return remainder(a,b)  
    else  
        return b+remainder(a,b)  
    end if  
end function  
 
?w32remainder({10,73,28}, {11, 3, 2 ,6, 14}) 

Phix:

{{10,1,0,4,10},{7,1,1,1,3},{6,1,0,4,0}} 
eui (4.0.0):
{ 
  {10,1,0,4,10}, 
  {7,1,1,1,3}, 
  {6,1,0,4,0} 
} 
exwc (2.4):
{ 
  {10,1,0,4,10}, 
  {7,1,1,1,3}, 
  {6,1,0,4,0} 
} 
Further, these results match those from eui/exwc when (instead of recursive calls to w32remainder) using the original remainder (which causes phix grief).
Not that any of the results make any logical sense or seem of any practical value to me, of course, but at least they seem pretty consistent.

ChrisB said...

Oh, the error is coming from a call from w32Round() - I could potentially simplify that too.

I did notice, incidentally and not very importantly, this:

global function w32round(object a,object b,integer flag) 
    atom diff 
    integer sgn 
 
    if sequence(a) then 
        for i=1 to length(a) do 
            a[i]=remainder(a[i],b) 
        end for 
        return a 
    elsif sequence(b) then 
--      for i=1 to length(a) do 
        for i=1 to length(b) do 
            b[i]=remainder(a,b[i]) 
        end for 
        return b 
    end if 
 
    if b<=0.0 or a=0.0 then 
        return a 
    end if 
    if sequence(a) then 
        for i=1 to length(a) do 
            a[i]=w32round(a[i],b,flag) 
        end for 
        return a 
    end if 

The last six lines are simply never going to be executed, which may speak for the quality of the rest of the code...
Plus those two calls to remainder() look extremely suspicious!

I think you are probably quite right about changing the parameters to be atom only.

Pete

new topic     » goto parent     » topic index » view message » categorize

13. Re: Phix : win32lib7 project

Hi

I have dropped that in, and it seems to get past that now. I may still tidy that up, as you suggest.

I now have a splash screen, then another halt on colorValue - there's an emty sequence in a sequence, which I shall returna zero on when I get to it.

Cheers

Chris

new topic     » goto parent     » topic index » view message » categorize

14. Re: Phix : win32lib7 project

ChrisB said...

another halt on colorValue

Have you removed the mod you made as per post 2 and applied the one I suggested in post 4?

new topic     » goto parent     » topic index » view message » categorize

15. Re: Phix : win32lib7 project

Hi Pete

No. I shall try that.

Cheers

Chris

new topic     » goto parent     » topic index » view message » categorize

16. Re: Phix : win32lib7 project

Hi

Success! IDE starts up, and I can pop a few controls on there. I will go through some testing, and modifies so that it runs Phix as default. Many Thanks Pete.

Cheers

Chris

new topic     » goto parent     » topic index » view message » categorize

17. Re: Phix : win32lib7 project

Hi

As a side effect of trawling through the IDE, I now know the cause of what I thought was a windows manifest issue with eui.exe and euiw.exe. The blocking of text labels, it turns out, is a result of the default background colour being set to black (0), so you actually have to set the background colour of text labels as you go.

To see this in action, start the IDE, look at Options / Configure IDE, and look through the tabs - you will see the labels as blocked out (note, this does not appear to have been a universal effect, so you may not see it).

To cure it, add into IDE_config.ew, procedure ConfigWindow_onOpen (integer self, integer event, sequence params) : line 536, the following code (just below the variable declarations)

    atom sysColor = getSysColor(COLOR_WINDOW) 
     
    -- CMB not just Phix set the background color of the labels 
 
    --setWindowBackColor ( object id, object Color ) 
    setWindowBackColor ( Tab3_Lb1, sysColor ) 
    setWindowBackColor ( Tab6_LB1, sysColor ) 
    setWindowBackColor ( Tab4_LB1, sysColor ) 
    setWindowBackColor ( Tab1_Lb1, sysColor ) 
    setWindowBackColor ( Tab2_LB1, sysColor ) 
    setWindowBackColor ( Tab4_LB2, sysColor ) 
    setWindowBackColor ( Tab4_LB2, sysColor ) 
    setWindowBackColor ( Tab4_LB3, sysColor ) 
    setWindowBackColor ( Tab2_Lb2, sysColor ) 
    setWindowBackColor ( Tab6_lb4, sysColor ) 
    setWindowBackColor ( Tab4_LB4, sysColor ) 
    setWindowBackColor ( Tab2_Lb3, sysColor ) 
    setWindowBackColor ( Tab2_Lb4, sysColor ) 
    setWindowBackColor ( Tab2_LB5, sysColor ) 
    setWindowBackColor ( Tab6_lb5, sysColor ) 
    setWindowBackColor ( Tab2_lb6, sysColor ) 
    setWindowBackColor ( Tab6_lb6, sysColor ) 
    setWindowBackColor ( Tab6_lb7, sysColor ) 
    setWindowBackColor ( EditorPath, sysColor ) 
    setWindowBackColor ( LText366, sysColor ) 
    setWindowBackColor ( Tab3_Lb2, sysColor ) 
    setWindowBackColor ( Tab7_LB1, sysColor ) 
 
 

and if you have the issue, that'll fix it.

Cheers

Chris

new topic     » goto parent     » topic index » view message » categorize

18. Re: Phix : win32lib7 project

ChrisB said...

The blocking of text labels, it turns out, is a result of the default background colour being set to black (0), so you actually have to set the background colour of text labels as you go.

LOL! Is that all it was?! Good eye! grin

new topic     » goto parent     » topic index » view message » categorize

19. Re: Phix : win32lib7 project

I know!

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu