[fpc-pascal] New FCL-CSS package in the GitLab repo

2022-03-27 Thread Alexey Torgashin via fpc-pascal

@Michael Van Canneyt
I didn't test but I hope this package can parse this _minified_ CSS 
file? Attached on the forum


https://forum.lazarus.freepascal.org/index.php/topic,58853.msg438550.html#msg438550

It has many tricks. E.g. @media blocks (@media supports nested blocks, 
not only 1 level), e.g. {} block for N classes, e.g. weird class names.


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


Re: [fpc-pascal] New FCL-CSS package in the GitLab repo

2022-03-27 Thread Alexey Torgashin via fpc-pascal

"*zoom", really ? That's not even valid CSS syntax.

I checked 2 EBNF grammars: neither will allow this. I checked the W3
spec: Confirms this is simply not valid syntax.


But "*.nnn" is valid one.
https://css-tricks.com/almanac/selectors/u/universal/

So if the "*" has meaning in one context, it is not the id-char, it is 
special construct.




Do you have the unminified file ?


nope.


treat as '* zoom' or as identifier '*zoom'


as "* zoom".

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


Re: [fpc-pascal] New FCL-CSS package in the GitLab repo

2022-03-28 Thread Alexey Torgashin via fpc-pascal
I will add some options to interpret "*zoom" as a property name, but 
they will

off by default.


OK thanks.
Can you try now with CSS (usual or minified) from
https://getbootstrap.com/ ?
See 'download' which gives file bootstrap-5.1.3-dist.zip .

Complex places:


.link-dark:hover, .link-dark:focus {
  color: #1a1e21;
}
//Here they have :suffixes.
---
  --bs-purple: #6f42c1;
  --bs-pink: #d63384;
//Here they have color varialbles.
---

.visually-hidden-focusable:not(:focus):not(:focus-within) {

a:not([href]):not([class]), a:not([href]):not([class]):hover {

button:not(:disabled),
[type=button]:not(:disabled),
[type=reset]:not(:disabled),
[type=submit]:not(:disabled) {
  cursor: pointer;
}

//Here they have weird boolean things.
---

*,
*::before,
*::after {
  box-sizing: border-box;
}
//Here they have star-chars.
---

  --bs-gradient: linear-gradient(180deg, rgba(255, 255, 255, 0.15), 
rgba(255, 255, 255, 0));

//They have complex func calls.
---

::-webkit-datetime-edit-year-field {
  padding: 0;
}
//More suffixes
---

From bootstrap-4.0.0-dist.zip I got also--
---

  abbr[title]::after {
content: " (" attr(title) ")";
  }
//strange value with 2 strings
---

.text-hide {
  font: 0/0 a;
  }
//strange value
---

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


Re: [fpc-pascal] New FCL-CSS package in the GitLab repo

2022-03-28 Thread Alexey Torgashin via fpc-pascal
Currently if I run "extractcssclasses" with Bootstrap 4 (or 5) CSS file 
(not minified) I get it work for more than 30 seconds, then I stopped 
it, too long.

Output file (parameter "--output=4.txt") not created.

CPU Core i3. Linux x64.
AT
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


[fpc-pascal] Improve TStringList.Text setter?

2022-05-05 Thread Alexey Torgashin via fpc-pascal

(I posted to the forum, but it's better to post here.)
TStringList.Text setter does this


Procedure TStrings.DoSetTextStr(const Value: string; DoClear : 
Boolean);

...
if FLineBreak=sLineBreak then
  begin
  While GetNextLine (Value,S,P) do
Add(S)
  end
else
  While GetNextLineBreak (Value,S,P) do
Add(S);
  finally
EndUpdate;
  end;
end;


here it calls GetNextLine which does SPECIAL handling of #10 and #13 and 
#13#10 line breaks. If it does special handling of #10 and #13 and 
#13#10 line breaks, why don't we check


  if (FLineBreak=#10) or (FLineBreak=#13) or (FLineBreak=#13#10)

but we do simple

 if FLineBreak=sLineBreak

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


Re: [fpc-pascal] Workaround for fpcres requiring absolute path

2022-06-27 Thread Alexey Torgashin via fpc-pascal

   TEMPLATE_UTILS_HEADER   RCDATA  "./resources/utils.h"


My .rc file has this line, so it seems sometimes relative path is 
supported:


tatbutton BITMAP "res\\tatbutton.bmp"

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


Re: [fpc-pascal] Workaround for fpcres requiring absolute path

2022-06-28 Thread Alexey Torgashin via fpc-pascal

   TEMPLATE_UTILS_HEADER   RCDATA  "./resources/utils.h"


I made an experiment with fresh fpcres compiled from source. It works 
even with your case! Ie with "./folder/filename". I created simple RC 
file, added there the line with "./folder/a.bmp", added BMP file in that 
folder, called fpcres using its full-path, all compiled OK.

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


Re: [fpc-pascal] TFPHTTPServer and HTTPS

2022-08-23 Thread Alexey Torgashin via fpc-pascal

You need to set your certificate details as well:
  fServer.UseSSL := fUseSSL;


I just saved this info to wiki: 
https://wiki.freepascal.org/fphttpserver#Support_for_HTTPS

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


Re: [fpc-pascal] SerReadTimeout question

2022-09-19 Thread Alexey Torgashin via fpc-pascal
I wrote this info to new page https://wiki.freepascal.org/Serial_unit , 
welcome to add more info there.

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


Re: [fpc-pascal] Pause Key

2023-04-14 Thread Alexey Torgashin via fpc-pascal

if Key=VK_PAUSE then
begin
 do_something;
 Key:=0;
end;


Yes. And I tested the Pause/Break key in the Lazarus program CudaText. I 
can assign the key to any action (in the Command Palette, press F9), and 
it works then. E.g. action "toggle statusbar" works then.


ShortcutToText() for this key shows "Break".
Alex
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Is there a Pos() function for TBytes?

2023-04-20 Thread Alexey Torgashin via fpc-pascal


function PosInBytes(const Pattern: byte; Target: TBytes): integer;


Let's use IndexByte standard procedure here?
Maybe also in the 1st overloaded code too?
Alex
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


[fpc-pascal] SeekEof issue & 2020 blog post by A Stolyarov

2023-09-11 Thread Alexey Torgashin via fpc-pascal
Translation of blog post http://www.stolyarov.info/node/290 from Ru to 
En.

Sep 6 2020.
Author: Andrey Stolyarov, author of Ru books about programming.

==
I'm trying to convince FPC men to finally fix SeekEof:
https://forum.lazarus.freepascal.org/index.php/topic,51353.0.html

Tellingly, I even sent them a fix. Proven fix, Carl! One strange man has 
already run in (Jonas Maebe). It feels like receiving replies from 
officials. I wonder if everyone is like that, or is there still a 
reasonable person? Or maybe I got into the wrong place, I don't need to 
go to the forum, but immediately to the bugtracker?


UPD: I reported in the bug tracker: 
https://bugs.freepascal.org/view.php?id=37716 ( 
https://gitlab.com/freepascal.org/fpc/source/-/issues/37716 ) Place your 
bets, I'll still have to write in the new edition of the book that the 
numbers from the text stream can be read correctly only 
character-by-character, or they will fix it.


UPD2: I received a response from someone in the bug tracker. I made a 
patch according to their rules. Submit. We stock up on popcorn.


UPD3: Christmas trees, where do such people come from and how is Free 
Pascal still alive with such a team?! And, most importantly, what to do 
now? I'm sorry, I won't be able to fork this monster, it's easier to 
write my own Pascal compiler, but it's not for one year of work.


UPD4: https://bugs.freepascal.org/view.php?id=37833 ( 
https://gitlab.com/freepascal.org/fpc/source/-/issues/37833 )- now we 
will convince them to fix the consequences of their fix, which "fixes" 
what is not broken. By God, if it weren't for the fact that there are 
simply no other implementations of Pascal, I would have spat on these 
comrades a long time ago. Sometimes it is easier for students (and what 
is there sometimes, just almost always) to explain what and how than to 
this stubborn character. This time, it's a little worse that I can't 
provide a ready-made patch - well, I probably can, but there are damn 
changes in git, it will be difficult to isolate among them those that 
this alternatively professional comrade made.


In the comments of that post:

Q (reader): Judging by the state of the ticket, has success been 
achieved?
A (Stolyarov): To be honest, it's not clear - you'll have to pull out a 
snapshot and see. I really hope that this Tomas Hajny didn't understand 
what happens when you open a text stream and ended up not being able to 
do what he wanted to do -- cut off buffering for anything that isn't a 
file. If he succeeded, then "the victory has some strange taste" - 
SeekEof seems to have been fixed to us, but in general it has become 
even worse than before. To be honest, I didn't expect to encounter such 
a level of militant ignorance.
UPD: I looked. So yes. I don't even know what's worse - what happened 
before this "fix" or what happened after. It is quite difficult to do 
without the correct SeekEof, but you can - for example, read everything 
character by character and translate numbers with pens. But when 
buffering is turned off for output, it is impossible to turn it on from 
inside the program, no means are provided for this. The devil knows 
what.

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


Re: [fpc-pascal] fcl-pdf custom font from memstream

2023-11-02 Thread Alexey Torgashin via fpc-pascal




How to load a custom font from a stream instead of from a file?


Currently no way to my knowledge,


But fpparsettf.pp has this:

  TTFFileInfo = class(TObject)
  ...
  public
// Load a TTF file from file or stream.
Procedure LoadFromFile(const AFileName : String);
Procedure LoadFromStream(AStream: TStream); virtual;
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal