Oxygen Basic

Programming => Problems & Solutions => Topic started by: Aurel on November 13, 2015, 02:05:31 PM

Title: Path lenght? LEN
Post by: Aurel on November 13, 2015, 02:05:31 PM
hello boys...
Something is very wrong with file path len calculated with oxygen.
Talking about file path with Mike on bp.org i found why my interpreter
not respond when file name have space...
because is calculated wrong.
so i tested to see what is file name and looks fine
but when i try to get proper file name lenght which is 39 i get 47  :o
how is that possible?
Title: Re: Path lenght? LEN
Post by: Aurel on November 14, 2015, 02:48:27 PM
still no answer...but i found bug or garbage problem:

FUNCTION Trim(string Main$="" ) As String
   String res$=""
   res$ = Rtrim(Main$)
     Return Ltrim(res$) ' this exit with garbage char "F"
End FUNCTION

as you can see function LTrim return F
is that fixed because i use older version?
Title: Re: Path lenght? LEN
Post by: Mike Lobanovsky on November 15, 2015, 04:41:21 AM
No bugs nor garbage seen here:

Code: OxygenBasic
  1. Include "$\inc\console.inc"
  2.  
  3. #LookAhead
  4.  
  5. Print "'" + Trim("   blabla   ") + "'"
  6.  
  7. WaitKey
  8.  
  9. Function Trim(String s) As String
  10.    Return Ltrim(Rtrim(s))
  11. End Function
  12.  

prints

Quote from: console
'blabla'

Do you ever try to load newer versions yourself to see what's been fixed and what's not?
Title: Re: Path lenght? LEN
Post by: Aurel on November 15, 2015, 09:13:09 AM
Quote
Do you ever try to load newer versions yourself to see what's been fixed and what's not?

yes of course ..what you think ?
but new or new-er version have so strange quirks that i cannot believe .
first of all i blame Oxygen tooo liberal syntax.
there is no such a string-problems in other BASICS.
i don't want to blame Charles for every tiny bug BUT that is real s*
because Oxygen is really great compiler and still suffer from such a bugs.
 >:(
Title: Re: Path lenght? LEN
Post by: Aurel on November 15, 2015, 10:17:25 AM
by the way which version is latest bug.fixed ?
Charles said that he can compile AsciEdit but ruben is another story  ::)
Title: Re: Path lenght? LEN
Post by: Mike Lobanovsky on November 15, 2015, 12:18:17 PM
first of all i blame Oxygen tooo liberal syntax.

Syntax in O2 is only as liberal as you would allow it to be. There is absolutely nothing that forbids you to write your code consistently, say, in camel case, utilize As Long and As String instead of int and char*, and Declare instead of !, and % instead of #define, and properly preformat and put your snippets in between {code=o2}{/code} or {code=c}{/code} tags (here {} stand for [] to make the tags visible). This will also display how much you respect, and care for, those who will come and see your submissions after you and who probably will offer help if needed if they like what they see and equally probably not if they don't. The style you choose for in-house development is entirely up to you while the style you expose to people had better be nice.

Quote
i don't want to blame Charles for every tiny bug BUT that is real s*

You shouldn't because OxygenBasic is a work in progress that's objectively here and will go on in the future regardless of whether Aurel's subjective ego is still around or no more. No reason to compare the incongruous.

Quote
by the way which version is latest bug.fixed

Scroll up to the Wizard at the top of this page and see the date beneath his feet. Click the Wizard to download the package.
Title: Re: Path lenght? LEN
Post by: Charles Pegge on November 15, 2015, 01:40:32 PM
Aurel,

Your function is not very clean, but it does work with the current o2 using this example:

Code: OxygenBasic
  1. FUNCTION Trim(string Main$="" ) As String
  2.    String res$=""
  3.    res$ = Rtrim(Main$)
  4.      Return Ltrim(res$) ' this exit with garbage char "F"
  5. End FUNCTION
  6.  
  7. print ">" & trim("  abc def  ") & "<" 'result: >abc def<
  8.  
Title: Re: Path lenght? LEN
Post by: Aurel on November 15, 2015, 02:27:34 PM
Yes this small example return clean string but
when is function called from bigger program then
Ltrim return garbage.

for Mike...
one thing is progres but another thing is stability.
it is not very smart built new features when we have old problems
(read quirks or bugs)...right?
i repeat i am not against new features but i expect that most standard
features which work properly in other compilers that work properly in Oxygen to...
do I want impossible things?

..and please stop share your ultra-smart vibrations
Title: Re: Path lenght? LEN
Post by: Mike Lobanovsky on November 15, 2015, 06:58:25 PM
..and please stop share your ultra-smart vibrations

Done as requested, Aurel! You've been put to my personal quarantine again until after the New Year. :)
Title: Re: Path lenght? LEN
Post by: JRS on November 15, 2015, 08:36:05 PM
Quote from: Aurel
..and please stop share your ultra-smart vibrations

(http://beforeitsnews.com/mediadrop/uploads/2013/38/40fe980d8c98c2fbe73101877ae9361ff5664676.jpg)

Careful Mike, you have super human computational powers that can cause spontaneous massive confusion.  8)

Title: Re: Path lenght? LEN
Post by: Charles Pegge on November 16, 2015, 07:28:05 AM
Yes this small example return clean string but
when is function called from bigger program then
Ltrim return garbage.

Have you checked the state of the input string?
Title: Re: Path lenght? LEN
Post by: Aurel on November 16, 2015, 10:30:35 AM
Quote
Have you checked the state of the input string?
Yes Charles i did..of course
as i say this function not work properly
because when i use just RTrim...then nothing->OK
but when i use Ltrim with empty input then i get char F.... >:(
Title: Re: Path lenght? LEN
Post by: Charles Pegge on November 17, 2015, 06:31:39 AM

What string inputs have you used?
Title: Re: Path lenght? LEN
Post by: Aurel on November 18, 2015, 04:19:03 AM
Quote
What string inputs have you used?
Charles i use in my interpreter full file path name
and i get wrong result in number of chars
then when is imput "" string i get this char F
Title: Re: Path lenght? LEN
Post by: Charles Pegge on November 18, 2015, 07:36:44 AM
Have you tried injecting specific strings into the Trim function? (Apart from the file path name)
Title: Re: Path lenght? LEN
Post by: Aurel on November 18, 2015, 12:24:04 PM
Quote
Have you tried injecting specific strings into the Trim function? (Apart from the file path name)

yes as i say when i "inject" nothing or empty string Ltrim return char  F
what a heck is F ?
Title: Re: Path lenght? LEN
Post by: Peter on November 18, 2015, 01:51:16 PM
Quote
what a heck is F ?

Fake!  ;D
Title: Re: Path lenght? LEN
Post by: Aurel on November 19, 2015, 12:01:37 PM
....
Title: Re: Path lenght? LEN
Post by: JRS on November 19, 2015, 01:17:29 PM
@Aurel,

I think you would have better luck with QxygenBasic if you were to follow the guidelines Charles and others have proven sound. There is nothing wrong with experimenting and pushing the envelope but don't trash O2 when something goes wrong.

Thanks!

 
Title: Re: Path lenght? LEN
Post by: Charles Pegge on November 20, 2015, 10:53:08 AM
Hi Aurel,

More diagnostics are required. It's up to you.

Ltrim and rtrim have not been modified for a number of years now, so I suspect it is our old friend, memory corruption, hanging out in some other part of the program.
Title: Re: Path lenght? LEN
Post by: Mike Lobanovsky on November 20, 2015, 03:18:26 PM
Good old Charles, always taking the blame upon himself. :) Go BP dot org for a moment and see some other renowned language devs getting deaf, mute and blind to any reasoning whenever it comes to glitches or questionable design decisions in their creations. :)
Title: Re: Path lenght? LEN
Post by: Aurel on November 21, 2015, 05:31:39 AM
Quote
More diagnostics are required. It's up to you.

Hi Charles ...yes i know that.

This F is not new thing .
i create Trim() function because is not implemented in Oxygen.
ok ..i will try with new-er oxygen.dll
currently i work on  few string functions in pureBasic.
Title: Re: Path lenght? LEN
Post by: Aurel on November 21, 2015, 05:33:13 AM
Quote
Go BP dot org for a moment and see some other renowned language devs getting deaf, mute and blind to any reasoning whenever it comes to glitches or questionable design decisions in their creations.

Ha ha ...yes that's true ..zx->dude is a funny guy  ;D