Repository navigation
Expand file tree
/
Copy pathmyStrLib.h
More file actions
56 lines (43 loc) · 1.58 KB
/
Copy pathmyStrLib.h
File metadata and controls
56 lines (43 loc) · 1.58 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#define DEBUG_PRINT printf("File name is %s.Function is %s.Local line is %d.\n",\
__FILE__,__FUNCTION__,\
__LINE__);
#define OBNUM 6
#define RESNUM 20
#define MESSAGELENGTH 80
#define DOUBLE 2
#define TRIPLE 3
typedef enum _observeType {REAL_ESTAE_BOSS=0 ,GOVEMENT ,THE_RICH_MAN,THE_POOR_MAN } observeType;
static char *representative[] =
{ "real estate boss", "government", "the rich man", "the poor man" };
static char *desire[] =
{ "I am very happy and expect further rise in house prices.",
"Try to control house prices and bring happies to people.",
"It does not matter,I have plenty money.",
"I cannot afford a house,I cannot afford a wife,I cannot afford a baby." };
typedef void (*displayHousePriceInformation)(float price ,char *observerMan,char *information);
typedef struct _ZJK_housePrice
{
float price;
} ZJK_housePrice;
typedef struct _observes
{
int isRegistered;
observeType type;
char representative[RESNUM];
char desire[MESSAGELENGTH];
ZJK_housePrice observed;
displayHousePriceInformation displayInformation;
} observes;
observes *obTogether[OBNUM];
char * myStrcpy(char*dest, const char *source);
int myStrcomp(const char *compA, const char *compB);
int myStrlen(const char *str);
char * myStrcat(char*dest, const char *source);
char * myStrstr(char *string, char * subString);
char * myStrtok(char *str, const char *delim);
int sortArray(void *array, int num, int length,
int (*callback)(void *, void *));
void setHousePrice(float * price,observes ob);
int attachObserve(observes ob);
int detachObserve(observes ob);
void notifyObserve(float price);