dcs_defn.h

<< Click to Display Table of Contents >>

Navigation:  User DLLs > Writing DLLs > Link Libraries >

dcs_defn.h

The following code is from dcs_defn.h. This file provides some basic definitions needed in your user-DLL routines. This file will briefly describe some of the most used items included in this header file for user-DLL routines.

 

wpBOOL: common boolean definition; this is just a redefinition of an integer, but used along with wpTRUE an wpFALSE, it can effectively be used as a boolean, with 0 indicating false (wpFALSE), and 1 indicating true (wpTRUE)

wpNULL: invalid pointer state; this is just a redefinition of 0 but is useful to use as a comparison for invalid pointers

wpSMALL: a very small double; useful so that small comparison values do not get defined differently throughout a project's code

wpLARGE: a very large double value; useful so that large comparison values do not get defined differently throughout a project's code

wpDataPr: general data type; redefinition of void, used by 3-Dcs interface to pass in data to user-routines, which is then cast to the appropriate structure type (move, tolerance or measure)

 

 

#ifndef wpCOMM_BASE_DEFN_HEADER

#define wpCOMM_BASE_DEFN_HEADER

 

 

 

// Windows 95/98/NT platform

#ifdef WIN32

#define wpEXT_DLL __declspec(dllexport) //AFX_EXT_CLASS // MFC-STYLE

#define wpDLLExportC extern "C" __declspec(dllexport)

 

// Unix platform

#else

#define wpEXT_DLL

#define wpDLLExportC extern "C"

 

#endif // platform definition

 

 

 

// basic type definition

typedef unsigned long wpDWRD;

 

typedef int wpBOOL;

typedef unsigned char wpBYTE;

typedef unsigned short wpWORD;

typedef unsigned int wpUINT;

typedef long wpLONG;

typedef char wpCHAR;

typedef double wpDBLE;

typedef wpDWRD wpCOLOR;

 

 

 

#define wpNULL 0

#ifndef NULL

#define NULL 0

#endif

 

#define wpFALSE 0

 

#define wpTRUE 1

 

//05/02/01

#define wpID_INVALID 0

#define wpID_ID_VAL wpLONG

 

 

// Logical Font

#define wpLF_FACESIZE 32

#define wpFW_DONTCARE 0

#define wpFW_THIN 100

#define wpFW_EXTRALIGHT 200

#define wpFW_LIGHT 300

#define wpFW_NORMAL 400

#define wpFW_MEDIUM 500

#define wpFW_SEMIBOLD 600

#define wpFW_BOLD 700

#define wpFW_EXTRABOLD 800

#define wpFW_HEAVY 900

 

#define wpANSI_CHARSET 0

#define wpDEFAULT_CHARSET 1

#define wpSYMBOL_CHARSET 2

 

#define wpOUT_DEFAULT_PRECIS 0

#define wpOUT_STRING_PRECIS 1

#define wpOUT_CHARACTER_PRECIS 2

 

#define wpCLIP_DEFAULT_PRECIS 0

#define wpCLIP_CHARACTER_PRECIS 1

#define wpCLIP_STROKE_PRECIS 2

 

#define wpDEFAULT_QUALITY 0

#define wpDRAFT_QUALITY 1

#define wpPROOF_QUALITY 2

 

#define wpDEFAULT_PITCH 0

#define wpFIXED_PITCH 1

#define wpVARIABLE_PITCH 2

 

 

 

// Font Families

#define wpFF_DONTCARE (0<<4) // Don't care or don't know.

#define wpFF_ROMAN (1<<4) // Variable stroke width, serifed.

// Times Roman, Century Schoolbook, etc.

#define wpFF_SWISS (2<<4) // Variable stroke width, sans-serifed.

// Helvetica, Swiss, etc.

#define wpFF_MODERN (3<<4) // Constant stroke width, serifed or sans-serifed.

// Pica, Elite, Courier, etc.

#define wpFF_SCRIPT (4<<4) // Cursive, etc.

#define wpFF_DECORATIVE (5<<4) // Old English, etc.

 

 

 

// distribution type in random number

enum wpRandType

{

RAN_UNIFORM = 0,

RAN_NORMAL,

RAN_TRIANGLE,

RAN_LEFTSKEW,

RAN_RIGHTSKEW,

RAN_OPENUP,

RAN_OPENDOWN,

RAN_USERDEF,

RAN_BIMODE,

RAN_CONSTANT,

RAN_WEIBULL,

RAN_STEP,

RAN_CURVEFIT,

RAN_MODAL,

RAN_WEIBULL4 = 101, // begin four parameters distributions: Weibull

RAN_PEARSON4 // four parameters distribution: Pearson

};

 

enum wpPearsonType

{

wpPearsonType1 = 1,

wpPearsonType3 = 3,

wpPearsonType4 = 4,

wpPearsonType5 = 5,

wpPearsonType6 = 6,

wpPearsonType8 = 8, // = normal distribution

wpPearsonTypeNone = 0// do not use

};

 

typedef struct wpLOGFONT_d

{

wpLONG lfHeight;

wpLONG lfWidth;

wpLONG lfEscapement;

wpLONG lfOrientation;

wpLONG lfWeight;

wpBYTE lfItalic;

wpBYTE lfUnderline;

wpBYTE lfStrikeOut;

wpBYTE lfCharSet;

wpBYTE lfOutPrecision;

wpBYTE lfClipPrecision;

wpBYTE lfQuality;

wpBYTE lfPitchAndFamily;

wpCHAR lfFaceName[wpLF_FACESIZE];

} wpLOGFONT_s;

 

 

 

// Color

#define wpRGB(r,g,b) ((wpCOLOR)(((wpBYTE)(r)|((wpWORD) \

((wpBYTE)(g))<<8))|(((wpDWRD)(wpBYTE)(b))<<16)))

#define wpGetRValue(rgb) ((wpBYTE)(rgb))

#define wpGetGValue(rgb) ((wpBYTE)(((wpWORD)(rgb)) >> 8))

#define wpGetBValue(rgb) ((wpBYTE)((rgb)>>16))

 

 

// VGA 16 standard colors

#define wpBLACK wpRGB(0,0,0)

#define wpBRIGHTBLUE wpRGB(0,0,255)

#define wpBRIGHTGREEN wpRGB(0,255,0)

#define wpCYAN wpRGB(0,255,255)

#define wpBRIGHTRED wpRGB(255,0,0)

#define wpMAGENTA wpRGB(255,0,255)

#define wpBRIGHTYELLOW wpRGB(255,255,0)

#define wpWHITE wpRGB(255,255,255)

#define wpDARKBLUE wpRGB(0,0,128)

#define wpDARKGREEN wpRGB(0,128,0)

#define wpBLUEGREEN wpRGB(0,128,128)

#define wpBROWN wpRGB(128,0,0)

#define wpDARKPURPLE wpRGB(128,0,128)

#define wpOLIVE wpRGB(128,128,0)

#define wpDARKGRAY wpRGB(128,128,128)

#define wpLIGHTGRAY wpRGB(192,192,192)

#define wpORANGE wpRGB(255,150,0)

 

 

// calculation error checking

const double wpSMALL = 0.000000001;//8-digit

 

// large number

const double wpLARGE = 100000000.0;

 

// checking threshold for division calculation

const double wpDIV_SMALL = 0.00000000000001; //14-digit

 

// global constants

const int wpMaxNameCharNum = 40;

 

// max num of char on one line in file

const int wpMAXFILECHAR = 256;

 

// angle value

const double wpPI = 3.14159265358979;

const double wpPIover180 = wpPI/180.0;

const double wpPItoAngle = 180.0/wpPI;

 

 

 

// data definition

#define wpDataPtr void

 

 

 

// mtm type

enum wpMtmType

{

wpMtmTypeNone,

wpMtmTypeMove,

wpMtmTypeMeas,

wpMtmTypeTole,

wpMtmTypeMTol,

wpMtmTypeExec

};

 

 

 

// 10/26/00

// Type Definitions for Range Offset mode types

// Range/Offset Format is now integer type since can be any of 4 options

#define wpRO_TYPE_PLUSMINUS 0

#define wpRO_TYPE_RANGEOFFSET 1

#define wpRO_TYPE_PLSMINUSOFST 2

#define wpRO_TYPE_UPPERLOWER 3

 

 

 

// file info

typedef struct wpFileInfo_d

{

int m_Year;

int m_Month;

int m_Day;

int m_Hour;

int m_Minute;

int m_Second;

wpUINT m_Size;

char m_Drive;

 

} wpFileInfo_s;

 

 

// calculate function pointer:

typedef void (*wpCalFuncPtr)(wpDataPtr* pCalData);

 

// get new class obj function

typedef void* (*wpGetNewClassPtr)();

 

// execute function

typedef void (*wpExeFuncPtr)(const char* exe_name, const char* param_str);

 

 

 

#endif /* wpCOMM_BASE_DEFN_HEADER */