home *** CD-ROM | disk | FTP | other *** search
- #include <string.h>
- #include "ScriptScrap.h"
- #include "Prototypes.h"
-
-
- /*****************************************************************/
- /* P S T R I N G T O T E X T - convert a Pascal-style
- /* string into a handle to a
- /* block of text.
- /*****************************************************************/
- void PstringToText(const char *pstring, Handle *textBlock)
- {
- *textBlock = NewHandle(pstring[0]);
- if (*textBlock != NULL)
- BlockMove(&(pstring[1]), **textBlock, (long)(pstring[0]));
- } /* PstringToText */
-
-
- /*****************************************************************/
- /* C S T R I N G T O T E X T - convert a C-style
- /* string into a handle to a
- /* block of text.
- /*****************************************************************/
- void CstringToText(const char *cstring, Handle *textBlock)
- {
- long numBytes = strlen(cstring);
-
- *textBlock = NewHandle(numBytes);
- if (*textBlock != NULL)
- BlockMove(cstring, **textBlock, numBytes);
- } /* CstringToText */
-
-
- /*****************************************************************/
- /* T E X T T O P S T R I N G - convert a handle to a
- /* block of text into a
- /* Pascal-style string.
- /*****************************************************************/
- void TextToPstring(const Handle textBlock, char *pstring)
- {
- long numBytes = GetHandleSize(textBlock);
-
- if (numBytes > 255) numBytes = 255;
- pstring[0] = (char)numBytes;
- BlockMove(*textBlock, &(pstring[1]), numBytes);
- } /* TextToPstring */
-
-
- /*****************************************************************/
- /* T E X T T O C S T R I N G - convert a handle to a
- /* block of text into a
- /* C-style string.
- /*****************************************************************/
- void TextToCstring(const Handle textBlock, char *cstring)
- {
- long numBytes = GetHandleSize(textBlock);
-
- if (numBytes > 255) numBytes = 255;
- BlockMove(*textBlock, cstring, numBytes);
- cstring[numBytes] = '\0';
- } /* TextToCstring */
-
-