root/tags/5.4.pre05/wxis_src/easyfc.h

Revision 1, 3.0 kB (checked in by heitor.barbieri, 4 years ago)

Criação do svn para Cisis.

Line 
1/* ---------------------------------------------------------------- EASYFC.H */
2
3/* ----------------------------------------------------------------- defines */
4#ifndef BOOLEAN
5#define BOOLEAN    int
6#endif
7
8#ifndef TRUE
9#define TRUE       1
10#endif
11
12#ifndef FALSE
13#define FALSE      0
14#endif
15
16#ifndef O_TEXT
17#define O_TEXT     0
18#endif
19
20#ifndef O_BINARY
21#define O_BINARY   0
22#endif
23
24/* File access modes used with open() and fcntl() */
25/* Copy of fcntl.h */
26#ifndef O_RDONLY
27#define O_RDONLY      0000000   /* Open for reading only */
28#endif
29#ifndef O_WRONLY
30#define O_WRONLY      0000001   /* Open for writing only */
31#endif
32#ifndef O_RDWR
33#define O_RDWR        0000002   /* Open for reading or writing */
34#endif
35#ifndef O_ACCMODE
36#define O_ACCMODE     0000003   /* Mask for file access modes */
37#endif
38
39#ifndef O_DENYNONE
40#define O_DENYNONE 0
41#endif
42
43#ifndef KBYTE
44#define KBYTE      1024L
45#endif
46
47#ifndef EFC_ERROR_INFO_MAX
48#define EFC_ERROR_INFO_MAX              60
49#endif
50/* ------------------------------------------------------------- enumaration */
51typedef enum {
52        FILE_ERROR_EMPTY,
53        FILE_ERROR_SIZE,
54        FILE_ERROR_OPEN,
55        FILE_ERROR_ALLOC,
56        FILE_ERROR_READ,
57        FILE_ERROR_LIST_QTT
58} EFC_FILE_ERROR_LIST;          /* file error */
59
60typedef enum {
61        COPYFILE_ERROR_OK,
62        COPYFILE_ERROR_IN_OPEN,
63        COPYFILE_ERROR_OUT_OPEN,
64        COPYFILE_ERROR_LIST_QTT
65} COPYFILE_ERROR;                               /* file copy error */
66
67typedef enum {
68        NUMBERLIST_ERROR_OK,
69        NUMBERLIST_ERROR_ALLOC,
70        NUMBERLIST_ERROR_LIST_QTT
71} EFC_NUMBERLIST_ERROR_LIST;    /* number list error */
72/* --------------------------------------------------------------- structure */
73typedef struct {
74        int code;
75   char info[EFC_ERROR_INFO_MAX+1];
76} EFC_ERROR;                                    /* error */
77
78typedef struct {
79   char *text;
80} EFC_LINE;
81
82typedef struct {
83        long qtt;
84   EFC_LINE *list;
85} EFC_SPLIT_LINES;
86
87typedef struct {
88        long qtt;
89        long *list;
90} EFC_NUMBER_LIST;
91/* --------------------------------------------------------------- prototype */
92int efc_error               (EFC_ERROR *err,
93                             int error_code,
94                             char *error_info);
95long  efc_filesize                      (int handle);
96char *efc_filecontent           (char *read_file,
97                             long *qttbytes);
98void *efc_free                          (void *buff);
99void *efc_new                           (long mem_size);
100long efc_split_lines            (EFC_SPLIT_LINES *split_lines,
101                             char *text);
102long efc_split_lines_char       (EFC_SPLIT_LINES *split_lines,
103                             char *text,
104                             char char_sep);
105void efc_split_lines_free       (EFC_SPLIT_LINES *split_lines);
106long efc_numberList                     (EFC_ERROR *err,
107                             EFC_NUMBER_LIST *numberList,
108                             char *text);
109void efc_numberListFree         (EFC_NUMBER_LIST *numberList);
110char *efc_std_filecontent       (EFC_ERROR *err,
111                             char *file_name);
112char *efc_strrepl                       (char *old,
113                             char *from);
114char *efc_trim_right        (char *buff);
115COPYFILE_ERROR efc_copyFile(unsigned char *fileNameIn,
116                            unsigned char *fileNameOut);
Note: See TracBrowser for help on using the browser.