[fpc-pascal]OS/2 program fails to run
rgrunsk at ibm.net
rgrunsk at ibm.net
Sat Jan 6 19:32:02 CET 2001
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>
--
-----------------------------------------------------------
rgrunsk at ibm.net Remember, what you see coming
at you is coming from you.
"Jungle" Jack Flanders
-----------------------------------------------------------
More information about the fpc-pascal
mailing list