943,871 Members | Top Members by Rank

Ad:
You are currently viewing page 1 of this multi-page discussion thread
Aug 3rd, 2009
0

[TurboPascal, Dev-Pas, Free-Pascal] problem with longint and unexpected end of file

Expand Post »
Hello!

I was looking for the answer here but I couldn't find: http://www.freepascal.org/port.var .

I've got old code in Turbo Pascal and I try to run it on Dev-Pascal 1.9.2. (I also tried Lazarus application, but there was "Error. Project raised exception class 'External: SIGSEGV'.").

Pascal and Delphi Syntax (Toggle Plain Text)
  1. Free Pascal Compiler version 1.0.6 [2002/04/23] for i386
  2. Copyright (c) 1993-2002 by Florian Klaempfl
  3. Target OS: Win32 for i386
  4. Compiling f:\intern\26turb~1\program\main1.pas
  5. main1.pas(1,2) Warning: Unsupported switch $N
  6. Compiling main2.pas
  7. main2.pas(1,2) Warning: Unsupported switch $N
  8. main2.pas(308,15) Error: call by var parameters have to match exactly: Got LONGINT expected SMALLINT
  9. main2.pas(645,76) Warning: Comment level 2 found
  10. main2.pas(843,3) Warning: Comment level 2 found
  11. main2.pas(643,2) Fatal: Unexpected end of file

I look at these two lines:
Pascal and Delphi Syntax (Toggle Plain Text)
  1. 308: InitGraph(ster,tryb,path);
  2. 52: ster:integer=VGA;

I changes line 52.
Pascal and Delphi Syntax (Toggle Plain Text)
  1. 52: ster:smallint=VGA;
I also tried:
Pascal and Delphi Syntax (Toggle Plain Text)
  1. 52: ster:shortint=VGA;
But neither of them can help and there's all the time the same error: Got LONGINT expected SMALLINT.

And the other thing, that is "unexpected end of file".
End of the file is as follows:
Pascal and Delphi Syntax (Toggle Plain Text)
  1. Resume
  2. end
  3. end;
  4.  
  5.  
  6. end .

How to get rid of those two errors?

Greetings!
Similar Threads
Reputation Points: 10
Solved Threads: 0
Light Poster
johnyjj2 is offline Offline
27 posts
since Jul 2009
Aug 3rd, 2009
0

Re: [TurboPascal, Dev-Pas, Free-Pascal] problem with longint and unexpected end of file

end . should be end. (remove the space)

Not sure about the first error. Could it be triggered by the $N switch error ? Look for {$N} and remove it (at the top).
Sponsor
Featured Poster
Reputation Points: 550
Solved Threads: 731
Bite my shiny metal ass!
pritaeas is offline Offline
4,177 posts
since Jul 2006
Aug 3rd, 2009
0

Re: [TurboPascal, Dev-Pas, Free-Pascal] problem with longint and unexpected end of file

Thanks!
I got rid of the first problem - it was because Dev-Pascal treats integer as longint and shortint as integer.
I removed the spacebar before dot. Now it looks like this
Pascal and Delphi Syntax (Toggle Plain Text)
  1. Infos;
  2. Resume
  3. end
  4. end;
  5. end.
But the error is the same :-(.
Greetings!
Reputation Points: 10
Solved Threads: 0
Light Poster
johnyjj2 is offline Offline
27 posts
since Jul 2009
Aug 3rd, 2009
0

Re: [TurboPascal, Dev-Pas, Free-Pascal] problem with longint and unexpected end of fi

OK, I got rid of those two problems. Now I've got new errors to debug .

line number 881 contains:
Pascal and Delphi Syntax (Toggle Plain Text)
  1. 200: window(1,1,80,25); ClrScr;

errors:
Pascal and Delphi Syntax (Toggle Plain Text)
  1. Free Pascal Compiler version 1.0.6 [2002/04/23] for i386
  2. Copyright (c) 1993-2002 by Florian Klaempfl
  3. Target OS: Win32 for i386
  4. Compiling f:\dev-pas\program\main.pas
  5. trc.pas(1,2) Warning: Unsupported switch $N
  6. trc.pas(401,5) Note: Local variable EM1 not used
  7. trc.pas(881,1) Error: Identifier not found 200
  8. trc.pas(881,4) Error: Illegal expression
  9. trc.pas(881,4) Fatal: Syntax error, ; expected but : found

It looks like I cannot use names (or rather numbers - 200) to indicate something in the code which are then reached by goto or something like this. How to get rid of this error :-)?

I tried to erase that
Pascal and Delphi Syntax (Toggle Plain Text)
  1. 200:
so there was left
Pascal and Delphi Syntax (Toggle Plain Text)
  1. window(1,1,80,25); ClrScr;
but it caused other error:
Pascal and Delphi Syntax (Toggle Plain Text)
  1. Free Pascal Compiler version 1.0.6 [2002/04/23] for i386
  2. Copyright (c) 1993-2002 by Florian Klaempfl
  3. Target OS: Win32 for i386
  4. Compiling f:\dev-pas\program\main1.pas
  5. trc.pas(1,2) Warning: Unsupported switch $N
  6. trc.pas(401,5) Note: Local variable EM1 not used
  7. trc.pas(882,1) Error: Label used but not defined 0200
  8. trc.pas(1749,11) Fatal: Syntax error, identifier expected but LIBRARY found

Greetings!
Last edited by johnyjj2; Aug 3rd, 2009 at 8:41 am. Reason: I got rid of previous errors but there is new one :-)
Reputation Points: 10
Solved Threads: 0
Light Poster
johnyjj2 is offline Offline
27 posts
since Jul 2009
Aug 3rd, 2009
0

Re: [TurboPascal, Dev-Pas, Free-Pascal] problem with longint and unexpected end of file

Correct. Labels must start with a character, not a number. Add a prefix to the 200, like:

label200:

and change the references in the code.
Sponsor
Featured Poster
Reputation Points: 550
Solved Threads: 731
Bite my shiny metal ass!
pritaeas is offline Offline
4,177 posts
since Jul 2006
Aug 3rd, 2009
0

Re: [TurboPascal, Dev-Pas, Free-Pascal] problem with longint and unexpected end of file

Thanks!
I changed twice in the code 200 into lab200. Now I've got the following errors:
Pascal and Delphi Syntax (Toggle Plain Text)
  1. Free Pascal Compiler version 1.0.6 [2002/04/23] for i386
  2. Copyright (c) 1993-2002 by Florian Klaempfl
  3. Target OS: Win32 for i386
  4. Compiling f:\dev-pas\trackal\trc.pas
  5. trc.pas(1,2) Warning: Unsupported switch $N
  6. trc.pas(401,5) Note: Local variable EM1 not used
  7. trc.pas(882,1) Error: Label used but not defined LAB200
  8. trc.pas(1749,11) Fatal: Syntax error, identifier expected but LIBRARY found
It is weird because in the line 733 I've got now:
Pascal and Delphi Syntax (Toggle Plain Text)
  1. label lab200;
Lines 881 & 882 are as follows:
Pascal and Delphi Syntax (Toggle Plain Text)
  1. window(1,1,80,25); ClrScr;
  2. end;
Greetings!
Reputation Points: 10
Solved Threads: 0
Light Poster
johnyjj2 is offline Offline
27 posts
since Jul 2009
Aug 3rd, 2009
0

Re: [TurboPascal, Dev-Pas, Free-Pascal] problem with longint and unexpected end of file

Whitespace between the keyword end and the period is not significant.

Perhaps you should post more code? It is hard to diagnose what is wrong.

With FPC, you must be sure to have the {$goto on} directive enabled.

I don't think that the $N directive is used in FPC -- the FPC uses native floating-point types -- there is no need to ask for them or emulate them.
Featured Poster
Reputation Points: 1140
Solved Threads: 229
Postaholic
Duoas is offline Offline
2,039 posts
since Oct 2007
Aug 4th, 2009
0

Re: [TurboPascal, Dev-Pas, Free-Pascal] problem with longint and unexpected end of file

All results of "200", "label" and "goto":
Pascal and Delphi Syntax (Toggle Plain Text)
  1. 732: procedure axesimu;
  2. 733: label 0200;
  3. 744: case vv of
  4. 747: 3: Goto 0200;
  5. 881: 200: window(1,1,80,25); ClrScr;
  6. 884: procedure TwoAxles;
  7. 885:label 100;
  8. 1025: if (zn='N') or (zn='n') then goto 100;

Without any changes:
Pascal and Delphi Syntax (Toggle Plain Text)
  1. Free Pascal Compiler version 1.0.6 [2002/04/23] for i386
  2. Copyright (c) 1993-2002 by Florian Klaempfl
  3. Target OS: Win32 for i386
  4. Compiling f:\dev-pas\trackal\02trc~1.pas
  5. 02trc~1.pas(1,2) Warning: Unsupported switch $N
  6. 02trc~1.pas(401,5) Note: Local variable EM1 not used
  7. 02trc~1.pas(881,1) Error: Identifier not found 200
  8. 02trc~1.pas(881,4) Error: Illegal expression
  9. 02trc~1.pas(881,4) Fatal: Syntax error, ; expected but : found

After adding to the second line {$GOTO ON}
Pascal and Delphi Syntax (Toggle Plain Text)
  1. Free Pascal Compiler version 1.0.6 [2002/04/23] for i386
  2. Copyright (c) 1993-2002 by Florian Klaempfl
  3. Target OS: Win32 for i386
  4. Compiling f:\dev-pas\trackal\02trc~1.pas
  5. 02trc~1.pas(1,2) Warning: Unsupported switch $N
  6. 02trc~1.pas(402,5) Note: Local variable EM1 not used
  7. 02trc~1.pas(882,1) Error: Identifier not found 200
  8. 02trc~1.pas(882,4) Error: Illegal expression
  9. 02trc~1.pas(882,4) Fatal: Syntax error, ; expected but : found

After changing from
Pascal and Delphi Syntax (Toggle Plain Text)
  1. 200: window(1,1,80,25); ClrScr;
to
Pascal and Delphi Syntax (Toggle Plain Text)
  1. window(1,1,80,25); ClrScr;
compilation errors:
Pascal and Delphi Syntax (Toggle Plain Text)
  1. Free Pascal Compiler version 1.0.6 [2002/04/23] for i386
  2. Copyright (c) 1993-2002 by Florian Klaempfl
  3. Target OS: Win32 for i386
  4. Compiling f:\dev-pas\trackal\02trc~1.pas
  5. 02trc~1.pas(1,2) Warning: Unsupported switch $N
  6. 02trc~1.pas(402,5) Note: Local variable EM1 not used
  7. 02trc~1.pas(883,1) Error: Label used but not defined 0200
  8. 02trc~1.pas(1750,11) Fatal: Syntax error, identifier expected but LIBRARY found

After changing into:
Pascal and Delphi Syntax (Toggle Plain Text)
  1. label 200; window(1,1,80,25); ClrScr;
errors:
Pascal and Delphi Syntax (Toggle Plain Text)
  1. Free Pascal Compiler version 1.0.6 [2002/04/23] for i386
  2. Copyright (c) 1993-2002 by Florian Klaempfl
  3. Target OS: Win32 for i386
  4. Compiling f:\dev-pas\trackal\02trc~1.pas
  5. 02trc~1.pas(1,2) Warning: Unsupported switch $N
  6. 02trc~1.pas(402,5) Note: Local variable EM1 not used
  7. 02trc~1.pas(882,8) Error: Illegal expression
  8. 02trc~1.pas(882,8) Error: Illegal expression
  9. 02trc~1.pas(882,8) Fatal: Syntax error, ; expected but ordinal const found

After changing into
Pascal and Delphi Syntax (Toggle Plain Text)
  1. window(1,1,80,25); ClrScr;
And changing 734:
label 0200;
into
label lab200;
And 748:
3: Goto 0200;
into
3: Goto lab200;
And 886:
label 100;
into
label lab100;
And 1026:
if (zn='N') or (zn='n') then goto 100;
into
if (zn='N') or (zn='n') then goto lab100;
And 1069
100: ClrScr;
into
label lab100; ClrScr;
The errors:
Pascal and Delphi Syntax (Toggle Plain Text)
  1. Free Pascal Compiler version 1.0.6 [2002/04/23] for i386
  2. Copyright (c) 1993-2002 by Florian Klaempfl
  3. Target OS: Win32 for i386
  4. Compiling f:\dev-pas\trackal\02trc~1.pas
  5. 02trc~1.pas(1,2) Warning: Unsupported switch $N
  6. 02trc~1.pas(402,5) Note: Local variable EM1 not used
  7. 02trc~1.pas(883,1) Error: Label used but not defined LAB200
  8. 02trc~1.pas(1069,7) Error: Illegal expression
  9. 02trc~1.pas(1069,7) Error: Illegal expression
  10. 02trc~1.pas(1069,7) Fatal: Syntax error, ; expected but identifier LAB100 found

Greetings!
Reputation Points: 10
Solved Threads: 0
Light Poster
johnyjj2 is offline Offline
27 posts
since Jul 2009
Aug 4th, 2009
0

Re: [TurboPascal, Dev-Pas, Free-Pascal] problem with longint and unexpected end of file

Turbo pascal 7.0.
Labels' identifier can be numbers from 0 to 9999,and any name that can be an identifier...
Free Pascal
A label is a name for a location in the source code to which can be jumped from another location
with a Goto statement. Labels can be digit sequences or identifiers.
The -Sg or -Mtp switches must be specified before labels can be used. By default, Free Pascal doesn’t support label and goto statements. The {$GOTO ON} directive can also be used to allow use of labels and the goto statement.

Link:ftp://ftp.freepascal.org/pub/fpc/docs-pdf/ref.pdf
Reputation Points: 132
Solved Threads: 138
Posting Pro
FlamingClaw is offline Offline
559 posts
since Feb 2009
Aug 4th, 2009
0

Re: [TurboPascal, Dev-Pas, Free-Pascal] problem with longint and unexpected end of file

johnyjj2 if you really want help, please post your code.

What you've listed so far is nonsense.
Featured Poster
Reputation Points: 1140
Solved Threads: 229
Postaholic
Duoas is offline Offline
2,039 posts
since Oct 2007

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Pascal and Delphi Forum Timeline: Balancing chemical equations
Next Thread in Pascal and Delphi Forum Timeline: CreateNew affecting all objects





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC