SDC C-Project CF Review 프로그램
LYW
2021-11-12 039bde2990b5b015232b5da9ff4df0cf1d88ddac
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
/***************************************************************************
 
        Title:          dprotlib.h
 
        Version:        1.00
 
        Date:           04/15/1993
 
        Author(s):      Ed Lay
 
----------------------------------------------------------------------------
 
        Change log:
 
       Date       Rev     Who                    Description
  ---------       -----   -----   --------------------------------------------
  07/14/1993              DES     Modified for Windows 'CNC' DLL.
  06/06/1994              EBL     Changed functions for Dual Binary Rot Buffers
  07/06/1995              DES     Modified for WIN32 and USERDLL.
  05/18/1997              EBL     Changes for Expression( Now a two PASS conversion )
 
***************************************************************************/
 
#ifndef _DPROTLIB_H
  #define _DPROTLIB_H
 
  #include <stdio.h>
  #include "resource.h"
 
 
  #define DPRTOKENMAX 125 // Maximume number of TOKENS in a Line of ASCII code
  #define DPRCMDMAX 150   // Two times the maximum number of PMAC commands in a line
  #define HOST_INDEX_T 0x1054
  #define HOST_INDEX_P 0x07F4
 
enum Dpr_Bin_Rot_Errors {
    DprOk = 0,
    DprBufBsy = 1, // DPR Rotary Buffer is Busy
    DprEOF = 2,    // DPR Rotary Buffer End of File detected
};
 
///////////////////////////////////////////////////////////////////////////
// ROT BUFFER Command Union
typedef union 
{
  USHORT  word_data[2 *DPRCMDMAX + 4];
  DWORD   long_data[DPRCMDMAX + 2];
  __int64 data64[DPRCMDMAX / 2 + 1];
 
} PMAC_BIN_RB_CMD, *PPMAC_BIN_RB_CMD ;
 
///////////////////////////////////////////////////////////////////////////
// DPR BIN ROT ASCII to Binary Token convert structure
struct dprbcnvt { 
    int           token;
    double        data;
    int           code1;
    int           code2;
    DWORD         ldata;
}; // 18 bytes
 
//*****************  Strings  ***********************************
  #define SABS "ABS"
  #define SACOS   "ACOS"
  #define SADIS "ADIS\xD0\xCC\xC1\xC3\xC5"                   // ADISPLACE'
  #define SAROT "AROT\xC1\xD4\xC5"                           //'AROTATE'
  #define SASIN   "ASIN"
  #define SATAN   "ATAN"
  #define SATAN2  "ATAN2"
  #define SBSTART "\x42\xCC\xCF\xC3\xCB\xA0START"            // 'BLOCK START'
  #define SBSTOP  "\x42\xCC\xCF\xC3\xCB\xA0STOP"             // 'BLOCK STOP'
  #define SCC     "CC"
  #define SCCR    "CCR"
  #define SCIR    "CIR\xC3\xCC\xC5"                          // 'CIRCLE'
  #define SCALL   "CALL"
  #define SCOS    "COS"
  #define SDWELL  "DWE\xCC\xCC"                              // DWELL
  #define SDELAY  "\x44\xC5\x4C\xC1\x59"                     // DELAY
  #define SDISPLC "DIS\xC1\xC2\xCC\xC5\xA0\x50\x4C\x43"      // 'DISABLE PLC'
  #define SDISPLCC "DIS\xC1\xC2\xCC\xC5\xA0\x50\x4C\x43\x43" // 'DISABLE PLCC'
  #define SENAPLC "ENA\xC2\xCC\xC5\xA0\x50\x4C\x43"          // 'ENABLE PLC'
  #define SENAPLCC "ENA\xC2\xCC\xC5\xA0\x50\x4C\x43\x43"     // 'ENABLE PLCC'
  #define SEXP    "EXP"
  #define SFRAX   "FRAX"
  #define SHOME   "\x48\xCF\x4D\xC5"                         // "HOME"
  #define SHOMEZ  "\x48\xCF\x4D\xC5\x5A"                     // " HOMEZ"
  #define SINC    "INC"
  #define SIDIS   "IDI\x53\xD0\xCC\xC1\xC3\xC5"              // "IDISPLACE"
  #define SIROT   "IROT\xC1\xD4\xC5"                         //  'IROTATE'
  #define SIF     "IF"
  #define SINT    "INT"
  #define SLINEAR "LIN\xC5\xC1\xD2"                          // 'LINEAR'
  #define SLN     "LN"
                                                             //#define SLSTART "L\xCF\xCF\xCB\xC1\xC8\xC5\xC1\xC4\xA0START"
                                                             //#define SLSTOP  "L\xCF\xCF\xCB\xC1\xC8\xC5\xC1\xC4\xA0STOP"
  #define SNORM   "\x4E\xCF\x52\x4D\xC1\xCC"                 // 'NORMAL'
  #define SPREL   "PRELUDE"
  #define SPVT    "PVT"
  #define SPSET   "PSET"
  #define SRAPID  "\x52\xC1\x50\xC9\x44"                     // 'RAPID'
  #define SSPLINE "SPLINE"
  #define SSTOP   "STOP"
  #define SSIN    "SIN"
  #define SSQRT   "SQRT"
  #define STAN    "TAN"
  #define STSEL   "TSE\x4C\xC5\xC3\xD4"                      // 'TSELECT'
  #define STINIT  "TINIT"
  #define STA     "TA"
  #define STS     "TS"
  #define STM     "TM"
  #define SWAIT   "WAIT"
  #define SWHILE  "WHILE"
 
//*****************  Integer Max Values  ***********************************
 
  #define AROTMAX 1015L
  #define ADISMAX 1021L
  #define CCMAX   2L
  #define CIRMAX  2L
  #define IDISMAX 1021L
  #define IROTMAX 1015L
  #define SPLINEMAX 1L
  #define TSELMAX 5L
  #define PRELMAX 1024L
 
//***************** Axis Mask Values  ***********************************
 
  #define RM 1L
  #define AM 2L
  #define BM 8L
  #define CM 32L
  #define UM 128L
  #define VM 512L
  #define WM 2048L
  #define XM 8192L
  #define YM 32768L
  #define ZM 131072L
  #define ALLM AM+BM+CM+XM+YM+ZM+UM+VM+WM
 
//****************************************************************************
//
//      Function Return codes for DPRstrcnvt, DPRpack_??, DPRstrtod, DPRmtrnum,
//      DPRplcnum, DPRaxisnum
//
//****************************************************************************
 
///////////////////////////////////////////////////////////////////////////
// Functions
  #ifdef __cplusplus
extern "C" {
  #endif
 
  // DPR Binary rotary buffer functions
  // Initialization/shutdown
  BOOL  CALLBACK PmacDPRGetRotBufInfo(DWORD dwDevice,DWORD bufnum,struct rotbuf *pDPRrotbf);
  void  CALLBACK PmacDPRSetRotBufInfo(DWORD dwDevice,DWORD bufnum,struct rotbuf *pDPRRotBuf);
  SHORT CALLBACK PmacDPRRotBufInit( DWORD dwDevice, USHORT bufnum );
  SHORT CALLBACK PmacDPRRotBufRemove( DWORD dwDevice, USHORT bufnum );
  SHORT CALLBACK PmacDPRRotBufChange( DWORD dwDevice, USHORT bufnum, USHORT new_size );
  void  CALLBACK PmacDPRRotBufClr( DWORD dwDevice, UINT bufnum );
  SHORT CALLBACK PmacDPRRotBuf( DWORD dwDevice, BOOL on );
  int   CALLBACK PmacDPRBufLast( DWORD dwDevice );
 
  // Transfer functions
  SHORT CALLBACK PmacDPRAsciiStrToBinary( DWORD dwDevice, PCHAR inpstr, PPMAC_BIN_RB_CMD pBinary);
  SHORT CALLBACK PmacDPRrotputEx( DWORD dwDevice,int num_put,LPDWORD rotdat,int bufnum,BOOL bSendImmediate,PCHAR inpstr);
  SHORT CALLBACK PmacDPRAsciiStrToRotEx( DWORD dwDevice, PCHAR inpstr, USHORT bufnum,BOOL bSendRemaining );
  SHORT CALLBACK PmacDPRAsciiStrToRotA( DWORD dwDevice, PCHAR inpstr, USHORT bufnum );
  SHORT CALLBACK PmacDPRSendBinaryCommandA( DWORD dwDevice, PCHAR inpstr, USHORT bufnum );
  SHORT CALLBACK PmacDPRAsciiStrToBinaryFileA( DWORD dwDevice, PCHAR inpstr, FILE * outfile );
 
  SHORT CALLBACK PmacDPRAsciiStrToRotW( DWORD dwDevice, PWCHAR inpstr, USHORT bufnum );
  SHORT CALLBACK PmacDPRSendBinaryCommandW( DWORD dwDevice, PWCHAR inpstr, USHORT bufnum );
  SHORT CALLBACK PmacDPRAsciiStrToBinaryFileW( DWORD dwDevice, PWCHAR inpstr, FILE * outfile );
 
 
  SHORT CALLBACK PmacDPRAsciiFileToRot( DWORD dwDevice, FILE * inpfile, USHORT bufnum );
  SHORT CALLBACK PmacDPRBinaryFileToRot( DWORD dwDevice, FILE * inpfile, USHORT bufnum );
  SHORT CALLBACK PmacDPRAsciiToBinaryFile( DWORD dwDevice, FILE * inpfile, FILE * outfile );
  SHORT CALLBACK PmacDPRBinaryToRot( DWORD dwDevice, WORD * inpbinptr, WORD * *outbinptr, WORD bufnum );
 
  // Packing/compiling functions
  int DPRpack_0A( int code1, double data );
  int DPRpack_0B( int code1, int code2, double data );
  int DPRpack_1A( int code1, int code2, unsigned long data );
  int DPRpack_1B( int code1, int code2, unsigned long data );
  int DPRpack_1C( int code1, unsigned long data );
  int DPRpack_1D( DWORD dwDevice, int code1, int code2, unsigned long data );
  int DPRpack_1E( DWORD dwDevice, int code1, int code2, unsigned long data );
  int DPRpack_1F( int code1, int code2 );
  int DPRpack_2( int code1, int code2, int data1, double data );
 
  int DPRstrcmp( char *instr, char *instrc, char **endptr );
  int DPRstrtod( char *instr, double *ddata, char **endptr );
  int DPRcmdend( char *instr );
  int  DPRmtrnum( DWORD dwDevice, unsigned long *retmask, char *instr, char **endptr );
  int DPRplcnum( char *instr, unsigned long *retmask, char **endptr );
  int DPRaxisnum( char *instr, unsigned long *retmask, char **endptr );
  int DPRstrcnvt( DWORD dwDevice, char *instr, struct dprbcnvt *pmc_cmd );
  int CALLBACK DPRrotput( int num_put, LPDWORD rotdat, int bufnum );
  int DPRTokentoBin( DWORD dwDevice, struct dprbcnvt *dprtoknptr );
  //-------------------------------------------------------------------------
  //-------------------------------------------------------------------------
  //
  // Variable Background Buffer Functions
  // Initialization
  long  CALLBACK PmacDPRVarBufInit( DWORD dwDevice, long new_num_entries, PLONG addrarray );
  long  CALLBACK PmacDPRVarBufInitEx( DWORD dwDevice, long new_num_entries, PLONG addrarray, PUINT addrtype );
  BOOL  CALLBACK PmacDPRVarBufRemove( DWORD dwDevice, long h );
  BOOL  CALLBACK PmacDPRVarBufChange( DWORD dwDevice, long handle, long new_num_entries, long *addrarray );
  BOOL  CALLBACK PmacDPRVarBufChangeEx( DWORD dwDevice, long handle, long new_num_entries, long *addrarray, PUINT addrtype );
  BOOL  CALLBACK PmacDPRVarBufRead( DWORD dwDevice, long h, long entry_num, PLONG long_2 );
  long  CALLBACK PmacDPRGetVBGAddress( DWORD dwDevice, long h, long entry_num );
 
  long  CALLBACK PmacDPRGetVBGNumEntries( DWORD dwDevice, long h );
  long  CALLBACK PmacDPRGetVBGDataOffset( DWORD dwDevice, long h );
  long  CALLBACK PmacDPRGetVBGAddrOffset( DWORD dwDevice, long h );
 
  // Both
  UINT  CALLBACK PmacDPRGetVBGServoTimer( DWORD dwDevice );
  UINT  CALLBACK PmacDPRGetVBGStartAddr( DWORD dwDevice );
  int   CALLBACK PmacDPRGetVBGTotalEntries( DWORD dwDevice );
 
  int   CALLBACK PmacDPRWriteBuffer( DWORD dwDevice, int num_entries,
                   struct VBGWFormat * the_data );
  #ifdef __cplusplus
}
  #endif
 
  #ifdef UNICODE
    #define PmacDPRAsciiStrToRot PmacDPRAsciiStrToRotW
    #define PmacDPRSendBinaryCommand PmacDPRSendBinaryCommandW
    #define PmacDPRAsciiStrToBinaryFile PmacDPRAsciiStrToBinaryFileW
  #else
    #define PmacDPRAsciiStrToRot PmacDPRAsciiStrToRotA
    #define PmacDPRSendBinaryCommand PmacDPRSendBinaryCommandA
    #define PmacDPRAsciiStrToBinaryFile PmacDPRAsciiStrToBinaryFileA
  #endif // !UNICODE
 
#endif