From c0806f893f711c9c788a55979be8e6193c600cf8 Mon Sep 17 00:00:00 2001 From: Mike Dvorkin Date: Tue, 27 Jul 2010 21:51:18 -0700 Subject: [PATCH] Added src/pager.c with stub APIs --- src/pager.c | 20 ++++++++++++++++++++ src/pager.h | 26 ++++++++++++++++++++++++++ src/pit.h | 1 + src/table.c | 4 +--- src/table.h | 4 ++-- 5 files changed, 50 insertions(+), 5 deletions(-) create mode 100644 src/pager.h diff --git a/src/pager.c b/src/pager.c index c491b6e..f97011c 100644 --- a/src/pager.c +++ b/src/pager.c @@ -2,3 +2,23 @@ #include #include #include "pit.h" + +PPager pit_pager_initialize(ulong number_of_entries) +{ + return NULL; +} + +uchar *pit_pager_add(PPager pp, uchar *entry) +{ + return NULL; +} + +void pit_pager_dump(PPager pp) +{ + +} + +void pit_pager_free(PPager pp, int deep) +{ + +} diff --git a/src/pager.h b/src/pager.h new file mode 100644 index 0000000..ca2e826 --- /dev/null +++ b/src/pager.h @@ -0,0 +1,26 @@ +#if !defined(__PAGER_H__) +#define __PAGER_H__ + +#define PAGER_ACTIVITY 1 +#define PAGER_PROJECT 2 +#define PAGER_TASK 4 +#define PAGER_NOTE 8 +#define PAGER_USER 16 + +typedef struct _Pager { + ulong type; + ulong number_of_entries; + int max_id; + int max_name; + int max_status; + int max_priority; + int min_deadline; + uchar *entries; +} Pager, *PPager; + +PPager pit_pager_initialize(ulong number_of_entries); +uchar *pit_pager_add(PPager pp, uchar *entry); +void pit_pager_dump(PPager pp); +void pit_pager_free(PPager pp, int deep); + +#endif \ No newline at end of file diff --git a/src/pit.h b/src/pit.h index 787a7a7..75f187f 100644 --- a/src/pit.h +++ b/src/pit.h @@ -8,6 +8,7 @@ typedef unsigned char uchar; #include #include "object.h" #include "table.h" +#include "pager.h" /* Externals. */ extern PTable activities; diff --git a/src/table.c b/src/table.c index e55eee4..be3c761 100644 --- a/src/table.c +++ b/src/table.c @@ -197,7 +197,7 @@ uchar *pit_table_mark(PTable pt, ulong id) { /* ** Release pt->slots and pt->index memory chunks, then free the table itself. */ -PTable pit_table_free(PTable pt) { +void pit_table_free(PTable pt) { if (pt) { if (pt->index) { free(pt->index); @@ -207,8 +207,6 @@ PTable pit_table_free(PTable pt) { } free(pt); } - - return NULL; } /* diff --git a/src/table.h b/src/table.h index c8fb44b..60e43c8 100644 --- a/src/table.h +++ b/src/table.h @@ -6,7 +6,7 @@ #define TABLE_HAS_UPDATED_AT 4 #define TABLE_HAS_TIMESTAMPS (TABLE_HAS_CREATED_AT | TABLE_HAS_UPDATED_AT) -typedef struct { +typedef struct _Table { ulong flags; /* Bit mask with table flags. */ ulong record_size; /* Record size in bytes; all records are of fixed size. */ ulong number_of_slots; /* Number of slots allocated, each slot is 'record_size' long. */ @@ -18,7 +18,7 @@ typedef struct { } Table, *PTable; PTable pit_table_initialize(ulong record_size, ulong flags); -PTable pit_table_free(PTable pt); +void pit_table_free(PTable pt); uchar *pit_table_find(PTable pt, ulong id); uchar *pit_table_delete(PTable pt, ulong id); uchar *pit_table_insert(PTable pt, uchar *record);