Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2001-01

OS/2 program fails to run

3 messages · 1 person · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Unknown author

The following program compiles and runs using the Win 32 version of Free Pascal. However with the OS/2 version, the program compiles but fails to run. The program aborts with a SIGSEGV error.

I have all the current EMX libraries installed since I already need them for other programs.

Any thoughts?

Rolf Grunsky

This program was compiled both under OS/2 and Win 98 with the respective compilers. In both cases the compile was successful.

Program DayOfYear;
{$X-,V-}
Uses SysUtils, Math;
Var
  RightNow : TDateTime;
  SystemNow : TSystemTime;
  JdNow,
  JdThen : Float;
  RightNowString : AnsiString;
Function ToJulian(day, month, year : Integer) : Float;
Var
  a, b : Integer;
  c : Float;
Begin
  if year < 0 then c := 0.75
  else c := 0;
  if month < 3 Then
  Begin
    year := year - 1;
    month := month + 12;
  End;
  If (year > 1582) Or ((Year = 1582) And (month > 10)) Or ((Year = 1582)
and (month = 10) and (day > 15)) Then
  Begin
    a := Trunc(year / 100);
    b := 2 - a + Trunc(a / 4);
  End
  Else
  Begin
   a := 0;
   b := 0;
  End;
  ToJulian := Int((365.25 * year) - c) + Int(30.6001 * (month + 1)) +
day + 1720994.5 + b; End; { ToJulian }
Begin
  RightNow := Now;
  DecodeDate(RightNow, SystemNow.Year, SystemNow.Month, SystemNow.Day);
  With SystemNow Do JdNow := ToJulian(Day, Month, Year);
  With SystemNow Do JdThen := ToJulian(0, 1, Year);
  DateTimeToString(RightNowString, 'mmmm d y', RightNow);
  {Writeln(Format('Today %d/%d/%d is day %d of %d' , [ SystemNow.Day,
SystemNow.Month, SystemNow.Year, Trunc(JdNow- JdThen),
SystemNow.Year]));}
  Writeln(Format('Today (%s) is day %d of %d' , [ RightNowString,
Trunc(JdNow- JdThen), SystemNow.Year])); End.

Running under OS/2 -

[d:\projects\planets]ppc386 dayofyear
Free Pascal Compiler version 1.0.4 [2000/12/19] for i386 Copyright (c) 1993-2000 by Florian Klaempfl
Target OS: OS/2 via EMX
Compiling dayofyear.pas
dayofyear.pas(26,21) Hint: use DIV instead to get an integer result dayofyear.pas(27,26) Hint: use DIV instead to get an integer result Assembling dayofyear
Linking dayofyear
emxbind 0.9d -- Copyright (c) 1991-1997 by Eberhard Mattes 46 Lines compiled, 3.7 sec

[d:\projects\planets]dayofyear

Process terminated by SIGSEGV

[d:\projects\planets]

Running under Win 98 -

d:\projects\planets>dayofyear
Today (January 6 2001) is day 6 of 2001

d:\projects\planets>

----------------------------------------------------------- Remember, what you see coming at you is coming from you. "Jungle" Jack Flanders -----------------------------------------------------------
Unknown author
to Unknown author

From:
Date sent: Sat, 06 Jan 2001 13:32:02 -0500
To:
Subject: [fpc-pascal]OS/2 program fails to run Send reply to:

The following program compiles and runs using the Win 32 version of Free Pascal. However with the OS/2 version, the program compiles but fails to run. The program aborts with a SIGSEGV error.

I'll check it and let you know. I suspect it might be some problem with the OS/2 implementation of sysutils.

Tomas

Unknown author
to Unknown author: The following program compiles and runs using the Win 32 version of Free Pascal. However…

From:
Date sent: Sat, 06 Jan 2001 13:32:02 -0500
To:
Subject: [fpc-pascal]OS/2 program fails to run Send reply to:

The following program compiles and runs using the Win 32 version of Free Pascal. However with the OS/2 version, the program compiles but fails to run. The program aborts with a SIGSEGV error.

It's solved now (at least in sources within CVS - no snapshot is ready at the moment). It was a bug in the OS/2 version of SysUtils. Thanks again for your report - the more of them the better.

Tomas