Looking at Pascal again after 27 years

All sorts of amusements and nonsense unrelated to xTalk
Post Reply
User avatar
OpenXTalkPaul
Posts: 1485
Joined: Sat Sep 11, 2021 4:19 pm
Contact:

Looking at Pascal again after 27 years

Post by OpenXTalkPaul »

I know a few people have mentioned Delphi here but has anybody used Free Pascal (and Lazurus IDE)?
Looks like it has runtimes for all sorts of platforms, from Nintendo PPC & ARM to Apple Silicon!
Can compile to libraries that can be used same as C Libraries (should be easy to wrap them with Builder to use with OXT)

I only vaguely remember experimenting with Pascal to try to produce Mac XCMDs/XFCNs for HyperCard, about 27 or so years ago. Apparently there's Object Pascal now days. It looks a little bit like the Builder language but less xTalk-ish.

Also someone ported the LC Externals SDK setup for Free Pascal about 10 years ago too. That's interesting, perhaps that could help in making drop in replacements for outdated LCC externals.
I was able to retrieve all the SDKs from the git and archive.org in case anybody else is interested.
User avatar
richmond62
Posts: 2617
Joined: Sun Sep 12, 2021 11:03 am
Location: Bulgaria
Contact:

Re: Looking at Pascal again after 27 years

Post by richmond62 »

One of the most interesting ways to try out Free PASCAL
is to lay one's sweaty paws on some sophisticated machine such as
a Pentium II (I did, it cost 5 Euros) and install FreeDOS with the
GEM GUI (a black and white WIMP interface) and "there you are"
with some other interesting packages as well.

https://www.freedos.org/https://www.freedos.org/
https://richmondmathewson.owlstown.net/
User avatar
OpenXTalkPaul
Posts: 1485
Joined: Sat Sep 11, 2021 4:19 pm
Contact:

Re: Looking at Pascal again after 27 years

Post by OpenXTalkPaul »

I'm interested in the modern Object Pascal features. But playing around with it a bit, I'm remembering why I liked HyperTalk and not Apple Pascal.
User avatar
richmond62
Posts: 2617
Joined: Sun Sep 12, 2021 11:03 am
Location: Bulgaria
Contact:

Re: Looking at Pascal again after 27 years

Post by richmond62 »

Personally I would not touch PASCAL with a 10-foot pole,
except that 14 years ago, when my older son was 15 the school he then
attended had the kids doing classes in PASCAL V . . .

This consisted of kids sitting in front of slow PCs running Windows XP, virused
up to the hilt, and having to COPY PASCAL programs from a text book with no
explanation, no nothing.

Obviously this was NOT satisfactory: hence my setting up a bashy old PII
with FreeDOS so I could sit with Alexander and TEACH him a spot of the
language so he could "Cock a snook" at the wholey incompetent
teacher at his school: which he did.

This, needless-to-say, had a fantastic effect on his programming career
as you can see here:

https://youtu.be/GgESJW-NyBA

He's the one with the military hat. :D
https://richmondmathewson.owlstown.net/
User avatar
OpenXTalkPaul
Posts: 1485
Joined: Sat Sep 11, 2021 4:19 pm
Contact:

Re: Looking at Pascal again after 27 years

Post by OpenXTalkPaul »

I was mostly looking at Free Pascal community as an opportunity for more libraries to compile, wrap, and add to OXT, although, unless there's something uniquely worthy available from that community, it's probably best to just wrap some library that has equivalent functionality directly with Builder.
richmond62 wrote: Thu Nov 04, 2021 6:02 pm This, needless-to-say, had a fantastic effect on his programming career
as you can see here:

https://youtu.be/GgESJW-NyBA

He's the one with the military hat. :D
The other guy in that video is playing a "Hooter" at least that's what semi-famous-in-the-1980s local Philadelphia band "The Hooter's" called it. I always wanted to try one of those.
User avatar
OpenXTalkPaul
Posts: 1485
Joined: Sat Sep 11, 2021 4:19 pm
Contact:

Re: Looking at Pascal again after 27 years

Post by OpenXTalkPaul »

Listen to that on my way home tonight! Tell your son I genuinely enjoyed that, and I’m not just saying that to be nice.
It fit in well with the other stuff I was listening to, which lately has been almost exclusively Diablo Swing Orchestra: https://youtu.be/jAGzkoGkc-c
xAction
Posts: 282
Joined: Thu Sep 16, 2021 1:40 pm
Contact:

Re: Looking at Pascal again after 27 years

Post by xAction »

I was mucking about with Castle Game Engine, it's a Free Pascal engine. Wait is that right? Or was it Free Basic, let me see?
Right Pascal, since it's some Lazarus related project. It's got that fresh out of 2003 feel. And Lazarus..uh...wow feels so 1990s.
I just can't get into it...ohho...openGL, a real live 3D cube, with transparency, lighting and 20,000 particles!
Damn, that's fancy. Going to have to give this a deeper look.


How do we wrap things with Builder?
User avatar
OpenXTalkPaul
Posts: 1485
Joined: Sat Sep 11, 2021 4:19 pm
Contact:

Re: Looking at Pascal again after 27 years

Post by OpenXTalkPaul »

Yeah, there is that! There's a few Game Engines libraries that would be great to wrap.
Castle looks like they've built their own editor that isn't hideously 1990s looking like Lazarus is.
https://castle-engine.io
I see there is a Pascal wrapper for Box2D which has a physics engine, which was supposedly to be wrapped with Builder, I think as part of some Infinite fundraiser. I think Monte actually did play with that a bit (posted an animated gif on gitter) but didn't release anything.

Free Pascal can compile to an insane number of architectures, modern and ancient / niché ones like BeOS, Amiga too!
I sort of wish the engine was written in Pascal because of that!
xAction wrote: Fri Nov 05, 2021 9:38 am How do we wrap things with Builder?
Binding strings are the key. Basically you need to translate headers of a library into Builder binding strings which may be different for different languages/platforms (C/C++/All Platforms, ObjC/macOS/iOS/etc., Java/All/Android., JS/Emscripten). There was talk of automating that process but I don't think that ever came to be, at least not publicly. Once you have correct binding strings and builder can find the library (which may be an operating system API not included with the Builder project) it's just a matter of feeding the proper variable types the library expects, parsing the types of data a library returns if it's not a type that Builder already understands (such as a structured record which is done with a different sort of binding string).

If you look at the OXT FluidSynth project, that's a wrapper for a C++ library with the library binaries included.

From what I've read, Free Pascal can compile to dynamic libraries which appear to be C libraries as far as an app that is using the library is concerned (ie they can have .h headers)
xAction
Posts: 282
Joined: Thu Sep 16, 2021 1:40 pm
Contact:

Re: Looking at Pascal again after 27 years

Post by xAction »

I spent like 3 hours trying to get Allegro to talk to Lazarus, then gave up.
But wow that open source project is so far ahead of LC in terms of available libraries...for a language 'nobody uses' there sure were lot of users making a lot of technology available to it.

Anyway we should look into wrapping raylib, it's already supported by 50 programmming languages. It has some kind of automated wrapper technology with raylib parser. Physics engine, openGL, fonts, sound, etc etc all in one solution with Google throwing money at it. 3D models in a browser in split seconds!

I went through some of the libsynth files but I can't tell the difference between Builder code and code from a library. Learning a new language to adopt another language to use in the other language. ieieiei!
User avatar
OpenXTalkPaul
Posts: 1485
Joined: Sat Sep 11, 2021 4:19 pm
Contact:

Re: Looking at Pascal again after 27 years

Post by OpenXTalkPaul »

Well Pascal is like a half century or so years old, was being taught in schools years before the first xTalk HyperCard arrived in the late 80s, Pascal is a standardized language, and there’s been many versions of Pascal supported by many companies over the years. Meanwhile xTalk has had only a few open source iterations and none that were well supported for very long, the longest lasted 8 years (so far), and a good chunk of that 8 years was spent modernizing the engine to bring it into this century with things like Unicode, and trying to keep up with new mobile device markets / App Store requirements while having a very small staff. Probably too small for everything they’ve taken on, I don’t think they even fulfilled some of those funded “stretch goals” from the multiple fund raisers along the way. And they have a base of commercial programmers paying full price for support that they were obligated to put first, so supporting the OS community was obviously not going to be a priority.


All of that code in the FluidSynth LCB file is Builder code. The lines that start with _SAFE are the binding strings for the library binaries (which are in the “Code” folder) the handlers that start with “Public” are functions or commands that are available to the script engine once the extension is loaded. A lot of Builder should be fairly familiar as they tried to keep it similar to the script language, but it is a different language.

I started with it going after low hanging fruit, simple small APIs that I was interested in (AVMIDIPlayer). I’m willing to help as much as I can anyone who wants to learn it. Honestly once you get past the learning curve, there’s a lot that can be done with it, including expanding the Builder language itself!
User avatar
richmond62
Posts: 2617
Joined: Sun Sep 12, 2021 11:03 am
Location: Bulgaria
Contact:

Re: Looking at Pascal again after 27 years

Post by richmond62 »

spent modernizing the engine to bring it into this century with things like Unicode
From a purely selfish point of view that was 100% "de trop" for my Devawriter Pro as messing around
with what-ever-you-call-them pairs was a huge headache.
https://richmondmathewson.owlstown.net/
User avatar
OpenXTalkPaul
Posts: 1485
Joined: Sat Sep 11, 2021 4:19 pm
Contact:

Re: Looking at Pascal again after 27 years

Post by OpenXTalkPaul »

richmond62 wrote: Sat Nov 06, 2021 8:19 am
spent modernizing the engine to bring it into this century with things like Unicode
From a purely selfish point of view that was 100% "de trop" for my Devawriter Pro as messing around
with what-ever-you-call-them pairs was a huge headache.
Multibyte chars sets because Unicode isn't the only multi-byte charsets... I still had a helluva time dealing with multi-byte chars coming from that HIDAPI library that I wrapped, some sort of Windows OS related multibyte issue but I worked around it.
User avatar
richmond62
Posts: 2617
Joined: Sun Sep 12, 2021 11:03 am
Location: Bulgaria
Contact:

Re: Looking at Pascal again after 27 years

Post by richmond62 »

Unicode isn't the only multi-byte charsets
Quite . . . let's talk about Old Church Slavonic digitised in a totally homemade TTF font in about 1995 where the font
has got lost and no-one can remember the mapping, but the enormous corpus that was digitised has to be decoded and
then reincoded in some semi-standard standard (in this case Unicode) . . .

Decoding it would be easy IFF one matched a section of a digitised text with the text from which it was taken:
then one can work out an equivalence table and do a simple search an replace. However, the hairy monks up at
the monastery where these documents are stored suffer from bigotry and want neither myself (formally converted
to BG orthodoxy when got married) nor my potential assistant (Muslim Bulgarian) to go anywhere near even a photocopy
of the documents . . . God must be laughing quietly somewhere.

. . . currently an on-going problem at Bulgarian universities (mainly because the Old Church Slavonic 'experts' know
absolutely nothing re font encoding but will not admit that and keep shoving their oars into the matter) that will
run and run until all the "wonks" are dead!

It is one hell of a lot better to have one. widespread multi-byte charset accessible inwith LiveCode
than one at all . . . and as only kinky types like myself (and, possibly, Tim Selander in Japan) are
interested in using LiveCode for non-Latin-alphabet languages, we should be profoundly grateful for
the Unicode thing there.
https://richmondmathewson.owlstown.net/
User avatar
OpenXTalkPaul
Posts: 1485
Joined: Sat Sep 11, 2021 4:19 pm
Contact:

Re: Looking at Pascal again after 27 years

Post by OpenXTalkPaul »

richmond62 wrote: Mon Nov 08, 2021 8:47 am we should be profoundly grateful for the Unicode thing there.
I think it's a necessity these days if you want to be able to say that your development environment is modern.

Fortunately I've only occasionally hit on multi-byte char problems over the years, and never really for serious work.
One that I used a lot that I recently noticed while looking back at some of my decades old HyperCard Stacks is the MacOS Classic Roman Charset side-ways and vertically mirrored L ( ¬ ) character whatever that is? It was used as a line-continuation character in HyperTalk (same as backslash \ in LCS ).
xAction
Posts: 282
Joined: Thu Sep 16, 2021 1:40 pm
Contact:

Re: Looking at Pascal again after 27 years

Post by xAction »

"It's the logic negation symbol." It's used in some programming languages as a mean to negate a boolean value, particulary old languages
The ¬ character is also used in AppleScript to force a long line of code to break onto the next line. On a French Mac keyboard, you get it with Option (alt) "L", which has a kind of logic to it :)
I remember seeing that littered in AppleScript books and being like "WTF"? Guess they were forced to use it with their limited page space.
User avatar
OpenXTalkPaul
Posts: 1485
Joined: Sat Sep 11, 2021 4:19 pm
Contact:

Re: Looking at Pascal again after 27 years

Post by OpenXTalkPaul »

xAction wrote: Tue Nov 09, 2021 12:07 pm "It's the logic negation symbol." It's used in some programming languages as a mean to negate a boolean value, particulary old languages
The ¬ character is also used in AppleScript to force a long line of code to break onto the next line. On a French Mac keyboard, you get it with Option (alt) "L", which has a kind of logic to it :)
I remember seeing that littered in AppleScript books and being like "WTF"? Guess they were forced to use it with their limited page space.
Yup that's why I used it in HC, screen-space!
I started some of these stacks on a Mac 512KE (modded to a Mac Plus, w/4MB memory upgrade trick!) with a tiny 1-bit B&W monitor, lol!
Good times!
Me Circa Late 1980s.jpg
Me Circa Late 1980s.jpg (258.28 KiB) Viewed 4157 times
Option + L is still how you get that character on macOS (with English keyboard setting).
User avatar
richmond62
Posts: 2617
Joined: Sun Sep 12, 2021 11:03 am
Location: Bulgaria
Contact:

Re: Looking at Pascal again after 27 years

Post by richmond62 »

Yup: ¬ is Unicode 172 / Hex AC: probably from the second ASCII table.
https://richmondmathewson.owlstown.net/
Post Reply

Who is online

Users browsing this forum: No registered users and 5 guests