Menu

Retro Code

January 5, 2015 - Programming

Recently, I took to wandering about in some of my decades-old projects. It is interesting to see the things I was passionate about then be considered so outmoded by myself today, and yet at the same time, still impressive given the limitations I was working in at the time. A more recent old project was a VB6 project that effectively creates a Geometry and drawing library and adds a Brushes and Pens to VB6, where normally you only have the ability to specify a solid colour as a brush and some limited pen styles. Another very old project is a “Hook” library designed to allow the implementation of Windows Hooks from within a Visual Basic Program. With some of the much older programs I consider myself lucky that I did not have regular, easy Internet Access at the time, as at the time I thought the programs I built were awesome when, today, they feel terrible. In particular some of my earliest QuickBASIC Programs have the standard air of teenage overconfidence one can find all over forums today that I am grateful is safely encapsulated within my own Disk Drive, rather than in the wild on a forum post that can be traced to me. And yet, ironically- I’ll toss one of these examples up in source code form, just so I can look at it in the setting of a blog post.

STRUCT

“STRUCT.BAS” was a program I wrote in QuickBASIC that has the purpose of taking a BASIC Source code file and formatting the code therein and writing that output to a new file. Effectively, it performed the same function as “Reformat Code” does in most modern IDE software today, on old QuickBASIC and Early VB Code.

Honestly I’m not sure if that is really a bad goal. At the time the IDE software didn’t really offer that feature and were basically just text editors, so it was left to me to format my source code properly and it was a simple enough premise that I could wrap my head around it and really dig into the problem. The program was written in QuickBASIC 7.1, and was designed to run on Visual Basic Source code files and QuickBASIC source code files, both saved in the text format.

This is not a bad program. It works for it’s simple function. The main thing I notice is that the program has a lot of repeated code. What it boils down to is finding lines that start with certain text and using them as an indicator to either increment the number of tabs, decrement the number of tabs, or set the tab count to 0. The task isn’t super simplistic- as there are some considerations particularly for standard BASIC indenting that need to be considered. Though considering it, I imagine things like Regular Expressions could really be utilized for the tasks in question.

Have something to say about this post? Comment!