sheet.h

Go to the documentation of this file.
00001 /*
00002  * Copyright (c) 2009 Jiri Svoboda
00003  * All rights reserved.
00004  *
00005  * Redistribution and use in source and binary forms, with or without
00006  * modification, are permitted provided that the following conditions
00007  * are met:
00008  *
00009  * - Redistributions of source code must retain the above copyright
00010  *   notice, this list of conditions and the following disclaimer.
00011  * - Redistributions in binary form must reproduce the above copyright
00012  *   notice, this list of conditions and the following disclaimer in the
00013  *   documentation and/or other materials provided with the distribution.
00014  * - The name of the author may not be used to endorse or promote products
00015  *   derived from this software without specific prior written permission.
00016  *
00017  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
00018  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
00019  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
00020  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
00021  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
00022  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
00023  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
00024  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
00025  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
00026  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00027  */
00028 
00036 #ifndef SHEET_H__
00037 #define SHEET_H__
00038 
00039 #include <adt/list.h>
00040 #include <sys/types.h>
00041 #include <bool.h>
00042 
00044 enum dir_spec {
00046         dir_before,
00048         dir_after
00049 };
00050 
00052 typedef struct {
00053         /* Note: This structure is opaque for the user. */
00054 
00055         size_t text_size;
00056         size_t dbuf_size;
00057         char *data;
00058 
00059         link_t tags_head;
00060 } sheet_t;
00061 
00066 typedef struct {
00067         int row;
00068         int column;
00069 } coord_t;
00070 
00078 typedef struct {
00079         /* Note: This structure is opaque for the user. */
00080         sheet_t *sh;
00081         size_t b_off;
00082 } spt_t;
00083 
00090 typedef struct {
00091         /* Note: This structure is opaque for the user. */
00092 
00094         link_t link;
00095         sheet_t *sh;
00096         size_t b_off;
00097 } tag_t;
00098 
00099 extern int sheet_init(sheet_t *);
00100 extern int sheet_insert(sheet_t *, spt_t *, enum dir_spec, char *);
00101 extern int sheet_delete(sheet_t *, spt_t *, spt_t *);
00102 extern void sheet_copy_out(sheet_t *, spt_t const *, spt_t const *, char *,
00103     size_t, spt_t *);
00104 extern void sheet_get_cell_pt(sheet_t *, coord_t const *, enum dir_spec,
00105     spt_t *);
00106 extern void sheet_get_row_width(sheet_t *, int, int *);
00107 extern void sheet_get_num_rows(sheet_t *, int *);
00108 extern void spt_get_coord(spt_t const *, coord_t *);
00109 extern bool spt_equal(spt_t const *, spt_t const *);
00110 
00111 extern void sheet_place_tag(sheet_t *, spt_t const *, tag_t *);
00112 extern void sheet_remove_tag(sheet_t *, tag_t *);
00113 extern void tag_get_pt(tag_t const *, spt_t *);
00114 
00115 #endif
00116 

Generated on Thu Jun 2 07:45:41 2011 for HelenOS/USB by  doxygen 1.4.7