T.R | Title | User | Personal Name | Date | Lines |
---|
2681.1 | DateStamp( v ); | EEMELI::LINDEN | | Tue Jul 11 1989 09:53 | 7 |
| Well sofar I haven't got the DateStamp( v ) working, but I have found
two source codes for Clock programs wich uses DateStamp( v ) function,
but because I don't have knowledge of C I wanna know what does '&'
standfor in an function call before an variable ie. DateStamp( &now );
- Kari
|
2681.2 | | TALLIS::MCAFEE | Steve McAfee | Tue Jul 11 1989 11:57 | 18 |
|
& means supply the address of the variable. so if you have
int num;
incr( &num);
then incr might do something like:
void incr ( val)
int *val;
{
*val += 1;
}
Notice that this actually increments the value in num.
- steve
|
2681.3 | | EEMELI::LINDEN | | Tue Jul 11 1989 12:21 | 5 |
| Thanks !!
Now I've an change getting the DateStamp(v) work in the MCC Pascal.
-Kari
|
2681.4 | Sample program using DateStamp... | EEMELI::LINDEN | | Wed Jul 12 1989 13:25 | 49 |
| Nope, I didn't get it work... I getting quite desperate with this
program....
Well here is my Pascal listing for it:
---
PROGRAM date(input,output);
INCLUDE 'libraries/dos.h';
INLCUDE 'libraries/dosextens.h';
VAR
now : Datestamp;
hours, minutes : REAL;
INCLUDE 'libraries/dos';
BEGIN
DateStamp ( now ); <--- here compiler tells SYNTAX ERROR ....
hours := now.ds_Minute / 60;
minute := now.ds_Minute MOD 60;
WRITELN ( hours, minutes, now.ds_Tick / TICKS_PER_SECOND );
END.
---
And the MCC Pascal has declared the DateStamp and it's variables :
In 'libraries/dos.h':
---
TYPE
DatestampPtrType �Datestamp;
Datestamp =
PACKED RECORD
ds_Days, ds_Minute, ds_Tick : INTEGER;
END;
---
and in 'libraries/dos':
---
FUNCTION DateStamp(v:DatestampPtrType) : DatestampPtrType; EXTERNAL;
---
So I'm still stuck on the same problem as in the first note.
- Kari
|
2681.5 | | TALLIS::MCAFEE | Steve McAfee | Wed Jul 12 1989 14:11 | 18 |
| I believe the problem is that you declared:
now : Datestamp;
I thing what you want is:
now : DatestampPtrType;
This is because the argument to the function must be a pointer to the
Datestamp record. Pascal/M2 are strongly typed and will give you errors
when you supply the wrong type of argument. You will probably want to do a
new( now); before you call Datestamp. This will allocate the space
for the record. Also somewhere before you exit you should do a
dispose( now); to free up this memory.
regards,
steve
|
2681.6 | I'll try it again... | EEMELI::LINDEN | | Thu Jul 13 1989 10:22 | 8 |
| I think that I've already tried that, but I'll check it out !
This problem has bugged me almost three weeks for now...so I'm getting
quite desperate..8+) Well maybe it just feels too hard to overcome...
Anyway thanks again for the help!!!
- Kari
|
2681.7 | IT WORKS AFTERALL!!! | EEMELI::LINDEN | | Fri Jul 14 1989 10:45 | 45 |
| The big fight against the DateStamp problem is over and I did solve the
problem wich I had in it.
Thank You very much Steve for the last help you gave me, it helped lot,
although it wasn't the straight answer.
Here the final working Pascal listing for the problem, hopefully it is
usefull if someone else is having problems with system function on
the MCC Pascal.
This ain't the cleanest code that I can generate because this is just
an test to get DateStamp workable and the final version will used in
port of an PC Benchmark program written in Turbo Pascal, that should be
ready for this weekend, so I might then reveal some benchmark test
results with AMY at 7 and 14 Mhz speeds against some PC's.
---
PROGRAM time(output);
INCLUDE 'libraries/dos.h';
INCLUDE 'libraries/dosextens.h';
VAR
now : DatestampPtrType;
hours, minutes : REAL;
h, m : INTEGER;
INCLUDE 'libraries/dos';
BEGIN
NEW ( now ); (* make space available to the pointer *)
now := DateStamp ( now ); (* read time to pointer *)
hours := now�.ds_Minute / 60; (* calculate hours *)
minutes := now�.ds_Minute MOD 60; (* calculate minutes *)
h := TRUNC ( hours ); (* make hours as integer *)
m := TRUNC ( minutes ); (* make minutes as integer *)
WRITELN ( 'Time is : ',h:2,' : ',m:2,' : ',now�ds_Tick / TICKS_PER_
SECOND:5:2 );
DISPOSE ( now ); (* free the memory for pointer *)
END.
---
- Kari
|