/* util.h
*
* Miscellaneous utilities (mostly for running under MPW).
*/
#ifndef PORTMISC_H_
#define PORTMISC_H_
#ifdef __cplusplus
extern "C" {
#endif
/* Translate an unsigned long into a Mac style four-character
string. _Escape sequences will be used for unprintable
characters._ Hence, "\x00\x00\x00\x00" for 0.
If buffer is zero, an internal static (non thread-safe) buffer
will be used. */
const char * PRINT_CHAR4(unsigned long value, char * buffer);
/* Translate a string using simple escapes (backslashed backslashes
and x00 notation) into unsigned long values. */
unsigned long READ_CHAR4(const char * text, int * failureP);
#ifdef macintosh
extern void SetFileTypeCreator(const char * fname,
unsigned long type, unsigned long creator);
extern void ShowProgress(int count);
extern int MacFilenameTooLong(const char * name);
extern void InitMPWTool(void);
/* If this option isn't enabled, assume we're not compiling an MPW Tool */
#if !__option(mpwc_newline)
#define InitMPWTool() do { InitMPWTool(); \
printf("Please enter arguments for %s, followed by '!': ", argv[0]); \
ReadArgFile(stdin, &argc, &argv, true); } while (0)
#endif
#else
#define SetFileTypeCreator(x,y,z) do { } while (0)
#define InitMPWTool() do { } while (0)
#define ShowProgress(x) do { } while (0)
#define MacFilenameTooLong(x) (0)
#endif
#ifdef __cplusplus
}
#endif
#ifdef __cplusplus
extern "C" int ReadArgFile(FILE * f, int * argc, char **argv[], int stopOnExclamation = false);
#else
extern int ReadArgFile(FILE * f, int * argc, char **argv[], int stopOnExclamation);
#endif
#endif /*PORTMISC_H_*/