mirror of
https://github.com/michaeldv/pit.git
synced 2025-12-10 08:25:34 +00:00
Added src/pager.c with stub APIs
This commit is contained in:
20
src/pager.c
20
src/pager.c
@@ -2,3 +2,23 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include "pit.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
26
src/pager.h
Normal 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
|
||||||
@@ -8,6 +8,7 @@ typedef unsigned char uchar;
|
|||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include "object.h"
|
#include "object.h"
|
||||||
#include "table.h"
|
#include "table.h"
|
||||||
|
#include "pager.h"
|
||||||
|
|
||||||
/* Externals. */
|
/* Externals. */
|
||||||
extern PTable activities;
|
extern PTable activities;
|
||||||
|
|||||||
@@ -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.
|
** 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) {
|
||||||
if (pt->index) {
|
if (pt->index) {
|
||||||
free(pt->index);
|
free(pt->index);
|
||||||
@@ -207,8 +207,6 @@ PTable pit_table_free(PTable pt) {
|
|||||||
}
|
}
|
||||||
free(pt);
|
free(pt);
|
||||||
}
|
}
|
||||||
|
|
||||||
return NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
#define TABLE_HAS_UPDATED_AT 4
|
#define TABLE_HAS_UPDATED_AT 4
|
||||||
#define TABLE_HAS_TIMESTAMPS (TABLE_HAS_CREATED_AT | TABLE_HAS_UPDATED_AT)
|
#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 flags; /* Bit mask with table flags. */
|
||||||
ulong record_size; /* Record size in bytes; all records are of fixed size. */
|
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. */
|
ulong number_of_slots; /* Number of slots allocated, each slot is 'record_size' long. */
|
||||||
@@ -18,7 +18,7 @@ typedef struct {
|
|||||||
} Table, *PTable;
|
} Table, *PTable;
|
||||||
|
|
||||||
PTable pit_table_initialize(ulong record_size, ulong flags);
|
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_find(PTable pt, ulong id);
|
||||||
uchar *pit_table_delete(PTable pt, ulong id);
|
uchar *pit_table_delete(PTable pt, ulong id);
|
||||||
uchar *pit_table_insert(PTable pt, uchar *record);
|
uchar *pit_table_insert(PTable pt, uchar *record);
|
||||||
|
|||||||
Reference in New Issue
Block a user