Re: [fpc-pascal] Vector code

2020-05-01 Thread Adriaan van Os

Zamrony P. Juhara via fpc-pascal wrote:
I found that this repository have some free ebooks about assembly but 
maybe not specific to vector code


Thanks for the links.


No, but you can ask questions here. I've done some minor x86_64 assembler work 
for image processing. Things like format conversions, uniform lighting, rotate, 
erosion/dilation etc.


Thanks for offering. I am particularly interested in knowing the tricks that can be done with 
masking, e.g. to prevent branching. In the first place to get an idea what can be done with vector 
code and what not. I guess I should  read the Intel and AMD processor docs first.


Regards,

Adriaan van Os

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


Re: [fpc-pascal] Pascal Language Server

2020-05-01 Thread Ryan Joseph via fpc-pascal


> On May 2, 2020, at 12:13 AM, Mattias Gaertner via fpc-pascal 
>  wrote:
> 
> By many functions in CodetoolBoss. Explore, FindDeclaration,
> FindReferences, GatherIdentifiers. All of them checks if a file have
> changed and rebuilds nodes. If no file/setting has changed, nodes are
> kept.

Found the problem. I overwrote "FirstChild" of TCodeTreeNode using a var param. 
oops! I still thought LoadFile should have rebuilt the node tree but it doesn't 
seem to do this (even if UpdateFromDisk and Revert params are set to true).

I'll post any new code tools questions to a new thread now and keep this one 
for the language server.

Regards,
Ryan Joseph

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


Re: [fpc-pascal] TFPGMap retrieving values

2020-05-01 Thread Marco van de Voort


Op 2020-05-01 om 20:15 schreef Sven Barth via fpc-pascal:
Ryan Joseph via fpc-pascal > schrieb am Fr., 1. Mai 2020, 
17:48:




> On May 1, 2020, at 10:18 PM, Sven Barth
mailto:pascaldra...@googlemail.com>>
wrote:
>
> If you need to decide which map to use I suggest you to look at
this benchmark page:
http://www.benibela.de/fpc-map-benchmark_en.html You can select
various of the maps that FPC supports (both ones distributed with
FPC and third party ones) and compare them.

and btw, why isn't there a TFPGHashList? I can't find one anyways.


Because none was needed. Fgl is mainly a demonstrator for the generic 
feature and nowadays mainly useful for smaller targets. The main 
suggestion is to use Collections.Generics and there the TDictionary 
class.


And don't forget to benchmark. If you test/search for existence of 
items, a faster hash that looks up faster but takes long to build and 
eats more memory might be counter productive.

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


Re: [fpc-pascal] TFPGMap retrieving values

2020-05-01 Thread Sven Barth via fpc-pascal
Ryan Joseph via fpc-pascal  schrieb am
Fr., 1. Mai 2020, 17:48:

>
>
> > On May 1, 2020, at 10:18 PM, Sven Barth 
> wrote:
> >
> > If you need to decide which map to use I suggest you to look at this
> benchmark page: http://www.benibela.de/fpc-map-benchmark_en.html You can
> select various of the maps that FPC supports (both ones distributed with
> FPC and third party ones) and compare them.
>
> and btw, why isn't there a TFPGHashList? I can't find one anyways.
>

Because none was needed. Fgl is mainly a demonstrator for the generic
feature and nowadays mainly useful for smaller targets. The main suggestion
is to use Collections.Generics and there the TDictionary class.

Regards,
Sven

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


Re: [fpc-pascal] Pascal Language Server

2020-05-01 Thread Mattias Gaertner via fpc-pascal
On Fri, 1 May 2020 21:32:24 +0700
Ryan Joseph via fpc-pascal  wrote:

> > On May 1, 2020, at 9:28 PM, Mattias Gaertner via fpc-pascal
> >  wrote:
> > 
> > "Explore" checks if some files have changed and if so rebuilds the
> > nodes.  
> 
> so I missed something fundamental! I used Explore because I noticed
> that I was able to get parser errors after calling it. When does the
> actual node tree get built then?

By many functions in CodetoolBoss. Explore, FindDeclaration,
FindReferences, GatherIdentifiers. All of them checks if a file have
changed and rebuilds nodes. If no file/setting has changed, nodes are
kept.

> I just want to load the file and
> step through the nodes like I explained earlier.

Maybe I misunderstand what "like I explained earlier" means. The thread
was pretty long.


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


Re: [fpc-pascal] TFPGMap retrieving values

2020-05-01 Thread Ryan Joseph via fpc-pascal


> On May 1, 2020, at 10:18 PM, Sven Barth  wrote:
> 
> If you need to decide which map to use I suggest you to look at this 
> benchmark page: http://www.benibela.de/fpc-map-benchmark_en.html You can 
> select various of the maps that FPC supports (both ones distributed with FPC 
> and third party ones) and compare them.

and btw, why isn't there a TFPGHashList? I can't find one anyways.

Regards,
Ryan Joseph

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


Re: [fpc-pascal] TFPGMap retrieving values

2020-05-01 Thread Ryan Joseph via fpc-pascal


> On May 1, 2020, at 10:18 PM, Sven Barth  wrote:
> 
> It is a map. It maps keys to values. Nowhere does it say how the map is 
> implemented.
> 
> If you need to decide which map to use I suggest you to look at this 
> benchmark page: http://www.benibela.de/fpc-map-benchmark_en.html You can 
> select various of the maps that FPC supports (both ones distributed with FPC 
> and third party ones) and compare them.

I thought it was a hash map! From the page:

"The array based TStringList and TFPGMap are the most memory efficient, using 
less memory than even the cuckoo maps. However, as they are not hash maps, 
their usage is extremely slow, even if the maps are sorted, so they are nearly 
useless as maps. Their default setting of unsorted and (in case of TStringList) 
case-insensitive matching are quite dangerous."

Regards,
Ryan Joseph

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


Re: [fpc-pascal] TFPGMap retrieving values

2020-05-01 Thread Sven Barth via fpc-pascal

Am 01.05.2020 um 16:12 schrieb Ryan Joseph via fpc-pascal:

I've been starting to use the RTL so I'm not very familiar with it but I 
thought TFPGMap was supposed to be a hash table for fast lookup, so why does 
TFPSMap.Find using a binary search instead of computing a hash key and indexing 
into the array like that? Is this not the type I should be using in the RTL for 
a generic hash table? What even is TFPGMap supposed to be if it isn't a hash 
table?


It is a map. It maps keys to values. Nowhere does it say how the map is 
implemented.


If you need to decide which map to use I suggest you to look at this 
benchmark page: http://www.benibela.de/fpc-map-benchmark_en.html You can 
select various of the maps that FPC supports (both ones distributed with 
FPC and third party ones) and compare them.


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


Re: [fpc-pascal] Pascal Language Server

2020-05-01 Thread Ryan Joseph via fpc-pascal


> On May 1, 2020, at 9:28 PM, Mattias Gaertner via fpc-pascal 
>  wrote:
> 
> "Explore" checks if some files have changed and if so rebuilds the
> nodes.

so I missed something fundamental! I used Explore because I noticed that I was 
able to get parser errors after calling it. When does the actual node tree get 
built then? I just want to load the file and step through the nodes like I 
explained earlier.

Regards,
Ryan Joseph

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


Re: [fpc-pascal] Pascal Language Server

2020-05-01 Thread Mattias Gaertner via fpc-pascal
On Fri, 1 May 2020 20:23:01 +0700
Ryan Joseph via fpc-pascal  wrote:

>[...]
> > What are you doing between calls of Explore?  
> 
> I'm walking the node tree and then using the Start/EndPos to read
> into the source text so that I can extract identifier. It's just:
> LoadFile, Explore, WalkTree. I didn't step through the debugger or
> anything but I assume the actual node structure   starting from
> Tool.Tree.Root changed.

"Explore" checks if some files have changed and if so rebuilds the
nodes.

 
> If that's not normal behavior I'll look harder and get into the
> debugger.

Mattias

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


[fpc-pascal] TFPGMap retrieving values

2020-05-01 Thread Ryan Joseph via fpc-pascal
I've been starting to use the RTL so I'm not very familiar with it but I 
thought TFPGMap was supposed to be a hash table for fast lookup, so why does 
TFPSMap.Find using a binary search instead of computing a hash key and indexing 
into the array like that? Is this not the type I should be using in the RTL for 
a generic hash table? What even is TFPGMap supposed to be if it isn't a hash 
table?

function TFPSMap.Find(AKey: Pointer; out Index: Integer): Boolean;
{ Searches for the first item <= Key, returns True if exact match,
  sets index to the index of the found string. }
var
  I,L,R,Dir: Integer;
begin
  Result := false;
  Index := -1;
  if not Sorted then
raise EListError.Create(SErrFindNeedsSortedList);
  // Use binary search.
  L := 0;
  R := FCount-1;
  while L<=R do
  begin
I := L + (R - L) div 2;
Dir := FOnKeyPtrCompare(Items[I], AKey);
if Dir < 0 then
  L := I+1
else begin
  R := I-1;
  if Dir = 0 then
  begin
Result := true;
if Duplicates <> dupAccept then
  L := I;
  end;
end;
  end;
  Index := L;
end;  

Regards,
Ryan Joseph

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


Re: [fpc-pascal] Vector code

2020-05-01 Thread Zamrony P. Juhara via fpc-pascal
I found that this repository have some free ebooks about assembly but maybe not 
specific to vector code
https://github.com/EbookFoundation/free-programming-books/blob/master/free-programming-books.md#assembly-language

I also wrote vector operation utility in assembly with SIMD in case you are 
interested
https://github.com/zamronypj/oprsimd

Zamrony P. Juhara
https://v3.juhara.com
https://github.com/zamronypj

Fano Framework
https://fanoframework.github.io

mod_pascal
https://zamronypj.github.io/mod_pascal 
 
  On Fri, May 1, 2020 at 16:25, Adriaan van Os wrote:   Can 
someone recommend a good book on writing (assembly) vector code ?

Thanks,

Adriaan van Os
___
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] Pascal Language Server

2020-05-01 Thread Ryan Joseph via fpc-pascal


> On May 1, 2020, at 4:55 PM, Mattias Gaertner via fpc-pascal 
>  wrote:
> 
> This thread is getting too long.
> 
> Can you please create new threads for new topics?

Sure. I'll respond now on this last question but I'll make new ones later if 
that's better for the list.

> 
> On Fri, 1 May 2020 16:27:46 +0700
> Ryan Joseph via fpc-pascal  wrote:
> 
>> Ok, got things working now. Here's the basic pattern I'm using. I
>> call explore and then walk the root tree node to find what I need but
>> i've noticed the 2nd time I do this I get less results than the first
>> time! What is happening?
> 
> What are you doing between calls of Explore?

I'm walking the node tree and then using the Start/EndPos to read into the 
source text so that I can extract identifier. It's just: LoadFile, Explore, 
WalkTree. I didn't step through the debugger or anything but I assume the 
actual node structure   starting from Tool.Tree.Root changed.

If that's not normal behavior I'll look harder and get into the debugger.

Regards,
Ryan Joseph

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


Re: [fpc-pascal] Pascal Language Server

2020-05-01 Thread Mattias Gaertner via fpc-pascal
On Wed, 29 Apr 2020 21:18:02 +0700
Ryan Joseph via fpc-pascal  wrote:

> Testing this more I'm having a problem getting overwhelmed by
> completions for classes because of methods from TObject (and other
> parents)

The RTL is powerful.
That's why I prefer to put recently used identifiers at top of the
completion box.


> so I'd like to add some information about this.
> 
> Using this method:
> 
> if CodeToolBoss.GatherIdentifiers(Code,X + 1,Y + 1) then
> begin
>   Count := CodeToolBoss.IdentifierList.GetFilteredCount;
>   for I := 0 to Count - 1 do
>   begin
> Identifier := CodeToolBoss.IdentifierList.FilteredItems[I];
> 
> 
> can I find the parent class of "Identifier"(TIdentifierListItem)?
> There's a TCodeTreeNode field that maybe I could walk up to find what
> I need?

Sure.
Something like:
while Node<>nil do begin
  if (Node.Desc=ctnClass) then begin
if Tool.ExtractClassName(Node),false)='TObject' then ...
break;
  end else
Node:=Node.Parent;
end;

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


Re: [fpc-pascal] Pascal Language Server

2020-05-01 Thread Mattias Gaertner via fpc-pascal
This thread is getting too long.

Can you please create new threads for new topics?

On Fri, 1 May 2020 16:27:46 +0700
Ryan Joseph via fpc-pascal  wrote:

> Ok, got things working now. Here's the basic pattern I'm using. I
> call explore and then walk the root tree node to find what I need but
> i've noticed the 2nd time I do this I get less results than the first
> time! What is happening?

What are you doing between calls of Explore?

> I assume it's caching something but do I
> need to reference the cache myself?
> 
>   Code := CodeToolBoss.LoadFile(Path,false,false);
>   if not CodeToolBoss.Explore(Code,Tool,false,false) then
> exit;
>   WalkTree(Tool.Tree.Root);

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


Re: [fpc-pascal] Vector code

2020-05-01 Thread Marco van de Voort


Op 2020-05-01 om 10:44 schreef Adriaan van Os:

Can someone recommend a good book on writing (assembly) vector code ?

No, but you can ask questions here. I've done some minor x86_64 
assembler work for image processing. Things like format conversions, 
uniform lighting, rotate, erosion/dilation etc.

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


Re: [fpc-pascal] Pascal Language Server

2020-05-01 Thread Ryan Joseph via fpc-pascal
Ok, got things working now. Here's the basic pattern I'm using. I call explore 
and then walk the root tree node to find what I need but i've noticed the 2nd 
time I do this I get less results than the first time! What is happening? I 
assume it's caching something but do I need to reference the cache myself?

  Code := CodeToolBoss.LoadFile(Path,false,false);
  if not CodeToolBoss.Explore(Code,Tool,false,false) then
exit;
  WalkTree(Tool.Tree.Root);


Regards,
Ryan Joseph

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


[fpc-pascal] Vector code

2020-05-01 Thread Adriaan van Os

Can someone recommend a good book on writing (assembly) vector code ?

Thanks,

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


Re: [fpc-pascal] Pascal Language Server

2020-05-01 Thread Ryan Joseph via fpc-pascal


> On May 1, 2020, at 2:42 PM, Mattias Gaertner via fpc-pascal 
>  wrote:
> 
> The Node.StartPos are referring to the Tool.Scanner.CleanedSrc, which is
> the code stripped of skipped $ifdef ranges and include files included.

That's what I was missing. Thanks again.

Regards,
Ryan Joseph

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


Re: [fpc-pascal] Question about compiling FPC trunk after revision 44849

2020-05-01 Thread Florian Klämpfl

Am 29.04.20 um 21:12 schrieb Marco van de Voort:


Op 2020-04-29 om 19:50 schreef Jonas Maebe:


Yes, but you cannot use "clean" and "all" in the same make invocation.
This was in fact never supported, and did not work on all platforms 
either.


So simply split it:

make -j 9 clean
make -j 9 all install

Does "clean" have a valid return value of make, or is it better ignored?


I run all of my scripts with set -e, so it should work.

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


Re: [fpc-pascal] Pascal Language Server

2020-05-01 Thread Mattias Gaertner via fpc-pascal
On Fri, 1 May 2020 12:31:26 +0700
Ryan Joseph via fpc-pascal  wrote:

> Stuck on another code tools problem.
> 
> I've been using code like this to find words at node offsets and this
> works well until there are $ifdefs in the file and then the text
> position getting offset and fail to return the correct identifiers.
> 
> GetIdentifier(@Code.Source[Node.StartPos]);

The Node.StartPos are referring to the Tool.Scanner.CleanedSrc, which is
the code stripped of skipped $ifdef ranges and include files included.

 
> How should this be resolved? I don't see there is a copy of the
> actual text parsed (without ifdefs) so I don't know how to reference
> the text that the parser actually used.

You can convert the cleanpos to actual file position using

Tool.CleanPosToCodePos

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


Re: [fpc-pascal] Porting from Turbo Pascal to FPC

2020-05-01 Thread Markus Greim
Hello,


I run Borland Pacal 7.01 in Dosemu / XdosEmu (don't use the 64bit binary) on 
Linux (Kernel 4.15, 64bit, Linux Mint 19.1, 16 CPUs...) here. 
Works fine, even the serial interface. At least for my experience, the printer 
doesn't work. 
So I "print" in a (shared) graphic file, and print then with Linux. 


Maybe LPT works now, I tested it last time about 10 years ago. 

Grüße


Markus

--- original message ---
On April 30, 2020, 11:27 AM GMT+2 xhaj...@hajny.biz wrote:

On 2020-04-30 10:29, Elmar Haneke wrote:

>> Am 29.04.20 um 10:42 schrieb Francisco Glover via fpc-pascal:

>>> Overt the years I have developed programs in Turbo Pascal for student

>>> lab use, in which the student can easily send to an attached printer

>>> contents of the text or VGA graphics screens. These no longer work on

>>> Windows 10. In shifting to FPC , certain key procedures which worked

>>> in Turbo Pascal running on Windows XP no longer work in FPC running on

>>> Windows 10. Samples are shown below:

>> 

>> The Problem depends more on moving from DOS to Windows than movong from

>> very old TP to FPC.

>> 

>> It might be an option to use DOSBox to run that old software.


> Indeed, the point of the original poster is not related to FPC versus TP 

> but rather porting low-level DOS access to other operating systems - FPC 

> would probably allow using these low-level constructs without problems 

> for the DOS target (either without changes with the 16-bit msdos target, 

> or with rather minor changes with the 32-bit GO32v2 target).


> Talking about DOSBox, things like printing may still not work very well 

> there, although there seem to be modified versions of DOSBox which may 

> have better support for this functionality according to a very quick 

> Google search. In any case, it's probably better to bite the bullet and 

> rewrite the low-level parts of that old application. The other option 

> might be running DOS in a full-featured virtualized environment (e.g. 

> VirtualBox).


> Tomas

> ___

> fpc-pascal maillist - fpc-pascal@lists.freepascal.org

> https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
--- end of original message ---___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal