User:Tangentstorm

From Lazarus wiki
Jump to navigationJump to search

I am a regular in the #fpc IRC Channel and an enthusiastic supporter of free pascal.

One day, after about 12 years of doing mostly python work, I found myself looking over my ancient TP5.5 code and thought it might be fun to get it working again. I was pleasantly surprised by how far pascal's come over the years, and have found myself reaching for FPC as my default tool.

I think Lazarus is pretty darn slick, but I grew up with text screens and keyboards, and still tend to find myself shelled into my FreeBSD box, editing my pascal code with emacs, and often using org-mode and babel for literate programming.

Most of my pascal code is available for free on github:

libraries

  • tangentstorm/xpl contains many general purpose units. A few interesting ones:
    • sqlite3ext.pp extends the standard sqlite3 package to allow extending sqlite with custom functions or virtual tables written in pascal. (demo/sqlrange.pas hos an example)
    • ubp.pas implements a b+ tree ([ bpdemo])
    • unda.pas provides n-dimensional arrays
    • kvm.pas (literate version) and kbd.pas together implement a terminal library similar to the old crt unit, but with support for widechars and 256-color displays.
    • arrays.pas (literate version) contains some generic array-like classes and interfaces).
    • cw is a rather cryptic mini-language for generating colored text output (ported from turbo pascal when I was in high school, so kind of messy)
    • There's also a console-based unit testing framework that I use on almost all of my projects.
    • lined.pas is my port of a simple line editor called LineNoise (like gnu readline, but tiny).
    • The /code/ui directory has a bunch of other console widgets (but based on my old turbo pascal code, and not fully modernized/debugged yet)]
  • tangentstorm/py4d is my fork of Python4Delphi. I'm still learning about everything it can do, but the repo includes a python wrapper for the kvm unit mentioned above.

example code

  • tangentstorm/zworld is a small sketch of a lazarus project. I had bigger plans for it, but right now it just uses BGRABitmap to draw a huge number of little sprites. I only link to it here because it might be of interest to someone wanting to use Lazarus for non-traditional graphic stuff (games, animation, etc as opposed to traditional GUI apps).
  • tangentstorm/tangentlabs/pascal contains a whole bunch of small pascal examples and experiments. Some especially fun ones (which may or may not require fpc 2.7.1 from the svn trunk):
    • GoGoSDL.pas is a basic demo of using SDL (1.x) from fpc, intended as a template for quickly creating SDL apps.
    • zenglagg.pas shows how to use AggPas to dynamically create smooth vector images for use as sprites in ZenGL.
    • arrayprops.pas shows how to override the bracket operator so you can say things like grid[5,3]; or even dict['strings as keys'];.
    • xpathdemo.pas shows how to use xpath.
    • dispatch.pas is a hopefully entertaining look at various approaches to dynamic dispatch/multimethods. (Short answer: dynamic dispatch semantics are possible in fpc, but require complicated setup or creative use of exceptions.)
    • hofmap.pas shows how to implement higher order functions as class methods in a generic class. (Probably requires trunk.)
    • funops demonstrates another style of higher order function based on function composition. In particular, it shows how to implement J-style hooks and forks.
    • jcolor.pas and [1] implement a hand-written syntax highlighter for java.
    • helpers.pas demonstrates how to use helpers, by adding some python-style methods to pascal strings.
  • goldsmile/zgld25 was a start on a game that I put together in a few hours after giving up on a different game entry for ludum dare 25.

reverse defender game

  • lazmvc is an example GUI program I made in Lazarus that illustrates the Observer pattern. (It's a small custom implementation that doesn't take advantage of the standard fpObserver unit, but maybe someone out there will find it enlightening.)

educational stuff

  • sabren/b4 contains a bunch of experiments related to a programming course I hope to present to the world some day. Of particular interest is the /ng directory, which contains a complete implementation of the ngaro virtual machine from retroforth, including implementations of the text/graphics console using SDL and ZenGL.

text/graphics console using SDL

  • minrel is a start on a minimal relational database, written as a literate program. Eventually I hope to guide readers step by step through building this system, but right now there are only 3 lessons. Much of what I eventually want to write about is already working in minneron (below) using SQLite for the database.
  • I also have some programming videos online at user/tangentstorm on youtube. Sadly, there's not anything pascal related right now, except for a little turbo pascal experiment I made from scratch in a few hours, showing off various console-mode micro-processes and widgets. (The code also works under fpc and you can see it at sabren/b4/turbo)

minneron

minneron/minneron contains my main project, a novel computing environment that combines a hypertext editor, graph database, and scripting engine. It's nowhere near ready for public consumption, but there's plenty of neat stuff already working.

minneron screenshot