Removing 'ASCII' switch from PureBasic

Developed or developing a new product in PureBasic? Tell the world about it.
User avatar
Danilo
Addict
Addict
Posts: 3037
Joined: Sat Apr 26, 2003 8:26 am
Location: Planet Earth

Re: Removing 'ASCII' switch from PureBasic

Post by Danilo »

@infratec:
Just change your compiler Defaults to UNICODE, and write all new codes with UNICODE in mind.
It is really not a big problem, after you got used to it. I wrote libs for Win+Linux+Mac with this
settings (for example HIDAPI and ChartDirector cross-platform wrappers.).
Of course you should prefer Unicode style, so paths work correctly for User_Russion and Xiang Xu, too.
User avatar
skywalk
Addict
Addict
Posts: 3994
Joined: Wed Dec 23, 2009 10:14 pm
Location: Boston, MA

Re: Removing 'ASCII' switch from PureBasic

Post by skywalk »

I'm with Infratec. I made many many changes and it is not fun or elegant. Despite the perception that Unicode is the future, Ascii strings are pervasive in the machine world. Sadly, we must resort to peeks and pokes natively. I am hoping a future version will re-introduce a new 1 byte string datatype that can coexist with multi-byte. :idea:
The nice thing about standards is there are so many to choose from. ~ Andrew Tanenbaum
User avatar
luis
Addict
Addict
Posts: 3876
Joined: Wed Aug 31, 2005 11:09 pm
Location: Italy

Re: Removing 'ASCII' switch from PureBasic

Post by luis »

Independently by all the proclamations about the future, unicode, and the alien civilizations we will meet thanks to it, it's evident a compiler supporting both ascii and unicode compilation is better than one only supporting unicode.

The one with unicode has a compilation mode less.

It's not a question of future, globalization or whatever. Who cares when you are looking at the two different compilers ?

One offers a feature the other hasn't. And when you need that feature, the one supporting it makes your life easier.

Exactly the same thing for 32 and 64 bit support. "64 bit code is the future", ok, right.
Until there are machines running 32 bit OSes, a compiler offering both is better than the one offering just 64 bits (be prepared for this).

Anyway, the future of PB has been decided, and in unicode mode is still possible to access ascii data in a inconvenient way compared to the pure ascii mode. The time to spoke against it was when this thread started, now does not serve any purpose.
So now you are better off using another compiler (good luck if you want another BASIC), another language or simply to get used to what you have now hoping this decision will result in a positive tradeoff instead of a simple menomation.

And yes, propose ideas to mitigate all this in Features Requests if you have any.
"Have you tried turning it off and on again ?"
A little PureBasic review
User avatar
skywalk
Addict
Addict
Posts: 3994
Joined: Wed Dec 23, 2009 10:14 pm
Location: Boston, MA

Re: Removing 'ASCII' switch from PureBasic

Post by skywalk »

I trust you don't interpret my words as whining? I am merely stating the repercussions to me with the loss of a fundamental data type. 2 really, if you count fixed length strings .s{1}.
It's not all bad. I welcome 1 less compiler switch. :)
Back to coding...
The nice thing about standards is there are so many to choose from. ~ Andrew Tanenbaum
User avatar
luis
Addict
Addict
Posts: 3876
Joined: Wed Aug 31, 2005 11:09 pm
Location: Italy

Re: Removing 'ASCII' switch from PureBasic

Post by luis »

skywalk wrote:I trust you don't interpret my words as whining?
No, I didn't.
"Have you tried turning it off and on again ?"
A little PureBasic review
User avatar
skywalk
Addict
Addict
Posts: 3994
Joined: Wed Dec 23, 2009 10:14 pm
Location: Boston, MA

Re: Removing 'ASCII' switch from PureBasic

Post by skywalk »

And I learned a new word...menomation. You have a strong vocabulary luis!
The nice thing about standards is there are so many to choose from. ~ Andrew Tanenbaum
User avatar
luis
Addict
Addict
Posts: 3876
Joined: Wed Aug 31, 2005 11:09 pm
Location: Italy

Re: Removing 'ASCII' switch from PureBasic

Post by luis »

skywalk wrote:You have a strong vocabulary luis!
And when I'll learn to connect them together (the words) in English sentences without making errors I'll be unstoppable.
"Have you tried turning it off and on again ?"
A little PureBasic review
User avatar
heartbone
Addict
Addict
Posts: 1058
Joined: Fri Apr 12, 2013 1:55 pm
Location: just outside of Ferguson

Re: Removing 'ASCII' switch from PureBasic

Post by heartbone »

menomation
The word you've entered isn't in the dictionary. Click on a spelling suggestion below or try again using the search bar above.


Answers.com: What is menomation?
While reading an article I was presented with the word "menomation" and I had no idea what it meant. Also, I could not find the definition in any of my typical sources. Fortunately, I was able to determine that it was Italian in origin. That lead me to a translator program and found it meant "impairment." In an unfortunate turn, the article was referring to eunuchs at the time.


Comparing the fixing of what ain't broken to a castration was simply brilliant luis!
Perhaps a little dramatic, but nicely done. :lol:
Keep it BASIC.
User avatar
Tenaja
Addict
Addict
Posts: 1949
Joined: Tue Nov 09, 2010 10:15 pm

Re: Removing 'ASCII' switch from PureBasic

Post by Tenaja »

Well, for Luis' sake, let's hope is not impaired in that manner!!!!
User avatar
blueznl
PureBasic Expert
PureBasic Expert
Posts: 6161
Joined: Sat May 17, 2003 11:31 am
Contact:

Re: Removing 'ASCII' switch from PureBasic

Post by blueznl »

skywalk wrote:I trust you don't interpret my words as whining? I am merely stating the repercussions to me with the loss of a fundamental data type. 2 really, if you count fixed length strings .s{1}.
It's not all bad. I welcome 1 less compiler switch. :)
Back to coding...
Oooooouch. This is the one thing I forgot about. Fixed length strings are primarily great for dealing with API's that have fixed length buffers (think about ISDN and telecom related stuff) as part of their structures. Those buffers are typically ASCII (some of that stuff is 20 to 30 years old, think winsock and the like).

Okay, I can POKES() PEEKS() these fields, but that suddenly makes the fixed length type not that useful anymore... Hmrpf. Poor Fred. First I pestered him for the type, and now I probably won't use it much anymore :lol:
( PB6.00 LTS Win11 x64 Asrock AB350 Pro4 Ryzen 5 3600 32GB GTX1060 6GB)
( The path to enlightenment and the PureBasic Survival Guide right here... )
walbus
Addict
Addict
Posts: 929
Joined: Sat Mar 02, 2013 9:17 am

Re: Removing 'ASCII' switch from PureBasic

Post by walbus »

I think removing the ASCII switch is not good.

My AES suite QUICK-AES-256 was a lot of work.
She has versions for x86 / x64 / ASCII / UNICODE , Win, Linux -inclusive DLL/SO in all variations.

But the Unicode versions was very prone and very difficult for debugging, a nightmare -LOL

Hmmm, for comparing you can downloading the compete packet here on my website.

http://www.quick-aes-256.de
Fred
Administrator
Administrator
Posts: 16664
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Re: Removing 'ASCII' switch from PureBasic

Post by Fred »

Sure, but IMHO if you had only unicode to start for, you wouldn't had any issues with it because all the dev/test would have been done with unicode. That's one issue with PB as it is now: you can start with ASCII and then once your project is big want to switch to unicode and you get a lot of trouble especially if you use API. I did the unicode version of the IDE and it wasn't easy to get it back on track as the code source was huge and built for ASCII in mind.
walbus
Addict
Addict
Posts: 929
Joined: Sat Mar 02, 2013 9:17 am

Re: Removing 'ASCII' switch from PureBasic

Post by walbus »

Yes, for new projects it does not matter, one can, if required, convert UNICODE easily into ASCII...
User avatar
deseven
Enthusiast
Enthusiast
Posts: 362
Joined: Wed Jan 12, 2011 3:48 pm
Location: Serbia
Contact:

Re: Removing 'ASCII' switch from PureBasic

Post by deseven »

Danilo wrote: Not if you connect to modern libraries and APIs that support UNICODE directly.
The conversion is only required if you connect to old-style, last-century libs,
that don't support UNICODE.
Unfortunately, that's not true. Many popular libraries still use ascii (for compatibility or architecture purposes). Check libcurl for example.
On the other hand, some libraries use utf8 and you still need to use PeekS for interacting with 'em. I usually end up writing some basic macroses or procedures to perform on-the-fly convertion.

However, it's not a big deal for me and i fully support the decision to drop the ascii support.
User avatar
Keya
Addict
Addict
Posts: 1891
Joined: Thu Jun 04, 2015 7:10 am

Re: Removing 'ASCII' switch from PureBasic

Post by Keya »

In a Unicode-only PB world does that mean all Ascii strings need to be AllocateMemory'd? and can we no longer use any string functions on them then?

for example i used this function in a Unicode-compiled exe that needed to pass an Ascii string to a lib, i'm just wondering if i'm doing this right or if there's a better way? thanks

Code: Select all

Procedure.i ToAscii(inbuf$)
  Protected *outbuf = AllocateMemory(Len(inbuf$)+1)
  If *outbuf
    PokeS(*outbuf, inbuf$, -1, #PB_Ascii)
  EndIf
  ProcedureReturn *outbuf
EndProcedure
Post Reply