Added src/pager.c with stub APIs

This commit is contained in:
Mike Dvorkin
2010-07-27 21:51:18 -07:00
parent be2bea9141
commit c0806f893f
5 changed files with 50 additions and 5 deletions

View File

@@ -2,3 +2,23 @@
#include <string.h>
#include <stdio.h>
#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)
{
}

26
src/pager.h Normal file
View File

@@ -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

View File

@@ -8,6 +8,7 @@ typedef unsigned char uchar;
#include <time.h>
#include "object.h"
#include "table.h"
#include "pager.h"
/* Externals. */
extern PTable activities;

View File

@@ -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;
}
/*

View File

@@ -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);