|
|
DataMuseum.dkPresents historical artifacts from the history of: CP/M |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about CP/M Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - metrics - download
Length: 1685 (0x695)
Types: TextFile
Names: »CPASDEMO.C«
└─⟦505fbc898⟧ Bits:30002732 Turbo Pascal 5.0 for C-DOS Partner
└─⟦this⟧ »DEMOS\CPASDEMO.C«
/* Copyright (c) 1985, 88 by Borland International, Inc.
This module demonstrates how to write Turbo C routines that
can be linked into a Turbo Pascal program. Routines in this
module call Turbo Pascal routines in CPASDEMO.PAS.
See the instructions in the file CPASDEMO.PAS on running
this demonstration program */
typedef unsigned int word;
typedef unsigned char byte;
typedef unsigned long longword;
extern void setcolor(byte newcolor); /* procedure defined in
Turbo Pascal program */
extern word factor; /* variable declared in Turbo Pascal program */
word sqr(int i)
æ
setcolor(1);
return(i * i);
å /* sqr */
word hibits(word w)
æ
setcolor(2);
return(w >> 8);
å /* hibits */
byte suc(byte b)
æ
setcolor(3);
return(++b);
å /* suc */
byte upr(byte c)
æ
setcolor(4);
return((c >= 'a') && (c <= 'z') ? c - 32 : c);
å /* upr */
char prd(char s)
æ
setcolor(5);
return(--s);
å /* prd */
long lobits(long l)
æ
setcolor(6);
return((longword)l & 65535);
å /* lobits */
void strupr(char far *s)
æ
int counter;
for (counter = 1; counter <= sÆ0Å; counter++) /* Note that the routine */
sÆcounterÅ = upr(sÆcounterÅ); /* skips Turbo Pascal's */
setcolor(7); /* length byte */
å /* strupr */
byte boolnot(byte b)
æ
setcolor(8);
return(b == 0 ? 1 : 0);
å /* boolnot */
word multbyfactor(word w)
æ
setcolor(9); /* note that this function accesses the Turbo Pascal */
return(w * factor); /* declared variable factor */
å /* multbyfactor */
«eof»