home *** CD-ROM | disk | FTP | other *** search
- /**
- *
- * Name qygcoun -- Get country information from DOS
- *
- * Synopsis error = qygcoun(pcountry,pinfo);
- *
- * int error 0 if OK
- * 2 if info not available for designated
- * country (error code is from DOS)
- * unsigned *pcountry
- * Country code. Let the value be 0
- * initially to default to current
- * country. This is ignored on
- * DOS 2.x.
- * COUNTRY_INFO *pinfo
- * Pointer to structure to receive info
- *
- * Description This function retrieves DOS's table of information about
- * the country for which it is configured and about how to
- * format time, dates, and money for various countries.
- *
- * This function is primarily for use with DOS 3.0 and
- * greater. Earlier versions of DOS return information for
- * the current country only (ignoring *pcountry), and they
- * fill only the "date format" and "currency symbol" fields
- * of the *pinfo structure.
- *
- * If the DOS version is 3.0 or greater, you can request
- * information about any country by putting the country
- * code into an unsigned and passing its address as the
- * pcountry argument. To request information and the
- * country code for the current country, use a country code
- * of 0. The code of the current country will be returned
- * in *pcountry.
- *
- * Returns error Error code: 0 if OK, 2 if unknown country
- * *pcountry Country code of requested country
- * (if DOS version 3.0 or greater)
- * *pinfo Table of information for requested country
- * (only partially valid if DOS version < 3)
- *
- * Version 3.0 (C)Copyright Blaise Computing Inc. 1986
- *
- **/
-
- #include <bquery.h>
-
- int qygcoun(pcountry,pinfo)
- unsigned *pcountry;
- COUNTRY_INFO *pinfo;
- {
- DOSREG regs;
- ADS buf_ads;
- int al,error,dosver,minor;
-
- if ((dosver = qydosver(&minor)) < 3)
- al = 0;
- else if (*pcountry < 255)
- al = *pcountry;
- else
- {
- al = 0xff;
- regs.bx = *pcountry;
- }
-
- utabsptr((char *)pinfo,&buf_ads);
- regs.ds = buf_ads.s;
- regs.dx = buf_ads.r;
- regs.ax = utbyword(0x38,al);
-
- error = dos(®s);
-
- if (dosver >= 3)
- *pcountry = regs.bx;
- else
- { /* Zero the code pointer in case this */
- (pinfo->cmap).r = /* gets passed to casemap(). */
- (pinfo->cmap).s = 0;
- }
-
- return error;
- }