Re: [fpc-pascal] What's in Hello World

2024-01-07 Thread Ingemar Ragnemalm via fpc-pascal

Just for comparison, I fired up Think Pascal and made Hello world!

Plain Hello world, closes so quickly that you don't have time to see it: 
4625 bytes.


Including ShowText and while not Button do; 4639 bytes.

Yes, less than 5k! Progress?

/Ingemar
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Here is real time graphics and physics simulation, library

2022-08-01 Thread Ingemar Ragnemalm via fpc-pascal



Den 2022-08-01 kl. 09:40, skrev fpc-pascal-requ...@lists.freepascal.org:

Date: Sun, 31 Jul 2022 09:05:56 -0400
From: Anthony Walter 

Michael, it's the same logic behind my now 12 year old Bare game system
that did the exact same thing. I am creating a small lPascal ibrary that
removes a lot of cruft and depends minimally on SDL for creating windows,
managing input, handling sound, threads / mutexes. and move most of the
core of what you need into a single unit (Tiny.System). In to browsable and
organized uint replaced all string handling with much more efficient and
powerful functions (see my FTP client and other socket protocols, my JSON
parser, ), I also add in multicast delegates for events, path handling,
file handling, file search, stream handling, and better threads (my simple
threads were copied into ).


I have exactly the same principle for all code I create for my teaching. 
I maximize transparency and keep the size down. For graphics, I go even 
further and only depend on OpenGL and the underlying window system.


There are big libraries with lots of bells and whistles. They can be 
useful, but not to get started with. I see myself replacing 100 files 
with one, megabytes of code with kilobytes.


It is pretty hard to balance usability and minimum size but I think I am 
doing fairly well.


So, reimplementing to something smaller and more transparent is not a 
bad thing at all. It is a matter of goals.


/Ingemar


___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] fpc-pascal Digest, Vol 181, Issue 19

2019-07-19 Thread Ingemar Ragnemalm


2019-07-19 kl. 12:00, "Mgr. Janusz Chmiel"  wrote:

To: fpc-pascal@lists.freepascal.org
Subject: [fpc-pascal] I need some working Pascal examples for android
Message-ID: 
Content-Type: text/plain; charset=UTF-8; format=flowed

Please, does somebody of us know about some functioning examples which
are utilising PPCJVM, android target and Android operating system? Not
Lamw or similar environments, which uses FPC and ARMHF targets.
MR Bart have done very good example. May be, that somebody of us would
send some links to functioning examples.
Because I do not see at all, Pascal is very probably The future for Me.
Because there are some units which do not need object positions as values.
But there is very little examples for calling native .so libraryes and
for working with Android APi functions from Pascal.
To be honest, I know only about two big projects.
javavcl and Pandroid.
May be, that somebody of us know about similar project which is hydden
somewhere on The iNternet.


I can only second that, but maybe be a bit more precise. Compiling for 
Android is no problem, but I *never* managed to get the "magic files" 
that it needs to work on a phone.


My futile attempts were a few years ago, so maybe there are some better 
examples now, so hopefully the solution is a simple pointer. Is it?


/Ingemar


___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] any free pascal standard function to compare a, string against an array of string?

2018-10-10 Thread Ingemar Ragnemalm


You mean something faster than a for-loop? Like a hash table?

I don't know of any hash table in the standard library but there are 
some in the class library:


https://www.freepascal.org/docs-html/fcl/contnrs/tfpstringhashtable.html
https://www.freepascal.org/docs-html/fcl/contnrs/tfphashlist.html

I have not used these myself but they may suit your problem.

Or you can just write your own hash table function. It is not that hard.

/Ingemar

Den 2018-10-10 kl. 17:31, skrev fpc-pascal-requ...@lists.freepascal.org:

is there a function like
    if    IsOneOf('subtext', ['abc','cde','fecg','hig'])   then begin
...
end;

is there such a function IsOneOf(TheSubString : String; const TheStrings
: array of String) : Boolean
?
if yes, what is its name and unit?


___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] GLPT v0.1.1 released

2018-10-08 Thread Ingemar Ragnemalm


Any work on OpenGL is of interest to me. I am working with it every day, 
have written two course books, a GLUT replacement and numerous demos, 
most in C though (because my students don't learn Pascal any more).


Two things come to mind:

Yet another API for GUI-OpenGL glue? I would suggest that the closer to 
an existing API (i.e. GLUT) the better. You are fairly close now so 
maybe making it a GLUT replacement is just a matter of renaming?


All your demos are old-style. I can't even see a single shader anywhere. 
I think you should use modern OpenGL more. For instance, I have made a 
modern version of the dear old Gears demo:


http://computer-graphics.se/demopage/glut-gears.html

Not converted to C yet, but it is converted to modern OpenGL. I also 
have a bunch of other demos that exist in FPC versions that you can have.


/Ingemar

Den 2018-10-09 kl. 00:46, Darius Blaszyk wrote:

Hi all,

I just released the first complete version of GLPT. Thanks to Ryan Joseph GLPT 
now supports Linux, MacOSX and Windows. Anyone interested in the project is 
invited to test, use, discuss and code. Please submit found or proposed issues 
on GitHub.

https://github.com/daar/GLPT/releases  


Rgds Darius


___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] fpc-pascal Digest, Vol 167, Issue 39

2018-05-20 Thread Ingemar Ragnemalm

On Sun, 20 May 2018, Sven Barth via fpc-pascal wrote:


I'm pleased to announce that after nearly a year various extensions for
dynamic arrays have been finished. This includes the following features:

- support for array constructors using "[...]" syntax
- support for Insert(), Delete() and Concat()
- support for "+" operator
- support for dynamic array constants (and variable initializations)
The dynamic array constructors sound absolutely wonderful! I have code 
with rather awkward workarounds that will benefit a lot by these features.


/Ingemar


___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] working with lldb

2018-05-05 Thread Ingemar Ragnemalm


Den 2018-05-05 kl. 12:00, skrev Mr Bee :

Hi,
Is there a way to make LLDB able to read and display Pascal's string correctly? 
At least, ansi string. I'm now using this option '-glpsw3 -godwarfcpp'. Did I 
miss some options or something?
Thank you.


In my experience, AnsiStrings will print with no problems. For example, 
they print nicely with a command like "fr v" as well as "p". Short 
strings are worse, they display as arrays or separate characters.


So what are you doing with them that goes wrong?

/Ingemar

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

[fpc-pascal] Next language feature for pas2js...

2018-05-01 Thread Ingemar Ragnemalm


Den 2018-05-01 kl. 09:50, Ryan Joseph  wrote:

On Apr 25, 2018, at 9:43 PM, Michael Van Canneyt  wrote:

Ah, webgl...

I had a look at this some time ago, and got depressed. Quickly closed the 
browser and didn't look back. Same for webaudio:(

I’m actually a little curious about this myself because I’ve been using OpenGL 
often recently. I’ve seen the Ingemar’s demos but I only slightly grasp how 
it’s working.

The wiki says you’re actually parsing the Pascal (not compiling it) and 
outputting JavaScript. If that’s the case then how does porting libraries work 
in practice? For examples lets say I want to translate a single OpenGL 
function, how does that look?


I found it surprisingly easy to import undefined JavaScript functions 
working from examples in the interfaces. I believe web.pas was 
particularly useful. I also made some changes in web.pas. Well, why not 
say what: I made localStorage public instead of private. And I think 
"strokeStyle" was spelled "strokeStye". Also added


    procedure ellipse(x, y, radiusX, radiusY: TCanvasCoordType; 
rotation, startAngle, endAngle: Real; anticlockwise: Boolean);


into TJSCanvasRenderingContext2D.

Not that much though.

WebGL is interesting for me, and being an OpenGL expert (teaching it for 
many years, written two course books on the subject and tons of code), I 
am happy to contribute any way I can. If nothing else, I can promise 
some decent demos, and testing of course.


/Ingemar

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

[fpc-pascal] Next language feature for pas2js...

2018-04-25 Thread Ingemar Ragnemalm

Michael Van Canneyt  wrote:

Hello,

Now that interface support has been added to the list of implemented language
features of pas2js, we're looking to get feedback on what best to tackle next.

This time, the poll is not on the forum, so you do not need to have an
account to vote.

Here is a link to the poll:

https://docs.google.com/forms/d/e/1FAIpQLScPVu6Y_X1QhOrYLWia4TVeKoZ3wiu-_PiMqJ0Zm8KW39FdCQ/viewform?usp=sf_link

Michael.


I am very happy with pas2js and couldn't select any particular feature. 
What I want the most are more APIs, but I have been quite successful in 
implementing the ones I need so far. However, WebGL (which is 
interesting for me) is a big API so if anyone is working on that, or 
have figured out a way to auto-convert or something, I am interested.


Have I mentioned that I used pas2js on this year's Global Game Jam? 
Successfully!


/Ingemar

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Proposal for new Free Pascal logo

2018-03-30 Thread Ingemar Ragnemalm


Den 2018-03-30 kl. 05:54, Mr Bee wrote:

Hi,
These days, most modern programming languages have its own logo. The logo becomes a 
"brand", a unique visual identity for the language. It also acts as a 
"trademark", a recognizable image for the language. It also helps the community to have a 
single visual identity to distinguish them from other programming communities. I've seen it with 
many other communities, such as Swift, Python, Kotlin, etc.
Unfortunately, I don't see Pascal language –especially Free Pascal– to have a such logo. 
Yes, I know the FPC's official site got a running cheetah (a .gif file) named as logo. 
But, I don't think an animated picture is appropriate to be used as a logo. A logo should 
be simple, unique, recognizable and "iconizable" image.
So, I propose a new logo for Free Pascal. It's a simple cheetah's head. The 
proposed logo in various sizes (for icon) can be looked at here: 
https://pak.lebah.web.id/fpc/ I also attach the logo as a .png file, in case 
someone can't open my website.
If this proposal is accepted, perhaps it's time to rework the official FPC's 
website, using the new logo. It's time to make Pascal looks more modern, 
because it looks pretty old today. I also think the Lazarus' logo can be made 
better, but that's another discussion for another time.
What do you think?


The logo is very good, and well connected to the tradtion set by the 
animated gif. The alternative would be to use a frame of the animation, 
or similar sideways cheetah, but scaled up so it can have different 
resolutions. But the head is more compact, which speaks in its favor.


I am not sure how bit the *need* is but it doesn't hurt to have an 
official still image logo.


/Ingemar

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] fpc-pascal Digest, Vol 163, Issue 12

2018-01-08 Thread Ingemar Ragnemalm


Den 2018-01-08 kl. 08:49, skrev Sandro Cumerlato:

I've done it, let's call it "santa3", it's amazing!:-)   [you've made my
day]

For the last point: yes!

Sandro


Great! It works just fine! Very neat and tight fix too! And in time 
before Christmas is *really* over. At least we have snow on the roof! :)


I might do something about the turning of the snake, but now I have to work.

/Ingemar

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] fpc-pascal Digest, Vol 163, Issue 11

2018-01-07 Thread Ingemar Ragnemalm


Thanks! The limitations in the sound playing are straight from 
JavaScript's Audio API. I think I know how to loop a sound, although the 
online advice are pretty confusing. For playing a sound multiple times, 
it seems I need to load it multiple times! Not very elegant but it can 
be done.


The last point, is that when turning twice very fast?

/Ingemar


Den 2018-01-07 kl. 16:38, skrev Sandro Cumerlato:

Awesame work!:-)

areas for improvement:

in santa2
- loop Jingle Bells.mp3 for an infinite pleasure;-)
- play boing.mp3 multiple times in case of multiple keyboard hits.

in snake:
- avoid this:https://imagebin.ca/v/3nOH4webezqH


___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] First pas2js public release

2018-01-07 Thread Ingemar Ragnemalm


An update on my tests with pas2js:

I have overcome most problems now and am quite a bit happier with what I 
see - and what I did see before was good!


Reimar Grabowski asked for interactivity. Done!

Myself, I wanted to reduce the amount of information, like file 
references in the HTML file, because, yes, it does matter! And I wanted 
to load sounds, and of course I, too, wanted interactivity! Done! Adding 
missing methods, interfacing to more APIs (like audio), no problem! It 
was surprisingly easy.


Here is an updated version of the Santa animation:

http://ragnemalm.se/images/santa/santa2.html

and here is an (almost) fully working snake game:

http://ragnemalm.se/images/santa/snake/snake.html

I really enjoyed making these! My code gets more and more comfortable, 
there is no problem hiding the JS libraries. Will I do that in the long 
run? Well, I don't know but doing that can help me making the code portable.


I also made some minor additions to Lightweight IDE, so now I edit, 
compile and run directly from the IDE. "Run" passes the HTML to a web 
browser.


I have implemented a different way to run animations, but still don't 
know if it flickers on other platforms. On my Mac, there is no flicker 
at all.


For gaming and similar purposes, all I miss now is the ability to save 
scores on file. For a wider range of applications, I want the ability to 
download data to my local drive. I havn't considered the case of 
communicating directly with some server.


For being a preliminary "0." version, pas2js works wonderfully well!

/Ingemar


Den 2017-12-24 kl. 12:00, skrev Ingemar Ragnemalm:

Den 2017-12-22 kl. 12:00, skrev Michael Van Canneyt:

On Wed, 20 Dec 2017, Reimar Grabowski wrote:


On Wed, 20 Dec 2017 15:14:50 +0100
Ingemar Ragnemalm<inge...@ragnemalm.se>  wrote:

But I don't see anything wrong with putting them in the HTML. For more 
flexibility you could create the HTML via a template engine or something but I 
would only load them from JS if there is a good reason to do so.

One reason is to collect information in one place. Making HTML load it
gives me two steps to the file instead of one. More chances to do it wrong.


While you are updating your code you can remove the two dependencies on 
bootstrap (as they are not satisfied anyway and I think the whole fpReport dir 
is superflous) and perhaps do something about the flickering of the text 
(although this may be a little bit too much asked).

Ah. They just remained from an example I worked from.

Text flicker is most likely caused by not double buffering. I need to
generate an image off-screen. Nothing strange with that, just one more
thing to figure out in the JS environment.


It feels really nice to have my first Pascal web application running!

Not dissing you or your work or pas2js but I fail to see the web application 
part. There is no communication between client and server. Actually there is no 
server side code at all and there is no interactivity. In my book this is a 
static page, but perhaps I miss something.

There is no interactivity, and no client-server communication, but this is my *first*, my 
"proof of concept" for the platform, like Hello World but with some more features 
(animation, random numbers, graphics elements). Doing *something* with it myself, showing myself 
the potential, making a kind of "thanks" for it and a Christmas greeting atthe same time. 
Interactivity is the next step, and the ability to save data somewhere.


That is one of the points of pas2js. To allow you to program the browser.

There is no need for a server. You can make e.g. a chess application that runs
100% in the browser, using a single HTML file. You can embed the JS and
images in the HTML itself, and thus your HTML file is the 'executable'.

See the browser as a desktop. Your program runs in that desktop.
If need be, this program can contact a server - the classical
client/server model, using HTTP as the protocol - but this is by no means a 
necessity.

In that sense, the demo demonstrates this. The server is just there for you
to be able to download the "program"...

Exactly. I get a cross-platform solution with no installations, in a way
that users are increasingly used to. And I can write it in FPC, which I
am a lot more happy with than a rubbish language like JavaScript! For me
it opens a lot of possibilities!

But let me get back to my current problems. I can accept loading images
through HTML for now, but how can I load and play sounds? There is an
"Audio" API in JavaScript but it seems that pas2js doesn't support it,
it can't find play(). I have searched web.pas and a few others for it.
Where do I start to fix that?

/Ingemar


___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] First pas2js public release

2017-12-24 Thread Ingemar Ragnemalm


Den 2017-12-22 kl. 12:00, skrev Michael Van Canneyt:

On Wed, 20 Dec 2017, Reimar Grabowski wrote:


On Wed, 20 Dec 2017 15:14:50 +0100
Ingemar Ragnemalm<inge...@ragnemalm.se>  wrote:


Although I would like to make some improvements - who doesn't? To be
precise, I want to figure out a way to play sounds, and I want image
loading directly in the code and not dependent on the HTML. Any ideas
about that?

First of all I know nothing about pas2js, but...
As your code is running solely in the browser there is no option to load it 
from file for security reasons.
But you can embed the binary image data in the code (as Uint8Array) or you can 
use XHR (pas2js will surely support this somehow) to fetch the image data via 
HTTP.
Once you have the data put it into a blob, create an url and finally use that 
as you image url.
So you need pascal code that will produce this JS code:

var blob = new Blob([data], { type: "image/png" }); // where data is your 
Uint8Array
var url = URL.createObjectURL(blob);
var image = new Image();
image.src = url;


Yes, something like that. I have found JS examples that does this but 
can't see how to make pas2js do it.



But I don't see anything wrong with putting them in the HTML. For more 
flexibility you could create the HTML via a template engine or something but I 
would only load them from JS if there is a good reason to do so.


One reason is to collect information in one place. Making HTML load it 
gives me two steps to the file instead of one. More chances to do it wrong.



While you are updating your code you can remove the two dependencies on 
bootstrap (as they are not satisfied anyway and I think the whole fpReport dir 
is superflous) and perhaps do something about the flickering of the text 
(although this may be a little bit too much asked).


Ah. They just remained from an example I worked from.

Text flicker is most likely caused by not double buffering. I need to 
generate an image off-screen. Nothing strange with that, just one more 
thing to figure out in the JS environment.



It feels really nice to have my first Pascal web application running!

Not dissing you or your work or pas2js but I fail to see the web application 
part. There is no communication between client and server. Actually there is no 
server side code at all and there is no interactivity. In my book this is a 
static page, but perhaps I miss something.


There is no interactivity, and no client-server communication, but this is my *first*, my 
"proof of concept" for the platform, like Hello World but with some more features 
(animation, random numbers, graphics elements). Doing *something* with it myself, showing myself 
the potential, making a kind of "thanks" for it and a Christmas greeting atthe same time. 
Interactivity is the next step, and the ability to save data somewhere.


That is one of the points of pas2js. To allow you to program the browser.

There is no need for a server. You can make e.g. a chess application that runs
100% in the browser, using a single HTML file. You can embed the JS and
images in the HTML itself, and thus your HTML file is the 'executable'.

See the browser as a desktop. Your program runs in that desktop.
If need be, this program can contact a server - the classical
client/server model, using HTTP as the protocol - but this is by no means a 
necessity.

In that sense, the demo demonstrates this. The server is just there for you
to be able to download the "program"...


Exactly. I get a cross-platform solution with no installations, in a way 
that users are increasingly used to. And I can write it in FPC, which I 
am a lot more happy with than a rubbish language like JavaScript! For me 
it opens a lot of possibilities!


But let me get back to my current problems. I can accept loading images 
through HTML for now, but how can I load and play sounds? There is an 
"Audio" API in JavaScript but it seems that pas2js doesn't support it, 
it can't find play(). I have searched web.pas and a few others for it. 
Where do I start to fix that?


/Ingemar

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] First pas2js public release

2017-12-20 Thread Ingemar Ragnemalm


Den 2017-12-20 kl. 13:09, skrev Mattias Gaertner:

On Wed, 20 Dec 2017 12:29:25 +0100
Ingemar Ragnemalm<inge...@ragnemalm.se>  wrote:

And then I got some of the provided demos running too and
managed to write one of my own. So it looks good!

Here is an early result, expressing my feelings for this release:

http://ragnemalm.se/images/santa/santa.html

I couldn't get sound working, but otherwise it seems to work as it
should! (I hope it does for the rest of you.)

Beautiful.
Can I add the URL as an example?


Absolutely, and I don't mind sharing the code. It is in the same folder! 
Very small and simple program, and all FPC. :)


Although I would like to make some improvements - who doesn't? To be 
precise, I want to figure out a way to play sounds, and I want image 
loading directly in the code and not dependent on the HTML. Any ideas 
about that?


It feels really nice to have my first Pascal web application running! 
Well, I could do it in Java before but that isn't as universal as 
JavaScript.


/Ingemar

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] First pas2js public release

2017-12-20 Thread Ingemar Ragnemalm


This is great news, something that I have been longing for for years! 
There have been some related efforts but none that really solved my 
problem. Best Christmas present this year!


After some initial fiddling, I realized that there was a misspelling in 
the wiki, and Hello World worked once I use -Jirtl.js rather than 
-jirtl.js. And then I got some of the provided demos running too and 
managed to write one of my own. So it looks good!


Here is an early result, expressing my feelings for this release:

http://ragnemalm.se/images/santa/santa.html

I couldn't get sound working, but otherwise it seems to work as it 
should! (I hope it does for the rest of you.)


/Ingemar

Den 2017-12-17 kl. 12:00, skrev Michael Van Canneyt:

From: Michael Van Canneyt
To: FPC mailing list,  FPC
development mailing list,  Lazarus
mailing list
Subject: [fpc-pascal] First pas2js public release
Message-ID:
Content-Type: text/plain; format=flowed; charset=US-ASCII


Hello fellow Pascal enthousiasts,

It is with great pleasure that I can finally announce the first publicly
available version of pas2js. A "beta" version, version 0.8.39.
The endpoint (for the time being) of nearly 10 years of (slow) development.

pas2js is a Object Pascal to Javascript transpiler. It compiles Object
pascal, and emits Javascript. The javascript is usable in the browser, and
in Node.js.

It is open source, and part of FPC/Lazarus.
This makes Free Pascal a full-stack development environment for Web Development:
You can use it to program the server and the browser alike, all from within
the environment you love so much:)

What does pas2js include ?
--

* On the language level:

It supports basically Delphi 7 syntax, interfaces excepted.
Naturally, any memory pointer operation is not possible in Javascript.
Code that relies on this will not work.

This is just the first version, we of course want to add the same language
features that exist in Delphi and FPC today.

* On the runtime level:

Beside the compiler itself, there is a basic Object Pascal RTL,
and several units from the FPC Packages are also available:

system
sysutils
Math
strutils
rtlconst
classes
contnrs
DB (yes, TDataset)
fpcunit testsuite
custapp
restconnection
js (javascript system objects)
web (browser provided objects)
libjquery (jquery is available too)
nodejs (basic node runtime environment)
typeinfo
objpas
browserconsole (support for writeln)
dateutils
browserapp
nodejsapp

* Debugging:

Obviously, the browser debugger can be used to debug the Javascript.
But there is more: the compiler can emit a source map, and this means that
if the browser finds the source file, it will display the original source
file instead of the javascript. You can debug Object pascal in the browser.

* Demoes ?

The package has several demoes, including FPReport, TDataset, JQuery and
Bootstrap.

* Documentation  ?

As befits an open source project, docs are lagging behind :/

But a WIKI page has been started, it will be expanded as time permits:

http://wiki.freepascal.org/pas2js

* Sources ?

The pas2js compiler sources and RTL sources have been checked in in FPC's
subversion repository. The page describes where to find it in SVN.

* Binaries ?

A snapshot is available:
http://www.freepascal.org/~michael/pas2js/pas2js-demo-0.8.39.zip

* Reporting bugs ?

The FPC bugtracker has now a 'pas2js' project, it can be used to report
bugs.

* Can you help ?

Yes, of course. There is still a lot of work to be done.
Feel free to contact me or Mattias Gaertner with questions.

What about Lazarus ?


Lazarus "understands" the extensions to object pascal (for importing Javascript
classes) that were borrowed from the JVM version of the compiler, so the
code completion will continue to work.

Using the pre-compiler command, CTRL-F9 just works. On error, you will be
shown the error location etc.

Further and deeped integration of pas2js into lazarus is expected.
In the first place, IDE integration.
Later on, a real widget set for the browser can (and hopefully will) be created.

But that is not all !
-

In the very near future, a major Delphi component vendor will announce a
complete package for RAD web development in the Delphi IDE.
The expectation is that later on, the exact same components will be usable
in Lazarus. In essence, the component developer has created a complete browser
widgetset. More than 100 controls are available.

Using this, you can design a web application as you design a desktop app;
Fully RAD, as you are used to. But even more, you can bind controls on a
form to existing tags in a web page, thus preserving the style in the web page.

The first demoes for a selected audience have evoked very positive feedback
indeed.

All this is based on 

[fpc-pascal] Pascal support in the Kattis educational site

2017-08-17 Thread Ingemar Ragnemalm


A bit of news which I think has some interest here:

"Kattis" (open.kattis.com) is a site where students can make programming 
exercises. This is quite important IMHO; companies look at Kattis 
results when recruiting.


Recently, Kattis added Pascal support, using FPC 3.0.0! (Free Pascal 
version 3.0.0+dfsg-2 whatever that means. The server runs Linux.)


I have made some of the exercises, and it works well. Not only that, I 
routinely score in the top group in performance (together with all the 
C++ solutions)! This is, of course, a matter of programming well, but it 
is fun to see FPC outperforming Java all the time - and this is visible 
to all users! Of course, *one* fast Pascal solution won't be noticed by 
many, but still I think it is an opportinuty to show that our language 
is useful!


For instance, here is the statistics for the "Good Morning" problem. 
Yes, that "1" on Pascal is me.


https://open.kattis.com/problems/goodmorning/statistics

Most importantly, it means that an important educational tool accepts 
FPC! Pascal students can now compete with the C++ students!


/Ingemar


___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Super Large Integer Math Calculations

2017-07-08 Thread Ingemar Ragnemalm


Bart  wrote:


On 7/7/17, nore...@z505.com  wrote:


For integers beyond 64 bit, or even beyond 32 bit on a 64 bit machine,
why can't the math be broken down into peices the way a human does it on
paper, and then theoretically any number can be added and subtracted,
even if it is beyond 32/64 bit?

Example:

type TSuperLargeInt = string;

var
i, j: TSuperLargeInt;
output: TSuperLargeInt;
begin
i := '10009';
j := '10001';
output := AddLargeInts(i,j);
writeln(output);
end.

http://svn.code.sf.net/p/flyingsheep/code/trunk/wtf/ncalc.pp does exactly that
(all dependenies are also found at
http://svn.code.sf.net/p/flyingsheep/code/trunk/wtf).

It can handle integers (and only integers) up to 2GB digits with
absolut precision.
It can handle GoogolPlex.

Calculate 9^99 with absolute precision:
29512665430652752148753480226197736314359272517043832886063884637676943433478020332709411004889

Fac(100)?
9332621544394415268169923885626670049071596826438162146859296389521753229915608941463976156518286253697920827223758251185210916864

It's not lightning fast, but there is room for optimization I guess.

Bart


Great! I knew someone must have made that! I needed this a few months 
ago, but resorted to Python at that time. Now I can use FPC next time. :)


/Ingemar

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] GLM library alternative?

2017-05-30 Thread Ingemar Ragnemalm


Den 2017-05-30 kl. 12:00, skrev Marco van de Voort:

For the 2Ders, in old GL I used glortho2d a lot. In newer ones I missed that, 
but I found
an equivalent on stackoverflow:


My FPC vector unit has overloading and many other functions 
(determinant, rotation around arbitrary axis...). Some functions like 
lookAt, frustum, ortho, matrix inverse etc are only in my C version so 
far. Not hard to port.


mat4 ortho(GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, 
GLfloat near, GLfloat far)

{
float a = 2.0f / (right - left);
float b = 2.0f / (top - bottom);
float c = -2.0f / (far - near);

float tx = - (right + left)/(right - left);
float ty = - (top + bottom)/(top - bottom);
float tz = - (far + near)/(far - near);

mat4 o = SetMat4(
a, 0, 0, tx,
0, b, 0, ty,
0, 0, c, tz,
0, 0, 0, 1);
return o;
}

So I have a pile of code on the topic, much of it for FPC. But shouldn't 
there really be a good OpenGL support package for FPC that was some kind 
of "standard"?


BTW, when I ported my OpenGL demos to FPC, I found that the FPC glext.pp 
had some fatal bugs. (Easy to fix, but I never figured out who would 
want the corrections, so I hope someone else noted that it crashed for 
modern OpenGL.)


/Ingemar

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] GLM library alternative?

2017-05-28 Thread Ingemar Ragnemalm

Ryan Joseph wrote:


I’m trying to following some OpenGL tutorials to learn the matrix transforms 
but I’m getting stuck because I don’t have the c++ GLM library which everyone 
is using. I see FPC has a matrix class but it doesn’t include all the helpers 
in GLM like rotation, transform, perspective transforms 
(https://open.gl/transformations). If I knew enough I think I could just build 
these myself but I’ll likely introduce a bunch of errors at first.

Has anyone converted these to Pascal before or having some similar I could look 
at?

Regards,
Ryan Joseph


I use my own vector/matrix library VectorUtils3, which is written in 
plain C (thereby FPC friendly), and included in the common code of my 
OpenGL demo library:


http://computer-graphics.se/demopage/

Actually, there is also an FPC version of VectorUtils, FPC interfaces to 
most of my common code, and even a bunch of demos that I made FPC for. 
(Modern OpenGL, not old-style code, no immediate mode.) I never uploaded 
them anywhere, since there didn't seem to be much interest, but if 
someone wants them, no problem.


/Ingemar

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

[fpc-pascal] Dynamic arrays in LLDB

2017-01-11 Thread Ingemar Ragnemalm


I am trying to debug an FPC program that uses dynamic arrays. (Don't 
them all?) It seems to me as if LLDB can not handle them. I get this error:


A1 is a dynamic array of Integers (SmallInt).

(lldb) p A1
(ARR1) $7 = 0x000b5048
(lldb) p *A1
error: incomplete type 'SMALLINT []' where a complete type is required
error: 1 errors parsing expression
(lldb)

Compiled with FPC 3.0, OSX 10.9, lldb-320.4.160.

The same problem happens with other dynamic arrays. Is there some way to 
get around this?


/Ingemar

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Write Applet with FPC JVM

2016-04-03 Thread Ingemar Ragnemalm



Message: 1
Date: Sat, 2 Apr 2016 03:39:41 -0700 (MST)
From: leledumbo 
To: fpc-pascal@lists.freepascal.org
Subject: Re: [fpc-pascal] Write Applet with FPC JVM
Message-ID: <1459593581645-5724733.p...@n5.nabble.com>
Content-Type: text/plain; charset=us-ascii


It compiles with both Java and FPC, but the FPC version doesn't run.

Works fine here:
fpc-helloworld-applet.png



Any ideas? Any obvious mistakes of mine?

I change your program to a unit, though I don't think that matters as long
as HelloWorldApplet.class is generated. Then I modify your applet tag by
removing archive attribute as it's not in a .jar but a standalone .class.
That's it.


Great! I tried and indeed, compiling a unit did it! Editing the HTML 
file didn't seem to matter though.



/Ingemar

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


[fpc-pascal] Write Applet with FPC JVM

2016-04-01 Thread Ingemar Ragnemalm


Hello, FPC list!

Is there anyone who knows how to write a JVM applet with FPC?

I have this minimal Java applet:

import java.applet.*;

import java.awt.*;

public class HelloWorldApplet extends Applet

{

   public void paint (Graphics g)

   {

  g.drawString ("Hello World", 25, 50);

   }

}


AFAIK this translates to:

{$mode objfpc}

// I try to make an Applet. How?

program HelloWorldAppletProgram;

uses

jdk15;

type

HelloWorldApplet = class(JAApplet)

public

procedure paint(g: JAGraphics);override;

end;




procedure HelloWorldApplet.paint(g: JAGraphics);

begin

g.drawString('Hello World (FPC)',25,50);

end;

begin

end.


Compiles, produces HelloWorldAppletProgram.class and HelloWorldApplet.class.

FPC compilation line:

/usr/local/bin/ppcjvm -O2 -g HelloWorldAppletProgram.pas -XP 
-FD/usr/local/bin/


Java compilation line:

/usr/bin/javac HelloWorldApplet.java

Uses this HTML file:

HelloWorldApplet



Should IMHO run with

appletviewer HelloWorldApplet.html

It compiles with both Java and FPC, but the FPC version doesn't run.

Any ideas? Any obvious mistakes of mine?


/Ingemar

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Smartphone apps in FPC

2016-03-20 Thread Ingemar Ragnemalm



Maciej Izak wrote:

Well, yes, it works fine, but you still need a Java part otherwise a
lot of APIs cannot be accessed. In particular APIs that require
creating interfaces.


I can confirm too :)


But for completeness, surely you do NOT have to write the Java (JVM) 
parts in Java, but you can write that too in FPC, right? I mean, using 
the FPC JVM compiler. But you need to interface JVM and native code like 
you do with Java code.



even is possible visual remote-debugging
from Lazarus (but that requires many IDE modifications).

wow, any link describing how to achieve that?

Work in progress.


I am looking forward to more information here! :)


/Ingemar

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Prospects for running Lightspeed/THINK Pascal and Codewarrior Pascal with FPC

2014-08-21 Thread Ingemar Ragnemalm

On 21/08/14 07:41, Jerry wrote:

I have a lot of old Pascal that I am getting interested in reviving. It was 
originally written in Lightspeed/THINK Pascal (did I mention it is old?) and 
around 2000-2002 I converted it to Codewarrior Pascal. These are both Macintosh 
dialects.

What are the prospects of running each of these dialects under FPC? Are there 
compatibility flags to set? Would there be much rewriting?



The compatibility flag to set is the compiler directive {$mode macpas} 
(at the top of the file), or the command line switch -Mmacpas. I don't 
know how much there would be to rewrite, but in general that switch 
should make the accepted syntax at least quite compatible to CodeWarrior's.


  

One of the things that I recall being possibly unique and possibly troublesome 
now is that under THINK Pascal, there was a built-in text I/O window and a 
built-in graphics drawing window, both of which I used. In the latter case, it 
was mainly MoveTo(x, y) and LineTo(x, y) stuff. When I moved to Codewarrior, I 
was somehow able to emulate that both text and drawing windows. I suppose the 
text window became a normal terminal (whatever Codewarrior offered). I can't 
remember if Codewarrior offered a drawing window or if I had to make a crude 
one using a (now) Carbon window.



Maybe you could rewrite your code on top of TransSkel: 
http://ragnemalm.se/lightweight/ (click on it in the navigation bar on 
the left).
  


Thanks, Jonas!

I am very comfortable in porting old Mac code to FPC. FPC implements a 
very nice and modern Pascal that handles most (but not all) old code. 
The only problem I have had is with multiply nested code that does 
exit on the enclosing function, which FPC can't do.


You have to make your own text/drawing windows, but that is fairly easy. 
If you program for Carbon, your code can be pretty close to the old one, 
and you can even use QuickDraw, but if you want to be a bit more future 
safe, TransSkel 5 targets Cocoa, includes a partial replacement for much 
of the Mac Toolbox GUI and a future safe QuickDraw layer, QDCG, where 
all those MoveTo/LineTo should work just fine.


And if you want an IDE that is somewhat similar to Think, Lightweight 
IDE is aiming in that direction. The debugger needs more work but we are 
quite active right now so the plan is to fix the remaining limitations 
during the coming months. (The latest upload was today.)



/Ingemar

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


[fpc-pascal] Re: fpc-pascal Digest, Vol 87, Issue 13

2011-09-11 Thread Ingemar Ragnemalm

From: Marcos Douglas m...@delfire.net

Subject: Re: [fpc-pascal] Overloading the increment operator (+=)
To: FPC-Pascal users discussions fpc-pascal@lists.freepascal.org
Message-ID:
CA+ixmeZZ9r2EiUzqJ-F2=htugyunkywhy_729jfyuofqyii...@mail.gmail.com
Content-Type: text/plain; charset=UTF-8

2011/9/10 Flávio Etrusco flavio.etru...@gmail.com
  

Hello,
If write a declaration without result it complains about invalid
syntax; if I add a result it says impossible operator overload.
Does FPC allow overloading the += operator? If not, why?



You do not need overload the += operator, just do it in := operator.

Marcos Douglas
  


I don't think the question was whether it was necessary, but whether it 
was possible. When you use += a lot for scalars, it is a bit annoying 
when I can't do the same for vectors.



/Ingemar

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Converting code from C++ to FP....

2011-03-19 Thread Ingemar Ragnemalm

Jeppe Johansen jepj...@es.aau.dk wrote:

Den 19-03-2011 08:30, Aleksa Todorovic skrev:
  

2) The parameter into the function is a pointer *A of type double. To
me that indicates a value of some kind, but in the code it suddenly
seems to appear as an array with indexing. What would be the proper
pascal translation of this?
  

Indeed. C doesn't actually have difference between pointer to some
data and arrays. You could use open array:

procedure Decompose(var A: array of double);


Or you could use

procedure Decompose(A: pdouble);

That way it would be precisely the same as the C solution. You can 
array-index A the same way as in C(in some fpc modes)
  


I would only do that when mixing C and Pascal code, to interface with C 
code.
In a Pascal-only program, never. Converting bad C code (that means 
almost any C code)
to good FPC code is a great thing to do, converting to bad FPC code is 
not as much fun.



/Ingemar

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


[fpc-pascal] Re: Name of the programming language used in/with FPC

2011-02-09 Thread Ingemar Ragnemalm


Mark Morgan Lloyd markmll.fpc-pas...@telemetry.co.uk wrote:

Marco van de Voort wrote:
  

In our previous episode, Ben said:


What is the programming language used in and with the Free Pascal Compiler?

* Object Pascal
* Delphi
* Free Pascal
* Pascal
  

Pretty much all apply.  Free Pascal has a mode concept with 5/6 modes.



I think that we need to distinguish between the name of the language 
(either Pascal or Object Pascal) and the implementation (Free Pascal). 
It's entirely reasonable that there be variations in the underlying 
language depending on implementation.


I'd suggest that an issue to be considered is what facilities are 
available in the language by default, i.e. with no command line options, 
embedded directives or uses statements.
  


It is all of them.

Object Pascal is a superset of Pascal. Delphi is a variant of Object 
Pascal (an implementation of
OP plus a RAD). Free Pascal is an implementation and extension of all 
the others.


I consider myself an FPC programmer rather than a Pascal programmer 
simply because it is important
to stress that I am not clinging to the 70's original Pascal but a 
modern language. Strangely enough,
you have to make that clear, while few C programmers are expected to use 
the KR C of the same time
even though they don't present themselves as C99 programmers or ANSI 
C programmers.



/Ingemar

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


[fpc-pascal] Sin function

2010-12-29 Thread Ingemar Ragnemalm

faber bor...@gmail.com wrote:


Hi,
according to docs/reference sin function should print 0.0 when

Writeln (Sin(Pi):0:1);

but, with fpc 2.4.0 and 2.4.2 (x86) I've get -0.0, such a result is
not entirely correct.
This is a bug (in sin func.) or something wrong with the formatting ?

best regards
faber
  


If I were you I would print it with more digits so you see if there is 
any significant difference at all.



/Ingemar

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] playing sound files (linux and windows)

2010-06-14 Thread Ingemar Ragnemalm

dmitry boyarintsev skalogryz.li...@gmail.com wrote:

On Mon, Jun 14, 2010 at 5:37 PM, Graeme Geldenhuys
graemeg.li...@gmail.com wrote:


Has anybody managed to play sound files under both Linux and Windows?
Does FPC have a cross-platform API or FCL class for this?



I'd offer using OpenAL, however it requires proper libraries to be
installed on Linux (afaik installed by default in all modern desktop
distribs), and proper .dlls available for Windows.



There's proper example in FCL how to use OpenAL to play .wav, .ogg .mp3 files.


I second that, AL is worth considering. It was very easy for me to use, at 
least once I found a decent WAV loader.

I have a little OpenAL kit for the Mac here:

http://www.ragnemalm.se/lightweight/openal_fpc.zip

On the Mac it it great: always installed, much better API than Core Audio, and 
portable. Havn't tried it on Linux och Windows though. And there is one problem 
that AL doesn't help me with (apart from loading WAV) and that is to play 
music. Uncompressed sound isn't useful for music. I can play that with 
Quicktime, but I'd like to use something cross-platform.


/Ingemar


___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


[fpc-pascal] Re: fpc-pascal Digest, Vol 72, Issue 15

2010-06-04 Thread Ingemar Ragnemalm

spir denis.s...@gmail.com wrote:

I'm surprised of this, fpc still systematically trying to follow 
Delphi, after so many years. I can understand that at the beginning 
the fpc team needed to mostly comply with Delphi, as de facto object 
pascal standard. But then, fpc could live its own life, possibly 
taking the best of Delphi's innovations, but not having as main goal 
to be always running after it. Fpc anyway has done different choices 
for some features (including choices of non-implementation), so why 
not having already made the step of declaring fpc a (object) Pascal 
dialect of its own?


First of all, I would like to saty that Pascal needs convergence and 
compatibility; it must be easy to adapt old code as well as being 
compatible between compilers. And with only three significant players 
(if my count is right: Delphi, FPC and GPC) that problem is quite a bit 
smaller than in the past when countless of companies were producing 
various dialects.


But there is of course another point, moving ahead. One major advantage 
of FPC is that it gives me all the advantages of C++ (performance, 
overloading), but none of its weaknesses (manual namespaces, lack of 
modularity, ugly syntax, questionable security). But the Pascal 
compilers I used in the 90's did not have that. I am not sure FPC would 
have been a viable choice today without these additions. So pleasew do 
not stop innovating!


Some problems can be handled by built in dialects, of which FPC have 
plenty. I am switching between modes a lot, and I often wish they could 
be merged a little bit. (MacPas and Delphi modes are quite different.)


I think my conclusion is that various compatibility modes are important, 
but I think FPC should rather be an innovative superset of Delphi than a 
clone that waits for the leader to move.



/Ingemar

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] png bitmap

2010-02-28 Thread Ingemar Ragnemalm

Mattias Gaertner nc-gaert...@netcologne.de wrote:



Rainer Stratmann rainerstratm...@t-online.de wrote:




 Has someone experience with creating png bitmap files?
 Is it easy or complicated?
 I programmed a web server and wanted to serve diagrams also.
  



Something like this:

http://wiki.lazarus.freepascal.org/Developing_with_Graphics#Drawing_without_LCL

?

Mattias


Looks nice, but it doesn't link on my Mac. I get a bunch of link errors all 
prefixed _FT_. FreeType? (Irrelevant for the PNGs though.)


/Ingemar


___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] [OT] which editor - emacs?

2010-01-10 Thread Ingemar Ragnemalm

Hans-Peter Suter gcha...@gmail.com wrote:


I'm on a mac and use TextMate currently. As it doesn't jump between
declaration and implementation and ist mac-only, I am looking for a
replacement.

Is Emacs a good choice? Does it work well with FPC?
  


I don't quite understand the question.

Why is Mac only a problem? I use whatever is available on the platform 
I am on. Under Linux, I usually use Gedit. Well, except that I avoid 
plain text editors for development since I consider them inefficient.


Emacs is good if you don't care for consistency between applications at 
all. It can do anything but nothing is easy with it. It has old commands 
from the TTY days that are different from everything else.


How should jump between declaration and implementation work? That 
sounds like the kind of functionality that requires the program to parse 
the file contents a lot, which rules out any editor that doesn't have an 
explicit Pascal mode that is FPC compatible.



/Ingemar

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


[fpc-pascal] Re: OpenCL (Lourival Mendes)

2009-12-22 Thread Ingemar Ragnemalm

I have tried Dmitry's OpenCL interfaces, and they work just fine. I use it on a 
Mac using Lightweight IDE, and making OpenCL work through it using C or FPC is 
trivial; it just works. I don't know how hard it is to use it from Lazarus 
(which I can't run for unknown reasons) but it can't be very hard.

There are three ways to work with GPU computations, shaders (e.g. GLSL), CUDA 
and OpenCL. CUDA is integrated with C, for better or worse (worse for us since 
that makes it hard to use from FPC). Shaders and OpenCL are no problem to use 
from FPC. In all cases, the languages are C-based. :-(


/Ingemar


Lourival Mendes mendes.louri...@gmail.com wrote:



I found that URL, actually I'm on the same situation... I'm waiting
for them to be applied...

please correct me if I'm wrong, CUDA work only for NVidia and OpenCL
should work for all GPU, right?
 and if I got the idea the OpenCL bindings submitted works only for
Mac. Can I get and try it on Windows?

Lourival


2009/12/22 Michalis Kamburelis michalis.ka...@gmail.com:
  

Lourival Mendes wrote:


FPC/Lazarus. Is there a project on it? Is there some thing working on
Parallel programming on FPC?
  

There are OpenCL bindings submitted to mantis,
http://mantis.freepascal.org/view.php?id=15297, by Dmitry Boyarintsev.
I didn't test them, as I don't have capable GPU (yet) :)
But I'm waiting with anticipation for them to be applied :)
(I was playing with CUDA some time ago, which had basically the same
goal, although was NVidia-only.)

Michalis
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal



___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Who said Pascal isn't popular

2009-10-18 Thread Ingemar Ragnemalm

Vinzent H?fler jellyfish.softw...@gmx.net wrote:


Graeme Geldenhuys graemeg.li...@gmail.com:

  

Any programmer worth hiring should find it relatively easy to switch
to another language. Or and least become proficient in it in a
relative short period of time.  The basic principles apply to all
languages, it's just the tool-chain and syntax that differs.



Yes and no. The mindsets of the languages may differ. Try talking about typing 
with a C-programmer and with an Ada-programmer and you'll see what I mean.

That's why the question should not be: Which language do you know?, but rather What other 
languages do you know? It tells me more about the mindset of the programmer than any previous 
10-years experience with $LANGUAGE.
  


Good point there. Anyone who only knows one language is likely to be 
unable to adapt even to the changes in that particular language. For us 
who have moved between languages, it is more natural to adapt.


Don't learn a language; learn to program. Big difference. I think C and 
Java are particularly bad choices to teach programming, and learning 
just the one that they use in the industry only makes you 
narrow-minded and limited.



/Ingemar

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Who said Pascal isn't popular

2009-10-16 Thread Ingemar Ragnemalm



Lee Jenkins l...@datatrakpos.com wrote:

  

I don't agree with the idea that BEGIN...END determines the failure
of Pascal, as syntax completion is for that. Both BEGIN...END and
{...} are finished in the same time if they were done by computer.
On the contrary, it is part of the way of Pascal being elegant.




Its very amusing to me when I meet people who are also developers and tell them 
I use object pascal and they look at me like I just told them I was using punch 
cards.


I just tell them...

ObjectPascal:  Strong like C, Easy like VB.

--
Warm Regards,

Lee
  


That blank look in the eyes of the C crowd is so strange. Lots and lots 
of people shy away from C/C++/etc since it is so obviously bad, but they 
don't know about Pascal so they go to slow scripting languages. They 
sure are happpier there than with C, but Pascal would be so much better 
in many cases.


I usually don't say that I use Pascal, I say that I use FPC. Then they 
don't understandand what that is and think they missed something. And 
they sure have.


FPC: Faster to compiler, faster to run, faster to write, faster to 
debug... We should print T-shirts with messages like that.



/Ingemar

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Error: Assembler as not found, switching to external assembling

2009-01-19 Thread Ingemar Ragnemalm

Jonas Maebe jonas.ma...@elis.ugent.be wrote:


On 31 Dec 2008, at 17:04, Giulio Bernardi wrote:

  

Joost van der Sluis ha scritto:


Op woensdag 31-12-2008 om 09:11 uur [tijdzone -0500], schreef César
Espinoza:
  

Error: Assembler as not found, switching to external assembling



I could be wrong but check if you have installed the binutils on your
machine. (ld, as)
  
On Mac OS X, you have to install the Developer Tools (they are on  
the Mac OS X DVD IIRC).



Correct, but the FPC installer package normally checks whether they  
are installed, by checking for the existence of /usr/bin/gcc. It's  
pretty odd that /usr/bin/gcc would exist, but /usr/bin/as not. Maybe  
the path is wrong in the terminal session for some reason?


To César: what does

echo $PATH

show? And

ls -l /usr/bin/gcc /usr/bin/as
  


It should be stressed that this problem is not isolated to one user; I 
have got questions from at least two
users of Lightweight IDE. The IDE has nothing to do with it, of course, 
it relies on FPC finding the
assembler. I suppose the IDE could call as itself when need arise, but 
that seems like an unnecessary

workaround.

One of the users reporting problems did search for as, and found it in 
/developer/usr/bin/as! So Xcode

was installed, and as was installed, but not in /usr/bin/as!

Maybe Apple has changed the paths in some Xcode version? I have no 
problems on my MBP/10.5 though.


Perhaps an alias from /usr/bin/as would help? Or is there anything else 
that FPC needs?



/Ingemar

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Porting linux to pascal, would it be, possible ?

2008-12-05 Thread Ingemar Ragnemalm

Skybuck Flying [EMAIL PROTECTED] wrote:


Hello,
  
An open source pascal operating system could be cool.
  
Would translating/porting linux to pascal be possible ?
  


Absolutely. Most of Unix is plain C, which translates well to Pascal. 
C++ is harder, of course.


Gerard N/A [EMAIL PROTECTED] wrote:


As with many things, it only depends of the time you have. But as you grow 
older you get a different idea of life expectancy and
the use of your remaing time.
  


This is an argument only after considering the time versus the goal. Is 
the goal worth the time?


An operating system based on FPC code would be one way to give FPC more 
(well deserved) attention, one way to make a wider range of people know 
that the language is not dead, but significantly updated and a stronger 
alternative than most people think.


But it is the best way? An OS kernel is not the most visible source code 
that makes a lot of people gather to have a look. Showing off the 
technology can be done in more time-efficient ways.


Another goal is to make a better OS. FPC programs use less memory and 
starts faster. That can be a good thing. Would it be significant? I'm 
not sure.


You are perfectly right in that we must choose our battles and spend our 
time on things that are worth the time. I don't rule out that this could 
be one. Porting Linux doesn't have to imply that every little program 
is ported.



/Ingemar

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Porting linux to pascal, would it be possible ?

2008-12-05 Thread Ingemar Ragnemalm


Leonardo M. Ram? [EMAIL PROTECTED] wrote:


--- On Fri, 12/5/08, Guillermo Martínez Jiménez [EMAIL PROTECTED] wrote:

  

By the way, Linux is good as it is now and Pascal isn't the best
option to create an operating system.



Are you sure? doesn't older MacOS's versions where written in Object Pascal?
  


Yes, and there's nothing wrong with Pascal for an OS. It would be excellent.


I think the problem here (again) is not the language, it's the critical mass of 
users of the language. Using C for Linux was a good bet, not because the 
language is good (Pascal is way better for me), but because C has a wider user 
base who can fix/add features.
  


Using C for Linux was the only way, because there was a free C compiler 
(GCC) and none for Pascal or other comparable languages. Things have 
changed since then, but much of the software industry is on a path 
decided from the situation 20 years ago. The industry took the C route 
since there was no cross-platform Pascal, while Linux made the choice 
from available free software. Now everything must have inherited design 
flaws from C just because of what was available in the 80's. That is, 
unless the tide changes. It can happen.



Felipe Monteiro de Carvalho [EMAIL PROTECTED] wrote:

My open source project, for example, the Virtual Magnifying Glass,
suffers in linux because KDE only wishes to distribute C++/Qt software
and Gnome only distributes C and C# software, so it get's hard to be
popular.
  


Now, that sounds like one real problem, related to the porting issue, 
which we can address. And not that doesn't need as much work.


So the KDE and Gnome projects are language-locked? (How? Surely users 
don't select software by language? Or are the distros incomplete, 
FPC-wise? Hard to recompile?) Anyway. that sounds bad! And that suggests 
a much shorter path: Adapt a distribution to Pascal Gnome support, 
with full Pascal interfaces and code, or whatever is missing. Port Gnome 
examples, if it isn't already done, and show that Pascal (FPC) is not 
only an option but a *better* solution. Easier than C/C++, faster than 
Java, much faster than Python... I don't know if an FPC-tuned distro 
would make any difference, stronger FPC support in, say, Ubuntu, would 
make a bigger impact. Acceptance of FPC sounds like a good goal to me.


Who isn't distributing? Gnome? That isn't a distribution. I don't quite 
understand what you mean.


The FPC OS doesn't have to be 100% written in FPC, not even 10%. No 
hurry. The C code is ugly but it works as long as you don't take GCC 
out. Port what really counts, making it possible and well supported to 
write *new* programs in FPC.



/Ingemar

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


[fpc-pascal] Re: Porting linux to pascal, would it be, possible ?

2008-12-05 Thread Ingemar Ragnemalm

 Guillermo Mart?nez Jim?nez  [EMAIL PROTECTED] wrote:


I disagree.  C is better for write operating systems *by definition*:
C was created to write UNIX, Pascal was created to learn good
programming techniques.  C is low/mid-level language, Pascal is
high-level (and Object Pascal is even higher):  OS are the lowest
software level.
  


This was true in the 70's. Then Pascal wasn't modular (C wasn't but 
hacked it in header files, and still does), it simply wasn't adapted for 
programming of that kind yet. And C was optimized for being similar to 
the machine code of the CPU's of the time. And it still is.


Today, the biggest difference between the languages are missing 
high-level features in C (which Pascal has had for decades), and that 
the syntax of C has a big range of obvious flaws. Neither of these make 
C a better language for anything.


The advantage to be able to mix operations on the same line, like the ++ 
operator, had importance for performance back then, before pipelining 
and caches. Today, it simply doesn't matter.


IMHO, C was simply the *first* language replacing assembly language on 
the OS level. And the first often gets chosen as standard, the only way.


Now, to return to the OS part: How could Linus Torvalds write the core 
of Linux in rather short time, single-handed, if it is such a huge task 
just to port it?


The window manager part is what I find really interesting. If Gnome is 
language-locked, there are two ways to change that: Either convince the 
Gnome team to open it up in our directions (just a matter of interfaces 
to them) or to make an FPC branch of Gnome (assuming that Gnome is under 
appropriate licenses), where appropriate parts are ported to FPC. I 
would call it Jedi Gnome, analogous to Jedi-SDL. Now, is there anyone 
more than me visualizing Yoda with a lightsabre as logotype? :-)



/Ingemar

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


[fpc-pascal] Re: OT: Buy a Mac to develop for MacOS? Which one?

2008-10-12 Thread Ingemar Ragnemalm



Message: 1
Date: Sat, 11 Oct 2008 17:09:10 +0200
From: Lukas Gradl [EMAIL PROTECTED]
Subject: [fpc-pascal] OT: Buy a Mac to develop for MacOS? Which one?
To: FPC-Pascal Mailinglist fpc-pascal@lists.freepascal.org
Message-ID: [EMAIL PROTECTED]
Content-Type: text/plain; charset=ISO-8859-15; format=flowed

Hi!

Having a customer request to port an app to MacOS I have to think about 
some test platform.

As I was never interested in MacOS this is virgin territory to me.

So perhaps some of the Mac-users here can help me out a bit:
I still want to use my current machines as them main ones, I just need a 
platform to compile and test my application on.


1.) Do I really need to buy a Mac? Or is there a good solution to 
emulate one on an x86 Linux box? Just crosscompiling without the 
possibility to do serious tests in house is not an option, as my app has 
to integrate in some hardware-subsystems (printing, networking).


2.) If 1=yes, which one would you recommend? Which hardware platform? 
Intel? PowerPC? It has to be OSX, do I have to care which version I get 
or is just any OSX ok for testing?


Perhaps some Mac-Developer out there could post his/her opinion...
  


Intel, positively. A MacBook is quite sufficient. A Mac Mini would also 
do the trick. I would not consider emulation.


A second hand PPC Mac is, of course, a lot cheaper, and will do for a 
while, but you will want an Intel one sooner or later.



/Ingemar

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Small OSX GUI apps

2008-09-17 Thread Ingemar Ragnemalm

Jon [EMAIL PROTECTED] wrote:


Thank you for your replies Jonas

  

if you're coming from Win32 programming, you may want to read this:
http://developer.apple.com/documentation/Porting/Conceptual/win32porting/win32porting.html



Interesting document. Do I have to install Interface Builder and XCode to use 
FPC?
  


You need some GCC tools that are installed with Xcode. It is possible to 
make installers for those only, but it is easier to install Xcode and 
then trash any unneeded apps.



Are any *simple* examples available for creating OSX gui apps?
  

There's one here (using Carbon):
http://svn.freepascal.org/cgi-bin/viewvc.cgi/trunk/packages/univint/examples/



Excellent, just what I was after. Are there any more, especially Cocoa?
  


Not much with Cocoa yet, but there is a whole bunch of Carbon-using 
examples here:


http://www.ragnemalm.se/lightweight

Check out distributions with all demos.


- and which is best?
  
Depends on who you ask. But Apple has made it clear that they want to  
move forward primarily with Cocoa.



How good is the FPC for each? Is there a separate install for both?
  


Currently (unless I have missed some significant breakthoughs) FPC 
support for Carbon is excellent while Cocoa is more 
experimental/preliminary. We will have to move to Cocoa GUIs simply 
because Apple won't provide anything else, but I have some ideas about 
making a nicer layer for hiding that. In particular, a cross-platform layer.



/Ingemar

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] pascal on macbook

2008-04-27 Thread Ingemar Ragnemalm

Tom Verhoeff [EMAIL PROTECTED] wrote:

 For Pascal, you can also consider LWP (Light-Weight Pascal) at
http://www.pascal-central.com/lwp/lightweight.html

Thanks! The link to the real home page is, however:

http://www.ragnemalm.se/lightweight

Richard Ward [EMAIL PROTECTED] wrote:

Just want to make sure I can use Java or Pascal (prefer Pascal) 
before I spend the 2,000 plus dollars.


 Just to follow up a bit more.   The Mac IDE from Ingemar will run on
 Core Duo and PPC processors.   There were some issues other people
 had on OS 10.5 (Leopard) but he released a fix or work around for
 that.

It works fairly well, but the Tiger-only version is so far a bit more 
stable.

The problem might go away in some Leopard update (because the problem is
simply a bug in Leopard).

 Although the main information page at the site link I  
 provided says it has limited support for JAVA, later updates have  
 stated that it  has full support.


No, not full Java support yet. No error parsing or application bundle 
building
for Java like it has for Pascal and C. Not yet, that is. Today, you can 
build

and run Java command-line applications and that's all. I personally consider
GPC or Ada support more interesting than Java. There are more Java users 
but I

prefer spending my time on languages that I like and consider using.

 It appears to have good support for C as well.

Yes, the C/C++/ObjC support is as complete as for Pascal.

 if you decide to use x-code or LW - IDE, you should be able to use  
 Free Pascal or GPC without much problem (besides the complexity of  
 using x-code itself).  Basically, Apple bundles x-code and their  
 Cocoa and Carbon development libraries for free with the OS.


GPC is not yet tested with Lightweight IDE. I can't imagine that the FPC
and GPC compilers are so close that they can share the same error parser
and compilation lines. So there are a few details that I expect to fix
for GPC, not much, but a few things.


/Ingemar

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Why I?m choosing (Object) Pascal

2008-04-07 Thread Ingemar Ragnemalm

Michael Van Canneyt [EMAIL PROTECTED] wrote:
   Hello,
  
   After a month (a bit more) of writing the above post, I finally
   released it in my blog:
   http://idkn.wordpress.com/2008/04/06/why-im-choosing-object-pascal/

 Just one remark:

 Have a look at http://www.morfik.com/ - a great way to creat pascal
 web applications. No need for Perl/Ruby/Python. These tools are primitive
 when compared to what Morfik does for you.

 Michael.

MS Windows only, otherwise it looks very interesting, although a bit 
pricey. No signs of support for other platforms? I must say that the 
very thought of creating web content with Pascal sounds like a dream 
compared to crappy languages like PHP.



/Ingemar

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] beginner in pascal for Mac

2008-01-18 Thread Ingemar Ragnemalm

[EMAIL PROTECTED] wrote:

Damien Gerard wrote:

On Jan 15, 2008, at 11:54 AM, Ezequiel Tacsir wrote:

  
I was used to wok with freepascal on windows. Now, I have switch to  
mac (10.5) and would like to know what are the things that I need to  
have it running. If anybody can send me a basic tutorial for  
installation, running and so on, I will be delighted.



Using FPC on a mac is really easy if you are comfortable with Terminal  
and I use it every days.
After that, I don't know, my Vim is for me really really more  
efficient that any text editor :)
  


Installation is easy. You need to install the developer tools (Xcode, 
but the GCC linker is the important thing), but both the Xcode and FPC 
installers are Mac standard installers, no trouble. (Perhaps the best 
feature with the Mac is the excellent installation systems.) After 
installing Xcode, you can trash the entire Developer folder if you don't 
want the applications (freeing up most of the disk space). The important 
things are installed in /usr/local, which is only visible from the Terminal.


If command-line work is all you want, the Terminal is what you want. 
Plus a text editor. Nobody (?) does text editing on the command line any 
more, but there are plenty of nice text editor to choose from.


When fed up with command-line compilations, you can consider two IDE 
options: Xcode (with plug-ins) or Lightweight IDE. I wrote Lightweight 
IDE myself after giving up Xcode and found myself back at the command-line.



/Ingemar

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Maybe a new fpc book :)

2008-01-06 Thread Ingemar Ragnemalm

On Jan 5, 2008, at 11:11 AM, Florian Klaempfl wrote:
  

Marco Ciampa schrieb:


I work in a high school in Italy.
We are currently using fpc + gnuplot for math and phisics  
simulations.
In one lab we are currently starting to use Linux as the _sole_  
platform.


On Wed, Jan 02, 2008 at 12:35:57PM -0500, Anthony W. Henry wrote:
  
   1. What OS is most-used for Free Pascal? Windows?  
Linux?


80% windows and 20% Linux (this one growing)

  


Not OS X at all ? I am a bit surprised.
  


Me too, I am using FPC daily on OSX and have recommended many to do the 
same. It might not be many percent but certainly growing.


And there are so many other FPC platforms, so we better set aside a few 
percent for the rest of us.


Speaking of books for teaching FPC, could one not take an old classic 
Pascal book and update it with the news? There are many abandoned books 
that the author may enjoy seeing brought back to life. But maybe it is 
better to write it from the modern perspective from the start.



/Ingemar

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


[fpc-pascal] Re: Help getting started with FPC

2007-12-02 Thread Ingemar Ragnemalm



Edward Kearns wrote:

First of all, note that LWP 0.2.9's demo is TransSkel.p, not  
NewSkel.p, as in the Lightweight Pascal IDE notes.


Yes, that was my fault. I only included the newest demos, but NewSkel.p 
should have been included all the same, since it is the example demo. 
TransSkel is something completely different.


Then when I do  
compile, and see nothing happen, the about box says:


Lightweight IDE: 0.2.9
FPC (Intel): Failed!
FPC (PPC): 2.2.0
GCC: powerpc-apple-Darwin8-gcc-4.0.1(GCC)
TransSkel: 4.0a1
  


Looks perfect! (As long as you don't need to compile for Intel.)


/Ingemar

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Help getting started with FPC

2007-12-01 Thread Ingemar Ragnemalm


Edward Kearns wrote:
Because of all the help I got, especially from Jonas Maebe, I  
successfully opened and ran successfully in LIghtweight IDE the  
Pascal program I had developed over several years in Think Pascal.  
NOW I can modify it, as I had desired.
  


That's great! What was the problem? File extensions? I'd like to know so 
I can make the

error messages better.


/Ingemar

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Help getting started with FPC

2007-11-30 Thread Ingemar Ragnemalm

Jonas Maebe wrote:
If you want something more akin to Think Pascal, you may want to try  
LWP, which is available here:

http://sourceforge.net/projects/lightweight-ide
  


Thanks, Jonas! I think that is what Edward needs. BTW, the latest 
version is at


http://www.ragnemalm.se/lightweight

It is much harder to upload to SourceForge, so I can't always do that.

Edward Kearns [EMAIL PROTECTED] wrote:

I did try LWP, and when I opened New Skel, and Compiled, and Ran, all  
I got were error message.
  


Then I must guess that you either have problems with the paths (strange 
characters that mess up the command lines) or something is not installed 
properly. What does the about box look like? It should tell what 
compilers are installed.




Here's what I wrote:


Program HelloWorld;
begin

print hello

end.

and I'm told

No main program found. Can not build.
  


I took that code, created a new document in LWP, saved as HW.pas, 
fixed the print line

to WriteLn('hello');, hit cmd-R. It runs just fine.


What extension do I need on it?
  


.p, .pas, .P, .PAS, .dpr should all work in recent versions.

Let me ask:

- Is Free Pascal installed? For the target you use? (If you use an Intel 
Mac, you need to change target to Intel unless the PPC compiler is 
installed.)
- Is GCC installed? (Comes with Xcode, I don't know if you can download 
it separately somewhere. AFAIK FPC needs GCC for linking.)


I am sure this can be solved pretty easily. In all my tests, LWP runs 
nicely as long as FPC is installed. I will gladly fix any beginner traps 
you find.



/Ingemar

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Mac losing Carbon support in 64bit Leopard

2007-06-16 Thread Ingemar Ragnemalm

Felipe Monteiro de Carvalho wrote:


On 6/15/07, memsom [EMAIL PROTECTED] wrote:


Apaprently Troll Tech is unhappy as they use Carbon in their Qt port for
Mac OS X...



Everyone is unhappy. Office, Photoshop, Adobe products, Firefox,
wxWidgets, etc, are all based on Carbon.

Actually to me it seams that Apple is the only entusiastic company
about Objective C
  
They have lured many younger developers into the Cocoa cage, but AFAIK 
the big players
are not there and are unlikely to go there since they need good 
cross-platform solutions

and can't afford rewriting everything over and over again.


This is sad, but at the same time isn't the end of the world, because:

* The transition to 64-bits will take time, so we have some years
still where work can continue with Carbon

* Even then 32-bits carbon apps will keep working normally on 64-bits computers

* Until 64-bits GUIs are really needed we will already have some way
of interfacing with Cocoa, which can be either supporting obj-c
objects on Pascal or procedurizing the Cocoa API
  

And

* Apple might decide to make 64-bit Carbon if enough big players are 
unhappy with the

situation.

If that happens (even if it only happens to the modern Carbon APIs like 
HIView etc)

then all is well and we can go on moving forward.

If it doesn't happen, if Apple insists that Objective-C is the only path 
into 64-bit, then a
third path will be needed, and I think that should be a strict 
cross-platform solution.
That will make the Mac interface diverge more than before, but if Apple 
does not open

better paths it will happen.

At the moment, I would like to see more detailed information about what 
is actually
officially depreciated, what non-ObjC interfaces are actually ported (CG 
for sure,
all low-level Unix stuff etc). There is a great confusion about what 
Carbon really
is. If Apple drops QuickDraw, old Menu Manager and other old APIs, but 
supports
the new APIs, I won't be happy about it but at least the time I spent 
learning the new

ways is not wasted.


/Ingemar

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] How to include Carbon.h?

2007-04-19 Thread Ingemar Ragnemalm



Hello, Pascal folks,

I'm using FPC 2.0.4 on MacOSX 1.4.9 PPC and trying to write a Pascal library
that is externally called from REALbasic (Rb).  But Rb needs Carbon.h header
included in dylibs which are called by Rb programs.

In C, it's easy:

#include Carbon/Carbon.h

Unfortunately, I am not familier to C, so that, I want to write the library
in FPC.  How it can be achieved in FPC? 
Could you give me some suggestions?


I have used CarbonEventsCore.ppu, but found not sufficient enough.  The
application still crashes in certain circumstances.
  


So the Pascal code compiles, links with the RB code, but crashes when it 
runs? How far does it run?


It can't possibly be a problem with calling conventions? Pascal routines 
that you need to call from C need to be declared appropriately, with 
cdecl or MWPascal (which are equivalent, I think). Could that be the 
problem? Then Jonas' suggestion to use {$calling mwpascal} could be 
just what you need. Then your calls will be compiled to use C calling 
conventions.


Another problem when mixing languages is the Pascal RTL. You might need 
to link with that. (That is not necessarily trivial, I am having trouble 
with that myself.) But that doesn't sound like your problem, right?



/Ingemar

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


[fpc-pascal] Pipe buffering, accessing C-style stdin/stdout

2007-04-03 Thread Ingemar Ragnemalm


Sorry for not replying in thread, I get the list as digest so I can't 
reply properly.


  The problem with FPC is that I
  can't find any straightforward way to either get PFile-style
  stdin/stdout from the Text-style input/output (surely there is a
  connection?)

 Yes. PFile _IS_ Text style.  PFile is the C wrapper implementing buffer,
 Text the analogue Pascal buffering.  I assume that settextbuf to 0 
didn't work?


 ( http://www.freepascal.org/docs-html/rtl/system/settextbuf.html )

I have tried that, but nothing good happened. I don't know how to apply
that to Input/Output in a TProcess.

 If that doesn't work, you need to go back to the raw unbuffered IO, do a
 IOCTL if necessary.  FPOpen, FPClose, FPWrite, FPRead

That's what I have been struggling with (apart from TProcess); pipe, fork,
dup, ioctl, read, write. I think I figured out how to access 
stdin/stdout (by

importing __sF and calculating offsets from the size of FILE - not very
portable code) and used that for setvbuf. Can't one get stdin/stdout from
Input/Output? They refer to the same buffers after all. Anyway, it doesn't
seem to matter for my problem.

 TProcess does not do any buffering. What is more, it's up to the called
 application to decide whether it buffers it's output or not, and TProcess
 does not have any control over that.

I had information claiming the contrary, that the caller can use setvbuf
to control the buffering, and then exec to the other program. However, my
attempts to do it are not successful so far, so I think you are quite right.

So I continue with pseudo-terminals. I found that the other day, and that
might help. I spent yesterday working on it and the tests look promising,
it might be the solution, at least for most Unixes.


/Ingemar

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


[fpc-pascal] Pipe buffering, accessing C-style stdin/stdout

2007-04-01 Thread Ingemar Ragnemalm


Dear list,

I have been struggling for quite a while (that is weeks) to get proper 
pipe communication with a sublaunched program, using TProcess or 
straight pipe/fork/exec calls. This is under Mac OSX, but the problem 
should be similar under any Unix.


The problem is the buffering. Using stdio, the data is stalled until the 
stdio buffers are full. This is a big problem. Two-way communication is 
impossible, and the user feedback is delayed.


After a lot of googling and experimenting, I think I have managed to 
make it work, but only in C code, and I want it to run in Pascal. The 
key to make it work in C was to call setvbuf at the right time, to set 
the buffering mode for stdin/stdout. The problem with FPC is that I 
can't find any straightforward way to either get PFile-style 
stdin/stdout from the Text-style input/output (surely there is a 
connection?), or get the C globals.


I have searched through the fpc and Lazarus sources after the 
definitions and possible solutions, tried all ways I can find, but have 
not succeeded yet. But surely someone else has ran into this problem?


Shouldn't simply TProcess have unbuffered or line-buffering as default?


/Ingemar

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal