Thread: Pascal to c

  1. #1
    Registered User
    Join Date
    Mar 2010
    Posts
    9

    Pascal to c

    I found a freeware program call UrthWurm I had been looking for on the internet but the EXE cannot run on my system (16-bit on 64). I found the source but it's written in TURBO PASCAL 7.0. I only know ANSI C and have a compiler for that. I'd really like to know how this program works and to compile it to work with my system.

    The opensource freeware program can be found here:
    Code:
    http://members.home.nl/bas.de.reuver/files/urthwurm_source.zip
    I was wondering if there was a way to convert the source code from TURBO PASCAL 7.0 to ANSI C. I looked on Google and found something that said it should do just that called PtoC.exe but I don't know how to use it and there is nearly NO instructions.

    I was just wondering if it would be possible and maybe what program I should use to do it.

    (Hopefully something with a graphical front end.)

    Thanks

    TUXRULES!

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    All PtoC will do is turn it into an even worse looking 16 bit C program.

    A serious update (change of language, graphics, architecture) requires a re-write.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  3. #3
    Registered User
    Join Date
    Mar 2010
    Posts
    9
    Yes but then wouldn't that restructuring, as bad as it may be, get the program a little closer to something I can understand and rewrite? At the moment, I can make only quick guesses as to what it does and some of the PASCAL doesn't seem to conform with ANY C functions. So, converting it to C with PtoC would be a start to rewriting it in C for my system wouldn't it?

    The thing is, I don't know how to use the PtoC program.

    Also, as a side note, the program works in DOSBox but I'd like it to run all by itself AND I'd like to understand exactly how it works.

  4. #4
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    Maybe - Pascal to C/C++ converter

    Maybe learn enough Pascal to get the general idea of what is going on. You don't need to know enough to understand the detail, and you certainly don't need to know enough to be able to write Pascal.

    It's a useful enough skill to take something written in one language, and re-express that in another language without having to rely on XtoY translators all the time.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  5. #5
    Registered User
    Join Date
    Mar 2010
    Posts
    9
    Hey you make a very apt point. I appreciate that understanding. Thanks.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Pascal
    By cogeek in forum Tech Board
    Replies: 32
    Last Post: 11-20-2004, 04:19 AM
  2. C & Pascal Help
    By Dragon227Slayer in forum C Programming
    Replies: 4
    Last Post: 12-01-2003, 09:40 AM
  3. Compares C++ and Pascal
    By Jaguar in forum A Brief History of Cprogramming.com
    Replies: 13
    Last Post: 07-19-2002, 11:28 AM
  4. Pascal Compiler
    By (TNT) in forum A Brief History of Cprogramming.com
    Replies: 3
    Last Post: 04-09-2002, 12:57 AM
  5. Pascal "with()" in C++
    By larry in forum C++ Programming
    Replies: 3
    Last Post: 09-27-2001, 02:04 PM