#ifndef __CCOMMON_H
#define __CCOMMON_H

#ifdef WIN32
#include        <stdio.h>
#include        <stdlib.h>
#define         _NO_STDIO
#include        <ctype.h>
#include        <string.h>
#include        <time.h>
#include        <fcntl.h>
#include        <signal.h>
#else
#ifdef __cplusplus
#include        <stddef.h>
#include        <stdio.h>
#include        <stdlib.h>
#define         _NO_STDIO
#include        <sys/types.h>
#include        <string.h>
#include        <ctype.h>
#include        <errno.h>
#include        <time.h>
#include        <fcntl.h>
#include        <signal.h>
#include        <setjmp.h>
#else
#include        <stdio.h>
#include        <stdlib.h>
#include        <sys/types.h>
#include        <ctype.h>
#include        <string.h>
#include        <errno.h>
#include        <time.h>
#include        <fcntl.h>
#include        <signal.h>
#include        <setjmp.h>
#endif
#endif

#define ELLIPSES ...

#ifdef WIN32
/* @(!) 2.3.01.316 modif.  #define         TMPFNAME(p,n)           sprintf(p, "\\tmp\\%s.tmp", (n));       */
#define         TMPFNAME(p,n)           tmpfname((p),(n))
/* @(:) 2.3.01.316 */
#define         DIRSEP                                  '\\'    
#else
#define         TMPFNAME(p,n)           sprintf(p, "/usr/tmp/%s%-d", (n), getpid());    
#define         DIRSEP                                  '/'     
#endif
#define         HIDDEN                                  static
#define         UPCASE(c)                               toupper(c)
#define         LOWCASE(c)                      tolower(c)
#define         LENGTH(s)                               strlen(s)
#define         STREMPTY(s)     (!(LENGTH(s)))
#define         STRNOTEMPTY(s)  (!STREMPTY(s))
#define         STRCMP(s1,op,s2)        (strcmp(s1,s2) op 0)
#define         CSTR(n,s)                       sprintf((s), "%-d", (n))
#define         CSTR4(n,s)                      sprintf((s), "%-ld", (n))
#define         BADR(x)                                 ((x) - 1)       
#define         WINHND(hw)                      warr[(hw)].w
/* @(!) 2.3.01.69 */
#define         WINHNDB(hw)                     warr[(hw)].wb
/* @(:) 2.3.01.69 */
#define         WINFLD(hw,f)            warr[(hw)].f
#define         POSTWIN(hw)                     WINFLD(hw,posted)       = TRUE  
#define         UNPOSTWIN(hw)           WINFLD(hw,posted)       = FALSE 
#define         CCLEAREOL(w)            xwclrtoeol(WINHND(w))
#define         CCLEAREOS(w)            xwclrtobot(WINHND(w))
#define         CCLEARWIN(w)            xpaint(WINHND(w), setattr[warr[(w)].bkat][iscolordisp])
#define         INSET(c,s)                      (ustrchr((s), (c)) != (byte *) NULL)
#define         CBITTEST(w,p)           (((w) & (0x0001 << (p))) != 0)
#define         CBITSET(w,p,v)  ((v) ? ((w) |= (0x0001 << (p))) : ((w) &= (~(0x0001 << (p)))))
/* @(!) 2.3.01.temp */
#ifndef BOOLEAN
#define         BOOLEAN                                 short
#endif
/* @(:) 2.3.01.temp */
#define         NoErr                                           0

#define         directory       "dir.gen"
#define         ntrrec          "trc.gen"
#define         nditta          "dta.gen"

#ifndef __STDTYPES_H
typedef unsigned char byte;
#endif
typedef char    Str8[9];
typedef char    Str25[26];
typedef char    Str30[32];
typedef char    Str80[82];
typedef char    Str255[256];
typedef byte     StCh[256];
typedef long    TrDate;

typedef char            PathSt[82];

extern PathSt            cprefix;

#ifdef __cplusplus
extern "C" {
#endif
   int CIOResult(void );
#ifdef WIN32
  void tmpfname(char *,char *);
#endif
  /* @(:) 2.3.01.316 */
#ifdef __cplusplus
};
#endif
#endif /* __CCOMMON_H */