File: application/libraries/dompdf/lib/ttf2ufm/src/windows.h

Recommend this page to a friend!
  Classes of harold rita  >  PHP Thesis Proposal Hub  >  application/libraries/dompdf/lib/ttf2ufm/src/windows.h  >  Download  
File: application/libraries/dompdf/lib/ttf2ufm/src/windows.h
Role: Auxiliary data
Content type: text/plain
Description: Auxiliary data
Class: PHP Thesis Proposal Hub
Store and publish research thesis documents
Author: By
Last change:
Date: 2 years ago
Size: 1,786 bytes


 * Implementation of things missing in Windows

#ifndef M_PI
#define M_PI  3.14159265358979323846

#undef ntohs
#undef ntohl
#undef htonl

/* 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]=='-') {

		for (n=0;n<nlen;n++) {
			if (args[n] == ':') continue;
			if (args[n] == nCmd) {
				if (args[n+1]==':') {
					char retVal;
					if (!optarg) optarg="";
					return retVal;
				} else {
					char retVal;
					return retVal;
	return -1;


unsigned short ntohs(unsigned short inv);
unsigned long ntohl(unsigned long inv);
unsigned long htonl(unsigned long inv);

extern char *optarg;
extern int optind;

char getopt(int argc, char **argv, char *args);

For more information send a message to info at phpclasses dot org.