-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathhead.h
91 lines (83 loc) · 3.13 KB
/
head.h
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
typedef enum type{
t_movie=1, t_director=2, t_actor=3, //구조체 타입
t_str=11, t_data_at=12, t_str_all = 13, //반환 문자열 타입
t_read=21, t_print=22 //모드 설정
} Type;
typedef struct data_at{ // 자기 참조 구조체 : 배우 & 대표작품
char * data_at;
void * link;
struct data_at * next;
} DATA_AT;
typedef struct movie{ // 자기 참조 구조체 : 영화
char * tag;
int srl_num;
char * title;
char * genre;
struct data_at * director;
int year;
int runtime;
struct data_at * actors;
struct movie * next;
} MOVIE;
typedef struct director_actor{ // 자기 참조 구조체 : 감독 &배우
char * tag;
int srl_num;
char * name;
char * sex;
int birth;
struct data_at * best_movies;
struct director_actor * next;
} DIR_ACTOR;
////////////////////////////
char * read(FILE * fp, Type type);
void startReadLog(void);
void readLog(FILE * fp, void * ptr, fpos_t * pos, Type type);
void linkLog(MOVIE * mPtr, DIR_ACTOR * dPtr, DIR_ACTOR * aPtr);
////////////////////////////
void Input_Tag(MOVIE * mPtr, DIR_ACTOR * dPtr, DIR_ACTOR * aPtr);
char* preArrange(char* cmpstr, char* stdstr);
char* Scan_log();
char* changeColon(char* ptr, Type mode);
////////////////////////////
void makeList(MOVIE * mPtr, DIR_ACTOR * dPtr, DIR_ACTOR * aPtr);
void Save_File();
////////////////////////////
void contrl_C();
////////////////////////////
void add(FILE * fp, void * ptr, Type type);
void update(FILE * fp, int srl, char * option, void * ptr, Type type);
int excludeSameRecord(void * ptr, char * compareString, Type type);
void PrintOption(void * ptr, int srl, Type type);
void saveOption(Type type, void * ptr, char * option, char * filename);
void SearchOption(void * ptr, char * str, Type type, int num);
void sortOption(Type type, void * ptr, char * option, char * filename);
////////////////////////////
int compareOptionT(const void * ptr1, const void * ptr2);
int compareOptionG(const void * ptr1, const void * ptr2);
int compareOptionD(const void * ptr1, const void * ptr2);
int compareOptionY(const void * ptr1, const void * ptr2);
int compareOptionR(const void * ptr1, const void * ptr2);
int compareOptionA(const void * ptr1, const void * ptr2);
int compareOptionN(const void * ptr1, const void * ptr2);
int compareOptionS(const void * ptr1, const void * ptr2);
int compareOptionB(const void * ptr1, const void * ptr2);
int compareOptionM(const void * ptr1, const void * ptr2);
////////////////////////////
#ifdef GLOBAL_DEF
MOVIE * movie = NULL;
DIR_ACTOR * director = NULL;
DIR_ACTOR * actor = NULL;
int m_srl=0, d_srl=0, a_srl=0; //마지막 시리얼 넘버 저장 전역 변수
fpos_t moviePos=0, directorPos=0, actorPos=0; // 파일 위치 저장 전역 변수
fpos_t *moviePosPtr=&moviePos, *directorPosPtr=&directorPos, *actorPosPtr=&actorPos;
#else
extern MOVIE * movie;
extern DIR_ACTOR * director, * actor;
extern int m_srl, d_srl, a_srl; //마지막 시리얼 넘버 저장 전역 변수
extern fpos_t moviePos, directorPos, actorPos; // 파일 위치 저장 전역 변수
extern fpos_t *moviePosPtr, *directorPosPtr, *actorPosPtr;
#endif