1 #ifndef __UTILS_H
2 # define __UTILS_H
3 /*!
4 *  \file utils.h
5 *  \brief Pool of common functions header file.
6 */
7 /*
8 *  Copyright (c) 1994, 95, 96, 1997, 2000 Thomas Esken
9 *  Copyright (c) 2010, 2011, 2013 Free Software Foundation, Inc.
10 *
11 *  This software doesn't claim completeness, correctness or usability.
12 *  On principle I will not be liable for ANY damages or losses (implicit
13 *  or explicit), which result from using or handling my software.
14 *  If you use this software, you agree without any exception to this
15 *  agreement, which binds you LEGALLY !!
16 *
17 *  This program is free software; you can redistribute it and/or modify
18 *  it under the terms of the `GNU General Public License' as published by
19 *  the `Free Software Foundation'; either version 3, or (at your option)
20 *  any later version.
21 *
22 *  You should have received a copy of the `GNU General Public License'
23 *  along with this program; if not, write to the:
24 *
25 */
26 
27 
28 
29 /*
30 *  $Id: utils.h 3.01 2000/06/14 03:00:01 tom Exp $
31 */
32 
33 
34 
35 /*
36 *  GLOBAL functions prototypes.
37 */
38 __BEGIN_DECLARATIONS
39 /*
40 ************************************************** Defined in `utils.c'.
41 */
42 extern VOID_PTR
43   my_malloc __P_ ((const int amount,
44 		   const int exit_status,
45 		   const char *module_name,
46 		   const long module_line,
47 		   const char *var_name, const int var_contents));
48 extern VOID_PTR
49   my_realloc __P_ ((VOID_PTR ptr_memblock,
50 		    const int amount,
51 		    const int exit_status,
52 		    const char *module_name,
53 		    const long module_line,
54 		    const char *var_name, const int var_contents));
55 extern void
56   allocate_all_strings __P_ ((const int amount,
57 			      const char *module_name,
58 			      const long module_line));
59 extern void
60   resize_all_strings __P_ ((const int amount,
61 			    const Bool with_line_buffer,
62 			    const char *module_name, const long module_line));
63 extern void
64   my_error __P_ ((const int exit_status,
65 		  const char *module_name,
66 		  const long module_line,
67 		  const char *var_name, const int var_contents));
68 # if HAVE_SIGNAL && (defined(SIGINT) || defined(SIGTERM) || defined(SIGHUP))
69 extern RETSIGTYPE handle_signal __P_ ((int the_signal));
70 # endif
71 extern void my_exit __P_ ((const int exit_status));
72 extern int my_atoi __P_ ((const char *string));
73 extern int my_system __P_ ((const char *command));
74 # if !HAVE_STRSTR
75 extern char *my_strstr __P_ ((const char *text, const char *pattern));
76 # endif	/* !HAVE_STRSTR */
77 # if !HAVE_STRCSPN
78 extern char *my_strcspn __P_ ((const char *s1, const char *s2));
79 # endif	/* !HAVE_STRCSPN */
80 # if !HAVE_STRCASECMP
81 extern int my_strcasecmp __P_ ((const char *s1, const char *s2));
82 # endif	/* !HAVE_STRCASECMP */
83 # if !HAVE_STRNCASECMP
84 extern int my_strncasecmp __P_ ((const char *s1, const char *s2, int len));
85 # endif	/* !HAVE_STRNCASECMP */
86 extern Bool get_actual_date __P_ ((void));
87 extern int
88   compare_d_m_name __P_ ((const char *string, const Cmode_enum mode));
89 extern int asc_sort __P_ ((const char **a, const char **b));
90 extern int des_sort __P_ ((const char **a, const char **b));
91 extern Bool is_presorted __P_ ((char **table, int elems));
92 extern void reverse_order __P_ ((char **table, const int elems));
93 extern const char *day_suffix __P_ ((int day));
94 extern const char *short3_day_name __P_ ((const int day));
95 extern const char *short_day_name __P_ ((const int day));
96 extern const char *day_name __P_ ((const int day));
97 extern const char *short_month_name __P_ ((const int month));
98 extern const char *month_name __P_ ((const int month));
99 extern Ulint date2num __P_ ((const int day, const int month, const int year));
100 extern void num2date __P_ ((Ulint mjd, int *day, int *month, int *year));
101 extern Bool
102   doy2date __P_ ((int doy, const int is_leap_year, int *day, int *month));
103 extern int
104   weekday_of_date __P_ ((const int day, const int month, const int year));
105 extern int
106   day_of_year __P_ ((const int day, const int month, const int year));
107 extern int days_of_february __P_ ((const int year));
108 extern Bool
109   valid_date __P_ ((const int day, const int month, const int year));
110 extern Bool prev_date __P_ ((int *day, int *month, int *year));
111 extern Bool next_date __P_ ((int *day, int *month, int *year));
112 extern int
113   week_number __P_ ((const int day,
114 		     const int month,
115 		     const int year,
116 		     const Bool is_iso_week, const int start_day_of_week));
117 extern int
118   weekno2doy __P_ ((int week,
119 		    const int year,
120 		    const Bool is_iso_week, const int start_day_of_week));
121 extern int knuth_easter_formula __P_ ((const int year));
122 extern int
123   julian_gregorian_diff __P_ ((const int day,
124 			       const int month, const int year));
125 __END_DECLARATIONS
126 #endif /* __UTILS_H */
127