Mac OS 9
NumberFormatting.h
Go to the documentation of this file.
1 
18 #ifndef __NUMBERFORMATTING__
19 #define __NUMBERFORMATTING__
20 
21 #ifndef __CONDITIONALMACROS__
22 #include <ConditionalMacros.h>
23 #endif
24 
25 #ifndef __MACTYPES__
26 #include <MacTypes.h>
27 #endif
28 
29 #ifndef __INTLRESOURCES__
30 #include <IntlResources.h>
31 #endif
32 
33 #if PRAGMA_ONCE
34 #pragma once
35 #endif
36 
37 #ifdef __cplusplus
38 extern "C"
39 {
40 #endif
41 
42 #if PRAGMA_IMPORT
43 #pragma import on
44 #endif
45 
46 #if PRAGMA_STRUCT_ALIGN
47 #pragma options align = mac68k
48 #elif PRAGMA_STRUCT_PACKPUSH
49 #pragma pack(push, 2)
50 #elif PRAGMA_STRUCT_PACK
51 #pragma pack(2)
52 #endif
53 
71  {
72  UInt8 fLength;
73  UInt8 fVersion;
74  char data[254];
75  };
76  typedef struct NumFormatString NumFormatString;
78  typedef short FormatStatus;
79  enum
80  {
81  fVNumber = 0
82  };
83 
84  typedef SInt8 FormatClass;
85  enum
86  {
87  fPositive = 0,
88  fNegative = 1,
89  fZero = 2
90  };
91 
92  typedef SInt8 FormatResultType;
93  enum
94  {
95  fFormatOK = 0,
96  fBestGuess = 1,
97  fOutOfSynch = 2,
98  fSpuriousChars = 3,
99  fMissingDelimiter = 4,
100  fExtraDecimal = 5,
101  fMissingLiteral = 6,
102  fExtraExp = 7,
103  fFormatOverflow = 8,
104  fFormStrIsNAN = 9,
105  fBadPartsTable = 10,
106  fExtraPercent = 11,
107  fExtraSeparator = 12,
108  fEmptyFormatString = 13
109  };
110 
111  struct FVector
112  {
113  short start;
114  short length;
115  };
116  typedef struct FVector FVector;
118  typedef FVector TripleInt[3];
119 #if CALL_NOT_IN_CARBON
128  void
129  stringtonum(const char *theString, long *theNum);
130 
139  void
140  numtostring(long theNum, char *theString);
141 
142 #endif
152  void
153  StringToNum(ConstStr255Param theString, long *theNum);
154 
163  void
164  NumToString(long theNum, Str255 theString);
165 
174  FormatStatus
175  ExtendedToString(const extended80 *x, const NumFormatString *myCanonical,
176  const NumberParts *partsTable, Str255 outString);
177 
186  FormatStatus
187  StringToExtended(ConstStr255Param source, const NumFormatString *myCanonical,
188  const NumberParts *partsTable, extended80 *x);
189 
198  FormatStatus
199  StringToFormatRec(ConstStr255Param inString, const NumberParts *partsTable,
200  NumFormatString *outString);
201 
210  FormatStatus
211  FormatRecToString(const NumFormatString *myCanonical,
212  const NumberParts *partsTable, Str255 outString,
213  TripleInt positions);
214 
215 #if OLDROUTINENAMES
216 #define FormatX2Str(x, myCanonical, partsTable, outString) \
217  ExtendedToString(x, myCanonical, partsTable, outString)
218 #define FormatStr2X(source, myCanonical, partsTable, x) \
219  StringToExtended(source, myCanonical, partsTable, x)
220 #define Str2Format(inString, partsTable, outString) \
221  StringToFormatRec(inString, partsTable, outString)
222 #define Format2Str(myCanonical, partsTable, outString, positions) \
223  FormatRecToString(myCanonical, partsTable, outString, positions)
224 #endif
226 #if PRAGMA_STRUCT_ALIGN
227 #pragma options align = reset
228 #elif PRAGMA_STRUCT_PACKPUSH
229 #pragma pack(pop)
230 #elif PRAGMA_STRUCT_PACK
231 #pragma pack()
232 #endif
233 
234 #ifdef PRAGMA_IMPORT_OFF
235 #pragma import off
236 #elif PRAGMA_IMPORT
237 #pragma import reset
238 #endif
239 
240 #ifdef __cplusplus
241 }
242 #endif
243 
244 #endif
Set up for compiler independent conditionals.
International Resource definitions.
Basic Macintosh data types.
void numtostring(long theNum, char *theString)
void stringtonum(const char *theString, long *theNum)
FormatStatus FormatRecToString(const NumFormatString *myCanonical, const NumberParts *partsTable, Str255 outString, TripleInt positions)
FormatStatus StringToExtended(ConstStr255Param source, const NumFormatString *myCanonical, const NumberParts *partsTable, extended80 *x)
FormatStatus ExtendedToString(const extended80 *x, const NumFormatString *myCanonical, const NumberParts *partsTable, Str255 outString)
void StringToNum(ConstStr255Param theString, long *theNum)
FVector TripleInt[3]
Definition: NumberFormatting.h:118
void NumToString(long theNum, Str255 theString)
FormatStatus StringToFormatRec(ConstStr255Param inString, const NumberParts *partsTable, NumFormatString *outString)
x
Definition: ToolUtils.h:163
Definition: NumberFormatting.h:112
Definition: MacTypes.h:206
Definition: NumberFormatting.h:71
Definition: IntlResources.h:212