Page 3 of 6

Posted: Sat Mar 29, 2008 7:31 pm
by ABBKlaus
This will only work if TailBite is installed in the purebasic directory :?
Here´s my version :

Code: Select all

;/ PureBasic 4.10 
Procedure.s SpecialFolder(folderno)
  Protected listptr,Result$
  listptr=0 
  Result$=Space(#MAX_PATH) 
  SHGetSpecialFolderLocation_(0,folderno,@listptr) 
  SHGetPathFromIDList_(listptr,@Result$) 
  ProcedureReturn Trim(Result$) 
EndProcedure

Procedure.s PBVersion() ; Lance PB /VERSION 
  If OSVersion()>=#PB_OS_Windows_Vista 
    subkey.s="PureBasic.exe\DefaultIcon\" 
  Else 
    subkey.s="Applications\PureBasic.exe\DefaultIcon\" 
  EndIf 
  
  RegOpenKeyEx_(#HKEY_CLASSES_ROOT,@subkey,0,#KEY_READ,@keyhandle) 
  Out.s=Space(255) 
  DataSize.l=Len(Out) 
  RegQueryValueEx_(keyhandle,@name$,0,@Type,@Out,@DataSize) 
  RegCloseKey_(keyhandle) 
  
  Out=StringField(Out,1,",") 
  Out=GetPathPart(Out)+"Compilers\PBCompiler.exe" 
  
  pid=RunProgram(Out,"/version","",#PB_Program_Open|#PB_Program_Read|#PB_Program_Hide) 
  If pid 
    While ProgramRunning(pid) 
      Sortie.s + ReadProgramString(pid) + #CRLF$ 
    Wend 
  EndIf 
  Sortie=StringField(Sortie,1,Chr(13)) 
  
  ProcedureReturn Sortie 
EndProcedure 

Procedure.s TBVersion() ; Lance TB /VERSION 
  TBPreferencesPath$=SpecialFolder(#CSIDL_APPDATA) + "\TailBite\"
  PBVersion$ = UCase(PBVersion())
  PBVersion$ = RemoveString(PBVersion$, "PUREBASIC")
  PBVersion$ = RemoveString(PBVersion$, "WINDOWS")
  PBVersion$ = RemoveString(PBVersion$, "X86")
  PBVersion$ = RemoveString(PBVersion$, "(")
  PBVersion$ = RemoveString(PBVersion$, ")")
  PBVersion$ = RemoveString(PBVersion$, "-")
  PBVersion$ = RemoveString(PBVersion$, "V")
  PBVersion$ = Trim(PBVersion$)
  PBnbVersion=Val(RemoveString(PBVersion$,"."))
  If PBnbVersion
    TBPreferencesPath$=TBPreferencesPath$+"TailBite_"+Str(PBnbVersion)+".prefs"
  Else
    TBPreferencesPath$=TBPreferencesPath$+"TailBite.prefs"
  EndIf
  If OpenPreferences(TBPreferencesPath$)
    Out.s=ReadPreferenceString("TBFolder","")+"TailBite.exe"
    pid=RunProgram(Out,"/version","",#PB_Program_Open|#PB_Program_Read|#PB_Program_Hide) 
  EndIf
  If pid 
    While ProgramRunning(pid) 
      Sortie.s + ReadProgramString(pid) + #CRLF$ 
    Wend 
    Sortie=StringField(Sortie,1,Chr(13)) 
    ProcedureReturn Sortie 
  EndIf 
EndProcedure 

MessageRequester("Version","PureBasic : "+PBVersion()+#CRLF$+"Tailbite     : "+TBVersion())

Posted: Sat Mar 29, 2008 8:44 pm
by Droopy
thanks i take a look @ your code :wink:

Posted: Mon Apr 21, 2008 4:47 pm
by ABBKlaus
New Version is out :
[34] APR 21th 2008 TailBite v1.3 PR 1.872
- fixed varalias bug (reported by LNA)
- fixed detection of modifiers (reported by Mistrel)
- switched to new sourcecode ordering (Thanks to Progi1984)
Regards Klaus

Posted: Mon Apr 21, 2008 7:24 pm
by Mistrel
Thank you for the update, ABBKlaus. :)

Posted: Tue Apr 22, 2008 8:28 pm
by ABBKlaus
New version is out :
[35] APR 22th 2008 TailBite v1.3 PR 1.873
- fixed creation of resident (reported by ts-soft)
Regards Klaus

Posted: Sun May 25, 2008 1:10 am
by ABBKlaus
New version is out :
[37] MAI 25th 2008 TailBite v1.3 PR 1.875
- fixed PureBasic PB4.20 final problem with pb_align / pb_bssalign = align (macro´s are the same)
- improved GetPBFolder() reads uninstall information to determine PureBasic installation path (thanks to mistrel)
PS:
as a side effect the folder-detection does only work for PB4.20, not the older versions.
If backward compatibility is wanted you should install TailBite in separate folders and put the appropriate 'tailbite.prefs' file in it.

Regards Klaus

Posted: Mon May 26, 2008 8:56 am
by Mistrel
I just compiled PureGDK (126 libs) with TailBite 1.875 for PureBasic 4.20 and it works great.

Thank you, ABBKlaus!

I'm not sure what you're using now to identify the PB directory that's not backwards compatible. I've revisited my lookup commands if you would like to take any part of the changes:

http://www.purebasic.fr/english/viewtop ... 334#245334

Posted: Tue May 27, 2008 9:39 am
by srod
With the latest version, TBManager ignores the folder I select to have the generated ASM files stored in! It always sticks them in MyDocuments etc.

Posted: Tue May 27, 2008 4:34 pm
by ABBKlaus
@mistrel : both registrykeys are present now, its impossible to know which one is the right.

@srod : the change in 'Asm source folder:' is only saved if you hit the 'Save' button :wink:

Posted: Tue May 27, 2008 4:35 pm
by srod
Doh! :oops:

hehe

Posted: Tue May 27, 2008 4:42 pm
by ABBKlaus
I just uploaded a new test-version : http://www.tailbite.com/downloads/TailB ... R1.876.zip

I make it final if someone says it works :twisted:
[38] MAI 27th 2008 TailBite v1.3 PR 1.876
- fixed GetPBFolder (thanks to ts-soft)
- fixed string bug in exported functions RET X + 4 (thanks to Fred / srod / gnozal)
Note from Gnozal : don't use exported string functions in the library
Example that crashes on MySecondProcedure() :

Code: Select all

ProcedureDLL.s MyProcedure()
  ProcedureReturn "TEST"
EndProcedure

ProcedureDLL.s MySecondProcedure()
  ProcedureReturn MyProcedure() ; <- will crash
EndProcedure
Safe example :

Code: Select all

Procedure.s MyLocalProcedure()
  ProcedureReturn "TEST"
EndProcedure

ProcedureDLL.s MyProcedure()
  ProcedureReturn MyLocalProcedure()
EndProcedure

ProcedureDLL.s MySecondProcedure()
  ProcedureReturn MyLocalProcedure()+"1"
EndProcedure

Posted: Tue May 27, 2008 4:46 pm
by freak
> @mistrel : both registrykeys are present now, its impossible to know which one is the right.

This is only on XP:
4.20 use HKEY_CURRENT_USER now due to some problems with admin accounts. (so it is the same as on Vista)
So the key in HKEY_CLASSES_ROOT is probably left from a 4.10 version.

I will add some code to clear the HKEY_CLASSES_ROOT location (if possible) in the future.

Posted: Tue May 27, 2008 10:29 pm
by Mistrel
1.876 works great. I think the problem is fixed. :)
Note from Gnozal : don't use exported functions in the library
Would you give an example of this?

Posted: Tue May 27, 2008 10:44 pm
by srod
At the moment you should not have a function inside your library calling an exported string function inside the same library. Avoid this and (Klaus' fix withstanding! :wink: ) you should be okay.

Posted: Tue May 27, 2008 11:47 pm
by ABBKlaus
Thanks for testing. Just uploaded the new version.
I made some examples of how it crashes and how it should be done the safe way.

@Freak : does this mean you will be releasing a bugfix version 4.21 :P
[38] MAI 27th 2008 TailBite v1.3 PR 1.876
- fixed GetPBFolder (thanks to ts-soft)
- fixed string bug in exported functions RET X + 4 (thanks to Fred / srod / gnozal)
Note from Gnozal : don't use exported string functions in the library
Forum thread : http://www.purebasic.fr/english/viewtop ... 189#230189