Closed Thread
Page 1 of 2 12 LastLast
Results 1 to 10 of 13

Thread: [TurboPascal, Dev-Pas, FreePascal] problem with longint and unexpected end of file

  1. #1
    johnyjj2 is offline Newbie
    Join Date
    Aug 2009
    Posts
    23
    Rep Power
    0

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

    Hello!

    I was looking for the answer here but I couldn't find: h ttp://w ww.freepascal.org/port.var -> Free Pascal - Porting Turbo Pascal Applications.

    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'.").

    Code:
    Free Pascal Compiler version 1.0.6 [2002/04/23] for i386
    Copyright (c) 1993-2002 by Florian Klaempfl
    Target OS: Win32 for i386
    Compiling f:\intern\26turb~1\program\main1.pas
    main1.pas(1,2) Warning: Unsupported switch $N
    Compiling main2.pas
    main2.pas(1,2) Warning: Unsupported switch $N
    main2.pas(308,15) Error: call by var parameters have to match exactly: Got LONGINT expected SMALLINT
    main2.pas(645,76) Warning: Comment level 2 found
    main2.pas(843,3) Warning: Comment level 2 found
    main2.pas(643,2) Fatal: Unexpected end of file
    I look at these two lines:
    Code:
    308: InitGraph(ster,tryb,path);
    52: ster:integer=VGA;
    I changes line 52.
    Code:
    52: ster:smallint=VGA;
    I also tried:
    Code:
    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:
    Code:
      Resume
      end
    end;
    
    
    end .
    How to get rid of those two errors?

    Greetings!

  2. CODECALL Circuit advertisement
    Join Date
    Always
    Posts
    Many

     
  3. #2
    Join Date
    Sep 2007
    Location
    Karlstad, Sweden
    Posts
    3,082
    Blog Entries
    7
    Rep Power
    42

    Re: [TurboPascal, Dev-Pas, FreePascal] problem with longint and unexpected end of fil

    end of file shall be End. I don't know if you can have that space there.
    otherwise, you often miss an End for something else, so the End. comes too early.
    __________________________________________
    I study Information Systems at Karlstad University when I'm not on CodeCall

  4. #3
    johnyjj2 is offline Newbie
    Join Date
    Aug 2009
    Posts
    23
    Rep Power
    0

    Re: [TurboPascal, Dev-Pas, FreePascal] problem with longint and unexpected end of fil

    Thanks!
    I corrected this error and now I've got other problem. There were some labels which names begin with digit so I changes label 200 into label lab200.

    Now I've got the following errors:
    Code:
    Free Pascal Compiler version 1.0.6 [2002/04/23] for i386
    Copyright (c) 1993-2002 by Florian Klaempfl
    Target OS: Win32 for i386
    Compiling f:\dev-pas\program\trc.pas
    trc.pas(1,2) Warning: Unsupported switch $N
    trc.pas(401,5) Note: Local variable EM1 not used
    trc.pas(882,1) Error: Label used but not defined LAB200
    trc.pas(1749,11) Fatal: Syntax error, identifier expected but LIBRARY found
    It is weird because in the line 733 I've got now:
    Code:
    label lab200;
    Lines 881 & 882 are as follows:
    Code:
     window(1,1,80,25); ClrScr;
    end;
    About the last one error:
    Line 1749 contains:
    Code:
    procedure library;
    Greetings!
    Last edited by johnyjj2; 08-07-2009 at 01:55 AM. Reason: +1749

  5. #4
    Join Date
    Jul 2006
    Posts
    16,494
    Blog Entries
    75
    Rep Power
    143

    Re: [TurboPascal, Dev-Pas, FreePascal] problem with longint and unexpected end of fil

    Labels have to be defined in the form as well as the code, or else they have to be in the var list and created dynamically.
    Programming is a branch of mathematics.
    My CodeCall Blog | My Personal Blog

  6. #5
    johnyjj2 is offline Newbie
    Join Date
    Aug 2009
    Posts
    23
    Rep Power
    0

    Re: [TurboPascal, Dev-Pas, FreePascal] problem with longint and unexpected end of fil

    All results of "200", "label" and "goto":
    Code:
    69:   menu1[4]:='Library       ';
    732: procedure axesimu;
    733: label 0200;
    744: case vv of
    747:  3: Goto 0200;
    881: 200: window(1,1,80,25); ClrScr;
    884:  procedure TwoAxles;
    885:label 100;
    1025:    if (zn='N') or (zn='n') then goto 100;
    1752: procedure library;
    1871:  4: library;
    Without any changes:
    Code:
    Free Pascal Compiler version 1.0.6 [2002/04/23] for i386
    Copyright (c) 1993-2002 by Florian Klaempfl
    Target OS: Win32 for i386
    Compiling f:\dev-pas\program\02trc~1.pas
    02trc~1.pas(1,2) Warning: Unsupported switch $N
    02trc~1.pas(401,5) Note: Local variable EM1 not used
    02trc~1.pas(881,1) Error: Identifier not found 200
    02trc~1.pas(881,4) Error: Illegal expression
    02trc~1.pas(881,4) Fatal: Syntax error, ; expected but : found
    After adding to the second line {$GOTO ON}
    Code:
    Free Pascal Compiler version 1.0.6 [2002/04/23] for i386
    Copyright (c) 1993-2002 by Florian Klaempfl
    Target OS: Win32 for i386
    Compiling f:\dev-pas\program\02trc~1.pas
    02trc~1.pas(1,2) Warning: Unsupported switch $N
    02trc~1.pas(402,5) Note: Local variable EM1 not used
    02trc~1.pas(882,1) Error: Identifier not found 200
    02trc~1.pas(882,4) Error: Illegal expression
    02trc~1.pas(882,4) Fatal: Syntax error, ; expected but : found
    After changing from
    Code:
    200: window(1,1,80,25); ClrScr;
    to
    Code:
    window(1,1,80,25); ClrScr;
    compilation errors:
    Code:
    Free Pascal Compiler version 1.0.6 [2002/04/23] for i386
    Copyright (c) 1993-2002 by Florian Klaempfl
    Target OS: Win32 for i386
    Compiling f:\dev-pas\program\02trc~1.pas
    02trc~1.pas(1,2) Warning: Unsupported switch $N
    02trc~1.pas(402,5) Note: Local variable EM1 not used
    02trc~1.pas(883,1) Error: Label used but not defined 0200
    02trc~1.pas(1750,11) Fatal: Syntax error, identifier expected but LIBRARY found
    After changing into:
    Code:
     label 200; window(1,1,80,25); ClrScr;
    errors:
    Code:
    Free Pascal Compiler version 1.0.6 [2002/04/23] for i386
    Copyright (c) 1993-2002 by Florian Klaempfl
    Target OS: Win32 for i386
    Compiling f:\dev-pas\program\02trc~1.pas
    02trc~1.pas(1,2) Warning: Unsupported switch $N
    02trc~1.pas(402,5) Note: Local variable EM1 not used
    02trc~1.pas(882,8) Error: Illegal expression
    02trc~1.pas(882,8) Error: Illegal expression
    02trc~1.pas(882,8) Fatal: Syntax error, ; expected but ordinal const found
    After changing into
    Code:
    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:
    Code:
    Free Pascal Compiler version 1.0.6 [2002/04/23] for i386
    Copyright (c) 1993-2002 by Florian Klaempfl
    Target OS: Win32 for i386
    Compiling f:\dev-pas\program\02trc~1.pas
    02trc~1.pas(1,2) Warning: Unsupported switch $N
    02trc~1.pas(402,5) Note: Local variable EM1 not used
    02trc~1.pas(883,1) Error: Label used but not defined LAB200
    02trc~1.pas(1069,7) Error: Illegal expression
    02trc~1.pas(1069,7) Error: Illegal expression
    02trc~1.pas(1069,7) Fatal: Syntax error, ; expected but identifier LAB100 found
    Greetings!
    Last edited by johnyjj2; 08-07-2009 at 01:54 AM.

  7. #6
    Join Date
    Jul 2006
    Posts
    16,494
    Blog Entries
    75
    Rep Power
    143

    Re: [TurboPascal, Dev-Pas, FreePascal] problem with longint and unexpected end of fil

    Oh. Goto is evil. Don't use it. You should be using while loops, etc here.

    I think the problem really comes down the a problem with poor programming. Function calls, loops, etc are the way to handle the types of things you're doing. There may be compatibility directives you can pass to the compilers to get them to act like TP5.5, but my sense is the code is in desperate need of review/reworking.
    Programming is a branch of mathematics.
    My CodeCall Blog | My Personal Blog

  8. #7
    johnyjj2 is offline Newbie
    Join Date
    Aug 2009
    Posts
    23
    Rep Power
    0

    Re: [TurboPascal, Dev-Pas, FreePascal] problem with longint and unexpected end of fil

    Thanks for your reply. It is not my code but something what was written in 1991 and now I was asked to recompile it in XP and later change interface. At this moment I am in that first stage i.e. I cannot compile it . This program contains about 3000 of lines in two PAS files and performs some sophisticated maths calculations so I'd like to make as little changes as possible. On the other hand it wasn't my code and I know nothing about the aim of this program - I can see how it works and what it is for after recompiling it .
    Greetings!

  9. #8
    Join Date
    Jul 2006
    Posts
    16,494
    Blog Entries
    75
    Rep Power
    143

    Re: [TurboPascal, Dev-Pas, FreePascal] problem with longint and unexpected end of fil

    You can probably still find TurboPascal 5.5 for free, and get it running under DOSBox. My guess, though, is that you need to look at your compiler options for the three compilers you're trying.
    Programming is a branch of mathematics.
    My CodeCall Blog | My Personal Blog

  10. #9
    johnyjj2 is offline Newbie
    Join Date
    Aug 2009
    Posts
    23
    Rep Power
    0

    Re: [TurboPascal, Dev-Pas, FreePascal] problem with longint and unexpected end of fil

    Thanks!
    I downloaded and installed DOSBox & Turbo Pascal 7.0 on it. I tried to compile my program on TP7.0 but there is weird problem. I open trc.pas, press F9 (Make) and see "Error 15: File not found (CDF.TPU)" in the window "\PROG\TRC.PAS". I check and there exists file CDF.TPU in the directory C:\dosprog\prog where on DOSBox I emulate disc C by command "mount c c:\dosprog\".
    Greetings!
    Last edited by johnyjj2; 08-07-2009 at 06:38 AM.

  11. #10
    Join Date
    Jul 2006
    Posts
    16,494
    Blog Entries
    75
    Rep Power
    143

    Re: [TurboPascal, Dev-Pas, FreePascal] problem with longint and unexpected end of fil

    Within TP7 under DOSBox, can you open the file where it expects to find it?
    Programming is a branch of mathematics.
    My CodeCall Blog | My Personal Blog

Closed Thread
Page 1 of 2 12 LastLast

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Unexpected EOFexception
    By toto_7 in forum Java Help
    Replies: 0
    Last Post: 05-17-2011, 12:21 PM
  2. Need help debugging. Unexpected T-ELSE
    By Ascension in forum PHP Development
    Replies: 4
    Last Post: 08-08-2009, 06:52 PM
  3. Unexpected $end
    By Ricardo-san in forum PHP Development
    Replies: 2
    Last Post: 05-31-2009, 05:59 AM
  4. unexpected T_ELSEIF
    By Jaan in forum PHP Development
    Replies: 3
    Last Post: 10-24-2007, 01:20 PM
  5. .NET VS Problem, "Unexpected EOF"
    By hoser2001 in forum C# Programming
    Replies: 1
    Last Post: 07-10-2007, 08:13 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts