It is currently Wed Jan 22, 2020 9:11 pm

All times are UTC + 1 hour




Post new topic Reply to topic  [ 7 posts ] 
Author Message
 Post subject: GetFilePartWE
PostPosted: Thu Mar 17, 2011 2:57 pm 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Thu Sep 16, 2004 9:50 pm
Posts: 658
Location: France
Hello,

Code:
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:
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 ?

_________________
DroopyLib/PBFastLib/HMod


Top
 Profile  
Reply with quote  
 Post subject: Re: GetFilePartWE
PostPosted: Thu Mar 17, 2011 3:19 pm 
Offline
PureBasic Expert
PureBasic Expert
User avatar

Joined: Sat Apr 26, 2003 8:27 am
Posts: 4229
Location: Strasbourg / France
Iirc it's a known Tailbite issue with string returning functions when used as procedure parameters.

I guess this code works ?
Code:
Tmp.s = ProgramFilename()
Debug GetFilePartWE(Tmp)

_________________
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).


Top
 Profile  
Reply with quote  
 Post subject: Re: GetFilePartWE
PostPosted: Thu Mar 17, 2011 3:37 pm 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Thu Sep 16, 2004 9:50 pm
Posts: 658
Location: France
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 ?

_________________
DroopyLib/PBFastLib/HMod


Top
 Profile  
Reply with quote  
 Post subject: Re: GetFilePartWE
PostPosted: Thu Mar 17, 2011 3:46 pm 
Offline
PureBasic Expert
PureBasic Expert
User avatar

Joined: Sat Apr 26, 2003 8:27 am
Posts: 4229
Location: Strasbourg / France
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).


Top
 Profile  
Reply with quote  
 Post subject: Re: GetFilePartWE
PostPosted: Thu Mar 17, 2011 4:45 pm 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Thu Sep 16, 2004 9:50 pm
Posts: 658
Location: France
Code:
ProcedureDLL.s Test(file.s)
  ProcedureReturn
EndProcedure


Compiled and tested with MessageRequester("",Test(ProgramFilename()))
return C:\Users\descaves\AppData\Local\Temp\Purebasic1.exe

_________________
DroopyLib/PBFastLib/HMod


Top
 Profile  
Reply with quote  
 Post subject: Re: GetFilePartWE
PostPosted: Thu Mar 17, 2011 10:49 pm 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Thu Sep 16, 2004 9:50 pm
Posts: 658
Location: France
Is it possible to create a topic for asm guru to fix this bug ?

_________________
DroopyLib/PBFastLib/HMod


Top
 Profile  
Reply with quote  
 Post subject: Re: GetFilePartWE
PostPosted: Mon Mar 21, 2011 11:52 am 
Offline
Addict
Addict

Joined: Sun May 15, 2005 5:15 am
Posts: 1027
Location: Australia
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!


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 7 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 8 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  

 


Powered by phpBB © 2008 phpBB Group
subSilver+ theme by Canver Software, sponsor Sanal Modifiye