l. 1 Ctmpiler Dtif fermces
1.2 Library Differes
xjst of the differmces betRen Version 2.1 aíü version 2.0 are in the library, as stmnarized in the Eollowim
list:
— Automatic sensiW of MS-DOG I vs. MS-DOS 2
— Autcmatic ms: tnj and use of 8087 math chip
— UNIX-cmpatible math fmctions
— FauvExEc ccmbination
f
imctions— ASCII/BINARY rmde specifiers on FOPEN
— Mcess to errvirornent strings
— Miscellmeow library add itions
W? have attanpted to keep all of the 2.1 chatyjes upward canpatible with Version 2.0, arü so you should not have to change my existim pr¢jgrans. lbwever, the Mdi tion of MS-DCS version
I
sensing and 8087 sensing has caused the library togrow a bit.
Therefore
, prcgrans that were close to a manory limit might be affected. Also, the FCRK/EXEC caµíbility forced us to chanje our approach to memory allocation, which may affect prograns that
bypass our staMard m~ry managanent functions. This change in
the manory lajput for the S and P imdels forced a change in the
code generated to detect stack overflow, which means that
prograns using these models must be entirely reccmpiled before
they can use the new library. See section 6 for more details.
Version 2.1 also includes bug fixes in both the ccmpiler and the library. These sMuld all Le transparmt, since none of the
doctíaented interfaces were changed .
Finally, m've improved the operating procedures by aiding an LC
canínarü that invokes both canpiler passes and by aiding several
batch f lies that copy the release disks to our rec«mended directory structure on systans with hard disks.
The following sectionsdescribe these differences in detail.
table Of camtns
2.0 NEW CCMPI= FExñRE3 3
3.0 -MS-COS VERSION SENSING 6
4.0 AUKMATIC SEN3ING AND USE (JÉ 8087 MATH CHIP 7
5.0 UNIX-CCMPATIBLE MATH FLNcTr= 8
6.0 FCRK/EXEC CCMBINATION FUNCTICN3 20
7. 0 ASCII/BINARY MOLE SPECIFIERS CN FDPEN 24
8.0 access m mIRcNqENT strings 25
9.0 MISCELLANEOUS LIBRARY AñDITIcNs AND CORRECTIONS 27
10. 0 CCNVENIENCE FEAMES 34
11.0 LIST (JE FILES 36
2
Lattice 8086/8088 C Ccmpiler Supplm«it for Version 2.10
2.0 NEW CCMPILER FEATURES
In addition to the wual buj fixes, this version of the compiler
has been enhanced in several ways. These enhancements make i t
easier to Ejerforln conditional ccxnpilations, and allow a larger
class of prcgrans to be accepted by the compiler. At the sane
tiíne
, several helpful warnings have been added which can often point to coding errors.
2.1 New Storage Class Size Lhnitatíom
In the previous version of the ccxnpiler, no object could exceM
32767 bytes in size; moreover , the combined size of all objects
declared for a particular storage class was subject to the sane limitation. In Version 2.í, the limit has been charged to 65535 bytes, for static arkj extern objects only. Structures may be
declared which are in excess of 32767 bytes, but the error
message "maximun object/storage size exceeded" will be generated
if
an attanpt is made to declare m auto structure of that size.2.2 CkmRrKj Line Definition of Pre-processor Sydxñs
'Ihe -d flag has bem exterüed to allow symbols to be ídefined
frcm the ccmnarxi line. 7his feature allo'ws source files
contain-ing conditional ccnpilation directives (#ifdeE, Ufridef,
tit,
telse, #eMif) to be used to prodtre dif ferent results witMut
modifying the source Elle, simply by definiW the appropr late
syntxil on the Lcl cQmnam. The -d fWj in its simplest form retains the same meaning as in the previous version (i .e.,
it
causes the ccmpiler to include line-number information in the object file) . The new forms of the ccmnand are
-ásydbol 4SµdbD1"value
where "symbol" is a stardard C idmtifier. The
first
form merelydefines the symbol with a null substitution text; the equivalent
C statmmt is Klefine syt±ol
'Ihe second Eorm ees an equal sign to attacha substitution text
"value"; its equivalmt is tdeflne
~1
valueSeveral definitions can be wed in the sane LCl cxmnand; however,
macros with argments cannot be defined fran the ccmnand line. 2.3 Pre-deffned
As a further assistance
~Is
to conditional empilation, the compilernow autcmatically #def ines several sµtols, which can be tested in coMitional cxmpilation statments to select appropr late cede
sequences for the operating systm, memory mcdel, and so forth.
3
These symbols have also simplified the new version of LCG.H aM eliminated the need for the MSÍXJS. H, SM8086.EI, R'18086.H,
IM8086. H, and LM8086.H heiáder files supplied with Version 2.00 of
the canpiler .
'I\nkj sµnWls are alwYs defined in the compiler:
[define MSJXE3
l
Hefine 18086 I
One of the following symbols is defined, depending on the manory
mcxiel s£?ecified:
ídefine IB086S
l
definedif
S mcdel, else trdefined fdefine Í8086Pl
definedif
Pmdel, else mdefinedtdefine I8086D I defined
if
D model , else tmdefinedtdefine I8086L I defined
if
L model, else uMefinedOne or the other of the following is also defined, deWMi% on the manory model:
tdefine SPTR I defined
if
S or P cmdel#define
~ i
definedif
D or L modelIf
the -s option ms spcified on LCl, the following symbol isdefined:
tdefíne SELIG
l
Finally,
if
the -d fliqj was specified (as"d",
not "-dsyntx)]") f the following symi»l is defined:idefine I
The automatic definition of these synúbols can be µevmted by usirg a new ccinpiler flag:
—u
Specifying this
fW
on LCl cancels all of the above definitions.2.4 Optional Wjüí Aligment
An option to s%Fxjrt aligment of data elanmts other than cMr
to an even (mrd) offset has bem provided :
-W
Speci fyinj this flag on LCl causes all data elanents except char itans t"j be assigned tÁj even offsets. Uiis aligmmt prcduces mre efficient cede on art 8086 processor, mere fetchirg a mrd
on an odd byte Hundary requires four additional clock pericds.
tibe sane aligment was used as the default in version 1.04 of the
ccmpileL .
4
Lattice 8086/8088 CQmpiler Supplanmt for Version 2.10
2.5 &icpaMed Line ani Macro Sizes
Formerly, the substitution text for a #define macro was limited
to a maximm of 80 bytes; in Version 2.10, the new maximun is 256
bytes. Similary, the previous maximun size of an input source
line was 132 bytes; the new maximun is 256 bytes.
2.6 New WarniW Messqjes
M
new warniW messages have been aided tiO Versicn 2. ID of the canpiler. They are:Warning 84: redefinition of pre-processor symbol "xxxx"
Warning 85: fimction return value mismatch
'lbe
fi
rst warning is issued whenever a #define statemen t i 3enco untered for m alreerly #defined synbol. As noted in tho
inanual , the second definition takes precedence, but requires An
additional #undef statment before the symbol is truly undefined.
The secorü warning is issued Üjenever the value returned by a function is mt of the sane type as the function itself. The
value specified is autcmatically converted to the appropriate
tyµz; the warning merely serves to notify you of the conver: ñon.
The warning can be eliminated by usirg a cast 3perator to Fo rce
the return value to the fmction type.
Version 2.00 of the compiler generated warning 30 ("pointers clo
not point to sane object") only when the result of an assigment statanent was a pointer. In Version 2.10, the same warning 1:3
generated when a pointer of any type is assigned to an arithnetic object. a new warning (duplicate declarat.ion of item. "XXXX") is
now generated whm a formal par aneter for a function 1:3
redeclared at the lowest level inside the fmction, as in f(X)
char x;
{
int x;
Finally, the Lgé of an undefined structure tm in a pointer declaration now causes only a warnim , not an error,
if
thestructure is never defined — as loW as no attmpt is mMe to refer to the structure's members, or to perform arithnetic with
the pinter .
2.7 New Error -|· · · ,1'·1
~
If
either oFerand in a logical CR (II) or logical AND (&&) expression is constant, the ccxnpiler now will generate the err3rmessaje "invalid constant expression".
If
the end of sourcefile
input is detected inside a constant, the error message
"mexpected end of file" will be generated.
5
3.0 ms-dc6 vmsxm sen3ing
The start-up prcgran (see C.A&°l) now sets up a global variable
naned dos that indicates which version of MS-DKJS is active.
'Ihe li6rary fmctions then test this variable at appropriate
points in order to call the proper low-level operating systan service fmctions.
You can refer to dos in twD mys, as follow:
extern char dos;
extern char "dos [2] ;
—
The ms-= major version ntxüer (l or 2) is then ffómd at dos (fl rst rnetMd) or dos[0] (secoM metPM) . The mino r version—.
ntxnber is fotrid at dos[l] for the second metMd only.
As jpu can see by exanining
c.m,
the MS-= version information is obtained via operatim sYstaa call 30, ídüch is fullydescribed in the MSAJOS or
FC~
Téchnical Refermce. We wsure that dos will never contain a value of 0 when operating uwüerand we may use the 0 value to indicate CP/M-86 in a future release.
6
Lattice 8086/8088 C Qxnpiler Supplanent for Version 2.10
4.0 AUKMATÍC SEN3ING AND USE OF 8087 MATH CHIP
The floatíryj point simulation functions in the library have betm
changed to detect the presence C1É the 8087 níath chip. IE the chip is -installed, Y3ü should notice a l áLjQ pzr Eu)rmáníü"
improvment in prograns that do many floatinj µÁnt Qµeratic}i1s.
Ñjtice that you do not need to usc" |.!íc? -E
f!:
vj i j or"h±í '..) obtát':the benefits ctf the 8087 under Ver:Mn 2. :
-
F·-lrth: ?rmore, timprogrms that you generate will rim c?rrg-: ¿:}' o: ' a sys: am 'withou:
the math chip. Ink are
still
c-3n3íd'.'ri¡ij t'iú u.f.e of the-t fj'jj
to stimulate in-line 803? ccxle ,j'·m: itian, but this may bo
dropped
if
the bi-modal library appro ich píoy·g?s adequate.7
5.0 LNIX-CCMFATIBLE MA7H FLNCTICN3
Version 2.1 incluies a large portion of the floating
pint
mathfunctions that are usually provided with LNIX. Detailed specif ications are given in the following manual pages. bbte thatincluded
tN
whenheaier files math.h and limits.h should usually bejNjU are using these functions.
8
Wttice 8086/8088 C Ccxnpiler Supplanent for Version 2-ID
NIWE
exp,lcg Jcgl0,pw,sqrt -- exponential ftmctions
SYNOPSIS
r = exp(x) ; coonpute E**x
r = log(x); canµite natural leg of x r = Icgl0(x); compute base 10 lcig of x r = Fow(Xgy); compute x**y
r = sqrt(x); ccmpute square root of x
double r; result
dotble x,y; arg merits [mmFTIcN
For lago jmgl0, and sqrt, the x argment mwt be positive,
and for pow, the y argunent mwt be an integer
if
x isnegative.
9