Got Pascal running in xcode.

Discussion in 'Mac Programming' started by larswik, Jan 29, 2011.

  1. larswik macrumors 68000

    Joined:
    Sep 8, 2006
    #1
    I downloaded this http://sourceforge.net/projects/freepascal/files/Mac OS X/2.2.4/ and it gave me what I needed to run Pascal from within xcode and not the terminal any more. When I write this code
    Code:
    program test;
    begin
    writeln('Hello World');
    end.
    it prints this mess out on the console window
    Code:
    [Session started at 2011-01-29 13:20:21 -0800.]
    Hello World
    Heap dump by heaptrc unit
    6 memory blocks allocated : 999/1016
    6 memory blocks freed     : 999/1016
    0 unfreed memory blocks : 0
    True heap size : 360448 (96 used in System startup)
    True free heap : 360352
    
    The Debugger has exited with status 0.
    At this point I should just count my blessings and be happy I can do everything in xcode but I will ask any way:) Is there a preference setting for removing all the extra memory data that gets printed so I can just see hello world and that it exited out ok?

    Thanks!

    -Lars
     
  2. lee1210 macrumors 68040

    lee1210

    Joined:
    Jan 10, 2005
    Location:
    Dallas, TX
    #2
    The user's guide:
    http://www.unlu.edu.ar/~program1/biblioteca/freepascal/user.pdf

    says -gh when compiling enables that output. You'll need to find the compiler flags being used and take that one out.

    Why are you abandoning the terminal? Will every machine you ever intend to program on have XCode available?

    -Lee
     
  3. larswik thread starter macrumors 68000

    Joined:
    Sep 8, 2006
    #3
    Thanks for the Manual Lee!

    All of my coding has been with xcode and I am comfortable with it. I am not opposed to using the Terminal in the future but tight now Pascal will be new to me and the Terminal to compile and run will be new to me. I would rather stick with something I know right now. Plus it is much easier to make changes in xcode, save and run it right there with in seconds.

    -Lars
     
  4. Bill McEnaney, Jan 29, 2011
    Last edited: Jan 29, 2011

    Bill McEnaney macrumors 6502

    Joined:
    Apr 29, 2010
    #4
    Call me old-fashioned because in many ways, I am old-fashioned. Since I've always been that way, I've always preferred a command-line to a graphic user interface, partly because a graphic user interface often slows my work. If I need to, say, empty a folder, I don't drag files one by one to the trash can. I open a terminal window, go into that folder, and type, "rm -rf *". Or if I already know the path to that folder, I can skip the "cd" step and just type something like this, "rm -rf /Users/Bill/Backup/*". Maybe from now on, I'll always keep a terminal window open.
     
  5. balamw Moderator

    balamw

    Staff Member

    Joined:
    Aug 16, 2005
    Location:
    New England
    #5
    I'm old fashioned too and always have Terminal open when writing code, but that's not a great example. It's fairly easy to select and delete all files and subfoldrs in a folder in the GUI as well.

    FWIW check out Path Finder, it supports many extensions to Finder that are aimed at old-fashioned types like us.

    larswik: I'm glad you got Xcode to work. Have you checked if debug features are working like breakpoints, variable inspectors, ...

    B
     
  6. lee1210 macrumors 68040

    lee1210

    Joined:
    Jan 10, 2005
    Location:
    Dallas, TX
    #6
    Fair enough.

    Typing :w :! and up arrow to bring up the last command which compiles and runs my code is pretty fast. The seven keystrokes necessary take well under a second. I say this to demonstrate that the terminal need not be slow. I feel like touching the mouse is a huge speedbump. I know IDEs have keyboard shortcuts, but a lot of the interaction seems mouse driven.

    To each his own, but I don't count on an IDE being available (or any GUI interaction at all) when I need to write code.

    -Lee
     
  7. larswik thread starter macrumors 68000

    Joined:
    Sep 8, 2006
    #7
    No, not yet, I am searching the web trying to find out how to shut off the Flags in the compiler so it won't list the Heap information when it finishes displaying the output. Lee gave me a lead and now I am trying to find out if it is some code that I add to my program to shut it off or if it is something I need to do with the Terminal (old school style :) ) to set it up once and then forget about it.

    -Lars
     
  8. lee1210 macrumors 68040

    lee1210

    Joined:
    Jan 10, 2005
    Location:
    Dallas, TX
    #8
    It should be in your build settings. It didn't sound like this was on by default, so it may be in the default build settings.

    -Lee
     
  9. chown33 macrumors 604

    Joined:
    Aug 9, 2009
    #9
    And in Terminal.app, the up arrow brings up the last command line. Press it again and it brings up the second last command. Press RETURN and it runs that command.

    Or my usual approach is to edit command-lines in a TextEdit plain text window, then drag-and-drop to Terminal window. This is especially useful if it's a command longer than about a dozen characters. Example:
    Code:
    curl -s http://example.com/somethingToGet
    
    Oh wait, I wanted to see the headers. Go to TextEdit window, add the -v option, select and drag:
    Code:
    curl -s -v http://example.com/somethingToGet
    
     
  10. firewood macrumors 604

    Joined:
    Jul 29, 2003
    Location:
    Silicon Valley
    #10
    First thing I do when setting up an OS X machine is to add the Terminal to my account Login Items so it's always there on startup.

    Somewhere in a box, I still have my Apple II Pascal floppy disks, with some programs I wrote way back. But it would be a long journey to get any Pascal programs on those disks into my MacBook.
     
  11. Bill McEnaney macrumors 6502

    Joined:
    Apr 29, 2010
    #11
    You're right, B. That's not a great example. So I like to startle some GUI fans with "1,$d" when the file I'm editing is at least 1,000 lines long. :)

    Thanks for the tip. I'll do that. I need to learn a lot about OS X because I'm much more familiar with Solaris.
     

Share This Page