TailBite specific forum
Moderators: gnozal , ABBKlaus , lexvictory
Droopy
Enthusiast
Posts: 658 Joined: Thu Sep 16, 2004 9:50 pm
Location: France
Contact:
Post
by Droopy » Thu Mar 17, 2011 2:57 pm
Hello,
Code: Select all
ProcedureDLL.s GetFilePartWE(file.s) ; Return only file part without extension
file.s=ReverseString(GetFilePart(file))
file=Right(file,Len(file)-FindString(file,".",1))
file=ReverseString(file)
ProcedureReturn file
EndProcedure
Test :
Code: Select all
Debug GetFilePartWE(ProgramFilename())
The function return Purebasic1
With Tailbite 1.4.7 the function return : C:\Users\descaves\AppData\Local\Temp\Purebasic1.exePurebasic1
Any idea ?
gnozal
PureBasic Expert
Posts: 4229 Joined: Sat Apr 26, 2003 8:27 am
Location: Strasbourg / France
Contact:
Post
by gnozal » Thu Mar 17, 2011 3:19 pm
Iirc it's a known Tailbite issue with string returning functions when used as procedure parameters.
I guess this code works ?
Code: Select all
Tmp.s = ProgramFilename()
Debug GetFilePartWE(Tmp)
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
Droopy
Enthusiast
Posts: 658 Joined: Thu Sep 16, 2004 9:50 pm
Location: France
Contact:
Post
by Droopy » Thu Mar 17, 2011 3:37 pm
Hello Gnozal.
I know a function wich return string can't call another function wich return string.
But i call GetProgramFilename() wich is an internal function.
Your solution works.
My old lib (Purebasic 3.94) works well with this function.
Could this bug be fixed ?
gnozal
PureBasic Expert
Posts: 4229 Joined: Sat Apr 26, 2003 8:27 am
Location: Strasbourg / France
Contact:
Post
by gnozal » Thu Mar 17, 2011 3:46 pm
I guess it's related to the other string issues.
It probably could be fixed but I am no asm guru.
And the fix should only be applied if a function was used as string parameter.
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
Droopy
Enthusiast
Posts: 658 Joined: Thu Sep 16, 2004 9:50 pm
Location: France
Contact:
Post
by Droopy » Thu Mar 17, 2011 4:45 pm
Code: Select all
ProcedureDLL.s Test(file.s)
ProcedureReturn
EndProcedure
Compiled and tested with MessageRequester("",Test(ProgramFilename()))
return C:\Users\descaves\AppData\Local\Temp\Purebasic1.exe
Droopy
Enthusiast
Posts: 658 Joined: Thu Sep 16, 2004 9:50 pm
Location: France
Contact:
Post
by Droopy » Thu Mar 17, 2011 10:49 pm
Is it possible to create a topic for asm guru to fix this bug ?
lexvictory
Addict
Posts: 1027 Joined: Sun May 15, 2005 5:15 am
Location: Australia
Contact:
Post
by lexvictory » Mon Mar 21, 2011 11:52 am
I don't know that it can be fixed; string handling is done differently in PB made functions than it is in C - at least from what I can tell by the example sources in C
I might take a look when I get the time, but if someone can figure out the cause of it I might be able to write a quick fix...
I may have thought of a solution to calling another TB string function from a TB procedure, but we'll see how that works...
Demonio Ardente
Currently managing Linux & OS X Tailbite
OS X TailBite now up to date with Windows!