Oh boy, it's starting time sound like "Instant Pascal", (incidentally anything but instant).
I think what you mean is that you store a #1, but want to retrieve an ordinal 1. I think your compiler calls ordinals Scalar. (?)
Normally I'd use Ord() to convert Char to ordinal but I have a feeling you don't have that option.
Yes I can use ORD() in HiSoft Pascal or Turbo Pascal 3, I think it's a very standard Pascal Function, if it's not there, then it will be a very limited Pascal Language.
The good news is I have been able to write a function which converts a number string into a number (see below).
Early compilers are why I think most people hate Pascal. They really do have some stupid limitations, and in a lot of cases appear to be intended only to compile certain classroom code.
Unfortunately I don't know a great deal about the Pascal Compilers in the 70s, Chuck(G) listed some of those Problems in the "Status of Pascal" thread and I came across the Limitations on a String Length to be Fixed, so a CHAR Array needs to equal the Length specified.
Turbo Pascal seems to have been a bit of a game changer for the Language and manages Strings with a bit more flexibility, early Turbo Pascal Languages had to define a STRING globally, as my example shows, though later versions were able to Define Strings just about anywhere I think.
In Hisoft Pascal, there's no String type, so an char array is the next best thing, the PACKED keyword exists for compatibility reasons for other Pascal Compilers, though HiSoft state in their manual that all arrays are Packed, but it's only really the Boolean Array's which would take the most advantage of a Packed Array.
I've stuck with the language since school, though I was initially using Apple Pascal on a Mac around the early to mid-90s, then I was using Delphi for Windows 95, part of that course involved translating Turbo Pascal into Delphi & after School was porting Turbo Pascal stuff using Turbo Pascal 3, obviously not everything worked, but managed to get a bit of stuff compiled, so it would run under CP/M-86. I then turned to TP3 for CP/M, so I could write code on my Amstrad, but as my Turbo Pascal site shows, quite a bit of Machine Specific crept into it, so I've turned my attention to Hisoft Pascal, which doesn't rely on CP/M being present, so programs are RUN from the BASIC prompt, I can also save programs to Tape as well.
I'm spoilt, in that I didn't learn Pascal until TP4, by which time the language was very serious, and certainly has all the capabilities of other languages.
TP4 was when Borland turned their attention to the DOS platform, I think it was when they had significantly changed their Editor to have Pull-Down Menus, Units were also introduced as well as LongInts & Word Types, not sure if INC(); & DEC(); were also brought in as well. EXE files were generated, I'm unsure how big they were, I've used TP 5.5, which was able to produce a Small EXE file, due to the Compiler being able to selectively use what the Program Required.
All very well and good except there's no more CP/M Compilers. TP3 produced COM files (in CP/M & DOS), CMD if you had CP/M-86 version, TP3 had a single Library (no units), the IBM PC version had the largest files because of all the extra goodies included in a Library, so everything used & not used was put into a COM (or CMD) File. So in Tp3 you could program for a 8bit computer or 16bit. Editor for it is very Basic, no pull-down menus and one has to send a key command to get back to the menu options [CTRL]+[K]+[D].
My solution to this problem has been to write my own compiler. Unfortunately, in ten years I have got absolutely nowhere on that.
A couple of people have started writing Pascal compilers for 8bit computers, though one of the guys ceased writing due to lack of time & had noticed that someone had written a BASIC compiler to produce some very tight Assembly & as I've probably mentioned elsewhere, C has become a popular language to generate cross-compilable code for whatever old machine you have. It just means you using a Powerful Computer to produce the Code.
Anyway back to your problem, I think the compiler just expects you to use Integers for all non-Real numbers.
Yes, so in my earlier program with SET of Palette, I've written an array with values from 0 to 26 in it, the Type Palette = 0..26; holds the Range of values, so when I define "ink = set of palette;" it will only accept numbers between 0 & 26. My col : ink; allows me to assign a set of values to it, I'm not sure how many values it can allow, given there's 27 combinations, I'm only allowed to use 16 of those cause my computer in Low-Resolution only lets me use 16 Colours (0-15).
I'll have to check out this Hisoft Pascal.. I'm still confused though because Hisoft wrote HighSpeed Pascal, which was an excellent clone of Turbo Pascal 5 that even had improvements over that. It really was the cat's meow. It was even faster than TP, and generated smaller code!
I wonder if there weren't two different Hisofts.
Ok, so from what I can see HighSpeed Pascal is an Amiga & Atari Pascal Compiler written by HiSoft, I don't know when they first started writing it v1.13 is dated 1990 I noticed. Hisoft Pascal from what I can work out started on the
ZX Spectrum System (an 8bit system) in 1983, shortly after Alan Sugar launched the Amstrad CPC464 in 1984, Hisoft Pascal 4T was one of the early languages distributed for it (which is what I'm using). I don't know a great deal about the ZX Spectrum version of Hisoft Pascal, though a number of things were added to the Amstrad version to cater for some of the features of the machine and in particular it's possible to tab into the Library of routines without the need of writing Inline M/C. Though the Compiler does provide a number of Pascal Functions, so something more generic can be produced, though like TP3, it produces a Library file of those routines, so it resolves that by letting the user tap into the Library bank of the machine.
So this is what I came up with, I made some alterations so the code works in TP3, so in this example I can turn a string from 00 to 99 and return it into it's Number format. I've used ORD() to get the Ordinal Value subtracted 48 from it to get the actual number and then use CASE on that number and use isgreater based on the digit, so that lets me get the actual digit from the string value passed through ConvNum.
Code:
PROGRAM GetNumber;
TYPE anum = STRING[2];
VAR str : anum;
num : integer;
FUNCTION ConvNum(str : anum) : integer;
VAR mynum : byte;
num1 : byte;
num2 : byte;
isgreator : byte;
BEGIN
num1:=ord(str[1])-48;
CASE num1 OF
0 : isgreator:=0;
1 : isgreator:=9;
2 : isgreator:=18;
3 : isgreator:=27;
4 : isgreator:=36;
5 : isgreator:=45;
6 : isgreator:=54;
7 : isgreator:=63;
8 : isgreator:=72;
9 : isgreator:=81
END; { CASE Statement }
num2:=ord(str[2])-48;
mynum:=num1+isgreator+num2;
ConvNum:=mynum;
END;
BEGIN
num:=convnum('26');
writeln('Your Number is: ',num);
END.
All I need to do is see if I can send a longer string of numbers, and have them converted to their proper values.