Re: [fpc-pascal] "Unexpected end of file" when having an open comment after the final "end."

2024-02-09 Thread Ralf Quint via fpc-pascal

On 2/8/2024 11:01 AM, Martin Wynne via fpc-pascal wrote:

Hi Thomas,

The error is not the file content after "end.".

The error is not having the expected "end;" after "begin".

This works ok:

_

program test;

begin
end;

end.

abc 123

_

Martin. 


This is not a valid Pascal source code to begin with (pun intended)...

The "begin" is the start of the actual Pascal program and by definition, 
that program is terminated by matching that with an "end." That's what 
the code completion in Lazarus for example is adding into a new "simple 
program" project source code.


Just adding a random "end;" should also just yield an error message...

Well, I actually did just tested this and it gives as expected an 
"Error: Syntax error,  "." expected but ";" found. It Doesn't even 
process past the "end." in that case.


What is however interesting is that an open comment, as mention by the 
OP,  immediately after the "end." results in the "Error: unexpected end 
of file" message, however any other addition text past that "end." will 
result in no error message and completing to compile the program 
successfully...


I just tried a couple more things, and it seems it is just the "{" or 
"(*" opening of a comment that is causing the error message, having a 
"//" comment until end of  line after the "end."  will also compile just 
fine



Ralf


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


Re: [fpc-pascal] Floating point question

2024-02-04 Thread Ralf Quint via fpc-pascal

On 2/4/2024 12:32 PM, James Richters via fpc-pascal wrote:


>> Not specifying in a program, specially in a strict programming 
language like Pascal, will always result in implementation depending


>> variations/assumptions.

The problem is, I feel that I DID specify what should be by declaring 
my variable as Extended. And Apparently FPC agrees with me, because it 
DOES work the way I expect, except if I put a .0 in my constant 
terms.This is all just a bug if you put .0 after any integers in an 
expression.I just put a better example that shows how it works 
correctly except if you put a .0


Strangely, upon discovering this, the solution is opposite what I 
thought it should be.If all the terms of an expression were reduced to 
the lowest precision possible without loosing data, then my 1440.0 
would be reduced from a float to a word, and then the entire problem 
would have went away, because when I put in 1440 without the .0, there 
is no problem.The .0 is apparently defining it to be a floating point 
and the smallest floating point is a single… but that’s not the 
smallest data structure, the smallest data structure that can be used 
is a word and that would have solved it.


Sorry, but that doesn't make any sense. If you just add the .0, you 
specify a floating point value, ANY floating point value. This is kind 
of obvious in a programming language that has only one type of floating 
point value (yes, they are less common these days as they used to be in 
the "days of old"). But you did not specify WHICH type of the possibly 
floating point values you are expecting, and there are three different 
ones (single, double, extended). What happens when you assume an 
integer/word/longint by omitting the decimal fraction, that's a 
different discussion.


But I would expect that you you explicitly use a typecast as in 
"extended (1440.0)" that the compiler is using an extended floating 
point calculation at that point. Specifying the resulting variable to be 
a specific type is IMHO not implying that ALL calculations of a whole 
expression are performed in that variable's type. If the compiler would 
ignore an explicit type cast of a constant, THEN I would call this a bug.



Ralf

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


Re: [fpc-pascal] Floating point question

2024-02-04 Thread Ralf Quint via fpc-pascal

On 2/4/2024 11:15 AM, James Richters via fpc-pascal wrote:

I understand that the result depends on the variables and expressions,
The problem with constants used in an expression is that some determination
needs to be made because it's not specified.
Since it's not specified, then I think it should be implied to be the same
as the variable it would be stored in, if that determination cannot be made,
then maximum precision should be used.
I don't think that this "implied" applies in my experience to pretty 
much all programming languages that I have used in the last 47 years 
that do offer various forms of floating point formats.
Not specifying in a program, specially in a strict programming language 
like Pascal, will always result in implementation depending 
variations/assumptions.


And if those variations are not to your liking, then simply specify 
(type cast) those constants to more precisely get the result you expect. 
This is Pascal after all, not Python or other over-ooped programming 
language that is making assumptions about your code all the time...



Ralf

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


Re: [fpc-pascal] Function to create a record ?

2023-06-01 Thread Ralf Quint via fpc-pascal

On 6/1/2023 5:36 PM, Steve Litt via fpc-pascal wrote:

Hi all,

I'm trying to create a function (called newperson()) that creates a new
instance of a record. The following compiles with no errors or warnings
in FPC, but multiple calls to newperson() produce exactly the same
variable, so in the preceding changing person changes person2, and vice
versa:

===
program test2;

const
junkvar_size = 2000;

type
personrecord = record
name: string;
end;
var
person: personrecord;
person2: personrecord;
junkvar: array[1..junkvar_size] of char;

function newperson(): personrecord;
var newp: personrecord;
begin
newp.name := '';
newperson := newp;
end;

function modperson(person: personrecord; name: string): personrecord;
begin
person.name := name;
modperson := person;
end;

procedure writeperson(person: personrecord);
begin
writeln(person.name);
end;

begin
person := newperson();
fillchar(junkvar, junkvar_size, 'a');
person2 := newperson();
fillchar(junkvar, junkvar_size, 'b');
person := modperson(person, 'Martin');
person := modperson(person2, 'Maria');
{writeln(junkvar);}
writeperson(person);
writeperson(person2);
end.
===

What is the best way for me to construct newperson() so that every time
called it would return a new variable?

W.T.F.?

Sorry, but for how long are you programming, in general, and for how 
long in Pascal?


Seriously, you should take some very basic Pascal tutorials, work 
through them, and in particular, pay close attention to the "scope" of 
variables as well as parameter passing. You seem to be completely 
oblivious to those very basics here... :(


Ralf


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


Re: [fpc-pascal] Oberon-0

2023-04-20 Thread Ralf Quint via fpc-pascal

On 4/19/2023 7:46 PM, Adriaan van Os via fpc-pascal wrote:

Ralf Quint via fpc-pascal wrote:


What does Oberon and Forth have to do with the FreePascal compiler? 


1. Niklaus Wirth
2. Strong resemblance between Oberon and Pascal
3. An early version of his book Compiler Construction used Pascal 
rather than Oberon


Well, still, neither one of those IMHO is a valid reason as to why this 
is discussed on a Free Pascal mailing list, beside possibly on 
fpc-other, as suggested.



Ralf


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


Re: [fpc-pascal] Oberon-0

2023-04-19 Thread Ralf Quint via fpc-pascal

On 4/19/2023 1:06 AM, Markus Greim via fpc-pascal wrote:
You are right there are in between many compilers for the Propeller 2 
around.

My idea would be a to have an Oberon system on the Propeller itself.
Developing on the target itself is unbeatable clever.
Is started 35 Years ago with the 8051-AH Basic processor and later on 
similar systems.


The Propeller 2 has already a built in Forth which is already a fine 
thing, but I am sure the Processor is powerful enough to run also a 
full Oberon

in the latest flavor of the RISC5 system.
The Oberon0 compiler would be necessary as bootstrap for a full Oberon 
system.
A native Oberon0 to Propeller ASM compiler would be fine, but maybe it 
would be easier to write first an Oberon0 to PropForth compiler.


What does Oberon and Forth have to do with the FreePascal compiler? 


Ralf

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


Re: [fpc-pascal] Cache-line alignment for records

2023-03-29 Thread Ralf Quint via fpc-pascal

On 3/29/2023 2:38 PM, Ched via fpc-pascal wrote:

Hello,

Ok for the records for internal calculations. But sometimes, records 
are used for reading/writing structured files. Does "packed" in 
"packed array" and "packed record" always forbid the compiler to play 
with alignments ? 


If that record/array is specifically defined as "packed", then yes, of 
course. However, arrays/records that are no so defined should be aligned...



Ralf


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


Re: [fpc-pascal] Converting old pascal written for Pascal/MT+ compiler

2023-03-28 Thread Ralf Quint via fpc-pascal

On 3/28/2023 3:12 AM, Marco van de Voort via fpc-pascal wrote:


On 28-3-2023 11:33, Karoly Balogh via fpc-pascal wrote:


Probably yes, but there might be an alternative, see below. But as 
far as

I understand, Unit is a Turbo Pascal concept, so any Pascal programming
dialect that predates it, probably don't understand it.


True, and before units in Turbo Pascal(*) and Modules in Extended 
Pascal, nothing was standardized about breaking up the source into 
multiple parts.


Most dialects either adopted some form of C "extern" like handling, 
and the more advanced ones some form of Modula2 derived modules, 
either directly, or via the lengthy Extended Pascal standardization 
process.


(*) Turbo Pascal was strictly not a standard, but influential enough 
to set one.


Units was actually something that was taken over from UCSD Pascal, which 
had them for more than a decade before Anders Hejlsberg introduced them 
with Turbo Pascal 4.0. They were omitted from the earlier versions due 
to space constraints on CP/M, then the CP/M versions were translated 
more or less 1:1 from Z80 to 8086 code and they were added when Turbo 
Pascal 4.0 was pretty much rewritten from scratch...



Ralf


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


Re: [fpc-pascal] Converting old pascal written for Pascal/MT+ compiler

2023-03-28 Thread Ralf Quint via fpc-pascal

On 3/27/2023 2:45 AM, Jacob Kroon via fpc-pascal wrote:

Hi,

I have some old Pascal code that was compiled in a CPM environment 
using the Pascal/MT+ compiler from Digital Research. I'm trying to get 
this project to build in a modern environment, for a start using 
FreePascal.


First, is anyone aware of a tool for converting this dialect of Pascal 
to something that FreePascal will accept ?


Well, it is a very long time since I used Pascal MT+ the last time, and 
that was already on the x86 version (+30 years now), but the same things 
should still apply.


First of all, Pascal MT+ is more or less ISO7185 compatible, so you 
would have to use that mode in FPC if you don't want to change all those 
file reference (that's what's mostly different to a "real" Pascal :P )


As for the "external" vars (and possibly procedures/functions), it is 
not quite the same as the units in UCSD/Turbo/Delphi/FreePascal, but it 
had the possibility (due to source code size restrictions, you had only 
64KB for OS, compiler and source code together) to compile different 
source files into separate object files, which then could be linked 
together with the linker. It is more of an "forward" declaration. In 
most cases, I would assume that you could actually copy all those source 
files that are being referenced into a single source file. Using units 
could work in a lot of cases, but which way to go might depend on your 
actual use case...



Ralf



Second, the old code contains a lot of:

var
foobar : external integer;

in sources that reference 'foobar', then there is a declaration in one 
of them:


var
foobar : integer;

As I understand it, in order to translate this to something that 
FreePascal understands, the variable needs to go in a "unit" and be 
part of its interface. Then, pascal sources that needs to reference 
the variable should use this unit. Is this the easiest way forward ?


I thought maybe I instead could adapt the syntax like:

var
foobar : integer; external;

but with this I still get undefined references when linking. Using 
units seems ok.


Bets regards
Jacob
___
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


Re: [fpc-pascal] Working on a new way to educate people about pascal

2022-12-31 Thread Ralf Quint via fpc-pascal

On 12/31/2022 12:37 AM, Steve Litt via fpc-pascal wrote:

Anthony Walter via fpc-pascal said on Thu, 29 Dec 2022 07:31:57 -0500


@youngman

"I'm a database guy with maybe 30 years experience, I'm new to SQL and
oh my god is it an over-complicated monster ..."

I'll say this: It certainly doesn't help that there are different
variations of SQL.

SteveT
Well, that  pretty much en par with any other programming language. 
Beside maybe C (for the most part), there are different variations of 
pretty much every mainstream programming language. Just see how many 
variations you can set in FreePascal to try and match other Pascal 
variations (Delphi, Turbo, ISO)... ;-)


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


Re: [fpc-pascal] Program efficiency

2022-11-15 Thread Ralf Quint via fpc-pascal

On 11/9/2022 6:52 AM, James Richters via fpc-pascal wrote:


Sounds to me that if the compiler will probably insert temp variables 
anyway, then I might as well make my own and make it easier to 
understand later.



+1

Trying to write this without intermediate variables would definitely 
make is less readable and the only case (maybe) where this could 
possibly, and even then likely in limited cases be more efficient, would 
be if you have a CPU architecture with MANY 64bit registers. But even 
64bit ARM gets limited rather quickly and it certainly won't help on 
x86, which is still the vastly dominant CPU architecture out there...



Ralf

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


Re: [fpc-pascal] BoolToStr

2022-08-28 Thread Ralf Quint via fpc-pascal

On 8/28/2022 8:23 AM, James Richters via fpc-pascal wrote:

Running "i:\booltostr.exe "

-1

0

Why true is -1 instead of 1 is beyond me, but anyway, I would consider 
this BoolToInt, not BoolToStr,I want the Strings ‘TRUE’ or ‘FALSE’ as 
indicated in the documentation


Very logical in fact. 0 is NO bit set in any given size of boolean data 
type, -1 means ALL bits set on that same size boolean data type. And a 
check on TRUE or FALSE, can easily be done with checking the sign flag 
of a processor rather than doing actually any bit fiddling (at least on 
those CPUs that I am familiar with).


Ralf

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


Re: [fpc-pascal] string vs char

2021-10-15 Thread Ralf Quint via fpc-pascal

On 10/15/2021 3:16 PM, Ched via fpc-pascal wrote:

Well, well, understand.


OTOH, declaring a string of length 1 is sort of futile -- it uses
two bytes where a plain char declaration takes just one byte.


Not so futile as a string can be empty, not a char ! 


Well, if you don't like it being called "futile, just call it "nonsense" 
instead (in 99.99% of all possible use cases)


Ralf



--
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus

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


Re: [fpc-pascal] FreePascal and MySQL 8.0

2021-09-20 Thread Ralf Quint via fpc-pascal

On 9/20/2021 12:39 AM, antlists via fpc-pascal wrote:

On 20/09/2021 00:12, Ralf Quint via fpc-pascal wrote:

On 9/18/2021 7:33 AM, Terry A. Haimann via fpc-pascal wrote:

I just upgraded to a new laptop and see that MariaDB is using MySQL 8.0
. I also see there is no connector in my Free Pascal install for MySQL
8.0.  I do see that there is an open ticket to create a connector.  Is
there an Alpha or Beta version of the connector available that I can
try?

Thank you for your attention,


To me, this question doesn't make any sense...

Either you have MariaDB or you have MySQL. "MariaDB is using MySQL 
8.0" seems utter nonsense.


What he probably meant is "MariaDB is using the MySQL 8.0 connector" 
which DOES make sense. 


Well, then it helps if he would write exactly that.

In general, in programming you need to write exactly what you intend to 
do, neither readers nor compilers/libraries can make wild guesses as to 
what your intentions might be otherwise...


Ralf



--
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus

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


Re: [fpc-pascal] FreePascal and MySQL 8.0

2021-09-19 Thread Ralf Quint via fpc-pascal

On 9/18/2021 7:33 AM, Terry A. Haimann via fpc-pascal wrote:

I just upgraded to a new laptop and see that MariaDB is using MySQL 8.0
. I also see there is no connector in my Free Pascal install for MySQL
8.0.  I do see that there is an open ticket to create a connector.  Is
there an Alpha or Beta version of the connector available that I can
try?

Thank you for your attention,


To me, this question doesn't make any sense...

Either you have MariaDB or you have MySQL. "MariaDB is using MySQL 8.0" 
seems utter nonsense.


Beside that MySQL 8 is around for 3 1/2 years now (April 2018)...

Ralf


--
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus

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


Re: [fpc-pascal] Hello, new Pascal programmer. had a question!

2021-08-31 Thread Ralf Quint via fpc-pascal

On 8/31/2021 10:40 AM, joseph turco via fpc-pascal wrote:

I guess I should just use lazarus and learn the GUI Tools.


Using Lazarus doesn't mean you HAVE TO write GUI programs. Just use it 
as an IDE. And by and large, any book/resource about Object 
Pascal/Delphi will do just fine to learn the basics of FreePascal...


Ralf



--
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus

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


Re: [fpc-pascal] How does FPC perform in the FASTEST Computer Language Race

2021-07-11 Thread Ralf Quint via fpc-pascal

On 7/10/2021 10:20 AM, Ryan Joseph via fpc-pascal wrote:


I guess that video is totally false or I'm missing something


There is no easier way to cheat than using benchmarks... ;-)

Ralf



--
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus

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


[fpc-pascal] 50 years of Pascal, by the the author himself

2021-05-12 Thread Ralf Quint via fpc-pascal
Thought this was kind of interesting, though it leaves short of 
mentioning the later Object Pascal evolution and thus Delphi and 
FreePascal...


https://cacm.acm.org/magazines/2021/3/250705-50-years-of-pascal/fulltext


Ralf



--
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus

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


Re: [fpc-pascal] Traits Proposal

2021-02-16 Thread Ralf Quint via fpc-pascal

On 2/16/2021 10:48 AM, Sven Barth via fpc-pascal wrote:
Ryan Joseph via fpc-pascal > schrieb am Di., 16. Feb. 
2021, 19:21:


>
> There we have:
>
> * slower creation of the class, because each implemented
interface adds another VMT reference to the class which needs to
be initialized.

How bad is this? We need to make a test case we can profile. For
example if you have a game that creates 1000 classes 60 frames per
second. If adding interfaces to the classes hurts this process we
may have a deal breaker.


If you need to create 1000 class instances each frame then you have a 
flaw in your logic in my opinion.


Yup, that would be a deal breaker right from the get go...

Ralf




--
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Value:x:y syntax

2021-02-10 Thread Ralf Quint via fpc-pascal

On 2/9/2021 7:26 AM, Luis Henrique via fpc-pascal wrote:



I guess one can call it optional formatting specifiers.  See documentation: 
https://www.freepascal.org/docs-html/rtl/system/str.html

I think I was lazy and didn't look in the right place, thanks Michael and 
Christo.


This is standard Pascal real number formatting since at least the mid 
'70s...


Ralf



--
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus

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


Re: [fpc-pascal] Selecting Records with a variable

2020-12-20 Thread Ralf Quint via fpc-pascal

On 12/20/2020 7:11 AM, Luca Olivetti via fpc-pascal wrote:


Then change your data model.

Instead of

Axis_record = record
  X,Y,Z,A,B,C    : Double;
End;

use

AxisName = (X,Y,Z,A,B,C);
Axis_record = array[AxisName] of double;

then it's easy to do what you want.

procedure DoSomething(var Axis:Axis_record; const which:AxisName);
begin
  Axis[which]:=Axis[which]/2;
end;

Bye


+1

I think this is a typical example where properly thinking about a 
solution for a programming issue BEFORE going with what seems as the 
logical choice at first glance leads to a much simpler solution without 
coming up with all kinds of fancy workarounds...


Ralf



--
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus

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


Re: [fpc-pascal] basic question on begin, end;

2020-09-23 Thread Ralf Quint via fpc-pascal

On 9/22/2020 5:46 AM, dano none via fpc-pascal wrote:

I have a basic shuffle routine. I put being, end statements in the outer loop 
for clarification.
It ended up producing random results.
Commenting out the begin, end combination allows the code to run as expected.
My code is below, can someone tell me if the begin, end combination should 
actually make a difference, or should they be more ornamental in function?


Well, in that code snippet, you have commented out one begin statement 
and two end statements in a nested comment. As Bart already mentioned, 
having the first for loop's statements enclosed with a begin/end does 
not make any functional difference, unless you have somehow unbalanced 
pairs of begin/end (outside of that code snippet).


Most of the time, this will result in the code not even compiling or 
throwing some warnings but there can be cases where it accidentally 
changes the flow of the code. Similar like moving code blocks around in 
Python with a one-off indentation and all the sudden the flow of that 
code changes, without complaining...


What editor do you use to write your code? If you are using the Lazarus 
IDE for example, it show show you/highlight the matching pairs of 
begin/end and could help to find some stray begins or ends in your code...


Ralf


Thanks!

{Let's Shuffle Col1  - routine from: 
https://www.theproblemsite.com/reference/science/technology/programming/randomizing-an-array
 }
my_base := 0;
for i:= 0 to 4 do  { Column we are currently working on }
 {  begin }
  for j:= 0 to 90 do { 20 swaps on the working column }
 begin
index1 := RandomRange(my_base,my_base+14);   { a random # = 
length of the array }
index2 := RandomRange(my_base,my_base+14);
writeln('index1 ', index1,' ', 'index2 ', index2);
while (index1 = index2) do
begin
   index2 := RandomRange(my_base,my_base+14); { avoid swaping 
on the same square }
   writeln('index2 trap ',index2);
end;
my_temp := shuffle_array[i,index1]; { store position to get 
a random value }
shuffle_array[i,index1] := shuffle_array[i,index2];
shuffle_array[i,index2] := my_temp;
writeln(shuffle_array[i,index1],'  ',shuffle_array[i,index2]);

{ ok... Index isn't a valid row.. }
 end;
 my_base := my_base + 15;
 writeln('current base ',my_base:2);
 ch := ReadKey;
 {  end;  { end i = column indexer }}



--
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus

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


Re: [fpc-pascal] Killing the mail list

2020-03-15 Thread Ralf Quint via fpc-pascal

On 3/15/2020 6:55 AM, Ryan Joseph via fpc-pascal wrote:

It's 2020 and the mail list is starting to really show its age. I don't get 
first messages from gmail and my personal web host is whitelisted, messages 
bounce when I use the wrong account by accident, hard to search the archives, 
can't post images and code easily (big problem!), messages gets lost or 
un-threaded when subjects are incorrect, and the list goes on (pun not 
intended).

Has there ever been any discussion into replacing it with a modern web based 
forum? I don't know how to manage this migration but it should be a goal for 
the future in my opinion.

Personally I really like the format used in forum.sublimetext.com which is from 
www.discourse.org.

Completely irrelevant what year it is, I much rather prefer the mailing 
list over a forum. The main reason is simply that the mailing list is 
"non interactive", meaning my email client gets the new posts 
automatically and puts them in a suitable subfolder, where I can read 
and react to them at my leisure, I am not required to actively check if 
there is something new or a reply to an existing thread I am interested in.


A lot of issues that you mention can happen on a forum as well, so that 
is no argument. There are a lot of forums that in fact restrict the 
posting of images and other forms of attachments, simply to ward off the 
never ending endeavors of spam/malware spewing miscreants...


Ralf


--
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus

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


Re: [fpc-pascal] Add API to official documentation search

2019-11-17 Thread Ralf Quint via fpc-pascal

On 11/17/2019 2:41 PM, Graeme Geldenhuys wrote:

On 17/11/2019 10:31 pm, Michael Van Canneyt wrote:

Stated purpose was special handling in the Bing search engine.

Either way, that's a pie in the face for Embarcadero. :-)

They might rather get a chuckle out of it, after all, it is Bing. And as 
you should know, friends don't let friends use Bing! :P


Ralf ;-)

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


Re: [fpc-pascal] FPC docs about FindFirst

2019-09-24 Thread Ralf Quint

On 9/24/2019 12:24 AM, Marco van de Voort wrote:

Op 2019-09-24 om 03:03 schreef Ralf Quint:
systutils, so having documentation that includes the differences 
between the versions would be helpful.


Turbo Pascal (for DOS) didn't have a FindClose function, as 
"officially", this would not be necessary on DOS. On all other OS, 
including Windows, for many, many years (I first stumbled about 
missing "FindClose" call in OS/2 some time in the early '90s) and got 
used to *alway**s* terminate a file search with it, even if it is in 
the case of DOS just a dummy routine that just returns without doing 
nothing. Saves a lot of headaches trying to find the source of 
apparent memory leaks in larger applications that do a lot of of file 
searches...



Note that afaik Long File Name supporting versions of the Dos unit 
with Turbo Pascal did have findclose, as afaik the LFN apis required 
it too.
___ 


I don't recall that there was a "DOS" unit in Turbo Pascal that was LFN 
aware, at least not as part of an official Borland distribution up to 
Borland Pascal Professional 7.01, the last version that I bought way 
back then. I just checked the Reference Manual... ;-)


I have personally never cared about LFN in pure DOS, don't know if it 
was maybe part of Borland Pascal for Windows or in Delphi 1.02, but I 
think FindClose was part of Delphi 3, which I didn't buy until I moved 
to the US and then used on Windows 95 and NT 4. Checking RBIL states 
that FindClose is an INT21h function required for Long Filenames 
(AX=71A1h) but "this function is only available when IFSMgr is running, 
not under bare MS-DOS 7"


I now remember that I stumbled across the FindClose issue when running a 
BP7 program in an OS/2 DOS box, rather than true OS/2 program. And that 
I found the reason/solution in a Beta (alpha?) version of Metrowerks 
Codewarrior for OS/2, which I had access to for a while (to bad that 
that never got officially released, it would have given Borland a run 
for their money)...



---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus

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


Re: [fpc-pascal] FPC docs about FindFirst

2019-09-23 Thread Ralf Quint

On 9/23/2019 3:53 PM, James Richters wrote:

I have ported Turbo Pascal code but then use Sysutils instead of DOS,  my 
intention was to convert it to a windows console application that used windows 
features, and I had no interest in maintaining Turbo Pascal backward 
compatibility, and the use of findfirst, findnext, etc, was part of the code 
that never changed.  I actually was not aware that there even was a command 
called findclose, and I never did it in Turbo Pascal.. it IS in there now, and 
I believe it was a discussion on this list that prompted me to add it.   
Anyway, just wanted to say, there are reasons to want to port Turbo Pascal code 
and then switch over to systutils, so having documentation that includes the 
differences between the versions would be helpful.


Turbo Pascal (for DOS) didn't have a FindClose function, as 
"officially", this would not be necessary on DOS. On all other OS, 
including Windows, for many, many years (I first stumbled about missing 
"FindClose" call in OS/2 some time in the early '90s) and got used to 
*alway**s* terminate a file search with it, even if it is in the case of 
DOS just a dummy routine that just returns without doing nothing. Saves 
a lot of headaches trying to find the source of apparent memory leaks in 
larger applications that do a lot of of file searches...


Ralf



---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Illegal counter variable?

2019-09-10 Thread Ralf Quint

On 9/10/2019 4:26 PM, wkitt...@windstream.net wrote:

On 9/9/19 10:11 AM, James Richters wrote:

Pascal doesn't have things like step...


hunh??? i don't think that's right but i'm just catching up after 
several 10+ hours days of $job...


i know that i've written code in the past that did use something to 
step X numbers per run through the look and it did not involved 
manually incrementing the loop var...



I am not aware of any Pascal implementation that does have a STEP 
parameter for FOR loops, and I am programming in Pascal at least as long 
as you... ;-)


The closest would be the FOR..IN variant, which works in Delphi (D2006? 
and later) and is AFAIK supported in FPC by now. But that would be 
iterating over a set, not increment an integer/cardinal variable in an 
increment other than 1...


Ralf

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


Re: [fpc-pascal] Implementation of variant records

2019-07-06 Thread Ralf Quint

On 7/6/2019 12:21 PM, Florian Klaempfl wrote:

Am 05.07.2019 um 13:53 schrieb Ralf Quint:

Shouldn't a PACKED Record guarantee that values are aligned at the byte
level?

It does in TP, but the ISO says only that it shall be economised.

Well, the ISO is probably what has done most of the damage to Pascal. 
AFAIK, the ISO doesn't not actually specify any "packed record" per se, 
but there is an explicit PACK and UNPACK procedures to more economically 
store sets and arrays (and possibly records, I would have to look up the 
ISO text to be certain). For example this would be something to create 
bit fields, pretty much the only feature of C that I sometimes miss in 
(Free)Pascal.


For me, the use of packed records is a feature that facilitates the easy 
exchange of stored data between architectures, something that a lot of 
people these days with their mania about 64bit this and 64bit that are 
often forgetting or chose to ignore...


Ralf


---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus

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


Re: [fpc-pascal] Implementation of variant records

2019-07-05 Thread Ralf Quint

On 7/5/2019 5:07 AM, Marco van de Voort wrote:

Op 2019-07-05 om 13:53 schreef Ralf Quint:


IMO, the variants in a variant record should always overlay 
correctly (like unions in C),
so the variant part should start at offset 32 in this case, and 
this is where all three

variants should start.


This is not a guarantee case in the Pascal language, afaik many old 
compilers don't even try, but make fields sequential.


As soon as you have expections of overlaying, you are dialect and 
architecture specific. 


Shouldn't a PACKED Record guarantee that values are aligned at the 
byte level?



In Borland and x86 pascals in general that is somewhat the norm.

But the original Pascal architecture was not byte, but word 
addressable, and "packed' there meant packing several fields into one 
word.  Access to packed fields meant loading the word, and shifting 
the values out.


From https://en.wikipedia.org/wiki/CDC_6600

---

The central processor had 60-bit 
<https://en.wikipedia.org/wiki/60-bit> words, while the peripheral 
processors had 12-bit <https://en.wikipedia.org/wiki/12-bit> words. 
CDC used the term "byte" to refer to 12-bit entities used by 
peripheral processors; characters were 6-bit, and central processor 
instructions were either 15 bits, or 30 bits with a signed 18-bit 
address field, the latter allowing for a directly addressable memory 
space of 128K words of central memory (converted to modern terms, with 
8-bit bytes, this is 0.94 MB).




Strings that were packed had 10 6-bit chars in a word etc. But for 
some array operations, operating on unpacked data (IOW one element per 
word) was easier. There were standard procedures (builtins?) PACK and 
UNPACK to convert between packed and unpacked arrays/records.


Packing was explicit and was meant as a generalized solution to 
counter the memory waste of such schemes (since one 6-bit char/60bits 
word is quite wastful), not to govern the memory layout precisely, 
that was architecture/implementation dependent. The architectures 
varied to wildly for that.


Other, newer, processors were less funky, but sometimes still had 
limitations. I can still remember the initial powerpc port having a 
problem on some (603) processors that couldn't load floating point 
values from unaligned addresses. (lfd/stfd or so)


And of course Alpha (older multias only?) that had exceptions on 
unaligned access iirc. 


That's rather odd. I have done a lot of data conversion between 
different architectures, always using Pascal, and can't recall where an 
explicit "packed" record element was not aligned at a byte level, and 
this was IIRC introduced with UCSD Pascal, which was based  on a 16bit 
p-code machine, regardless of the underlying CPU, so your CDC reference 
doesn't directly apply.


And the concept of a "packed record" (as coming from UCSD Pascal) should 
be different from the explicit PACK/UNPACK from ISO7165, which can also 
be applied arrays and sets, which I think is what you are likely 
referring to...


The only time I had to deal with PACK/UNPACK was on some HP (fka Compaq 
fka DEC) Pascal for (Open)VMS, and a packed record would work on a byte 
level, unless sets smaller than a byte where used, with the whole record 
then padded in memory (but not on storage) to the necessary 
alignment/register width.


Can't find my old Metrowerks CodeWarrior manuals right now, that is the 
only time I have worked with a (non-UCSD) Pascal on a PPC (and 68k) 
processor to check what how that was defined in there...


Ralf


---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus

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


Re: [fpc-pascal] Implementation of variant records

2019-07-05 Thread Ralf Quint

On 7/5/2019 3:27 AM, Marco van de Voort wrote:


Op 2019-07-05 om 11:49 schreef Bernd Oppolzer:


IMO, the variants in a variant record should always overlay correctly 
(like unions in C),
so the variant part should start at offset 32 in this case, and this 
is where all three

variants should start.


This is not a guarantee case in the Pascal language, afaik many old 
compilers don't even try, but make fields sequential.


As soon as you have expections of overlaying, you are dialect and 
architecture specific. 


Shouldn't a PACKED Record guarantee that values are aligned at the byte 
level?


Ralf


---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus

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


Re: [fpc-pascal] The keyboard unit

2019-05-10 Thread Ralf Quint

On 5/10/2019 4:42 PM, Kevin Lyda wrote:

If I remove the uses clause it runs fine.  Why is the keyboard unit,
which isn't even being used, causing this error?

Kevin


Well, when I got home a short while ago, I tried that small test program 
on one of my Linux workstations and it runs just fine...


FPC 3.04 as installed with Lazarus 2.02 (ok, installed the 3 .deb 
packages for fpc, fpc-source and lazarus 2.02 from the lazarus 
SourceForge repo), compiled and running on Linux Mint 19.2/64, tried 
both Cinnamon and Mate, on two different hosts...


Ralf


---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus

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

Re: [fpc-pascal] The keyboard unit

2019-05-10 Thread Ralf Quint

On 5/10/2019 4:42 PM, Kevin Lyda wrote:

When I compile and run this small test program (
https://gist.github.com/lyda/2d33a6d91067e9dffb4ed37147b52583 ) the
following happens:

% fpc test.pas
Free Pascal Compiler version 3.0.4+dfsg-22~bpo9+2 [2019/02/22] for x86_64
Copyright (c) 1993-2017 by Florian Klaempfl and others
Target OS: Linux for x86-64
Compiling test.pas
Linking test
/usr/bin/ld.bfd: warning: link.res contains output sections; did you forget -T?
7 lines compiled, 0.1 sec

% ./test
Runtime error 106 at $0042968D
   $0042968D
   $0040018C

If I remove the uses clause it runs fine.  Why is the keyboard unit,
which isn't even being used, causing this error?

Kevin

Away from any computer with FreePascal installed, but could it be that 
this is a non-Linux aware unit which does something DOS-specific (as you 
select TP mode), which of course doesn't work under Linux...


Ralf


---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus

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

Re: [fpc-pascal] Lazarus Release 2.0.2 - suggestions

2019-04-16 Thread Ralf Quint

On 4/16/2019 1:11 PM, Martin Frb wrote:

On 16/04/2019 22:03, Ralf Quint wrote:


Schwachfug. (Bollocks for the Anglophiles around here)

And for those with American English: B*S*

But I really dont see where to put 2nd, let alone a 3rd  50 inch 
screen. ;) ;) ;)


Showoff! :P

Ralf ;-)

PS: Seriously, I rather buy 2 (or 3) smaller 24" or 27" monitors than 
one 50". Maximizing any window on such a big screen (even if it would 
support a pixel resolution that would be the same as 2-3 smaller 
screens) is still a HUGE downside, beside the mere cost...




---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus

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

Re: [fpc-pascal] Lazarus Release 2.0.2 - suggestions

2019-04-16 Thread Ralf Quint

On 4/16/2019 11:44 AM, Mattias Gaertner via fpc-pascal wrote:

On Tue, 16 Apr 2019 11:37:56 -0700
Ralf Quint  wrote:


[...]
Anyone who seriously develops software, specially desktop
applications, is/should be using at least two (better 3 monitors).
And the "many" different windows allow easily to spread those out to
those various screens as needed. One screen has the source code and
associated windows, the second one the debugging windows, and the
third one has the actually tested application screen.

It is not a fixed docking. You can undock any window and place them on
other screens. Or dock only some and place them on another screen.


Have yet to see this work. I always ran into the problem that I needed 
to change the overall graphics driver setting to "full screen" a window 
over more than just the active monitor. Which is kind of pointless for 
most work with multi-screen setups. I will test this on this latest 
Lazarus version sometime later today on one of my secondary PCs.


But I still think that this should not be the default setting...

Ralf


---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus

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

Re: [fpc-pascal] Lazarus Release 2.0.2 - suggestions

2019-04-16 Thread Ralf Quint

On 4/16/2019 11:49 AM, Rainer Stratmann wrote:

On Dienstag, 16. April 2019 11:37:56 CEST Ralf Quint wrote:

On 4/16/2019 4:46 AM, Rainer Stratmann wrote:
Anyone who seriously develops software, specially desktop applications,
is/should be using at least two (better 3 monitors).

That is completely new for me that the amount of monitors is an indication of
how professional someone can write good software.


And the "many"
different windows allow easily to spread those out to those various
screens as needed. One screen has the source code and associated
windows, the second one the debugging windows, and the third one has the
actually tested application screen.

For you that may makes sense.
But for me that seems like pretending who has the biggest car.


Schwachfug. (Bollocks for the Anglophiles around here)

It's just a very efficient way to work, as you don't have two switch 
back and forth between hidden/overlapped windows. A two screen solution 
was even available back in the good old days of DOS, when you ran your 
application on color (xGA) screen and your debugging and source 
window(s) on an additional monchrome (Hercules/MDA) monitor. One of the 
reasons why the Borland IDEs where lightyears ahead of Microsoft and the 
other guys.


And this not only is an efficient way to program, but also for other, 
everyday work. A lot of my clients, once they have used a 2-screen setup 
would never go back to a single screen and dread when they have to work 
off a single screen laptop (or tablet) for example.


Ralf


---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus

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

Re: [fpc-pascal] Lazarus Release 2.0.2 - suggestions

2019-04-16 Thread Ralf Quint

On 4/16/2019 4:46 AM, Rainer Stratmann wrote:

Are there plans to merge some windows?

Like here (best solution):
https://cdn.portableapps.com/GeanyPortable.png

Because I think it is no more up to date.
I don't know any other Software that uses so many windows across the whole
desktop. It would be more userfriendly to merge at least the main window with
the code window. So that on top of the code window there are the buttons of
the main window. Also the output window could be one tab of the search window.


I seriously hope that this NEVER becomes a default setting for Lazarus.

Anyone who seriously develops software, specially desktop applications, 
is/should be using at least two (better 3 monitors). And the "many" 
different windows allow easily to spread those out to those various 
screens as needed. One screen has the source code and associated 
windows, the second one the debugging windows, and the third one has the 
actually tested application screen.


Something like this would be a major PITA with those stupid docked 
windows. That's only something that makes sense for someone who's 
tinkering along on a laptop or such...


Ralf


---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus

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

Re: [fpc-pascal] Can FPC optimize: if (s[i]='a') or ...

2019-04-13 Thread Ralf Quint

On 4/13/2019 12:30 PM, Alexey Tor. wrote:
E.g. i have a loop which test each s[i] char for several cases: 'a', 
'b', 'c'.


for i:= 1 to length(s) do

if (s[i]='a') or (s[i]='b') or (s[i]='c') then ...

Can FPC optimize it so it only reads s[i] once (to register), not 3 
times?



How about writing it in Pascal, something like

if s[i] in ['a'..'c'] then

or in case of no-sequential characters/values

if s[i] in ['a', 'b', 'c'] then...


Ralf


---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus

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

Re: [fpc-pascal] Need Advice: Teaching a Child Programming

2019-03-06 Thread Ralf Quint

On 3/6/2019 8:06 AM, Anthony Walter wrote:

I need some advice from you guys.

I might soon be teaching a child about computer programming and am 
considering using Free Pascal as the first language. The problem is 
the child is a distance away from me and I want a way to see his code 
as he types and help him along by moving his cursor and sending him 
snippets or correcting his code while he watches, all done remotely 
along with two way voice chat.


I need some sort of tool to help with this. I could simply use Skype 
and set him up to allow me to occasionally take control remotely, but 
I am wondering if there might be a better way?


What do you people think?

I was considering writing a small cross platform desktop text editor 
type application that would forward to me the text and cursor location 
as he types, and allow me to change his text and highlight text and 
move the cursor. That wouldn't be very difficult, but I would need a 
separate program for VOIP, and I also might want syntax highlighting, 
code completion drop downs, compile functions.


Again, do you people have any suggestions?


If you're doing this with Windows on both sides, you can use AeroAdmin 
(https://www.aeroadmin.com/en/) to remotely see (and even assist) his 
remote screen. I use this as a remote support tool...


You still would have to use Skype for the voice communication though, 
but that can run just in the background.


Ralf


---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus

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

Re: [fpc-pascal] AVR GetMem/AllocMem

2019-01-26 Thread Ralf Quint

On 1/26/2019 1:29 AM, Dimitrios Chr. Ioannidis via fpc-pascal wrote:

Hi,

  AFAIU dynamic allocation memory does not exist for AVR platform ( 
tried to use AllocMem, GetMem and the mcu restart it's self. ) .


Is there any other way to dynamically allocate memory in AVR ? 


I have not used any AVR with FPC (I hope to do so on the next project 
that comes along), but the general problem is that you have extremely 
limited amount of RAM on those micro controller chips. The popular ones 
used on the Arduino Uno and Leonardo, just as an example, do have only 
2KB and 2.5KB of RAM to work with. So it is very unwise to rely on any 
form of dynamic memory allocation. There is just no guarantee that there 
is enough RAM for such operations available. It simply requires a 
different mindset and a lot of planning ahead, more than on pretty much 
any other platform these days...


Ralf


---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus

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

Re: [fpc-pascal] FPC code to migrate Outlook PST file to MBOX format?

2019-01-13 Thread Ralf Quint

On 1/12/2019 4:26 AM, EsmeKael wrote:

Try this pst to mbox conversion tool for further information please visit :-
http://www.toolsbaer.com/pst-to-mbox-conversion/


Why is this repeated posting of advertising, that in no way answers the 
question of this thread, still allowed?


Ralf


---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus

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

Re: [fpc-pascal] Windows programming tutorials for FPC

2018-11-03 Thread Ralf Quint

On 11/3/2018 1:20 PM, James wrote:


>And you can't just pop up a dialog window without having a 
window/form in the first place.


That’s probably my problem…  My idea of just calling up the 
windows-API to get the save-as dialog probably won’t work without a 
form, even though I was able to get message boxes working



>In general, the logic of a GUI based program (regardless if Windows, 
macOS, Linux, etc) simply is different from a console program. Your 
console program main loop simply  pretty much just becomes a procedure 
within the GUI main loop.


This logic difference is what is most confusing to me.   I just don’t 
know where to put my main program and I don’t know how to output 
things to some kind of text box.   I don’t want the user to do 
anything at all unless it’s necessary… so if everything is set up 
correctly, the program opens, does it’s thing, writes some status 
stuff to a text box and closes,  no buttons to push or anything…. If I 
get a GUI program to work, I guess I can put a percentage complete 
barograph somewhere. If there’s an error, I need to stop and wait for 
acknowledgement of the error, or if the output file was not specified, 
I want the Save-As box to just open up on it’s own with out anyone 
pushing any buttons, and when the save-as box is closed the process 
completes on it’s own and the program exits without any further user 
intervention.


I had that problem many years ago as well, having literally written 
hundreds of console of TUI based programs, mainly on DOS, myself. And 
then switching some of them to a GUI program in Delphi (there was no 
Lazarus at that time) took quite a bit of rethinking of  a couple of 
decades habits in console/command line ways or even self written TUI 
programs.


I’ve been tinkering with Lazarus, and I managed to get a form with 
some buttons based on the examples, and I did make one button open the 
save-as box… but I’m clueless on how to make the save-as box only come 
up when needed and by a programming command, not because someone 
pushed a button.  I still can’t figure out how to write my writeln’s 
into a text box of some sort.    I get the idea… instead of a 
sequential program the executes from beginning to end,  everything 
kind of all happens at the same time



Yup, all the windows (as in GUI) stuff happens all the time, at the same 
time as your actual program. I have no had a program myself where I had 
a dialog "come up out of the blue" (as you kind of describe it), but I 
have written a lot of data conversion programs that at some point 
required to open up an additional open or save dialog. A lot though 
depends on what the actual logic behind the actual processing of your 
console program is. A lot of times, it might take a bit of re-organizing.
I am a bit short of time, as I am dealing on and off all day with some 
CERT stuff, but I will see that I take a closer look at that program 
(snippet?) that you posted later today or tomorrow morning and return a 
rough sample of a GUI "solution" for it...


Ralf




---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Windows programming tutorials for FPC

2018-11-03 Thread Ralf Quint

On 11/3/2018 7:00 AM, James wrote:


That is correct, I have only ever done console programming, but now I 
find I'm lost trying to do any kind of GUI programming.    I have a 
very simple program that works as a console application, but what I 
would like to do is have it use the Windows "Save AS' Dialog to allow 
the user to save the file using the windows GUI interface, so the user 
can navigate through directory structures and save the file.


I looked at a few tutorials and see how to make a form and put some 
buttons on it, but I'm still trying to figure out how to get the 
save-as box to come up and how to then use the given file name and 
path in the program for the actual write operation..  Here’s my 
console program.. it’s pretty simple, but I really don’t know where to 
even start to convert it into a GUI program.  On line 51, if the 
output file has not been defined yet, I want to launch the save-as 
dialog, then on line 54, assign whatever save-as returns to my 
OutputFileName Variable.


The main thing to keep in mind that the main program loop in a GUI 
program is to handle all the (internal) GUI stuff, not your console 
program loop. A RAD tool like Lazarus, will conveniently handle that for 
you.


And you can't just pop up a dialog window without having a window/form 
in the first place.


In general, the logic of a GUI based program (regardless if Windows, 
macOS, Linux, etc) simply is different from a console program. Your 
console program main loop simply  pretty much just becomes a procedure 
within the GUI main loop.


Ralf



---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Syntax changes suggestions

2018-07-16 Thread Ralf Quint

On 7/16/2018 8:36 AM, Anthony Walter wrote:

To the OP:

For the sake of brevity, my vote is simply "no" to all your suggestions.

+1



---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Coercing record fields together

2018-07-09 Thread Ralf Quint

On 7/9/2018 9:22 AM, Ryan Joseph wrote:

Could I do some RTL magic on a record to loop over its fields and set them to 
another record by name? In the example below I want to set all the fields in 
TRecA to matching named fields in TRecB. Just curious if we can do this 
automatically using RTL.

type
TRecA = record
a: string;
b: string;
end;

type
TRecB = record
a: string;
b: string;
c: integer;
d: integer;
end;


for field in recA.GetFields do
recB.GetFieldByName(field.name).value := field.value

If you make sure that any variable of tRecB is declared first, you can use

Var RecB : tRecB;
   RecA : tRedA ABSOLUTE RecB;

Quite obviously, it doesn't work the other way around as tRecB is larger 
than tRecA...


Ralf

---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus

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

Re: [fpc-pascal] Loss of precision when using math.Max()

2018-07-03 Thread Ralf Quint
On 7/3/2018 10:41 AM, Martok wrote:
>>> If you compile with range checks on, you get a runtime error.
>> why are so many folks NOT developing with all the checks (range, heap, 
>> stack, 
>> etc) turned ON and then turning them off for production builds???
> Actually, while we're at it - it seems to me that for FPC, "all runtime checks
> enabled" is the "defined" way to use the language, and disabling them is more 
> of
> an optimization that the programmer may choose?
> In books about TP and Delphi, it is usually presented the other way around, 
> the
> checks being a debugging tool for edge cases and not essential.
>
> If so, that'd explain some of the issues people have.
>
Exactly, Pascal by and large assumes that you develop with all checks
enabled. Which is something that people also should do in other
languages, like C, which do have those options. However, too many people
just turn all the checks off, because they feel bothered by the all
warnings that the compiler gives them where they are programming in a
very ambiguous and possibly dangerous way.

Speed kills...

Ralf


---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus

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

Re: [fpc-pascal] Loss of precision when using math.Max()

2018-07-03 Thread Ralf Quint
On 7/3/2018 10:33 AM, wkitt...@windstream.net wrote:
> On 07/03/2018 12:41 PM, Ralf Quint wrote:
>> And no "new language" can absolve the programmer from properly doing
>> their
>> work. Everything else is just a quick hack, not a properly designed
>> program...
>
>
> Welcome Back, Ralf!  we've missed you O:) O:) O:) 
Thanks, Mark, well, I have always been here (as in FreePascal), it was
just "the other place" where I had to take a prolonged time off... ;-)

Ralf

---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus

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

Re: [fpc-pascal] Loss of precision when using math.Max()

2018-07-03 Thread Ralf Quint
On 7/3/2018 10:09 AM, Marco van de Voort wrote:
> In our previous episode, Santiago A. said:
>> Pascal needs to break backward compatibility to advance, that is, in 
>> fact, a new language. But if pascal is struggling to survive, let alone 
>> a new language if you are not mozilla, google...
> I think to advance Pascal needs less discussion about language and more
> about libraries.
+1

It seems that there are more and more people trying to make Pascal into
a second coming of whatever other language they are used to/have used
before, instead of properly solving problems with the language tools and
features that are already provided.

Ralf

---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus

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

Re: [fpc-pascal] Loss of precision when using math.Max()

2018-07-03 Thread Ralf Quint
On 7/3/2018 5:01 AM, Santiago A. wrote:
> El 03/07/2018 a las 01:26, Jim Lee escribió:
>>
>> Without the implicit conversion of signed/unsigned values, the
>> utility of the language is greatly diminished.
Bollocks! Just learn to program in Pascal, not trying to have Pascal act
just like another compiler/language
>
> Let's be honest, compared to C and many other languages (included C++,
> that is a suicide without extra-language analyzer tools), Pascal is
> very type secure. For instance, many languages allow assigning a float
> to an integer without any problem. Moreover without being clearly
> specified by language definition what the compiler should do, truncate
> or round.
>
> Pascal needs to break backward compatibility to advance, that is, in
> fact, a new language. But if pascal is struggling to survive, let
> alone a new language if you are not mozilla, google...
Again bollocks!

If you have properly range check enabled, you get an exception at those
code samples. Such for code samples (all variables of the same type,
Byte in the examples), the compiler can not make a determination at
compile time (and we have a compiler here, not just another interpreter,
like Python, etc ).

And no "new language" can absolve the programmer from properly doing
their work. Everything else is just a quick hack, not a properly
designed program...

Ralf

---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus

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

Re: [fpc-pascal] Default record fields

2018-06-22 Thread Ralf Quint

On 6/22/2018 4:19 AM, Karoly Balogh (Charlie/SGR) wrote:

Hi,

On Fri, 22 Jun 2018, Ryan Joseph wrote:


I want to do a pivot away from the macro stuff to ask another question.
Since I’ve wanted to contribute to the compiler for so long and I
finally have a little understanding I’d like to know if there’s anything
minor I could do, that isn’t offensive to the compiler team.

It's not about the compiler team. It's about the integrity of a
programming language, which doesn't matter these days a lot, when all
languages turned into a feature race to provide the same broken concepts,
but with slightly different syntax. Nevermind. I sometimes do not even
understand how people did stuff for 50 years without
TObjectClassAdvancedTemplateGenericRecordRTTI...

+1
It's not (only/just) what "the compiler team" wants. There are people 
actually using the compiler. For real life purposes.
And a lot of what people are proposing, over and over again, are 
solutions for problems that nobody has (in real life)...


Ralf

---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus

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

Re: [fpc-pascal] Proper preprocessor?

2018-06-21 Thread Ralf Quint

On 6/21/2018 8:08 AM, Sven Barth via fpc-pascal wrote:


Of course you have permission to work on this, after all this is Open 
Source software. However whether we'd want to integrate this is a 
totally different topic.
I personally am against it, cause I see no real world use in it and 
the usual point of making the code less readable applies as well.

+1



---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus

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

Re: [fpc-pascal] MSEide+MSEgui 4.6 for FPC 3.0.4

2017-11-25 Thread Ralf Quint
On 11/25/2017 8:43 AM, Martin Schreiber wrote:
> On Saturday 25 November 2017 15:04:05 Andreas Berger wrote:
>> On the Android side I actually only need a graphical app with access to
>> the Bluetooth and possibly be a TCP client.
>>
> And why Free Pascal to develop the android application? What would be the 
> advantages instead to use the tools of the platform?
In a lot of cases, at least for non-trivial applications, you might need
to share a larger code base with desktop applications running on 
Windows, Linux or macOS...

Ralf

---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus

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

Re: [fpc-pascal] Forbidden access to the packages page

2017-11-02 Thread Ralf Quint
On 11/2/2017 1:02 PM, Cleverson Casarin Uliana wrote:
> Hello, is it normal that the following URL gives a 403 forbidden error
> when trying to access via Firefox? Here it does:
> https://www.freepascal.org/packages/ 
Certainly not a Firefox problem, as I can reproduce this with Chrome and
Opera as well...

Ralf

---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus

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

Re: [fpc-pascal] Syntax to select constant or variable with function call

2017-09-24 Thread Ralf Quint
On 9/24/2017 12:07 PM, James Richters wrote:
> Thank you for explaining how to achieve this.  
> I am curious about the meaning behind the prefixes you used:
>>  TVGA256Array = Array[0..255] of VGARGBRec;  
>>  PVGA256Array = ^TVGA256Array;
> Do the T and P in front of VGA256Array have a special meaning or 
> significance?   I see things like that all the time, but never really 
> understood why there are these designations.
It is called (IMHO a bad form of) "Hungarian Notation", an identifier
naming convention that should help to make source code more readable. In
[Borland,Turbo,Free]Pascal, the first latter is indicating what kind of
indentifier it is.
 "t" denotes a Type
 "p" denotes a pointer to a Type
"c" denotes a constant
(I personally prefer to use low case letters for that preceding
character, it is IMHO much better readable).

So yes, in this case, the T and P do have a special meaning, but are of
no significance...

Ralf


---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus

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

Re: [fpc-pascal] Freepascal Floating Point Issue

2017-08-24 Thread Ralf Quint
On 8/24/2017 2:45 PM, Ched wrote:
> And under "modern" Windows, the extended type, which is fully
> supported by the FPU, is *degraded* to double. So, I can't do high
> precision computation with fpc even if the native hardware permits
> such computations. I'm glued to XP as the full capabilities of the FPU
> were on the hands of programmers, years ago. 
It's not a problem of "modern" Windows, but a problem of any 64bit x86
OS that in that "long" mode the FPU does NOT support the extended data
type (80 bits, 10 bytes). In 32bit mode, the FPU is using the "old" x87
FP unit on the chip, in 64bit mode, it is using the SSE FP unit, which
doesn't have those 80 bit registers, it's 64 bit only (and several times
faster).
So that you can use that with your Windows XP version is likely due to
the fact that this is a 32bit version, not XP Professional 64 (or
Windows Server 2003 64 for that matter).

There are apparently some ways to enable the FP calculation to use the
x87 FPU and therefor the possibility of those 80 bit registers on Inter
chips (so far), but for one, this runs significantly slower that the SSE
FPU, and then this is apparently not supported by (all) AMD CPUs, so you
are limiting yourself also on which systems your code can run...

Ralf


---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus

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

Re: [fpc-pascal] Freepascal Floating Point Issue

2017-08-24 Thread Ralf Quint
On 8/24/2017 2:18 AM, Sven Barth via fpc-pascal wrote:
>
> Am 23.08.2017 02:16 schrieb "Paul Nance"  >:
> >
> > Turbo Pascal also had a BCD unit.
>
> Free Pascal also has a BCD unit: FmtBCD. It provides a BCD type and
> operators as well operator overloads.
>
And where would such gem be hiding? It's not in neither my Lazarus
1.6/FPC 3.02 nor the Lazarus 1.8RC4/FPC 3.04 installs...

Ralf


---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Freepascal Floating Point Issue

2017-08-23 Thread Ralf Quint
On 8/22/2017 5:16 PM, Paul Nance wrote:
> Turbo Pascal also had a BCD unit.
Well, no, there was no unit, rather a version of Turbo Pascal 3.0x had a
version that natively used BCD math for "reals" instead of the 6byte
REAL type, just as there was a x87 version that used hardware x87 FP
(IEEE754) floats instead of software emulated ones. That was at a time
when the x87 processors where an addon to the basic CPU (8087 for the
8086/8088/80188, 80187 for the 808186, 80287 for 80286, 80387 for the
80386).

Ralf


---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus

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

Re: [fpc-pascal] Freepascal Floating Point Issue

2017-08-23 Thread Ralf Quint
On 8/23/2017 5:11 AM, Benito van der Zander wrote:
>> Btw, anyone know about a BCD math implementation for Free Pascal, like
>> it used to be implemented in DR CBASIC? (those were the days... ;-) )
>
>
> I have one here: http://benibela.de/sources_en.html#bigdecimalmath
Thanks, but that is not quite the same as having a BCD library for
financial math. I will look though if that can be trimmed down into just
that

Ralf

---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus

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

Re: [fpc-pascal] Freepascal Floating Point Issue

2017-08-22 Thread Ralf Quint
On 8/22/2017 1:39 PM, Mark Morgan Lloyd wrote:
> On 21/08/17 22:15, Ralf Quint wrote:
>> On 8/21/2017 3:02 PM, James Richters wrote:> I am having an issue
>> with a simple floating point application.  I am setting a variable to
>> a specific value and immediately after I set it,  it is not exactly
>> what I set it to.  Here's an example>>    Draw_GX_Min:=999.999;>   
>> Writeln(Draw_GX_Min:3:30);>> The writeln results in
>> 999.999002  >> Why is it not 
>> 999.999000  where did 0.02 come
>> from?>Out of thin air... Well, kind of. Double floating point means
>> 16 digitsof precision, so when you force a 30 digit precision output,
>> anythingpast 16 digits is random garbage, at best...
>
> And in any event, that's probably much more precision than the GPU is
> using to generate the final image :-)
>
Well, older GPUs (at least NVidia, pretty sure similar restrictions
apply to AMD) use(d) only 32bit "single" floats, giving a 7 digit
precision, though newer ones can also handle 64bit doubles. But there
are quite a few differences in how certain FP operations are handled on
those GPUs, which result in even doubles only having 14 (instead of 16)
digits of precision at best. So while NVidia keeps mentioning IEEE754,
their GPUs are in practice not 100% compliant.

As I mentioned before, if someone needs to work a lot with floating
point arithmetic, it really helps to get yourself acquainted to the way
those works and all the possible pitfalls.

Btw, anyone know about a BCD math implementation for Free Pascal, like
it used to be implemented in DR CBASIC? (those were the days... ;-) )

Ralf



---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus

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

Re: [fpc-pascal] Freepascal Floating Point Issue

2017-08-21 Thread Ralf Quint
On 8/21/2017 3:34 PM, Daniel Franzini wrote:
> It might be the case (I didn't do the math) that 999.999 doesn't have
> an exact representation in IEEE-754 double-precision format, so the
> best you get is an aproximation (a pretty good one, btw).
Just use WriteLn (Draw_GX_Min:3:16) and you get no mystery digits anymore...

In pretty much any programming language/compiler, if you print more
digits than the precision of the used variable defines, you will get
random numbers after the defined precision.
This is not something FreePascal specific, any C/C++ compiler for
example will do the same thing. People need to learn what limitations
come along with floating point variables/calculations...

Ralf

---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus

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

Re: [fpc-pascal] Freepascal Floating Point Issue

2017-08-21 Thread Ralf Quint
On 8/21/2017 3:02 PM, James Richters wrote:
> I am having an issue with a simple floating point application.  I am setting 
> a variable to a specific value and immediately after I set it,  it is not 
> exactly what I set it to.  Here's an example
>
>Draw_GX_Min:=999.999;
>Writeln(Draw_GX_Min:3:30);
>
> The writeln results in 999.999002  
>
> Why is it not  999.999000  where did 0.02 
> come from?
>
Out of thin air... Well, kind of. Double floating point means 16 digits
of precision, so when you force a 30 digit precision output, anything
past 16 digits is random garbage, at best...

Ralf

---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus

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

Re: [fpc-pascal] fpReport released

2017-08-20 Thread Ralf Quint
On 8/20/2017 11:35 AM, Michael Van Canneyt wrote:
>
> Hello,
>
> A long time wait. But it finally made it:
>
> fpreport has been committed to FPC SVN: packages/fcl-report.
> It should compile on windows, linux, freebsd and darwin. 
Nifty!

Ralf ;-)

---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus

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

Re: [fpc-pascal] Correct syntax for initialized constants/variables

2017-04-28 Thread Ralf Quint
On 4/27/2017 12:22 PM, Ewald wrote:
> On 27/04/17 20:49, Ralf Quint wrote:
>> I try to include some initialized constants/variables in an application
>> of mine, but somehow stumbled upon a stupid little problem that I can't
>> figure out myself after nights on the computer.
>>
>> I see in the reference docs (section 4.4) examples for arrays and
>> examples for records, but in my case, I would need to properly define an
>> array of records.
> Something like this?
>
> Type
>   TA = Record
>   a: Integer;
>   End;
>
> Var
>   SomeArray: Array[0..1] of TA = (
>   (a: 42;),
>   (a: 17;)
>   );
Never mind, I just found my problem. Quite embarrassing for someone
programming in Pascal for 41 years, who should know better as to where
to put a comma and where to put a semicolon... :-[
Just picture me slapping myself hard for the next hour or two... :-!

Ralf


---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus

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

Re: [fpc-pascal] Correct syntax for initialized constants/variables

2017-04-27 Thread Ralf Quint
On 4/27/2017 12:22 PM, Ewald wrote:
> On 27/04/17 20:49, Ralf Quint wrote:
>> I try to include some initialized constants/variables in an application
>> of mine, but somehow stumbled upon a stupid little problem that I can't
>> figure out myself after nights on the computer.
>>
>> I see in the reference docs (section 4.4) examples for arrays and
>> examples for records, but in my case, I would need to properly define an
>> array of records.
> Something like this?
>
> Type
>   TA = Record
>   a: Integer;
>   End;
>
> Var
>   SomeArray: Array[0..1] of TA = (
>   (a: 42;),
>   (a: 17;)
>   );
>
> Note: this is written from memory, syntax might differ a little (but the
> error messages from the compiler should help you out in that case).
Well, no, the error messages just state "expected this, found that",
without actually giving a REAL hint...

The declaration would be something like this

Type tStateRecord = Record
 StateAbbrev : String [4];
 StateName   : String [40];
 InLower48: Boolean;  
end;
tStateArray = Array [1..MaxNoStates] of tStateRecord;

Var {or Const, so it's initialized only once}
States : tStateArray = (  (StateAbbrev  : 'AL', StateName :
'Alabama', InLower48:TRUE),
 (StateAbbrev  : 'AK',
StateName : 'Alaska', InLower48:FALSE),
 ...
   );

Various versions of parenthesis just vary the error message, either the
above mentioned "expected this, found that" or "filed xyz not initialize"...

Ralf


---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus

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

[fpc-pascal] Correct syntax for initialized constants/variables

2017-04-27 Thread Ralf Quint
I try to include some initialized constants/variables in an application
of mine, but somehow stumbled upon a stupid little problem that I can't
figure out myself after nights on the computer.

I see in the reference docs (section 4.4) examples for arrays and
examples for records, but in my case, I would need to properly define an
array of records.

Any hint/example for the proper syntax in that case would be deeply
appreciated, it's probably something simple that I am missing,

tia,

Ralf



---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus

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

Re: [fpc-pascal] FreePascal Windows - Force files to write to disk

2017-03-21 Thread Ralf Quint

On 3/21/2017 11:58 AM, James Richters wrote:

I have not tried FlushFileBuffers() yet, so I just tried it now,  I am getting 
the same results.
Well, that is expected, as the issue has nothing to do with your 
program, it's the caching of the operating system that is responsible 
for the actual physical write to the disk.
I see something similar with some text files that I use while doing some 
cross-platform work that I am doing recently.


The actual test file is on a Windows 8.1 machine, while most of the 
access to that file is from either a Windows 10 laptop or a macOS Sierra 
MacBook Pro. Occasionally, more pronounced when one of these two 
machines is connected via WiFi instead of wired connection (on the same 
logical subnet though!), when reloading the file from disk, it shows up 
corrupted on the other machine, while it shows perfectly fine on the one 
that did the last write. Force a new write and in 99.9% of all cases, it 
will show up just fine on another reload...


Any chance that the file(s) you are working with are on a shared drive?

Ralf

---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus

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

Re: [fpc-pascal] uses myunit in '../src/myunit.pas' ?

2017-02-13 Thread Ralf Quint

On 2/13/2017 2:02 PM, fredvs wrote:

I guess you are searching for {$unitpath Documents}

Yes, it is a excellent solution.


  but then some units might not rebuild automatically,

It is not a problem, all that units are part of ../src and users should not
touch it when compiling demos.

Many thanks Mathias for this pearl.

PS: I wish that one day fpc will publish the complete list of all  the
{$something  ...} that  fpc can deal.

You mean a duplicate of this page
http://wiki.freepascal.org/global_compiler_directives

Ralf

---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus

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


Re: [fpc-pascal] Underscores in numerical literals - grouping

2016-11-21 Thread Ralf Quint

On 11/21/2016 8:05 AM, Jürgen Hestermann wrote:

Am 2016-11-21 um 15:46 schrieb Graeme Geldenhuys:

The age old rule
of programmer source code always being in a mono-spaced font is
ridiculous for this day and age.


Why?
I like monospaced fonts for code very much.

Code is not a novel or a newspaper where you read
a lot of text from top down to the end in a linear manner.
Instead, alignment is very important to make code more readable.
Monospaced fonts make it much easier to align code and
make a lot of things align 'automatically'.

I even align procedure headers like the following where all variables and
all types start at the same column
(which may not be visible in this email if you use proportional fonts 
;-).
Please copy it to notepad or into Lazarus Editor in this case): 

+1
Anything BUT a mono-spaced font for program code is ridiculous, even in 
this day and age...


We are programming in Pascal, which is neither case-sensitive (like for 
example C) nor does it make it whitespace significant (like Python), 
allowing for a much more readable code than most other languages out 
there, as you can easily format code in a way that is more human 
readable. The machine (compiler) doesn't care for that...


Ralf

---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus

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


Re: [fpc-pascal] Missing messages

2016-10-31 Thread Ralf Quint

On 10/31/2016 1:12 PM, Florian Klämpfl wrote:

Am 30.10.2016 um 19:11 schrieb Graeme Geldenhuys:

On 2016-10-30 17:24, Sven Barth wrote:

Same here...

First Lazarus, now FPC. Can we not switch fpc-pascal to a NNTP newsgroup

I used NNTP years ago the last time. How does marking read messages work when 
reading a group with
multiple devices (mobile, tablet, notebook, pc)?
It doesn't. You need to download, read and mark each message on each 
device separately. Ever since IMAP has become the predominant email 
protocol, as servers are no longer short on storage space, there isn't 
much actually that REALLY makes a point against mailing lists.


For me, it is far more convenient than usenet, as I can receive emails 
for mailing lists on a separate email address, on multiple devices, 
which would sync automatically, as they are all set up to use IMAP, 
messages get automatically filtered into the right folders. The only 
disadvantages that I see at time is the issue of attachments and posting 
messages with screenshots for example, which doesn't work (well) on 
usenet either and is pretty much an advantage of using a forum in most 
cases...


The issues with emails not showing up is commonly due to the sender 
playing some shenanigans (intentionally or not), not by the system in 
general. And the threshold for spam is lower on a mailing list as well, 
as there is usually more of a vetted signup process than on usenet 
(where there is none).


Ralf

---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus

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


Re: [fpc-pascal] Smart link in FreeBSD multi-arch ?

2016-10-17 Thread Ralf Quint

On 10/17/2016 7:47 PM, fredvs wrote:


@fpc-team: Why not register the concept of "smart-linking", nobody knows
that word in other language.
IMO, it would be good to add in wikipedia a article about "smartlink" and
not forget to say that the concept of "smart-linking" comes from fpc.
Well, it does not come from FPC, in fact the Borland compiler back to at 
least Turbo/Borland Pascal 7.0 supported that feature. (Don't know if 
Turbo Pascal 6.0 might have already supported it because I skipped it 
"back then" and went from 5.5 straight to 7.0...


Ralf

---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus

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


Re: [fpc-pascal] Reed-Solomon algorithm

2016-09-16 Thread Ralf Quint

On 9/16/2016 12:11 AM, duilio foschi wrote:

Hi Ralf.

thank you for the hint re the Jedi RS algorithm.

The code is inspirational, but weak:

[from file readme.txt]

"As far as I can tell it works, but I made some rather rash
assumptions which need to be confirmed by someone who knows what they
are doing"

I need code I can trust, so will stay with the code from sourceforge.

This has been tested far and wide :)
I just remembered that I saw some related code when looking for 
something else a short while ago, never used it myself. If it helps you 
great, if not...


Ralf ;-)

---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus

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


Re: [fpc-pascal] Reed-Solomon algorithm

2016-09-15 Thread Ralf Quint

On 9/15/2016 3:07 PM, duilio foschi wrote:

https://sourceforge.net/projects/rscode/?source=typ_redirect

The code above seems much easier to use.

There is also some code in the Delphi JEDI library at 
http://www.delphi-jedi.org/toolslibrary.html


Ralf

---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus

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


Re: [fpc-pascal] Free Delphi 10.1 Berlin Starter Edition

2016-08-24 Thread Ralf Quint

On 8/24/2016 1:04 AM, brian wrote:

On Tue, 23 Aug 2016 23:40:06 +0800, you wrote:

It should maybe be noted that this download apparently requires that
you have Windows 10?

Negative. I downloaded and installed it just fine on Windows 8.1/64...

Ralf

---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus

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


Re: [fpc-pascal] Free Delphi 10.1 Berlin Starter Edition

2016-08-23 Thread Ralf Quint

On 8/23/2016 6:19 PM, Stephen Chrzanowski wrote:
FULLY understanding that this forum is for FPC and not 
Delphi/Embarcadero, has anyone installed Berlin, gone into Tools> 
Options> Environment Options> Form Designer and see NO OPTIONS show 
up?  Stuff like the grid size, the toggling the Embeded Designer, etc 
should be here but I get no options. That particular form option 
screen is completely blank, and I'm not sure why.

Not sure why either, but that page is blank for me too...

Ralf

---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus

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


Re: [fpc-pascal] Free Delphi 10.1 Berlin Starter Edition

2016-08-23 Thread Ralf Quint

On 8/23/2016 1:46 PM, Maciej Izak wrote:
2016-08-23 19:42 GMT+02:00 Jonas Maebe >:


And you can't use any edition to "develop an application that is
directly competitive to the Product or to any other Embarcadero
products" 



AFAIK they can write any nonsense in the license agreement and nobody 
can forbid them to do so ;)... You can't dictate people what they can 
not do with compiler. That means Delphi can't be used to develop any 
OS project (Zeos, mORMot).
No, it means you can't use Delphi Starter Edition to develop another 
Object Pascal or C++ compiler, that are competing products...


Ralf


---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Free Delphi 10.1 Berlin Starter Edition

2016-08-23 Thread Ralf Quint

On 8/23/2016 12:19 PM, geneb wrote:

On Tue, 23 Aug 2016, Jonas Maebe wrote:


On 23/08/16 19:14, Ralf Quint wrote:

As a very rough summary, you can't use the Starter Edition if you are
making more than $1000 a year from the software created with it...


And you can't use any edition to "develop an application that is 
directly competitive to the Product or to any other Embarcadero 
products" 
(https://www.embarcadero.com/products/rad-studio/rad-studio-eula )


EULAs have the same value as toilet paper and should be used for the 
same purpose.  I for one, will use Delphi for whatever I like, and if 
Embarcadero has a problem with that, they're invited to kiss my ass. :) 

Hope you got a good lawyer...

Ralf

---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus

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


Re: [fpc-pascal] Free Delphi 10.1 Berlin Starter Edition

2016-08-23 Thread Ralf Quint

On 8/23/2016 9:49 AM, Dennis wrote:



wkitt...@windstream.net wrote:

On 08/23/2016 11:40 AM, Dennis wrote:

Thanks a lot.
I wonder if there is any catch.


you mean like having to create an account, having to provide a phone 
number or having to run it in a winwhatever environment? ;)

\

it says:
"a limited commercial use license"

I wonder that means. 

Just read the license, simple as that...

As a very rough summary, you can't use the Starter Edition if you are 
making more than $1000 a year from the software created with it...


Ralf

---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus

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


Re: [fpc-pascal] Textmode IDE splitscreen?

2016-07-25 Thread Ralf Quint

On 7/25/2016 5:06 AM, James Richters wrote:

The TurboPascal version used to write to B800-B7FF for the monochrome
monitor and A000-AFFF for the color monitor, the IDE was always on
monochrome and the program executing was always on color... that's how it
worked,

No, it didn't.

The monochrome screen RAM is at segment address $B000 and while a whole 
32KB is reserved ($-B7FF), only the first 4KB are in fact used. (80x25 
characters, 2 bytes per character=4000 bytes) The Hercules graphics card 
did use the whole 32KB when in graphics mode.


The default page for color text mode (mode 3) starts at $B800, is also 
4KB and a total of 8 pages are available up to $BFFF, though an original 
CGA card had  only 16KB and hence only the first 4 pages are available.


And it was a choice which screen appears on which monitor, selectable as 
a parameter upon start of the IDE. I in fact used to run most of the 
time with the IDE on the color screen and the program output on the 
monochrome screen, unless I would explicitly test a program with color 
screen features.


$A000 is the start of the EGA/VGA graphics screen, not a text screen 
segment address...


Ralf

---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus

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


Re: [fpc-pascal] Build in a C compiler

2016-04-20 Thread Ralf Quint

On 4/20/2016 4:29 AM, Rainer Stratmann wrote:

Am Mittwoch, 20. April 2016, 07:05:10 schrieb Mark Morgan Lloyd:

No. Pascal and ALGOL are closely related, C and ALGOL are closely
related. Pascal and C are not so closely related.

As you can see here Pascal, C, and Basic are very close related.

http://www.mikroe.com/compilers


I think you are jumping to conclusion here.
It is more likely that they spend the time in the past (they are around 
for quite a while) to build their specific Basic, Pascal and C compiler 
front end and just have to replace the actual code generator for each 
architecture they support.
Just because a company offers compilers for various languages, with a 
common IDE, doesn't mean that those compilers are "closely related".
Just take Borland of old, Turbo Pascal, Turbo C, Turbo Basic, Turbo 
Prolog, they all used a very similar IDE but the actual compiler had all 
completely different origins...


Ralf

---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus

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


Re: [fpc-pascal] PDF generator, try 2

2016-03-31 Thread Ralf Quint

On 3/31/2016 7:02 AM, Michael Van Canneyt wrote:


Hello

In revision 33401 of FPC subversion, a lot of fixes have been 
committed for Font
handling in the PDF generator: e.g. Unicode fonts should now render 
correctly.


The test program generates the following PDF:

http://www.freepascal.org/~michael/test.pdf

Page 1 looks as follows on my system:

http://www.freepascal.org/~michael/pdftest.png

The output has been tested for correct rendering in the following 
applications:


  Firefox native viewer (Linux)
  Acrobat Reader 10 (Windows)
Looks fine on an up to date Acrobat Reader DC (15.10.2006) as well, both 
on Windows (8.1, 10 Pro Insider) and Mac OS X (10.11.4)


Ralf



---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus

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


Re: [fpc-pascal] How do I test the testfppdf on Windows?

2016-03-05 Thread Ralf Quint

On 3/5/2016 12:03 PM, Michael Van Canneyt wrote:


This is what I get with the normal test font:
http://www.freepascal.org/~michael/test.pdf


FYI,

Opening up this document with the latest Adobe Reader DC 
(15.10.20059.40980, on Windows 8.1/64), I get an error message saying


"The font 'Times' contains a bad /BBox"...

Ralf

---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus

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


Re: [fpc-pascal] Please someone explain this to me

2016-02-09 Thread Ralf Quint

On 2/9/2016 2:58 PM, Anthony Walter wrote:
I really don't like the include files with Lazarus and Free Pascal for 
the following reason:


How the  am I supposed to know which file is including an include 
file?


Often times I am trying to find a function or class or some other 
identifier and I search files on disk for the name. Then it turns out 
the identifier is in some include file. Often the include file doesn't 
have any information to which unit it belongs and I am then forced to 
search further for other files which reference the include file. It's 
a mess.


In this issue http://mantis.freepascal.org/view.php?id=29599 Juha is 
asking how I was able to compile my patch without using the dynlibs 
unit. Sure enough I am not using the dynlibs unit, but on my system it 
compiles. When I control click the LoadLibrary identifier in my Unity 
patch, Lazarus brings up an include file with LoadLibtary declared, 
but I have no idea which unit is including it (remember I'm not using 
unit dynlibs).


So my question is, how do the rest of you deal with include files and 
locating the unit including them? And also can this system for 
including files be better implemented, for example by some IDE feature 
to figure this out for you and displaying the "owning" units.


It seems to me as if you are approaching the problem from the wrong end, 
which has your search end up in the include file instead of the 
associated unit.


I had only a cursory look at your problem and it seems you just went 
straight to the Linux related LoadLibrary function instead of indeed 
using the dynlibs unit, which exist for the purpose of creating a 
cross-platform way of using dynamically loaded libraries (hence the 
name). You seem to  just ignore the fact that this is a highly OS 
depended functionality and seemed to have taken interest only in the 
Linux related part of what ever your initial problem is/was and used 
that portion of the code in stead of making use of the dynlibs unit.


Ralf

---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus

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


Re: [fpc-pascal] New feature: IfThen() intrinsic

2016-01-31 Thread Ralf Quint

On 1/31/2016 7:14 AM, Vojtěch Čihák wrote:


Hi,

what is difference in produced assembler between ifthen(); and classic 
if - then - else?




+1

I don't really see how this is different from properly writing  if ... 
then ... else... either... :-\


Ralf

---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus

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

Re: [fpc-pascal] howto store passwords

2015-11-01 Thread Ralf Quint

On 11/1/2015 7:50 PM, Anthony Walter wrote:
Ideally you shouldn't store passwords at all. You store the hash to 
the password. In this way, someone at your business, or someone with 
access to your business, or if someone mistakenly installs some 
malicious software, your users passwords can never be retrieved.


When someone logs into your software/site they send their password. 
Your server then converts that password to a hash and compares it to a 
hash associated with their account, and the password then goes away. 
No one can steal your customer password list since they are never 
stored and thus cannot be compromised.


The downside of that approach however is that it this opens up the 
possibility to create a matching hash on "inappropriate" passwords (too 
short, easy to look up/guess) and hence get access...


Ralf

---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus

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


Re: [fpc-pascal] Basic Windows tutorial

2015-10-22 Thread Ralf Quint

Ryan Joseph wrote:

On Oct 23, 2015, at 2:03 AM, Sven Barth  wrote:

Out of curiosity: in how far aren't you a fan of Lazarus' layout? Many parts 
can be configured. Especially the code tools that Lazarus provides makes 
navigating/writing code rather easy.


I don’t use the RAD tools so those are in the way but the biggest problem is 
how everything is broken up into separate windows. Could that be changed?

Try using more than one monitor while developing GUI applications and 
you will never ask that question again... ;-)


Ralf

---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus

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

Re: [fpc-pascal] Methods for autoupdating fpc programs?

2015-10-03 Thread Ralf Quint

On 10/3/2015 11:30 AM, Bo Berglund wrote:

I am wondering if there is some method to autoupdate an fpc program
running on a RaspberryPi? It really should not matter where the fpc
program runs but I figured the operating system has some influence, so
let's limit this to Linux.

What I would like is to endow my data collection control program on a
Pi with the ability to check for updates on the web and then update
itself. But I have no clue as to the best way to do this.

The program will probably be started by cron every minute to check if
it has anything to do and if so execute its data collection task and
quit. Otherwise just quit, but here maybe also check for an update on
the web?
But how could one exchange a running program on the pi from within
itself?

Any common methods available somewhere?


Well, there is a Lazarus component for that... ;-)

http://wiki.freepascal.org/LazAutoUpdater

Ralf

---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus

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


Re: [fpc-pascal] Methods for autoupdating fpc programs?

2015-10-03 Thread Ralf Quint

On 10/3/2015 2:15 PM, Bo Berglund wrote:
Yes, I found that but it seems to be a visual component that will 
interact with a user. My program is a command line application started 
by cron and running on a headless Pi2B installed inside a box in the 
wilderness. Only communicates via a mobile broadband modem/router... I 
need a non-visual one. And I did not intend to host my program on 
Sourceforge either... 


Well, then run a shell script in cron instead of the executable direct. 
And before starting the executable in that script, check for the 
existence of a new version that your application has downloaded, and if 
existent, copy it over the existing one and remove the download...
That's a basic method that will work for pretty much any application, 
not only on written in FPC...


Ralf


---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus

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


Re: [fpc-pascal] alignment of records

2015-08-10 Thread Ralf Quint

On 8/8/2015 12:30 AM, Sven Barth wrote:


Am 08.08.2015 00:37 schrieb Ralf Quint freedos...@gmail.com 
mailto:freedos...@gmail.com:


 On 8/6/2015 8:25 PM, Xiangrong Fang wrote:

 It seems that $packrecord does not work at all.

 I always explicitly use PACKED Record as in

 Type ifmap = PACKED Record
   mem_start: dword;
   mem_end: dword;
   base_addr: word;
   irq: byte;
   dma: byte;
   port: byte;
  end;

 and at least in/up to FPC 2.6.4, this works for me just fine

This depends however on the code you're interfacing with. Also the 
record you mentioned as an example shouldn't differ with and without 
packed anyway...



I just copied and pasted the code snippet from  the OP, to show how to 
use the PACKED Record statement explicitly for a specific record. I am 
using this for cross-platform/cross-compiler/cross-language software for 
at least 30 years now and probably for +20 years in FreePascal (when it 
was still called FPK and was an attempt of creating a 32bit compiler 
compatible with 16bit Turbo/Borland Pascal at that time)...


Beside, on the above record, the layout in fact SHOULD matter as it has 
3 single bytes at the end and there for needs to be aligned on the byte, 
not on any word/dword/etc boundary...


Ralf

Ralf



---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] New Get Lazarus Initiative

2015-02-04 Thread Ralf Quint

On 2/4/2015 3:20 AM, Anthony Walter wrote:
Okay, I'll work on new builds ASAP which include the revision numbers 
from inside Lazarus as well as clearly labeled revision text files 
placed in the FPC and Lazarus folders. These files will contain the 
branch name and SVN revision number.


I've modified the line you mentioned to read To get the testing 
versions of Free Pascal 3.0 and Lazarus 1.4 download the setup program.


To everyone else, anyone can edit the pages, so if anyone cares to 
clarify anything on any page, just click edit this page and I'll 
review an apply the changes.
On a general note, while I appreciate the overall effort, just 
mentioning FPC3.0 and Lazarus 1.4, which both do not exist (just yet) 
might rather backfire and give it a kind of vaporware look...


Also, you might reconsider to immediately trigger the download of a 
random image in .exe format when switching to the Get Lazarus page, 
that doesn't look good either, considering that this is a way how not so 
nice fellows are trying to spread malware...


Just my quick 2c,

Ralf


---
This email has been checked for viruses by Avast antivirus software.
http://www.avast.com

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


Re: [fpc-pascal] New Get Lazarus Initiative

2015-02-04 Thread Ralf Quint

On 2/4/2015 12:22 PM, Anthony Walter wrote:
Ralph, regarding the first point of FPC 3.0, we already discussed it 
in previous replies. Check those messages to get caught up.

My general objection still stands...


Regarding the automatic download, I'm not sure where you are talking 
about.
As soon as I click the get Lazarus link on the starting page, together 
with the download page, it immediately opens up the download dialog.
Happens in Windows 8.1/64 with Firefox 35.0.1, Opera 27.0.1689.66, 
Chrome 40.0.2214.94as well as Vivaldi 1.0.94.2 and Internet Exploder 
11.0.9600.17498.


I can send you the screenshots off-list...

Ral*f*


---
This email has been checked for viruses by Avast antivirus software.
http://www.avast.com
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] New Get Lazarus Initiative

2015-02-04 Thread Ralf Quint

On 2/4/2015 2:43 PM, Anthony Walter wrote:
Ralph, not to be rude, but you are either not paying attention or 
being dense. I said:

I am not dense, but you seem to go that direction.
For one, my name is Ralf not Ralph. Looks like you need to pay attention...


'And one hyper link with on the front page with the words get Lazarus 
today does the same thing.'


Now what the heck are you talking about? I reported to you that on five 
different, current browsers, opening the download page via the get 
Lazarus link on the home page is immediately starting a download. As 
this is an .exe file, as another user already pointed out to you as 
well, this is something that should be frowned upon.


Ralf



---
This email has been checked for viruses by Avast antivirus software.
http://www.avast.com

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


[fpc-pascal] What's wrong with this simple test program

2014-12-19 Thread Ralf Quint
I have been trying to use tStringList in a larger project of mine, but 
this just keeps bombing out with a exception.
I have been able to reproduce the problem with this very simple test 
program:


program project1;

USES Classes;

Var T : tStringList;
S : String;
begin
  S := 'Test';
  T.Create;
// T.Clear;
  T.Add (S);
  T.Free;
end.

It will throw the exception at each and every instruction using T after 
the T.Create statement.


The project is a simple command line program, tested both with Lazarus 
1.2.6 and the included default install of FPC 2.6.4 on either Windows 
8.1/64 or Windows 10/32...




---
This email has been checked for viruses by Avast antivirus software.
http://www.avast.com

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


Re: [fpc-pascal] What's wrong with this simple test program

2014-12-19 Thread Ralf Quint

On 12/19/2014 12:53 PM, Joost van der Sluis wrote:

On 12/19/2014 09:48 PM, Ralf Quint wrote:

I have been trying to use tStringList in a larger project of mine, but
this just keeps bombing out with a exception.
I have been able to reproduce the problem with this very simple test
program:

program project1;

USES Classes;

Var T : tStringList;
 S : String;
begin
   S := 'Test';
   T.Create;
// T.Clear;
   T.Add (S);
   T.Free;
end.


You're mixing old TP-style objects with classes.

T := TStringList.Create is the correct syntax.
Well, then why is the compiler building this just fine without even 
throwing an error?!?!?
As mentioned, I do not get the error at the .Create call, but at 
anything after that...
I do not have a working Delphi system at hand right now, but I am sure 
that this would have compiled and worked on anything up to Delphi 2006 
just fine.


I will change this and see if this makes a difference, thanks

Ralf

---
This email has been checked for viruses by Avast antivirus software.
http://www.avast.com

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


Re: [fpc-pascal] findfirst wildcards...

2014-12-03 Thread Ralf Quint

On 12/3/2014 8:30 AM, waldo kitty wrote:

On 12/3/2014 3:41 AM, Jonas Maebe wrote:


On 03 Dec 2014, at 06:05, waldo kitty wrote:

can you help me understand the differences in the output of the 
below program?


given these three filenames: t.txt t1.txt t11.txt

with mask  t?.txt  why does MatchesMaskList not show t.txt and 
t11.txt like

plain findfirst?


? means a single arbitrary character.  findfirst with t?.txt 
should not

match t.txt nor t11.txt either.


yes, i wrote t11.txt when i should have written t1.txt... my bad...

however on
  OS/2 native
  OS/2 with 4OS2 command interpreter replacement
  OS/2 DOS native
  OS/2 DOS with 4DOS command interpreter replacement
  Vista (32bit)
t?.txt returns both t.txt and t1.txt...
On any DOS based OS (that includes OS/2 and Windows), the ? wildcard 
character will find any character, including no character at all in that 
position. So in your example, t?.txt will find t.txt and tx.txt but not 
txy.txt. It will not return any filename longer than your search mask, 
but return shorter filenames. This is (should be) a functionality of the 
underlying system calls.
On *ix based systems, the filenames are evaluated by the shell, not the 
OS, and your search result will be different in a lot of cases...


Ralf

---
This email has been checked for viruses by Avast antivirus software.
http://www.avast.com

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


Re: [fpc-pascal] findfirst wildcards...

2014-12-03 Thread Ralf Quint

On 12/3/2014 12:27 PM, Bart wrote:

On 12/3/14, Ralf Quint freedos...@gmail.com wrote:


On any DOS based OS (that includes OS/2 and Windows), the ? wildcard
character will find any character, including no character at all in that
position. So in your example, t?.txt will find t.txt and tx.txt but not
txy.txt. It will not return any filename longer than your search mask,
but return shorter filenames. This is (should be) a functionality of the
underlying system calls.

Windows.FindFirstFile however treats ? as exactly 1 character AFAIK.
And is I'm not mistake this was also the case with TP in the old days.

I do not have a working DOS on my Windows 8.1 laptop here right now, but 
as long as I can remember, the ? as always a match for one or none, 
allowing for a shorter filename as the filemask to be returned. The only 
exception that comes to my mind though is a the combination of ??*.txt 
for example, which would return all filenames at least two characters long,

A quick test in a Windows 8.1 command prompt:

 Directory of C:\Users\Ralf\x

12/03/2014  12:50 PMDIR  .
12/03/2014  12:50 PMDIR  ..
12/03/2014  12:49 PM 3 a.txt
12/03/2014  12:49 PM 3 aa.txt
12/03/2014  12:49 PM 3 aaa.txt
12/03/2014  12:50 PM 3 b.txt
12/03/2014  12:50 PM 3 bb.txt
12/03/2014  12:50 PM 3 bbb.txt
12/03/2014  12:50 PM 3 c.txt
12/03/2014  12:50 PM 3 cc.txt
12/03/2014  12:50 PM 3 ccc.txt
   9 File(s) 27 bytes
   2 Dir(s)  324,408,578,048 bytes free

C:\Users\Ralf\xdir ?.txt
 Volume in drive C is TI10673200G
 Volume Serial Number is 5E9D-3D3F

 Directory of C:\Users\Ralf\x

12/03/2014  12:49 PM 3 a.txt
12/03/2014  12:50 PM 3 b.txt
12/03/2014  12:50 PM 3 c.txt
   3 File(s)  9 bytes
   0 Dir(s)  324,408,578,048 bytes free

C:\Users\Ralf\xdir ??.txt
 Volume in drive C is TI10673200G
 Volume Serial Number is 5E9D-3D3F

 Directory of C:\Users\Ralf\x

12/03/2014  12:49 PM 3 a.txt
12/03/2014  12:49 PM 3 aa.txt
12/03/2014  12:50 PM 3 b.txt
12/03/2014  12:50 PM 3 bb.txt
12/03/2014  12:50 PM 3 c.txt
12/03/2014  12:50 PM 3 cc.txt
   6 File(s) 18 bytes
   0 Dir(s)  324,408,573,952 bytes free

C:\Users\Ralf\x


























---
This email has been checked for viruses by Avast antivirus software.
http://www.avast.com

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


Re: [fpc-pascal] findfirst wildcards...

2014-12-03 Thread Ralf Quint

On 12/3/2014 2:09 PM, Bart wrote:
I don't dispute teh way cmd/command treats ? in dir, I merely stated 
that the OS function FindFirstFile des not do it like that. (And so we 
should not change FindFirst/FidNext behaviour.)
Well, I have no way/time to do a more extensive test right now, but I am 
certain that this is the way the OS function is working ever since DOS 
1.x, which was the first version of DOS I used back in late '81/early 
'82. And I can't recall ever to have a different behavior between the 
internal system call and the command line. (Well, internal system calls 
handling paths since DOS 2.0 allow for use of both / and \ as 
directory delimiter, while the DOS/Windows shell commonly does not).
The only time that I had to deal with a decisively different behavior is 
on any *ix derived OS, which since the beginning of time (as far as 
computers go) has handled wildcards and FindFirst kind of calls 
differently and this is the main differences in code that are necessary 
for a lot of cross-platform applications that I have been writing for 
the last +30 years...


Ralf



---
This email has been checked for viruses by Avast antivirus software.
http://www.avast.com

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


Re: [fpc-pascal] Illeagal assignment to For Loop variable in Free pascal

2014-06-18 Thread Ralf Quint

On 6/17/2014 7:54 PM, Jim Leonard wrote:
The error is because FreePascal optimizes loops wherever it can, and 
trying to modify the loop variable would break under that optimization.


While you could enable compilation flags to make things more TP 
compatible, looking at the code, I can see that the 'counter:=1' is 
just an early termination clause.  If the variable 'counter' isn't 
needed after that section, you could replace that line with 'break' 
which would exit the loop immediately (which is what the code does now).


On 6/17/2014 6:05 AM, mokashe.ram wrote:

Hi,

Could Any one help me for fixing below error in free pascal. as i am 
tring
to excute for loop in decemental order using 'DOWNTO' but its thwoing 
error
'Illeagal assignment to For Loop variable 'Counter' as this is 
possible in
TP but in Free pascal its not working so is there any workaround for 
this?


   FOR counter := 8 DOWNTO 1 DO
   IF filename[counter] = ' 'THEN
  DELETE(filename,counter,1)
   ELSE
   counter := 1;
A totally different solution and also more universal (not depending on 
the length of the filename to be exactly 8 characters long would be


   while ((Length (Filename)  0) AND (Filename (Length (Filename) = ' 
') do

   Delete (Filename, Length (Filename), 1);

or if you insist on using a separate integer variable

  Counter = Length (Filename);
  while (Counter  0) AND (Filename [Counter] = ' ') do
  begin
  Delete (Filename, Counter, 1);
  Dec (Counter);
  end;

Ralf

---
This email is free from viruses and malware because avast! Antivirus protection 
is active.
http://www.avast.com

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


Re: [fpc-pascal] Lazarus 1.2.2 Release

2014-04-25 Thread Ralf Quint
Just a minor issue,but when installing 1.2.2 over an existing 1.2.0 
(32bit on Windows 8.1 64bit), it did not properly set the path to the 
make file. Had to go on the first startup and browse to the binary in 
the fpc compiler bin folder, all other paths were set right...


Ralf

---
This email is free from viruses and malware because avast! Antivirus protection 
is active.
http://www.avast.com

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


Re: [fpc-pascal] lazarus not reachable

2014-04-06 Thread Ralf Quint

On 4/6/2014 8:17 PM, m...@rpzdesign.com wrote:

Ralf:

I am very sorry to bother you.

I will not make another request for information on this topic

Each time I started to try to pursue the matter earlier, I got some 
light responses, but never

was in a position to fully eliminate the problem.
Well, that problem, as I see it, is that you just keep looking for it in 
the wrong place/direction.
As Mark (waldo kitty) already mentioned, a traceroute doesn't 
necessarily mean anything, the type of data for such scans(ICMP/IGMP) is 
a lot of times these days filtered along the way.


Today, I tried to gather more information using comparative trace 
routes to solve the problem.

again, such traceroutes don't mean anything


Several other users have been very kind to share their trace routes 
failing but are still getting through using HTTP.


If this problem follows me to another internet cafe or public wi-fi, I 
will then try outside of my ISP area

or even leave the region to run a connection test.

All of my computers and tablets here fail, so is likely some silly ISP 
issue,

like C#//.NET developers at my ISP who filter all pascal traffic!!!
I am working all over town (Los Angeles, that's a pretty big 
town!LOL), from roughly a dozen different locations, with almost 
always different ISPs (Verizon, ATT, Time Warner, Time Warner Business, 
DSLExtreme, CBeyond,...) , types Internet connection (DSL, digital 
cable, FiOS, T1/ATM based, wireless broadband) and never had a problem 
reaching this site.


If you have tested from your own home/office location so far only, look 
in whatever firewall/router you have in place as the first possible 
culprit.  In an earlier post you showed the start of your traceroute,

  1 6 ms 1 ms1 ms 192.168.7.1
  2 1 ms1 ms1 ms  192.168.6.1
  335 ms24 ms16 ms cable-mac1.faptnyal-ar4003.nyroc.rr.com 
[66.66.72.1]
which indicates that you double NAT'ed before you hit the first router 
in the Roadrunner/TWC infrastructure in Rochester, NY.
That makes two local devices that can possibly interfering. Unless you 
start looking into those, at the very least to eliminate them as the 
source for your problem, you can compare other people's traceroutes all 
you want, you still will be looking at the wrong end...


Ralf


---
This email is free from viruses and malware because avast! Antivirus protection 
is active.
http://www.avast.com

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


Re: [fpc-pascal] fppoll/epoll examples/documentation

2014-03-22 Thread Ralf Quint

On 3/22/2014 5:43 PM, m...@rpzdesign.com wrote:
This may seem crazy, but I cannot find any documentation or examples 
on fppoll( ) and the events member of TFdPoll structure.


ALso, there is a epoll demo at forum.lazarus.*freepascal*.org
But I cannot ever reach that site from USA.

Works just fine from here... (Los Angeles/Santa Monica/San Fernando Valley)

Ralf


---
This email is free from viruses and malware because avast! Antivirus protection 
is active.
http://www.avast.com
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] $LINKLIB MSVCRT on windows

2014-03-10 Thread Ralf Quint

On 3/10/2014 7:23 AM, m...@rpzdesign.com wrote:

Ludo:

I wish the forum.lazarus.freepascal.org website were functional. It is 
usually not responding most of the time.


Must be an issue on your side, I can access it, at any time I have tried 
in the last few weeks, just perfectly fine...


Ralf

---
This email is free from viruses and malware because avast! Antivirus protection 
is active.
http://www.avast.com

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


  1   2   >