Re: [fpc-pascal] Food for thought - language string improvement

2017-07-09 Thread Graeme Geldenhuys

Hi,

I've give a short reply here, in case others deem this off-topic. I 
always seem to end up in hot water about such stuff here. I can send you 
more details in private if need be.


On 2017-07-09 22:16, Michael Van Canneyt wrote:

Would it be possible to give examples ?
Maybe there are things that can be done in Lazarus, and Pascal ?


Some IDE examples I have already raised in recent weeks in the Lazarus 
forum. The Java IDE's are *way* more clever about what code you wrote 
and makes very intelligent suggestions when it discovers errors, or 
possible improvements (eg: because you are using a newer Java version 
that might have an improved solution). In Eclipse, Ctrl+1 will list the 
options, give you a tooltip hint of how the changed code will look 
(before any changes are made). Make your pick and press enter. Those 
could be fixing errors, improved language features, pull in missing 
import lines, implement getters and setters, define missing classes, 
field variables or local variables etc. The list of what is on offer is 
massive.


Purely on the language side of things I love the fact that there is 
no *.h or an "interface section" in my code - why must C/C++ and Object 
Pascal duplicate that information. If I want to see a purely "interface" 
view of my code, the IDE doesn't that as standard in the unit Outline 
window.


As I said, just a short list here, but I can list many more if you want 
- both IDE features and language features.


Regards,
  Graeme

--
fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
http://fpgui.sourceforge.net/

My public PGP key:  http://tinyurl.com/graeme-pgp
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Food for thought - language string improvement

2017-07-09 Thread Michael Van Canneyt



On Sun, 9 Jul 2017, Graeme Geldenhuys wrote:


On 2017-07-08 07:57, Felipe Monteiro de Carvalho wrote:

Since we are talking about language features, after learning Java I
think we could use in Pascal:


I must say, after using Java more and more in recent months, it starts 
to show why so many developers call Delphi/Object Pascal out of date. [I 
never thought I would ever say that - I have a real soft spot for Object 
Pascal]


The Java language has some awesome features and much less typing is 
required - yet not as cryptic as C/C++. The Java IDEs (primarily Eclipse 
and IntelliJ IDEA) also blow Lazarus and MSEide out of the water - but 
then they have a ton more resources at their disposal). Either way, 
those IDEs are a real pleasure to work with, and have so many programmer 
friendly features.


Would it be possible to give examples ?
Maybe there are things that can be done in Lazarus, and Pascal ?

I'm doing some work in a Java environment  myself lately, and I must 
say I have not noticed anything of these 'language features'. 
Lots of useful libraries, yes.  There I will not argue.


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

Re: [fpc-pascal] Food for thought - language string improvement

2017-07-09 Thread Graeme Geldenhuys

On 2017-07-08 07:57, Felipe Monteiro de Carvalho wrote:

Since we are talking about language features, after learning Java I
think we could use in Pascal:


I must say, after using Java more and more in recent months, it starts 
to show why so many developers call Delphi/Object Pascal out of date. [I 
never thought I would ever say that - I have a real soft spot for Object 
Pascal]


The Java language has some awesome features and much less typing is 
required - yet not as cryptic as C/C++. The Java IDEs (primarily Eclipse 
and IntelliJ IDEA) also blow Lazarus and MSEide out of the water - but 
then they have a ton more resources at their disposal). Either way, 
those IDEs are a real pleasure to work with, and have so many programmer 
friendly features.


Regards,
  Graeme

--
fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
http://fpgui.sourceforge.net/

My public PGP key:  http://tinyurl.com/graeme-pgp
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Food for thought - language string improvement

2017-07-09 Thread Graeme Geldenhuys

On 2017-07-06 17:52, Marco van de Voort wrote:

''' already has meaning, you'll see that


The 3 quotes were simply an idea. You correctly identified that it is 
already used is some special cases, so then simply replace it with some 
other unique syntax that is not used yet. As Z505 mentioned, even the 
back-tick symbol should be a good option, and not used by Object Pascal 
syntax yet. For simpler typing, seeing as not all keyboard layouts seem 
to have the back-tick readily available, maybe the quote-quote could be 
used - as far as I know Object Pascal doesn't use that yet. But if I had 
to choose between the two, I would opt for the back-tick as it is more 
clearly distinguishable.


Regards,
  Graeme

--
fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
http://fpgui.sourceforge.net/

My public PGP key:  http://tinyurl.com/graeme-pgp
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Fixed record files

2017-07-09 Thread James Richters
Thanks for the link.   For best compatibility should I make it:

 

Type

  DrawCMD = Packed Record

   GC: Word;

   PX,PY,PZ,GX,GY,GZ,GI,GJ,R,SA,EA:Double;

End;

 

 

Or 

 

Type

 {$PackRecords 2}   
  DrawCMD =  Record

   GC: Word;

   PX,PY,PZ,GX,GY,GZ,GI,GJ,R,SA,EA:Double;

End;

 {$PackRecords default}

 

Or am I not understanding this correctly?

 

James

 

From: fpc-pascal [mailto:fpc-pascal-boun...@lists.freepascal.org] On Behalf Of 
Vojtech Cihák
Sent: Sunday, July 09, 2017 2:44 PM
To: FPC-Pascal users discussions 
Subject: Re: [fpc-pascal] Fixed record files

 

Hi,

 

"packed record" is for compatibility. Its guaranteed that inner alignment and 
size of record will be always the same and will not change in future versions 
of compiler, unlike the plain "record".

 

https://www.freepascal.org/docs-html/ref/refsu15.html

 

V.

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

Re: [fpc-pascal] Fixed record files

2017-07-09 Thread Vojtěch Čihák

Hi,
 
"packed record" is for compatibility. Its guaranteed that inner alignment and size of 
record will be always the same and will not change in future versions of compiler, unlike the plain 
"record".
 
https://www.freepascal.org/docs-html/ref/refsu15.html
 
V.
__

Od: "James Richters" 
Komu: "'FPC-Pascal users discussions'" 
Datum: 09.07.2017 20:12
Předmět: Re: [fpc-pascal] Fixed record files



I don't understand "packed record" could you elaborate?

James

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

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

Re: [fpc-pascal] Fixed record files

2017-07-09 Thread James Richters
I prefer performance over size, The only reason 'GC' was a byte was because it 
didn't really need to be a word, however it wouldn't hut to be a word anyway, 
so I could just use this:

Type
  DrawCMD = Record
   GC: Word;
   PX,PY,PZ,GX,GY,GZ,GI,GJ,R,SA,EA:Double;
End;

I don't understand "packed record" could you elaborate?

James
-Original Message-
From: fpc-pascal [mailto:fpc-pascal-boun...@lists.freepascal.org] On Behalf Of 
Ched
Sent: Sunday, July 09, 2017 12:01 PM
To: FPC-Pascal users discussions 
Subject: Re: [fpc-pascal] Fixed record files

Hello,

I'll try something like

If filesize(drawfile)>0 then
Seek(drawfile, sizeof(drawfile)-1)
else
"empty file";

For portability of you file and software, I recommand you to use a "packed 
record" with an internal forced word-align of the double data. If size matters, 
no need to align.

Type
  DrawCMD = Record

   GC: Byte;
   __: byte; { no use axcept to force align on words for 
speed on certain systems }

   PX,PY,PZ,GX,GY,GZ,GI,GJ,R,SA,EA:Double;

End;

This can also be uses for memory access, as on some processors, word aligning 
data can save some cpu cycles with reference to non aligned data for data 
longer than one byte/char.

Chers, Ched




Le 09.07.2017 à 13:45, James Richters a écrit :
> I have a few questions about fixed record files.  I have the following:
> 
> Type
> 
> DrawCMD = Record
> 
>  GC: Byte;
> 
>  PX,PY,PZ,GX,GY,GZ,GI,GJ,R,SA,EA:Double;
> 
>   End;
> 
> Var
> 
>DrawFile: File Of DrawCMD;
> 
>Drawinfo: DrawCMD;
> 
> I wish to get to the end of the file and read the last record.  Currently I 
> am doing it like this:
> 
>   Reset(DrawFile);
> 
>   while not eof(DrawFile) do
> 
>  begin
> 
> Read(DrawFile,DrawInfo);
> 
>  End;
> 
> When this finishes Drawinfo contains the last record of the file.  But 
> I’m wondering if there is a better way since it’s a file of fixed records.
> 
> I’m also wondering if there is a way to insert a record at the 
> beginning of the file, or in the middle of the file without doing 
> something like copying the entire file to a temp file, then re-writing the 
> entire new file in the desired order?
> 
> James
> 
> 
> 
> ___
> fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org 
> http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
> 

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

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

Re: [fpc-pascal] Fixed record files

2017-07-09 Thread Ched

Hello,

I'll try something like

If filesize(drawfile)>0 then
   Seek(drawfile, sizeof(drawfile)-1)
else
   "empty file";

For portability of you file and software, I recommand you to use a "packed record" with an internal 
forced word-align of the double data. If size matters, no need to align.


Type
 DrawCMD = Record

  GC: Byte;
  __: byte; { no use axcept to force align on words for 
speed on certain systems }

  PX,PY,PZ,GX,GY,GZ,GI,GJ,R,SA,EA:Double;

   End;

This can also be uses for memory access, as on some processors, word aligning data can save some cpu 
cycles with reference to non aligned data for data longer than one byte/char.


Chers, Ched




Le 09.07.2017 à 13:45, James Richters a écrit :

I have a few questions about fixed record files.  I have the following:

Type

DrawCMD = Record

 GC: Byte;

 PX,PY,PZ,GX,GY,GZ,GI,GJ,R,SA,EA:Double;

  End;

Var

   DrawFile: File Of DrawCMD;

   Drawinfo: DrawCMD;

I wish to get to the end of the file and read the last record.  Currently I am 
doing it like this:

  Reset(DrawFile);

  while not eof(DrawFile) do

 begin

Read(DrawFile,DrawInfo);

 End;

When this finishes Drawinfo contains the last record of the file.  But I’m wondering if there is a better 
way since it’s a file of fixed records.


I’m also wondering if there is a way to insert a record at the beginning of the file, or in the middle of 
the file without doing something like copying the entire file to a temp file, then re-writing the entire 
new file in the desired order?


James



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



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

[fpc-pascal] Fixed record files

2017-07-09 Thread James Richters
I have a few questions about fixed record files.  I have the following:

 

Type

   DrawCMD = Record

GC: Byte;

PX,PY,PZ,GX,GY,GZ,GI,GJ,R,SA,EA:Double;

 End;

Var

  DrawFile: File Of DrawCMD;

  Drawinfo: DrawCMD;

 

 

I wish to get to the end of the file and read the last record.  Currently I
am doing it like this:

 

 Reset(DrawFile);

 while not eof(DrawFile) do

begin

   Read(DrawFile,DrawInfo);

End;

 

When this finishes Drawinfo contains the last record of the file.  But I'm
wondering if there is a better way since it's a file of fixed records.

 

I'm also wondering if there is a way to insert a record at the beginning of
the file, or in the middle of the file without doing something like copying
the entire file to a temp file, then re-writing the entire new file in the
desired order?

 

James

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

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

2017-07-09 Thread Michael Van Canneyt


Forwarded at request of fra...@rhost.it:



On Fri, 7 Jul 2017, nore...@z505.com wrote:

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


An alternative unit in i386 assembler and base 2^32 for big integers:
http://spazioinwind.libero.it/frm/software/bigint.zip

Here there is also a floating-point multiprecision unit up to 5000 digits:
http://spazioinwind.libero.it/frm/software/mpcalc-7.4.zip

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