#[1]Cypher Phunk - Atom [2]Cypher Phunk - RSS [3]Cypher Phunk - Atom

[4]Cypher Phunk

A coder with an interest in cybersecurity

Menu

    * [5]Home

Tuesday, 17 May 2022

[6]Using the Free Pascal IDE for a week

  [7]May 17, 2022 by [8]Chris Hawkins

  Code can really be written with any text editor that you're comfortable
  with. I tend to use [9]Vim for quick edits and writing notes, and on
  Linux I occasionally use [10]Geany or [11]Mousepad. But when you want
  to do more than quickly update a few files, you need a full Integrated
  Development Environment (IDE).
  An IDE understands the language that you're writing in, and can run
  additional tools like a compiler and a debugger from the same
  environment.

  The most full featured IDE for Free Pascal, bar none, is [12]Lazarus.
  The ease with which you can write, refactor, debug and compile programs
  in Lazarus makes me miss it when I have to write code in another
  language. It's fast and perfectly suited for the task... except in one
  instance.
  Lazarus is designed for coding GUI applications, but recently I've
  spent most of my free time writing a terminal based game. It used to be
  possible to run a terminal session 'attached' to Lazarus, so that it
  could be debugged from the IDE, but since a previous update this always
  seems to fail on my PC. I can still use Lazarus to write my code, but
  when I encounter an error I need some other way to diagnose it.

Introducing FP IDE

  [13][DefaultBlue.png]

  I'm not sure what the rationale is for maintaining the text mode FP
  IDE. It seems kinda quaint in 2022 to maintain a recreation of the old
  Turbo Pascal editor, but I'm so glad that it's there. The IDE might not
  have all the bells and whistles of something like Lazarus, but it's
  lightweight, easy to use, and reliable. I first learned Pascal back in
  the Borland days, so the IDE does feel familiar to me. Although I'm not
  sure how a younger programmer, encountering it for the first time would
  feel about it. Without the haze of experience and nostalgia informing
  their opinion.

  Regardless, it comes with Free Pascal and runs in the terminal. It does
  require a little setting up first though. Note, I'm running Linux here
  but the same should work in Windows with a little tweaking to use the
  correct file paths. Also, I've found the best Linux terminal to run the
  IDE in is Xterm. Other terminal emulators seem to catch your keyboard
  commands for their own menus.

Setting it up

  The first time that you run FP IDE it creates a couple of config files
  in the starting directory, fp.cfg and fp.ini. The first thing that you
  notice when opening the IDE is the retro, blue colour scheme. The
  second thing that you'll notice is that it doesn't actually compile
  Pascal programs out of the box.
  I'm not sure why this is the default setup, but you need to tell the
  IDE where to find the Free Pascal files on your system. A quick Google
  search shows that this step trips a lot of people up, so let's kill two
  birds with one stone and get both of these things resolved.

  Open fp.cfg in a text editor and you'll see three sections:

    #IFDEF NORMAL
    #IFDEF DEBUG
    #IFDEF RELEASE

  These correspond to the different build profiles that you'll use.
  Personally, I spend all my development time using the debug profile,
  and then only use release at the very end of my development cycle.
  In each section, add the following lines:

     -Fu/usr/lib/fpc/$fpcversion/units/$fpctarget
     -Fu/usr/lib/fpc/$fpcversion/units/$fpctarget/*
     -Fu/usr/lib/fpc/$fpcversion/units/$fpctarget/rtl

  You can also add this in the IDE itself in Options > Directories >
  Units, but it's a little quicker to copy and paste this in a text
  editor.
  Unlike Lazarus, the FP IDE doesn't use 'Projects' where all of a
  programs files are managed. Instead it deals with directories/folders.
  If the program that you're working on has files stored in subfolders,
  explicitly add them here. Each line begins with -Fu followed by the
  full path to the directory, with no space after -Fu.
  As an example, here's my fp.cfg file below.

    # Automatically created file, don't edit.
    #IFDEF NORMAL
     -TLinux
     -Mfpc
     -Sg
     -Si
     -Os
     -CpATHLON64
     -OpCOREI
     -Fu/home/cypher/Development/MyProg/
     -Fu/home/cypher/Development/MyProg/AdditionalUnits
     -Fu/usr/lib/fpc/$fpcversion/units/$fpctarget
     -Fu/usr/lib/fpc/$fpcversion/units/$fpctarget/*
     -Fu/usr/lib/fpc/$fpcversion/units/$fpctarget/rtl
     -g-
     -p-
     -b-
    #ENDIF
    #IFDEF DEBUG
     -TLinux
     -Mfpc
     -Sg
     -Si
     -Sa
     -Cr
     -Ci
     -Co
     -CR
     -Os
     -CpATHLON64
     -OpCOREI
     -Fu/home/cypher/Development/MyProg/
     -Fu/home/cypher/Development/MyProg/AdditionalUnits
     -Fu/usr/lib/fpc/$fpcversion/units/$fpctarget
     -Fu/usr/lib/fpc/$fpcversion/units/$fpctarget/*
     -Fu/usr/lib/fpc/$fpcversion/units/$fpctarget/rtl
     -g
     -p-
     -b-
    #ENDIF
    #IFDEF RELEASE
     -TLinux
     -Mfpc
     -Sg
     -Si
     -CX
     -Os
     -CpATHLON64
     -OpCOREI
     -Fu/home/cypher/Development/MyProg/
     -Fu/home/cypher/Development/MyProg/AdditionalUnits
     -Fu/usr/lib/fpc/$fpcversion/units/$fpctarget
     -Fu/usr/lib/fpc/$fpcversion/units/$fpctarget/*
     -Fu/usr/lib/fpc/$fpcversion/units/$fpctarget/rtl
     -XS
     -g-
     -p-
     -b-
    #ENDIF

Some Quality of Life improvements

  The next steps aren't necessary in order to use the IDE, but I find
  that it makes it a more comfortable environment to work in.
  If you're happy with the blue colour scheme, you can ignore this step.
  Personally, I prefer something darker so I put together my own colour
  palette. It's incomplete, but it's good enough to use day to day.
  View the file at [14]https://github.com/cyberfilth/FP-IDE-theme and
  paste the [Colors] section into your own fp.ini file.

  [15][Themed.png]

  The next thing that I do is download the help files, so that I can
  access them through the IDE's built-in help viewer. The HTML
  documentation can be downloaded from
  [16]https://www.freepascal.org/down/docs/docs-canada.var then add them
  in the IDE by going to Help > Files and adding the path to the HTML
  files.

  Now the IDE is set up. It took a little more work than opening Lazarus
  for the first time, but now I can find bugs in my code a lot easier.
  Until now I've been writing code in Lazarus and firing up the FP IDE
  whenever I need to debug something. I did wonder though if I can just
  use the FP IDE for everything.
  Since I'm currently writing a [17]roguelike game, I thought that I'd
  open it up in the IDE. Before doing that, I amended the main filename
  from the Lazarus format to plain Pascal. That just means changing the
  suffix .lpr to .pas.
  Once the main program file is opened up, select it as the primary file.

  [18][PrimaryFile.png]
  One of the main differences in the interface, compared to Lazarus, is
  that instead of a tabbed interface it has a series of windows. With the
  right font size, I actually prefer this interface as it means that I
  can see several related files on screen at once.

  [19][Windows.png]

  The biggest thing that I'm missing so far is a good auto complete. The
  IDE will offer suggestions for completing Pascal keywords but, unlike
  Lazarus, it won't try to autocomplete your own variables or procedure
  names.

  Regardless, I'm going to try and restrict myself to just using this IDE
  for the next week to see if I can still use it for my hobby project. My
  codebase is currently about 17,000 lines of code and I'm curious to see
  what it's like to navigate it using the IDE... wish me luck!
  [20]Email This[21]BlogThis![22]Share to Twitter[23]Share to Facebook

  Posted in [24]dev, [25]Free Pascal, [26]IDE / [27]No comments /
  [28]Edit
  [29]Older Post [30]Home

0 comments:

Post a Comment

  Subscribe to: [31]Post Comments (Atom)

Search This Blog

  __________ Search
  Powered by [32]Blogger.

[33]Report Abuse

    * [34]Home

About Me

  [35]My photo

  [36]Chris Hawkins

  [37]View my complete profile

[38]Using the Free Pascal IDE for a week

  Code can really be written with any text editor that you're comfortable
  with. I tend to use Vim for quick edits and writing notes, and ...
  [DefaultBlue.png]

Search

  Search ____________________ Search

Popular Posts

    * [39]Using the Free Pascal IDE for a week
      Code can really be written with any text editor that you're
      comfortable with. I tend to use Vim for quick edits and writing
      notes, and ...
    * [40]My current development IDE
      I've recently reconfigured an old Dell laptop for development work
      and thought that I'd post my current setup. I love reading about
      ...
    * [41]Roguelikes, a very strange hobby
      Disclaimer. This post assumes some familiarity with the idea of
      roguelike games, if not with the games themselves. This isn't a
      'his...

Categories

    * [42]cybersecurity
    * [43]dev
    * [44]Free Pascal
    * [45]IDE
    * [46]roguelike
    * [47]Vim

BTemplates.com

Blog Archive

    * [48]May 2022 (1)
    * [49]January 2022 (1)
    * [50]April 2021 (2)
    * [51]March 2021 (1)

  Copyright © [52]Cypher Phunk | Powered by [53]Blogger
  Design by [54]Taras Dashkevych | Blogger Theme by [55]Lasantha -
  [56]PremiumBloggerTemplates.com

References

  Visible links
  1. https://cypherphunk.blogspot.com/feeds/posts/default
  2. https://cypherphunk.blogspot.com/feeds/posts/default?alt=rss
  3. https://cypherphunk.blogspot.com/feeds/5685145377003343911/comments/default
  4. https://cypherphunk.blogspot.com/
  5. https://cypherphunk.blogspot.com/
  6. https://cypherphunk.blogspot.com/2022/05/using-free-pascal-ide-for-week.html
  7. https://cypherphunk.blogspot.com/2022/05/using-free-pascal-ide-for-week.html
  8. https://www.blogger.com/profile/11142052749928122407
  9. https://www.vim.org/
 10. https://www.geany.org/
 11. https://docs.xfce.org/apps/mousepad/start
 12. https://www.lazarus-ide.org/
 13. https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjUh84oiIpCeuNqHfDydxV0JxAE64LKBus3DKylfTgAOWJI_B3GTTBqZMa_co6w5TW4Jix5EoUoE0siyjn5w6EAkd2NbeodyN6_vkCp-OKHmjdATsNlsuom6Ht-7EaOE21J_l5XhX2lGWsP3svRal-l_cSn5uhmOz7U8LSBAMbdd59aJGl9X3jcUNDJ/s612/DefaultBlue.png
 14. https://github.com/cyberfilth/FP-IDE-theme
 15. https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgT6HTZf97JO2Yy6Gy7w1YYSNVRLEOyQ5f7D5xwebPmtn5dUb4eJH_em5idmpnle9xrlnjaoL93EaDb7IYa3ekVZJwf84_Ee9Z8ST_ULWWea8U1LvYW3FNP6w-geMMI7MdgpeInoL-qTOeuhWv0fl47AzzrPelqmfimVXwvifNo5UC_qw8tX7PHmb3Y/s617/Themed.png
 16. https://www.freepascal.org/down/docs/docs-canada.var
 17. https://github.com/cyberfilth/Axes-Armour-Ale
 18. https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhUzzgkQUWfBIAx8-vfjYlJHrnbKoKnrkrBy1Xv6ZeEnAj_nny-dHciuQ0V5wIHtNeFNuZTl-xlmK5wMFJ30T4NI18nos5ke7V4YHPKxCfwy6w3gD9DiEharU0-geUdjMnoZFyEDunGAjQ9bxpC2tHM7BaICN_IvXW30f1YXA5OKfCyzjRgNuVQDqAP/s377/PrimaryFile.png
 19. https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgfD0sT3MjRCa9x2BOWCqJ_Yofz4VW61F-ZaZI77lns4Gl2VwO2fM4pNfD4gsg09UqHRnEZEGw15H3Pacjq2idTLHVWVHVaPc099f9xA8F2CUVtZtI8DHTq4dpmjVCphDQYkZqLCdQF69m_MogvH_fAeOhq85ohlMLcu_-uJ7VESNveUbDric3Fb-qJ/s1358/Windows.png
 20. https://www.blogger.com/share-post.g?blogID=6243007530772688470&postID=5685145377003343911&target=email
 21. https://www.blogger.com/share-post.g?blogID=6243007530772688470&postID=5685145377003343911&target=blog
 22. https://www.blogger.com/share-post.g?blogID=6243007530772688470&postID=5685145377003343911&target=twitter
 23. https://www.blogger.com/share-post.g?blogID=6243007530772688470&postID=5685145377003343911&target=facebook
 24. https://cypherphunk.blogspot.com/search/label/dev
 25. https://cypherphunk.blogspot.com/search/label/Free%20Pascal
 26. https://cypherphunk.blogspot.com/search/label/IDE
 27. https://cypherphunk.blogspot.com/2022/05/using-free-pascal-ide-for-week.html#comment-form
 28. https://www.blogger.com/post-edit.g?blogID=6243007530772688470&postID=5685145377003343911&from=pencil
 29. https://cypherphunk.blogspot.com/2022/01/pathfinding-with-smell-maps.html
 30. https://cypherphunk.blogspot.com/
 31. https://cypherphunk.blogspot.com/feeds/5685145377003343911/comments/default
 32. https://www.blogger.com/
 33. https://www.blogger.com/go/report-abuse
 34. https://cypherphunk.blogspot.com/
 35. https://www.blogger.com/profile/11142052749928122407
 36. https://www.blogger.com/profile/11142052749928122407
 37. https://www.blogger.com/profile/11142052749928122407
 38. https://cypherphunk.blogspot.com/2022/05/using-free-pascal-ide-for-week.html
 39. https://cypherphunk.blogspot.com/2022/05/using-free-pascal-ide-for-week.html
 40. https://cypherphunk.blogspot.com/2021/04/my-current-development-ide.html
 41. https://cypherphunk.blogspot.com/2021/04/roguelikes-very-strange-hobby.html
 42. https://cypherphunk.blogspot.com/search/label/cybersecurity
 43. https://cypherphunk.blogspot.com/search/label/dev
 44. https://cypherphunk.blogspot.com/search/label/Free%20Pascal
 45. https://cypherphunk.blogspot.com/search/label/IDE
 46. https://cypherphunk.blogspot.com/search/label/roguelike
 47. https://cypherphunk.blogspot.com/search/label/Vim
 48. https://cypherphunk.blogspot.com/2022/05/
 49. https://cypherphunk.blogspot.com/2022/01/
 50. https://cypherphunk.blogspot.com/2021/04/
 51. https://cypherphunk.blogspot.com/2021/03/
 52. https://cypherphunk.blogspot.com/
 53. https://www.blogger.com/
 54. http://tdwp.us/
 55. http://www.bloggertipandtrick.net/
 56. http://www.btemplates.com/author/pbtemplates/

  Hidden links:
 58. https://www.blogger.com/comment/frame/6243007530772688470?po=5685145377003343911&hl=en-GB
 59. https://cypherphunk.blogspot.com/2022/05/using-free-pascal-ide-for-week.html
 60. https://cypherphunk.blogspot.com/2021/04/my-current-development-ide.html
 61. https://cypherphunk.blogspot.com/2021/04/roguelikes-very-strange-hobby.html