Gammu internals  1.38.0
misc.h
Go to the documentation of this file.
1 /* (c) 2002-2004 by Marcin Wiacek */
2 
3 #ifndef __misc_h
4 #define __misc_h
5 
6 #if defined(_MSC_VER) && defined(__cplusplus)
7  extern "C" {
8 #endif
9 
10 #define GAMMU_URL "<http://www.gammu.org>"
11 #define BACKUP_MAIN_HEADER "; This file format was designed for Gammu and is compatible with Gammu+"
12 #define BACKUP_INFO_HEADER "; See " GAMMU_URL " for more info"
13 
14 #include <stdio.h>
15 #include <time.h>
16 
17 #ifdef WIN32
18 #define WIN32_LEAN_AND_MEAN
19 #include <windows.h>
20 #include <winsock2.h>
21 #endif
22 
23 #include <gammu-config.h>
24 #include <gammu-types.h>
25 #include <gammu-datetime.h>
26 #include <gammu-misc.h>
27 #include <gammu-debug.h>
28 
29 /* ------------------------------------------------------------------------- */
30 
34 typedef struct {
38  size_t *numbers;
42  size_t allocated;
46  char *retval;
47 } GSM_CutLines;
48 
52 void SplitLines(const char *message, const size_t messagesize, GSM_CutLines *lines, const char *whitespaces, const size_t spaceslen, const char *quotes, const size_t quoteslen, const gboolean eot);
53 
61 const char *GetLineString(const char *message, GSM_CutLines *lines, int start);
62 
69 int GetLineLength(const char *message, const GSM_CutLines * lines, int start);
70 
74 void InitLines(GSM_CutLines *lines);
75 
79 void FreeLines(GSM_CutLines *lines);
80 
84 void CopyLineString(char *dest, const char *src, const GSM_CutLines * lines, int start);
85 
86 void GetTimeDifference(unsigned long diff, GSM_DateTime * DT, gboolean Plus,
87  int multi);
88 
90 
95 int GetDayOfYear(unsigned int year, unsigned int month, unsigned int day);
96 
101 int GetWeekOfMonth(unsigned int year, unsigned int month, unsigned int day);
102 
107 int GetDayOfWeek(unsigned int year, unsigned int month, unsigned int day);
108 
109 
110 #ifdef WIN32
111 typedef SOCKET socket_type;
112 #define socket_invalid (INVALID_SOCKET)
113 #else
114 typedef int socket_type;
115 #define socket_invalid (-1)
116 #endif
117 
123 void StripSpaces(char *buff);
124 
125 #if defined(_MSC_VER) && defined(__cplusplus)
126 
127  }
128 #endif
129 
130 #endif
131 
132 /* How should editor hadle tabs in this file? Add editor commands here.
133  * vim: noexpandtab sw=8 ts=8 sts=8:
134  */
const char * GetLineString(const char *message, GSM_CutLines *lines, int start)
Definition: misc.c:492
void CopyLineString(char *dest, const char *src, const GSM_CutLines *lines, int start)
Definition: misc.c:522
int GetWeekOfMonth(unsigned int year, unsigned int month, unsigned int day)
Definition: misc.c:105
int socket_type
Definition: misc.h:114
int GetDayOfYear(unsigned int year, unsigned int month, unsigned int day)
Definition: misc.c:93
int GetDayOfWeek(unsigned int year, unsigned int month, unsigned int day)
Definition: misc.c:117
void SplitLines(const char *message, const size_t messagesize, GSM_CutLines *lines, const char *whitespaces, const size_t spaceslen, const char *quotes, const size_t quoteslen, const gboolean eot)
Definition: misc.c:401
size_t * numbers
Definition: misc.h:38
void StripSpaces(char *buff)
Definition: misc.c:713
size_t allocated
Definition: misc.h:42
int gboolean
Definition: gammu-types.h:23
int GetLineLength(const char *message, const GSM_CutLines *lines, int start)
void FreeLines(GSM_CutLines *lines)
Definition: misc.c:392
void InitLines(GSM_CutLines *lines)
Definition: misc.c:385
void GetTimeDifference(unsigned long diff, GSM_DateTime *DT, gboolean Plus, int multi)
Definition: misc.c:247
GSM_DateTime GSM_AddTime(GSM_DateTime DT, GSM_DeltaTime delta)
Definition: misc.c:223
char * retval
Definition: misc.h:46