Re: [fpc-pascal] FP IDE sources
Thanks, Karoly and Marco. I thought "packages" were libraries not applications, as there is an "utils" directory with programs. Thankyou again, Guillermo Martínez. El Wed, 13 Mar 2024 22:45:19 +0100 Marco van de Voort via fpc-pascal escribió: > Op 13-3-2024 om 21:34 schreef Karoly Balogh via fpc-pascal: > > H > > > > Where are they? Why aren't with the official source packages? > > But they are. The IDE code is here: > > https://gitlab.com/freepascal.org/fpc/source/-/tree/main/packages/ide > > > > It also depends on Free Vision, which is here: > > https://gitlab.com/freepascal.org/fpc/source/-/tree/main/packages/fv > > > > The ASCII table code is part of Free Vision, and it's here: > > https://gitlab.com/freepascal.org/fpc/source/-/blob/main/packages/fv/src/asciitab.pas > > > And the mouse-keyboard-video drivers are in package rtl-console, e.g. > for windows > > > https://gitlab.com/freepascal.org/fpc/source/-/tree/main/packages/rtl-console/src/win > > ___ > fpc-pascal maillist - fpc-pascal@lists.freepascal.org > https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
[fpc-pascal] FP IDE sources
Hi Pascaloids, I was looking for the FP IDE sources to check how it renders the ASCII table and manage the mouse input, but I'm not able to find them. They're not in GitLab, not in the source packages, not in the download pages. Lazarus Wiki has two pages "Textmode IDE" and "Textmode IDE development" but none of them have any link or reference of how to find the sources. Where are they? Why aren't with the official source packages? Regards, Guillermo "Ñuño" Martínez ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Nested comments.
El Sun, 21 Jan 2024 17:27:15 +0100 Adriaan van Os via fpc-pascal escribió: > > ($modeswitch nestedcomments-} > I didn't know about this switch. Thanks, maybe I can use it. Guillermo Martínez J. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Nested comments.
El Sun, 21 Jan 2024 17:12:05 +0100 Tomas Hajny via fpc-pascal escribió: > Well, I guess that you use mode Delphi, because warning about nested > comments and even an error in your case (due to nested comment not > closed) is already issued by default. So the very simple solution is > using e.g. -Mobjfpc. ;-) That's it: I'm using Delphi mode because code should work both Delphi and FreePascal. Thanks for the note. Guillermo Martínez J. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
[fpc-pascal] Nested comments.
Hi Pascaloids, I'm wondering if it is possible to make FPC detect and warn (or even stop compillation when) it has detect a nested comment. That's because I'm using Vim and it closes odd comments. For example, the nex code: { This comment isn't closed. *) DoSomething (); { This is a nested comment. } I know this is a silly mistake, but sometimes I comment batchs of codde to deactivate them temporary and when un-comment they're non paired and it result in weird runtime bugs. A command line option that activate that functionality would be great. Something like -wn (because -vn is used for notes). What do you thing? Guillermo "Ñuño" Martínez. Piopio Juegos. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] ShortString still relevant today?
Hi, I'm not sure but I think that CPU caches (L1, L2...) have some impact on this example. Also I think PChar assignation should use string copy instead (Strings.strcopy). Not time to do my own tests right now though u_u) . Regards, Guillermo "Ñuño" Martínez El Tue, 4 Jul 2023 11:46:42 +0700 Hairy Pixels via fpc-pascal escribió: > Here is my test unit I'm playing with. It's crude but can anyone > suggest what other things I could test? > > I'm playing with a string pointer also to see how ref > counting/finalization plays in. Making your own managed typed using > management operators is not tested but I'm sure it will be terrible > compared to everything else. > > * test_short_string time: 143ms > * test_ansi_string time: 115ms > * test_mem_string time: 115ms > > * test_short_string_record time: 165ms > * test_ansi_string_record time: 75ms > * test_mem_string_record time: 47ms > > * test_short_string_mutate time: 203ms > * test_ansi_string_mutate time: 181ms > > === > > {$mode objfpc} > > program string_test; > uses > SysUtils, DateUtils; > > const > ITERATIONS = 1000 * 1000; > TEST_STRING = 'Lorem ipsum dolor sit amet, consectetur adipiscing > elit'; > > type > TTestProc = procedure; > > procedure test_mem_string; > > procedure do_pass(const s: PString; len: Integer); > var > c: Char; > i: Integer; > begin > for i := 0 to len - 1 do > c := s^[i]; > end; > > var > s: PString; > i, len: Integer; > begin > for i := 0 to ITERATIONS - 1 do > begin > len := Length(TEST_STRING); > s := GetMem(len); > s^ := TEST_STRING; > do_pass(s, len); > FreeMem(s); > end; > end; > > procedure test_short_string; > > procedure do_pass(const s: ShortString); > var > c: Char; > i: Integer; > begin > for i := 0 to length(s) - 1 do > c := s[i]; > end; > > var > s: Shortstring; > i: Integer; > begin > for i := 0 to ITERATIONS - 1 do > begin > s := TEST_STRING; > do_pass(s); > end; > end; > > procedure test_ansi_string; > > procedure ansi_string_pass(const s: AnsiString); > var > c: Char; > i: Integer; > begin > for i := 0 to length(s) - 1 do > c := s[i]; > end; > > var > s: AnsiString; > i: Integer; > begin > for i := 0 to ITERATIONS - 1 do > begin > s := TEST_STRING; > ansi_string_pass(s); > end; > end; > > procedure test_ansi_string_mutate; > var > i, j: Integer; > s1, s2: AnsiString; > begin > for i := 0 to ITERATIONS - 1 do > begin > s1 := TEST_STRING; > s2 := s1 + IntToStr(i); > for j := 1 to length(s2) - 1 do > s2[j] := 'x'; > end; > end; > > procedure test_short_string_mutate; > var > i, j: Integer; > s1, s2: ShortString; > begin > for i := 0 to ITERATIONS - 1 do > begin > s1 := TEST_STRING; > s2 := s1 + IntToStr(i); > for j := 1 to length(s2) - 1 do > s2[j] := 'x'; > end; > end; > > procedure test_short_string_record; > > type > TMyRecord = record > a: ShortString; > b: ShortString; > c: ShortString; > end; > > function do_pass(rec: TMyRecord): TMyRecord; > begin > result := rec; > end; > > var > i: Integer; > r: TMyRecord; > begin > for i := 0 to ITERATIONS - 1 do > begin > r.a := TEST_STRING; > r.b := TEST_STRING; > r.c := TEST_STRING; > do_pass(r); > end; > end; > > > procedure test_ansi_string_record; > > type > TMyRecord = record > a: AnsiString; > b: AnsiString; > c: AnsiString; > end; > > function do_pass(rec: TMyRecord): TMyRecord; > begin > result := rec; > end; > > var > i: Integer; > r: TMyRecord; > begin > for i := 0 to ITERATIONS - 1 do > begin > r.a := TEST_STRING; > r.b := TEST_STRING; > r.c := TEST_STRING; > > do_pass(r); > end; > end; > > procedure test_mem_string_record; > > type > TMyRecord = record > a: PString; > b: PString; > c: PString; > end; > > function do_pass(rec: TMyRecord): TMyRecord; > begin > result := rec; > end; > > var > i: Integer; > r: TMyRecord; > len: Integer; > begin > len := Length(TEST_STRING); > > for i := 0 to ITERATIONS - 1 do > begin > r.a := GetMem(len); > r.b := GetMem(len); > r.c := GetMem(len); > > r.a^ := TEST_STRING; > r.b^ := TEST_STRING; > r.c^ := TEST_STRING; > > do_pass(r); > end; > end; > > > procedure run_test(name: String; test: TTestProc); > var > startTime: Double; > begin > startTime := Now; > test; > writeln('* ', name,' time: ', MilliSecondsBetween(Now, StartTime), > 'ms'); end; > > begin > run_test('test_short_string', @test_short_string); > run_test('test_ansi_string', @test_ansi_string); > run_test('test_mem_string', @test_ansi_string); > > run_test('test_short_string_re
Re: [fpc-pascal] SDL2 Event Registration (and case statements)
El Sun, 25 Jun 2023 13:42:00 -0300 Rafael Picanço via fpc-pascal escribió: > Thanks Guilhermo, You welcome. :) > > Just to clarify, I do have a limited number of events. Lets say, 2 > events. So, using the SDL_RegisterEvents function, is it possible to > define these two new events as normal constants so they will be known > at compile time and will make Free Pascal case statements happy? Yes, you can. But be careful that no other events are registered before yours. > > Best, > R Regards, Guillermo Martínez ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] SDL2 Event Registration (and case statements)
Hi. > The SDL2 documentation recommends you to register constants with: > > Uint32 SDL_RegisterEvents(int numevents); >numevents = the number of events to be allocated. >Returns the beginning event number, or (Uint32)-1 if there are not > enough user-defined events left. > > The SDL_RegisterEvents result is not known at compile time, so one > can't use them as case conditions. So, Is there a workaround for > building these constants at compile time? If you know how many events were registered, then you can create constants. Else, you can't. > > Best, > R Guillermo "Ñuño" Martínez ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal