Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ nlconvnum(3X) — HP-UX ANSI C A.09.00

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

nlfmtnum(3X)

portnls(5)

nlconvnum(3X)

NAME

nlconvnum() − convert MPE native-language formatted number to ASCII number

SYNOPSIS

#include <portnls.h>

void nlconvnum(

short int langid,
const char *instr,
short int leninstr,
char *outstr,
short int *plenoutstr,
unsigned short int err[2],
const char *numspec,
short int fmtmask,
short int *pdecimals

);

DESCRIPTION

nlconvnum() converts a native-language formatted number to an ASCII number, with an n-computer decimal separator (.) and thousands separator (,), to use for further conversion to INTEGER, REAL, etc. 

This routine converts the decimal separator and the thousands separators to the n-computer equivalent, or strips them, according to the value of fmtmask. If fmtmask and M_NUMBERSONLY is not zero, instr is validated as a number.  If it is null, no validation takes place. 

For languages using an alternate set of digits (currently only arabic, which uses HINDI digits), nlconvnum() also converts these digits to ASCII digits so they can be recognized and used as numeric characters. 

Arguments to nlconvnum() are as follows:

langid A language ID number. 

instr A character buffer containing the native language formatted number to convert.  Leading and trailing spaces are ignored. 

leninstr Length, in bytes, of instr.

outstr Output buffer; an array containing the converted output.  The output is left-justified in the buffer, and plenoutstr contains the actual length of the converted number.  outstring may refer to the same address as instr.

plenoutstr A pointer to the length, in bytes, of outstr. After a successful call to nlconvnum, the short integer to which plenoutstr points contains the actual length of the converted number. 

err The first element of this array contains the error number.  The second element is always zero.  If the call is successful, both elements contain zero. 

Error # Meaning

2 Specified language is not configured. 

3 Invalid length specified (leninstr or plenoutstr).

4 Invalid number specified (instr).

7 Truncation has occurred (outstr is left partially formatted). 

8 Invalid numspec parameter. 

9 Invalid fmtmask parameter. 

numspec A character buffer, as returned from nlnumspec, containing information about correct formatting. If this parameter is not null, langid is ignored and performance is improved (see the description of nlnumspec).

fmtmask An unsigned short specifying how to format the number.  The default value is zero, which means substitution only, convert thousands separators, convert decimal separators, and that instr can contain any character. 

Value Description

M_STRIPTHOU Strip thousands separators. 

M_STRIPDEC Strip decimal separators. 

M_NUMBERSONLY instr contains a number. 

pdecimals Pointer to a variable in which the number of decimal places in the input number is returned. 

WARNINGS

This routine is provided for compatibility with MPE, a proprietary HP operating system.  See portnls(5) for more information on the use of this routine. Use the Native Language Support routines for C programmers described by hpnls(5) for HP-UX NLS support.

AUTHOR

nlconvnum() was developed by HP. 

SEE ALSO

nlfmtnum(3X), portnls(5). 

EXTERNAL INFLUENCES

International Code Set Support

Single- and multi-byte character code sets are supported. 

Hewlett-Packard Company  —  HP-UX Release 9.0: August 1992

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026