Archives for Freepascal

AGraphics finished. Documentation pending

Posted by ALB42 on 8. September 2013No Comments

The AGraphics unit is finished. And all Circular type calls are solved… I’m a little Bit curious if it is possible in Intuition as well… I noticed there are much more of such problems.
Sadly, because of this change, the Structure and the corresponding Constants are now a little bit far form each other. But I think the right type is much more important, especially when nicely linked in the Docu (As I Did in AmigaOS and little bit in Exec) there is no need to look to the Source.

The FPDoc util can also create the CHM file we need as help for FP-IDE would be nice to add it as context sensitive help. Next Days I will start/continue with AGraphics Documentation. Stay tuned.

I got another idea for better convert C-structs to pascal
for example:

struct XXX
{
  Int abc;
}
#define cde abc

Such things you can find everywhere in AROS includes (because of compatibility with AOS4, MorphOS? MayBe)
There is a functionality that records can act like classes in Delphi compat mode, so this record would look like this in Pascal:

TXXX = record
  abc: Integer;
  property cde: Integer read abc write abc;
end;

Needs to be tested but should work well. The property does not mark an other field so it does not extend the records size (SizeOf should stay the same) just an other Access function is added. This also work into other records for example, maybe even some unions could be replaced with this functionality:

TTextFont = record
  tf_Message: TMessage;
  // .... more fields
  property tf_extension: PMsgPort read tf_Message.mn_ReplyPort write tf_Message.mn_ReplyPort;
end;

Working on (A)Graphics

Posted by ALB42 on 8. September 2013No Comments

Finished work at „AmigaDOS“ unit. also changed the documentation.. some of the functions are not descripted in the official reference. Can add a Description later. I’m still thinking how to „save“ the documentation source files. as archive? as seperate SVN (like fpc is doing) or add it into (but then can not add to official SVN)

Now starting with AGraphics unit. wrapper for graphics.library, there ar esome problems to solve… some cycle type uses.. but I think the most of them I can solve.

BugFix Release

Posted by ALB42 on 2. September 2013No Comments

Again a release, not much changed.
Only a small bug in FP-IDE: Copy to/from AROS only copied 256 Chars. Now it should work also with longer texts. I also will from now on always post the MD5 of the archive file.
I didn’t find a md5 tool for Aros so I wrote one (GenerateMD5) and also set it for download.
it does not compare, just give out the Hash, so you have to compare by eye. Later I will a better one which also can compare from a *.md5 file.

New Release!

Posted by ALB42 on 1. September 2013No Comments

A new Release of Freepascal for AROS is out today:
News:

  • Added function ‚GetToolTypes(Filename)‘ to „Icon“-Unit. To get fast the Tooltype entries from the icon
    of a file. Filename (without .info) must be supplied, Result is an array of string (TToolTypeArray)
  • Complete rework Exec, AmigaDos(not completely finished), Icon, Workbench
  • corrected Date in SearchRecord (FindFirst/FindNext) for example FP-IDE Dialog
  • DebugLn/Debug calls to get DebugOutput to AROS Debug Output (for example Sashimi or with hosted AROS the console it was started from)

Like always the download is available at FPC Page

Pascal mp3 decoder

Posted by ALB42 on 31. August 2013No Comments

I was searching for an mp3 decoder in pascal… seems it does not exists… (or at least not for free to download).

Of course there are many C examples, so I took a very simple C source, I ported it to Pascal, not a very fast source, but hopefully easier to understand.

The port work (even at AROS 😉 ) but is really VERY slow.

New Release (mainly bugfixes)

Posted by ALB42 on 16. August 2013No Comments

After a long time again a little bugfix release of fpc, and first release of clipboard support for aros (there is an example script in the src directory of fp)
The news:

  • lower case filenames for FP-ide
  • better handling of parameter with quotes and empty parameter
  • NewObjectA in intuition with right calling
  • fixed wrong pathes when started from WB and file is in root
  • Bugfixes for Copyfile-routine in fileutil (lcl) and some other fileutil routines
  • Copy to AROS Clipboard, paste from AROS Clipboard added to FP IDE
  • GetTextFromClip and PutTextToClip functions added (as easy function to use clipboard in aros)
  • Iffparse unit added

Download like always on the fpc aros page

Clipboard

Posted by ALB42 on 23. Januar 2013No Comments

Today I cared about the Clipboard in aros, how to get a text from there and how to put a text here.

I should say it was not that difficult, but only because  I had a example source code in C functions toClip and fromCli. But first I had to create an iffparse unit because the informations are saved as IFF in the clipboard. Has the advantage that you can everything what you can transport via IFF format, so pictures, sounds and of course Text.

The first function GetTextFromClip was really simple and worked directly, PutTextToClip in principle the same easy task but it didn’t work always end with error -6 on PushChunks. I compared all calls and variables but all seems to be correct. Then I tried to make copy paste in editor but there it also didn’t work. So Something was wrong with AROS self. After a restart of AROS both routines worked very nice, strange like always.

I will put both routines into Clipboard unit for easy access from fpc programs. Perhaps later also make a version for images.

As first test I added it to the FP IDE, there is already something prepared for windows to get the Clipboard from Windows.

FP IDE with Clipboard support

New Release

Posted by ALB42 on 21. Januar 2013No Comments

Today I bring all together and release. A not complete lists of changes/bugfixes for this realease:

* some basic units moved from arosunits to rtl, also helpful if later joined with amiga and morphos
– amigados, agraphics, exec, inputevent, intuition, layers,
– longarray, pastoc, tagsarray, timer, utility
– IMPORTANT: DELETE UNITS BEFORE INSTALL NEW VERSION TO GET RID OF UNITS IN OLD DIRECTORY
* changed all library calls to cdecl
* Startup and finishing code improved
* FileGetDate/FileSetDate implemented
* GetEnvironmentVariableCount/GetEnvironmentString implemented (example code by magorium)
* Video unit with fullscreen support (color tag = False)
* Keyboard unit rewritten, better identification of keys for fp ide, mousewheel as pgup/pgdwn
* free vision GetDosTicks implemented (needed for double click)
* layers aros unit (thanks to anon and magorium)
* FPGUI:
– MOUSEENTER/MOUSELEAVE implemented
– MOUSEMOVE with mouse grabbing
– KEYRELEASE implemented
– Input focus implemented
– Modal windows, blocking of other windows
– save closing of window (removing of messages from message port)
– combobox closing when a entry is selected repaired (hopefully)

check out https://blog.alb42.de/fpc-aros/ for the last Version

Buggy Bugs and difficult keys

Posted by ALB42 on 15. Januar 2013No Comments

Sometimes when a Button or so is destroyed in runtime the software crashed because in the messageport still some messages for this particular object and I have no chance to see if it is still alive.

First Idea was to poll all messages before destroy this windowthis was implemented when writing the Message for 07.01.2013 in this blog the first error report. But now I noticed sometimes a stack overflow appear when large windows are closed.

When searching for CloseWindowSafely Amiga  you find a lot of source snips which all do the same, remove all messages for this window from the messageport.
for example this
So the StripIntuiMessage is exactly what I need, conversation to Pascal is simple, the problem was it didn’t change the problem. I changed the routine that it counts how many messages are there and how many are removed. So at least it does something. Then I let the routine run twice one after the other so the second should not find a message and the overall should be smaller (because removed messages). I was surprised that the messages are not be removed.. so both runs are identical, I’m not sure whats wrong with my routine it does exactly the same as this C routine. So in the end I wrote a complete new routine, which gets all messages with GetMsg and then put them back with PutMsg when they not belong the removed window. Task done, now its working.

Another task I set for myself was the keybinding for fp-editor, and this is really crap, finally I think it would be easier to make a very big table for all cases, so all keys combinations with shift, alt, ctrl, sounds crazy but this keycodes have no real systematics. The most keys are working already… so menu keys, copy paste and so on, are working also mark text with keys is working, but still need some testing.

Stack me up

Posted by ALB42 on 13. Januar 2013No Comments

When I started to bring FreePascal to AROS I had no idea how this should be especially the startup code was something like magic. The startup codes are mostly in Assembler, I used much i386 and x64 Assembler, even machine code already (created an compiler to machine code). But for this you have to know about the inner system of aros and freepascal and additionally this assembler uses a rather strange syntax AT&T, ok when look right to it the intel syntax is strange… but I’m more used to it.

So I just looked into the different i386 implementations for linux, ppc for amiga and tried to guess how it should look like, in principle it was just a lucky shot. And I was rather surprise that the startup worked, just the finish was nearly impossible, for me this was more or less obvious because I do not know what AROS expect on the stack after the program.

The simple approach was DosExit, a call in dos.library which ends the process directly, but because its such a hard end it leaves some memory leaks open, especially the dos.library stays open (of course it must be open to call this DosExit). The conseqeuence was when calling very often after a while you get some strange effects like „out of memory“ even there are some hundred megabytes free.

Finally I got disturbed by it and try to find a different solution.

First I tried what happen when I just leave the program directly again, seems everything works nicely.. so it seems Aros expect the same stack as started, so more or less its just a CDECL call of „start“ with CommandLine, CommandLineLength and Execbase as arguments. As in the copied startup code of linux I saved the stack pointer called my program restored the stack pointer. Sadly this did not work, on „ret“ it looked like it jumped back into my fpc program and not back to  aros system., so for me it looked like the stack is not at right position. I compared the stack entry by entry, its exactly the saem before and after my routine, so this was not my problem. Of course I didn’t noticed this directly, this would be too easy. First I tried 3 days to debug this situation why my stack could be wrong or destroyed or whatever and thats all without a real debugger and without output (writeln does not work at this position of course). In germany we say  „I was barking at the wrong tree.“

Ok back to problem, I noticed that the stack is completely the same, so what else could it be, of course the other registers. So I added pushad/popad (in AT&T syntax its pushal/popal) and its working I was really surprised about this. It seems that the starting of a program in AROS is really just like call a subroutine… which was not obvious for me because I guessed you get a new process so also get a clean set of registers.

I’m not really sure if I saved now enough… how about SSE registers? FPU registers? until now fpu seems always be empty, sse register difficult to say. Much more interresting will be for x64 if one day I will also bring fpc to there (its my wish) there is no pushal/popal and much registers.

Nevertheless its working now, included in the next release.