📄 sfl.h
字号:
/* Database type should be defined in CCDEFINES environment variable */#if (defined (DBIO_ODBC)) /* Okay, use ODBC */#elif (defined (DBIO_MYSQL)) /* Okay, use MySQL */#elif (defined (DBIO_ORACLE)) /* Okay, use Oracle */#elif (defined (DBIO_DB2)) /* Okay, use IBM/DB2 */#elif (defined (DBIO_XML)) /* Okay, use XML simulated database */#else# define DBIO_NONE#endif/* Type of Database server */#define DB_TYPE_NONE 0#define DB_TYPE_ODBC 1#define DB_TYPE_ORACLE 2#define DB_TYPE_DB2 3#define DB_TYPE_INFORMIX 4#define DB_TYPE_SYBASE 5#define DB_TYPE_SQLSERV 6#define DB_TYPE_MYSQL 7#define DB_TYPE_POSTGRES 8#define DB_TYPE_XML 9#define DB_TYPE_MAX 10#define GOTO_NEXT_RECORD 99999#define ERR_MSG_SIZE 300#define ERR_CODE_SIZE 20#define COMMON_DBIO_CTX \ long connect_id; /* Connection ID */\ free_table_handle *free_handle; /* Handle to free table resource */ typedef void (free_table_handle) (void *);/* Error structure */typedef struct{ int code; /* Error code ( 0 = NO ERROR) */ char code_msg [ERR_CODE_SIZE]; /* Message code */ char message [ERR_MSG_SIZE]; /* Error message */ int parse_offset; /* Parse error offset */ int nb_rows; /* number of rows processed */} DBIO_ERR;/* All feedback type */enum { OK = 0, HARD_ERROR = 1, ILLEGAL_OPERATION = 2, ILLEGAL_MODE = 3, RECORD_NOT_PRESENT = 4, DUPLICATE_RECORD = 5, ILLEGAL_FILE_USAGE = 6, RECORD_LOCKED = 7, RECORD_CHANGED = 8, RECORD_INTEGRITY = 9, INVALID_SEARCH_KEY = 10, NOT_CONNECTED = 11};/* Position mode */enum { THIS_RECORD = 0, EQUAL_TO = 1, GREATER_OR_EQUAL = 2, GREATER_THAN = 3, LESS_THAN = 4, LESS_THAN_OR_EQUAL = 5, NEXT_RECORD = 6, PRIOR_RECORD = 7, LAST_RECORD = 8, FIRST_RECORD = 9};/* KEY selector */enum { PRIMARY = 0, ALTERNATE_A = 1, ALTERNATE_B = 2, ALTERNATE_C = 3, ALTERNATE_D = 4, ALTERNATE_E = 5, ALTERNATE_F = 6, ALTERNATE_G = 7, ALTERNATE_H = 8, ALTERNATE_I = 9, ALTERNATE_J = 10, ALTERNATE_K = 11, ALTERNATE_L = 12, ALTERNATE_M = 13, ALTERNATE_N = 14, ALTERNATE_O = 15, ALTERNATE_P = 16, ALTERNATE_Q = 17, ALTERNATE_R = 18, ALTERNATE_S = 19, ALTERNATE_T = 20, ALTERNATE_U = 21, ALTERNATE_V = 22, ALTERNATE_W = 23, ALTERNATE_X = 24, ALTERNATE_Y = 25, ALTERNATE_Z = 26, ALTERNATE_ERROR = 27};#ifdef __cplusplusextern "C" {#endifextern long current_connect_id [DB_TYPE_MAX];Bool dbio_connect (char *db_name, char *user, char *pwd, char *extra, Bool set_default, dbyte db_type);void *dbio_get_handle (dbyte db_type, char *table, char *connect_name, long connect_id);void dbio_disconnect (void);int dbio_commit (void);int dbio_rollback (void);DBIO_ERR *dbio_get_error (void);int dbio_error_code (void);char *dbio_error_message (void);dbyte get_db_type (char *db_type_name);#ifdef __cplusplus}#endif#endif/* ----------------------------------------------------------------<Prolog>- Name: sflexdr.h Title: External data representation functions Package: Standard Function Library (SFL) Written: 1996/06/25 iMatix SFL project team <sfl@imatix.com> Revised: 1997/09/08 Synopsis: Provides functions to read and write data in a portable format that is suitable for transmission to other systems. The principle is similar to the ONC XDR standard used in RPC, but somewhat simpler. The streams produced by these functions are not compatible with ONC XDR. Copyright: Copyright (c) 1996-2000 iMatix Corporation License: This is free software; you can redistribute it and/or modify it under the terms of the SFL License Agreement as provided in the file LICENSE.TXT. This software is distributed in the hope that it will be useful, but without any warranty. ------------------------------------------------------------------</Prolog>-*/#ifndef SFLEXDR_INCLUDED /* Allow multiple inclusions */#define SFLEXDR_INCLUDED/*--------------------------------------------------------------------------- * Function prototypes */#ifdef __cplusplusextern "C" {#endifint exdr_write (byte *buffer, const char *format, ...);int exdr_writed (DESCR *buffer, const char *format, ...);int exdr_read (const byte *buffer, const char *format, ...);#ifdef __cplusplus}#endif#endif /* Include sflexdr.h *//* ----------------------------------------------------------------<Prolog>- Name: sflfind.h Title: Fast string searching functions Package: Standard Function Library (SFL) Written: 1996/04/24 iMatix SFL project team <sfl@imatix.com> Revised: 1998/05/03 Synopsis: Searches for a pattern within a string or block of memory using a variant of the Boyer-Moore algorithm (improved by Horspool and Sunday). As fast or faster than the normal Boyer-Moore algorithm for most search strings, and much simpler. Includes a basic function for searching blocks of memory with known sizes, plus an envelope that searches null-delimited strings. Provides the option of repeatedly searching for the same pattern without re-parsing the pattern each time. Original algorithm published by BOYER, R., and S. MOORE 1977, "A Fast String Searching Algorithm." CACM, 20, 762-72. Simplifications by HORSPOOL, R. N. 1980, "Practical Fast Searching in Strings." Software - Practice and Experience, 10, 501-06. More improvements by HUME, A., and D. M. SUNDAY 1991, "Fast String Searching." AT&T Bell Labs Computing Science Technical Report No. 156. Implemented in C by P. Hintjens. strfind_r() and memfind_r(), are reentrant versions of strfind() and memfind() for single searches, and strfind_rb() and memfind_rb() are reentrant versions of strfind() and memfind() supporting repeat searches against the same pattern. Copyright: Copyright (c) 1996-2000 iMatix Corporation License: This is free software; you can redistribute it and/or modify it under the terms of the SFL License Agreement as provided in the file LICENSE.TXT. This software is distributed in the hope that it will be useful, but without any warranty. ------------------------------------------------------------------</Prolog>-*/#ifndef SFLFIND_INCLUDED /* Allow multiple inclusions */#define SFLFIND_INCLUDED/* Function prototypes */#ifdef __cplusplusextern "C" {#endifchar *strfind (const char *string, const char *pattern, Bool repeat_find);char *strfind_r (const char *string, const char *pattern);char *strfind_rb (const char *string, const char *pattern, size_t *shift, Bool *repeat_find);void *memfind (const void *block, size_t block_size, const void *pattern, size_t pattern_size, Bool repeat_find);void *memfind_r (const void *block, size_t block_size, const void *pattern, size_t pattern_size);void *memfind_rb (const void *block, size_t block_size, const void *pattern, size_t pattern_size, size_t *shift, Bool *repeat_find);char *txtfind (const char *string, const char *pattern);#ifdef __cplusplus}#endif#endif/* ----------------------------------------------------------------<Prolog>- Name: sflfile.h Title: File-access functions Package: Standard Function Library (SFL) Written: 1992/10/25 iMatix SFL project team <sfl@imatix.com> Revised: 1999/11/08 Synopsis: Provides functions to read and write files with explicit new-line/carriage-return control; to find files on a path; to copy files, check files' protection, etc. Copyright: Copyright (c) 1996-2000 iMatix Corporation License: This is free software; you can redistribute it and/or modify it under the terms of the SFL License Agreement as provided in the file LICENSE.TXT. This software is distributed in the hope that it will be useful, but without any warranty. ------------------------------------------------------------------</Prolog>-*/#ifndef SFLFILE_INCLUDED /* Allow multiple inclusions */#define SFLFILE_INCLUDED/* System-specific definitions */#if (defined (__MSDOS__))# define FOPEN_READ_TEXT "rt" /* Under DOS we can be explict */# define FOPEN_READ_BINARY "rb" /* and use 't' or 'b' in fopen */# define FOPEN_WRITE_TEXT "wt"# define FOPEN_WRITE_BINARY "wb"# define FOPEN_APPEND_TEXT "at"# define FOPEN_APPEND_BINARY "ab"#elif (defined (__VMS__))# define FOPEN_READ_TEXT "r" /* Dec C does not like 't' or 'b' */# define FOPEN_READ_BINARY "r"# define FOPEN_WRITE_TEXT "w"# define FOPEN_WRITE_BINARY "w"# define FOPEN_APPEND_TEXT "a"# define FOPEN_APPEND_BINARY "a"#elif (defined (__UNIX__))# define FOPEN_READ_TEXT "rt" /* Under UNIX we can be explict */# define FOPEN_READ_BINARY "rb" /* and use 't' or 'b' in fopen */# define FOPEN_WRITE_TEXT "wt"# define FOPEN_WRITE_BINARY "wb"# define FOPEN_APPEND_TEXT "at"# define FOPEN_APPEND_BINARY "ab"#elif (defined (__OS2__))# define FOPEN_READ_TEXT "rt" /* Under OS/2 we can be explict */# define FOPEN_READ_BINARY "rb" /* and use 't' or 'b' in fopen */# define FOPEN_WRITE_TEXT "wt"# define FOPEN_WRITE_BINARY "wb"# define FOPEN_APPEND_TEXT "at"# define FOPEN_APPEND_BINARY "ab"#else# error "No definitions for FOPEN constants"#endif/* Constants */enum { CYCLE_ALWAYS = 0, /* Cycle file unconditionally */ CYCLE_HOURLY = 1, /* Cycle file if hour has changed */ CYCLE_DAILY = 2, /* Cycle file if day has changed */ CYCLE_WEEKLY = 3, /* Cycle file if week has changed */ CYCLE_MONTHLY = 4, /* Cycle file if month has changed */ CYCLE_NEVER = 5 /* Don't cycle the file */};/* Function prototypes */#ifdef __cplusplusextern "C" {#endifFILE *file_open (const char *filename, char mode);FILE *file_locate (const char *path, const char *name, const char *ext);int file_close (FILE *stream);Bool file_read (FILE *stream, char *string);Bool file_readn (FILE *stream, char *string, int line_max);char *file_write (FILE *stream, const char *string);int file_copy (const char
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -