one question that happens in x86 but not in x64(pb5&4.61)

Just starting out? Need help? Post your questions and find answers here.
ynkrc
User
User
Posts: 55
Joined: Sat Sep 03, 2011 5:28 am

one question that happens in x86 but not in x64(pb5&4.61)

Post by ynkrc »

I want to skin for window and found a question that happens in x86 but not in x64(pb5&4.61)
then Streamline the codes to below(error on line 48)

Code: Select all

Structure imgInfo
  ImgFromRect.rect
  ImgDrawRect.rect
  DrawOrNot.l
EndStructure

Structure Buttons
  ImgUrl.s
  ImgID.l
  ImgMouseOn.imgInfo
  ImgMouseOut.imgInfo
  ImgMouseDown.imageInfo
EndStructure

Structure skinInfo
  GlobalSkinImageID.l
  CloseButton.Buttons
  MaxButton.Buttons
  NomalButton.Buttons
  MinButton.Buttons
EndStructure

Global skin.skinInfo


Procedure getRectFromStr(Str.s,*rc.rect)
  If CountString(str,",")=3
    *rc\left=Val(StringField(str,1,","))
    *rc\top=Val(StringField(str,2,","))
    *rc\right=Val(StringField(str,3,","))
    *rc\bottom=Val(StringField(str,4,","))
  EndIf
  ProcedureReturn #True
EndProcedure
Procedure getImgInfoFromStr(Str.s,*ii.imgInfo)
  If CountString(str,"#")=2
    getRectFromStr(StringField(str,1,"#"),*ii\ImgFromRect)
    getRectFromStr(StringField(str,2,"#"),*ii\ImgDrawRect)
    *ii\DrawOrNot=Val(StringField(str,3,"#"))
  EndIf
EndProcedure
Procedure getButtonsFromStr(str.s,*bs.Buttons,imgId.l=0)
  If CountString(str,"|")=3
    getImgInfoFromStr(StringField(str,1,"|"),*bs\ImgMouseOut)
    getImgInfoFromStr(StringField(str,2,"|"),*bs\ImgMouseOn)
    getImgInfoFromStr(StringField(str,3,"|"),*bs\ImgMouseDown)
    temp.s=StringField(str,4,"|")
    *bs\ImgUrl=temp
  EndIf
EndProcedure

Procedure getSkinInfo(*sk.SkinInfo)
  getButtonsFromStr("144,1,180,18#-38,1,37,17#1|144,19,180,36#-38,1,37,17#1|144,37,180,54#-38,1,37,17#1|",*sk\CloseButton,*sk\GlobalSkinImageID)
  getButtonsFromStr("144,1,180,18#-38,1,37,17#1|144,19,180,36#-38,1,37,17#1|144,37,180,54#-38,1,37,17#1|",*sk\NomalButton,*sk\GlobalSkinImageID)
  getButtonsFromStr("144,1,180,18#-38,1,37,17#1|144,19,180,36#-38,1,37,17#1|144,37,180,54#-38,1,37,17#1|",*sk\MaxButton,*sk\GlobalSkinImageID)
  getButtonsFromStr("144,1,180,18#-38,1,37,17#1|144,19,180,36#-38,1,37,17#1|144,37,180,54#-38,1,37,17#1|",*sk\MinButton,*sk\GlobalSkinImageID)
EndProcedure

getSkinInfo(skin)
ynkrc
User
User
Posts: 55
Joined: Sat Sep 03, 2011 5:28 am

Re: one question that happens in x86 but not in x64(pb5&4.61

Post by ynkrc »

I have tested and found that
the value of "@*bs\imgUrl" have different values when the fourth Four calls
It occurs error on the third call,and
the value of "@*bs\imgUrl" in three calls are 0,0,1
It sames very strange!
:!:
Little John
Addict
Addict
Posts: 4777
Joined: Thu Jun 07, 2007 3:25 pm
Location: Berlin, Germany

Re: one question that happens in x86 but not in x64(pb5&4.61

Post by Little John »

Please do not post coding questions in the bug forum, and do not post the same question in multiple subforums :!:
(Also, any new topic should get a meaningful title.)
Thanks.
ynkrc
User
User
Posts: 55
Joined: Sat Sep 03, 2011 5:28 am

Re: one question that happens in x86 but not in x64(pb5&4.61

Post by ynkrc »

Little John wrote:Please do not post coding questions in the bug forum, and do not post the same question in multiple subforums :!:
Thanks.
oh,I am sorry ,but I had shared my code with several pber and found without Syntax error,So I thought it may be a bug,then posted the codes in the bug area wanting to make the Purebasic more and more perfect.
if you think it's not a bug,could you please tell me why the error occurs?
ynkrc
User
User
Posts: 55
Joined: Sat Sep 03, 2011 5:28 am

Re: one question that happens in x86 but not in x64(pb5&4.61

Post by ynkrc »

Little John wrote:Please do not post coding questions in the bug forum, and do not post the same question in multiple subforums :!:
(Also, any new topic should get a meaningful title.)
Thanks.
I have found a interesting way to solve the question:
change the position of line imgUrl.s like this then no error will occur.(not the first and not the last)

Code: Select all

Structure Buttons
  ImgID.l
  ImgMouseOn.imgInfo
  ImgMouseOut.imgInfo
  ImgUrl.s
  ImgMouseDown.imageInfo
EndStructure
But I don't know Why!
Could Somebody Tell Me? :(
User avatar
Rings
Moderator
Moderator
Posts: 1435
Joined: Sat Apr 26, 2003 1:11 am

Re: one question that happens in x86 but not in x64(pb5&4.61

Post by Rings »

moved...
SPAMINATOR NR.1
ynkrc
User
User
Posts: 55
Joined: Sat Sep 03, 2011 5:28 am

Re: one question that happens in x86 but not in x64(pb5&4.61

Post by ynkrc »

Rings wrote:moved...
....
moved?What does it mean?
Salc
User
User
Posts: 11
Joined: Tue Sep 25, 2012 9:20 am

Re: one question that happens in x86 but not in x64(pb5&4.61

Post by Salc »

If you use the right structure in buttons it should work.

Code: Select all

Structure Buttons
  ImgUrl.s
  ImgID.l
  ImgMouseOn.imgInfo
  ImgMouseOut.imgInfo
  ImgMouseDown.imageInfo   ;<-- This makes the problem, change it to imgInfo
EndStructure
Little John
Addict
Addict
Posts: 4777
Joined: Thu Jun 07, 2007 3:25 pm
Location: Berlin, Germany

Re: one question that happens in x86 but not in x64(pb5&4.61

Post by Little John »

if you think it's not a bug,could you please tell me why the error occurs?
Define varaibles for your structures. Pass the variable names to the respective procedures, NOT pointers. (I.e. * at the beginning is only OK here for the parameters in the procedure definition.) Use EnableExplicit at the beginning of the code, it will help you to locate problems of this kind. Maybe you also want to read in the help about pointers and structures, and how to pass them to procedures.

Code: Select all

; WRONG

Structure foo
   demo.i
EndStructure

Procedure test (*a.foo)
   *a\demo = 10
   Debug *a\demo
EndProcedure

test(*bar.foo)

Code: Select all

; CORRECT

Structure foo
   demo.i
EndStructure

Procedure test (*a.foo)
   *a\demo = 10
   Debug *a\demo
EndProcedure


Define bar.foo
test(bar)
Regards, Little John
ynkrc
User
User
Posts: 55
Joined: Sat Sep 03, 2011 5:28 am

Re: one question that happens in x86 but not in x64(pb5&4.61

Post by ynkrc »

Salc wrote:If you use the right structure in buttons it should work.

Code: Select all

Structure Buttons
  ImgUrl.s
  ImgID.l
  ImgMouseOn.imgInfo
  ImgMouseOut.imgInfo
  ImgMouseDown.imageInfo   ;<-- This makes the problem, change it to imgInfo
EndStructure
Oh!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!MyGod!
buddymatkona
Enthusiast
Enthusiast
Posts: 252
Joined: Mon Aug 16, 2010 4:29 am

Re: one question that happens in x86 but not in x64(pb5&4.61

Post by buddymatkona »

@ynkrc
Normally if you mistype the name of a structure, PB will let you know however, you made a very unlucky typo. :)
Run this by itself:

Code: Select all

EnableExplicit

  CompilerIf Defined(SomeTypo, #PB_Structure)
    Debug "Structure 'SomeTypo' is already declared"
  CompilerElse
     Debug "Structure 'SomeTypo' is not recognized"
  CompilerEndIf
  
  CompilerIf Defined(ImageInfo, #PB_Structure)
    Debug "Structure 'ImageInfo' is already declared"
  CompilerElse
     Debug "Structure 'ImageInfo' is not recognized"
  CompilerEndIf
Post Reply