Re: [fpc-pascal] Pascal Language Server

2020-04-30 Thread Ryan Joseph via fpc-pascal
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]);

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.

Regards,
Ryan Joseph

___
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-04-30 Thread Alexander Grotewohl
Not really sure how you would adapt this to your setup, but I threw this 
together from a project I did previously. I've only tested it with the Windows 
10 builtin XPS and PDF printers so I'm not sure how it will behave on a real 
printer.

(Hopefully the attachment makes it through..)

--
Alexander Grotewohl
https://dcclost.com

From: fpc-pascal  on behalf of 
Francisco Glover via fpc-pascal 
Sent: Wednesday, April 29, 2020 4:42 AM
To: fpc-pascal@lists.freepascal.org 
Cc: Francisco Glover 
Subject: [fpc-pascal] Porting from Turbo Pascal to FPC

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:
===
Program Sample;
{$ mode TP}
Uses Crt, Dos, Printer;
Var Regs: Registers;

 Procedure Print_screen;   { Interupt $05 }
   Begin
 Intr($05, Regs);
   End;   {Nothing printed, exit code= 0}

 Procedure Print_string;
  Begin
Writeln('Text Screen');
Writeln(LST, 'String to be printed');
  End;{nothing printed, system hangs}


 Procedure Print_characters;   {Intrupt $17, function 0,  char to printer}
 Var j: byte;
 Msg: String[2];
   Begin
 Msg :=  'A' + #11;{ #11 = formfeed  }
 For j := 1 to 2 do
Begin
  Regs.AH := 0;   {Function 0, output char}
  Regs.AL :=Ord(Msg[j]);
  Regs.DX := 0;   {default printer}
  Intr($17, Regs);
End;
   End;  {Nothing printed, exit code= 0}

 Procedure Print1Char; {Interupt $21, Fcn 5}
   Begin
 Regs.AH := 5; {print character}
 Regs.DL := 'A';
 MSDos(Regs);
 Regs.AH := 5; {print character}
 Regs.DL := #11;  {formfeed}
 MSDos(Regs);
   End;{Nothing printed, exit code= 0}

How can I have my FPC programs running on Windows 10 send text and graphics 
screens direct to an attached printer? Thank you



print.pas
Description: print.pas
___
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-04-30 Thread Tomas Hajny

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


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

2020-04-30 Thread Elmar Haneke

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.


Elmar


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


Re: [fpc-pascal] Converting http date back to TDateTime

2020-04-30 Thread Santiago A.

El 29/04/2020 a las 19:31, Zamrony P. Juhara via fpc-pascal escribió:
Yes, it works if I remove timezone part from pattern as suggested by 
Santiago. This one works


adatetime := scanDateTime(
     'ddd, dd mmm  hh:mm:ss',
     'Tue, 28 Apr 2020 10:11:12 GMT');

So i guess, we must convert timezone information to local timezone 
manually.


yes.
In unit Dateutils 
https://www.freepascal.org/docs-html/rtl/dateutils/index-5.html

You have a lot of handy functions:

function UniversalTimeToLocal(

  UT: TDateTime 



):TDateTime 
;


function UniversalTimeToLocal(

  UT: TDateTime 
;


  TZOffset: Integer 



):TDateTime 
;




function LocalTimeToUniversal(

  LT: TDateTime 



):TDateTime 
;


function LocalTimeToUniversal(

  LT: TDateTime 
;


  TZOffset: Integer 



):TDateTime 
;




function UniversalTimeToLocal(

  UT: TDateTime 



):TDateTime 
;


function UniversalTimeToLocal(

  UT: TDateTime 
;


  TZOffset: Integer 



):TDateTime 
;



function GetLocalTimeOffset: Integer 
;






Thank you

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 Wed, Apr 29, 2020 at 16:40, Santiago A.
 wrote:
___
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



--
Saludos

Santiago A.

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


[fpc-pascal] Porting from Turbo Pascal to FPC

2020-04-30 Thread 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:
===
Program Sample;
{$ mode TP}
Uses Crt, Dos, Printer;
Var Regs: Registers;

 Procedure Print_screen;   { Interupt $05 }
   Begin
 Intr($05, Regs);
   End;   {Nothing printed, exit code= 0}

 Procedure Print_string;
  Begin
Writeln('Text Screen');
Writeln(LST, 'String to be printed');
  End;{nothing printed, system hangs}


 Procedure Print_characters;   {Intrupt $17, function 0,  char to printer}
 Var j: byte;
 Msg: String[2];
   Begin
 Msg :=  'A' + #11;{ #11 = formfeed  }
 For j := 1 to 2 do
Begin
  Regs.AH := 0;   {Function 0, output char}
  Regs.AL :=Ord(Msg[j]);
  Regs.DX := 0;   {default printer}
  Intr($17, Regs);
End;
   End;  {Nothing printed, exit code= 0}

 Procedure Print1Char; {Interupt $21, Fcn 5}
   Begin
 Regs.AH := 5; {print character}
 Regs.DL := 'A';
 MSDos(Regs);
 Regs.AH := 5; {print character}
 Regs.DL := #11;  {formfeed}
 MSDos(Regs);
   End;{Nothing printed, exit code= 0}

How can I have my FPC programs running on Windows 10 send text and graphics
screens direct to an attached printer? Thank you
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal