Mac OS 9
TextUtils.h
Go to the documentation of this file.
1 
19 #ifndef __TEXTUTILS__
20 #define __TEXTUTILS__
21 
22 #ifndef __MACTYPES__
23 #include <MacTypes.h>
24 #endif
25 
26 #ifndef __NUMBERFORMATTING__
27 #include <NumberFormatting.h>
28 #endif
29 
30 #ifndef __STRINGCOMPARE__
31 #include <StringCompare.h>
32 #endif
33 
34 #ifndef __DATETIMEUTILS__
35 #include <DateTimeUtils.h>
36 #endif
37 
38 #if PRAGMA_ONCE
39 #pragma once
40 #endif
41 
42 #ifdef __cplusplus
43 extern "C"
44 {
45 #endif
46 
47 #if PRAGMA_IMPORT
48 #pragma import on
49 #endif
50 
51 #if PRAGMA_STRUCT_ALIGN
52 #pragma options align = mac68k
53 #elif PRAGMA_STRUCT_PACKPUSH
54 #pragma pack(push, 2)
55 #elif PRAGMA_STRUCT_PACK
56 #pragma pack(2)
57 #endif
58 
92  {
93  SInt8 script;
94  SInt8 runVariant;
95  };
96  typedef struct ScriptRunStatus ScriptRunStatus;
97  struct BreakTable
98  {
99  char charTypes[256];
100  short tripleLength;
101  short triples[1];
102  };
103  typedef struct BreakTable BreakTable;
104  typedef BreakTable *BreakTablePtr;
105  struct NBreakTable
106  {
107  SInt8 flags1;
108  SInt8 flags2;
109  short version;
110  short classTableOff;
111  short auxCTableOff;
112  short backwdTableOff;
113  short forwdTableOff;
114  short doBackup;
115  short length;
116  char charTypes[256];
117  short tables[1];
118  };
119  typedef struct NBreakTable NBreakTable;
120  typedef NBreakTable *NBreakTablePtr;
130  long
131  Munger(Handle h, long offset, const void *ptr1, long len1, const void *ptr2,
132  long len2);
133 
142  StringHandle
143  NewString(ConstStr255Param theString);
144 
153  void
154  SetString(StringHandle theString, ConstStr255Param strNew);
155 
164  StringHandle
165  GetString(short stringID);
166 
175  void
176  GetIndString(Str255 theString, short strListID, short index);
177 
178 #if CALL_NOT_IN_CARBON
187  void
188  setstring(StringHandle theString, const char *strNew);
189 
198  StringHandle
199  newstring(const char *theString);
200 
209  void
210  getindstring(char *theString, short strListID, short index);
211 
212 #endif
222  void
223  FindWordBreaks(Ptr textPtr, short textLength, short offset, Boolean leadingEdge,
224  BreakTablePtr breaks, OffsetTable offsets, ScriptCode script);
225 
234  void
235  LowercaseText(Ptr textPtr, short len, ScriptCode script);
236 
245  void
246  UppercaseText(Ptr textPtr, short len, ScriptCode script);
247 
256  void
257  StripDiacritics(Ptr textPtr, short len, ScriptCode script);
258 
267  void
268  UppercaseStripDiacritics(Ptr textPtr, short len, ScriptCode script);
269 
279  FindScriptRun(Ptr textPtr, long textLen, long *lenUsed);
280 
286 #if CALL_NOT_IN_CARBON
295  void
296  FindWord(Ptr textPtr, short textLength, short offset, Boolean leadingEdge,
297  BreakTablePtr breaks, OffsetTable offsets);
298 
307  void
308  NFindWord(Ptr textPtr, short textLength, short offset, Boolean leadingEdge,
309  NBreakTablePtr nbreaks, OffsetTable offsets);
310 
325 #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
326 #pragma parameter LwrText(__A0, __D0)
327 #endif
328  void
329  LwrText(Ptr textPtr, short len);
330 
339 #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
340 #pragma parameter LowerText(__A0, __D0)
341 #endif
342  void
343  LowerText(Ptr textPtr, short len);
344 
353 #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
354 #pragma parameter StripText(__A0, __D0)
355 #endif
356  void
357  StripText(Ptr textPtr, short len);
358 
367 #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
368 #pragma parameter UpperText(__A0, __D0)
369 #endif
370  void
371  UpperText(Ptr textPtr, short len);
372 
381 #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
382 #pragma parameter StripUpperText(__A0, __D0)
383 #endif
384  void
385  StripUpperText(Ptr textPtr, short len);
386 
389 #endif
399  void
400  UpperString(Str255 theString, Boolean diacSensitive);
401 
410  void
411  upperstring(char *theString, Boolean diacSensitive);
412 
415 #if OLDROUTINENAMES
416 #define UprString(theString, diacSensitive) \
417  UpperString(theString, diacSensitive)
418 #endif
421 #if CALL_NOT_IN_CARBON
422 
431 #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
432 #pragma parameter UprText(__A0, __D0)
433 #endif
434  void
435  UprText(Ptr textPtr, short len);
436 
437 #endif
464  void
465  c2pstrcpy(Str255 dst, const char *src);
466 
475  void
476  p2cstrcpy(char *dst, ConstStr255Param src);
477 
486  void
487  CopyPascalStringToC(ConstStr255Param src, char *dst);
488 
497  void
498  CopyCStringToPascal(const char *src, Str255 dst);
499 
500 #if CALL_NOT_IN_CARBON
509  StringPtr
510  c2pstr(char *aStr);
511 
520  StringPtr
521  C2PStr(Ptr cString);
522 
531  char *
533 
542  Ptr
543  P2CStr(StringPtr pString);
544 
545 #endif
547 #if !TARGET_OS_MAC
549 #define C2PStr(a) (StringPtr) c2pstr((Ptr)(a))
550 #define P2CStr(a) (Ptr) p2cstr(a)
551 
552 #define CopyPascalStringToC(src, dst) p2cstrcpy(dst, src)
553 #define CopyCStringToPascal(src, dst) c2pstrcpy(dst, src)
554 #endif
555 #if TARGET_OS_MAC && TARGET_API_MAC_CARBON && OLDP2C
558 #define p2cstr(aStr) (p2cstrcpy((char *)aStr, aStr), (char *)aStr)
559 #define c2pstr(aStr) (c2pstrcpy((StringPtr)aStr, aStr), (StringPtr)aStr)
560 
561 #define C2PStr(a) (StringPtr) c2pstr((Ptr)(a))
562 #define P2CStr(a) (Ptr) p2cstr(a)
563 #endif
564 
565 #if PRAGMA_STRUCT_ALIGN
566 #pragma options align = reset
567 #elif PRAGMA_STRUCT_PACKPUSH
568 #pragma pack(pop)
569 #elif PRAGMA_STRUCT_PACK
570 #pragma pack()
571 #endif
572 
573 #ifdef PRAGMA_IMPORT_OFF
574 #pragma import off
575 #elif PRAGMA_IMPORT
576 #pragma import reset
577 #endif
578 
579 #ifdef __cplusplus
580 }
581 #endif
582 
583 #endif
584 * / ine c2pstr(aStr)(c2pstrcpy((StringPtr)aStr, aStr), (StringPtr)aStr)
585 
586 #define C2PStr(a) (StringPtr) c2pstr((Ptr)(a))
587 #define P2CStr(a) (Ptr) p2cstr(a)
588 #endif
589 
590 #if PRAGMA_STRUCT_ALIGN
591 #pragma options align = reset
592 #elif PRAGMA_STRUCT_PACKPUSH
593 #pragma pack(pop)
594 #elif PRAGMA_STRUCT_PACK
595 #pragma pack()
596 #endif
597 
598 #ifdef PRAGMA_IMPORT_OFF
599 #pragma import off
600 #elif PRAGMA_IMPORT
601 #pragma import reset
602 #endif
603 
604 #ifdef __cplusplus
605 }
606 #endif
607 
608 #endif
International Date and Time Interfaces (previously in TextUtils)
Basic Macintosh data types.
unsigned char * StringPtr
Definition: MacTypes.h:477
unsigned char Boolean
Definition: MacTypes.h:318
Utilites for formatting numbers.
Public interfaces for String Comparison and related operations.
StringHandle newstring(const char *theString)
ScriptRunStatus FindScriptRun(Ptr textPtr, long textLen, long *lenUsed)
void UppercaseStripDiacritics(Ptr textPtr, short len, ScriptCode script)
void LowercaseText(Ptr textPtr, short len, ScriptCode script)
void setstring(StringHandle theString, const char *strNew)
void CopyPascalStringToC(ConstStr255Param src, char *dst)
void UpperString(Str255 theString, Boolean diacSensitive)
void UpperText(Ptr textPtr, short len)
void p2cstrcpy(char *dst, ConstStr255Param src)
char * p2cstr(StringPtr aStr)
long Munger(Handle h, long offset, const void *ptr1, long len1, const void *ptr2, long len2)
void LowerText(Ptr textPtr, short len)
StringPtr c2pstr(char *aStr)
void GetIndString(Str255 theString, short strListID, short index)
void c2pstrcpy(Str255 dst, const char *src)
#define C2PStr(a)
Definition: TextUtils.h:549
StringHandle GetString(short stringID)
void getindstring(char *theString, short strListID, short index)
void CopyCStringToPascal(const char *src, Str255 dst)
StringHandle NewString(ConstStr255Param theString)
void LwrText(Ptr textPtr, short len)
void UprText(Ptr textPtr, short len)
Provide non-localizable uppercasing.
void StripUpperText(Ptr textPtr, short len)
void SetString(StringHandle theString, ConstStr255Param strNew)
void upperstring(char *theString, Boolean diacSensitive)
void NFindWord(Ptr textPtr, short textLength, short offset, Boolean leadingEdge, NBreakTablePtr nbreaks, OffsetTable offsets)
void FindWordBreaks(Ptr textPtr, short textLength, short offset, Boolean leadingEdge, BreakTablePtr breaks, OffsetTable offsets, ScriptCode script)
void UppercaseText(Ptr textPtr, short len, ScriptCode script)
void FindWord(Ptr textPtr, short textLength, short offset, Boolean leadingEdge, BreakTablePtr breaks, OffsetTable offsets)
void StripDiacritics(Ptr textPtr, short len, ScriptCode script)
Ptr P2CStr(StringPtr pString)
void StripText(Ptr textPtr, short len)
Definition: TextUtils.h:98
Definition: TextUtils.h:106
char charTypes[256]
Definition: TextUtils.h:116
Definition: TextUtils.h:92