File: task.h

package info (click to toggle)
gtimer 2.0.0-1.2
  • links: PTS
  • area: main
  • in suites: bullseye, buster, jessie, jessie-kfreebsd, sid, stretch
  • size: 1,380 kB
  • ctags: 849
  • sloc: ansic: 8,122; sh: 821; perl: 651; makefile: 86
file content (94 lines) | stat: -rw-r--r-- 3,170 bytes parent folder | download | duplicates (2)
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
92
93
94
/*
 * Definition for a task
 *
 * Copyright:
 *	(C) 1999 Craig Knudsen, cknudsen@cknudsen.com
 *	See accompanying file "COPYING".
 * 
 *	This program is free software; you can redistribute it and/or
 *	modify it under the terms of the GNU General Public License
 *	as published by the Free Software Foundation; either version 2
 *	of the License, or (at your option) any later version.
 * 
 *	This program is distributed in the hope that it will be useful,
 *	but WITHOUT ANY WARRANTY; without even the implied warranty of
 *	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *	GNU General Public License for more details.
 * 
 *	You should have received a copy of the GNU General Public License
 *	along with this program; if not, write to the
 *	Free Software Foundation, Inc., 59 Temple Place,
 *	Suite 330, Boston, MA  02111-1307, USA
 *
 *	17-Apr-2005	Add support for subtracting a particular offset
 *			off of timers.  (Russ Allbery)
 */


#ifndef _TASK_H
#define _TASK_H

#define TASK_DIRECTORY		".gtimer"	/* from $HOME */

/* Errors */
#define TASK_ERROR_SYSTEM_ERROR	1	/* check errno value */
#define TASK_ERROR_BAD_FILE	2	/* bad file format */

typedef struct {
  int seconds;		/* time in seconds */
  int mon, mday, year;	/* MM/DD/YYYY */
  int marked_seconds;	/* time in seconds - used by taskMark() */
} TaskTimeEntry;

typedef struct {
  char *text;		/* text of annotiation */
  time_t text_time;	/* GMT of annotation */
} TaskAnnotation;

typedef struct {
  char *name;			/* name of task */
  TaskTimeEntry **entries;	/* entries */
  int num_entries;		/* number entries (dates) */
  time_t created;		/* time created */
  int number;			/* unique task id number */
  int project_id;		/* id of parent project (-1=no project) */
  unsigned int options;		/* app-defined bit-or options */
  TaskAnnotation **annotations;	/* annotations */
  int num_annotations;		/* size of above array */
} Task;

/*
 * Functions
 */


void taskAdd ( Task *task );
int taskSave ( Task *task, char *taskdir );
int taskSaveAll ( char *taskdir );
/* rra 2005-04-17 - add an offset to subtract from running times */
void taskMark ( Task *task, int offset );
void taskMarkAll ( int offset );
void taskRestore ( Task *task );
void taskRestoreAll ();
void taskClearAll ();
int taskLoad ( char *file, Task **task );
int taskLoadAll ( char *taskdir );
Task *taskCreate ( char *name );
int taskDelete ( Task *task, char *taskdir );
void taskFree ();
int taskCount ();
Task *taskGet ( int number );
Task *taskGetFirst ();
Task *taskGetNext ();
TaskTimeEntry *taskGetTimeEntry ( Task *task, int year, int month, int day );
TaskTimeEntry *taskNewTimeEntry ( Task *task, int year, int month, int day );
unsigned int taskOptions ( Task *task );
unsigned int taskOptionEnabled ( Task *task, unsigned int option );
void taskSetOption ( Task *task, unsigned int option );
void taskUnsetOption ( Task *task, unsigned int option );
void taskAddAnnotation ( Task *task, char *taskdir, char *text );
TaskAnnotation **TaskGetAnnotationEntries ( Task *task, int year,
  int month, int day, int time_offset, int *num_ret );
char *taskErrorString ( int task_error );

#endif /* _TASK_H */