From e0c6872cf40896c7be36b11dcc744620f10adf1d Mon Sep 17 00:00:00 2001 From: Norbert Preining Date: Mon, 2 Sep 2019 13:46:59 +0900 Subject: Initial commit --- fonts/utilities/ttf2pt1/windows.h | 93 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 93 insertions(+) create mode 100644 fonts/utilities/ttf2pt1/windows.h (limited to 'fonts/utilities/ttf2pt1/windows.h') diff --git a/fonts/utilities/ttf2pt1/windows.h b/fonts/utilities/ttf2pt1/windows.h new file mode 100644 index 0000000000..a90ecf7e5f --- /dev/null +++ b/fonts/utilities/ttf2pt1/windows.h @@ -0,0 +1,93 @@ +/* + * Implementation of things missing in Windows + */ + +#ifndef M_PI +#define M_PI 3.14159265358979323846 +#endif + +#undef ntohs +#undef ntohl +#undef htonl + +#ifdef WINDOWS_FUNCTIONS +/* byte order */ + +static unsigned short StoM(unsigned short inv) { + union iconv { + unsigned short ui; + unsigned char uc[2]; + } *inp, outv; + + inp = (union iconv *)&inv; + + outv.uc[0] = inp->uc[1]; + outv.uc[1] = inp->uc[0]; + + return (outv.ui); +} + +static unsigned int ItoM(unsigned int inv) { + union iconv { + unsigned int ui; + unsigned char uc[4]; + } *inp, outv; + + inp = (union iconv *)&inv; + + outv.uc[0] = inp->uc[3]; + outv.uc[1] = inp->uc[2]; + outv.uc[2] = inp->uc[1]; + outv.uc[3] = inp->uc[0]; + + return (outv.ui); +} + +unsigned short ntohs(unsigned short inv) { return StoM(inv); } +unsigned long ntohl(unsigned long inv) { return ItoM(inv); } +unsigned long htonl(unsigned long inv) { return ItoM(inv); } + +char *optarg; +int optind=1; + +char getopt(int argc, char **argv, char *args) { + int n,nlen=strlen(args),nLen=0; + char nCmd; + + if (argv[optind] && *argv[optind]=='-') { + nCmd=*((argv[optind]+1)); + + for (n=0;n