Sender: nate AT cartsys DOT com Message-ID: <35C8A6FA.33C4E602@cartsys.com> Date: Wed, 05 Aug 1998 11:39:54 -0700 From: Nate Eldredge MIME-Version: 1.0 To: Eli Zaretskii CC: djgpp-workers AT delorie DOT com Subject: Re: emu387 functions undocumented/undeclared References: Content-Type: multipart/mixed; boundary="------------DEC07EED5226532D299F117C" Precedence: bulk This is a multi-part message in MIME format. --------------DEC07EED5226532D299F117C Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Eli Zaretskii wrote: > > On Tue, 4 Aug 1998, Nate Eldredge wrote: > > > The functions in the emu387 tree of libc aren't documented, and also > > aren't declared in any headers. The major one of interest is > > `_detect_80387'; there is also `_npxsetup' and a few globals. I will > > write the docs, but what header should they go in (if any)? > > I suggest for `_detect_80387', since that's where the _8087 > global variable is declared in TC and BC. And while at that, how > about adding _8087 as well? Herewith the patch that accomplishes that. > > Also, what is the policy on documentation of functions? libc.inf says > > it documents "all public symbols", but that's not really the case. Some > > public symbols are internal to the library and completely useless to an > > application. (Examples: __crt1_startup, and the dummy > > __emu387_load_hook.) Should we document them, if only to say "internal > > to libc, don't use"? > > Personally, I think that everything should be documented. The reason > is that, given a good index in libc.info, a user can look up relevant > functionality in a centralized place. Without that, the only option > is to grep the library sources (or use ID-utils) which leave no real > clues about the purpose of these facilities except what their names > tell. > > That said, I'm not the one who makes policy decisions around here. > > In practice, I would first worry about documenting *useful* > functionality, like the `end' symbol, before we get to documenting the > rest of them. Good point. DJ? -- Nate Eldredge nate AT cartsys DOT com --------------DEC07EED5226532D299F117C Content-Type: text/plain; charset=us-ascii; name="patch" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="patch" *** include/dos.h~ Wed Jun 12 16:56:20 1996 --- include/dos.h Wed Aug 5 11:29:42 1998 *************** *** 10,15 **** --- 10,19 ---- #include + extern int _8087; + + int _detect_80387(void); + struct DWORDREGS { unsigned long edi; unsigned long esi; *** src/libc/emu387/npxsetup.old Wed Aug 5 11:30:52 1998 --- src/libc/emu387/npxsetup.c Wed Aug 5 11:31:18 1998 *************** *** 17,22 **** --- 17,23 ---- #include #include #include + #include /* for _8087 */ #ifndef IMBED_EMU387 #include static int (*_emu_entry)(jmp_buf exc); *************** *** 24,29 **** --- 25,32 ---- int _emu_entry(jmp_buf exc); #endif + int _8087; + /* crt0.o references __emu387_load_hook just to pull in this object in libemu.a. Using -lemu -lc brings in the static objects instead of a dynamic link. */ *************** *** 74,79 **** --- 77,83 ---- nested FPU client fault - DJ */ __dpmi_set_coprocessor_emulation(1); have_80387 = _detect_80387(); + _8087 = (have_80387 ? 3 : 0); } if (cp && (tolower(cp[0]) == 'q')) { *** /dev/nul Wed Aug 5 11:32:11 1998 --- src/libc/emu387/fpu.txh Wed Aug 5 11:29:40 1998 *************** *** 0 **** --- 1,42 ---- + @node _detect_80387, cpu + @subheading Syntax + + @example + #include + + int _detect_80387(void); + @end example + + @subheading Description + + Detects whether a numeric coprocessor is present. Note that + floating-point will work even without a coprocessor, due to the + existence of emulation. + + @subheading Return Value + + 1 if a coprocessor is present, 0 if not. + + @subheading Example + + @example + if (_detect_80387()) + printf("You have a coprocessor\n"); + @end example + + @c ---------------------------------------------------------------------- + @node _8087, cpu + @subheading Syntax + + @example + #include + + extern int _8087; + @end example + + @subheading Description + + Contains @code{3} if a numeric coprocessor is installed, otherwise + @code{0}. Provided for compatibility with other DOS compilers. + + @c ---------------------------------------------------------------------- --------------DEC07EED5226532D299F117C--