Commit 12622861 authored by Morten Welinder's avatar Morten Welinder

Fix interdependent header files.

parent 780daecf
1999-04-30 Morten Welinder <terra@diku.dk>
* src/*.h: Properly forward-declare structures. Include
dependencies. Change the occasional "void *" to its right
type.
* src/*.[cy]: Include more dependencies.
* src/sheet.c (sheet_delete_row): Remove from workbook hash also.
1999-04-29 Morten Welinder <terra@diku.dk>
......
1999-04-30 Morten Welinder <terra@diku.dk>
* src/*.h: Properly forward-declare structures. Include
dependencies. Change the occasional "void *" to its right
type.
* src/*.[cy]: Include more dependencies.
* src/sheet.c (sheet_delete_row): Remove from workbook hash also.
1999-04-29 Morten Welinder <terra@diku.dk>
......
1999-04-30 Morten Welinder <terra@diku.dk>
* src/*.h: Properly forward-declare structures. Include
dependencies. Change the occasional "void *" to its right
type.
* src/*.[cy]: Include more dependencies.
* src/sheet.c (sheet_delete_row): Remove from workbook hash also.
1999-04-29 Morten Welinder <terra@diku.dk>
......
1999-04-30 Morten Welinder <terra@diku.dk>
* src/*.h: Properly forward-declare structures. Include
dependencies. Change the occasional "void *" to its right
type.
* src/*.[cy]: Include more dependencies.
* src/sheet.c (sheet_delete_row): Remove from workbook hash also.
1999-04-29 Morten Welinder <terra@diku.dk>
......
......@@ -13,6 +13,7 @@
#include "format.h"
#include "color.h"
#include "cursors.h"
#include "utils.h"
static int redraws_frozen = 0;
static GHashTable *cell_hash_queue;
......@@ -1408,11 +1409,10 @@ str_trim_spaces (char *s)
* Returns the number of columns used for the draw
*/
int
cell_draw (Cell *cell, void *sv, GdkGC *gc, GdkDrawable *drawable, int x1, int y1)
cell_draw (Cell *cell, SheetView *sheet_view, GdkGC *gc, GdkDrawable *drawable, int x1, int y1)
{
Style *style = cell->style;
GdkFont *font = style->font->font;
SheetView *sheet_view = sv;
GdkGC *white_gc = GTK_WIDGET (sheet_view->sheet_view)->style->white_gc;
GdkRectangle rect;
......
#ifndef GNUMERIC_CELL_H
#define GNUMERIC_CELL_H
/* Forward references for structures. */
typedef struct _Cell Cell;
typedef struct _CellRegion CellRegion;
typedef GList CellList;
typedef struct _ColRowInfo ColRowInfo;
#include "style.h"
#include "sheet.h"
#include "sheet-view.h"
#include "str.h"
#include "expr.h"
typedef unsigned char ColType;
typedef unsigned short RowType;
typedef struct {
struct _ColRowInfo {
int pos; /* the column or row number */
/* The height */
......@@ -15,7 +27,7 @@ typedef struct {
unsigned int hard_size:1; /* has the user explicitly set the dimensions? */
void *data;
} ColRowInfo;
};
#define COL_INTERNAL_WIDTH(col) ((col)->pixels - ((col)->margin_b + (col)->margin_a))
#define ROW_INTERNAL_HEIGHT(row) ((row)->pixels - ((row)->margin_b + (row)->margin_a))
......@@ -51,8 +63,8 @@ typedef struct {
*
* Definition of a Gnumeric Cell
*/
typedef struct {
void *sheet;
struct _Cell {
Sheet *sheet;
ColRowInfo *col;
ColRowInfo *row;
......@@ -74,9 +86,7 @@ typedef struct {
CellComment *comment;
int flags;
char generation;
} Cell;
typedef GList CellList;
};
/* #define CELL_TEXT_GET(cell) ((cell)->text ? cell->text->str : cell->entered_text->str) */
#define CELL_IS_FORMAT_SET(cell) ((cell)->flags & CELL_FORMAT_SET)
......@@ -97,10 +107,10 @@ typedef struct {
typedef GList CellCopyList;
typedef struct {
struct _CellRegion {
int cols, rows;
CellCopyList *list;
} CellRegion;
};
char *value_format (Value *value, StyleFormat *format, char **color);
......@@ -148,7 +158,7 @@ void cell_formula_changed (Cell *cell);
void cell_queue_redraw (Cell *cell);
int cell_get_horizontal_align (const Cell *cell);
int cell_draw (Cell *cell, void *sheet_view,
int cell_draw (Cell *cell, SheetView *sheet_view,
GdkGC *gc, GdkDrawable *drawable,
int x, int y);
......@@ -177,4 +187,3 @@ void row_init_span (ColRowInfo *ri);
void row_destroy_span (ColRowInfo *ri);
#endif /* GNUMERIC_CELL_H */
#ifndef GNUMERIC_EVAL_H
#define GNUMERIC_EVAL_H
#include "sheet.h"
#include "cell.h"
/*
* A DependencyRange defines a range of cells whose values
* are used by another Cell in the spreadsheet.
......
......@@ -13,6 +13,7 @@
#include "dialogs.h"
#include "cell.h"
#include "expr.h"
#include "utils.h"
typedef struct {
GtkWidget *parent;
......
......@@ -16,7 +16,7 @@
#include "cell.h"
#include "expr.h"
#include "eval.h"
#include "utils.h"
#define MAX_CELL_NAME_LEN 20
......
......@@ -12,7 +12,7 @@
#include "gnumeric-util.h"
#include "dialogs.h"
#include "func.h"
#include "utils.h"
/* Different constraint types */
static const char *constraint_strs[] = {
......
#ifndef GNUMERIC_DIALOGS_H
#define GNUMERIC_DIALOGS_H
#include "sheet.h"
#include "cell.h"
void dialog_goto_cell (Workbook *wb);
void dialog_cell_format (Workbook *wb, Sheet *sheet);
int dialog_paste_special (Workbook *wb);
......
......@@ -13,6 +13,7 @@
#include "dialogs.h"
#include "cell.h"
#include "expr.h"
#include "utils.h"
typedef struct {
GtkWidget *parent;
......
......@@ -16,7 +16,7 @@
#include "cell.h"
#include "expr.h"
#include "eval.h"
#include "utils.h"
#define MAX_CELL_NAME_LEN 20
......
......@@ -12,7 +12,7 @@
#include "gnumeric-util.h"
#include "dialogs.h"
#include "func.h"
#include "utils.h"
/* Different constraint types */
static const char *constraint_strs[] = {
......
#ifndef GNUMERIC_DIALOGS_H
#define GNUMERIC_DIALOGS_H
#include "sheet.h"
#include "cell.h"
void dialog_goto_cell (Workbook *wb);
void dialog_cell_format (Workbook *wb, Sheet *sheet);
int dialog_paste_special (Workbook *wb);
......
......@@ -3,6 +3,8 @@
#include <stdio.h>
#include "gnumeric.h"
#include "dump.h"
#include "symbol.h"
#include "func.h"
static FILE *output_file;
......
#ifndef GNUMERIC_EVAL_H
#define GNUMERIC_EVAL_H
#include "sheet.h"
#include "cell.h"
/*
* A DependencyRange defines a range of cells whose values
* are used by another Cell in the spreadsheet.
......
......@@ -13,6 +13,7 @@
#include "eval.h"
#include "format.h"
#include "func.h"
#include "utils.h"
ExprTree *
expr_parse_string (const char *expr, Sheet *sheet, int col, int row,
......
#ifndef GNUMERIC_EXPR_H
#define GNUMERIC_EXPR_H
/* Forward reference. We should probably just include sheet.h to get this. */
struct _Sheet;
/* Forward references for structures. */
typedef struct _Value Value;
typedef struct _ExprTree ExprTree;
typedef struct _CellRef CellRef;
#include "sheet.h"
#include "symbol.h"
#include "numbers.h"
#include "str.h"
typedef enum {
OPER_EQUAL, /* Compare value equal */
......@@ -41,15 +48,15 @@ typedef enum {
VALUE_ARRAY,
} ValueType;
typedef struct {
struct _Sheet *sheet;
struct _CellRef {
Sheet *sheet;
int col, row;
unsigned int col_relative:1;
unsigned int row_relative:1;
} CellRef;
};
typedef struct _Value {
struct _Value {
ValueType type;
union {
CellRef cell;
......@@ -60,19 +67,19 @@ typedef struct _Value {
struct {
int x, y ;
struct _Value **vals; /* Array [x][y] */
Value **vals; /* Array [x][y] */
} array ;
String *str;
Symbol *sym;
float_t v_float; /* floating point */
int_t v_int;
} v;
} Value;
};
#define VALUE_IS_NUMBER(x) (((x)->type == VALUE_INTEGER) || \
((x)->type == VALUE_FLOAT))
struct ExprTree {
struct _ExprTree {
Operation oper;
int ref_count;
......@@ -85,18 +92,16 @@ struct ExprTree {
} function;
struct {
struct ExprTree *value_a;
struct ExprTree *value_b;
ExprTree *value_a;
ExprTree *value_b;
} binary;
struct ExprTree *value;
ExprTree *value;
CellRef ref;
} u;
};
typedef struct ExprTree ExprTree;
typedef enum {
PARSE_OK,
PARSE_ERR_NO_QUOTE,
......@@ -135,7 +140,7 @@ struct FunctionDefinition {
char *args;
char *named_arguments;
char **help;
Value *(*expr_fn)(struct _Sheet *sheet, GList *expr_node_list, int eval_col, int eval_row, char **error_string);
Value *(*expr_fn)(Sheet *sheet, GList *expr_node_list, int eval_col, int eval_row, char **error_string);
Value *(*fn)(struct FunctionDefinition *func_def, Value *argv [], char **error_string);
};
......@@ -146,30 +151,30 @@ void cell_get_abs_col_row (const CellRef *cell_ref,
int eval_col, int eval_row,
int *col, int *row);
ExprTree *expr_parse_string (const char *expr, struct _Sheet *sheet, int col, int row,
ExprTree *expr_parse_string (const char *expr, Sheet *sheet, int col, int row,
const char **desired_format, char **error_msg);
/* In parser.y */
ParseErr gnumeric_expr_parser (const char *expr, struct _Sheet *sheet,
ParseErr gnumeric_expr_parser (const char *expr, Sheet *sheet,
int col, int row, const char **desired_format,
ExprTree **tree);
ExprTree *expr_tree_duplicate (ExprTree *expr);
ExprTree *expr_tree_relocate (ExprTree *expr, int col_diff, int row_diff);
char *expr_decode_tree (ExprTree *tree, struct _Sheet *sheet,
char *expr_decode_tree (ExprTree *tree, Sheet *sheet,
int col, int row);
void expr_tree_ref (ExprTree *tree);
void expr_tree_unref (ExprTree *tree);
ExprTree *expr_tree_invalidate_references (ExprTree *src, struct _Sheet *sheet,
ExprTree *expr_tree_invalidate_references (ExprTree *src, Sheet *sheet,
int src_col, int src_row, int col, int row,
int colcount, int rowcount);
ExprTree *expr_tree_fixup_references (ExprTree *src, struct _Sheet *sheet,
ExprTree *expr_tree_fixup_references (ExprTree *src, Sheet *sheet,
int src_col, int src_row, int col, int row,
int coldelta, int rowdelta);
Value *eval_expr (struct _Sheet *sheet, ExprTree *tree,
Value *eval_expr (Sheet *sheet, ExprTree *tree,
int col, int row,
char **error_string);
......
#ifndef GNUMERIC_FILE_H
#define GNUMERIC_FILE_H
#include "sheet.h"
typedef gboolean (*FileFormatProbe)(const char *filename);
typedef Workbook *(*FileFormatOpen) (const char *filename);
typedef int (*FileFormatSave) (Workbook *wb, const char *filename);
......
......@@ -34,6 +34,7 @@
#include "gnumeric.h"
#include "format.h"
#include "dates.h"
#include "utils.h"
/* Points to the locale information for number display */
static struct lconv *lc;
......
#ifndef GNUMERIC_FORMAT_H
#define GNUMERIC_FORMAT_H
#include "style.h"
#include "expr.h"
void format_destroy (StyleFormat *format);
void format_compile (StyleFormat *format);
gchar *format_value (StyleFormat *format, Value *value, StyleColor **color);
......
#ifndef GNUMERIC_FUNC_H
#define GNUMERIC_FUNC_H
#include "expr.h"
#include "sheet.h"
extern FunctionDefinition math_functions [];
extern FunctionDefinition sheet_functions [];
extern FunctionDefinition misc_functions [];
......@@ -100,4 +103,3 @@ Value *gnumeric_sum (Sheet *sheet, GList *expr_node_list,
int solver_simplex(Workbook *wb, Sheet *sheet);
#endif /* GNUMERIC_FUNC_H */
......@@ -15,6 +15,7 @@
#include "sheet-object.h"
#include "color.h"
#include "cursors.h"
#include "utils.h"
#define CURSOR_COL(gsheet) gsheet->sheet_view->sheet->cursor_col
#define CURSOR_ROW(gsheet) gsheet->sheet_view->sheet->cursor_row
......
......@@ -5,6 +5,7 @@
#include "item-cursor.h"
#include "item-bar.h"
#include "item-edit.h"
#include "sheet.h"
#define GNUMERIC_TYPE_SHEET (gnumeric_sheet_get_type ())
#define GNUMERIC_SHEET(obj) (GTK_CHECK_CAST((obj), GNUMERIC_TYPE_SHEET, GnumericSheet))
......@@ -93,6 +94,5 @@ void gnumeric_sheet_stop_editing (GnumericSheet *sheet);
typedef struct {
GnomeCanvasClass parent_class;
} GnumericSheetClass;
#endif /* GNUMERIC_GNUMERIC_SHEET_H */
#endif /* GNUMERIC_GNUMERIC_SHEET_H */
......@@ -15,6 +15,7 @@
#include "sheet-object.h"
#include "color.h"
#include "cursors.h"
#include "utils.h"
#define CURSOR_COL(gsheet) gsheet->sheet_view->sheet->cursor_col
#define CURSOR_ROW(gsheet) gsheet->sheet_view->sheet->cursor_row
......
......@@ -5,6 +5,7 @@
#include "item-cursor.h"
#include "item-bar.h"
#include "item-edit.h"
#include "sheet.h"
#define GNUMERIC_TYPE_SHEET (gnumeric_sheet_get_type ())
#define GNUMERIC_SHEET(obj) (GTK_CHECK_CAST((obj), GNUMERIC_TYPE_SHEET, GnumericSheet))
......@@ -93,6 +94,5 @@ void gnumeric_sheet_stop_editing (GnumericSheet *sheet);
typedef struct {
GnomeCanvasClass parent_class;
} GnumericSheetClass;
#endif /* GNUMERIC_GNUMERIC_SHEET_H */
#endif /* GNUMERIC_GNUMERIC_SHEET_H */
#ifndef GNUMERIC_GNUMERIC_UTIL_H
#define GNUMERIC_GNUMERIC_UTIL_H
#include "sheet.h"
void gnumeric_notice (Workbook *wb, const char *type, const char *str);
/* A simple routine for making a popup menu */
......
#include "numbers.h"
#include "style.h"
#include "symbol.h"
#include "str.h"
#include "expr.h"
#include "cell.h"
#ifdef ENABLE_BONOBO
# include <bonobo/gnome-container.h>
# include <bonobo/gnome-client-site.h>
#endif
#include "sheet.h"
#include "sheet-view.h"
#include "clipboard.h"
#include "utils.h"
#ifndef GNUMERIC_GNUMERIC_UTIL_H
#define GNUMERIC_GNUMERIC_UTIL_H
#include "sheet.h"
void gnumeric_notice (Workbook *wb, const char *type, const char *str);
/* A simple routine for making a popup menu */
......
......@@ -203,7 +203,7 @@ january_1900()
if (!julian) {
GDate* date = g_date_new_dmy (1, 1, 1900);
/* Day 1 means 1st of jannuary of 1900 */
/* Day 1 means 1st of January of 1900 */
julian = g_date_julian (date) - 1;
g_date_free (date);
}
......@@ -227,10 +227,9 @@ g_date_new_serial (guint32 serial)
* exist, they are created. If the input string is not valid
* error_flag is set.
*/
GSList *parse_cell_name_list (void *vsheet,
GSList *parse_cell_name_list (Sheet *sheet,
const char *cell_name_str, int *error_flag)
{
Sheet *sheet = (Sheet *) vsheet;
char *buf = (char *) malloc(strlen(cell_name_str)+1);
GSList *cells = NULL;
Cell *cell;
......
#ifndef GNUMERIC_UTILS_H
#define GNUMERIC_UTILS_H
#include "sheet.h"
/* Gets an integer in the buffer in start to end */
void int_get_from_range (const char *start, const char *end, int_t *t);
void float_get_from_range (const char *start, const char *end, float_t *t);
const char*cell_name (int col, int row);
int parse_cell_name (const char *cell_str, int *col, int *row);
GSList *parse_cell_name_list (void *sheet, const char *cell_name_str,
GSList *parse_cell_name_list (Sheet *sheet, const char *cell_name_str,
int *eflag);
const char*col_name (int col);
int col_from_name (const char *cell_str);
......
#ifndef GNUMERIC_ITEM_BAR_H
#define GNUMERIC_ITEM_BAR_H
#include "sheet.h"
#define ITEM_BAR(obj) (GTK_CHECK_CAST((obj), item_bar_get_type (), ItemBar))
#define ITEM_BAR_CLASS(k) (GTK_CHECK_CLASS_CAST ((k), item_bar_get_type (), ItemBarType))
#define IS_ITEM_BAR(o) (GTK_CHECK_TYPE((o), item_bar_get_type ()))
......
......@@ -16,6 +16,7 @@
#include "color.h"
#include "cursors.h"
#include "sheet-autofill.h"
#include "clipboard.h"
static GnomeCanvasItem *item_cursor_parent_class;
......
#ifndef GNUMERIC_ITEM_CURSOR_H
#define GNUMERIC_ITEM_CURSOR_H
#include "sheet.h"
#include "item-grid.h"
#define ITEM_CURSOR(obj) (GTK_CHECK_CAST((obj), item_cursor_get_type (), ItemCursor))
#define ITEM_CURSOR_CLASS(k) (GTK_CHECK_CLASS_CAST ((k), item_cursor_get_type (), ItemCursorClass))
#define IS_ITEM_CURSOR(o) (GTK_CHECK_TYPE((o), item_cursor_get_type ()))
......
#ifndef GNUMERIC_ITEM_EDIT_H
#define GNUMERIC_ITEM_EDIT_H
#include "sheet.h"
#include "style.h"
#include "item-grid.h"
#define ITEM_EDIT(obj) (GTK_CHECK_CAST((obj), item_edit_get_type (), ItemEdit))
#define ITEM_EDIT_CLASS(k) (GTK_CHECK_CLASS_CAST ((k), item_edit_get_type (), ItemEditClass))
#define IS_ITEM_EDIT(o) (GTK_CHECK_TYPE((o), item_edit_get_type ()))
......
......@@ -15,6 +15,7 @@
#include "dialogs.h"
#include "cursors.h"
#include "gnumeric-util.h"
#include "clipboard.h"
static GnomeCanvasItem *item_grid_parent_class;
......
#ifndef GNUMERIC_ITEM_GRID_H
#define GNUMERIC_ITEM_GRID_H
#include "sheet.h"
#include "sheet-view.h"
#define ITEM_GRID(obj) (GTK_CHECK_CAST((obj), item_grid_get_type (), ItemGrid))
#define ITEM_GRID_CLASS(k) (GTK_CHECK_CLASS_CAST ((k), item_grid_get_type (), ItemGridClass))
#define IS_ITEM_GRID(o) (GTK_CHECK_TYPE((o), item_grid_get_type ()))
......
......@@ -13,6 +13,10 @@
#include <gnome.h>
#include "gnumeric.h"
#include "number-match.h"
#include "symbol.h"
#include "expr.h"
#include "sheet.h"
#include "utils.h"
/* Allocation with disposal-on-error */
static void *alloc_buffer (int size);
......
#ifndef GNUMERIC_PLUGIN_H
#define GNUMERIC_PLUGIN_H
/* Forward references for structures. */
typedef struct _PluginData PluginData;
#include "sheet.h"
#include <gmodule.h>
struct PluginData
struct _PluginData
{
GModule *handle;
int (*init_plugin) (struct PluginData *);
int (*can_unload) (struct PluginData *);
void (*cleanup_plugin) (struct PluginData *);
int (*init_plugin) (PluginData *);
int (*can_unload) (PluginData *);
void (*cleanup_plugin) (PluginData *);
gchar *title;
/* filled in by plugin */
void *private;
};
typedef struct PluginData PluginData;
extern GList *plugin_list;
void plugins_init (void);
......
#ifndef GNUMERIC_RENDER_ASCII_H
#define GNUMERIC_RENDER_ASCII_H
#include "cell.h"
char *cell_region_render_ascii (CellRegion *cr);
#endif /* GNUMERIC_RENDER_ASCII_H */
#ifndef GNUMERIC_SHEET_AUTOFILL_H
#define GNUMERIC_SHEET_AUTOFILL_H
#include "sheet.h"
typedef int (*AutofillFunction) (Sheet *sheet,
int base_col, int base_row,
int w, int h,
......
......@@ -14,6 +14,7 @@
#include "gnumeric.h"
#include "gnumeric-sheet.h"
#include "item-cursor.h"
#include "utils.h"
static GtkTableClass *sheet_view_parent_class;
......
#ifndef GNUMERIC_SHEET_VIEW_H
#define GNUMERIC_SHEET_VIEW_H
#include "sheet.h"
#include <gtk/gtktable.h>
#define SHEET_VIEW_TYPE (sheet_view_get_type ())
......
#ifndef GNUMERIC_SHEET_OBJECT_H
#define GNUMERIC_SHEET_OBJECT_H
#include "sheet.h"
#include "sheet-view.h"
#include "sheet-object.h"
/*
* SheetObject
*
......@@ -73,4 +77,3 @@ SheetObject *sheet_object_create_filled (Sheet *sheet, int type,
int w);
#endif /* GNUMERIC_SHEET_OBJECT_H */
......@@ -14,6 +14,7 @@
#include "gnumeric.h"
#include "gnumeric-sheet.h"
#include "item-cursor.h"
#include "utils.h"
static GtkTableClass *sheet_view_parent_class;
......
#ifndef GNUMERIC_SHEET_VIEW_H
#define GNUMERIC_SHEET_VIEW_H
#include "sheet.h"
#include <gtk/gtktable.h>
#define SHEET_VIEW_TYPE (sheet_view_get_type ())
......
......@@ -15,6 +15,7 @@
#include "eval.h"
#include "number-match.h"
#include "format.h"
#include "clipboard.h"
#ifdef ENABLE_BONOBO
# include <libgnorba/gnorba.h>
#endif
......
#ifndef GNUMERIC_SHEET_H
#define GNUMERIC_SHEET_H
typedef struct _Workbook Workbook;
typedef struct _Sheet Sheet;
#ifdef ENABLE_BONOBO
# include <bonobo/gnome-container.h>
#endif
#include "solver.h"
#include "style.h"
#include "expr.h"
#include "str.h"
#include "symbol.h"
#include "cell.h"
#define SHEET_MAX_ROWS (16 * 1024)
#define SHEET_MAX_COLS 256
......@@ -24,7 +32,7 @@ typedef struct {
Style *style;