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

Thread Solved

Join Date: Jul 2009
Posts: 19
Reputation: johnyjj2 is an unknown quantity at this point 
Solved Threads: 0
johnyjj2 johnyjj2 is offline Offline
Newbie Poster

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

 
0
  #1
Aug 3rd, 2009
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!
Reply With Quote Quick reply to this message  
Join Date: Jul 2006
Posts: 823
Reputation: pritaeas will become famous soon enough pritaeas will become famous soon enough 
Solved Threads: 135
Sponsor
pritaeas's Avatar
pritaeas pritaeas is offline Offline
Practically a Posting Shark

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

 
0
  #2
Aug 3rd, 2009
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).
"If it is NOT source, it is NOT software."
-- NASA
Reply With Quote Quick reply to this message  
Join Date: Jul 2009
Posts: 19
Reputation: johnyjj2 is an unknown quantity at this point 
Solved Threads: 0
johnyjj2 johnyjj2 is offline Offline
Newbie Poster

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

 
0
  #3
Aug 3rd, 2009
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!
Reply With Quote Quick reply to this message  
Join Date: Jul 2009
Posts: 19
Reputation: johnyjj2 is an unknown quantity at this point 
Solved Threads: 0
johnyjj2 johnyjj2 is offline Offline
Newbie Poster

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

 
0
  #4
Aug 3rd, 2009
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 :-)
Reply With Quote Quick reply to this message  
Join Date: Jul 2006
Posts: 823
Reputation: pritaeas will become famous soon enough pritaeas will become famous soon enough 
Solved Threads: 135
Sponsor
pritaeas's Avatar
pritaeas pritaeas is offline Offline
Practically a Posting Shark

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

 
0
  #5
Aug 3rd, 2009
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.
"If it is NOT source, it is NOT software."
-- NASA
Reply With Quote Quick reply to this message  
Join Date: Jul 2009
Posts: 19
Reputation: johnyjj2 is an unknown quantity at this point 
Solved Threads: 0
johnyjj2 johnyjj2 is offline Offline
Newbie Poster

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

 
0
  #6
Aug 3rd, 2009
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!
Reply With Quote Quick reply to this message  
Join Date: Oct 2007
Posts: 1,951
Reputation: Duoas has much to be proud of Duoas has much to be proud of Duoas has much to be proud of Duoas has much to be proud of Duoas has much to be proud of Duoas has much to be proud of Duoas has much to be proud of Duoas has much to be proud of 
Solved Threads: 214
Featured Poster
Duoas's Avatar
Duoas Duoas is offline Offline
Posting Virtuoso

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

 
0
  #7
Aug 3rd, 2009
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.
Reply With Quote Quick reply to this message  
Join Date: Jul 2009
Posts: 19
Reputation: johnyjj2 is an unknown quantity at this point 
Solved Threads: 0
johnyjj2 johnyjj2 is offline Offline
Newbie Poster

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

 
0
  #8
Aug 4th, 2009
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!
Reply With Quote Quick reply to this message  
Join Date: Feb 2009
Posts: 443
Reputation: FlamingClaw will become famous soon enough FlamingClaw will become famous soon enough 
Solved Threads: 106
FlamingClaw's Avatar
FlamingClaw FlamingClaw is offline Offline
Posting Pro in Training

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

 
0
  #9
Aug 4th, 2009
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
Be a good part of the community.Don't be ungrateful.
If you ask something on the forum and you got the right answer then mark as solved!
If my opinion helped to you a lot then sometimes give reputation point to me.
I'm just a pascal programmer from Hungary.
Farewell...
Reply With Quote Quick reply to this message  
Join Date: Oct 2007
Posts: 1,951
Reputation: Duoas has much to be proud of Duoas has much to be proud of Duoas has much to be proud of Duoas has much to be proud of Duoas has much to be proud of Duoas has much to be proud of Duoas has much to be proud of Duoas has much to be proud of 
Solved Threads: 214
Featured Poster
Duoas's Avatar
Duoas Duoas is offline Offline
Posting Virtuoso

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

 
0
  #10
Aug 4th, 2009
johnyjj2 if you really want help, please post your code.

What you've listed so far is nonsense.
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC