📄 sfl.h
字号:
/* conv_str_time () */#define CONV_ERR_MULTIPLE_AM 4 /* More than one 'am' or 'pm' *//* conv_date_str () */#define CONV_ERR_DATE_OVERFLOW 5 /* Result too large for output *//* conv_str_date () */#define CONV_ERR_DATE_SIZE 6 /* Too few or too many digits */#define CONV_ERR_MULTIPLE_DELIM 7 /* Too many delimiters */#define CONV_ERR_BAD_MONTH 8 /* Unknown month name */#define CONV_ERR_REJECT_3_5 9 /* 3/5 digits in a row not allowed */#define CONV_ERR_MULTIPLE_MONTH 10 /* More than one month name *//* conv_number_str () */#define CONV_ERR_DECS_MISSING 11 /* Not enough decimals supplied */#define CONV_ERR_NUM_OVERFLOW 12 /* Result too large for output *//* conv_str_number () */#define CONV_ERR_MULTIPLE_SIGN 13 /* More than one sign character */#define CONV_ERR_SIGN_REJECTED 14 /* Sign not allowed if unsigned */#define CONV_ERR_SIGN_BAD_FIN 15 /* Malformed financial negative */#define CONV_ERR_MULTIPLE_POINT 16 /* More than one decimal point */#define CONV_ERR_DECS_REJECTED 17 /* Decimals not allowed if integer */#define CONV_ERR_DECS_HIDDEN 18 /* Decimals not allowed if hidden */#define CONV_ERR_DECS_OVERFLOW 19 /* Too many decimal positions */#define CONV_ERR_TOO_MANY_DIGITS 20 /* Too many digits for number *//* Constants used for dedicated formatting functions */#define DATE_ORDER_FIRST 1 /* Values for date_order */#define DATE_ORDER_YMD 1#define DATE_ORDER_DMY 2#define DATE_ORDER_MDY 3#define DATE_ORDER_LAST 3#define FLAG_N_SIGNED 1 /* Number field flags */#define FLAG_N_DECIMALS 2#define FLAG_N_LEFT 4#define FLAG_N_ZERO_FILL 8#define FLAG_N_ZERO_BLANK 16#define FLAG_N_THOUSANDS 32#define SIGN_NEG_TRAIL 1 /* Number field formatting */#define SIGN_ALL_TRAIL 2#define SIGN_NEG_LEAD 3#define SIGN_ALL_LEAD 4#define SIGN_FINANCIAL 5#define DECS_SHOW_ALL 1#define DECS_DROP_ZEROS 2#define DECS_HIDE_ALL 3#define DECS_SCIENTIFIC 4#define DATE_FORMAT_FIRST 0 /* Date field formatting */#define DATE_YMD_COMPACT 0#define DATE_YMD_DELIM 1#define DATE_YMD_SPACE 2#define DATE_YMD_COMMA 3#define DATE_YMD_LAST 3#define DATE_YM_COMPACT 4#define DATE_YM_DELIM 5#define DATE_YM_SPACE 6#define DATE_YM_LAST 6#define DATE_MD_COMPACT 7#define DATE_MD_DELIM 8#define DATE_MD_SPACE 9#define DATE_MD_LAST 9#define DATE_FORMAT_LAST 9#define FLAG_D_DD_AS_D 1 /* Date field flags */#define FLAG_D_MM_AS_M 2#define FLAG_D_MONTH_ABC 4#define FLAG_D_CENTURY 8#define FLAG_D_UPPER 16#define FLAG_D_ORDER_YMD 32#define FLAG_D_ORDER_DMY 64#define FLAG_D_ORDER_MDY 128#define FLAG_T_HH_AS_H 1 /* Time field flags */#define FLAG_T_MM_AS_M 2#define FLAG_T_SS_AS_S 4#define FLAG_T_CC_AS_C 8#define FLAG_T_COMPACT 16#define FLAG_T_12_HOUR 32#define BOOL_YES_NO 0 /* Boolean field formatting */#define BOOL_Y_N 1#define BOOL_TRUE_FALSE 2#define BOOL_T_F 3#define BOOL_1_0 4#endif/* ----------------------------------------------------------------<Prolog>- Name: sflcryp.h Title: Encryption and decryption functions Package: Standard Function Library (SFL) Written: 1996/01/23 iMatix SFL project team <sfl@imatix.com> Revised: 1997/09/08 Copyright: Copyright (c) 1996-2000 iMatix Corporation Synopsis: The encryption/decryption functions were based on the cryptosystem library by Andrew Brown <asb@cs.nott.ac.uk>, cleaned-up for portability. Thanks for a great package. IDEA is registered as the international patent WO 91/18459 "Device for Converting a Digital Block and the Use thereof". For commercial use of IDEA, you should contact: ASCOM TECH AG Freiburgstrasse 370 CH-3018 Bern, Switzerland 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. Notes: Description of IDEA cipher -------------------------- The IDEA cipher operates on 64 bit (8 byte) blocks, using a 128 bit (16 byte) key. IDEA has found itself famous through its inclusion in the well-known PGP package. The following is from the introduction to chapter 3 of the thesis that presented the cipher. The block cipher IDEA (International Data Encryption Algorithm) is based on the new design concept of "mixing operations from different algebraic groups". The required "confusion" was achieved by successively using three "incompatible" group operations on pairs of 16-bit subblocks and the cipher structure was chosen to provide the necessary "diffusion". The cipher structure was further chosen to facilitate both hardware and software implementations. The IDEA cipher is an improved version of PES and was developed to increase security against differential cryptanalysis. Description of MDC cipher ------------------------- This is a method for turning a hash function, here MD5, into a fast secret-key encryption. Based on a suggestion by Phil Karn in sci.crypt, 13 Feb 1992. See also his comments from sci.crypt, 23 Mar 1992. The method is a variant of that described in Zheng, Matsumoto and Imai, Crypto 89. See also, "A New Class of Cryptosystems Based on Interconnection Networks" by michaelp@terpsichore.informatic.rwth-aachen.de Description of DES cipher ------------------------- DES is the well known U.S. Data Encryption Standard cipher. DES encrypts data in 64 bit blocks, using a 64 bit key -- of which 56 bits are used in the encipherment process.------------------------------------------------------------------</Prolog>-*/#ifndef SFLCRYP_INCLUDED /* Allow multiple inclusions */#define SFLCRYP_INCLUDED/* Definitions of the encryption algorithms we support */#define CRYPT_IDEA 0 /* IDEA algorithm */#define CRYPT_MDC 1 /* MDC algorithm */#define CRYPT_DES 2 /* DES algorithm */#define CRYPT_XOR 3 /* A basic XOR algorithm */#define CRYPT_TOP 4 /* We support 4 algorithms *//* We define some tables that key off the encryption algorithm */#if (defined (DEFINE_CRYPT_TABLES))static int crypt_block_size [] = { /* Block size for each algorithm */ 8, 32, 8, 16 };#define CRYPT_MAX_BLOCK_SIZE 32 /* Largest block size, in bytes */#endif/* Function prototypes */#ifdef __cplusplusextern "C" {#endifBool crypt_encode (byte *buffer, word buffer_size, int algorithm, const byte *key);Bool crypt_decode (byte *buffer, word buffer_size, int algorithm, const byte *key);qbyte calculate_crc (byte *block, size_t length);#ifdef __cplusplus}#endif#endif/* ----------------------------------------------------------------<Prolog>- Name: sfldate.h Title: Date and time functions Package: Standard Function Library (SFL) Written: 1996/01/05 iMatix SFL project team <sfl@imatix.com> Revised: 1998/08/05 Synopsis: Includes functions to get the current date/time, calculate the day or week, week of year and leap year. Dates and times are each stored in a 32-bit long value of 8 digits: dates are CCYYMMDD; times are HHMMSSCC. You can compare dates and times directly - e.g. if (date_wanted >= date_now). 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 SFLDATE_INCLUDED /* Allow multiple inclusions */#define SFLDATE_INCLUDED/* Macros */#define GET_CENTURY(d) (int) ( (d) / 1000000L)#define GET_CCYEAR(d) (int) ( (d) / 10000L)#define GET_YEAR(d) (int) (((d) % 1000000L) / 10000L)#define GET_MONTH(d) (int) (((d) % 10000L) / 100)#define GET_DAY(d) (int) ( (d) % 100)#define GET_HOUR(t) (int) ( (t) / 1000000L)#define GET_MINUTE(t) (int) (((t) % 1000000L) / 10000L)#define GET_SECOND(t) (int) (((t) % 10000L) / 100)#define GET_CENTI(t) (int) ( (t) % 100)#define MAKE_DATE(c,y,m,d) (long) (c) * 1000000L + \ (long) (y) * 10000L + \ (long) (m) * 100 + (d)#define MAKE_TIME(h,m,s,c) (long) (h) * 1000000L + \ (long) (m) * 10000L + \ (long) (s) * 100 + (c)#define timeeq(d1,t1,d2,t2) ((d1) == (d2) && (t1) == (t2))#define timeneq(d1,t1,d2,t2) ((d1) != (d2) || (t1) != (t2))#define timelt(d1,t1,d2,t2) ((d1) < (d2) || ((d1) == (d2) && (t1) < (t2)))#define timele(d1,t1,d2,t2) ((d1) < (d2) || ((d1) == (d2) && (t1) <= (t2)))#define timegt(d1,t1,d2,t2) ((d1) > (d2) || ((d1) == (d2) && (t1) > (t2)))#define timege(d1,t1,d2,t2) ((d1) > (d2) || ((d1) == (d2) && (t1) >= (t2)))/* Days are numbered from 0=Sunday to 6=Saturday */#define DAY_SUNDAY 0#define DAY_MONDAY 1#define DAY_TUESDAY 2#define DAY_WEDNESDAY 3#define DAY_THURSDAY 4#define DAY_FRIDAY 5#define DAY_SATURDAY 6/* Interval values, specified in centiseconds */#define INTERVAL_CENTI 1#define INTERVAL_SEC 100#define INTERVAL_MIN 6000#define INTERVAL_HOUR 360000L#define INTERVAL_DAY 8640000L/* Function prototypes */#ifdef __cplusplusextern "C" {#endiflong date_now (void);long time_now (void);Bool leap_year (int year);int julian_date (long date);int day_of_week (long date);int week_of_year (long date);int year_quarter (long date);long next_weekday (long date);long prev_weekday (long date);word pack_date (long date);word pack_time (long time);long unpack_date (word packdate);long unpack_time (word packtime);long default_century (long *date);long date_to_days (long date);long days_to_date (long days);time_t date_to_timer (long date, long time);long timer_to_date (time_t time_secs);long timer_to_time (time_t time_secs);long timer_to_gmdate (time_t time_secs);long timer_to_gmtime (time_t time_secs);long time_to_csecs (long time);long csecs_to_time (long csecs);void future_date (long *date, long *time, long days, long csecs);void past_date (long *date, long *time, long days, long csecs);void date_diff (long date1, long time1, long date2, long time2, long *days, long *csecs);Bool valid_date (long date);Bool valid_time (long time);Bool date_is_future (long date, long time);Bool date_is_past (long date, long time);char *timezone_string (void);void local_to_gmt (long date, long time, long *gmdate, long *gmtime);void gmt_to_local (long gmdate, long gmtime, long *date, long *time);struct tm *safe_localtime (const time_t *time_secs);struct tm *safe_gmtime (const time_t *time_secs);#ifdef __cplusplus}#endif#endif/* ----------------------------------------------------------------<Prolog>- Name: sfldbio.h Title: Database interface - header file Package: SFL Written: 1999/03/31 Pascal Antonnaux <pascal@imatix.com> Revised: 2000/02/13 Jonathan Schultz Synopsis: Defines structures and constants for the db interface. Copyright: Copyright (c) 1991-99 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 _SFLDBIO_INCLUDED#define _SFLDBIO_INCLUDED/*- Definitions ------------------------------------------------------------*/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -