Page 5 of 10

Posted: Wed Oct 17, 2007 7:15 pm
by ABBKlaus
i think i found it :D

new version is out : V1.3 PR 1.859
[21] OKT 17th 2007 TailBite v1.3 PR 1.859
- fixed problem with :Import section (found by srod)
see first post for more details.

Regards Klaus

Posted: Wed Oct 17, 2007 7:23 pm
by srod
Thanks Klaus; works much better! :)

Posted: Fri Nov 16, 2007 1:36 pm
by srod
Klaus,

I have a problem with Tailbite.

Basically, all of my ProcedureDLL() statements have been replaced by a macro so that, for example,

Code: Select all

ProcedureDLL MyProc()
has been replaced with :

Code: Select all

Proc MyProc()
etc.

Now, the macro is working fine - no problem there. However, Tailbite is refusing to acknowledge the exported functions and is completely ignoring them!

The only way I figure this can happen is if Tailbite actually runs through the source code BEFORE the compiler applies the macros, identifying ProcedureDLL() statements. Is this correct?

If so, would it be much work to get Tailbite to run through the modified source instead, assuming that the PB compiler saves a copy of this modified source somewhere?
If not, I'll obviously have to remove the macro as I can see no way around it.

Thanks.

Posted: Fri Nov 16, 2007 1:52 pm
by gnozal
Iirc, Tailbite parses the compiler generated 'PureBasic.asm' file and not the source file.
If the compiler does not translate the macros in 'PureBasic.asm', it may be difficult to Tailbite to handle macros.
Could you have a look at PureBasic.asm (compile with /COMMENTED) and see if the macros are translated ?

Posted: Fri Nov 16, 2007 1:58 pm
by srod
Thinking about it Gnozal, Tailbite must parse the source and I recall El-Choni saying something to the effect that it does indeed run through and lists the procedures to be exported.

I don't think there's anything in the commented asm which labels the procedure as exported, but I'll have a look to be sure. :)

Posted: Fri Nov 16, 2007 2:03 pm
by gnozal
srod wrote:Thinking about it Gnozal, Tailbite must parse the source and I recall El-Choni saying something to the effect that it does indeed run through and lists the procedures to be exported.

I don't think there's anything in the commented asm which labels the procedure as exported, but I'll have a look to be sure. :)
I had a quick look at the sources :

Code: Select all

...
    PBSourceFileSize = FileSize(TBTempPath$+"PureBasic.asm")
    *PBSourceFile = AllocateMemory(PBSourceFileSize)
    ReadData(0, *PBSourceFile, PBSourceFileSize)
    CloseFile(0)
    If QuietMode=0
      SetGadgetText(0,Language("TailBite","CreateFuncList"))
    EndIf
    ResidentFile = 0
    CheckPrevious:
    If CreateFunctionList(*PBSourceFile, *PBSourceFile+PBSourceFileSize)
...
It seems that CreateFunctionList() uses the ASM file and not the source.

Code: Select all

Procedure CreateFunctionList(FileStart, FileEnd)
  Debug "CreateFunctionList()"
  WriteLog("CreateFunctionList()")
...  
    If UCase(PeekS(*FileSeeker, 11))="; PROCEDURE" And PeekS(*FileSeeker-Len(WNL$), 2)=WNL$ And PeekB(NextSeeker+Len(WNL$))<>';' And *FileSeeker<FileEnd
      IndexSeeker = FindNextString("macro MP", *FileSeeker, FileEnd)+Len("macro MP")
      FIndex = Val(GetNextString(IndexSeeker, "{"))
      *FileSeeker = FindNextString("; Procedure", IndexSeeker, FileStart)
      *FileSeeker+11
      DLLFunction = 0
      If UCase(PeekS(*FileSeeker, 3))="DLL"
        *FileSeeker+3
        DLLFunction = 1
      ElseIf UCase(PeekS(*FileSeeker, 4))="CDLL"
        *FileSeeker+4
        DLLFunction = 1
      EndIf
...

Posted: Fri Nov 16, 2007 2:08 pm
by srod
Yes, that tallies with what I'm seeing with the generated asm in which I have not used the macro.

This is strange. I'd better have a closer look at the macro then.

Thanks.

Posted: Fri Nov 16, 2007 2:12 pm
by srod
Gnozal, in the commented ASM, Purebasic places the name of the macro instead of "; Procedure" etc.

Bugger! No way around this!

Back to good old search and replace then! :?

Posted: Fri Nov 16, 2007 4:52 pm
by ABBKlaus
@srod,

i think you have to ask Fred to change that behaviour of a macro, since TailBite relies only on the commented ASM output that PB supplies :twisted:

Regards Klaus

Posted: Fri Nov 16, 2007 6:13 pm
by srod
ABBKlaus wrote:@srod,

i think you have to ask Fred to change that behaviour of a macro, since TailBite relies only on the commented ASM output that PB supplies :twisted:

Regards Klaus
Aye, though I reckon Fred is perhaps a little busy at the moment! The thing is that there are good arguments for placing the original PB source code (without macros being substituted for their textual content) into the generated asm. Oh well.

Posted: Mon Nov 19, 2007 5:23 pm
by Denis
Hi ABBKlaus,

With the last version of Tailbite installer, i didn't get right PB folder under Vista.
I use your code with a modififcation to get it correctly.

@Gnozal, this is the same for your libs (almost PureColor)

Here is the modified code i use for my Gdi+ 1.0 installer
added code between lines ;-----------

Code: Select all

Procedure.s GetPBFolder()
  Protected hKey1.l, Type.l, Res.l, Folder$, lpbData.l, cbData.l
 
  cbData = (#MAX_PATH*2)+2
  lpbData = AllocateMemory(cbData)
 
  Folder$=""
  hKey1=0
  Type=0
  Res=-1
 
  Select OSVersion()
    Case #PB_OS_Windows_95,#PB_OS_Windows_98,#PB_OS_Windows_ME
      Debug "Detected OS : Windows 95/98/ME"
      Res=RegOpenKeyEx_(#HKEY_LOCAL_MACHINE, "Software\Classes\PureBasic.exe\shell\open\command", 0, #KEY_ALL_ACCESS, @hKey1)
    Case #PB_OS_Windows_NT3_51,#PB_OS_Windows_NT_4,#PB_OS_Windows_2000,#PB_OS_Windows_XP,#PB_OS_Windows_Server_2003
      Debug "Detected OS : Windows NT/2000/XP"
      Res=RegOpenKeyEx_(#HKEY_CLASSES_ROOT, "Applications\PureBasic.exe\shell\open\command", 0, #KEY_ALL_ACCESS, @hKey1)
    Case #PB_OS_Windows_Vista,#PB_OS_Windows_Server_2008,#PB_OS_Windows_Future
      Debug "Detected OS : Windows Vista/Server 2008"
      Res=RegOpenKeyEx_(#HKEY_CURRENT_USER, "Software\Classes\PureBasic.exe\shell\open\command", 0, #KEY_ALL_ACCESS , @hKey1)
  EndSelect
 
  If Res = #ERROR_SUCCESS
    If RegQueryValueEx_(hKey1, "", 0, @Type, lpbData, @cbData)=#ERROR_SUCCESS
      Folder$ = PeekS(lpbData)
      Folder$ = GetPathPart(Mid(Folder$, 2, Len(Folder$)-7))
    EndIf
    RegCloseKey_(hKey1)
  EndIf
 
  If lpbData
    FreeMemory(lpbData)
    lpbData=0
  EndIf
 
;   ---------------------------------------------------------------
; la chaine depuis la beta4 se présente comme ceci sous Vista (sur ma machine)
; C:\Program Files\PureBasic 4.00\PureBasic.exe" "%1" /P "C:\Documents And Settings\ww\Application Data\PureBasic\PureBasic.prefs"
; je teste sur le % en ne gardant que la partie précédante

; since Beta 4, the string is somethink like that under Vista (on my computer)
; C:\Program Files\PureBasic 4.00\PureBasic.exe" "%1" /P "C:\Documents And Settings\ww\Application Data\PureBasic\PureBasic.prefs"
; I check if % is in the string and if so i keep only previous part of string.
  If FindString(Folder$, "%", 1) 
      Folder$ = StringField(Folder$, 1, "%")
      Folder$ = GetPathPart(Folder$)
  EndIf
;   ---------------------------------------------------------------

  ProcedureReturn Folder$
EndProcedure


Posted: Mon Nov 19, 2007 5:33 pm
by gnozal
Denis wrote:@Gnozal, this is the same for your libs (almost PureColor)
Did you try the latest download ?
I have updated the library installers a month ago : http://www.purebasic.fr/english/viewtop ... c&start=36

Posted: Mon Nov 19, 2007 5:56 pm
by ABBKlaus
@denis,
its fixed since 10.OKT.2007, you are using an outdated version :shock:

Posted: Mon Nov 19, 2007 6:39 pm
by Denis
@ABBKlaus

I downloaded the installer from this
http://www.tailbite.com/

and the version is V1.3PR1.8
Is-it oK ?

With this installer, PB folder i get is on my computer :

K:\PureBasic

instead

K:\PureBasic 4_10 finale\

Posted: Mon Nov 19, 2007 6:44 pm
by Denis
Sorry ABBKlaus , :D

i didn't saw the correct link V1.3 PR 1.859 :oops: