-
Notifications
You must be signed in to change notification settings - Fork 0
/
library.h
68 lines (59 loc) · 1.36 KB
/
library.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
#ifndef LIBRARY_H
#define LIBRARY_H
#include <stdio.h>
#include <ctype.h>
#include <string.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
//GENERAL SETTINGS DEFINES
#define titleLength 15
#define authorNameLength 15
#define lettersPerPage 450
#define PagesPerBook 100
#define booksPerShelf 12
#define shelfsPerBookcase 5
#define bookcasesPerChamber 4
typedef struct {
int pageNumber;
char text[lettersPerPage];
}PAGE;
typedef struct {
int booknumber;
int amountOfPages;
char title[titleLength];
char author[authorNameLength];
PAGE bookPages[PagesPerBook];
}BOOK;
typedef struct {
int shelfID;
BOOK books[booksPerShelf];
}SHELF;
typedef struct {
int bookcaseID;
SHELF shelves[shelfsPerBookcase];
}BOOKCASE;
typedef struct {
int totalBooksInChamber;
int chamberID;
BOOKCASE bookcase[bookcasesPerChamber];
}CHAMBER;
typedef struct {
unsigned int chamber;
unsigned int bookcase;
unsigned int shelf;
unsigned int book;
unsigned int page;
unsigned short state;
}CURRENT;
typedef struct node {
CURRENT place;
struct node* next;
} LIST;
//each chamber has 4 walls with bookcases
int CreateChamber(int amountOfChambers);
int SaveChamber(CHAMBER* chamberPtr, FILE* libraryFile);
int LoadChamber(int chamberNR, CHAMBER* chamberPtr, FILE* libraryFile);
int CountChambers();
int SearchLibrary(CHAMBER* chamber, FILE* libraryFile, LIST* list,char* word);
#endif