Exotic programming languages for DOS: Profan.
"Profan2 is a powerful programming language for Windows 95/98/2000 or NT. With "powerful" we mean, that the language includes rather lots of functions, and is able to well compete with other (more complicate) languages. Especially for beginners, its simple commands make it worth to be given a try".
The paragraph above is a free translation of how they describe Profan 7 on the SelfProfan website. That site, in German, is a tutorial about Profan 7 on Windows; the information about the non-GUI commands and functions should however mostly apply to the DOS version, too.
This tutorial is about the installation of Profan 7 for DOS on FreeDOS. It probably applies to other DOS distributions, too. Profan 7 for DOS can be downloaded from the XProfan website. Be sure, to pick the 32-bit DPMI version (there is also an older 16-bit version available). Important to note that the interface of the included editor, as well as the compiler error messages are in German. The "international" file, available at the download page, is unfortunately for the Windows version, only. There is a help file for DOS available ("Hilfe für PROFAN 7.0 für DOS"); the problem is that is intended to be used with Norton Guide or similar software; I have not yet find a program to open .ng files. You can, however, download the Profan 6.6 user manual (German: "Profan 6.6 Handbuch"). It's not version 7 and it's for Windows, but the download archive containing a reference of the variables, functions and commands available in the DOS version, you can use that manual to view their syntax and usage.
The download archive contains the program's folder structure. Unzipping it on my Windows 10 using 7-Zip failed with an invalid header error
message for two of the executables, that were not extracted. Thus, put the .zip file on a floppy diskette and "install" the software by running the commands (supposing the
archive is contained on a diskette in drive A:):
mkdir c:\profan
a:
unzip -d c:\profan profdos.zip
The screenshots below show the extraction of the archive (don't worry about the warning messages; the extraction is done correctly) (on the left), and the installation directory with the Profan 7 files (on the right).
The installation files include an IDE, called rpe70.exe. As I said above, the interface is only available in German. The first time that you start it, you get the message "Optionsdatei konnte nicht gefunden werden" (Options file not found). This is normal; a default options file will automatically be created.
Each time the IDE is started, a notice is displayed. It tells us that the actual program is the freeware version of the RGH-Profan-Editor. It may be freely used, copied, and distributed, however, not be modified in any way.
For your convenience, here is the English translation of the most important IDE menu commands:
|
|
|
Important to note, that the IDE awaits the Profan executables in the current directory. So, adding the Profan installation directory to the PATH, setting some working directory (with the sources) as current, will not work. When trying to compile a program, you'll get the error message "compile.bat nicht vorhanden" (compile.bat not found). The simplest way to proceed, is to place the sources together with the Profan executables (in my case, in c:\profan).
Here is the code of a simple "Hello user" program. It shows one of these commands, that make life easy for programming beginners: tbox
draws a nice box, where you can put your text inside, with one single instruction.
declare name$, greeting$
declare x1%, y1%, x2%, y2%
print "What is your name? ";
input name$
cls
let greeting$ = "Hello", @upper$(name$)
let greeting$ = @add$(greeting$, "!")
let x1% = 5
let x2% = @add(x1%, @len(greeting$))
let x2% = @add(x2%, 3)
let y1% = 3
let y2% = 5
color 14, 0
tbox y1%, x1% - y2%, x2%; 1
locate @add(y1%, 1), @add(x1%, 2)
print greeting$
print
print
print
Some notes concerning the code:
- Variables are declared using the command declare; the variable type is indicated by a suffix: % for integers, & for long integers, ! for reals, $ for strings.
- There are no operators in Profan. Use a function (or, if available, a command) instead.
- Functions are prefixed by @, and have one single return value. Note that functions, that return a string must end with a $ prefix. Ex: the function @add() adds two numbers; the function @add$() concatenates two strings.
- The print command adds a line-ending character by default. To avoid this, terminate it with a semicolon.
- The let command may be used with several string parameters. When separated by a semicolon, the arguments are concatenated without separator, when separated by a comma, a space is inserted between them.
- The three print commands at the end of my program are intended to let some space between the textbox and the DOS prompt displayed when the program is terminated. Trying to do this with locate seems not to work. Maybe that this command is somehow bind to the textbox... (?)
The screenshot on the left shows the code of hello.prf opened in the IDE editor. The screenshot on the right shows the program execution (after the name has been entered and the screen cleared).
Here is the code of another Profan program. It reads the names of the files of the current directory, and writes them (as full paths) together with the filesizes to
a text file. The code shows how to use files in Profan (note the usage of #N as file handle, taken from BASIC, and the commands
assign and rewrite taken from Pascal), the special Profan feature of filling a list using the command
addfiles, and the system functions @getdir$() and @filesize().
declare count%, i%, fn$, fs$, s$
assign #1, "DIRLIST.TXT"
rewrite #1
clearlist
addfiles "*.*"
let count% = @sub(%getcount, 2)
print "Number of files in directory: "; count%
print "Directory listing written to: DIRLIST.TXT"
let i% = 0
whilenot @gt(i%, %getcount)
let fn$ = @listboxitem$(i%)
ifnot ((@equ$(fn$, "DIRLIST.TXT")) or (@equ$(fn$, "[.]")) or (@equ$(fn$, "[..]")))
let s$ = @getdir$("@");"\";fn$
let fs$ = @str$(@filesize(fn$))
print #1, s$;@space$(30 - @len(s$));@space$(6 - @len(fs$));fs$;" bytes"
endif
inc i%
wend
close #1
Some notes concerning the code:
- Profan includes a function called @format$(), that is accepted by the syntax checker of the IDE, but produces an "unknown function" error during compilation (?).
- The special variable %getcount returns the count of the elements in the Profan internal list. However, the value returned actually is the index of the last element, rather than the real count (i.e. the real count minus 1). Therefore, the usage of the function @gt() is all correct in the whilenot statement.
- When writing the files, I remove the directory entries "." and "..", as well as the text file containing the list. Thus, the number of files equals the number of list entries minus 3 (as %getcount returns the real count minus 1, it's 2 that has to be subtracted).
- Printing out @sub(%getcount, 2) directly would result in the display of a decimal number with several zeros after the decimal point. To avoid this, assign the expression to an integer variable and print out this one.
- The command @rewrite() seems to always create a file with a name in uppercase (?), so to avoid trouble specify the name in uppercase in your source code.
The screenshot below shows the first part of the content of the file DIRLIST.TXT, created by my directory listing program, opened in the FreeDOS editor.
The installation files include 3 program examples. The screenshots below show the execution of two of them: On the left, the program patience.prf, a patience card game for one player; on the right, mylldemo.prf, the demo of a "junk removal" game.
Is it possible to run the executables created by the Profan 7 compiler/linker on another DOS machine? Yes, it is. However, you must remember that these executables are 32-bit and need DPMI to run on a standard DOS platform. Thus, if you try to run patience.exe, for example, on MS-DOS 6.22, you will get the error message Load error: No DPMI. The solution is simple: Just copy the file cwsdpmi.exe (included with the Profan 7 installation files) to the MS-DOS directory that contains patience.exe. The program should now run without any problems.
If you find this text helpful, please, support me and this website by signing my guestbook.