+++ /dev/null
-SUBDIRS=include
-AM_CPPFLAGS = @NAVIT_CFLAGS@ -I$(srcdir)/include
-noinst_LTLIBRARIES = libmdb.la
-libmdb_la_SOURCES=backend.c catalog.c data.c dump.c file.c iconv.c index.c kkd.c like.c map.c mem.c money.c options.c props.c sargs.c stats.c table.c worktable.c write.c
+++ /dev/null
-/* MDB Tools - A library for reading MS Access database files
- * Copyright (C) 2000 Brian Bruns
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library 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
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-/*
-** functions to deal with different backend database engines
-*/
-
-#include "mdbtools.h"
-
-#ifdef DMALLOC
-#include "dmalloc.h"
-#endif
-
-static int is_init;
-static GHashTable *mdb_backends;
-
- /* Access data types */
-static MdbBackendType mdb_access_types[] = {
- {"Unknown 0x00", 0,0,0 },
- {"Boolean", 0,0,0},
- {"Byte", 0,0,0},
- {"Integer", 0,0,0},
- {"Long Integer", 0,0,0},
- {"Currency", 0,0,0},
- {"Single", 0,0,0},
- {"Double", 0,0,0},
- {"DateTime (Short)", 0,0,1},
- {"Unknown 0x09", 0,0,0},
- {"Text", 1,0,1},
- {"OLE", 1,0,1},
- {"Memo/Hyperlink",1,0,1},
- {"Unknown 0x0d",0,0,0},
- {"Unknown 0x0e",0,0,0},
- {"Replication ID",0,0,0},
- {"Numeric",1,1,0}
-};
-
-/* Oracle data types */
-static MdbBackendType mdb_oracle_types[] = {
- {"Oracle_Unknown 0x00",0,0,0},
- {"NUMBER",1,0,0},
- {"NUMBER",1,0,0},
- {"NUMBER",1,0,0},
- {"NUMBER",1,0,0},
- {"NUMBER",1,0,0},
- {"FLOAT",0,0,0},
- {"FLOAT",0,0,0},
- {"DATE",0,0,0},
- {"Oracle_Unknown 0x09",0,0,0},
- {"VARCHAR2",1,0,1},
- {"BLOB",1,0,1},
- {"CLOB",1,0,1},
- {"Oracle_Unknown 0x0d",0,0,0},
- {"Oracle_Unknown 0x0e",0,0,0},
- {"NUMBER",1,0,0},
- {"NUMBER",1,0,0},
-};
-
-/* Sybase/MSSQL data types */
-static MdbBackendType mdb_sybase_types[] = {
- {"Sybase_Unknown 0x00",0,0,0},
- {"bit",0,0,0},
- {"char",1,0,1},
- {"smallint",0,0,0},
- {"int",0,0,0},
- {"money",0,0,0},
- {"real",0,0,0},
- {"float",0,0,0},
- {"smalldatetime",0,0,0},
- {"Sybase_Unknown 0x09",0,0,0},
- {"varchar",1,0,1},
- {"varbinary",1,0,1},
- {"text",1,0,1},
- {"Sybase_Unknown 0x0d",0,0,0},
- {"Sybase_Unknown 0x0e",0,0,0},
- {"Sybase_Replication ID",0,0,0},
- {"numeric",1,1,0},
-};
-
-/* Postgres data types */
-static MdbBackendType mdb_postgres_types[] = {
- {"Postgres_Unknown 0x00",0,0,0},
- {"Bool",0,0,0},
- {"Int2",0,0,0},
- {"Int4",0,0,0},
- {"Int8",0,0,0},
- {"Money",0,0,0},
- {"Float4",0,0,0},
- {"Float8",0,0,0},
- {"Timestamp",0,0,0},
- {"Postgres_Unknown 0x09",0,0,0},
- {"Char",1,0,1},
- {"Postgres_Unknown 0x0b",0,0,0},
- {"Postgres_Unknown 0x0c",0,0,0},
- {"Postgres_Unknown 0x0d",0,0,0},
- {"Postgres_Unknown 0x0e",0,0,0},
- {"Serial",0,0,0},
- {"Postgres_Unknown 0x10",0,0,0},
-};
-/* MySQL data types */
-static MdbBackendType mdb_mysql_types[] = {
- {"Text",1,0,1},
- {"char",0,0,0},
- {"int",0,0,0},
- {"int",0,0,0},
- {"int",0,0,0},
- {"float",0,0,0},
- {"float",0,0,0},
- {"float",0,0,0},
- {"date",0,0,1},
- {"varchar",1,0,1},
- {"varchar",1,0,1},
- {"varchar",1,0,1},
- {"text",1,0,1},
- {"blob",0,0,0},
- {"text",1,0,1},
- {"numeric",1,1,0},
- {"numeric",1,1,0},
-};
-
-static gboolean mdb_drop_backend(gpointer key, gpointer value, gpointer data);
-
-char *mdb_get_coltype_string(MdbBackend *backend, int col_type)
-{
- static char buf[16];
-
- if (col_type > 0x10 ) {
- // return NULL;
- snprintf(buf,sizeof(buf), "type %04x", col_type);
- return buf;
- } else {
- return backend->types_table[col_type].name;
- }
-}
-
-int mdb_coltype_takes_length(MdbBackend *backend, int col_type)
-{
- return backend->types_table[col_type].needs_length;
-}
-
-/**
- * mdb_init_backends
- *
- * Initializes the mdb_backends hash and loads the builtin backends.
- * Use mdb_remove_backends() to destroy this hash when done.
- */
-void mdb_init_backends(void)
-{
- mdb_backends = g_hash_table_new(g_str_hash, g_str_equal);
-
- mdb_register_backend(mdb_access_types, "access");
- mdb_register_backend(mdb_sybase_types, "sybase");
- mdb_register_backend(mdb_oracle_types, "oracle");
- mdb_register_backend(mdb_postgres_types, "postgres");
- mdb_register_backend(mdb_mysql_types, "mysql");
-}
-void mdb_register_backend(MdbBackendType *backend_type, char *backend_name)
-{
- MdbBackend *backend = (MdbBackend *) g_malloc0(sizeof(MdbBackend));
- backend->types_table = backend_type;
- g_hash_table_insert(mdb_backends, backend_name, backend);
-}
-
-/**
- * mdb_remove_backends
- *
- * Removes all entries from and destroys the mdb_backends hash.
- */
-void mdb_remove_backends(void)
-{
- g_hash_table_foreach_remove(mdb_backends, mdb_drop_backend, NULL);
- g_hash_table_destroy(mdb_backends);
-}
-static gboolean mdb_drop_backend(gpointer key, gpointer value, gpointer data)
-{
- MdbBackend *backend = (MdbBackend *)value;
- g_free (backend);
- return TRUE;
-}
-
-/**
- * mdb_set_default_backend
- * @mdb: Handle to open MDB database file
- * @backend_name: Name of the backend to set as default
- *
- * Sets the default backend of the handle @mdb to @backend_name.
- *
- * Returns: 1 if successful, 0 if unsuccessful.
- */
-int mdb_set_default_backend(MdbHandle *mdb, char *backend_name)
-{
- MdbBackend *backend;
-
- backend = (MdbBackend *) g_hash_table_lookup(mdb_backends, backend_name);
- if (backend) {
- mdb->default_backend = backend;
- mdb->backend_name = (char *) g_strdup(backend_name);
- is_init = 0;
- return 1;
- } else {
- return 0;
- }
-}
-
-/**
- * mdb_get_relationships
- * @mdb: Handle to open MDB database file
- *
- * Generates relationships by reading the MSysRelationships table.
- * 'szColumn' contains the column name of the child table.
- * 'szObject' contains the table name of the child table.
- * 'szReferencedColumn' contains the column name of the parent table.
- * 'szReferencedObject' contains the table name of the parent table.
- *
- * Returns: a string stating that relationships are not supported for the
- * selected backend, or a string containing SQL commands for setting up
- * the relationship, tailored for the selected backend. The caller is
- * responsible for freeing this string.
- */
-char *mdb_get_relationships(MdbHandle *mdb)
-{
- unsigned int i;
- gchar *text = NULL; /* String to be returned */
- static char *bound[4]; /* Bound values */
- static MdbTableDef *table; /* Relationships table */
- int backend = 0; /* Backends: 1=oracle */
-
- if (strncmp(mdb->backend_name,"oracle",6) == 0) {
- backend = 1;
- } else {
- if (is_init == 0) { /* the first time through */
- is_init = 1;
- return (char *) g_strconcat(
- "-- relationships are not supported for ",
- mdb->backend_name, NULL);
- } else { /* the second time through */
- is_init = 0;
- return NULL;
- }
- }
-
- if (is_init == 0) {
- table = mdb_read_table_by_name(mdb, "MSysRelationships", MDB_TABLE);
- if ((!table) || (table->num_rows == 0)) {
- return NULL;
- }
-
- mdb_read_columns(table);
- for (i=0;i<4;i++) {
- bound[i] = (char *) g_malloc0(MDB_BIND_SIZE);
- }
- mdb_bind_column_by_name(table, "szColumn", bound[0]);
- mdb_bind_column_by_name(table, "szObject", bound[1]);
- mdb_bind_column_by_name(table, "szReferencedColumn", bound[2]);
- mdb_bind_column_by_name(table, "szReferencedObject", bound[3]);
- mdb_rewind_table(table);
-
- is_init = 1;
- }
- else if (table->cur_row >= table->num_rows) { /* past the last row */
- for (i=0;i<4;i++)
- g_free(bound[i]);
- is_init = 0;
- return NULL;
- }
-
- if (!mdb_fetch_row(table)) {
- for (i=0;i<4;i++)
- g_free(bound[i]);
- is_init = 0;
- return NULL;
- }
-
- switch (backend) {
- case 1: /* oracle */
- text = g_strconcat("alter table ", bound[1],
- " add constraint ", bound[3], "_", bound[1],
- " foreign key (", bound[0], ")"
- " references ", bound[3], "(", bound[2], ")", NULL);
- break;
- }
-
- return (char *)text;
-}
-
+++ /dev/null
-/* MDB Tools - A library for reading MS Access database file
- * Copyright (C) 2000 Brian Bruns
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library 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
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#include "mdbtools.h"
-
-#ifdef DMALLOC
-#include "dmalloc.h"
-#endif
-
-char *
-mdb_get_objtype_string(int obj_type)
-{
-static char *type_name[] = {"Form",
- "Table",
- "Macro",
- "System Table",
- "Report",
- "Query",
- "Linked Table",
- "Module",
- "Relationship",
- "Unknown 0x09",
- "Unknown 0x0a",
- "Database"
- };
-
- if (obj_type > 11) {
- return NULL;
- } else {
- return type_name[obj_type];
- }
-}
-
-void mdb_free_catalog(MdbHandle *mdb)
-{
- unsigned int i;
-
- if (!mdb->catalog) return;
- for (i=0; i<mdb->catalog->len; i++)
- g_free (g_ptr_array_index(mdb->catalog, i));
- g_ptr_array_free(mdb->catalog, TRUE);
- mdb->catalog = NULL;
-}
-
-GPtrArray *mdb_read_catalog (MdbHandle *mdb, int objtype)
-{
- MdbCatalogEntry *entry, msysobj;
- MdbTableDef *table;
- char obj_id[256];
- char obj_name[256];
- char obj_type[256];
- char obj_flags[256];
- int type;
-
- if (mdb->catalog) mdb_free_catalog(mdb);
- mdb->catalog = g_ptr_array_new();
- mdb->num_catalog = 0;
-
- /* dummy up a catalog entry so we may read the table def */
- memset(&msysobj, 0, sizeof(MdbCatalogEntry));
- msysobj.mdb = mdb;
- msysobj.object_type = MDB_TABLE;
- msysobj.table_pg = 2;
- strcpy(msysobj.object_name, "MSysObjects");
-
- /* mdb_table_dump(&msysobj); */
-
- table = mdb_read_table(&msysobj);
- if (!table) return NULL;
-
- mdb_read_columns(table);
-
- mdb_bind_column_by_name(table, "Id", obj_id);
- mdb_bind_column_by_name(table, "Name", obj_name);
- mdb_bind_column_by_name(table, "Type", obj_type);
- mdb_bind_column_by_name(table, "Flags", obj_flags);
-
- mdb_rewind_table(table);
-
- while (mdb_fetch_row(table)) {
- type = atoi(obj_type);
- if (objtype==MDB_ANY || type == objtype) {
- // fprintf(stdout, "obj_id: %10ld objtype: %-3d obj_name: %s\n",
- // (atol(obj_id) & 0x00FFFFFF), type, obj_name);
- entry = (MdbCatalogEntry *) g_malloc0(sizeof(MdbCatalogEntry));
- entry->mdb = mdb;
- strcpy(entry->object_name, obj_name);
- entry->object_type = (type & 0x7F);
- entry->table_pg = atol(obj_id) & 0x00FFFFFF;
- entry->flags = atol(obj_flags);
- mdb->num_catalog++;
- g_ptr_array_add(mdb->catalog, entry);
- }
- }
- //mdb_dump_catalog(mdb, MDB_TABLE);
-
- mdb_free_tabledef(table);
-
- return mdb->catalog;
-}
-
-void
-mdb_dump_catalog(MdbHandle *mdb, int obj_type)
-{
- unsigned int i;
- MdbCatalogEntry *entry;
-
- mdb_read_catalog(mdb, obj_type);
- for (i=0;i<mdb->num_catalog;i++) {
- entry = g_ptr_array_index(mdb->catalog,i);
- if (obj_type==MDB_ANY || entry->object_type==obj_type) {
- fprintf(stdout,"Type: %-10s Name: %-18s T pg: %04x KKD pg: %04x row: %2d\n",
- mdb_get_objtype_string(entry->object_type),
- entry->object_name,
- (unsigned int) entry->table_pg,
- (unsigned int) entry->kkd_pg,
- entry->kkd_rowid);
- }
- }
- return;
-}
-
+++ /dev/null
-/* MDB Tools - A library for reading MS Access database file
- * Copyright (C) 2000 Brian Bruns
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library 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
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#include "mdbtools.h"
-#include "time.h"
-#include "math.h"
-
-#ifdef DMALLOC
-#include "dmalloc.h"
-#endif
-
-#define OFFSET_MASK 0x1fff
-
-char *mdb_money_to_string(MdbHandle *mdb, int start, char *s);
-static int _mdb_attempt_bind(MdbHandle *mdb,
- MdbColumn *col, unsigned char isnull, int offset, int len);
-static char *mdb_num_to_string(MdbHandle *mdb, int start, int datatype, int prec, int scale);
-int mdb_copy_ole(MdbHandle *mdb, char *dest, int start, int size);
-
-static char date_fmt[64] = "%x %X";
-
-void mdb_set_date_fmt(const char *fmt)
-{
- date_fmt[63] = 0;
- strncpy(date_fmt, fmt, 63);
-}
-
-void mdb_bind_column(MdbTableDef *table, int col_num, void *bind_ptr)
-{
-MdbColumn *col;
-
- /*
- ** the column arrary is 0 based, so decrement to get 1 based parameter
- */
- col=g_ptr_array_index(table->columns, col_num - 1);
- col->bind_ptr = bind_ptr;
-}
-int
-mdb_bind_column_by_name(MdbTableDef *table, gchar *col_name, void *bind_ptr)
-{
- unsigned int i;
- int col_num = -1;
- MdbColumn *col;
-
- for (i=0;i<table->num_cols;i++) {
- col=g_ptr_array_index(table->columns,i);
- if (!strcmp(col->name,col_name)) {
- col_num = col->col_num + 1;
- mdb_bind_column(table, col_num, bind_ptr);
- break;
- }
- }
-
- return col_num;
-}
-void mdb_bind_len(MdbTableDef *table, int col_num, int *len_ptr)
-{
-MdbColumn *col;
-
- col=g_ptr_array_index(table->columns, col_num - 1);
- col->len_ptr = len_ptr;
-}
-
-/**
- * mdb_find_pg_row
- * @mdb: Database file handle
- * @pg_row: Lower byte contains the row number, the upper three contain page
- * @buf: Pointer for returning a pointer to the page
- * @off: Pointer for returning an offset to the row
- * @len: Pointer for returning the length of the row
- *
- * Returns: 0 on success. 1 on failure.
- */
-int mdb_find_pg_row(MdbHandle *mdb, int pg_row, char **buf, int *off, int *len)
-{
- unsigned int pg = pg_row >> 8;
- unsigned int row = pg_row & 0xff;
-
- if (mdb_read_alt_pg(mdb, pg) != mdb->fmt->pg_size)
- return 1;
- mdb_swap_pgbuf(mdb);
- *off = mdb_pg_get_int16(mdb, mdb->fmt->row_count_offset + 2 + (row*2));
- *len = mdb_find_end_of_row(mdb, row) - *off + 1;
- mdb_swap_pgbuf(mdb);
- *buf = mdb->alt_pg_buf;
- return 0;
-}
-
-int
-mdb_find_end_of_row(MdbHandle *mdb, int row)
-{
- MdbFormatConstants *fmt = mdb->fmt;
- int row_end;
-
- /* Search the previous "row start" values for the first non-'lookupflag' one.
- * If we don't find one, then the end of the page is the correct value.
- */
-#if 1
- if (row==0) {
- row_end = fmt->pg_size - 1;
- } else {
- row_end = (mdb_pg_get_int16(mdb, ((fmt->row_count_offset + 2) + (row - 1) * 2)) & OFFSET_MASK) - 1;
- }
- return row_end;
-#else
- int i, row_start;
-
- /* if lookupflag is not set, it's good (deleteflag is ok) */
- for (i = row - 1; i >= 0; i--) {
- row_start = mdb_pg_get_int16(mdb, ((fmt->row_count_offset + 2) + i * 2));
- if (!(row_start & 0x8000)) {
- break;
- }
- }
-
- if (i == -1) {
- row_end = fmt->pg_size - 1;
- } else {
- row_end = (row_start & OFFSET_MASK) - 1;
- }
- return row_end;
-#endif
-}
-int mdb_is_null(unsigned char *null_mask, int col_num)
-{
-int byte_num = (col_num - 1) / 8;
-int bit_num = (col_num - 1) % 8;
-
- if ((1 << bit_num) & null_mask[byte_num]) {
- return 0;
- } else {
- return 1;
- }
-}
-/* bool has to be handled specially because it uses the null bit to store its
-** value*/
-static int
-mdb_xfer_bound_bool(MdbHandle *mdb, MdbColumn *col, int value)
-{
-
- col->cur_value_len = value;
- if (col->bind_ptr) {
- strcpy(col->bind_ptr, value ? "0" : "1");
- }
-
- return 0;
-}
-static int mdb_xfer_bound_ole(MdbHandle *mdb, int start, MdbColumn *col, int len)
-{
- int ret = 0;
- if (len) {
- col->cur_value_start = start;
- col->cur_value_len = len;
- } else {
- col->cur_value_start = 0;
- col->cur_value_len = 0;
- }
- if (col->bind_ptr || col->len_ptr) {
- //ret = mdb_copy_ole(mdb, col->bind_ptr, start, len);
- memcpy(col->bind_ptr, &mdb->pg_buf[start], MDB_MEMO_OVERHEAD);
- }
- if (col->len_ptr) {
- *col->len_ptr = MDB_MEMO_OVERHEAD;
- }
- return ret;
-}
-static int mdb_xfer_bound_data(MdbHandle *mdb, int start, MdbColumn *col, int len)
-{
-int ret;
- //if (!strcmp("Name",col->name)) {
- //printf("start %d %d\n",start, len);
- //}
- if (len) {
- col->cur_value_start = start;
- col->cur_value_len = len;
- } else {
- col->cur_value_start = 0;
- col->cur_value_len = 0;
- }
- if (col->bind_ptr) {
- if (!len) {
- strcpy(col->bind_ptr, "");
- } else if (col->col_type == MDB_NUMERIC) {
- //fprintf(stdout,"len %d size %d\n",len, col->col_size);
- char *str = mdb_num_to_string(mdb, start, col->col_type,
- col->col_prec, col->col_scale);
- strcpy(col->bind_ptr, str);
- g_free(str);
- } else {
- //fprintf(stdout,"len %d size %d\n",len, col->col_size);
- char *str = mdb_col_to_string(mdb, mdb->pg_buf, start,
- col->col_type, len);
- strcpy(col->bind_ptr, str);
-
- }
- ret = strlen(col->bind_ptr);
- if (col->len_ptr) {
- *col->len_ptr = ret;
- }
- return ret;
- }
- return 0;
-}
-int mdb_read_row(MdbTableDef *table, unsigned int row)
-{
- MdbHandle *mdb = table->entry->mdb;
- MdbFormatConstants *fmt = mdb->fmt;
- MdbColumn *col;
- unsigned int i;
- int rc;
- int row_start, row_end;
- int delflag, lookupflag;
- MdbField fields[256];
- int num_fields;
-
- if (table->num_rows <= row)
- return 0;
-
- row_start = mdb_pg_get_int16(mdb, (fmt->row_count_offset + 2) + (row*2));
- row_end = mdb_find_end_of_row(mdb, row);
-
- delflag = lookupflag = 0;
- if (row_start & 0x8000) lookupflag++;
- if (row_start & 0x4000) delflag++;
- row_start &= OFFSET_MASK; /* remove flags */
-#if MDB_DEBUG
- fprintf(stdout,"Row %d bytes %d to %d %s %s\n",
- row, row_start, row_end,
- lookupflag ? "[lookup]" : "",
- delflag ? "[delflag]" : "");
-#endif
-
- if (!table->noskip_del && delflag) {
- row_end = row_start-1;
- return 0;
- }
-
- num_fields = mdb_crack_row(table, row_start, row_end, fields);
- if (!mdb_test_sargs(table, fields, num_fields)) return 0;
-
-#if MDB_DEBUG
- fprintf(stdout,"sarg test passed row %d \n", row);
-#endif
-
-#if MDB_DEBUG
- buffer_dump(mdb->pg_buf, row_start, row_end);
-#endif
-
- /* take advantage of mdb_crack_row() to clean up binding */
- /* use num_cols instead of num_fields -- bsb 03/04/02 */
- for (i = 0; i < table->num_cols; i++) {
- col = g_ptr_array_index(table->columns,fields[i].colnum);
- rc = _mdb_attempt_bind(mdb, col, fields[i].is_null,
- fields[i].start, fields[i].siz);
- }
-
- return 1;
-}
-static int _mdb_attempt_bind(MdbHandle *mdb,
- MdbColumn *col,
- unsigned char isnull,
- int offset,
- int len)
-{
- if (col->col_type == MDB_BOOL) {
- mdb_xfer_bound_bool(mdb, col, isnull);
- } else if (isnull) {
- mdb_xfer_bound_data(mdb, 0, col, 0);
- } else if (col->col_type == MDB_OLE) {
- mdb_xfer_bound_ole(mdb, offset, col, len);
- } else {
- //if (!mdb_test_sargs(mdb, col, offset, len)) {
- //return 0;
- //}
- mdb_xfer_bound_data(mdb, offset, col, len);
- }
- return 1;
-}
-int mdb_read_next_dpg(MdbTableDef *table)
-{
- MdbCatalogEntry *entry = table->entry;
- MdbHandle *mdb = entry->mdb;
- int next_pg;
-
-#ifndef SLOW_READ
- next_pg = mdb_map_find_next(mdb, table->usage_map,
- table->map_sz, table->cur_phys_pg);
-
- if (next_pg >= 0) {
- if (mdb_read_pg(mdb, next_pg)) {
- table->cur_phys_pg = next_pg;
- return table->cur_phys_pg;
- } else {
- return 0;
- }
- }
- fprintf(stderr, "Warning: defaulting to brute force read\n");
-#endif
- /* can't do a fast read, go back to the old way */
- do {
- if (!mdb_read_pg(mdb, table->cur_phys_pg++))
- return 0;
- } while (mdb->pg_buf[0]!=0x01 || mdb_pg_get_int32(mdb, 4)!=entry->table_pg);
- /* fprintf(stderr,"returning new page %ld\n", table->cur_phys_pg); */
- return table->cur_phys_pg;
-}
-int mdb_rewind_table(MdbTableDef *table)
-{
- table->cur_pg_num=0;
- table->cur_phys_pg=0;
- table->cur_row=0;
-
- return 0;
-}
-int
-mdb_fetch_row(MdbTableDef *table)
-{
- MdbHandle *mdb = table->entry->mdb;
- MdbFormatConstants *fmt = mdb->fmt;
- unsigned int rows;
- int rc;
- guint32 pg;
-
- if (table->num_rows==0)
- return 0;
-
- /* initialize */
- if (!table->cur_pg_num) {
- table->cur_pg_num=1;
- table->cur_row=0;
- if ((!table->is_temp_table)&&(table->strategy!=MDB_INDEX_SCAN))
- if (!mdb_read_next_dpg(table)) return 0;
- }
-
- do {
- if (table->is_temp_table) {
- GPtrArray *pages = table->temp_table_pages;
- rows = mdb_get_int16(
- g_ptr_array_index(pages, table->cur_pg_num-1),
- fmt->row_count_offset);
- if (table->cur_row >= rows) {
- table->cur_row = 0;
- table->cur_pg_num++;
- if (table->cur_pg_num > pages->len)
- return 0;
- }
- memcpy(mdb->pg_buf,
- g_ptr_array_index(pages, table->cur_pg_num-1),
- fmt->pg_size);
- } else if (table->strategy==MDB_INDEX_SCAN) {
-
- if (!mdb_index_find_next(table->mdbidx, table->scan_idx, table->chain, &pg, (guint16 *) &(table->cur_row))) {
- mdb_index_scan_free(table);
- return 0;
- }
- mdb_read_pg(mdb, pg);
- } else {
- rows = mdb_pg_get_int16(mdb,fmt->row_count_offset);
-
- /* if at end of page, find a new page */
- if (table->cur_row >= rows) {
- table->cur_row=0;
-
- if (!mdb_read_next_dpg(table)) {
- return 0;
- }
- }
- }
-
- /* printf("page %d row %d\n",table->cur_phys_pg, table->cur_row); */
- rc = mdb_read_row(table, table->cur_row);
- table->cur_row++;
- } while (!rc);
-
- return 1;
-}
-void mdb_data_dump(MdbTableDef *table)
-{
- unsigned int i;
- char *bound_values[MDB_MAX_COLS];
-
- for (i=0;i<table->num_cols;i++) {
- bound_values[i] = (char *) g_malloc(256);
- mdb_bind_column(table, i+1, bound_values[i]);
- }
- mdb_rewind_table(table);
- while (mdb_fetch_row(table)) {
- for (i=0;i<table->num_cols;i++) {
- fprintf(stdout, "column %d is %s\n", i+1, bound_values[i]);
- }
- }
- for (i=0;i<table->num_cols;i++) {
- g_free(bound_values[i]);
- }
-}
-
-int mdb_is_fixed_col(MdbColumn *col)
-{
- return col->is_fixed;
-}
-#if 0
-static char *mdb_data_to_hex(MdbHandle *mdb, char *text, int start, int size)
-{
-int i;
-
- for (i=start; i<start+size; i++) {
- sprintf(&text[(i-start)*2],"%02x", mdb->pg_buf[i]);
- }
- text[(i-start)*2]='\0';
-
- return text;
-}
-#endif
-int
-mdb_ole_read_next(MdbHandle *mdb, MdbColumn *col, void *ole_ptr)
-{
- guint16 ole_len;
- guint16 ole_flags;
- char *buf;
- int pg_row, row_start;
- int len;
-
- ole_len = mdb_get_int16(ole_ptr, 0);
- ole_flags = mdb_get_int16(ole_ptr, 2);
-
- if (ole_flags == 0x8000) {
- /* inline fields don't have a next */
- return 0;
- } else if (ole_flags == 0x4000) {
- /* 0x4000 flagged ole's are contained on one page and thus
- * should be handled entirely with mdb_ole_read() */
- return 0;
- } else if (ole_flags == 0x0000) {
- pg_row = (col->cur_blob_pg << 8) & col->cur_blob_row;
- if (mdb_find_pg_row(mdb, pg_row, &buf, &row_start, &len)) {
- return 0;
- }
- if (col->bind_ptr)
- memcpy(col->bind_ptr, buf + row_start, len);
- pg_row = mdb_get_int32(buf, row_start);
- col->cur_blob_pg = pg_row >> 8;
- col->cur_blob_row = pg_row & 0xff;
-
- return len;
- }
- return 0;
-}
-int
-mdb_ole_read(MdbHandle *mdb, MdbColumn *col, void *ole_ptr, int chunk_size)
-{
- guint16 ole_len;
- guint16 ole_flags;
- char *buf;
- int pg_row, row_start;
- int len;
-
- ole_len = mdb_get_int16(ole_ptr, 0);
- ole_flags = mdb_get_int16(ole_ptr, 2);
- mdb_debug(MDB_DEBUG_OLE,"ole len = %d ole flags = %08x",
- ole_len, ole_flags);
-
- col->chunk_size = chunk_size;
-
- if (ole_flags == 0x8000) {
- /* inline ole field, if we can satisfy it, then do it */
- len = col->cur_value_len - MDB_MEMO_OVERHEAD;
- if (chunk_size >= len) {
- if (col->bind_ptr)
- memcpy(col->bind_ptr,
- &mdb->pg_buf[col->cur_value_start +
- MDB_MEMO_OVERHEAD],
- len);
- return len;
- } else {
- return 0;
- }
- } else if (ole_flags == 0x4000) {
- pg_row = mdb_get_int32(ole_ptr, 4);
- col->cur_blob_pg = pg_row >> 8;
- col->cur_blob_row = pg_row & 0xff;
- mdb_debug(MDB_DEBUG_OLE,"ole row = %d ole pg = %ld",
- col->cur_blob_row, col->cur_blob_pg);
-
- if (mdb_find_pg_row(mdb, pg_row, &buf, &row_start, &len)) {
- return 0;
- }
- mdb_debug(MDB_DEBUG_OLE,"start %d len %d", row_start, len);
-
- if (col->bind_ptr) {
- memcpy(col->bind_ptr, buf + row_start, len);
- if (mdb_get_option(MDB_DEBUG_OLE))
- buffer_dump(col->bind_ptr, 0, 16);
- }
- return len;
- } else if (ole_flags == 0x0000) {
- pg_row = mdb_get_int32(ole_ptr, 4);
- col->cur_blob_pg = pg_row >> 8;
- col->cur_blob_row = pg_row & 0xff;
-
- if (mdb_find_pg_row(mdb, pg_row, &buf, &row_start, &len)) {
- return 0;
- }
-
- if (col->bind_ptr)
- memcpy(col->bind_ptr, buf + row_start, len);
-
- pg_row = mdb_get_int32(buf, row_start);
- col->cur_blob_pg = pg_row >> 8;
- col->cur_blob_row = pg_row & 0xff;
-
- return len;
- } else {
- fprintf(stderr,"Unhandled ole field flags = %04x\n", ole_flags);
- return 0;
- }
-}
-int mdb_copy_ole(MdbHandle *mdb, char *dest, int start, int size)
-{
- guint16 ole_len;
- guint16 ole_flags;
- guint32 row_start, pg_row;
- guint32 len;
- char *buf;
-
- if (size<MDB_MEMO_OVERHEAD) {
- return 0;
- }
-
- /* The 16 bit integer at offset 0 is the length of the memo field.
- * The 32 bit integer at offset 4 contains page and row information.
- */
- ole_len = mdb_pg_get_int16(mdb, start);
- ole_flags = mdb_pg_get_int16(mdb, start+2);
-
- if (ole_flags == 0x8000) {
- len = size - MDB_MEMO_OVERHEAD;
- /* inline ole field */
- if (dest) memcpy(dest, &mdb->pg_buf[start + MDB_MEMO_OVERHEAD],
- size - MDB_MEMO_OVERHEAD);
- return len;
- } else if (ole_flags == 0x4000) {
- pg_row = mdb_get_int32(mdb->pg_buf, start+4);
- mdb_debug(MDB_DEBUG_OLE,"Reading LVAL page %06x", pg_row >> 8);
-
- if (mdb_find_pg_row(mdb, pg_row, &buf, &row_start, &len)) {
- return 0;
- }
- mdb_debug(MDB_DEBUG_OLE,"row num %d start %d len %d",
- pg_row & 0xff, row_start, len);
-
- if (dest)
- memcpy(dest, buf + row_start, len);
- return len;
- } else if (ole_flags == 0x0000) {
- int cur = 0;
- pg_row = mdb_get_int32(mdb->pg_buf, start+4);
- mdb_debug(MDB_DEBUG_OLE,"Reading LVAL page %06x", pg_row >> 8);
- do {
- if (mdb_find_pg_row(mdb,pg_row,&buf,&row_start,&len)) {
- return 0;
- }
-
- mdb_debug(MDB_DEBUG_OLE,"row num %d start %d len %d",
- pg_row & 0xff, row_start, len);
-
- if (dest)
- memcpy(dest+cur, buf + row_start + 4, len - 4);
- cur += len - 4;
-
- /* find next lval page */
- pg_row = mdb_get_int32(buf, row_start);
- } while ((pg_row >> 8));
- return cur;
- } else {
- fprintf(stderr,"Unhandled ole field flags = %04x\n", ole_flags);
- return 0;
- }
-}
-static char *mdb_memo_to_string(MdbHandle *mdb, int start, int size)
-{
- guint16 memo_len;
- static char text[MDB_BIND_SIZE];
- guint16 memo_flags;
- guint32 row_start, pg_row;
- guint32 len;
- char *buf;
-
- if (size<MDB_MEMO_OVERHEAD) {
- return "";
- }
-
-#if MDB_DEBUG
- buffer_dump(mdb->pg_buf, start, start + 12);
-#endif
-
- /* The 16 bit integer at offset 0 is the length of the memo field.
- * The 32 bit integer at offset 4 contains page and row information.
- */
- memo_len = mdb_pg_get_int16(mdb, start);
- memo_flags = mdb_pg_get_int16(mdb, start+2);
-
- if (memo_flags & 0x8000) {
- /* inline memo field */
- strncpy(text, &mdb->pg_buf[start + MDB_MEMO_OVERHEAD],
- size - MDB_MEMO_OVERHEAD);
- text[size - MDB_MEMO_OVERHEAD]='\0';
- return text;
- } else if (memo_flags & 0x4000) {
- pg_row = mdb_get_int32(mdb->pg_buf, start+4);
-#if MDB_DEBUG
- printf("Reading LVAL page %06x\n", pg_row >> 8);
-#endif
- if (mdb_find_pg_row(mdb, pg_row, &buf, &row_start, &len)) {
- return "";
- }
-#if MDB_DEBUG
- printf("row num %d start %d len %d\n",
- pg_row & 0xff, row_start, len);
- buffer_dump(mdb->pg_buf, row_start, row_start + len);
-#endif
- if (IS_JET3(mdb)) {
- strncpy(text, buf + row_start, len);
- text[len]='\0';
- } else {
- mdb_unicode2ascii(mdb, buf, row_start, len, text);
- }
- return text;
- } else { /* if (memo_flags == 0x0000) { */
- pg_row = mdb_get_int32(mdb->pg_buf, start+4);
-#if MDB_DEBUG
- printf("Reading LVAL page %06x\n", pg_row >> 8);
-#endif
- text[0]='\0';
- do {
- if (mdb_find_pg_row(mdb,pg_row,&buf,&row_start,&len)) {
- return "";
- }
-#if MDB_DEBUG
- printf("row num %d start %d len %d\n",
- pg_row & 0xff, row_start, len);
-#endif
- strncat(text, buf + row_start + 4,
- strlen(text) + len - 4 > MDB_BIND_SIZE ?
- MDB_BIND_SIZE - strlen(text) : len - 4);
-
- /* find next lval page */
- pg_row = mdb_get_int32(mdb->pg_buf, row_start);
- } while ((pg_row >> 8));
- return text;
-/*
- } else {
- fprintf(stderr,"Unhandled memo field flags = %04x\n", memo_flags);
- return "";
-*/
- }
-}
-static char *
-mdb_num_to_string(MdbHandle *mdb, int start, int datatype, int prec, int scale)
-{
- char *text;
- gint32 l;
-
- memcpy(&l, mdb->pg_buf+start+13, 4);
-
- text = (char *) g_malloc(prec+2);
- sprintf(text, "%0*" G_GINT32_FORMAT, prec, GINT32_FROM_LE(l));
- if (scale) {
- memmove(text+prec-scale, text+prec-scale+1, scale+1);
- text[prec-scale] = '.';
- }
- return text;
-}
-
-static int trim_trailing_zeros(char * buff, int n)
-{
- char * p = buff + n - 1;
-
- while (p >= buff && *p == '0')
- *p-- = '\0';
-
- if (*p == '.')
- *p = '\0';
-
- return 0;
-}
-
-char *mdb_col_to_string(MdbHandle *mdb, unsigned char *buf, int start, int datatype, int size)
-{
- /* FIX ME -- not thread safe */
- static char text[MDB_BIND_SIZE];
- time_t t;
- int n;
- float tf;
- double td;
-
- switch (datatype) {
- case MDB_BOOL:
- /* shouldn't happen. bools are handled specially
- ** by mdb_xfer_bound_bool() */
- break;
- case MDB_BYTE:
- sprintf(text,"%d",mdb_get_byte(buf, start));
- return text;
- break;
- case MDB_INT:
- sprintf(text,"%ld",(long)mdb_get_int16(buf, start));
- return text;
- break;
- case MDB_LONGINT:
- sprintf(text,"%ld",mdb_get_int32(buf, start));
- return text;
- break;
- case MDB_FLOAT:
- tf = mdb_get_single(mdb->pg_buf, start);
- n = sprintf(text,"%.*f",FLT_DIG - (int)ceil(log10(tf)), tf);
- trim_trailing_zeros(text, n);
- return text;
- break;
- case MDB_DOUBLE:
- td = mdb_get_double(mdb->pg_buf, start);
- n = sprintf(text,"%.*f",DBL_DIG - (int)ceil(log10(td)), td);
- trim_trailing_zeros(text, n);
- return text;
- break;
- case MDB_TEXT:
- if (size<0) {
- return "";
- }
- if (IS_JET4(mdb)) {
-/*
- int i;
- for (i=0;i<size;i++) {
- fprintf(stdout, "%c %02x ", mdb->pg_buf[start+i], mdb->pg_buf[start+i]);
- }
- fprintf(stdout, "\n");
-*/
- mdb_unicode2ascii(mdb, mdb->pg_buf, start, size, text);
- } else {
- strncpy(text, &buf[start], size);
- text[size]='\0';
- }
- return text;
- break;
- case MDB_SDATETIME:
- td = mdb_get_double(mdb->pg_buf, start);
- if (td > 1) {
- t = (long int)((td - 25569.0) * 86400.0);
- } else {
- t = (long int)(td * 86400.0);
- }
- strftime(text, MDB_BIND_SIZE, date_fmt, (struct tm*)gmtime(&t));
- return text;
-
- break;
- case MDB_MEMO:
- return mdb_memo_to_string(mdb, start, size);
- break;
- case MDB_MONEY:
- mdb_money_to_string(mdb, start, text);
- return text;
- case MDB_NUMERIC:
- break;
- default:
- return "";
- break;
- }
- return NULL;
-}
-int mdb_col_disp_size(MdbColumn *col)
-{
- switch (col->col_type) {
- case MDB_BOOL:
- return 1;
- break;
- case MDB_BYTE:
- return 4;
- break;
- case MDB_INT:
- return 6;
- break;
- case MDB_LONGINT:
- return 11;
- break;
- case MDB_FLOAT:
- return 10;
- break;
- case MDB_DOUBLE:
- return 10;
- break;
- case MDB_TEXT:
- return col->col_size;
- break;
- case MDB_SDATETIME:
- return 20;
- break;
- case MDB_MEMO:
- return 255;
- break;
- case MDB_MONEY:
- return 21;
- break;
- }
- return 0;
-}
-int mdb_col_fixed_size(MdbColumn *col)
-{
- switch (col->col_type) {
- case MDB_BOOL:
- return 1;
- break;
- case MDB_BYTE:
- return -1;
- break;
- case MDB_INT:
- return 2;
- break;
- case MDB_LONGINT:
- return 4;
- break;
- case MDB_FLOAT:
- return 4;
- break;
- case MDB_DOUBLE:
- return 8;
- break;
- case MDB_TEXT:
- return -1;
- break;
- case MDB_SDATETIME:
- return 4;
- break;
- case MDB_MEMO:
- return -1;
- break;
- case MDB_MONEY:
- return 8;
- break;
- }
- return 0;
-}
+++ /dev/null
-#include <ctype.h>
-#include <string.h>
-#include <stdio.h>
-
-#ifdef DMALLOC
-#include "dmalloc.h"
-#endif
-
-void buffer_dump(const unsigned char* buf, int start, int end)
-{
- char asc[20];
- int j, k;
-
- memset(asc, 0, sizeof(asc));
- k = 0;
- for (j=start; j<=end; j++) {
- if (k == 0) {
- fprintf(stdout, "%04x ", j);
- }
- fprintf(stdout, "%02x ", buf[j]);
- asc[k] = isprint(buf[j]) ? buf[j] : '.';
- k++;
- if (k == 8) {
- fprintf(stdout, " ");
- }
- if (k == 16) {
- fprintf(stdout, " %s\n", asc);
- memset(asc, 0, sizeof(asc));
- k = 0;
- }
- }
- for (j=k; j<16; j++) {
- fprintf(stdout, " ");
- }
- if (k < 8) {
- fprintf(stdout, " ");
- }
- fprintf(stdout, " %s\n", asc);
-}
+++ /dev/null
-/* MDB Tools - A library for reading MS Access database files
- * Copyright (C) 2000 Brian Bruns
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library 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
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#include "mdbtools.h"
-
-#ifdef DMALLOC
-#include "dmalloc.h"
-#endif
-
-/*
-typedef struct {
- int pg_size;
- guint16 row_count_offset;
- guint16 tab_num_rows_offset;
- guint16 tab_num_cols_offset;
- guint16 tab_num_idxs_offset;
- guint16 tab_num_ridxs_offset;
- guint16 tab_usage_map_offset;
- guint16 tab_first_dpg_offset;
- guint16 tab_cols_start_offset;
- guint16 tab_ridx_entry_size;
- guint16 col_fixed_offset;
- guint16 col_size_offset;
- guint16 col_num_offset;
- guint16 tab_col_entry_size;
- guint16 tab_free_map_offset;
- guint16 tab_col_offset_var;
- guint16 tab_col_offset_fixed;
- guint16 tab_row_col_num_offset;
-} MdbFormatConstants;
-*/
-MdbFormatConstants MdbJet4Constants = {
- 4096, 0x0c, 16, 45, 47, 51, 55, 56, 63, 12, 15, 23, 5, 25, 59, 7, 21, 9
-};
-MdbFormatConstants MdbJet3Constants = {
- 2048, 0x08, 12, 25, 27, 31, 35, 36, 43, 8, 13, 16, 1, 18, 39, 3, 14, 5 /* not sure on 5, need to check */
-};
-
-static ssize_t _mdb_read_pg(MdbHandle *mdb, unsigned char *pg_buf, unsigned long pg);
-
-/**
- * mdb_find_file:
- * @filename: path to MDB (database) file
- *
- * Finds and returns the absolute path to an MDB file. Function will first try
- * to fstat file as passed, then search through the $MDBPATH if not found.
- *
- * Return value: gchar pointer to absolute path. Caller is responsible for
- * freeing.
- **/
-
-static gchar *mdb_find_file(char *file_name)
-{
- struct stat status;
- gchar *mdbpath, **dir, *tmpfname;
- unsigned int i = 0;
-
- /* try the provided file name first */
- if (!stat(file_name, &status)) {
- return g_strdup(file_name);
- }
-
- /* Now pull apart $MDBPATH and try those */
- mdbpath = (gchar *) getenv("MDBPATH");
- /* no path, can't find file */
- if (!mdbpath || !strlen(mdbpath)) return NULL;
-
- dir = g_strsplit(mdbpath, ":", 0);
- while (dir[i]) {
- if (!strlen(dir[i])) continue;
- tmpfname = g_strconcat(dir[i++], "/", file_name, NULL);
- if (!stat(tmpfname, &status)) {
- g_strfreev(dir);
- return tmpfname;
- }
- g_free(tmpfname);
- }
- g_strfreev(dir);
- return NULL;
-}
-/**
- * mdb_open:
- * @filename: path to MDB (database) file
- * @flags: MDB_NOFLAGS for read-only, MDB_WRITABLE for read/write
- *
- * Opens an MDB file and returns an MdbHandle to it. MDB File may be relative
- * to the current directory, a full path to the file, or relative to a
- * component of $MDBPATH.
- *
- * Return value: pointer to MdbHandle structure.
- **/
-MdbHandle *mdb_open(char *filename, MdbFileFlags flags)
-{
- MdbHandle *mdb;
-
- mdb = (MdbHandle *) g_malloc0(sizeof(MdbHandle));
- mdb_set_default_backend(mdb, "access");
- /* need something to bootstrap with, reassign after page 0 is read */
- mdb->fmt = &MdbJet3Constants;
- mdb->f = (MdbFile *) g_malloc0(sizeof(MdbFile));
- mdb->f->refs = 1;
- mdb->f->fd = -1;
- mdb->f->filename = (char *) mdb_find_file(filename);
- if (!mdb->f->filename) {
- fprintf(stderr, "Can't alloc filename\n");
- mdb_close(mdb);
- return NULL;
- }
- if (flags & MDB_WRITABLE) {
- mdb->f->writable = TRUE;
- mdb->f->fd = open(mdb->f->filename,O_RDWR);
- } else {
- mdb->f->fd = open(mdb->f->filename,O_RDONLY);
- }
-
- if (mdb->f->fd==-1) {
- fprintf(stderr,"Couldn't open file %s\n",mdb->f->filename);
- mdb_close(mdb);
- return NULL;
- }
- if (!mdb_read_pg(mdb, 0)) {
- fprintf(stderr,"Couldn't read first page.\n");
- mdb_close(mdb);
- return NULL;
- }
- if (mdb->pg_buf[0] != 0) {
- mdb_close(mdb);
- return NULL;
- }
- mdb->f->jet_version = mdb_pg_get_int32(mdb, 0x14);
- if (IS_JET4(mdb)) {
- mdb->fmt = &MdbJet4Constants;
- } else if (IS_JET3(mdb)) {
- mdb->fmt = &MdbJet3Constants;
- } else {
- fprintf(stderr,"Unknown Jet version.\n");
- mdb_close(mdb);
- return NULL;
- }
-
- return mdb;
-}
-
-/**
- * mdb_close:
- * @mdb: Handle to open MDB database file
- *
- * Dereferences MDB file, closes if reference count is 0, and destroys handle.
- *
- **/
-void
-mdb_close(MdbHandle *mdb)
-{
- if (!mdb) return;
- mdb_free_catalog(mdb);
- g_free(mdb->stats);
- g_free(mdb->backend_name);
-
- if (mdb->f) {
- if (mdb->f->refs > 1) {
- mdb->f->refs--;
- } else {
- if (mdb->f->fd != -1) close(mdb->f->fd);
- g_free(mdb->f->filename);
- g_free(mdb->f);
- }
- }
-
- g_free(mdb);
-}
-/**
- * mdb_clone_handle:
- * @mdb: Handle to open MDB database file
- *
- * Clones an existing database handle. Cloned handle shares the file descriptor
- * but has its own page buffer, page position, and similar internal variables.
- *
- * Return value: new handle to the database.
- */
-MdbHandle *mdb_clone_handle(MdbHandle *mdb)
-{
- MdbHandle *newmdb;
- MdbCatalogEntry *entry, *data;
- unsigned int i;
-
- newmdb = (MdbHandle *) g_memdup(mdb, sizeof(MdbHandle));
- newmdb->stats = NULL;
- newmdb->catalog = g_ptr_array_new();
- for (i=0;i<mdb->num_catalog;i++) {
- entry = g_ptr_array_index(mdb->catalog,i);
- data = g_memdup(entry,sizeof(MdbCatalogEntry));
- g_ptr_array_add(newmdb->catalog, data);
- }
- mdb->backend_name = NULL;
- if (mdb->f) {
- mdb->f->refs++;
- }
- return newmdb;
-}
-
-/*
-** mdb_read a wrapper for read that bails if anything is wrong
-*/
-ssize_t mdb_read_pg(MdbHandle *mdb, unsigned long pg)
-{
- ssize_t len;
-
- if (pg && mdb->cur_pg == pg) return mdb->fmt->pg_size;
-
- len = _mdb_read_pg(mdb, mdb->pg_buf, pg);
- //fprintf(stderr, "read page %d type %02x\n", pg, mdb->pg_buf[0]);
- mdb->cur_pg = pg;
- /* kan - reset the cur_pos on a new page read */
- mdb->cur_pos = 0; /* kan */
- return len;
-}
-ssize_t mdb_read_alt_pg(MdbHandle *mdb, unsigned long pg)
-{
- ssize_t len;
-
- len = _mdb_read_pg(mdb, mdb->alt_pg_buf, pg);
- return len;
-}
-static ssize_t _mdb_read_pg(MdbHandle *mdb, unsigned char *pg_buf, unsigned long pg)
-{
- ssize_t len;
- struct stat status;
- off_t offset = pg * mdb->fmt->pg_size;
-
- fstat(mdb->f->fd, &status);
- if (status.st_size < offset) {
- fprintf(stderr,"offset %lu is beyond EOF\n",offset);
- return 0;
- }
- if (mdb->stats && mdb->stats->collect)
- mdb->stats->pg_reads++;
-
- lseek(mdb->f->fd, offset, SEEK_SET);
- len = read(mdb->f->fd,pg_buf,mdb->fmt->pg_size);
- if (len==-1) {
- perror("read");
- return 0;
- }
- else if (len<mdb->fmt->pg_size) {
- /* fprintf(stderr,"EOF reached %d bytes returned.\n",len, mdb->fmt->pg_size); */
- return 0;
- }
- return len;
-}
-void mdb_swap_pgbuf(MdbHandle *mdb)
-{
-char tmpbuf[MDB_PGSIZE];
-
- memcpy(tmpbuf,mdb->pg_buf, MDB_PGSIZE);
- memcpy(mdb->pg_buf,mdb->alt_pg_buf, MDB_PGSIZE);
- memcpy(mdb->alt_pg_buf,tmpbuf,MDB_PGSIZE);
-}
-
-
-/* really stupid, just here for consistancy */
-unsigned char mdb_get_byte(unsigned char *buf, int offset)
-{
- return buf[offset];
-}
-unsigned char mdb_pg_get_byte(MdbHandle *mdb, int offset)
-{
- if (offset < 0 || offset+1 > mdb->fmt->pg_size) return -1;
- mdb->cur_pos++;
- return mdb->pg_buf[offset];
-}
-
-int mdb_get_int16(unsigned char *buf, int offset)
-{
- return buf[offset+1]*256+buf[offset];
-}
-int mdb_pg_get_int16(MdbHandle *mdb, int offset)
-{
- if (offset < 0 || offset+2 > mdb->fmt->pg_size) return -1;
- mdb->cur_pos+=2;
- return mdb_get_int16(mdb->pg_buf, offset);
-}
-
-gint32 mdb_pg_get_int24_msb(MdbHandle *mdb, int offset)
-{
- gint32 l = 0;
- if (offset <0 || offset+3 > mdb->fmt->pg_size) return -1;
- mdb->cur_pos+=3;
- memcpy((char *)&l+1, &(mdb->pg_buf[offset]), 3);
-#if 0
- printf("l=0x%08x 0x%08x\n",l,GINT32_FROM_BE(l));
-#endif
- return GINT32_FROM_BE(l);
-}
-gint32 mdb_get_int24(unsigned char *buf, int offset)
-{
- gint32 l = 0;
- memcpy(&l, &buf[offset], 3);
- return GINT32_FROM_LE(l);
-}
-gint32 mdb_pg_get_int24(MdbHandle *mdb, int offset)
-{
- if (offset <0 || offset+3 > mdb->fmt->pg_size) return -1;
- mdb->cur_pos+=3;
- return mdb_get_int24(mdb->pg_buf, offset);
-}
-
-long mdb_get_int32(unsigned char *buf, int offset)
-{
- guint32 l;
- memcpy(&l, &buf[offset], 4);
- return (long)GINT32_FROM_LE(l);
-}
-long mdb_pg_get_int32(MdbHandle *mdb, int offset)
-{
- if (offset <0 || offset+4 > mdb->fmt->pg_size) return -1;
- mdb->cur_pos+=4;
- return mdb_get_int32(mdb->pg_buf, offset);
-}
-
-float mdb_get_single(unsigned char *buf, int offset)
-{
- union {guint32 g; float f;} f;
- memcpy(&f, &buf[offset], 4);
- f.g = GUINT32_FROM_LE(f.g);
- return f.f;
-}
-float mdb_pg_get_single(MdbHandle *mdb, int offset)
-{
- if (offset <0 || offset+4 > mdb->fmt->pg_size) return -1;
- mdb->cur_pos+=4;
- return mdb_get_single(mdb->pg_buf, offset);
-}
-
-double mdb_get_double(unsigned char *buf, int offset)
-{
- union {guint64 g; double d;} d;
- memcpy(&d, &buf[offset], 8);
- d.g = GUINT64_FROM_LE(d.g);
- return d.d;
-}
-double mdb_pg_get_double(MdbHandle *mdb, int offset)
-{
- if (offset <0 || offset+8 > mdb->fmt->pg_size) return -1;
- mdb->cur_pos+=8;
- return mdb_get_double(mdb->pg_buf, offset);
-}
-
-
-int
-mdb_set_pos(MdbHandle *mdb, int pos)
-{
- if (pos<0 || pos >= mdb->fmt->pg_size) return 0;
-
- mdb->cur_pos=pos;
- return pos;
-}
-int mdb_get_pos(MdbHandle *mdb)
-{
- return mdb->cur_pos;
-}
+++ /dev/null
-/* MDB Tools - A library for reading MS Access database files
- * Copyright (C) 2000 Brian Bruns
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library 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
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#include "mdbtools.h"
-
-#ifdef DMALLOC
-#include "dmalloc.h"
-#endif
-
-int
-mdb_unicode2ascii(MdbHandle *mdb, unsigned char *buf, int offset, unsigned int len, char *dest)
-{
- unsigned int i;
-
- if (buf[offset]==0xff && buf[offset+1]==0xfe) {
- strncpy(dest, &buf[offset+2], len-2);
- dest[len-2]='\0';
- } else {
- /* convert unicode to ascii, rather sloppily */
- for (i=0;i<len;i+=2)
- dest[i/2] = buf[offset + i];
- dest[len/2]='\0';
- }
- return len;
-}
-
-int
-mdb_ascii2unicode(MdbHandle *mdb, unsigned char *buf, int offset, unsigned int len, char *dest)
-{
- unsigned int i = 0;
-
- if (!buf) return 0;
-
- if (IS_JET3(mdb)) {
- strncpy(dest, &buf[offset], len);
- dest[len]='\0';
- return strlen(dest);
- }
-
- while (i<strlen(&buf[offset]) && (i*2+2)<len) {
- dest[i*2] = buf[offset+i];
- dest[i*2+1] = 0;
- i++;
- }
-
- return (i*2);
-}
+++ /dev/null
-EXTRA_DIST = mdbtools.h
+++ /dev/null
-/* MDB Tools - A library for reading MS Access database files
- * Copyright (C) 2000 Brian Bruns
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library 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
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifndef _mdbtools_h_
-#define _mdbtools_h_
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <stdarg.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <unistd.h>
-#include <ctype.h>
-#include <string.h>
-#include <glib.h>
-
-#ifdef HAVE_ICONV
-#include <iconv.h>
-#endif
-
-#define MDB_DEBUG 0
-
-#define MDB_PGSIZE 4096
-#define MDB_MAX_OBJ_NAME 256
-#define MDB_MAX_COLS 256
-#define MDB_MAX_IDX_COLS 10
-#define MDB_CATALOG_PG 18
-#define MDB_MEMO_OVERHEAD 12
-#define MDB_BIND_SIZE 16384
-
-enum {
- MDB_PAGE_DB = 0,
- MDB_PAGE_DATA,
- MDB_PAGE_TABLE,
- MDB_PAGE_INDEX,
- MDB_PAGE_LEAF,
- MDB_PAGE_MAP
-};
-enum {
- MDB_VER_JET3 = 0,
- MDB_VER_JET4 = 1
-};
-enum {
- MDB_FORM = 0,
- MDB_TABLE,
- MDB_MACRO,
- MDB_SYSTEM_TABLE,
- MDB_REPORT,
- MDB_QUERY,
- MDB_LINKED_TABLE,
- MDB_MODULE,
- MDB_RELATIONSHIP,
- MDB_UNKNOWN_09,
- MDB_UNKNOWN_0A,
- MDB_DATABASE_PROPERTY,
- MDB_ANY = -1
-};
-enum {
- MDB_BOOL = 0x01,
- MDB_BYTE = 0x02,
- MDB_INT = 0x03,
- MDB_LONGINT = 0x04,
- MDB_MONEY = 0x05,
- MDB_FLOAT = 0x06,
- MDB_DOUBLE = 0x07,
- MDB_SDATETIME = 0x08,
- MDB_TEXT = 0x0a,
- MDB_OLE = 0x0b,
- MDB_MEMO = 0x0c,
- MDB_REPID = 0x0f,
- MDB_NUMERIC = 0x10
-};
-
-/* SARG operators */
-enum {
- MDB_OR = 1,
- MDB_AND,
- MDB_NOT,
- MDB_EQUAL,
- MDB_GT,
- MDB_LT,
- MDB_GTEQ,
- MDB_LTEQ,
- MDB_LIKE,
- MDB_ISNULL,
- MDB_NOTNULL
-};
-
-typedef enum {
- MDB_TABLE_SCAN,
- MDB_LEAF_SCAN,
- MDB_INDEX_SCAN
-} MdbStrategy;
-
-typedef enum {
- MDB_NOFLAGS = 0x00,
- MDB_WRITABLE = 0x01
-} MdbFileFlags;
-
-enum {
- MDB_DEBUG_LIKE = 0x0001,
- MDB_DEBUG_WRITE = 0x0002,
- MDB_DEBUG_USAGE = 0x0004,
- MDB_DEBUG_OLE = 0x0008,
- MDB_DEBUG_ROW = 0x0010,
- MDB_USE_INDEX = 0x0020
-};
-
-#define mdb_is_logical_op(x) (x == MDB_OR || \
- x == MDB_AND || \
- x == MDB_NOT )
-
-#define mdb_is_relational_op(x) (x == MDB_EQUAL || \
- x == MDB_GT || \
- x == MDB_LT || \
- x == MDB_GTEQ || \
- x == MDB_LTEQ || \
- x == MDB_LIKE || \
- x == MDB_ISNULL || \
- x == MDB_NOTNULL )
-
-enum {
- MDB_ASC,
- MDB_DESC
-};
-
-enum {
- MDB_IDX_UNIQUE = 0x01,
- MDB_IDX_IGNORENULLS = 0x02,
- MDB_IDX_REQUIRED = 0x08
-};
-
-#define IS_JET4(mdb) (mdb->f->jet_version==MDB_VER_JET4)
-#define IS_JET3(mdb) (mdb->f->jet_version==MDB_VER_JET3)
-
-/* hash to store registered backends */
-/* extern GHashTable *mdb_backends; */
-
-/* forward declarations */
-typedef struct mdbindex MdbIndex;
-typedef struct mdbsargtree MdbSargNode;
-
-typedef struct {
- char *name;
- unsigned char needs_length; /* or precision */
- unsigned char needs_scale;
- unsigned char needs_quotes;
-} MdbBackendType;
-
-typedef struct {
- MdbBackendType *types_table;
-} MdbBackend;
-
-typedef struct {
- gboolean collect;
- unsigned long pg_reads;
-} MdbStatistics;
-
-typedef struct {
- int fd;
- gboolean writable;
- char *filename;
- guint32 jet_version;
- guint32 db_key;
- char db_passwd[14];
- MdbBackend *default_backend;
- char *backend_name;
- MdbStatistics *stats;
- /* free map */
- int map_sz;
- unsigned char *free_map;
- /* reference count */
- int refs;
-} MdbFile;
-
-/* offset to row count on data pages...version dependant */
-typedef struct {
- int pg_size;
- guint16 row_count_offset;
- guint16 tab_num_rows_offset;
- guint16 tab_num_cols_offset;
- guint16 tab_num_idxs_offset;
- guint16 tab_num_ridxs_offset;
- guint16 tab_usage_map_offset;
- guint16 tab_first_dpg_offset;
- guint16 tab_cols_start_offset;
- guint16 tab_ridx_entry_size;
- guint16 col_fixed_offset;
- guint16 col_size_offset;
- guint16 col_num_offset;
- guint16 tab_col_entry_size;
- guint16 tab_free_map_offset;
- guint16 tab_col_offset_var;
- guint16 tab_col_offset_fixed;
- guint16 tab_row_col_num_offset;
-} MdbFormatConstants;
-
-typedef struct {
- MdbFile *f;
- guint32 cur_pg;
- guint16 row_num;
- unsigned int cur_pos;
- unsigned char pg_buf[MDB_PGSIZE];
- unsigned char alt_pg_buf[MDB_PGSIZE];
- unsigned int num_catalog;
- GPtrArray *catalog;
- MdbBackend *default_backend;
- char *backend_name;
- MdbFormatConstants *fmt;
- MdbStatistics *stats;
-#ifdef HAVE_ICONV
- iconv_t iconv_out;
-#endif
-} MdbHandle;
-
-typedef struct {
- MdbHandle *mdb;
- char object_name[MDB_MAX_OBJ_NAME+1];
- int object_type;
- unsigned long table_pg; /* misnomer since object may not be a table */
- unsigned long kkd_pg;
- unsigned int kkd_rowid;
- int num_props;
- GArray *props;
- GArray *columns;
- int flags;
-} MdbCatalogEntry;
-
-typedef struct {
- gchar *name;
- GHashTable *hash;
-} MdbProperties;
-
-typedef union {
- int i;
- double d;
- char s[256];
-} MdbAny;
-
-typedef struct {
- char name[MDB_MAX_OBJ_NAME+1];
- int col_type;
- int col_size;
- void *bind_ptr;
- int *len_ptr;
- GHashTable *properties;
- unsigned int num_sargs;
- GPtrArray *sargs;
- GPtrArray *idx_sarg_cache;
- unsigned char is_fixed;
- int query_order;
- /* col_num is the current column order,
- * does not include deletes */
- int col_num;
- int cur_value_start;
- int cur_value_len;
- /* MEMO/OLE readers */
- guint32 cur_blob_pg;
- int cur_blob_row;
- int chunk_size;
- /* numerics only */
- int col_prec;
- int col_scale;
- MdbProperties *props;
- /* info needed for handling deleted/added columns */
- int fixed_offset;
- int var_col_num;
- /* row_col_num is the row column number order,
- * including deleted columns */
- int row_col_num;
-} MdbColumn;
-
-struct mdbsargtree {
- int op;
- MdbColumn *col;
- MdbAny value;
- void *parent;
- MdbSargNode *left;
- MdbSargNode *right;
-};
-
-typedef struct {
- guint32 pg;
- int start_pos;
- int offset;
- int len;
- guint16 idx_starts[2000];
- unsigned char cache_value[256];
-} MdbIndexPage;
-
-typedef int (*MdbSargTreeFunc)(MdbSargNode *, gpointer *data);
-
-#define MDB_MAX_INDEX_DEPTH 10
-
-typedef struct {
- int cur_depth;
- guint32 last_leaf_found;
- int clean_up_mode;
- MdbIndexPage pages[MDB_MAX_INDEX_DEPTH];
-} MdbIndexChain;
-
-typedef struct {
- MdbCatalogEntry *entry;
- char name[MDB_MAX_OBJ_NAME+1];
- unsigned int num_cols;
- GPtrArray *columns;
- unsigned int num_rows;
- int index_start;
- unsigned int num_real_idxs;
- unsigned int num_idxs;
- GPtrArray *indices;
- guint32 first_data_pg;
- guint32 cur_pg_num;
- guint32 cur_phys_pg;
- unsigned int cur_row;
- int noskip_del; /* don't skip deleted rows */
- /* object allocation map */
- guint32 map_base_pg;
- unsigned int map_sz;
- unsigned char *usage_map;
- /* pages with free space left */
- guint32 freemap_base_pg;
- unsigned int freemap_sz;
- unsigned char *free_usage_map;
- /* query planner */
- MdbSargNode *sarg_tree;
- MdbStrategy strategy;
- MdbIndex *scan_idx;
- MdbHandle *mdbidx;
- MdbIndexChain *chain;
- MdbProperties *props;
- unsigned int num_var_cols; /* to know if row has variable columns */
- /* temp table */
- unsigned int is_temp_table;
- GPtrArray *temp_table_pages;
-} MdbTableDef;
-
-struct mdbindex {
- int index_num;
- char name[MDB_MAX_OBJ_NAME+1];
- unsigned char index_type;
- guint32 first_pg;
- int num_rows; /* number rows in index */
- unsigned int num_keys;
- short key_col_num[MDB_MAX_IDX_COLS];
- unsigned char key_col_order[MDB_MAX_IDX_COLS];
- unsigned char flags;
- MdbTableDef *table;
-};
-
-typedef struct {
- char name[MDB_MAX_OBJ_NAME+1];
-} MdbColumnProp;
-
-typedef struct {
- void *value;
- int siz;
- int start;
- unsigned char is_null;
- unsigned char is_fixed;
- int colnum;
- int offset;
-} MdbField;
-
-typedef struct {
- int op;
- MdbAny value;
-} MdbSarg;
-
-/* mem.c */
-extern void mdb_init(void);
-extern void mdb_exit(void);
-
-/* file.c */
-extern ssize_t mdb_read_pg(MdbHandle *mdb, unsigned long pg);
-extern ssize_t mdb_read_alt_pg(MdbHandle *mdb, unsigned long pg);
-extern unsigned char mdb_get_byte(unsigned char *buf, int offset);
-extern int mdb_get_int16(unsigned char *buf, int offset);
-extern gint32 mdb_get_int24(unsigned char *buf, int offset);
-extern long mdb_get_int32(unsigned char *buf, int offset);
-extern float mdb_get_single(unsigned char *buf, int offset);
-extern double mdb_get_double(unsigned char *buf, int offset);
-extern unsigned char mdb_pg_get_byte(MdbHandle *mdb, int offset);
-extern int mdb_pg_get_int16(MdbHandle *mdb, int offset);
-extern gint32 mdb_pg_get_int24(MdbHandle *mdb, int offset);
-extern long mdb_pg_get_int32(MdbHandle *mdb, int offset);
-extern float mdb_pg_get_single(MdbHandle *mdb, int offset);
-extern double mdb_pg_get_double(MdbHandle *mdb, int offset);
-extern gint32 mdb_pg_get_int24_msb(MdbHandle *mdb, int offset);
-extern MdbHandle *mdb_open(char *filename, MdbFileFlags flags);
-extern void mdb_close(MdbHandle *mdb);
-extern MdbHandle *mdb_clone_handle(MdbHandle *mdb);
-extern void mdb_swap_pgbuf(MdbHandle *mdb);
-extern long _mdb_get_int32(unsigned char *buf, int offset);
-
-/* catalog.c */
-extern void mdb_free_catalog(MdbHandle *mdb);
-extern GPtrArray *mdb_read_catalog(MdbHandle *mdb, int obj_type);
-extern void mdb_dump_catalog(MdbHandle *mdb, int obj_type);
-extern char *mdb_get_objtype_string(int obj_type);
-
-/* table.c */
-extern MdbTableDef *mdb_alloc_tabledef(MdbCatalogEntry *entry);
-extern void mdb_free_tabledef(MdbTableDef *table);
-extern MdbTableDef *mdb_read_table(MdbCatalogEntry *entry);
-extern MdbTableDef *mdb_read_table_by_name(MdbHandle *mdb, gchar *table_name, int obj_type);
-extern void mdb_append_column(GPtrArray *columns, MdbColumn *in_col);
-extern void mdb_free_columns(GPtrArray *columns);
-extern GPtrArray *mdb_read_columns(MdbTableDef *table);
-extern void mdb_table_dump(MdbCatalogEntry *entry);
-extern guint16 read_pg_if_16(MdbHandle *mdb, int *cur_pos);
-extern guint32 read_pg_if_32(MdbHandle *mdb, int *cur_pos);
-extern int read_pg_if(MdbHandle *mdb, int *cur_pos, int offset);
-extern guint16 read_pg_if_n(MdbHandle *mdb, unsigned char *buf, int *cur_pos, int len);
-extern int mdb_is_user_table(MdbCatalogEntry *entry);
-extern int mdb_is_system_table(MdbCatalogEntry *entry);
-
-/* data.c */
-extern int mdb_bind_column_by_name(MdbTableDef *table, gchar *col_name, void *bind_ptr);
-extern void mdb_data_dump(MdbTableDef *table);
-extern void mdb_bind_column(MdbTableDef *table, int col_num, void *bind_ptr);
-extern int mdb_rewind_table(MdbTableDef *table);
-extern int mdb_fetch_row(MdbTableDef *table);
-extern int mdb_is_fixed_col(MdbColumn *col);
-extern char *mdb_col_to_string(MdbHandle *mdb, unsigned char *buf, int start, int datatype, int size);
-extern int mdb_find_pg_row(MdbHandle *mdb, int pg_row, char **buf, int *off, int *len);
-extern int mdb_find_end_of_row(MdbHandle *mdb, int row);
-extern int mdb_col_fixed_size(MdbColumn *col);
-extern int mdb_col_disp_size(MdbColumn *col);
-extern void mdb_bind_len(MdbTableDef *table, int col_num, int *len_ptr);
-extern int mdb_ole_read_next(MdbHandle *mdb, MdbColumn *col, void *ole_ptr);
-extern int mdb_ole_read(MdbHandle *mdb, MdbColumn *col, void *ole_ptr, int chunk_size);
-extern void mdb_set_date_fmt(const char *);
-extern int mdb_read_row(MdbTableDef *table, unsigned int row);
-
-/* dump.c */
-extern void buffer_dump(const unsigned char* buf, int start, int end);
-
-/* backend.c */
-extern char *mdb_get_coltype_string(MdbBackend *backend, int col_type);
-extern int mdb_coltype_takes_length(MdbBackend *backend, int col_type);
-extern void mdb_init_backends(void);
-extern void mdb_register_backend(MdbBackendType *backend, char *backend_name);
-extern void mdb_remove_backends(void);
-extern int mdb_set_default_backend(MdbHandle *mdb, char *backend_name);
-extern char *mdb_get_relationships(MdbHandle *mdb);
-
-/* sargs.c */
-extern int mdb_test_sargs(MdbTableDef *table, MdbField *fields, int num_fields);
-extern int mdb_test_sarg(MdbHandle *mdb, MdbColumn *col, MdbSargNode *node, MdbField *field);
-extern void mdb_sql_walk_tree(MdbSargNode *node, MdbSargTreeFunc func, gpointer data);
-extern int mdb_find_indexable_sargs(MdbSargNode *node, gpointer data);
-extern int mdb_add_sarg_by_name(MdbTableDef *table, char *colname, MdbSarg *in_sarg);
-extern int mdb_test_string(MdbSargNode *node, char *s);
-extern int mdb_test_int(MdbSargNode *node, gint32 i);
-extern int mdb_add_sarg(MdbColumn *col, MdbSarg *in_sarg);
-
-
-
-/* index.c */
-extern GPtrArray *mdb_read_indices(MdbTableDef *table);
-extern void mdb_index_dump(MdbTableDef *table, MdbIndex *idx);
-extern void mdb_index_scan_free(MdbTableDef *table);
-extern int mdb_index_find_next_on_page(MdbHandle *mdb, MdbIndexPage *ipg);
-extern int mdb_index_find_next(MdbHandle *mdb, MdbIndex *idx, MdbIndexChain *chain, guint32 *pg, guint16 *row);
-extern void mdb_index_hash_text(guchar *text, guchar *hash);
-extern void mdb_index_scan_init(MdbHandle *mdb, MdbTableDef *table);
-extern int mdb_index_find_row(MdbHandle *mdb, MdbIndex *idx, MdbIndexChain *chain, guint32 pg, guint16 row);
-extern void mdb_index_swap_n(unsigned char *src, int sz, unsigned char *dest);
-extern void mdb_free_indices(GPtrArray *indices);
-void mdb_index_page_reset(MdbIndexPage *ipg);
-extern MdbIndexPage *mdb_index_read_bottom_pg(MdbHandle *mdb, MdbIndex *idx, MdbIndexChain *chain);
-extern MdbIndexPage *mdb_index_unwind(MdbHandle *mdb, MdbIndex *idx, MdbIndexChain *chain);
-extern void mdb_index_page_init(MdbIndexPage *ipg);
-
-
-/* stats.c */
-extern void mdb_stats_on(MdbHandle *mdb);
-extern void mdb_stats_off(MdbHandle *mdb);
-extern void mdb_dump_stats(MdbHandle *mdb);
-
-/* like.c */
-extern int mdb_like_cmp(char *s, char *r);
-
-/* write.c */
-extern int mdb_crack_row(MdbTableDef *table, int row_start, int row_end, MdbField *fields);
-extern guint16 mdb_add_row_to_pg(MdbTableDef *table, unsigned char *row_buffer, int new_row_size);
-extern int mdb_update_index(MdbTableDef *table, MdbIndex *idx, unsigned int num_fields, MdbField *fields, guint32 pgnum, guint16 rownum);
-extern int mdb_pack_row(MdbTableDef *table, unsigned char *row_buffer, unsigned int num_fields, MdbField *fields);
-extern int mdb_replace_row(MdbTableDef *table, int row, unsigned char *new_row, int new_row_size);
-extern int mdb_pg_get_freespace(MdbHandle *mdb);
-extern int mdb_update_row(MdbTableDef *table);
-extern unsigned char *mdb_new_data_pg(MdbCatalogEntry *entry);
-
-/* map.c */
-extern guint32 mdb_map_find_next_freepage(MdbTableDef *table, int row_size);
-guint32 mdb_map_find_next(MdbHandle *mdb, unsigned char *map, unsigned int map_sz, guint32 start_pg);
-
-/* props.c */
-extern GPtrArray *mdb_read_props_list(gchar *kkd, int len);
-extern void mdb_free_props(MdbProperties *props);
-extern MdbProperties *mdb_read_props(MdbHandle *mdb, GPtrArray *names, gchar *kkd, int len);
-
-/* worktable.c */
-extern MdbTableDef *mdb_create_temp_table(MdbHandle *mdb, char *name);
-extern void mdb_temp_table_add_col(MdbTableDef *table, MdbColumn *col);
-extern void mdb_fill_temp_col(MdbColumn *tcol, char *col_name, int col_size, int col_type, int is_fixed);
-extern void mdb_fill_temp_field(MdbField *field, void *value, int siz, int is_fixed, int is_null, int start, int column);
-extern void mdb_temp_columns_end(MdbTableDef *table);
-
-/* options.c */
-extern int mdb_get_option(unsigned long optnum);
-extern void mdb_debug(int klass, char *fmt, ...);
-
-/* iconv.c */
-extern int mdb_unicode2ascii(MdbHandle *mdb, unsigned char *buf, int offset, unsigned int len, char *dest);
-extern int mdb_ascii2unicode(MdbHandle *mdb, unsigned char *buf, int offset, unsigned int len, char *dest);
-
-#endif /* _mdbtools_h_ */
+++ /dev/null
-/* MDB Tools - A library for reading MS Access database file
- * Copyright (C) 2000-2004 Brian Bruns
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library 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
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#include "mdbtools.h"
-
-#ifdef DMALLOC
-#include "dmalloc.h"
-#endif
-
-MdbIndexPage *mdb_index_read_bottom_pg(MdbHandle *mdb, MdbIndex *idx, MdbIndexChain *chain);
-MdbIndexPage *mdb_chain_add_page(MdbHandle *mdb, MdbIndexChain *chain, guint32 pg);
-
-char idx_to_text[] = {
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0-7 0x00-0x07 */
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 8-15 0x09-0x0f */
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 16-23 0x10-0x17 */
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 24-31 0x19-0x1f */
-' ', 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 32-39 0x20-0x27 */
-0x00, 0x00, 0x00, 0x00, 0x00, ' ', ' ', 0x00, /* 40-47 0x29-0x2f */
-'V', 'W', 'X', 'Y', 'Z', '[', '\\', ']', /* 48-55 0x30-0x37 */
-'^', '_', 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 56-63 0x39-0x3f */
-0x00, '`', 'a', 'b', 'd', 'f', 'g', 'h', /* 64-71 0x40-0x47 */
-'i', 'j', 'k', 'l', 'm', 'o', 'p', 'r', /* 72-79 0x49-0x4f H */
-'s', 't', 'u', 'v', 'w', 'x', 'z', '{', /* 80-87 0x50-0x57 P */
-'|', '}', '~', '5', '6', '7', '8', '9', /* 88-95 0x59-0x5f */
-0x00, '`', 'a', 'b', 'd', 'f', 'g', 'h', /* 96-103 0x60-0x67 */
-'i', 'j', 'k', 'l', 'm', 'o', 'p', 'r', /* 014-111 0x69-0x6f h */
-'s', 't', 'u', 'v', 'w', 'x', 'z', '{', /* 112-119 0x70-0x77 p */
-'|', '}', '~', 0x00, 0x00, 0x00, 0x00, 0x00, /* 120-127 0x78-0x7f */
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 128-135 0x80-0x87 */
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x88-0x8f */
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x90-0x97 */
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x98-0x9f */
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xa0-0xa7 */
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xa8-0xaf */
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xb0-0xb7 */
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xb8-0xbf */
-0x00, 0x00, 0x00, 0x00, 0x00, '`', 0x00, 0x00, /* 0xc0-0xc7 */
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xc8-0xcf */
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xd0-0xd7 */
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xd8-0xdf */
-0x00, '`', 0x00, '`', '`', '`', 0x00, 0x00, /* 0xe0-0xe7 */
-'f', 'f', 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xe8-0xef */
-0x00, 0x00, 0x00, 'r', 0x00, 0x00, 'r', 0x00, /* 0xf0-0xf7 */
-0x81, 0x00, 0x00, 0x00, 'x', 0x00, 0x00, 0x00, /* 0xf8-0xff */
-};
-
-
-GPtrArray *
-mdb_read_indices(MdbTableDef *table)
-{
- MdbCatalogEntry *entry = table->entry;
- MdbHandle *mdb = entry->mdb;
- MdbFormatConstants *fmt = mdb->fmt;
- MdbIndex *pidx;
- unsigned int i, j;
- int idx_num, key_num, col_num;
- int cur_pos, name_sz, idx2_sz, type_offset;
- int index_start_pg = mdb->cur_pg;
- gchar *tmpbuf;
-
- table->indices = g_ptr_array_new();
-
- if (IS_JET4(mdb)) {
- cur_pos = table->index_start + 52 * table->num_real_idxs;
- idx2_sz = 28;
- type_offset = 23;
- } else {
- cur_pos = table->index_start + 39 * table->num_real_idxs;
- idx2_sz = 20;
- type_offset = 19;
- }
-
- tmpbuf = (gchar *) g_malloc(idx2_sz);
- for (i=0;i<table->num_idxs;i++) {
- read_pg_if_n(mdb, tmpbuf, &cur_pos, idx2_sz);
- cur_pos += idx2_sz;
- pidx = (MdbIndex *) g_malloc0(sizeof(MdbIndex));
- pidx->table = table;
- pidx->index_num = mdb_get_int16(tmpbuf, 4);
- pidx->index_type = tmpbuf[type_offset];
- g_ptr_array_add(table->indices, pidx);
- }
- g_free(tmpbuf);
-
- for (i=0;i<table->num_idxs;i++) {
- pidx = g_ptr_array_index (table->indices, i);
- if (IS_JET4(mdb)) {
- name_sz=read_pg_if_16(mdb, &cur_pos);
- cur_pos += 2;
- tmpbuf = g_malloc(name_sz);
- read_pg_if_n(mdb, tmpbuf, &cur_pos, name_sz);
- cur_pos += name_sz;
- mdb_unicode2ascii(mdb, tmpbuf, 0, name_sz, pidx->name);
- g_free(tmpbuf);
- } else {
- read_pg_if(mdb, &cur_pos, 0);
- name_sz=mdb->pg_buf[cur_pos++];
- read_pg_if_n(mdb, pidx->name, &cur_pos, name_sz);
- cur_pos += name_sz;
- pidx->name[name_sz]='\0';
- }
- //fprintf(stderr, "index name %s\n", pidx->name);
- }
-
- mdb_read_alt_pg(mdb, entry->table_pg);
- mdb_read_pg(mdb, index_start_pg);
- cur_pos = table->index_start;
- idx_num=0;
- for (i=0;i<table->num_real_idxs;i++) {
- if (IS_JET4(mdb)) cur_pos += 4;
- do {
- pidx = g_ptr_array_index (table->indices, idx_num++);
- } while (pidx && pidx->index_type==2);
-
- /* if there are more real indexes than index entries left after
- removing type 2's decrement real indexes and continue. Happens
- on Northwind Orders table.
- */
- if (!pidx) {
- table->num_real_idxs--;
- continue;
- }
-
- pidx->num_rows = mdb_get_int32(mdb->alt_pg_buf,
- fmt->tab_cols_start_offset +
- (i*fmt->tab_ridx_entry_size));
-
- key_num=0;
- for (j=0;j<MDB_MAX_IDX_COLS;j++) {
- col_num=read_pg_if_16(mdb,&cur_pos);
- cur_pos += 2;
- read_pg_if(mdb, &cur_pos, 0);
- cur_pos++;
- if (col_num == 0xFFFF)
- continue;
- /* set column number to a 1 based column number and store */
- pidx->key_col_num[key_num] = col_num + 1;
- pidx->key_col_order[key_num] =
- (mdb->pg_buf[cur_pos-1]) ? MDB_ASC : MDB_DESC;
- key_num++;
- }
- pidx->num_keys = key_num;
-
- cur_pos += 4;
- pidx->first_pg = read_pg_if_32(mdb, &cur_pos);
- cur_pos += 4;
- read_pg_if(mdb, &cur_pos, 0);
- pidx->flags = mdb->pg_buf[cur_pos++];
- if (IS_JET4(mdb)) cur_pos += 9;
- }
- return NULL;
-}
-void
-mdb_index_hash_text(guchar *text, guchar *hash)
-{
- unsigned int k;
-
- for (k=0;k<strlen(text);k++) {
- hash[k] = idx_to_text[text[k]];
- if (!(hash[k])) fprintf(stderr,
- "No translation available for %02x %d\n",
- text[k],text[k]);
- }
- hash[strlen(text)]=0;
-}
-void
-mdb_index_swap_n(unsigned char *src, int sz, unsigned char *dest)
-{
- int i, j = 0;
-
- for (i = sz; i > 0; i--) {
- dest[j++] = src[i];
- }
-}
-void
-mdb_index_cache_sarg(MdbColumn *col, MdbSarg *sarg, MdbSarg *idx_sarg)
-{
- //guint32 cache_int;
- unsigned char *c;
-
- switch (col->col_type) {
- case MDB_TEXT:
- mdb_index_hash_text(sarg->value.s, idx_sarg->value.s);
- break;
-
- case MDB_LONGINT:
- idx_sarg->value.i = GUINT32_SWAP_LE_BE(sarg->value.i);
- //cache_int = sarg->value.i * -1;
- c = (unsigned char *) &(idx_sarg->value.i);
- c[0] |= 0x80;
- //printf("int %08x %02x %02x %02x %02x\n", sarg->value.i, c[0], c[1], c[2], c[3]);
- break;
-
- case MDB_INT:
- break;
-
- default:
- break;
- }
-}
-#if 0
-int
-mdb_index_test_sarg(MdbHandle *mdb, MdbColumn *col, MdbSarg *sarg, int offset, int len)
-{
-char tmpbuf[256];
-int lastchar;
-
- switch (col->col_type) {
- case MDB_BYTE:
- return mdb_test_int(sarg, mdb_pg_get_byte(mdb, offset));
- break;
- case MDB_INT:
- return mdb_test_int(sarg, mdb_pg_get_int16(mdb, offset));
- break;
- case MDB_LONGINT:
- return mdb_test_int(sarg, mdb_pg_get_int32(mdb, offset));
- break;
- case MDB_TEXT:
- strncpy(tmpbuf, &mdb->pg_buf[offset],255);
- lastchar = len > 255 ? 255 : len;
- tmpbuf[lastchar]='\0';
- return mdb_test_string(sarg, tmpbuf);
- default:
- fprintf(stderr, "Calling mdb_test_sarg on unknown type. Add code to mdb_test_sarg() for type %d\n",col->col_type);
- break;
- }
- return 1;
-}
-#endif
-int
-mdb_index_test_sargs(MdbHandle *mdb, MdbIndex *idx, unsigned char *buf, int len)
-{
- unsigned int i, j;
- MdbColumn *col;
- MdbTableDef *table = idx->table;
- MdbSarg *idx_sarg;
- MdbSarg *sarg;
- MdbField field;
- MdbSargNode node;
- //int c_offset = 0,
- int c_len;
-
-#if 0
- fprintf(stderr,"mdb_index_test_sargs called on ");
- for (i=0;i<len;i++)
- fprintf(stderr,"%02x ",buf[i]); //mdb->pg_buf[offset+i]);
- fprintf(stderr,"\n");
-#endif
- for (i=0;i<idx->num_keys;i++) {
- //c_offset++; /* the per column null indicator/flags */
- col=g_ptr_array_index(table->columns,idx->key_col_num[i]-1);
- /*
- * This will go away eventually
- */
- if (col->col_type==MDB_TEXT) {
- //c_len = strlen(&mdb->pg_buf[offset + c_offset]);
- c_len = strlen(buf);
- } else {
- c_len = col->col_size;
- //fprintf(stderr,"Only text types currently supported. How did we get here?\n");
- }
- /*
- * If we have no cached index values for this column,
- * create them.
- */
- if (col->num_sargs && !col->idx_sarg_cache) {
- col->idx_sarg_cache = g_ptr_array_new();
- for (j=0;j<col->num_sargs;j++) {
- sarg = g_ptr_array_index (col->sargs, j);
- idx_sarg = g_memdup(sarg,sizeof(MdbSarg));
- //printf("calling mdb_index_cache_sarg\n");
- mdb_index_cache_sarg(col, sarg, idx_sarg);
- g_ptr_array_add(col->idx_sarg_cache, idx_sarg);
- }
- }
-
- for (j=0;j<col->num_sargs;j++) {
- sarg = g_ptr_array_index (col->idx_sarg_cache, j);
- /* XXX - kludge */
- node.op = sarg->op;
- node.value = sarg->value;
- //field.value = &mdb->pg_buf[offset + c_offset];
- field.value = buf;
- field.siz = c_len;
- field.is_null = FALSE;
- if (!mdb_test_sarg(mdb, col, &node, &field)) {
- /* sarg didn't match, no sense going on */
- return 0;
- }
- }
- }
- return 1;
-}
-/*
- * pack the pages bitmap
- */
-int
-mdb_index_pack_bitmap(MdbHandle *mdb, MdbIndexPage *ipg)
-{
- int mask_bit = 0;
- int mask_pos = 0x16;
- int mask_byte = 0;
- int elem = 0;
- int len, start, i;
-
- start = ipg->idx_starts[elem++];
-
- while (start) {
- len = ipg->idx_starts[elem] - start;
- fprintf(stdout, "len is %d\n", len);
- for (i=0; i < len; i++) {
- mask_bit++;
- if (mask_bit==8) {
- mask_bit=0;
- mdb->pg_buf[mask_pos++] = mask_byte;
- mask_byte = 0;
- }
- /* upon reaching the len, set the bit */
- }
- mask_byte = (1 << mask_bit) | mask_byte;
- fprintf(stdout, "mask byte is %02x at %d\n", mask_byte, mask_pos);
- start = ipg->idx_starts[elem++];
- }
- /* flush the last byte if any */
- mdb->pg_buf[mask_pos++] = mask_byte;
- /* remember to zero the rest of the bitmap */
- for (i = mask_pos; i < 0xf8; i++) {
- mdb->pg_buf[mask_pos++] = 0;
- }
- return 0;
-}
-/*
- * unpack the pages bitmap
- */
-int
-mdb_index_unpack_bitmap(MdbHandle *mdb, MdbIndexPage *ipg)
-{
- int mask_bit = 0;
- int mask_pos = 0x16;
- int mask_byte;
- int start = 0xf8;
- int elem = 0;
- int len = 0;
-
- ipg->idx_starts[elem++]=start;
-
-#if 0
- fprintf(stdout, "Unpacking index page %u\n", ipg->pg);
-#endif
- do {
- len = 0;
- do {
- mask_bit++;
- if (mask_bit==8) {
- mask_bit=0;
- mask_pos++;
- }
- mask_byte = mdb->pg_buf[mask_pos];
- len++;
- } while (mask_pos <= 0xf8 && !((1 << mask_bit) & mask_byte));
- //fprintf(stdout, "%d %d %d %d\n", mask_pos, mask_bit, mask_byte, len);
-
- start += len;
- if (mask_pos < 0xf8) ipg->idx_starts[elem++]=start;
-
- } while (mask_pos < 0xf8);
-
- /* if we zero the next element, so we don't pick up the last pages starts*/
- ipg->idx_starts[elem]=0;
-
- return elem;
-}
-/*
- * find the next entry on a page (either index or leaf). Uses state information
- * stored in the MdbIndexPage across calls.
- */
-int
-mdb_index_find_next_on_page(MdbHandle *mdb, MdbIndexPage *ipg)
-{
- if (!ipg->pg) return 0;
-
- /* if this page has not been unpacked to it */
- if (!ipg->idx_starts[0]){
- //fprintf(stdout, "Unpacking page %d\n", ipg->pg);
- mdb_index_unpack_bitmap(mdb, ipg);
- }
-
-
- if (ipg->idx_starts[ipg->start_pos + 1]==0) return 0;
- ipg->len = ipg->idx_starts[ipg->start_pos+1] - ipg->idx_starts[ipg->start_pos];
- ipg->start_pos++;
- //fprintf(stdout, "Start pos %d\n", ipg->start_pos);
-
- return ipg->len;
-}
-void mdb_index_page_reset(MdbIndexPage *ipg)
-{
- ipg->offset = 0xf8; /* start byte of the index entries */
- ipg->start_pos=0;
- ipg->len = 0;
- ipg->idx_starts[0]=0;
-}
-void mdb_index_page_init(MdbIndexPage *ipg)
-{
- memset(ipg, 0, sizeof(MdbIndexPage));
- mdb_index_page_reset(ipg);
-}
-/*
- * find the next leaf page if any given a chain. Assumes any exhausted leaf
- * pages at the end of the chain have been peeled off before the call.
- */
-MdbIndexPage *
-mdb_find_next_leaf(MdbHandle *mdb, MdbIndex *idx, MdbIndexChain *chain)
-{
- MdbIndexPage *ipg, *newipg;
- guint32 pg;
- guint passed = 0;
-
- ipg = mdb_index_read_bottom_pg(mdb, idx, chain);
-
- /*
- * If we are at the first page deep and it's not an index page then
- * we are simply done. (there is no page to find
- */
-
- if (mdb->pg_buf[0]==MDB_PAGE_LEAF) {
- /* Indexes can have leaves at the end that don't appear
- * in the upper tree, stash the last index found so
- * we can follow it at the end. */
- chain->last_leaf_found = ipg->pg;
- return ipg;
- }
-
- /*
- * apply sargs here, currently we don't
- */
- do {
- ipg->len = 0;
- //printf("finding next on pg %lu\n", ipg->pg);
- if (!mdb_index_find_next_on_page(mdb, ipg)) {
- //printf("find_next_on_page returned 0\n");
- return 0;
- }
- pg = mdb_pg_get_int24_msb(mdb, ipg->offset + ipg->len - 3);
- //printf("Looking at pg %lu at %lu %d\n", pg, ipg->offset, ipg->len);
- ipg->offset += ipg->len;
-
- /*
- * add to the chain and call this function
- * recursively.
- */
- newipg = mdb_chain_add_page(mdb, chain, pg);
- newipg = mdb_find_next_leaf(mdb, idx, chain);
- //printf("returning pg %lu\n",newipg->pg);
- return newipg;
- } while (!passed);
- /* no more pages */
- return NULL;
-
-}
-MdbIndexPage *
-mdb_chain_add_page(MdbHandle *mdb, MdbIndexChain *chain, guint32 pg)
-{
- MdbIndexPage *ipg;
-
- chain->cur_depth++;
- if (chain->cur_depth > MDB_MAX_INDEX_DEPTH) {
- fprintf(stderr,"Error! maximum index depth of %d exceeded. This is probably due to a programming bug, If you are confident that your indexes really are this deep, adjust MDB_MAX_INDEX_DEPTH in mdbtools.h and recompile.\n", MDB_MAX_INDEX_DEPTH);
- exit(1);
- }
- ipg = &(chain->pages[chain->cur_depth - 1]);
- mdb_index_page_init(ipg);
- ipg->pg = pg;
-
- return ipg;
-}
-/*
- * returns the bottom page of the IndexChain, if IndexChain is empty it
- * initializes it by reading idx->first_pg (the root page)
- */
-MdbIndexPage *
-mdb_index_read_bottom_pg(MdbHandle *mdb, MdbIndex *idx, MdbIndexChain *chain)
-{
- MdbIndexPage *ipg;
-
- /*
- * if it's new use the root index page (idx->first_pg)
- */
- if (!chain->cur_depth) {
- ipg = &(chain->pages[0]);
- mdb_index_page_init(ipg);
- chain->cur_depth = 1;
- ipg->pg = idx->first_pg;
- if (!(ipg = mdb_find_next_leaf(mdb, idx, chain)))
- return 0;
- } else {
- ipg = &(chain->pages[chain->cur_depth - 1]);
- ipg->len = 0;
- }
-
- mdb_read_pg(mdb, ipg->pg);
-
- return ipg;
-}
-/*
- * unwind the stack and search for new leaf node
- */
-MdbIndexPage *
-mdb_index_unwind(MdbHandle *mdb, MdbIndex *idx, MdbIndexChain *chain)
-{
- MdbIndexPage *ipg;
-
- //printf("page %lu finished\n",ipg->pg);
- if (chain->cur_depth==1) {
- //printf("cur_depth == 1 we're out\n");
- return NULL;
- }
- /*
- * unwind the stack until we find something or reach
- * the top.
- */
- ipg = NULL;
- while (chain->cur_depth>1 && ipg==NULL) {
- //printf("chain depth %d\n", chain->cur_depth);
- chain->cur_depth--;
- ipg = mdb_find_next_leaf(mdb, idx, chain);
- if (ipg) mdb_index_find_next_on_page(mdb, ipg);
- }
- if (chain->cur_depth==1) {
- //printf("last leaf %lu\n", chain->last_leaf_found);
- return NULL;
- }
- return ipg;
-}
-/*
- * the main index function.
- * caller provides an index chain which is the current traversal of index
- * pages from the root page to the leaf. Initially passed as blank,
- * mdb_index_find_next will store it's state information here. Each invocation
- * then picks up where the last one left off, allowing us to scroll through
- * the index one by one.
- *
- * Sargs are applied here but also need to be applied on the whole row b/c
- * text columns may return false positives due to hashing and non-index
- * columns with sarg values can't be tested here.
- */
-int
-mdb_index_find_next(MdbHandle *mdb, MdbIndex *idx, MdbIndexChain *chain, guint32 *pg, guint16 *row)
-{
- MdbIndexPage *ipg;
- int passed = 0;
- int idx_sz;
- int idx_start = 0;
- MdbColumn *col;
-
- ipg = mdb_index_read_bottom_pg(mdb, idx, chain);
-
- /*
- * loop while the sargs don't match
- */
- do {
- ipg->len = 0;
- /*
- * if no more rows on this leaf, try to find a new leaf
- */
- if (!mdb_index_find_next_on_page(mdb, ipg)) {
- if (!chain->clean_up_mode) {
- if (!(ipg = mdb_index_unwind(mdb, idx, chain)))
- chain->clean_up_mode = 1;
- }
- if (chain->clean_up_mode) {
- //fprintf(stdout,"in cleanup mode\n");
-
- if (!chain->last_leaf_found) return 0;
- mdb_read_pg(mdb, chain->last_leaf_found);
- chain->last_leaf_found = mdb_pg_get_int24(mdb, 0x0c);
- //printf("next leaf %lu\n", chain->last_leaf_found);
- mdb_read_pg(mdb, chain->last_leaf_found);
- /* reuse the chain for cleanup mode */
- chain->cur_depth = 1;
- ipg = &chain->pages[0];
- mdb_index_page_init(ipg);
- ipg->pg = chain->last_leaf_found;
- //printf("next on page %d\n",
- if (!mdb_index_find_next_on_page(mdb, ipg))
- return 0;
- }
- }
- *row = mdb->pg_buf[ipg->offset + ipg->len - 1];
-#if 0
- printf("page: ");
- buffer_dump(mdb->pg_buf, ipg->offset+ipg->len-4, ipg->offset+ipg->len-2);
-#endif
- *pg = mdb_pg_get_int24_msb(mdb, ipg->offset + ipg->len - 4);
-#if 0
- printf("row = %d pg = %lu ipg->pg = %lu offset = %lu len = %d\n", *row, *pg, ipg->pg, ipg->offset, ipg->len);
-#endif
- col=g_ptr_array_index(idx->table->columns,idx->key_col_num[0]-1);
- idx_sz = mdb_col_fixed_size(col);
- /* handle compressed indexes, single key indexes only? */
- if (idx->num_keys==1 && idx_sz>0 && ipg->len - 4 < idx_sz) {
-#if 0
- printf("short index found\n");
- buffer_dump(ipg->cache_value, 0, idx_sz);
-#endif
- memcpy(&ipg->cache_value[idx_sz - (ipg->len - 4)], &mdb->pg_buf[ipg->offset], ipg->len);
-#if 0
- buffer_dump(ipg->cache_value, 0, idx_sz);
-#endif
- } else {
- idx_start = ipg->offset + (ipg->len - 4 - idx_sz);
- memcpy(ipg->cache_value, &mdb->pg_buf[idx_start], idx_sz);
- }
-
- //idx_start = ipg->offset + (ipg->len - 4 - idx_sz);
- passed = mdb_index_test_sargs(mdb, idx, ipg->cache_value, idx_sz);
-
-// printf("passed=%d\n", passed);
-
- buffer_dump(mdb->pg_buf, ipg->offset, ipg->offset+ipg->len-1);
- ipg->offset += ipg->len;
-
- } while (!passed);
-
-#if 0
- fprintf(stdout,"len = %d pos %d\n", ipg->len, ipg->len);
- buffer_dump(mdb->pg_buf, ipg->offset, ipg->offset+ipg->len-1);
-#endif
-
- return ipg->len;
-}
-/*
- * XXX - FIX ME
- * This function is grossly inefficient. It scans the entire index building
- * an IndexChain to a specific row. We should be checking the index pages
- * for matches against the indexed fields to find the proper leaf page, but
- * getting it working first and then make it fast!
- */
-int
-mdb_index_find_row(MdbHandle *mdb, MdbIndex *idx, MdbIndexChain *chain, guint32 pg, guint16 row)
-{
- MdbIndexPage *ipg;
- int passed = 0;
- guint32 datapg;
- guint16 datarow;
-
- ipg = mdb_index_read_bottom_pg(mdb, idx, chain);
-
- do {
- ipg->len = 0;
- /*
- * if no more rows on this leaf, try to find a new leaf
- */
- if (!mdb_index_find_next_on_page(mdb, ipg)) {
- /* back to top? We're done */
- if (chain->cur_depth==1)
- return 0;
-
- /*
- * unwind the stack until we find something or reach
- * the top.
- */
- while (chain->cur_depth>1) {
- chain->cur_depth--;
- if (!(ipg = mdb_find_next_leaf(mdb, idx, chain)))
- return 0;
- mdb_index_find_next_on_page(mdb, ipg);
- }
- if (chain->cur_depth==1)
- return 0;
- }
- /* test row and pg */
- datarow = mdb->pg_buf[ipg->offset + ipg->len - 1];
- datapg = mdb_pg_get_int24_msb(mdb, ipg->offset + ipg->len - 4);
-
- if (datapg == pg && datarow == row) {
- passed = 1;
- }
- ipg->offset += ipg->len;
- } while (!passed);
-
- /* index chain from root to leaf should now be in "chain" */
- return 1;
-}
-
-void mdb_index_walk(MdbTableDef *table, MdbIndex *idx)
-{
-MdbHandle *mdb = table->entry->mdb;
-int cur_pos = 0;
-unsigned char marker;
-MdbColumn *col;
-unsigned int i;
-
- if (idx->num_keys!=1) return;
-
- mdb_read_pg(mdb, idx->first_pg);
- cur_pos = 0xf8;
-
- for (i=0;i<idx->num_keys;i++) {
- marker = mdb->pg_buf[cur_pos++];
- col=g_ptr_array_index(table->columns,idx->key_col_num[i]-1);
- //printf("column %d coltype %d col_size %d (%d)\n",i,col->col_type, mdb_col_fixed_size(col), col->col_size);
- }
-}
-void
-mdb_index_dump(MdbTableDef *table, MdbIndex *idx)
-{
- unsigned int i;
- MdbColumn *col;
-
- fprintf(stdout,"index number %d\n", idx->index_num);
- fprintf(stdout,"index name %s\n", idx->name);
- fprintf(stdout,"index first page %d\n", idx->first_pg);
- fprintf(stdout,"index rows %d\n", idx->num_rows);
- if (idx->index_type==1) fprintf(stdout,"index is a primary key\n");
- for (i=0;i<idx->num_keys;i++) {
- col=g_ptr_array_index(table->columns,idx->key_col_num[i]-1);
- fprintf(stdout,"Column %s(%d) Sorted %s Unique: %s\n",
- col->name,
- idx->key_col_num[i],
- idx->key_col_order[i]==MDB_ASC ? "ascending" : "descending",
- idx->flags & MDB_IDX_UNIQUE ? "Yes" : "No"
- );
- }
- mdb_index_walk(table, idx);
-}
-/*
- * compute_cost tries to assign a cost to a given index using the sargs
- * available in this query.
- *
- * Indexes with no matching sargs are assigned 0
- * Unique indexes are preferred over non-uniques
- * Operator preference is equal, like, isnull, others
- */
-int mdb_index_compute_cost(MdbTableDef *table, MdbIndex *idx)
-{
- unsigned int i;
- MdbColumn *col;
- MdbSarg *sarg = NULL;
- int not_all_equal = 0;
-
- if (!idx->num_keys) return 0;
- if (idx->num_keys > 1) {
- for (i=0;i<idx->num_keys;i++) {
- col=g_ptr_array_index(table->columns,idx->key_col_num[i]-1);
- if (col->sargs) sarg = g_ptr_array_index (col->sargs, 0);
- if (!sarg || sarg->op != MDB_EQUAL) not_all_equal++;
- }
- }
-
- col=g_ptr_array_index(table->columns,idx->key_col_num[0]-1);
- /*
- * if this is the first key column and there are no sargs,
- * then this index is useless.
- */
- if (!col->num_sargs) return 0;
-
- sarg = g_ptr_array_index (col->sargs, 0);
-
- /*
- * a like with a wild card first is useless as a sarg */
- if (sarg->op == MDB_LIKE && sarg->value.s[0]=='%')
- return 0;
-
- /*
- * this needs a lot of tweaking.
- */
- if (idx->flags & MDB_IDX_UNIQUE) {
- if (idx->num_keys == 1) {
- //printf("op is %d\n", sarg->op);
- switch (sarg->op) {
- case MDB_EQUAL:
- return 1; break;
- case MDB_LIKE:
- return 4; break;
- case MDB_ISNULL:
- return 12; break;
- default:
- return 8; break;
- }
- } else {
- switch (sarg->op) {
- case MDB_EQUAL:
- if (not_all_equal) return 2;
- else return 1;
- break;
- case MDB_LIKE:
- return 6; break;
- case MDB_ISNULL:
- return 12; break;
- default:
- return 9; break;
- }
- }
- } else {
- if (idx->num_keys == 1) {
- switch (sarg->op) {
- case MDB_EQUAL:
- return 2; break;
- case MDB_LIKE:
- return 5; break;
- case MDB_ISNULL:
- return 12; break;
- default:
- return 10; break;
- }
- } else {
- switch (sarg->op) {
- case MDB_EQUAL:
- if (not_all_equal) return 3;
- else return 2;
- break;
- case MDB_LIKE:
- return 7; break;
- case MDB_ISNULL:
- return 12; break;
- default:
- return 11; break;
- }
- }
- }
- return 0;
-}
-/*
- * choose_index runs mdb_index_compute_cost for each available index and picks
- * the best.
- *
- * Returns strategy to use (table scan, or index scan)
- */
-MdbStrategy
-mdb_choose_index(MdbTableDef *table, int *choice)
-{
- unsigned int i;
- MdbIndex *idx;
- int cost = 0;
- int least = 99;
-
- *choice = -1;
- for (i=0;i<table->num_idxs;i++) {
- idx = g_ptr_array_index (table->indices, i);
- cost = mdb_index_compute_cost(table, idx);
- //printf("cost for %s is %d\n", idx->name, cost);
- if (cost && cost < least) {
- least = cost;
- *choice = i;
- }
- }
- /* and the winner is: *choice */
- if (least==99) return MDB_TABLE_SCAN;
- return MDB_INDEX_SCAN;
-}
-void
-mdb_index_scan_init(MdbHandle *mdb, MdbTableDef *table)
-{
- int i;
-
- if (mdb_get_option(MDB_USE_INDEX) && mdb_choose_index(table, &i) == MDB_INDEX_SCAN) {
- table->strategy = MDB_INDEX_SCAN;
- table->scan_idx = g_ptr_array_index (table->indices, i);
- table->chain = g_malloc0(sizeof(MdbIndexChain));
- table->mdbidx = mdb_clone_handle(mdb);
- mdb_read_pg(table->mdbidx, table->scan_idx->first_pg);
- //printf("best index is %s\n",table->scan_idx->name);
- }
- //printf("TABLE SCAN? %d\n", table->strategy);
-}
-void
-mdb_index_scan_free(MdbTableDef *table)
-{
- if (table->chain) {
- g_free(table->chain);
- table->chain = NULL;
- }
- if (table->mdbidx) {
- mdb_close(table->mdbidx);
- table->mdbidx = NULL;
- }
-}
-
-void mdb_free_indices(GPtrArray *indices)
-{
- unsigned int i;
-
- if (!indices) return;
- for (i=0; i<indices->len; i++)
- g_free (g_ptr_array_index(indices, i));
- g_ptr_array_free(indices, TRUE);
-}
+++ /dev/null
-/* MDB Tools - A library for reading MS Access database file
- * Copyright (C) 2000 Brian Bruns
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library 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
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#include "mdbtools.h"
-
-#ifdef DMALLOC
-#include "dmalloc.h"
-#endif
-
-
-/*
-** Note: This code is mostly garbage right now...just a test to parse out the
-** KKD structures.
-*/
-
-GArray *mdb_get_column_props(MdbCatalogEntry *entry, int start)
-{
-int pos, cnt=0;
-int len, tmp, cplen;
-MdbColumnProp prop;
-MdbHandle *mdb = entry->mdb;
-
- entry->props = g_array_new(FALSE,FALSE,sizeof(MdbColumnProp));
- len = mdb_pg_get_int16(mdb,start);
- pos = start + 6;
- while (pos < start+len) {
- tmp = mdb_pg_get_int16(mdb,pos); /* length of string */
- pos += 2;
- cplen = tmp > MDB_MAX_OBJ_NAME ? MDB_MAX_OBJ_NAME : tmp;
- g_memmove(prop.name,&mdb->pg_buf[pos],cplen);
- prop.name[cplen]='\0';
- pos += tmp;
- g_array_append_val(entry->props, prop.name);
- cnt++;
- }
- entry->num_props = cnt;
- return entry->props;
-}
-
-GHashTable *mdb_get_column_def(MdbCatalogEntry *entry, int start)
-{
-GHashTable *hash = NULL;
-MdbHandle *mdb = entry->mdb;
-MdbColumnProp prop;
-int tmp, pos, col_num, val_len, i;
-int len, col_type;
-unsigned char c;
-int end;
-
- fprintf(stdout,"\n data\n");
- fprintf(stdout,"-------\n");
- len = mdb_pg_get_int16(mdb,start);
- fprintf(stdout,"length = %3d\n",len);
- pos = start + 6;
- end = start + len;
- while (pos < end) {
- fprintf(stdout,"pos = %3d\n",pos);
- start = pos;
- tmp = mdb_pg_get_int16(mdb,pos); /* length of field */
- pos += 2;
- col_type = mdb_pg_get_int16(mdb,pos); /* ??? */
- pos += 2;
- col_num = 0;
- if (col_type) {
- col_num = mdb_pg_get_int16(mdb,pos);
- pos += 2;
- }
- val_len = mdb_pg_get_int16(mdb,pos);
- pos += 2;
- fprintf(stdout,"length = %3d %04x %2d %2d ",tmp, col_type, col_num, val_len);
- for (i=0;i<val_len;i++) {
- c = mdb->pg_buf[pos+i];
- if (isprint(c))
- fprintf(stdout," %c",c);
- else
- fprintf(stdout," %02x",c);
-
- }
- pos = start + tmp;
- prop = g_array_index(entry->props,MdbColumnProp,col_num);
- fprintf(stdout," Property %s",prop.name);
- fprintf(stdout,"\n");
- }
- return hash;
-}
-void mdb_kkd_dump(MdbCatalogEntry *entry)
-{
-int rows;
-int kkd_start, kkd_end;
-int i, tmp, pos, row_type, datapos=0;
-MdbColumnProp prop;
-MdbHandle *mdb = entry->mdb;
-int rowid = entry->kkd_rowid;
-
-
- mdb_read_pg(mdb, entry->kkd_pg);
- rows = mdb_pg_get_int16(mdb,8);
- fprintf(stdout,"number of rows = %d\n",rows);
- kkd_start = mdb_pg_get_int16(mdb,10+rowid*2);
- fprintf(stdout,"kkd start = %d %04x\n",kkd_start,kkd_start);
- kkd_end = mdb->fmt->pg_size;
- for (i=0;i<rows;i++) {
- tmp = mdb_pg_get_int16(mdb, 10+i*2);
- if (tmp < mdb->fmt->pg_size &&
- tmp > kkd_start &&
- tmp < kkd_end) {
- kkd_end = tmp;
- }
- }
- fprintf(stdout,"kkd end = %d %04x\n",kkd_end,kkd_end);
- pos = kkd_start + 4; /* 4 = K K D \0 */
- while (pos < kkd_end) {
- tmp = mdb_pg_get_int16(mdb,pos);
- row_type = mdb_pg_get_int16(mdb,pos+4);
- fprintf(stdout,"row size = %3d type = 0x%02x\n",tmp,row_type);
- if (row_type==0x80) {
- fprintf(stdout,"\nColumn Properties\n");
- fprintf(stdout,"-----------------\n");
- mdb_get_column_props(entry,pos);
- for (i=0;i<entry->num_props;i++) {
- prop = g_array_index(entry->props,MdbColumnProp,i);
- fprintf(stdout,"%3d %s\n",i,prop.name);
- }
- }
- if (row_type==0x01) datapos = pos;
- pos += tmp;
- }
-
- if (datapos) {
- mdb_get_column_def(entry, datapos);
- }
-}
-
+++ /dev/null
-/* MDB Tools - A library for reading MS Access database file
- * Copyright (C) 2000 Brian Bruns
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library 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
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#include <stdio.h>
-#include <string.h>
-#include <mdbtools.h>
-
-#ifdef DMALLOC
-#include "dmalloc.h"
-#endif
-
-/**
- * mdb_like_cmp
- * @s: String to search within.
- * @r: Search pattern.
- *
- * Tests the string @s to see if it matches the search pattern @r. In the
- * search pattern, a percent sign indicates matching on any number of
- * characters, and an underscore indicates matching any single character.
- *
- * Returns: 1 if the string matches, 0 if the string does not match.
- */
-int mdb_like_cmp(char *s, char *r)
-{
- unsigned int i;
- int ret;
-
- mdb_debug(MDB_DEBUG_LIKE, "comparing %s and %s", s, r);
- switch (r[0]) {
- case '\0':
- if (s[0]=='\0') {
- return 1;
- } else {
- return 0;
- }
- case '_':
- /* skip one character */
- return mdb_like_cmp(&s[1],&r[1]);
- case '%':
- /* skip any number of characters */
- /* the strlen(s)+1 is important so the next call can */
- /* if there are trailing characters */
- for(i=0;i<strlen(s)+1;i++) {
- if (mdb_like_cmp(&s[i],&r[1])) {
- return 1;
- }
- }
- return 0;
- default:
- for(i=0;i<strlen(r);i++) {
- if (r[i]=='_' || r[i]=='%') break;
- }
- if (strncmp(s,r,i)) {
- return 0;
- } else {
- mdb_debug(MDB_DEBUG_LIKE, "at pos %d comparing %s and %s", i, &s[i], &r[i]);
- ret = mdb_like_cmp(&s[i],&r[i]);
- mdb_debug(MDB_DEBUG_LIKE, "returning %d (%s and %s)", ret, &s[i], &r[i]);
- return ret;
- }
- }
-}
+++ /dev/null
-/* MDB Tools - A library for reading MS Access database file
- * Copyright (C) 2000 Brian Bruns
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library 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
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#include "mdbtools.h"
-
-#ifdef DMALLOC
-#include "dmalloc.h"
-#endif
-
-static guint32
-mdb_map_find_next0(MdbHandle *mdb, unsigned char *map, unsigned int map_sz, guint32 start_pg)
-{
- guint32 pgnum, i, usage_bitlen;
- unsigned char *usage_bitmap;
-
- pgnum = mdb_get_int32(map, 1);
- usage_bitmap = map + 5;
- usage_bitlen = (map_sz - 5) * 8;
-
- i = (start_pg >= pgnum) ? start_pg-pgnum+1 : 0;
- for (; i<usage_bitlen; i++) {
- if (usage_bitmap[i/8] & (1 << (i%8))) {
- return pgnum + i;
- }
- }
- /* didn't find anything */
- return 0;
-}
-static int
-mdb_map_find_next1(MdbHandle *mdb, unsigned char *map, unsigned int map_sz, guint32 start_pg)
-{
- guint32 map_ind, max_map_pgs, offset, usage_bitlen;
-
- /*
- * start_pg will tell us where to (re)start the scan
- * for the next data page. each usage_map entry points to a
- * 0x05 page which bitmaps (mdb->fmt->pg_size - 4) * 8 pages.
- *
- * map_ind gives us the starting usage_map entry
- * offset gives us a page offset into the bitmap
- */
- usage_bitlen = (mdb->fmt->pg_size - 4) * 8;
- max_map_pgs = (map_sz - 1) / 4;
- map_ind = (start_pg + 1) / usage_bitlen;
- offset = (start_pg + 1) % usage_bitlen;
-
- for (; map_ind<max_map_pgs; map_ind++) {
- unsigned char *usage_bitmap;
- guint32 i, map_pg;
-
- if (!(map_pg = mdb_get_int32(map, (map_ind*4)+1))) {
- continue;
- }
- if(mdb_read_alt_pg(mdb, map_pg) != mdb->fmt->pg_size) {
- fprintf(stderr, "Oops! didn't get a full page at %d\n", map_pg);
- exit(1);
- }
-
- usage_bitmap = mdb->alt_pg_buf + 4;
- for (i=offset; i<usage_bitlen; i++) {
- if (usage_bitmap[i/8] & (1 << (i%8))) {
- return map_ind*usage_bitlen + i;
- }
- }
- offset = 0;
- }
- /* didn't find anything */
- return 0;
-}
-guint32
-mdb_map_find_next(MdbHandle *mdb, unsigned char *map, unsigned int map_sz, guint32 start_pg)
-{
- if (map[0] == 0) {
- return mdb_map_find_next0(mdb, map, map_sz, start_pg);
- } else if (map[0] == 1) {
- return mdb_map_find_next1(mdb, map, map_sz, start_pg);
- }
-
- fprintf(stderr, "Warning: unrecognized usage map type: %d\n", map[0]);
- return -1;
-}
-guint32
-mdb_alloc_page(MdbTableDef *table)
-{
- printf("Allocating new page\n");
- return 0;
-}
-guint32
-mdb_map_find_next_freepage(MdbTableDef *table, int row_size)
-{
- MdbCatalogEntry *entry = table->entry;
- MdbHandle *mdb = entry->mdb;
- guint32 pgnum;
- guint32 cur_pg = 0;
- int free_space;
-
- do {
- pgnum = mdb_map_find_next(mdb,
- table->free_usage_map,
- table->freemap_sz, cur_pg);
- printf("looking at page %d\n", pgnum);
- if (!pgnum) {
- /* allocate new page */
- pgnum = mdb_alloc_page(table);
- return pgnum;
- }
- cur_pg = pgnum;
-
- mdb_read_pg(mdb, pgnum);
- free_space = mdb_pg_get_freespace(mdb);
-
- } while (free_space < row_size);
-
- printf("page %d has %d bytes left\n", pgnum, free_space);
-
- return pgnum;
-}
+++ /dev/null
-/* MDB Tools - A library for reading MS Access database files
- * Copyright (C) 2000 Brian Bruns
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library 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
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#include "mdbtools.h"
-#include <locale.h>
-
-#ifdef DMALLOC
-#include "dmalloc.h"
-#endif
-
-/**
- * mdb_init:
- *
- * Initializes the LibMDB library. This function should be called exactly once
- * by calling program and prior to any other function.
- *
- **/
-void mdb_init(void)
-{
- mdb_init_backends();
-}
-
-/**
- * mdb_exit:
- *
- * Cleans up the LibMDB library. This function should be called exactly once
- * by the calling program prior to exiting (or prior to final use of LibMDB
- * functions).
- *
- **/
-void mdb_exit(void)
-{
- mdb_remove_backends();
-}
+++ /dev/null
-/* MDB Tools - A library for reading MS Access database file
- * Copyright (C) 1998-1999 Brian Bruns
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library 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
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#include <stdio.h>
-#include "mdbtools.h"
-
-#ifdef DMALLOC
-#include "dmalloc.h"
-#endif
-
-#define MAXPRECISION 20
-/*
-** these routines are copied from the freetds project which does something
-** very similiar
-*/
-
-static int multiply_byte(unsigned char *product, int num, unsigned char *multiplier);
-static int do_carry(unsigned char *product);
-static char *array_to_string(unsigned char *array, int unsigned scale, char *s);
-
-/**
- * mdb_money_to_string
- * @mdb: Handle to open MDB database file
- * @start: Offset of the field within the current page
- * @s: String that will receieve the value
- *
- * Returns: the string that has received the value.
- */
-char *mdb_money_to_string(MdbHandle *mdb, int start, char *s)
-{
- int num_bytes = 8;
- int i;
- int neg=0;
- unsigned char multiplier[MAXPRECISION], temp[MAXPRECISION];
- unsigned char product[MAXPRECISION];
- unsigned char money[num_bytes];
-
- memset(multiplier,0,MAXPRECISION);
- memset(product,0,MAXPRECISION);
- multiplier[0]=1;
- memcpy(money, mdb->pg_buf + start, num_bytes);
-
- /* Perform two's complement for negative numbers */
- if (money[7] & 0x80) {
- neg = 1;
- for (i=0;i<num_bytes;i++) {
- money[i] = ~money[i];
- }
- for (i=0; i<num_bytes; i++) {
- money[i] ++;
- if (money[i]!=0) break;
- }
- }
-
- for (i=0;i<num_bytes;i++) {
- /* product += multiplier * current byte */
- multiply_byte(product, money[i], multiplier);
-
- /* multiplier = multiplier * 256 */
- memcpy(temp, multiplier, MAXPRECISION);
- memset(multiplier,0,MAXPRECISION);
- multiply_byte(multiplier, 256, temp);
- }
- if (neg) {
- s[0]='-';
- array_to_string(product, 4, &s[1]);
- } else {
- array_to_string(product, 4, s);
- }
- return s;
-}
-static int multiply_byte(unsigned char *product, int num, unsigned char *multiplier)
-{
- unsigned char number[3];
- unsigned int i, j;
-
- number[0]=num%10;
- number[1]=(num/10)%10;
- number[2]=(num/100)%10;
-
- for (i=0;i<MAXPRECISION;i++) {
- if (multiplier[i] == 0) continue;
- for (j=0;j<3;j++) {
- if (number[j] == 0) continue;
- product[i+j] += multiplier[i]*number[j];
- }
- do_carry(product);
- }
- return 0;
-}
-static int do_carry(unsigned char *product)
-{
- unsigned int j;
-
- for (j=0;j<MAXPRECISION-1;j++) {
- if (product[j]>9) {
- product[j+1]+=product[j]/10;
- product[j]=product[j]%10;
- }
- }
- if (product[j]>9) {
- product[j]=product[j]%10;
- }
- return 0;
-}
-static char *array_to_string(unsigned char *array, unsigned int scale, char *s)
-{
- unsigned int top, i, j=0;
-
- for (top=MAXPRECISION;(top>0) && (top-1>scale) && !array[top-1];top--);
-
- if (top == 0) {
- s[j++] = '0';
- } else {
- for (i=top; i>0; i--) {
- if (j == top-scale) s[j++]='.';
- s[j++]=array[i-1]+'0';
- }
- }
- s[j]='\0';
-
- return s;
-}
+++ /dev/null
-/* MDB Tools - A library for reading MS Access database file
- * Copyright (C) 2004 Brian Bruns
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library 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
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#include <stdio.h>
-#include <string.h>
-#include <stdarg.h>
-#include <stdlib.h>
-
-#include <mdbtools.h>
-
-#ifdef DMALLOC
-#include "dmalloc.h"
-#endif
-
-#define DEBUG 1
-
-static unsigned long opts;
-static int optset;
-
-static void load_options();
-
-void
-mdb_debug(int klass, char *fmt, ...)
-{
-#ifdef DEBUG
- va_list ap;
-
- if (!optset) load_options();
- if (klass & opts) {
- va_start(ap, fmt);
- vfprintf (stdout,fmt, ap);
- va_end(ap);
- fprintf(stdout,"\n");
- }
-#endif
-}
-
-static void
-load_options()
-{
- char *opt;
- char *s;
-
- if (!optset && (s=getenv("MDBOPTS"))) {
- opt = strtok(s, ":");
- do {
- if (!strcmp(opt, "use_index")) opts |= MDB_USE_INDEX;
- if (!strcmp(opt, "debug_like")) opts |= MDB_DEBUG_LIKE;
- if (!strcmp(opt, "debug_write")) opts |= MDB_DEBUG_WRITE;
- if (!strcmp(opt, "debug_usage")) opts |= MDB_DEBUG_USAGE;
- if (!strcmp(opt, "debug_ole")) opts |= MDB_DEBUG_OLE;
- if (!strcmp(opt, "debug_row")) opts |= MDB_DEBUG_ROW;
- if (!strcmp(opt, "debug_all")) {
- opts |= MDB_DEBUG_LIKE;
- opts |= MDB_DEBUG_WRITE;
- opts |= MDB_DEBUG_USAGE;
- opts |= MDB_DEBUG_OLE;
- opts |= MDB_DEBUG_ROW;
- }
- opt = strtok(NULL,":");
- } while (opt);
- }
- optset = 1;
-}
-int
-mdb_get_option(unsigned long optnum)
-{
- if (!optset) load_options();
- return ((opts & optnum) > 0);
-}
+++ /dev/null
-/* MDB Tools - A library for reading MS Access database file
- * Copyright (C) 2000 Brian Bruns
- *
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library 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
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#include "mdbtools.h"
-
-GPtrArray *
-mdb_read_props_list(gchar *kkd, int len)
-{
- guint32 record_len;
- int pos = 0;
- gchar *name;
- GPtrArray *names = NULL;
- int i = 0;
-
- names = g_ptr_array_new();
-#ifdef MDB_DEBUG
- buffer_dump(kkd, 0, len - 1);
-#endif
- pos = 0;
- while (pos < len) {
- record_len = mdb_get_int16(kkd, pos);
- pos += 2;
-#ifdef MDB_DEBUG
- printf("%02d ",i++);
- buffer_dump(kkd, pos - 2, pos + record_len - 1);
-#endif
- name = g_malloc(record_len + 1);
- strncpy(name, &kkd[pos], record_len);
- name[record_len] = '\0';
- pos += record_len;
- g_ptr_array_add(names, name);
-#ifdef MDB_DEBUG
- printf("new len = %d\n", names->len);
-#endif
- }
- return names;
-}
-void
-mdb_free_props(MdbProperties *props)
-{
- if (!props) return;
-
- if (props->name) g_free(props->name);
- g_free(props);
-}
-MdbProperties *
-mdb_alloc_props()
-{
- MdbProperties *props;
-
- props = g_malloc0(sizeof(MdbProperties));
-
- return props;
-}
-MdbProperties *
-mdb_read_props(MdbHandle *mdb, GPtrArray *names, gchar *kkd, int len)
-{
- guint32 record_len, name_len;
- int pos = 0;
- int elem, dtype, dsize;
- gchar *name, *value;
- MdbProperties *props;
- int i = 0;
-
-#ifdef MDB_DEBUG
- buffer_dump(kkd, 0, len - 1);
-#endif
- pos = 0;
-
- /* skip the name record */
- record_len = mdb_get_int16(kkd, pos);
- pos += 4;
- name_len = mdb_get_int16(kkd, pos);
- pos += 2;
- props = mdb_alloc_props();
- if (name_len) {
- props->name = g_malloc(name_len + 1);
- strncpy(props->name, &kkd[pos], name_len);
- props->name[name_len]='\0';
- }
- pos += name_len;
-
- props->hash = g_hash_table_new(g_str_hash, g_str_equal);
-
- while (pos < len) {
- record_len = mdb_get_int16(kkd, pos);
- elem = mdb_get_int16(kkd, pos + 4);
- dtype = kkd[pos + 3];
- dsize = mdb_get_int16(kkd, pos + 6);
- value = g_malloc(dsize + 1);
- strncpy(value, &kkd[pos + 8], dsize);
- value[dsize] = '\0';
- name = g_ptr_array_index(names,elem);
-#ifdef MDB_DEBUG
- printf("%02d ",i++);
- buffer_dump(kkd, pos, pos + record_len - 1);
- printf("elem %d dsize %d dtype %d\n", elem, dsize, dtype);
-#endif
- if (dtype == MDB_MEMO) dtype = MDB_TEXT;
- if (dtype == MDB_BOOL) {
- g_hash_table_insert(props->hash, g_strdup(name), g_strdup(kkd[pos + 8] ? "yes" : "no"));
- } else {
- g_hash_table_insert(props->hash, g_strdup(name), g_strdup(mdb_col_to_string(mdb, kkd, pos + 8, dtype, dsize)));
- }
- g_free(value);
- pos += record_len;
- }
- return props;
-
-}
+++ /dev/null
-/* MDB Tools - A library for reading MS Access database file
- * Copyright (C) 2000 Brian Bruns
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library 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
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-/*
- * code for handling searchable arguments (sargs) used primary by the sql
- * engine to support where clause handling. The sargs are configured in
- * a tree with AND/OR operators connecting the child nodes. NOT operations
- * have only one child on the left side. Logical operators (=,<,>,etc..)
- * have no children.
- *
- * datatype support is a bit weak at this point. To add more types create
- * a mdb_test_[type]() function and invoke it from mdb_test_sarg()
- */
-#include "mdbtools.h"
-
-#ifdef DMALLOC
-#include "dmalloc.h"
-#endif
-
-void
-mdb_sql_walk_tree(MdbSargNode *node, MdbSargTreeFunc func, gpointer data)
-{
- if (func(node, data))
- return;
- if (node->left) mdb_sql_walk_tree(node->left, func, data);
- if (node->right) mdb_sql_walk_tree(node->right, func, data);
-}
-int
-mdb_test_string(MdbSargNode *node, char *s)
-{
-int rc;
-
- if (node->op == MDB_LIKE) {
- return mdb_like_cmp(s,node->value.s);
- }
- rc = strncmp(node->value.s, s, 255);
- switch (node->op) {
- case MDB_EQUAL:
- if (rc==0) return 1;
- break;
- case MDB_GT:
- if (rc<0) return 1;
- break;
- case MDB_LT:
- if (rc>0) return 1;
- break;
- case MDB_GTEQ:
- if (rc<=0) return 1;
- break;
- case MDB_LTEQ:
- if (rc>=0) return 1;
- break;
- default:
- fprintf(stderr, "Calling mdb_test_sarg on unknown operator. Add code to mdb_test_string() for operator %d\n",node->op);
- break;
- }
- return 0;
-}
-int mdb_test_int(MdbSargNode *node, gint32 i)
-{
- switch (node->op) {
- case MDB_EQUAL:
- printf("comparing %x and %x %d\n", i, node->value.i, node->value.i == i);
- if (node->value.i == i) return 1;
- break;
- case MDB_GT:
- if (node->value.i < i) return 1;
- break;
- case MDB_LT:
- if (node->value.i > i) return 1;
- break;
- case MDB_GTEQ:
- if (node->value.i <= i) return 1;
- break;
- case MDB_LTEQ:
- if (node->value.i >= i) return 1;
- break;
- default:
- fprintf(stderr, "Calling mdb_test_sarg on unknown operator. Add code to mdb_test_int() for operator %d\n",node->op);
- break;
- }
- return 0;
-}
-#if 0
-#endif
-int
-mdb_find_indexable_sargs(MdbSargNode *node, gpointer data)
-{
- MdbSarg sarg;
-
- if (node->op == MDB_OR || node->op == MDB_NOT) return 1;
-
- /*
- * right now all we do is look for sargs that are anded together from
- * the root. Later we may put together OR ops into a range, and then
- * range scan the leaf pages. That is col1 = 2 or col1 = 4 becomes
- * col1 >= 2 and col1 <= 4 for the purpose of index scans, and then
- * extra rows are thrown out when the row is tested against the main
- * sarg tree. range scans are generally only a bit better than table
- * scanning anyway.
- *
- * also, later we should support the NOT operator, but it's generally
- * a pretty worthless test for indexes, ie NOT col1 = 3, we are
- * probably better off table scanning.
- */
- if (mdb_is_relational_op(node->op) && node->col) {
- //printf("op = %d value = %s\n", node->op, node->value.s);
- sarg.op = node->op;
- sarg.value = node->value;
- mdb_add_sarg(node->col, &sarg);
- }
- return 0;
-}
-int
-mdb_test_sarg(MdbHandle *mdb, MdbColumn *col, MdbSargNode *node, MdbField *field)
-{
-char tmpbuf[256];
-int lastchar;
-
- if (node->op == MDB_ISNULL) {
- if (field->is_null) return 0;
- else return 1;
- } else if (node->op == MDB_NOTNULL) {
- if (field->is_null) return 1;
- else return 0;
- }
- switch (col->col_type) {
- case MDB_BOOL:
- return mdb_test_int(node, !field->is_null);
- break;
- case MDB_BYTE:
- return mdb_test_int(node, (gint32)((char *)field->value)[0]);
- break;
- case MDB_INT:
- return mdb_test_int(node, (gint32)mdb_get_int16(field->value, 0));
- break;
- case MDB_LONGINT:
- return mdb_test_int(node, (gint32)mdb_get_int32(field->value, 0));
- break;
- case MDB_TEXT:
- if (IS_JET4(mdb)) {
- mdb_unicode2ascii(mdb, field->value, 0, field->siz, tmpbuf);
- } else {
- strncpy(tmpbuf, field->value, 255);
- lastchar = field->siz > 255 ? 255 : field->siz;
- tmpbuf[lastchar]='\0';
- }
- return mdb_test_string(node, tmpbuf);
- default:
- fprintf(stderr, "Calling mdb_test_sarg on unknown type. Add code to mdb_test_sarg() for type %d\n",col->col_type);
- break;
- }
- return 1;
-}
-int
-mdb_find_field(int col_num, MdbField *fields, int num_fields)
-{
- int i;
-
- for (i=0;i<num_fields;i++) {
- if (fields[i].colnum == col_num) return i;
- }
- return -1;
-}
-int
-mdb_test_sarg_node(MdbHandle *mdb, MdbSargNode *node, MdbField *fields, int num_fields)
-{
- int elem;
- MdbColumn *col;
- int rc;
-
- if (mdb_is_relational_op(node->op)) {
- col = node->col;
- /* for const = const expressions */
- if (!col) {
- return (node->value.i);
- }
- elem = mdb_find_field(col->col_num, fields, num_fields);
- if (!mdb_test_sarg(mdb, col, node, &fields[elem]))
- return 0;
- } else { /* logical op */
- switch (node->op) {
- case MDB_NOT:
- rc = mdb_test_sarg_node(mdb, node->left, fields, num_fields);
- return !rc;
- break;
- case MDB_AND:
- if (!mdb_test_sarg_node(mdb, node->left, fields, num_fields))
- return 0;
- return mdb_test_sarg_node(mdb, node->right, fields, num_fields);
- break;
- case MDB_OR:
- if (mdb_test_sarg_node(mdb, node->left, fields, num_fields))
- return 1;
- return mdb_test_sarg_node(mdb, node->right, fields, num_fields);
- break;
- }
- }
- return 1;
-}
-int
-mdb_test_sargs(MdbTableDef *table, MdbField *fields, int num_fields)
-{
- MdbSargNode *node;
- MdbCatalogEntry *entry = table->entry;
- MdbHandle *mdb = entry->mdb;
-
- node = table->sarg_tree;
-
- /* there may not be a sarg tree */
- if (!node) return 1;
-
- return mdb_test_sarg_node(mdb, node, fields, num_fields);
-}
-#if 0
-int mdb_test_sargs(MdbHandle *mdb, MdbColumn *col, int offset, int len)
-{
-MdbSarg *sarg;
-int i;
-
- for (i=0;i<col->num_sargs;i++) {
- sarg = g_ptr_array_index (col->sargs, i);
- if (!mdb_test_sarg(mdb, col, sarg, offset, len)) {
- /* sarg didn't match, no sense going on */
- return 0;
- }
- }
-
- return 1;
-}
-#endif
-int mdb_add_sarg(MdbColumn *col, MdbSarg *in_sarg)
-{
-MdbSarg *sarg;
- if (!col->sargs) {
- col->sargs = g_ptr_array_new();
- }
- sarg = g_memdup(in_sarg,sizeof(MdbSarg));
- g_ptr_array_add(col->sargs, sarg);
- col->num_sargs++;
-
- return 1;
-}
-int mdb_add_sarg_by_name(MdbTableDef *table, char *colname, MdbSarg *in_sarg)
-{
- MdbColumn *col;
- unsigned int i;
-
- for (i=0;i<table->num_cols;i++) {
- col = g_ptr_array_index (table->columns, i);
- if (!strcasecmp(col->name,colname)) {
- return mdb_add_sarg(col, in_sarg);
- }
- }
- /* else didn't find the column return 0! */
- return 0;
-}
+++ /dev/null
-/* MDB Tools - A library for reading MS Access database files
- * Copyright (C) 2000 Brian Bruns
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library 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
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#include "mdbtools.h"
-
-#ifdef DMALLOC
-#include "dmalloc.h"
-#endif
-
-/**
- * mdb_stats_on:
- * @mdb: Handle to the (open) MDB file to collect stats on.
- *
- * Begins collection of statistics on an MDBHandle.
- *
- * Statistics in LibMDB will track the number of reads from the MDB file. The
- * collection of statistics is started and stopped with the mdb_stats_on and
- * mdb_stats_off functions. Collected statistics are accessed by reading the
- * MdbStatistics structure or calling mdb_dump_stats.
- *
- */
-void
-mdb_stats_on(MdbHandle *mdb)
-{
- if (!mdb->stats)
- mdb->stats = g_malloc0(sizeof(MdbStatistics));
-
- mdb->stats->collect = TRUE;
-}
-/**
- * mdb_stats_off:
- * @mdb: pointer to handle of MDB file with active stats collection.
- *
- * Turns off statistics collection.
- *
- * If mdb_stats_off is not called, statistics will be turned off when handle
- * is freed using mdb_close.
- **/
-void
-mdb_stats_off(MdbHandle *mdb)
-{
- if (!mdb->stats) return;
-
- mdb->stats->collect = FALSE;
-}
-/**
- * mdb_dump_stats:
- * @mdb: pointer to handle of MDB file with active stats collection.
- *
- * Dumps current statistics to stdout.
- **/
-void
-mdb_dump_stats(MdbHandle *mdb)
-{
- if (!mdb->stats) return;
-
- fprintf(stdout, "Physical Page Reads: %lu\n", mdb->stats->pg_reads);
-}
+++ /dev/null
-/* MDB Tools - A library for reading MS Access database file
- * Copyright (C) 2000 Brian Bruns
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library 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
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#include "mdbtools.h"
-
-#ifdef DMALLOC
-#include "dmalloc.h"
-#endif
-
-
-static gint mdb_col_comparer(MdbColumn **a, MdbColumn **b)
-{
- if ((*a)->col_num > (*b)->col_num)
- return 1;
- else if ((*a)->col_num < (*b)->col_num)
- return -1;
- else
- return 0;
-}
-
-static unsigned char mdb_col_needs_size(int col_type)
-{
- if (col_type == MDB_TEXT) {
- return TRUE;
- } else {
- return FALSE;
- }
-}
-
-MdbTableDef *mdb_alloc_tabledef(MdbCatalogEntry *entry)
-{
- MdbTableDef *table;
-
- table = (MdbTableDef *) g_malloc0(sizeof(MdbTableDef));
- table->entry=entry;
- strcpy(table->name, entry->object_name);
-
- return table;
-}
-void mdb_free_tabledef(MdbTableDef *table)
-{
- if (!table) return;
- if (table->is_temp_table) {
- unsigned int i;
- for (i=0; i<table->temp_table_pages->len; i++)
- g_free(g_ptr_array_index(table->temp_table_pages,i));
- g_ptr_array_free(table->temp_table_pages, TRUE);
- }
- mdb_free_columns(table->columns);
- mdb_free_indices(table->indices);
- g_free(table->usage_map);
- g_free(table->free_usage_map);
- g_free(table);
-}
-MdbTableDef *mdb_read_table(MdbCatalogEntry *entry)
-{
- MdbTableDef *table;
- MdbHandle *mdb = entry->mdb;
- MdbFormatConstants *fmt = mdb->fmt;
- int len, row_start, pg_row;
- char *buf;
-
- table = mdb_alloc_tabledef(entry);
-
- mdb_read_pg(mdb, entry->table_pg);
- if (mdb->pg_buf[0] != 0x02) return NULL; /* not a valid table def page */
-
- len = mdb_pg_get_int16(mdb,8);
-
- table->num_rows = mdb_pg_get_int32(mdb, fmt->tab_num_rows_offset);
- table->num_var_cols = mdb_pg_get_int16(mdb, fmt->tab_num_cols_offset-2);
- table->num_cols = mdb_pg_get_int16(mdb, fmt->tab_num_cols_offset);
- table->num_idxs = mdb_pg_get_int32(mdb, fmt->tab_num_idxs_offset);
- table->num_real_idxs = mdb_pg_get_int32(mdb, fmt->tab_num_ridxs_offset);
- /* grab a copy of the usage map */
- pg_row = mdb_pg_get_int32(mdb, fmt->tab_usage_map_offset);
- mdb_find_pg_row(mdb, pg_row, &buf, &row_start, &(table->map_sz));
- table->usage_map = g_memdup(buf + row_start, table->map_sz);
- if (mdb_get_option(MDB_DEBUG_USAGE))
- buffer_dump(buf, row_start, row_start+table->map_sz-1);
- mdb_debug(MDB_DEBUG_USAGE,"usage map found on page %ld row %d start %d len %d",
- pg_row >> 8, pg_row & 0xff, row_start, table->map_sz);
-
- /* grab a copy of the free space page map */
- pg_row = mdb_pg_get_int32(mdb, fmt->tab_free_map_offset);
- mdb_find_pg_row(mdb, pg_row, &buf, &row_start, &(table->freemap_sz));
- table->free_usage_map = g_memdup(buf + row_start, table->freemap_sz);
- mdb_debug(MDB_DEBUG_USAGE,"free map found on page %ld row %d start %d len %d\n",
- pg_row >> 8, pg_row & 0xff, row_start, table->freemap_sz);
-
- table->first_data_pg = mdb_pg_get_int16(mdb, fmt->tab_first_dpg_offset);
-
- return table;
-}
-MdbTableDef *mdb_read_table_by_name(MdbHandle *mdb, gchar *table_name, int obj_type)
-{
- unsigned int i;
- MdbCatalogEntry *entry;
-
- mdb_read_catalog(mdb, obj_type);
-
- for (i=0; i<mdb->num_catalog; i++) {
- entry = g_ptr_array_index(mdb->catalog, i);
- if (!strcasecmp(entry->object_name, table_name))
- return mdb_read_table(entry);
- }
-
- return NULL;
-}
-
-/*
-** read the next page if offset is > pg_size
-** return true if page was read
-*/
-int
-read_pg_if(MdbHandle *mdb, int *cur_pos, int offset)
-{
- if (*cur_pos + offset >= mdb->fmt->pg_size) {
- mdb_read_pg(mdb, mdb_pg_get_int32(mdb,4));
- *cur_pos = 8 - (mdb->fmt->pg_size - (*cur_pos));
- return 1;
- }
- return 0;
-}
-guint32
-read_pg_if_32(MdbHandle *mdb, int *cur_pos)
-{
- unsigned char c[4];
- int i, rc = 0;
-
- for (i=0;i<4;i++) {
- rc += read_pg_if(mdb, cur_pos, i);
- c[i] = mdb->pg_buf[(*cur_pos) + i];
- }
- return mdb_get_int32(c, 0);
-}
-guint16
-read_pg_if_16(MdbHandle *mdb, int *cur_pos)
-{
- unsigned char low_byte, high_byte;
- int rc = 0;
-
- rc += read_pg_if(mdb, cur_pos, 0);
- low_byte = mdb->pg_buf[*cur_pos];
- rc += read_pg_if(mdb, cur_pos, 1);
- high_byte = mdb->pg_buf[(*cur_pos) + 1];
-
- return (high_byte * 256 + low_byte);
-}
-guint16
-read_pg_if_n(MdbHandle *mdb, unsigned char *buf, int *cur_pos, int len)
-{
- if (*cur_pos + len < mdb->fmt->pg_size) {
- memcpy(buf, &mdb->pg_buf[*cur_pos], len);
- return 0;
- } else {
- int half = mdb->fmt->pg_size - *cur_pos;
- memcpy(buf, &mdb->pg_buf[*cur_pos], half);
- mdb_read_pg(mdb, mdb_pg_get_int32(mdb,4));
- memcpy(buf + half, &mdb->pg_buf[8], len - half);
- *cur_pos = 8 - half;
- return 1;
- }
-}
-
-void mdb_append_column(GPtrArray *columns, MdbColumn *in_col)
-{
- g_ptr_array_add(columns, g_memdup(in_col,sizeof(MdbColumn)));
-}
-void mdb_free_columns(GPtrArray *columns)
-{
- unsigned int i;
-
- if (!columns) return;
- for (i=0; i<columns->len; i++)
- g_free (g_ptr_array_index(columns, i));
- g_ptr_array_free(columns, TRUE);
-}
-GPtrArray *mdb_read_columns(MdbTableDef *table)
-{
- MdbHandle *mdb = table->entry->mdb;
- MdbFormatConstants *fmt = mdb->fmt;
- MdbColumn *pcol;
- unsigned char *col;
- unsigned int i;
- int cur_pos, name_sz;
-
- table->columns = g_ptr_array_new();
-
- col = (unsigned char *) g_malloc(fmt->tab_col_entry_size);
-
- cur_pos = fmt->tab_cols_start_offset +
- (table->num_real_idxs * fmt->tab_ridx_entry_size);
-
- /* new code based on patch submitted by Tim Nelson 2000.09.27 */
-
- /*
- ** column attributes
- */
- for (i=0;i<table->num_cols;i++) {
-#ifdef MDB_DEBUG
- /* printf("column %d\n", i);
- buffer_dump(mdb->pg_buf, cur_pos ,cur_pos + 18); */
-#endif
- read_pg_if_n(mdb, col, &cur_pos, fmt->tab_col_entry_size);
- cur_pos += fmt->tab_col_entry_size;
- pcol = (MdbColumn *) g_malloc0(sizeof(MdbColumn));
-
- pcol->col_type = col[0];
-
- // col_num_offset == 1 or 5
- pcol->col_num = col[fmt->col_num_offset];
-
- //fprintf(stdout,"----- column %d -----\n",pcol->col_num);
- // col_var == 3 or 7
- pcol->var_col_num = mdb_get_int16(col, fmt->tab_col_offset_var);
- //fprintf(stdout,"var column pos %d\n",pcol->var_col_num);
-
- // col_var == 5 or 9
- pcol->row_col_num = mdb_get_int16(col, fmt->tab_row_col_num_offset);
- //fprintf(stdout,"row column num %d\n",pcol->row_col_num);
-
- /* FIXME: can this be right in Jet3 and Jet4? */
- if (pcol->col_type == MDB_NUMERIC) {
- pcol->col_prec = col[11];
- pcol->col_scale = col[12];
- }
-
- // col_fixed_offset == 13 or 15
- pcol->is_fixed = col[fmt->col_fixed_offset] & 0x01 ? 1 : 0;
-
- // col_fixed_offset == 13 or 15
- pcol->fixed_offset = mdb_get_int16(col, fmt->tab_col_offset_fixed);
- //fprintf(stdout,"fixed column offset %d\n",pcol->fixed_offset);
- //fprintf(stdout,"col type %s\n",pcol->is_fixed ? "fixed" : "variable");
-
- if (pcol->col_type != MDB_BOOL) {
- // col_size_offset == 16 or 23
- pcol->col_size = mdb_get_int16(col, fmt->col_size_offset);
- } else {
- pcol->col_size=0;
- }
-
- g_ptr_array_add(table->columns, pcol);
- }
-
- g_free (col);
-
- /*
- ** column names - ordered the same as the column attributes table
- */
- for (i=0;i<table->num_cols;i++) {
- pcol = g_ptr_array_index(table->columns, i);
-
- if (IS_JET4(mdb)) {
- char *tmp_buf;
- name_sz = read_pg_if_16(mdb, &cur_pos);
- cur_pos += 2;
- tmp_buf = (char *) g_malloc(name_sz);
- read_pg_if_n(mdb, tmp_buf, &cur_pos, name_sz);
- mdb_unicode2ascii(mdb, tmp_buf, 0, name_sz, pcol->name);
- g_free(tmp_buf);
- cur_pos += name_sz;
- } else if (IS_JET3(mdb)) {
- read_pg_if(mdb, &cur_pos, 0);
- name_sz = mdb->pg_buf[cur_pos];
- cur_pos++;
- read_pg_if_n(mdb, pcol->name, &cur_pos, name_sz);
- pcol->name[name_sz]='\0';
- cur_pos += name_sz;
- } else {
- fprintf(stderr,"Unknown MDB version\n");
- }
- }
-
- /* Sort the columns by col_num */
- g_ptr_array_sort(table->columns, (GCompareFunc)mdb_col_comparer);
-
- table->index_start = cur_pos;
- return table->columns;
-}
-
-void mdb_table_dump(MdbCatalogEntry *entry)
-{
-MdbTableDef *table;
-MdbColumn *col;
-int coln;
-MdbIndex *idx;
-MdbHandle *mdb = entry->mdb;
-unsigned int i, bitn;
-guint32 pgnum;
-
- table = mdb_read_table(entry);
- fprintf(stdout,"definition page = %lu\n",entry->table_pg);
- fprintf(stdout,"number of datarows = %d\n",table->num_rows);
- fprintf(stdout,"number of columns = %d\n",table->num_cols);
- fprintf(stdout,"number of indices = %d\n",table->num_real_idxs);
-
- mdb_read_columns(table);
- mdb_read_indices(table);
-
- for (i=0;i<table->num_cols;i++) {
- col = g_ptr_array_index(table->columns,i);
-
- fprintf(stdout,"column %d Name: %-20s Type: %s(%d)\n",
- i, col->name,
- mdb_get_coltype_string(mdb->default_backend, col->col_type),
- col->col_size);
- }
-
- for (i=0;i<table->num_idxs;i++) {
- idx = g_ptr_array_index (table->indices, i);
- mdb_index_dump(table, idx);
- }
- if (table->usage_map) {
- printf("pages reserved by this object\n");
- printf("usage map pg %" G_GUINT32_FORMAT "\n",
- table->map_base_pg);
- printf("free map pg %" G_GUINT32_FORMAT "\n",
- table->freemap_base_pg);
- pgnum = mdb_get_int32(table->usage_map,1);
- /* the first 5 bytes of the usage map mean something */
- coln = 0;
- for (i=5;i<table->map_sz;i++) {
- for (bitn=0;bitn<8;bitn++) {
- if (table->usage_map[i] & 1 << bitn) {
- coln++;
- printf("%6" G_GUINT32_FORMAT, pgnum);
- if (coln==10) {
- printf("\n");
- coln = 0;
- } else {
- printf(" ");
- }
- }
- pgnum++;
- }
- }
- printf("\n");
- }
-}
-
-int mdb_is_user_table(MdbCatalogEntry *entry)
-{
- return ((entry->object_type == MDB_TABLE)
- && !(entry->flags & 0x80000002)) ? 1 : 0;
-}
-int mdb_is_system_table(MdbCatalogEntry *entry)
-{
- return ((entry->object_type == MDB_TABLE)
- && (entry->flags & 0x80000002)) ? 1 : 0;
-}
+++ /dev/null
-/* MDB Tools - A library for reading MS Access database files
- * Copyright (C) 2004 Brian Bruns
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library 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
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#include "mdbtools.h"
-
-#ifdef DMALLOC
-#include "dmalloc.h"
-#endif
-
-/*
- * Temp table routines. These are currently used to generate mock results for
- * commands like "list tables" and "describe table"
- */
-
-void
-mdb_fill_temp_col(MdbColumn *tcol, char *col_name, int col_size, int col_type, int is_fixed)
-{
- memset(tcol,0,sizeof(MdbColumn));
- strcpy(tcol->name, col_name);
- tcol->col_type = col_type;
- if ((col_type == MDB_TEXT) || (col_type == MDB_MEMO)) {
- tcol->col_size = col_size;
- } else {
- tcol->col_size = mdb_col_fixed_size(tcol);
- }
- tcol->is_fixed = is_fixed;
-}
-void
-mdb_fill_temp_field(MdbField *field, void *value, int siz, int is_fixed, int is_null, int start, int colnum)
-{
- field->value = value;
- field->siz = siz;
- field->is_fixed = is_fixed;
- field->is_null = is_null;
- field->start = start;
- field->colnum = colnum;
-}
-MdbTableDef *
-mdb_create_temp_table(MdbHandle *mdb, char *name)
-{
- MdbCatalogEntry *entry;
- MdbTableDef *table;
-
- /* dummy up a catalog entry */
- entry = (MdbCatalogEntry *) g_malloc0(sizeof(MdbCatalogEntry));
- entry->mdb = mdb;
- entry->object_type = MDB_TABLE;
- entry->table_pg = 0;
- strcpy(entry->object_name, name);
-
- table = mdb_alloc_tabledef(entry);
- table->columns = g_ptr_array_new();
- table->is_temp_table = 1;
- table->temp_table_pages = g_ptr_array_new();
-
- return table;
-}
-void
-mdb_temp_table_add_col(MdbTableDef *table, MdbColumn *col)
-{
- col->col_num = table->num_cols;
- if (!col->is_fixed)
- col->var_col_num = table->num_var_cols++;
- g_ptr_array_add(table->columns, g_memdup(col, sizeof(MdbColumn)));
- table->num_cols++;
-}
-/*
- * Should be called after setting up all temp table columns
- */
-void mdb_temp_columns_end(MdbTableDef *table)
-{
- MdbColumn *col;
- unsigned int i;
- unsigned int start = 0;
-
- for (i=0; i<table->num_cols; i++) {
- col = g_ptr_array_index(table->columns, i);
- if (col->is_fixed) {
- col->fixed_offset = start;
- start += col->col_size;
- }
- }
-}
+++ /dev/null
-/* MDB Tools - A library for reading MS Access database file
- * Copyright (C) 2000 Brian Bruns
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library 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
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#include "mdbtools.h"
-#include "time.h"
-#include "math.h"
-
-#ifdef DMALLOC
-#include "dmalloc.h"
-#endif
-
-
-//static int mdb_copy_index_pg(MdbTableDef *table, MdbIndex *idx, MdbIndexPage *ipg);
-static int mdb_add_row_to_leaf_pg(MdbTableDef *table, MdbIndex *idx, MdbIndexPage *ipg, MdbField *idx_fields);
-
-void
-_mdb_put_int16(unsigned char *buf, guint32 offset, guint32 value)
-{
- buf[offset] = value % 256;
- value /= 256;
- buf[offset+1] = value % 256;
-}
-void
-_mdb_put_int32(unsigned char *buf, guint32 offset, guint32 value)
-{
- buf[offset] = value % 256;
- value /= 256;
- buf[offset+1] = value % 256;
- value /= 256;
- buf[offset+2] = value % 256;
- value /= 256;
- buf[offset+3] = value % 256;
-}
-ssize_t
-mdb_write_pg(MdbHandle *mdb, unsigned long pg)
-{
- ssize_t len;
- struct stat status;
- off_t offset = pg * mdb->fmt->pg_size;
-
- fstat(mdb->f->fd, &status);
- /* is page beyond current size + 1 ? */
- if (status.st_size < offset + mdb->fmt->pg_size) {
- fprintf(stderr,"offset %lu is beyond EOF\n",offset);
- return 0;
- }
- lseek(mdb->f->fd, offset, SEEK_SET);
- len = write(mdb->f->fd,mdb->pg_buf,mdb->fmt->pg_size);
- if (len==-1) {
- perror("write");
- return 0;
- } else if (len<mdb->fmt->pg_size) {
- /* fprintf(stderr,"EOF reached %d bytes returned.\n",len, mdb->pg_size); */
- return 0;
- }
- mdb->cur_pos = 0;
- return len;
-}
-
-static int
-mdb_is_col_indexed(MdbTableDef *table, int colnum)
-{
- unsigned int i, j;
- MdbIndex *idx;
-
- for (i=0;i<table->num_idxs;i++) {
- idx = g_ptr_array_index (table->indices, i);
- for (j=0;j<idx->num_keys;j++) {
- if (idx->key_col_num[j]==colnum) return 1;
- }
- }
- return 0;
-}
-static int
-mdb_crack_row4(MdbTableDef *table, int row_start, int row_end, MdbField *fields)
-{
- MdbCatalogEntry *entry = table->entry;
- MdbHandle *mdb = entry->mdb;
- MdbColumn *col;
- unsigned char *pg_buf = mdb->pg_buf;
- unsigned int i;
- unsigned int row_var_cols=0, row_fixed_cols, row_cols;
- unsigned int fixed_cols_found;
- unsigned int col_start;
- unsigned char *nullmask;
- unsigned int bitmask_sz;
- unsigned int byte_num, bit_num;
- unsigned int *var_col_offsets = NULL;
-
- if (mdb_get_option(MDB_DEBUG_ROW)) {
- buffer_dump(pg_buf, row_start, row_end);
- }
-
- row_cols = mdb_pg_get_int16(mdb, row_start);
-
- bitmask_sz = (row_cols + 7) / 8;
- nullmask = &pg_buf[row_end - bitmask_sz + 1];
-
- /* read table of variable column locations */
- if (table->num_var_cols > 0) {
- row_var_cols = mdb_pg_get_int16(mdb, row_end - bitmask_sz - 1);
- var_col_offsets = (int *)g_malloc((row_var_cols+1)*sizeof(int));
- for (i=0; i<row_var_cols+1; i++) {
- var_col_offsets[i] = mdb_pg_get_int16(mdb,
- row_end - bitmask_sz - 3 - (i*2));
- }
- }
- fixed_cols_found = 0;
- row_fixed_cols = row_cols - row_var_cols;
-
- /* read information into fields[] */
- for (i=0;i<table->num_cols;i++) {
- col = g_ptr_array_index(table->columns,i);
- fields[i].colnum = i;
- fields[i].is_fixed = (mdb_is_fixed_col(col)) ? 1 : 0;
- byte_num = col->col_num / 8;
- bit_num = col->col_num % 8;
- /* logic on nulls is reverse, 1 is not null, 0 is null */
- fields[i].is_null = nullmask[byte_num] & (1 << bit_num) ? 0 : 1;
-
- if ((fields[i].is_fixed)
- && (fixed_cols_found < row_fixed_cols)) {
- col_start = col->fixed_offset + 2;
- fields[i].start = row_start + col_start;
- fields[i].value = &pg_buf[row_start + col_start];
- fields[i].siz = col->col_size;
- fixed_cols_found++;
- /* Use col->var_col_num because a deleted column is still
- * present in the variable column offsets table for the row */
- } else if ((!fields[i].is_fixed)
- && (col->var_col_num < row_var_cols)) {
- col_start = var_col_offsets[col->var_col_num];
- fields[i].start = row_start + col_start;
- fields[i].value = &pg_buf[row_start + col_start];
- fields[i].siz = var_col_offsets[(col->var_col_num)+1] -
- col_start;
- } else {
- fields[i].start = 0;
- fields[i].value = NULL;
- fields[i].siz = 0;
- fields[i].is_null = 1;
- }
- }
- g_free(var_col_offsets);
-
- return row_cols;
-}
-static int
-mdb_crack_row3(MdbTableDef *table, int row_start, int row_end, MdbField *fields)
-{
- MdbCatalogEntry *entry = table->entry;
- MdbHandle *mdb = entry->mdb;
- MdbColumn *col;
- unsigned char *pg_buf = mdb->pg_buf;
- unsigned int i;
- unsigned int row_var_cols = 0, row_fixed_cols, row_cols;
- unsigned int fixed_cols_found, var_cols_found;
- unsigned int col_start;
- unsigned char *nullmask;
- unsigned int bitmask_sz;
- unsigned int byte_num, bit_num;
- unsigned int *var_col_offsets = NULL;
- unsigned int num_jumps = 0, jumps_used = 0;
- unsigned int col_ptr, row_len;
-
- if (mdb_get_option(MDB_DEBUG_ROW)) {
- buffer_dump(pg_buf, row_start, row_end);
- }
-
- row_cols = pg_buf[row_start];
-
- bitmask_sz = (row_cols + 7) / 8;
- nullmask = &pg_buf[row_end - bitmask_sz + 1];
-
- /* read table of variable column locations */
- if (table->num_var_cols > 0) {
- row_var_cols = pg_buf[row_end - bitmask_sz];
- row_len = row_end - row_start + 1;
- num_jumps = (row_len - 1) / 256;
- col_ptr = row_end - bitmask_sz - num_jumps - 1;
- /* If last jump is a dummy value, ignore it */
- if ((col_ptr-row_start-row_var_cols)/256 < num_jumps)
- num_jumps--;
-
- var_col_offsets = (int *)g_malloc((row_var_cols+1)*sizeof(int));
- jumps_used = 0;
- for (i=0; i<row_var_cols+1; i++) {
- if ((jumps_used < num_jumps)
- && (i == pg_buf[row_end-bitmask_sz-jumps_used-1])) {
- jumps_used++;
- }
- var_col_offsets[i] = pg_buf[col_ptr-i]+(jumps_used*256);
- }
- }
- fixed_cols_found = 0;
- var_cols_found = 0;
- row_fixed_cols = row_cols - row_var_cols;
-
- if (mdb_get_option(MDB_DEBUG_ROW)) {
- fprintf(stdout,"bitmask_sz %d num_jumps %d\n",bitmask_sz, num_jumps);
- fprintf(stdout,"row_var_cols %d\n", row_var_cols);
- fprintf(stdout,"row_fixed_cols %d\n", row_fixed_cols);
- }
-
- /* read information into fields[] */
- for (i=0;i<table->num_cols;i++) {
- col = g_ptr_array_index (table->columns, i);
- fields[i].colnum = i;
- fields[i].is_fixed = (mdb_is_fixed_col(col)) ? 1 : 0;
- byte_num = col->col_num / 8;
- bit_num = col->col_num % 8;
- /* logic on nulls is reverse, 1 is not null, 0 is null */
- fields[i].is_null = nullmask[byte_num] & (1 << bit_num) ? 0 : 1;
-
- if ((fields[i].is_fixed)
- && (fixed_cols_found < row_fixed_cols)) {
- col_start = col->fixed_offset + 1;
- fields[i].start = row_start + col_start;
- fields[i].value = &pg_buf[row_start + col_start];
- fields[i].siz = col->col_size;
- fixed_cols_found++;
- } else if ((!fields[i].is_fixed)
- && (var_cols_found < row_var_cols)) {
- col_start = var_col_offsets[var_cols_found];
- fields[i].start = row_start + col_start;
- fields[i].value = &pg_buf[row_start + col_start];
- fields[i].siz = var_col_offsets[var_cols_found+1] -
- col_start;
- var_cols_found++;
- } else {
- fields[i].start = 0;
- fields[i].value = NULL;
- fields[i].siz = 0;
- fields[i].is_null = 1;
- }
- }
- g_free(var_col_offsets);
-
- return row_cols;
-}
-/**
- * mdb_crack_row:
- * @table: Table that the row belongs to
- * @row_start: offset to start of row on current page
- * @row_end: offset to end of row on current page
- * @fields: pointer to MdbField array to be popluated by mdb_crack_row
- *
- * Cracks a row buffer apart into its component fields.
- *
- * A row buffer is that portion of a data page which contains the values for
- * that row. Its beginning and end can be found in the row offset table.
- *
- * The resulting MdbField array contains pointers into the row for each field
- * present. Be aware that by modifying field[]->value, you would be modifying
- * the row buffer itself, not a copy.
- *
- * This routine is mostly used internally by mdb_fetch_row() but may have some
- * applicability for advanced application programs.
- *
- * Return value: number of fields present.
- */
-int
-mdb_crack_row(MdbTableDef *table, int row_start, int row_end, MdbField *fields)
-{
-MdbCatalogEntry *entry = table->entry;
-MdbHandle *mdb = entry->mdb;
-
- if (IS_JET4(mdb)) {
- return mdb_crack_row4(table, row_start, row_end, fields);
- } else {
- return mdb_crack_row3(table, row_start, row_end, fields);
- }
-}
-
-static int
-mdb_pack_null_mask(unsigned char *buffer, int num_fields, MdbField *fields)
-{
- int pos = 0, bit = 0, byte = 0;
- int i;
-
- /* 'Not null' bitmap */
- for (i=0; i<num_fields; i++) {
- /* column is null if bit is clear (0) */
- if (!fields[i].is_null) {
- byte |= 1 << bit;
- //printf("%d %d %d %d\n", i, bit, 1 << bit, byte);
- }
- bit++;
- if (bit==8) {
- buffer[pos++] = byte;
- bit = byte = 0;
- }
- }
- /* if we've written any bits to the current byte, flush it */
- if (bit)
- buffer[pos++] = byte;
-
- return pos;
-}
-/* fields must be ordered with fixed columns first, then vars, subsorted by
- * column number */
-static int
-mdb_pack_row4(MdbTableDef *table, unsigned char *row_buffer, unsigned int num_fields, MdbField *fields)
-{
- unsigned int pos = 0;
- unsigned int var_cols = 0;
- unsigned int i;
-
- row_buffer[pos++] = num_fields & 0xff;
- row_buffer[pos++] = (num_fields >> 8) & 0xff;
-
- /* Fixed length columns */
- for (i=0;i<num_fields;i++) {
- if (fields[i].is_fixed) {
- fields[i].offset = pos;
- if (!fields[i].is_null) {
- memcpy(&row_buffer[pos], fields[i].value, fields[i].siz);
- }
- pos += fields[i].siz;
- }
- }
- /* For tables without variable-length columns */
- if (table->num_var_cols == 0) {
- pos += mdb_pack_null_mask(&row_buffer[pos], num_fields, fields);
- return pos;
- }
- /* Variable length columns */
- for (i=0;i<num_fields;i++) {
- if (!fields[i].is_fixed) {
- var_cols++;
- fields[i].offset = pos;
- if (! fields[i].is_null) {
- memcpy(&row_buffer[pos], fields[i].value, fields[i].siz);
- pos += fields[i].siz;
- }
- }
- }
- /* EOD */
- row_buffer[pos] = pos & 0xff;
- row_buffer[pos+1] = (pos >> 8) & 0xff;
- pos += 2;
-
- /* Offsets of the variable-length columns */
- for (i=num_fields; i>0; i--) {
- if (!fields[i-1].is_fixed) {
- row_buffer[pos++] = fields[i-1].offset & 0xff;
- row_buffer[pos++] = (fields[i-1].offset >> 8) & 0xff;
- }
- }
- /* Number of variable-length columns */
- row_buffer[pos++] = var_cols & 0xff;
- row_buffer[pos++] = (var_cols >> 8) & 0xff;
-
- pos += mdb_pack_null_mask(&row_buffer[pos], num_fields, fields);
- return pos;
-}
-
-static int
-mdb_pack_row3(MdbTableDef *table, unsigned char *row_buffer, unsigned int num_fields, MdbField *fields)
-{
- unsigned int pos = 0;
- unsigned int var_cols = 0;
- unsigned int i, j;
- unsigned char *offset_high;
-
- row_buffer[pos++] = num_fields;
-
- /* Fixed length columns */
- for (i=0;i<num_fields;i++) {
- if (fields[i].is_fixed) {
- fields[i].offset = pos;
- if (!fields[i].is_null) {
- memcpy(&row_buffer[pos], fields[i].value, fields[i].siz);
- }
- pos += fields[i].siz;
- }
- }
- /* For tables without variable-length columns */
- if (table->num_var_cols == 0) {
- pos += mdb_pack_null_mask(&row_buffer[pos], num_fields, fields);
- return pos;
- }
- /* Variable length columns */
- for (i=0;i<num_fields;i++) {
- if (!fields[i].is_fixed) {
- var_cols++;
- fields[i].offset = pos;
- if (! fields[i].is_null) {
- memcpy(&row_buffer[pos], fields[i].value, fields[i].siz);
- pos += fields[i].siz;
- }
- }
- }
-
- offset_high = (unsigned char *) g_malloc(var_cols+1);
- offset_high[0] = (pos << 8) & 0xff;
- j = 1;
-
- /* EOD */
- row_buffer[pos] = pos & 0xff;
- pos++;
-
- /* Variable length column offsets */
- for (i=num_fields; i>0; i--) {
- if (!fields[i-1].is_fixed) {
- row_buffer[pos++] = fields[i-1].offset & 0xff;
- offset_high[j++] = (fields[i-1].offset << 8) & 0xff;
- }
- }
-
- /* Dummy jump table entry */
- if (offset_high[0] < (pos+(num_fields+7)/8-1)/255) {
- row_buffer[pos++] = 0xff;
- }
- /* Jump table */
- for (i=0; i<var_cols; i++) {
- if (offset_high[i] > offset_high[i+1]) {
- row_buffer[pos++] = var_cols-i;
- }
- }
- g_free(offset_high);
-
- row_buffer[pos++] = var_cols;
-
- pos += mdb_pack_null_mask(&row_buffer[pos], num_fields, fields);
- return pos;
-}
-int
-mdb_pack_row(MdbTableDef *table, unsigned char *row_buffer, int unsigned num_fields, MdbField *fields)
-{
- if (table->is_temp_table) {
- unsigned int i;
- for (i=0; i<num_fields; i++) {
- MdbColumn *c = g_ptr_array_index(table->columns, i);
- fields[i].is_null = (fields[i].value) ? 0 : 1;
- fields[i].colnum = i;
- fields[i].is_fixed = c->is_fixed;
- if ((c->col_type != MDB_TEXT)
- && (c->col_type != MDB_MEMO)) {
- fields[i].siz = c->col_size;
- }
- }
- }
- if (IS_JET4(table->entry->mdb)) {
- return mdb_pack_row4(table, row_buffer, num_fields, fields);
- } else {
- return mdb_pack_row3(table, row_buffer, num_fields, fields);
- }
-}
-int
-mdb_pg_get_freespace(MdbHandle *mdb)
-{
- int rows, free_start, free_end;
- int row_count_offset = mdb->fmt->row_count_offset;
-
- rows = mdb_pg_get_int16(mdb, row_count_offset);
- free_start = row_count_offset + 2 + (rows * 2);
- free_end = mdb_pg_get_int16(mdb, row_count_offset + (rows * 2));
- mdb_debug(MDB_DEBUG_WRITE,"free space left on page = %d", free_end - free_start);
- return (free_end - free_start);
-}
-unsigned char *
-mdb_new_leaf_pg(MdbCatalogEntry *entry)
-{
- MdbHandle *mdb = entry->mdb;
- unsigned char *new_pg;
-
- new_pg = (unsigned char *) g_malloc0(mdb->fmt->pg_size);
-
- new_pg[0]=0x04;
- new_pg[1]=0x01;
- _mdb_put_int32(new_pg, 4, entry->table_pg);
-
- return new_pg;
-}
-unsigned char *
-mdb_new_data_pg(MdbCatalogEntry *entry)
-{
- MdbFormatConstants *fmt = entry->mdb->fmt;
- unsigned char *new_pg;
-
- new_pg = (unsigned char *) g_malloc0(fmt->pg_size);
-
- new_pg[0]=0x01;
- new_pg[1]=0x01;
- _mdb_put_int16(new_pg, 2, fmt->pg_size - fmt->row_count_offset - 2);
- _mdb_put_int32(new_pg, 4, entry->table_pg);
-
- return new_pg;
-}
-
-int
-mdb_update_indexes(MdbTableDef *table, int num_fields, MdbField *fields, guint32 pgnum, guint16 rownum)
-{
- unsigned int i;
- MdbIndex *idx;
-
- for (i=0;i<table->num_idxs;i++) {
- idx = g_ptr_array_index (table->indices, i);
- mdb_debug(MDB_DEBUG_WRITE,"Updating %s (%d).", idx->name, idx->index_type);
- if (idx->index_type==1) {
- mdb_update_index(table, idx, num_fields, fields, pgnum, rownum);
- }
- }
- return 1;
-}
-
-int
-mdb_init_index_chain(MdbTableDef *table, MdbIndex *idx)
-{
- MdbCatalogEntry *entry = table->entry;
- MdbHandle *mdb = entry->mdb;
-
- table->scan_idx = idx;
- table->chain = g_malloc0(sizeof(MdbIndexChain));
- table->mdbidx = mdb_clone_handle(mdb);
- mdb_read_pg(table->mdbidx, table->scan_idx->first_pg);
-
- return 1;
-}
-
-int
-mdb_update_index(MdbTableDef *table, MdbIndex *idx, unsigned int num_fields, MdbField *fields, guint32 pgnum, guint16 rownum)
-{
- MdbCatalogEntry *entry = table->entry;
- MdbHandle *mdb = entry->mdb;
- int idx_xref[16];
- unsigned int i, j;
- MdbIndexChain *chain;
- MdbField idx_fields[10];
-
- for (i = 0; i < idx->num_keys; i++) {
- for (j = 0; j < num_fields; j++) {
- // key_col_num is 1 based, can't remember why though
- if (fields[j].colnum == idx->key_col_num[i]-1) {
- idx_xref[i] = j;
- idx_fields[i] = fields[j];
- }
- }
- }
- for (i = 0; i < idx->num_keys; i++) {
- fprintf(stdout, "key col %d (%d) is mapped to field %d (%d %d)\n",
- i, idx->key_col_num[i], idx_xref[i], fields[idx_xref[i]].colnum,
- fields[idx_xref[i]].siz);
- }
- for (i = 0; i < num_fields; i++) {
- fprintf(stdout, "%d (%d %d)\n",
- i, fields[i].colnum,
- fields[i].siz);
- }
-
- chain = g_malloc0(sizeof(MdbIndexChain));
-
- mdb_index_find_row(mdb, idx, chain, pgnum, rownum);
- printf("chain depth = %d\n", chain->cur_depth);
- printf("pg = %" G_GUINT32_FORMAT "\n",
- chain->pages[chain->cur_depth-1].pg);
- //mdb_copy_index_pg(table, idx, &chain->pages[chain->cur_depth-1]);
- mdb_add_row_to_leaf_pg(table, idx, &chain->pages[chain->cur_depth-1], idx_fields);
-
- return 1;
-}
-
-int
-mdb_insert_row(MdbTableDef *table, int num_fields, MdbField *fields)
-{
- int new_row_size;
- unsigned char row_buffer[4096];
- MdbCatalogEntry *entry = table->entry;
- MdbHandle *mdb = entry->mdb;
- MdbFormatConstants *fmt = mdb->fmt;
- guint32 pgnum;
- guint16 rownum;
-
- if (!mdb->f->writable) {
- fprintf(stderr, "File is not open for writing\n");
- return 0;
- }
- new_row_size = mdb_pack_row(table, row_buffer, num_fields, fields);
- if (mdb_get_option(MDB_DEBUG_WRITE)) {
- buffer_dump(row_buffer, 0, new_row_size-1);
- }
- pgnum = mdb_map_find_next_freepage(table, new_row_size);
- if (!pgnum) {
- fprintf(stderr, "Unable to allocate new page.\n");
- return 0;
- }
-
- rownum = mdb_add_row_to_pg(table, row_buffer, new_row_size);
-
- if (mdb_get_option(MDB_DEBUG_WRITE)) {
- buffer_dump(mdb->pg_buf, 0, 39);
- buffer_dump(mdb->pg_buf, fmt->pg_size - 160, fmt->pg_size-1);
- }
- mdb_debug(MDB_DEBUG_WRITE, "writing page %d", pgnum);
- if (!mdb_write_pg(mdb, pgnum)) {
- fprintf(stderr, "write failed! exiting...\n");
- exit(1);
- }
-
- mdb_update_indexes(table, num_fields, fields, pgnum, rownum);
-
- return 1;
-}
-/*
- * Assumes caller has verfied space is available on page and adds the new
- * row to the current pg_buf.
- */
-guint16
-mdb_add_row_to_pg(MdbTableDef *table, unsigned char *row_buffer, int new_row_size)
-{
- unsigned char *new_pg;
- int num_rows, i, pos, row_start, row_end, row_size;
- MdbCatalogEntry *entry = table->entry;
- MdbHandle *mdb = entry->mdb;
- MdbFormatConstants *fmt = mdb->fmt;
-
- if (table->is_temp_table) {
- GPtrArray *pages = table->temp_table_pages;
- if (pages->len == 0) {
- new_pg = mdb_new_data_pg(entry);
- g_ptr_array_add(pages, new_pg);
- } else {
- new_pg = g_ptr_array_index(pages, pages->len - 1);
- if (mdb_get_int16(new_pg, 2) < new_row_size + 2) {
- new_pg = mdb_new_data_pg(entry);
- g_ptr_array_add(pages, new_pg);
- }
- }
-
- num_rows = mdb_get_int16(new_pg, fmt->row_count_offset);
- pos = (num_rows == 0) ? fmt->pg_size :
- mdb_get_int16(new_pg, fmt->row_count_offset + (num_rows*2));
- } else { /* is not a temp table */
- new_pg = mdb_new_data_pg(entry);
-
- num_rows = mdb_pg_get_int16(mdb, fmt->row_count_offset);
- pos = fmt->pg_size;
-
- /* copy existing rows */
- for (i=0;i<num_rows;i++) {
- row_start = mdb_pg_get_int16(mdb, (fmt->row_count_offset + 2) + (i*2));
- row_end = mdb_find_end_of_row(mdb, i);
- row_size = row_end - row_start + 1;
- pos -= row_size;
- memcpy(&new_pg[pos], &mdb->pg_buf[row_start], row_size);
- _mdb_put_int16(new_pg, (fmt->row_count_offset + 2) + (i*2), pos);
- }
- }
-
- /* add our new row */
- pos -= new_row_size;
- memcpy(&new_pg[pos], row_buffer, new_row_size);
- /* add row to the row offset table */
- _mdb_put_int16(new_pg, (fmt->row_count_offset + 2) + (num_rows*2), pos);
-
- /* update number rows on this page */
- num_rows++;
- _mdb_put_int16(new_pg, fmt->row_count_offset, num_rows);
-
- /* update the freespace */
- _mdb_put_int16(new_pg,2,pos - fmt->row_count_offset - 2 - (num_rows*2));
-
- /* copy new page over old */
- if (!table->is_temp_table) {
- memcpy(mdb->pg_buf, new_pg, fmt->pg_size);
- g_free(new_pg);
- }
-
- return num_rows;
-}
-int
-mdb_update_row(MdbTableDef *table)
-{
-int row_start, row_end;
-unsigned int i;
-MdbColumn *col;
-MdbCatalogEntry *entry = table->entry;
-MdbHandle *mdb = entry->mdb;
-MdbFormatConstants *fmt = mdb->fmt;
-MdbField fields[256];
-unsigned char row_buffer[4096];
-int old_row_size, new_row_size, delta;
-unsigned int num_fields;
-
- if (!mdb->f->writable) {
- fprintf(stderr, "File is not open for writing\n");
- return 0;
- }
- row_start = mdb_pg_get_int16(mdb, (fmt->row_count_offset + 2) + ((table->cur_row-1)*2));
- row_end = mdb_find_end_of_row(mdb, table->cur_row-1);
- old_row_size = row_end - row_start;
-
- row_start &= 0x0FFF; /* remove flags */
-
- mdb_debug(MDB_DEBUG_WRITE,"page %lu row %d start %d end %d", (unsigned long) table->cur_phys_pg, table->cur_row-1, row_start, row_end);
- if (mdb_get_option(MDB_DEBUG_LIKE))
- buffer_dump(mdb->pg_buf, row_start, row_end);
-
- for (i=0;i<table->num_cols;i++) {
- col = g_ptr_array_index(table->columns,i);
- if (col->bind_ptr && mdb_is_col_indexed(table,i)) {
- fprintf(stderr, "Attempting to update column that is part of an index\n");
- return 0;
- }
- }
- num_fields = mdb_crack_row(table, row_start, row_end, fields);
-
- if (mdb_get_option(MDB_DEBUG_WRITE)) {
- for (i=0;i<num_fields;i++) {
- printf("col %d %d start %d siz %d\n", i, fields[i].colnum, fields[i].start, fields[i].siz);
- }
- }
- for (i=0;i<table->num_cols;i++) {
- col = g_ptr_array_index(table->columns,i);
- if (col->bind_ptr) {
- printf("yes\n");
- fields[i].value = col->bind_ptr;
- fields[i].siz = *(col->len_ptr);
- }
- }
-
- new_row_size = mdb_pack_row(table, row_buffer, num_fields, fields);
- if (mdb_get_option(MDB_DEBUG_WRITE))
- buffer_dump(row_buffer, 0, new_row_size-1);
- delta = new_row_size - old_row_size;
- if ((mdb_pg_get_freespace(mdb) - delta) < 0) {
- fprintf(stderr, "No space left on this page, update will not occur\n");
- return 0;
- }
- /* do it! */
- mdb_replace_row(table, table->cur_row-1, row_buffer, new_row_size);
- return 0;
-}
-int
-mdb_replace_row(MdbTableDef *table, int row, unsigned char *new_row, int new_row_size)
-{
-MdbCatalogEntry *entry = table->entry;
-MdbHandle *mdb = entry->mdb;
-MdbFormatConstants *fmt = mdb->fmt;
-unsigned char *new_pg;
-guint16 num_rows;
-int row_start, row_end, row_size;
-int i, pos;
-
- if (mdb_get_option(MDB_DEBUG_WRITE)) {
- buffer_dump(mdb->pg_buf, 0, 39);
- buffer_dump(mdb->pg_buf, fmt->pg_size - 160, fmt->pg_size-1);
- }
- mdb_debug(MDB_DEBUG_WRITE,"updating row %d on page %lu", row, (unsigned long) table->cur_phys_pg);
- new_pg = mdb_new_data_pg(entry);
-
- num_rows = mdb_pg_get_int16(mdb, fmt->row_count_offset);
- _mdb_put_int16(new_pg, fmt->row_count_offset, num_rows);
-
- pos = mdb->fmt->pg_size;
-
- /* rows before */
- for (i=0;i<row;i++) {
- row_start = mdb_pg_get_int16(mdb, (fmt->row_count_offset + 2) + (i*2));
- row_end = mdb_find_end_of_row(mdb, i);
- row_size = row_end - row_start + 1;
- pos -= row_size;
- memcpy(&new_pg[pos], &mdb->pg_buf[row_start], row_size);
- _mdb_put_int16(new_pg, (fmt->row_count_offset + 2) + (i*2), pos);
- }
-
- /* our row */
- pos -= new_row_size;
- memcpy(&new_pg[pos], new_row, new_row_size);
- _mdb_put_int16(new_pg, (fmt->row_count_offset + 2) + (row*2), pos);
-
- /* rows after */
- for (i=row+1;i<num_rows;i++) {
- row_start = mdb_pg_get_int16(mdb, (fmt->row_count_offset + 2) + (i*2));
- row_end = mdb_find_end_of_row(mdb, i);
- row_size = row_end - row_start + 1;
- pos -= row_size;
- memcpy(&new_pg[pos], &mdb->pg_buf[row_start], row_size);
- _mdb_put_int16(new_pg, (fmt->row_count_offset + 2) + (i*2), pos);
- }
-
- /* almost done, copy page over current */
- memcpy(mdb->pg_buf, new_pg, fmt->pg_size);
-
- g_free(new_pg);
-
- _mdb_put_int16(mdb->pg_buf, 2, mdb_pg_get_freespace(mdb));
- if (mdb_get_option(MDB_DEBUG_WRITE)) {
- buffer_dump(mdb->pg_buf, 0, 39);
- buffer_dump(mdb->pg_buf, fmt->pg_size - 160, fmt->pg_size-1);
- }
- /* drum roll, please */
- if (!mdb_write_pg(mdb, table->cur_phys_pg)) {
- fprintf(stderr, "write failed! exiting...\n");
- exit(1);
- }
- return 0;
-}
-static int
-mdb_add_row_to_leaf_pg(MdbTableDef *table, MdbIndex *idx, MdbIndexPage *ipg, MdbField *idx_fields)
-/*, guint32 pgnum, guint16 rownum)
-static int
-mdb_copy_index_pg(MdbTableDef *table, MdbIndex *idx, MdbIndexPage *ipg)
-*/
-{
- MdbCatalogEntry *entry = table->entry;
- MdbHandle *mdb = entry->mdb;
- MdbColumn *col;
- guint32 pg;
- guint16 row;
- unsigned char *new_pg;
- unsigned char key_hash[256];
- unsigned char iflag;
- int keycol;
-
- new_pg = mdb_new_leaf_pg(entry);
-
- mdb_index_page_reset(ipg);
- mdb_read_pg(mdb, ipg->pg);
-
- /* do we support this index type yet? */
- if (idx->num_keys > 1) {
- fprintf(stderr,"multikey indexes not yet supported, aborting\n");
- return 0;
- }
- keycol = idx->key_col_num[0];
- col = g_ptr_array_index (table->columns, keycol - 1);
- printf("keycol = %d (%s)\n", keycol, col->name);
- if (!mdb_is_fixed_col(col)) {
- fprintf(stderr,"variable length key columns not yet supported, aborting\n");
- return 0;
- }
- printf("col size = %d\n", col->col_size);
-
- while (mdb_index_find_next_on_page(mdb, ipg)) {
-
- /* check for compressed indexes. */
- if (ipg->len < col->col_size + 1) {
- fprintf(stderr,"compressed indexes not yet supported, aborting\n");
- return 0;
- }
-
- pg = mdb_pg_get_int24_msb(mdb, ipg->offset + ipg->len - 4);
- row = mdb->pg_buf[ipg->offset + ipg->len - 1];
- iflag = mdb->pg_buf[ipg->offset];
- mdb_index_swap_n(&mdb->pg_buf[ipg->offset + 1], col->col_size, key_hash);
- key_hash[col->col_size - 1] &= 0x7f;
- printf("length = %d\n", ipg->len);
- printf("iflag = %d pg = %" G_GUINT32_FORMAT
- " row = %" G_GUINT16_FORMAT "\n", iflag, pg, row);
- buffer_dump(mdb->pg_buf, ipg->offset, ipg->offset + ipg->len - 1);
- buffer_dump(mdb->pg_buf, ipg->offset + 1, ipg->offset + col->col_size);
- buffer_dump(key_hash, 0, col->col_size - 1);
- ipg->offset += ipg->len;
- ipg->len = 0;
- row++;
- }
- g_free(new_pg);
-
- return ipg->len;
-}
+++ /dev/null
-/**\r
- * this program is free software, please use it as you like.\r
- * i am not a programmer, so please have this code reviewed\r
- * to make sure it has nog bugs or ill side efects.\r
- * use at your own risk\r
- * compile it with: gcc -l m -o latlon2bookmark latlon2bookmark.c\r
- * Credits for this work goes to edje in #navit\r
-**/\r
-\r
-#include <stdio.h>\r
-#include <stdlib.h>\r
-#include <math.h>\r
-#include <string.h>\r
-\r
-int main( int argc, char **argv )\r
-{\r
- char description[256];\r
- char lngsign[10];\r
- char latsign[10];\r
- float lat;\r
- float lng;\r
- long intlat;\r
- long intlng;\r
- int i;\r
- int n;\r
-\r
- if ( argc < 4 )\r
- {\r
- printf("\n");\r
- printf("This program converts a lat/lon coordinates pair\n");\r
- printf("into a bookmark you can use with navit.\n");\r
- printf("This program expects 3 arguments in the following order:\n");\r
- printf("Lat, Lon and a description\n");\r
- printf("and will print a bookmark.\n");\r
- printf("for example: latlon2bookmark 51.980344 4.358005 this is my house \n");\r
- printf("\n");\r
- return 1;\r
- }\r
-\r
- lat=atof(argv[1]);\r
- lng=atof(argv[2]);\r
-\r
- /* concatenate all parts of the description string */\r
- strcpy(description, argv[3]);\r
- n=0;\r
- for (i=4; i < argc; i++)\r
- {\r
- /* add spaces between the parts of the description */\r
- if ( i < argc )\r
- {\r
- strcat(description, " ");\r
- }\r
- strcat(description, argv[i]);\r
- n=n+1;\r
- }\r
-\r
- if ( lat < -90 )\r
- {\r
- printf("\n");\r
- printf("The first argument must be the lattitude\n");\r
- printf("and can't be smaller then -90 (southpole)\n");\r
- printf("\n");\r
- return 2;\r
- }\r
-\r
- if ( lat > 90 )\r
- {\r
- printf("\n");\r
- printf("The first argument must be the lattitude\n");\r
- printf("and can't be bigger then 90 (northpole)\n");\r
- printf("\n");\r
- return 3;\r
- }\r
-\r
- if ( lng < -180 )\r
- {\r
- printf("\n");\r
- printf("The second argument must be the longitude\n");\r
- printf("and can't be smaller then -180 (oposite the 0 meridian)\n");\r
- printf("\n");\r
- return 4;\r
- }\r
-\r
- if ( lng > 180 )\r
- {\r
- printf("\n");\r
- printf("The first argument must be the longitude\n");\r
- printf("and can't be bigger then 180 (oposite the 0 meridian)\n");\r
- printf("\n");\r
- return 5;\r
- }\r
-\r
- /* convert the longitude to an integer */\r
- intlng=lng*6371000.0*M_PI/180;\r
-\r
- /* aparently if inlng < 0 , inlng needs to be inverted and a - sign used in the output */\r
- strcpy(lngsign, "0x");\r
- if ( intlng < 0)\r
- {\r
- intlng=(intlng ^ 0xffffffff);\r
- strcpy(lngsign, "-0x");\r
- }\r
-\r
- /* and the same for the latitude */\r
- intlat=log(tan(M_PI_4+lat*M_PI/360))*6371000.0;\r
-\r
- /* aparently if inlat < 0 , inlat needs to be inverted and a - sign used in the output */\r
- strcpy(latsign, "0x");\r
- if ( intlat < 0)\r
- {\r
- intlat=(intlat ^ 0xffffffff);\r
- strcpy(latsign, "-0x");\r
- }\r
-\r
- /* print the bookmark */\r
- fprintf(stderr,"\n");\r
- fprintf(stdout,"mg:%s%x %s%x type=bookmark label=\"%s\"\n",lngsign,intlng,latsign,intlat,description);\r
- fprintf(stderr,"\n");\r
-\r
- return 0;\r
-}\r
+++ /dev/null
-bin
-obj
-*.img
-*.bin
-navit.xml
-*.depend
-*.layout
-*.bak
-bak
-locale
-distr
-xpm
-*.bz2
-*.zip
-destination.txt
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
-<CodeBlocks_project_file>
- <FileVersion major="1" minor="6" />
- <Project>
- <Option title="Gpx2Navit" />
- <Option pch_mode="2" />
- <Option compiler="gcc" />
- <Build>
- <Target title="Debug">
- <Option output="bin\Debug\gpx2navit" prefix_auto="1" extension_auto="1" />
- <Option working_dir="bin\Debug" />
- <Option object_output="obj\gpx2navit\Debug\" />
- <Option type="1" />
- <Option compiler="gcc" />
- <Option use_console_runner="0" />
- <Option parameters="--input-file=d:\CB_Projects\netherlands.osm --attr-debug-level=0 -k netherlands.bin" />
- <Compiler>
- <Add option="-g" />
- </Compiler>
- <Linker>
- <Add directory="%GTK_DIR%\lib" />
- <Add directory="bin\Debug" />
- </Linker>
- </Target>
- <Target title="Release">
- <Option output="bin\Release\gpx2navit" prefix_auto="1" extension_auto="1" />
- <Option object_output="obj\gpx2navit\Release\" />
- <Option type="1" />
- <Option compiler="gcc" />
- <Compiler>
- <Add option="-O2" />
- </Compiler>
- <Linker>
- <Add option="-s" />
- <Add directory="%GTK_DIR%\lib" />
- <Add directory="bin\Release" />
- </Linker>
- </Target>
- </Build>
- <Compiler>
- <Add option="-Wall" />
- <Add option="-mms-bitfields -DMODULE=osm2navit" />
- <Add directory="%GTK_DIR%\include\glib-2.0" />
- <Add directory="%GTK_DIR%\lib\glib-2.0\include" />
- <Add directory="%GTK_DIR%\include" />
- <Add directory="Win32Extra" />
- <Add directory="..\..\src\tools\gpx2navit_txt\src" />
- </Compiler>
- <Linker>
- <Add library="user32" />
- <Add library="gtk-win32-2.0" />
- <Add library="gdk-win32-2.0" />
- <Add library="gdk_pixbuf-2.0" />
- <Add library="fib" />
- <Add library="freetype" />
- <Add library="z" />
- <Add library="gobject-2.0" />
- <Add library="gmodule-2.0" />
- <Add library="glib-2.0" />
- <Add library="intl" />
- <Add library="zdll" />
- <Add directory="%GTK_DIR%\lib" />
- </Linker>
- <Unit filename="Win32Extra\sys\mman.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="Win32Extra\sys\mman.h" />
- <Unit filename="Win32Extra\wordexp.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="Win32Extra\wordexp.h" />
- <Unit filename="..\..\src\attr.h" />
- <Unit filename="..\..\src\attr_def.h" />
- <Unit filename="..\..\src\coord.h" />
- <Unit filename="..\..\src\country.h" />
- <Unit filename="..\..\src\debug.h" />
- <Unit filename="..\..\src\file.h" />
- <Unit filename="..\..\src\item.h" />
- <Unit filename="..\..\src\map.h" />
- <Unit filename="..\..\src\param.h" />
- <Unit filename="..\..\src\plugin.h" />
- <Unit filename="..\..\src\tools\gpx2navit_txt\src\Makefile.am" />
- <Unit filename="..\..\src\tools\gpx2navit_txt\src\elementControl.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\src\tools\gpx2navit_txt\src\emess.h" />
- <Unit filename="..\..\src\tools\gpx2navit_txt\src\errorcode.h" />
- <Unit filename="..\..\src\tools\gpx2navit_txt\src\geod_for.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\src\tools\gpx2navit_txt\src\geod_inv.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\src\tools\gpx2navit_txt\src\geod_set.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\src\tools\gpx2navit_txt\src\geodesic.h" />
- <Unit filename="..\..\src\tools\gpx2navit_txt\src\gpx2navit_txt.h" />
- <Unit filename="..\..\src\tools\gpx2navit_txt\src\main.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\src\tools\gpx2navit_txt\src\misc.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\src\tools\gpx2navit_txt\src\parser.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\src\tools\gpx2navit_txt\src\setmeta.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\src\tools\gpx2navit_txt\src\setpath.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\src\tools\gpx2navit_txt\src\setwpt.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\src\tools\gpx2navit_txt\src\utils.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\src\transform.h" />
- <Extensions>
- <code_completion />
- <envvars />
- <debugger />
- </Extensions>
- </Project>
-</CodeBlocks_project_file>
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
-<CodeBlocks_project_file>
- <FileVersion major="1" minor="6" />
- <Project>
- <Option title="Navit" />
- <Option pch_mode="2" />
- <Option compiler="gcc" />
- <Build>
- <Target title="Debug">
- <Option output="bin\Debug\Navit" prefix_auto="1" extension_auto="1" />
- <Option object_output="obj\Debug\" />
- <Option external_deps="bin\Debug\libvehicle_file.la;bin\Debug\libdata_binfile.la;bin\Debug\libgtk_graphics.la;bin\Debug\libgtk_gui.la;bin\Debug\libwin32_gui.la" />
- <Option type="1" />
- <Option compiler="gcc" />
- <Option use_console_runner="0" />
- <Compiler>
- <Add option="-g" />
- </Compiler>
- <Linker>
- <Add library="bin\Debug\libfib.a" />
- <Add library="bin\Debug\libvehicle_file.la" />
- <Add library="bin\Debug\libdata_binfile.la" />
- <Add library="bin\Debug\libgtk_graphics.la" />
- <Add library="bin\Debug\libgtk_gui.la" />
- <Add library="bin\Debug\libvehicle_demo.la" />
- <Add library="bin\Debug\libdata_poi_geodownload.la" />
- <Add library="bin\Debug\libmdb.a" />
- <Add library="bin\Debug\libdata_garmin.la" />
- <Add library="bin\Debug\libspeech_speech_dispatcher.la" />
- <Add library="bin\Debug\libdata_mg.la" />
- <Add library="bin\Debug\libdata_textfile.la" />
- <Add library="libgarmin.a" />
- <Add library="bin\Debug\libwin32_gui.la" />
- <Add library="ole32" />
- <Add library="user32" />
- <Add library="gdi32" />
- <Add library="gtk-win32-2.0" />
- <Add library="gdk-win32-2.0" />
- <Add library="gdk_pixbuf-2.0" />
- <Add library="freetype" />
- <Add library="z" />
- <Add library="gobject-2.0" />
- <Add library="gmodule-2.0" />
- <Add library="glib-2.0" />
- <Add library="intl" />
- <Add directory="bin\Debug" />
- <Add directory="." />
- <Add directory="Win32Extra\libgarmin" />
- </Linker>
- </Target>
- <Target title="Release">
- <Option output="bin\Release\Navit" prefix_auto="1" extension_auto="1" />
- <Option object_output="obj\Release\" />
- <Option type="1" />
- <Option compiler="gcc" />
- <Option use_console_runner="0" />
- <Compiler>
- <Add option="-O2" />
- </Compiler>
- <Linker>
- <Add option="-s" />
- <Add library="bin\Release\libfib.a" />
- <Add library="bin\Release\libvehicle_file.la" />
- <Add library="bin\Release\libdata_binfile.la" />
- <Add library="bin\Release\libgtk_graphics.la" />
- <Add library="bin\Release\libvehicle_demo.la" />
- <Add library="bin\Release\libgtk_gui.la" />
- <Add library="bin\Release\libdata_poi_geodownload.la" />
- <Add library="bin\Release\libmdb.a" />
- <Add library="bin\Release\libdata_garmin.la" />
- <Add library="bin\Release\libspeech_speech_dispatcher.la" />
- <Add library="bin\Release\libdata_mg.la" />
- <Add library="bin\Release\libdata_textfile.la" />
- <Add library="bin\Release\libwin32_gui.la" />
- <Add library="libgarmin.a" />
- <Add library="ole32" />
- <Add library="user32" />
- <Add library="gtk-win32-2.0" />
- <Add library="gdk-win32-2.0" />
- <Add library="gdk_pixbuf-2.0" />
- <Add library="freetype" />
- <Add library="z" />
- <Add library="gobject-2.0" />
- <Add library="gmodule-2.0" />
- <Add library="glib-2.0" />
- <Add library="intl" />
- <Add directory="." />
- <Add directory="Win32Extra\libgarmin" />
- </Linker>
- </Target>
- </Build>
- <Compiler>
- <Add option="-Wall" />
- <Add option="-mms-bitfields" />
- <Add option="-DMODULE=Navit" />
- <Add option='-DPREFIX=\"/usr/local\"' />
- <Add directory="%GTK_DIR%\include" />
- <Add directory="%GTK_DIR%\include\gtk-2.0" />
- <Add directory="%GTK_DIR%\include\glib-2.0" />
- <Add directory="%GTK_DIR%\lib\gtk-2.0\include" />
- <Add directory="%GTK_DIR%\lib\glib-2.0\include" />
- <Add directory="%GTK_DIR%\include\cairo" />
- <Add directory="%GTK_DIR%\include\pango-1.0" />
- <Add directory="%GTK_DIR%\include\atk-1.0" />
- <Add directory="..\..\src" />
- <Add directory="Win32Extra" />
- <Add directory="..\..\src\fib-1.1" />
- <Add directory="%GTK_DIR%\include\freetype2" />
- </Compiler>
- <Linker>
- <Add directory="%GTK_DIR%\lib" />
- </Linker>
- <Unit filename="Win32Extra\builtin.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="Win32Extra\config.h" />
- <Unit filename="Win32Extra\serial_io.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="Win32Extra\serial_io.h" />
- <Unit filename="Win32Extra\setenv.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="Win32Extra\setenv.h" />
- <Unit filename="Win32Extra\sys\mman.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="Win32Extra\sys\mman.h" />
- <Unit filename="Win32Extra\wordexp.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="Win32Extra\wordexp.h" />
- <Unit filename="..\..\src\Makefile" />
- <Unit filename="..\..\src\Makefile.am" />
- <Unit filename="..\..\src\Makefile.in" />
- <Unit filename="..\..\src\attr.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\src\attr.h" />
- <Unit filename="..\..\src\attr_def.h" />
- <Unit filename="..\..\src\callback.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\src\callback.h" />
- <Unit filename="..\..\src\color.h" />
- <Unit filename="..\..\src\compass.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\src\compass.h" />
- <Unit filename="..\..\src\coord.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\src\coord.h" />
- <Unit filename="..\..\src\country.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\src\country.h" />
- <Unit filename="..\..\src\cursor.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\src\cursor.h" />
- <Unit filename="..\..\src\data.h" />
- <Unit filename="..\..\src\data_window.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\src\data_window.h" />
- <Unit filename="..\..\src\data_window_int.h" />
- <Unit filename="..\..\src\debug.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\src\debug.h" />
- <Unit filename="..\..\src\destination.h" />
- <Unit filename="..\..\src\draw_info.h" />
- <Unit filename="..\..\src\file.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\src\file.h" />
- <Unit filename="..\..\src\graphics.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\src\graphics.h" />
- <Unit filename="..\..\src\gtkext.h" />
- <Unit filename="..\..\src\gui.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\src\gui.h" />
- <Unit filename="..\..\src\gui\gtk\gui_gtk.h" />
- <Unit filename="..\..\src\item.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\src\item.h" />
- <Unit filename="..\..\src\item_def.h" />
- <Unit filename="..\..\src\layer.h" />
- <Unit filename="..\..\src\layout.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\src\layout.h" />
- <Unit filename="..\..\src\log.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\src\log.h" />
- <Unit filename="..\..\src\main.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\src\main.h" />
- <Unit filename="..\..\src\map-share.h" />
- <Unit filename="..\..\src\map.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\src\map.h" />
- <Unit filename="..\..\src\map_data.h" />
- <Unit filename="..\..\src\mapset.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\src\mapset.h" />
- <Unit filename="..\..\src\maptype.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\src\maptype.h" />
- <Unit filename="..\..\src\menu.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\src\menu.h" />
- <Unit filename="..\..\src\navigation.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\src\navigation.h" />
- <Unit filename="..\..\src\navit.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\src\navit.h" />
- <Unit filename="..\..\src\navit.xml" />
- <Unit filename="..\..\src\osd.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\src\osd.h" />
- <Unit filename="..\..\src\param.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\src\param.h" />
- <Unit filename="..\..\src\phrase.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\src\phrase.h" />
- <Unit filename="..\..\src\plugin.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\src\plugin.h" />
- <Unit filename="..\..\src\plugin_def.h" />
- <Unit filename="..\..\src\point.h" />
- <Unit filename="..\..\src\popup.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\src\popup.h" />
- <Unit filename="..\..\src\profile.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\src\profile.h" />
- <Unit filename="..\..\src\projection.h" />
- <Unit filename="..\..\src\route.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\src\route.h" />
- <Unit filename="..\..\src\search.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\src\search.h" />
- <Unit filename="..\..\src\speech.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\src\speech.h" />
- <Unit filename="..\..\src\statusbar.h" />
- <Unit filename="..\..\src\track.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\src\track.h" />
- <Unit filename="..\..\src\transform.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\src\transform.h" />
- <Unit filename="..\..\src\util.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\src\util.h" />
- <Unit filename="..\..\src\vehicle.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\src\vehicle.h" />
- <Unit filename="..\..\src\xmlconfig.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\src\xmlconfig.h" />
- <Unit filename="..\..\src\zipfile.h" />
- <Extensions>
- <code_completion />
- <envvars />
- <debugger />
- </Extensions>
- </Project>
-</CodeBlocks_project_file>
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
-<CodeBlocks_project_file>
- <FileVersion major="1" minor="6" />
- <Project>
- <Option title="Navit" />
- <Option pch_mode="2" />
- <Option compiler="gcc" />
- <Build>
- <Target title="Debug">
- <Option output="bin\Debug\Navi" prefix_auto="1" extension_auto="1" />
- <Option object_output="obj\Debug\" />
- <Option type="1" />
- <Option compiler="gcc" />
- <Option use_console_runner="0" />
- <Compiler>
- <Add option="-g" />
- </Compiler>
- <Linker>
- <Add directory="bin\Debug" />
- </Linker>
- </Target>
- <Target title="Release">
- <Option output="bin\Release\Navit" prefix_auto="1" extension_auto="1" />
- <Option object_output="obj\Release\" />
- <Option type="1" />
- <Option compiler="gcc" />
- <Option use_console_runner="0" />
- <Compiler>
- <Add option="-O2" />
- </Compiler>
- <Linker>
- <Add option="-s" />
- </Linker>
- </Target>
- </Build>
- <Compiler>
- <Add option="-Wall" />
- <Add option="-mms-bitfields" />
- <Add option="-DMODULE=Navit" />
- <Add option='-DPREFIX=\"/usr/local\"' />
- <Add directory="%GTK_DIR%\include" />
- <Add directory="%GTK_DIR%\include\gtk-2.0" />
- <Add directory="%GTK_DIR%\include\glib-2.0" />
- <Add directory="%GTK_DIR%\lib\gtk-2.0\include" />
- <Add directory="%GTK_DIR%\lib\glib-2.0\include" />
- <Add directory="%GTK_DIR%\include\cairo" />
- <Add directory="%GTK_DIR%\include\pango-1.0" />
- <Add directory="%GTK_DIR%\include\atk-1.0" />
- <Add directory="..\..\src" />
- <Add directory="Win32Extra" />
- <Add directory="..\..\src\fib-1.1" />
- <Add directory="D:\msys\1.10\freetype-2.3.5\include" />
- </Compiler>
- <Linker>
- <Add library="bin\Debug\libgtk_graphics.la" />
- <Add library="bin\Debug\libgtk_gui.la" />
- <Add library="bin\Debug\libdata_binfile.la" />
- <Add library="user32" />
- <Add library="gtk-win32-2.0" />
- <Add library="gdk-win32-2.0" />
- <Add library="gdk_pixbuf-2.0" />
- <Add library="fib" />
- <Add library="freetype" />
- <Add library="z" />
- <Add library="gobject-2.0" />
- <Add library="gmodule-2.0" />
- <Add library="glib-2.0" />
- <Add library="intl" />
- <Add library="bin\Debug\libvehicle_file.la" />
- <Add directory="%GTK_DIR%\lib" />
- <Add directory="D:\msys\1.10\freetype-2.3.5\objs\.libs" />
- </Linker>
- <Unit filename="Win32Extra\config.h" />
- <Unit filename="Win32Extra\serial_io.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="Win32Extra\serial_io.h" />
- <Unit filename="Win32Extra\setenv.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="Win32Extra\setenv.h" />
- <Unit filename="Win32Extra\wordexp.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="Win32Extra\wordexp.h" />
- <Unit filename="..\..\src\Makefile" />
- <Unit filename="..\..\src\Makefile.am" />
- <Unit filename="..\..\src\Makefile.in" />
- <Unit filename="..\..\src\attr.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\src\attr.h" />
- <Unit filename="..\..\src\attr_def.h" />
- <Unit filename="..\..\src\builtin.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\src\callback.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\src\callback.h" />
- <Unit filename="..\..\src\color.h" />
- <Unit filename="..\..\src\compass.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\src\compass.h" />
- <Unit filename="..\..\src\coord.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\src\coord.h" />
- <Unit filename="..\..\src\country.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\src\country.h" />
- <Unit filename="..\..\src\cursor.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\src\cursor.h" />
- <Unit filename="..\..\src\data.h" />
- <Unit filename="..\..\src\data_window.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\src\data_window.h" />
- <Unit filename="..\..\src\data_window_int.h" />
- <Unit filename="..\..\src\debug.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\src\debug.h" />
- <Unit filename="..\..\src\destination.h" />
- <Unit filename="..\..\src\draw_info.h" />
- <Unit filename="..\..\src\file.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\src\file.h" />
- <Unit filename="..\..\src\graphics.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\src\graphics.h" />
- <Unit filename="..\..\src\gtkext.h" />
- <Unit filename="..\..\src\gui.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\src\gui.h" />
- <Unit filename="..\..\src\gui\gtk\gui_gtk.h" />
- <Unit filename="..\..\src\item.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\src\item.h" />
- <Unit filename="..\..\src\item_def.h" />
- <Unit filename="..\..\src\layer.h" />
- <Unit filename="..\..\src\layout.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\src\layout.h" />
- <Unit filename="..\..\src\log.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\src\log.h" />
- <Unit filename="..\..\src\main.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\src\main.h" />
- <Unit filename="..\..\src\map-share.h" />
- <Unit filename="..\..\src\map.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\src\map.h" />
- <Unit filename="..\..\src\map_data.h" />
- <Unit filename="..\..\src\mapset.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\src\mapset.h" />
- <Unit filename="..\..\src\maptype.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\src\maptype.h" />
- <Unit filename="..\..\src\menu.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\src\menu.h" />
- <Unit filename="..\..\src\navigation.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\src\navigation.h" />
- <Unit filename="..\..\src\navit.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\src\navit.h" />
- <Unit filename="..\..\src\navit.xml" />
- <Unit filename="..\..\src\osd.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\src\osd.h" />
- <Unit filename="..\..\src\param.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\src\param.h" />
- <Unit filename="..\..\src\phrase.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\src\phrase.h" />
- <Unit filename="..\..\src\plugin.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\src\plugin.h" />
- <Unit filename="..\..\src\plugin_def.h" />
- <Unit filename="..\..\src\point.h" />
- <Unit filename="..\..\src\popup.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\src\popup.h" />
- <Unit filename="..\..\src\profile.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\src\profile.h" />
- <Unit filename="..\..\src\projection.h" />
- <Unit filename="..\..\src\route.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\src\route.h" />
- <Unit filename="..\..\src\search.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\src\search.h" />
- <Unit filename="..\..\src\speech.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\src\speech.h" />
- <Unit filename="..\..\src\statusbar.h" />
- <Unit filename="..\..\src\track.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\src\track.h" />
- <Unit filename="..\..\src\transform.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\src\transform.h" />
- <Unit filename="..\..\src\util.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\src\util.h" />
- <Unit filename="..\..\src\vehicle.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\src\vehicle.h" />
- <Unit filename="..\..\src\xmlconfig.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\src\xmlconfig.h" />
- <Unit filename="..\..\src\zipfile.h" />
- <Extensions>
- <code_completion />
- <envvars />
- <debugger />
- </Extensions>
- </Project>
-</CodeBlocks_project_file>
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
-<CodeBlocks_workspace_file>
- <Workspace title="Navit">
- <Project filename="NavitCore.cbp" />
- <Project filename="win32_gui.cbp" />
- <Project filename="fib-1.1.cbp" />
- <Project filename="Osm2Navit.cbp" />
- <Project filename="Gpx2Navit.cbp" />
- <Project filename="gentypes.cbp" />
- <Project filename="data_textfile.cbp" />
- <Project filename="mdb.cbp" />
- <Project filename="gtk_gui.cbp" />
- <Project filename="gtk_graphics.cbp" />
- <Project filename="gtk_gl_ext.cbp" />
- <Project filename="vehicle_file.cbp" />
- <Project filename="vehicle_demo.cbp" />
- <Project filename="speech_speech_dispatcher.cbp" />
- <Project filename="binfile.cbp" />
- <Project filename="data_poi_geodownload.cbp" />
- <Project filename="data_garmin.cbp">
- <Depends filename="gentypes.cbp" />
- </Project>
- <Project filename="data_mg.cbp" />
- <Project filename="Navit_win32.cbp">
- <Depends filename="NavitCore.cbp" />
- <Depends filename="win32_gui.cbp" />
- <Depends filename="fib-1.1.cbp" />
- <Depends filename="Osm2Navit.cbp" />
- <Depends filename="gentypes.cbp" />
- <Depends filename="data_textfile.cbp" />
- <Depends filename="mdb.cbp" />
- <Depends filename="gtk_gui.cbp" />
- <Depends filename="gtk_graphics.cbp" />
- <Depends filename="gtk_gl_ext.cbp" />
- <Depends filename="vehicle_file.cbp" />
- <Depends filename="vehicle_demo.cbp" />
- <Depends filename="speech_speech_dispatcher.cbp" />
- <Depends filename="binfile.cbp" />
- <Depends filename="data_poi_geodownload.cbp" />
- <Depends filename="data_garmin.cbp" />
- <Depends filename="data_mg.cbp" />
- </Project>
- <Project filename="Navit_gtk.cbp" active="1">
- <Depends filename="NavitCore.cbp" />
- <Depends filename="win32_gui.cbp" />
- <Depends filename="fib-1.1.cbp" />
- <Depends filename="Osm2Navit.cbp" />
- <Depends filename="gentypes.cbp" />
- <Depends filename="data_textfile.cbp" />
- <Depends filename="mdb.cbp" />
- <Depends filename="gtk_gui.cbp" />
- <Depends filename="gtk_graphics.cbp" />
- <Depends filename="gtk_gl_ext.cbp" />
- <Depends filename="vehicle_file.cbp" />
- <Depends filename="vehicle_demo.cbp" />
- <Depends filename="speech_speech_dispatcher.cbp" />
- <Depends filename="binfile.cbp" />
- <Depends filename="data_poi_geodownload.cbp" />
- <Depends filename="data_garmin.cbp" />
- <Depends filename="data_mg.cbp" />
- </Project>
- </Workspace>
-</CodeBlocks_workspace_file>
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
-<CodeBlocks_project_file>
- <FileVersion major="1" minor="6" />
- <Project>
- <Option title="NavitCommon" />
- <Option pch_mode="2" />
- <Option compiler="gcc" />
- <Build>
- <Target title="Debug">
- <Option output=".\bin\Debug\NavitCommonLib" prefix_auto="1" extension_auto="1" />
- <Option working_dir=".\bin\Debug" />
- <Option object_output=".\obj\Debug\" />
- <Option type="3" />
- <Option compiler="gcc" />
- <Option createDefFile="1" />
- <Compiler>
- <Add option="-g" />
- </Compiler>
- </Target>
- <Target title="Release">
- <Option output=".\bin\Release\NavitCommonLib" prefix_auto="1" extension_auto="1" />
- <Option working_dir=".\bin\Release" />
- <Option object_output=".\obj\Release\" />
- <Option type="3" />
- <Option compiler="gcc" />
- <Option createDefFile="1" />
- <Compiler>
- <Add option="-O2" />
- </Compiler>
- <Linker>
- <Add option="-s" />
- </Linker>
- </Target>
- </Build>
- <Compiler>
- <Add option="-Wall" />
- <Add option="-mms-bitfields" />
- <Add option='-DMODULE=\"Navit\"' />
- <Add directory="%GTK_DIR%\include\glib-2.0" />
- <Add directory="%GTK_DIR%\lib\glib-2.0\include" />
- <Add directory="Win32Extra" />
- <Add directory="%GTK_DIR%\include" />
- </Compiler>
- <Linker>
- <Add library="glib-2.0" />
- <Add library="z" />
- <Add directory="%GTK_DIR%\lib" />
- </Linker>
- <Unit filename="Win32Extra\setenv.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="Win32Extra\setenv.h" />
- <Unit filename="Win32Extra\sys\mman.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="Win32Extra\sys\mman.h" />
- <Unit filename="Win32Extra\wordexp.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="Win32Extra\wordexp.h" />
- <Unit filename="..\..\src\callback.h" />
- <Unit filename="..\..\src\debug.h" />
- <Unit filename="..\..\src\file.h" />
- <Unit filename="..\..\src\item.h" />
- <Unit filename="..\..\src\map.h" />
- <Unit filename="..\..\src\param.h" />
- <Unit filename="..\..\src\search.h" />
- <Unit filename="..\..\src\transform.h" />
- <Extensions>
- <code_completion />
- <envvars />
- <debugger />
- </Extensions>
- </Project>
-</CodeBlocks_project_file>
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
-<CodeBlocks_project_file>
- <FileVersion major="1" minor="6" />
- <Project>
- <Option title="NavitCore" />
- <Option pch_mode="2" />
- <Option compiler="gcc" />
- <Build>
- <Target title="Debug">
- <Option output="bin\Debug\libNavit" prefix_auto="1" extension_auto="1" />
- <Option working_dir="" />
- <Option object_output="obj\Debug\" />
- <Option type="2" />
- <Option compiler="gcc" />
- <Compiler>
- <Add option="-g" />
- </Compiler>
- </Target>
- <Target title="Release">
- <Option output="bin\Release\libNavit" prefix_auto="1" extension_auto="1" />
- <Option working_dir="" />
- <Option object_output="obj\Release\" />
- <Option type="2" />
- <Option compiler="gcc" />
- <Compiler>
- <Add option="-O2" />
- </Compiler>
- </Target>
- </Build>
- <Compiler>
- <Add option="-Wall" />
- <Add option="-mms-bitfields" />
- <Add option="-DMODULE=Navit" />
- <Add option='-DPREFIX=\"/usr/local\"' />
- <Add directory="%GTK_DIR%\include" />
- <Add directory="%GTK_DIR%\include\gtk-2.0" />
- <Add directory="%GTK_DIR%\include\glib-2.0" />
- <Add directory="%GTK_DIR%\lib\gtk-2.0\include" />
- <Add directory="%GTK_DIR%\lib\glib-2.0\include" />
- <Add directory="%GTK_DIR%\include\cairo" />
- <Add directory="%GTK_DIR%\include\pango-1.0" />
- <Add directory="%GTK_DIR%\include\atk-1.0" />
- <Add directory="..\..\src" />
- <Add directory="Win32Extra" />
- <Add directory="..\..\src\fib-1.1" />
- <Add directory="%GTK_DIR%\include\freetype2" />
- </Compiler>
- <Linker>
- <Add directory="%GTK_DIR%\lib" />
- </Linker>
- <Unit filename="Win32Extra\config.h" />
- <Unit filename="Win32Extra\serial_io.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="Win32Extra\serial_io.h" />
- <Unit filename="Win32Extra\setenv.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="Win32Extra\setenv.h" />
- <Unit filename="Win32Extra\sys\mman.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="Win32Extra\sys\mman.h" />
- <Unit filename="Win32Extra\wordexp.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="Win32Extra\wordexp.h" />
- <Unit filename="..\..\src\Makefile" />
- <Unit filename="..\..\src\Makefile.am" />
- <Unit filename="..\..\src\Makefile.in" />
- <Unit filename="..\..\src\attr.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\src\attr.h" />
- <Unit filename="..\..\src\attr_def.h" />
- <Unit filename="..\..\src\callback.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\src\callback.h" />
- <Unit filename="..\..\src\color.h" />
- <Unit filename="..\..\src\compass.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\src\compass.h" />
- <Unit filename="..\..\src\coord.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\src\coord.h" />
- <Unit filename="..\..\src\country.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\src\country.h" />
- <Unit filename="..\..\src\cursor.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\src\cursor.h" />
- <Unit filename="..\..\src\data.h" />
- <Unit filename="..\..\src\data_window.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\src\data_window.h" />
- <Unit filename="..\..\src\data_window_int.h" />
- <Unit filename="..\..\src\debug.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\src\debug.h" />
- <Unit filename="..\..\src\destination.h" />
- <Unit filename="..\..\src\draw_info.h" />
- <Unit filename="..\..\src\file.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\src\file.h" />
- <Unit filename="..\..\src\graphics.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\src\graphics.h" />
- <Unit filename="..\..\src\gtkext.h" />
- <Unit filename="..\..\src\gui.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\src\gui.h" />
- <Unit filename="..\..\src\gui\gtk\gui_gtk.h" />
- <Unit filename="..\..\src\item.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\src\item.h" />
- <Unit filename="..\..\src\item_def.h" />
- <Unit filename="..\..\src\layer.h" />
- <Unit filename="..\..\src\layout.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\src\layout.h" />
- <Unit filename="..\..\src\log.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\src\log.h" />
- <Unit filename="..\..\src\main.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\src\main.h" />
- <Unit filename="..\..\src\map-share.h" />
- <Unit filename="..\..\src\map.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\src\map.h" />
- <Unit filename="..\..\src\map_data.h" />
- <Unit filename="..\..\src\mapset.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\src\mapset.h" />
- <Unit filename="..\..\src\maptype.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\src\maptype.h" />
- <Unit filename="..\..\src\menu.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\src\menu.h" />
- <Unit filename="..\..\src\navigation.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\src\navigation.h" />
- <Unit filename="..\..\src\navit.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\src\navit.h" />
- <Unit filename="..\..\src\navit.xml" />
- <Unit filename="..\..\src\osd.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\src\osd.h" />
- <Unit filename="..\..\src\param.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\src\param.h" />
- <Unit filename="..\..\src\phrase.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\src\phrase.h" />
- <Unit filename="..\..\src\plugin.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\src\plugin.h" />
- <Unit filename="..\..\src\plugin_def.h" />
- <Unit filename="..\..\src\point.h" />
- <Unit filename="..\..\src\popup.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\src\popup.h" />
- <Unit filename="..\..\src\profile.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\src\profile.h" />
- <Unit filename="..\..\src\projection.h" />
- <Unit filename="..\..\src\route.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\src\route.h" />
- <Unit filename="..\..\src\search.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\src\search.h" />
- <Unit filename="..\..\src\speech.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\src\speech.h" />
- <Unit filename="..\..\src\statusbar.h" />
- <Unit filename="..\..\src\track.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\src\track.h" />
- <Unit filename="..\..\src\transform.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\src\transform.h" />
- <Unit filename="..\..\src\util.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\src\util.h" />
- <Unit filename="..\..\src\vehicle.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\src\vehicle.h" />
- <Unit filename="..\..\src\xmlconfig.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\src\xmlconfig.h" />
- <Unit filename="..\..\src\zipfile.h" />
- <Extensions>
- <code_completion />
- <envvars />
- <debugger />
- </Extensions>
- </Project>
-</CodeBlocks_project_file>
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
-<CodeBlocks_project_file>
- <FileVersion major="1" minor="6" />
- <Project>
- <Option title="Navit_gtk" />
- <Option pch_mode="2" />
- <Option compiler="gcc" />
- <Build>
- <Target title="Debug">
- <Option output="bin\Debug\Navit_gtk" prefix_auto="1" extension_auto="1" />
- <Option object_output="obj\Debug\" />
- <Option external_deps="bin\Debug\libnavit.a;bin\Debug\libvehicle_file.la;bin\Debug\libdata_binfile.la;bin\Debug\libgtk_graphics.la;bin\Debug\libgtk_gui.la;bin\Debug\libwin32_gui.la" />
- <Option type="1" />
- <Option compiler="gcc" />
- <Option use_console_runner="0" />
- <Compiler>
- <Add option="-g" />
- </Compiler>
- <Linker>
- <Add library="bin\Debug\libvehicle_file.la" />
- <Add library="bin\Debug\libdata_binfile.la" />
- <Add library="bin\Debug\libgtk_graphics.la" />
- <Add library="bin\Debug\libgtk_gui.la" />
- <Add library="bin\Debug\libvehicle_demo.la" />
- <Add library="bin\Debug\libdata_poi_geodownload.la" />
- <Add library="bin\Debug\libmdb.a" />
- <Add library="bin\Debug\libdata_garmin.la" />
- <Add library="bin\Debug\libspeech_speech_dispatcher.la" />
- <Add library="bin\Debug\libdata_mg.la" />
- <Add library="bin\Debug\libdata_textfile.la" />
- <Add library="libgarmin.a" />
- <Add library="bin\Debug\libnavit.a" />
- <Add library="bin\Debug\libfib.a" />
- <Add library="ole32" />
- <Add library="user32" />
- <Add library="gdi32" />
- <Add library="gtk-win32-2.0" />
- <Add library="gdk-win32-2.0" />
- <Add library="gdk_pixbuf-2.0" />
- <Add library="freetype" />
- <Add library="fontconfig" />
- <Add library="z" />
- <Add library="gobject-2.0" />
- <Add library="gmodule-2.0" />
- <Add library="glib-2.0" />
- <Add library="intl" />
- <Add directory="bin\Debug" />
- <Add directory="." />
- <Add directory="Win32Extra\libgarmin" />
- </Linker>
- </Target>
- <Target title="Release">
- <Option output="bin\Release\Navit_gtk" prefix_auto="1" extension_auto="1" />
- <Option object_output="obj\Release\" />
- <Option type="1" />
- <Option compiler="gcc" />
- <Option use_console_runner="0" />
- <Compiler>
- <Add option="-O2" />
- </Compiler>
- <Linker>
- <Add option="-s" />
- <Add library="bin\Release\libvehicle_file.la" />
- <Add library="bin\Release\libdata_binfile.la" />
- <Add library="bin\Release\libgtk_graphics.la" />
- <Add library="bin\Release\libvehicle_demo.la" />
- <Add library="bin\Release\libgtk_gui.la" />
- <Add library="bin\Release\libdata_poi_geodownload.la" />
- <Add library="bin\Release\libmdb.a" />
- <Add library="bin\Release\libdata_garmin.la" />
- <Add library="bin\Release\libspeech_speech_dispatcher.la" />
- <Add library="bin\Release\libdata_mg.la" />
- <Add library="bin\Release\libdata_textfile.la" />
- <Add library="libgarmin.a" />
- <Add library="bin\Release\libnavit.a" />
- <Add library="bin\Release\libfib.a" />
- <Add library="ole32" />
- <Add library="user32" />
- <Add library="gtk-win32-2.0" />
- <Add library="gdk-win32-2.0" />
- <Add library="gdk_pixbuf-2.0" />
- <Add library="freetype" />
- <Add library="fontconfig" />
- <Add library="z" />
- <Add library="gobject-2.0" />
- <Add library="gmodule-2.0" />
- <Add library="glib-2.0" />
- <Add library="intl" />
- <Add directory="." />
- <Add directory="Win32Extra\libgarmin" />
- </Linker>
- </Target>
- </Build>
- <Compiler>
- <Add option="-Wall" />
- <Add option="-mms-bitfields" />
- <Add option="-DMODULE=Navit" />
- <Add option='-DPREFIX=\"/usr/local\"' />
- <Add directory="%GTK_DIR%\include" />
- <Add directory="%GTK_DIR%\include\gtk-2.0" />
- <Add directory="%GTK_DIR%\include\glib-2.0" />
- <Add directory="%GTK_DIR%\lib\gtk-2.0\include" />
- <Add directory="%GTK_DIR%\lib\glib-2.0\include" />
- <Add directory="%GTK_DIR%\include\cairo" />
- <Add directory="%GTK_DIR%\include\pango-1.0" />
- <Add directory="%GTK_DIR%\include\atk-1.0" />
- <Add directory="..\..\src" />
- <Add directory="Win32Extra" />
- <Add directory="..\..\src\fib-1.1" />
- <Add directory="%GTK_DIR%\include\freetype2" />
- </Compiler>
- <Linker>
- <Add directory="%GTK_DIR%\lib" />
- </Linker>
- <Unit filename="Win32Extra\navit_gtk.c">
- <Option compilerVar="CC" />
- </Unit>
- <Extensions>
- <code_completion />
- <envvars />
- <debugger />
- </Extensions>
- </Project>
-</CodeBlocks_project_file>
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
-<CodeBlocks_project_file>
- <FileVersion major="1" minor="6" />
- <Project>
- <Option title="gui_gtk" />
- <Option pch_mode="2" />
- <Option compiler="gcc" />
- <Build>
- <Target title="Debug">
- <Option output="bin\Debug\gui_gtk" prefix_auto="1" extension_auto="1" />
- <Option object_output="obj\Debug\" />
- <Option type="3" />
- <Option compiler="gcc" />
- <Option createDefFile="1" />
- <Option createStaticLib="1" />
- <Compiler>
- <Add option="-g" />
- </Compiler>
- <Linker>
- <Add directory="bin\Debug" />
- </Linker>
- </Target>
- <Target title="Release">
- <Option output="bin\Release\gui_gtk" prefix_auto="1" extension_auto="1" />
- <Option object_output="obj\Release\" />
- <Option type="3" />
- <Option compiler="gcc" />
- <Option createDefFile="1" />
- <Option createStaticLib="1" />
- <Compiler>
- <Add option="-O2" />
- </Compiler>
- <Linker>
- <Add option="-s" />
- </Linker>
- </Target>
- </Build>
- <Compiler>
- <Add option="-Wall" />
- <Add option="-DBUILD_DLL" />
- <Add option='-DMODULE=\"Navit\"' />
- <Add directory="%GTK_DIR%\include" />
- <Add directory="%GTK_DIR%\include\gtk-2.0" />
- <Add directory="%GTK_DIR%\include\glib-2.0" />
- <Add directory="%GTK_DIR%\lib\gtk-2.0\include" />
- <Add directory="%GTK_DIR%\lib\glib-2.0\include" />
- <Add directory="%GTK_DIR%\include\cairo" />
- <Add directory="%GTK_DIR%\include\pango-1.0" />
- <Add directory="%GTK_DIR%\include\atk-1.0" />
- <Add directory="..\..\src" />
- <Add directory="Win32Extra" />
- </Compiler>
- <Linker>
- <Add library="NavitCommonLib" />
- <Add library="user32" />
- <Add library="gtk-win32-2.0" />
- <Add library="gobject-2.0" />
- <Add library="gdk_pixbuf-2.0" />
- <Add library="glib-2.0" />
- <Add library="intl" />
- <Add directory="%GTK_DIR%\lib" />
- </Linker>
- <Unit filename="main.cpp" />
- <Unit filename="main.h" />
- <Unit filename="..\..\src\gui\gtk\datawindow.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\src\gui\gtk\destination.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\src\gui\gtk\gui_gtk.h" />
- <Unit filename="..\..\src\gui\gtk\gui_gtk_action.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\src\gui\gtk\gui_gtk_statusbar.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\src\gui\gtk\gui_gtk_window.c">
- <Option compilerVar="CC" />
- </Unit>
- <Extensions>
- <code_completion />
- <envvars />
- <debugger />
- </Extensions>
- </Project>
-</CodeBlocks_project_file>
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
-<CodeBlocks_project_file>
- <FileVersion major="1" minor="6" />
- <Project>
- <Option title="Navit_win32" />
- <Option pch_mode="2" />
- <Option compiler="gcc" />
- <Build>
- <Target title="Debug">
- <Option output="bin\Debug\Navit_win32" prefix_auto="1" extension_auto="1" />
- <Option object_output="obj\Debug\" />
- <Option external_deps="bin\Debug\libnavit.a;bin\Debug\libvehicle_file.la;bin\Debug\libdata_binfile.la;bin\Debug\libgtk_graphics.la;bin\Debug\libgtk_gui.la;bin\Debug\libwin32_gui.la" />
- <Option type="1" />
- <Option compiler="gcc" />
- <Option use_console_runner="0" />
- <Compiler>
- <Add option="-g" />
- </Compiler>
- <Linker>
- <Add library="bin\Debug\libvehicle_file.la" />
- <Add library="bin\Debug\libdata_binfile.la" />
- <Add library="bin\Debug\libvehicle_demo.la" />
- <Add library="bin\Debug\libdata_poi_geodownload.la" />
- <Add library="bin\Debug\libmdb.a" />
- <Add library="bin\Debug\libdata_garmin.la" />
- <Add library="bin\Debug\libspeech_speech_dispatcher.la" />
- <Add library="bin\Debug\libdata_mg.la" />
- <Add library="bin\Debug\libdata_textfile.la" />
- <Add library="libgarmin.a" />
- <Add library="bin\Debug\libwin32_gui.la" />
- <Add library="bin\Debug\libnavit.a" />
- <Add library="bin\Debug\libfib.a" />
- <Add library="ole32" />
- <Add library="user32" />
- <Add library="gdi32" />
- <Add library="z" />
- <Add library="gobject-2.0" />
- <Add library="gmodule-2.0" />
- <Add library="glib-2.0" />
- <Add library="intl" />
- <Add directory="bin\Debug" />
- <Add directory="." />
- <Add directory="Win32Extra\libgarmin" />
- </Linker>
- </Target>
- <Target title="Release">
- <Option output="bin\Release\Navit_win32" prefix_auto="1" extension_auto="1" />
- <Option object_output="obj\Release\" />
- <Option external_deps="bin\Release\libnavit.a;bin\Release\libvehicle_file.la;bin\Release\libdata_binfile.la;bin\Release\libgtk_graphics.la;bin\Release\libgtk_gui.la;bin\Release\libwin32_gui.la" />
- <Option type="1" />
- <Option compiler="gcc" />
- <Option use_console_runner="0" />
- <Compiler>
- <Add option="-O2" />
- </Compiler>
- <Linker>
- <Add option="-s" />
- <Add library="bin\Release\libvehicle_file.la" />
- <Add library="bin\Release\libdata_binfile.la" />
- <Add library="bin\Release\libgtk_graphics.la" />
- <Add library="bin\Release\libvehicle_demo.la" />
- <Add library="bin\Release\libgtk_gui.la" />
- <Add library="bin\Release\libdata_poi_geodownload.la" />
- <Add library="bin\Release\libmdb.a" />
- <Add library="bin\Release\libdata_garmin.la" />
- <Add library="bin\Release\libspeech_speech_dispatcher.la" />
- <Add library="bin\Release\libdata_mg.la" />
- <Add library="bin\Release\libdata_textfile.la" />
- <Add library="bin\Release\libwin32_gui.la" />
- <Add library="libgarmin.a" />
- <Add library="bin\Release\libnavit.a" />
- <Add library="bin\Release\libfib.a" />
- <Add library="ole32" />
- <Add library="user32" />
- <Add library="gdi32" />
- <Add library="z" />
- <Add library="gobject-2.0" />
- <Add library="gmodule-2.0" />
- <Add library="glib-2.0" />
- <Add library="intl" />
- <Add directory="." />
- <Add directory="Win32Extra\libgarmin" />
- </Linker>
- </Target>
- </Build>
- <Compiler>
- <Add option="-Wall" />
- <Add option="-mms-bitfields" />
- <Add option="-DMODULE=Navit" />
- <Add option='-DPREFIX=\"/usr/local\"' />
- <Add directory="%GTK_DIR%\include" />
- <Add directory="%GTK_DIR%\include\gtk-2.0" />
- <Add directory="%GTK_DIR%\include\glib-2.0" />
- <Add directory="%GTK_DIR%\lib\gtk-2.0\include" />
- <Add directory="%GTK_DIR%\lib\glib-2.0\include" />
- <Add directory="%GTK_DIR%\include\cairo" />
- <Add directory="%GTK_DIR%\include\pango-1.0" />
- <Add directory="%GTK_DIR%\include\atk-1.0" />
- <Add directory="..\..\src" />
- <Add directory="Win32Extra" />
- <Add directory="..\..\src\fib-1.1" />
- <Add directory="%GTK_DIR%\include\freetype2" />
- </Compiler>
- <ResourceCompiler>
- <Add directory="win32gui\resources" />
- </ResourceCompiler>
- <Linker>
- <Add directory="%GTK_DIR%\lib" />
- </Linker>
- <Unit filename="Win32Extra\navit_win32.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="win32gui\resources\resource.h" />
- <Unit filename="win32gui\resources\resource.rc">
- <Option compilerVar="WINDRES" />
- </Unit>
- <Extensions>
- <code_completion />
- <envvars />
- <debugger />
- </Extensions>
- </Project>
-</CodeBlocks_project_file>
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
-<CodeBlocks_project_file>
- <FileVersion major="1" minor="6" />
- <Project>
- <Option title="Osm2Navit" />
- <Option pch_mode="2" />
- <Option compiler="gcc" />
- <Build>
- <Target title="Debug">
- <Option output="bin\Debug\Osm2Navit" prefix_auto="1" extension_auto="1" />
- <Option working_dir="bin\Debug" />
- <Option object_output="obj\osm2navit\Debug\" />
- <Option type="1" />
- <Option compiler="gcc" />
- <Option use_console_runner="0" />
- <Option parameters="--input-file=d:\europe.osm --attr-debug-level=5 europa.bin" />
- <Compiler>
- <Add option="-g" />
- </Compiler>
- <Linker>
- <Add directory="%GTK_DIR%\lib" />
- <Add directory="bin\Debug" />
- </Linker>
- </Target>
- <Target title="Release">
- <Option output="bin\Release\Osm2Navit" prefix_auto="1" extension_auto="1" />
- <Option object_output="obj\osm2navit\Release\" />
- <Option type="1" />
- <Option compiler="gcc" />
- <Compiler>
- <Add option="-O2" />
- </Compiler>
- <Linker>
- <Add option="-s" />
- <Add directory="%GTK_DIR%\lib" />
- <Add directory="bin\Release" />
- </Linker>
- </Target>
- </Build>
- <Compiler>
- <Add option="-Wall" />
- <Add option="-mms-bitfields -DMODULE=osm2navit" />
- <Add directory="%GTK_DIR%\include\glib-2.0" />
- <Add directory="%GTK_DIR%\lib\glib-2.0\include" />
- <Add directory="%GTK_DIR%\include" />
- <Add directory="Win32Extra" />
- </Compiler>
- <Linker>
- <Add library="user32" />
- <Add library="gtk-win32-2.0" />
- <Add library="gdk-win32-2.0" />
- <Add library="gdk_pixbuf-2.0" />
- <Add library="freetype" />
- <Add library="z" />
- <Add library="gobject-2.0" />
- <Add library="gmodule-2.0" />
- <Add library="glib-2.0" />
- <Add library="intl" />
- <Add library="zdll" />
- <Add directory="%GTK_DIR%\lib" />
- </Linker>
- <Unit filename="Win32Extra\sys\mman.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="Win32Extra\sys\mman.h" />
- <Unit filename="Win32Extra\wordexp.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="Win32Extra\wordexp.h" />
- <Unit filename="..\..\src\attr.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\src\attr.h" />
- <Unit filename="..\..\src\attr_def.h" />
- <Unit filename="..\..\src\coord.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\src\coord.h" />
- <Unit filename="..\..\src\country.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\src\country.h" />
- <Unit filename="..\..\src\debug.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\src\debug.h" />
- <Unit filename="..\..\src\file.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\src\file.h" />
- <Unit filename="..\..\src\item.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\src\item.h" />
- <Unit filename="..\..\src\map.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\src\map.h" />
- <Unit filename="..\..\src\osm2navit.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\src\param.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\src\param.h" />
- <Unit filename="..\..\src\plugin.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\src\plugin.h" />
- <Unit filename="..\..\src\transform.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\src\transform.h" />
- <Extensions>
- <code_completion />
- <envvars />
- <debugger />
- </Extensions>
- </Project>
-</CodeBlocks_project_file>
+++ /dev/null
-/* $XFree86: xc/include/XF86keysym.h,v 1.16 2003/02/11 02:51:10 dawes Exp $ */
-
-/*
- * XFree86 vendor specific keysyms.
- *
- * The XFree86 keysym range is 0x10080001 - 0x1008FFFF.
- *
- * When adding new entries, the xc/lib/XKeysymDB file should also be
- * updated to make the new entries visible to Xlib.
- */
-
-/*
- * ModeLock
- *
- * This one is old, and not really used any more since XKB offers this
- * functionality.
- */
-
-#define XF86XK_ModeLock 0x1008FF01 /* Mode Switch Lock */
-
-/*
- * Note, 0x1008FF02 - 0x1008FF0F are free and should be used for misc new
- * keysyms that don't fit into any of the groups below.
- *
- * 0x1008FF64, 0x1008FF6F, 0x1008FF71, 0x1008FF83 are no longer used,
- * and should be used first for new keysyms.
- *
- * Check in keysymdef.h for generic symbols before adding new XFree86-specific
- * symbols here.
- */
-
-
-/*
- * Keys found on some "Internet" keyboards.
- */
-#define XF86XK_Standby 0x1008FF10
-#define XF86XK_AudioLowerVolume 0x1008FF11
-#define XF86XK_AudioMute 0x1008FF12
-#define XF86XK_AudioRaiseVolume 0x1008FF13
-#define XF86XK_AudioPlay 0x1008FF14
-#define XF86XK_AudioStop 0x1008FF15
-#define XF86XK_AudioPrev 0x1008FF16
-#define XF86XK_AudioNext 0x1008FF17
-#define XF86XK_HomePage 0x1008FF18
-#define XF86XK_Mail 0x1008FF19
-#define XF86XK_Start 0x1008FF1A
-#define XF86XK_Search 0x1008FF1B
-#define XF86XK_AudioRecord 0x1008FF1C
-
-/* These are sometimes found on PDA's (e.g. Palm, PocketPC or elsewhere) */
-#define XF86XK_Calculator 0x1008FF1D
-#define XF86XK_Memo 0x1008FF1E
-#define XF86XK_ToDoList 0x1008FF1F
-#define XF86XK_Calendar 0x1008FF20
-#define XF86XK_PowerDown 0x1008FF21
-#define XF86XK_ContrastAdjust 0x1008FF22
-#define XF86XK_RockerUp 0x1008FF23
-#define XF86XK_RockerDown 0x1008FF24
-#define XF86XK_RockerEnter 0x1008FF25
-
-/* Some more "Internet" keyboard symbols */
-#define XF86XK_Back 0x1008FF26
-#define XF86XK_Forward 0x1008FF27
-#define XF86XK_Stop 0x1008FF28
-#define XF86XK_Refresh 0x1008FF29
-#define XF86XK_PowerOff 0x1008FF2A
-#define XF86XK_WakeUp 0x1008FF2B
-#define XF86XK_Eject 0x1008FF2C
-#define XF86XK_ScreenSaver 0x1008FF2D
-#define XF86XK_WWW 0x1008FF2E
-#define XF86XK_Sleep 0x1008FF2F
-#define XF86XK_Favorites 0x1008FF30
-#define XF86XK_AudioPause 0x1008FF31
-#define XF86XK_AudioMedia 0x1008FF32
-#define XF86XK_MyComputer 0x1008FF33
-#define XF86XK_VendorHome 0x1008FF34
-#define XF86XK_LightBulb 0x1008FF35
-#define XF86XK_Shop 0x1008FF36
-#define XF86XK_History 0x1008FF37
-#define XF86XK_OpenURL 0x1008FF38
-#define XF86XK_AddFavorite 0x1008FF39
-#define XF86XK_HotLinks 0x1008FF3A
-#define XF86XK_BrightnessAdjust 0x1008FF3B
-#define XF86XK_Finance 0x1008FF3C
-#define XF86XK_Community 0x1008FF3D
-#define XF86XK_AudioRewind 0x1008FF3E
-#define XF86XK_XF86BackForward 0x1008FF3F
-#define XF86XK_Launch0 0x1008FF40
-#define XF86XK_Launch1 0x1008FF41
-#define XF86XK_Launch2 0x1008FF42
-#define XF86XK_Launch3 0x1008FF43
-#define XF86XK_Launch4 0x1008FF44
-#define XF86XK_Launch5 0x1008FF45
-#define XF86XK_Launch6 0x1008FF46
-#define XF86XK_Launch7 0x1008FF47
-#define XF86XK_Launch8 0x1008FF48
-#define XF86XK_Launch9 0x1008FF49
-#define XF86XK_LaunchA 0x1008FF4A
-#define XF86XK_LaunchB 0x1008FF4B
-#define XF86XK_LaunchC 0x1008FF4C
-#define XF86XK_LaunchD 0x1008FF4D
-#define XF86XK_LaunchE 0x1008FF4E
-#define XF86XK_LaunchF 0x1008FF4F
-
-#define XF86XK_ApplicationLeft 0x1008FF50
-#define XF86XK_ApplicationRight 0x1008FF51
-#define XF86XK_Book 0x1008FF52
-#define XF86XK_CD 0x1008FF53
-#define XF86XK_Calculater 0x1008FF54
-#define XF86XK_Clear 0x1008FF55
-#define XF86XK_Close 0x1008FF56
-#define XF86XK_Copy 0x1008FF57
-#define XF86XK_Cut 0x1008FF58
-#define XF86XK_Display 0x1008FF59
-#define XF86XK_DOS 0x1008FF5A
-#define XF86XK_Documents 0x1008FF5B
-#define XF86XK_Excel 0x1008FF5C
-#define XF86XK_Explorer 0x1008FF5D
-#define XF86XK_Game 0x1008FF5E
-#define XF86XK_Go 0x1008FF5F
-#define XF86XK_iTouch 0x1008FF60
-#define XF86XK_LogOff 0x1008FF61
-#define XF86XK_Market 0x1008FF62
-#define XF86XK_Meeting 0x1008FF63
-#define XF86XK_MenuKB 0x1008FF65
-#define XF86XK_MenuPB 0x1008FF66
-#define XF86XK_MySites 0x1008FF67
-#define XF86XK_New 0x1008FF68
-#define XF86XK_News 0x1008FF69
-#define XF86XK_OfficeHome 0x1008FF6A
-#define XF86XK_Open 0x1008FF6B
-#define XF86XK_Option 0x1008FF6C
-#define XF86XK_Paste 0x1008FF6D
-#define XF86XK_Phone 0x1008FF6E
-#define XF86XK_Q 0x1008FF70
-#define XF86XK_Reply 0x1008FF72
-#define XF86XK_Reload 0x1008FF73
-#define XF86XK_RotateWindows 0x1008FF74
-#define XF86XK_RotationPB 0x1008FF75
-#define XF86XK_RotationKB 0x1008FF76
-#define XF86XK_Save 0x1008FF77
-#define XF86XK_ScrollUp 0x1008FF78
-#define XF86XK_ScrollDown 0x1008FF79
-#define XF86XK_ScrollClick 0x1008FF7A
-#define XF86XK_Send 0x1008FF7B
-#define XF86XK_Spell 0x1008FF7C
-#define XF86XK_SplitScreen 0x1008FF7D
-#define XF86XK_Support 0x1008FF7E
-#define XF86XK_TaskPane 0x1008FF7F
-#define XF86XK_Terminal 0x1008FF80
-#define XF86XK_Tools 0x1008FF81
-#define XF86XK_Travel 0x1008FF82
-#define XF86XK_UserPB 0x1008FF84
-#define XF86XK_User1KB 0x1008FF85
-#define XF86XK_User2KB 0x1008FF86
-#define XF86XK_Video 0x1008FF87
-#define XF86XK_WheelButton 0x1008FF88
-#define XF86XK_Word 0x1008FF89
-#define XF86XK_Xfer 0x1008FF8A
-#define XF86XK_ZoomIn 0x1008FF8B
-#define XF86XK_ZoomOut 0x1008FF8C
-
-#define XF86XK_Away 0x1008FF8D
-#define XF86XK_Messenger 0x1008FF8E
-#define XF86XK_WebCam 0x1008FF8F
-#define XF86XK_MailForward 0x1008FF90
-#define XF86XK_Pictures 0x1008FF91
-#define XF86XK_Music 0x1008FF92
-
-/* Keys for special action keys (hot keys) */
-#define XF86XK_Switch_VT_1 0x1008FE01
-#define XF86XK_Switch_VT_2 0x1008FE02
-#define XF86XK_Switch_VT_3 0x1008FE03
-#define XF86XK_Switch_VT_4 0x1008FE04
-#define XF86XK_Switch_VT_5 0x1008FE05
-#define XF86XK_Switch_VT_6 0x1008FE06
-#define XF86XK_Switch_VT_7 0x1008FE07
-#define XF86XK_Switch_VT_8 0x1008FE08
-#define XF86XK_Switch_VT_9 0x1008FE09
-#define XF86XK_Switch_VT_10 0x1008FE0A
-#define XF86XK_Switch_VT_11 0x1008FE0B
-#define XF86XK_Switch_VT_12 0x1008FE0C
-
-#define XF86XK_Ungrab 0x1008FE20
-#define XF86XK_ClearGrab 0x1008FE21
-#define XF86XK_Next_VMode 0x1008FE22
-#define XF86XK_Prev_VMode 0x1008FE23
-
-
+++ /dev/null
-extern void module_data_textfile_init(void);
-extern void module_data_binfile_init(void);
-extern void module_data_mg_init(void);
-extern void module_data_garmin_init(void);
-extern void module_data_poi_geodownload_init(void);
-extern void module_gtk_graphics_init(void);
-extern void module_gtk_gui_init(void);
-extern void module_vehicle_demo_init(void);
-extern void module_vehicle_file_init(void);
-extern void module_win32_gui_init(void);
-extern void module_speech_speech_dispatcher_init(void);
-extern void builtin_init(void);
-void builtin_init(void) {
- module_data_textfile_init();
- module_data_binfile_init();
- module_data_mg_init();
- module_win32_gui_init();
- module_data_garmin_init();
- module_data_poi_geodownload_init();
- module_gtk_graphics_init();
- module_gtk_gui_init();
- module_vehicle_demo_init();
- module_vehicle_file_init();
- module_speech_speech_dispatcher_init();
-}
+++ /dev/null
-#ifndef _BYTESWAP_H
-#define _BYTESWAP_H
-
-static inline unsigned short bswap_16(unsigned short x) {
- return (x>>8) | (x<<8);
-}
-
-static inline unsigned int bswap_32(unsigned int x) {
- return (bswap_16(x&0xffff)<<16) | (bswap_16(x>>16));
-}
-
-static inline unsigned long long bswap_64(unsigned long long x) {
- return (((unsigned long long)bswap_32(x&0xffffffffull))<<32) | (bswap_32(x>>32));
-}
-
-#endif
-
+++ /dev/null
-/* config.h. Generated from config.h.in by configure. */
-/* config.h.in. Generated from configure.in by autoheader. */
-
-/* Define to avoid floating point */
-/* #undef AVOID_FLOAT */
-
-/* Define to avoid unaligned access */
-/* #undef AVOID_UNALIGNED */
-
-/* Define to one of `_getb67', `GETB67', `getb67' for Cray-2 and Cray-YMP
- systems. This function is required for `alloca.c' support on those systems.
- */
-/* #undef CRAY_STACKSEG_END */
-
-/* Define to 1 if using `alloca.c'. */
-/* #undef C_ALLOCA */
-
-/* Define to 1 if translation of program messages to the user's native
- language is requested. */
-#define ENABLE_NLS 1
-
-/* Define to 1 if you have `alloca', as a function or macro. */
-#define HAVE_ALLOCA 1
-
-/* Define to 1 if you have <alloca.h> and it should be used (not on Ultrix).
- */
-#define HAVE_ALLOCA_H 1
-
-/* Define to 1 if you have the `argz_count' function. */
-#define HAVE_ARGZ_COUNT 1
-
-/* Define to 1 if you have the <argz.h> header file. */
-#define HAVE_ARGZ_H 1
-
-/* Define to 1 if you have the `argz_next' function. */
-#define HAVE_ARGZ_NEXT 1
-
-/* Define to 1 if you have the `argz_stringify' function. */
-#define HAVE_ARGZ_STRINGIFY 1
-
-/* Define to 1 if you have the `asprintf' function. */
-#define HAVE_ASPRINTF 1
-
-/* Define to 1 if the compiler understands __builtin_expect. */
-#define HAVE_BUILTIN_EXPECT 1
-
-/* Define to 1 if you have the [CEGUI/CEGUI.h] header file. */
-/* #undef HAVE_CEGUI */
-
-/* Define to 1 if you have the MacOS X function CFLocaleCopyCurrent in the
- CoreFoundation framework. */
-/* #undef HAVE_CFLOCALECOPYCURRENT */
-
-/* Define to 1 if you have the MacOS X function CFPreferencesCopyAppValue in
- the CoreFoundation framework. */
-/* #undef HAVE_CFPREFERENCESCOPYAPPVALUE */
-
-/* Define if the GNU dcgettext() function is already present or preinstalled.
- */
-#define HAVE_DCGETTEXT 1
-
-/* Define to 1 if you have the declaration of `feof_unlocked', and to 0 if you
- don't. */
-#define HAVE_DECL_FEOF_UNLOCKED 0
-
-/* Define to 1 if you have the declaration of `fgets_unlocked', and to 0 if
- you don't. */
-#define HAVE_DECL_FGETS_UNLOCKED 0
-
-/* Define to 1 if you have the declaration of `getc_unlocked', and to 0 if you
- don't. */
-#define HAVE_DECL_GETC_UNLOCKED 1
-
-/* Define to 1 if you have the declaration of `_snprintf', and to 0 if you
- don't. */
-#define HAVE_DECL__SNPRINTF 0
-
-/* Define to 1 if you have the declaration of `_snwprintf', and to 0 if you
- don't. */
-#define HAVE_DECL__SNWPRINTF 0
-
-/* Define to 1 if you have the <dlfcn.h> header file. */
-#define HAVE_DLFCN_H 1
-
-/* Define to 1 if you have imlib2 */
-#define HAVE_FREETYPE2 1
-
-/* Define to 1 if you have the `fwprintf' function. */
-/* #undef HAVE_FWPRINTF */
-
-/* Define to 1 if you have the `getcwd' function. */
-#define HAVE_GETCWD 1
-
-/* Define to 1 if you have the `getegid' function. */
-#define HAVE_GETEGID 1
-
-/* Define to 1 if you have the `geteuid' function. */
-#define HAVE_GETEUID 1
-
-/* Define to 1 if you have the `getgid' function. */
-#define HAVE_GETGID 1
-
-/* Define to 1 if you have the `getpagesize' function. */
-#define HAVE_GETPAGESIZE 1
-
-/* Define if the GNU gettext() function is already present or preinstalled. */
-#define HAVE_GETTEXT 1
-
-/* Define to 1 if you have the `getuid' function. */
-#define HAVE_GETUID 1
-
-/* Define to 1 if you have the <GL/glc.h> header file. */
-/* #undef HAVE_GLC */
-
-/* Define to 1 if you have the <GL/glut.h> header file. */
-#define HAVE_GLUT
-
-/* Define to 1 if you have imlib2 */
-#define HAVE_GTK2 1
-
-/* Define if you have the iconv() function. */
-#define HAVE_ICONV 1
-
-/* Define to 1 if you have imlib2 */
-/* #undef HAVE_IMLIB2 */
-
-/* Define if you have the 'intmax_t' type in <stdint.h> or <inttypes.h>. */
-#define HAVE_INTMAX_T 1
-
-/* Define if <inttypes.h> exists and doesn't clash with <sys/types.h>. */
-#define HAVE_INTTYPES_H 1
-
-/* Define if <inttypes.h> exists, doesn't clash with <sys/types.h>, and
- declares uintmax_t. */
-#define HAVE_INTTYPES_H_WITH_UINTMAX 1
-
-/* Define if you have <langinfo.h> and nl_langinfo(CODESET). */
-#define HAVE_LANGINFO_CODESET 1
-
-/* Define if your <locale.h> file defines LC_MESSAGES. */
-#define HAVE_LC_MESSAGES 1
-
-/* Define to 1 if you have the `CEGUIBase' library (-lCEGUIBase). */
-/* #undef HAVE_LIBCEGUIBASE */
-
-/* Define to 1 if you have the `CEGUIFalagardWRBase' library
- (-lCEGUIFalagardWRBase). */
-/* #undef HAVE_LIBCEGUIFALAGARDWRBASE */
-
-/* Define to 1 if you have the `CEGUIOpenGLRenderer' library
- (-lCEGUIOpenGLRenderer). */
-/* #undef HAVE_LIBCEGUIOPENGLRENDERER */
-
-/* Define to 1 if you have the <gps.h> header file. */
-/* #undef HAVE_LIBGPS */
-
-/* Define to 1 if you have the <SDL/SDL.h> header file. */
-/* #undef HAVE_LIBSDL */
-
-/* Define to 1 if you have the <libspeechd.h> header file. */
-/* #undef HAVE_LIBSPEECHD */
-
-/* Define to 1 if you have the <limits.h> header file. */
-#define HAVE_LIMITS_H 1
-
-/* Define if you have the 'long double' type. */
-#define HAVE_LONG_DOUBLE 1
-
-/* Define if you have the 'long long' type. */
-#define HAVE_LONG_LONG 1
-
-/* Define to 1 if you have the <memory.h> header file. */
-#define HAVE_MEMORY_H 1
-
-/* Define to 1 if you have the `mempcpy' function. */
-#define HAVE_MEMPCPY 1
-
-/* Define to 1 if you have a working `mmap' system call. */
-/* #undef HAVE_MMAP */
-
-/* Define to 1 if you have the `munmap' function. */
-#define HAVE_MUNMAP 1
-
-/* Define if you have <langinfo.h> and it defines the NL_LOCALE_NAME macro if
- _GNU_SOURCE is defined. */
-/* #undef HAVE_NL_LOCALE_NAME */
-
-/* Define to 1 if you have the <GL/gl.h> header file. */
-#define HAVE_OPENGL
-
-/* Define if your printf() function supports format strings with positions. */
-#define HAVE_POSIX_PRINTF 1
-
-/* Define if the <pthread.h> defines PTHREAD_MUTEX_RECURSIVE. */
-#define HAVE_PTHREAD_MUTEX_RECURSIVE 1
-
-/* Define if the POSIX multithreading library has read/write locks. */
-#define HAVE_PTHREAD_RWLOCK 1
-
-/* Define to 1 if you have the `putenv' function. */
-#define HAVE_PUTENV 1
-
-/* Define to 1 if you have python */
-#define HAVE_PYTHON 1
-
-/* Define to 1 if you have the `setenv' function. */
-#define HAVE_SETENV 1
-
-/* Define to 1 if you have the `setlocale' function. */
-#define HAVE_SETLOCALE 1
-
-/* Define to 1 if you have the `snprintf' function. */
-#define HAVE_SNPRINTF 1
-
-/* Define to 1 if you have the <stddef.h> header file. */
-#define HAVE_STDDEF_H 1
-
-/* Define to 1 if you have the <stdint.h> header file. */
-#define HAVE_STDINT_H 1
-
-/* Define if <stdint.h> exists, doesn't clash with <sys/types.h>, and declares
- uintmax_t. */
-#define HAVE_STDINT_H_WITH_UINTMAX 1
-
-/* Define to 1 if you have the <stdlib.h> header file. */
-#define HAVE_STDLIB_H 1
-
-/* Define to 1 if you have the `stpcpy' function. */
-/* #undef HAVE_STPCPY */
-
-/* Define to 1 if you have the `strcasecmp' function. */
-#define HAVE_STRCASECMP 1
-
-/* Define to 1 if you have the `strdup' function. */
-#define HAVE_STRDUP 1
-
-/* Define to 1 if you have the <strings.h> header file. */
-#define HAVE_STRINGS_H 1
-
-/* Define to 1 if you have the <string.h> header file. */
-#define HAVE_STRING_H 1
-
-/* Define to 1 if you have the `strtoul' function. */
-#define HAVE_STRTOUL 1
-
-/* Define to 1 if you have the <sys/param.h> header file. */
-#define HAVE_SYS_PARAM_H 1
-
-/* Define to 1 if you have the <sys/stat.h> header file. */
-#define HAVE_SYS_STAT_H 1
-
-/* Define to 1 if you have the <sys/types.h> header file. */
-#define HAVE_SYS_TYPES_H 1
-
-/* Define to 1 if you have the `tsearch' function. */
-#define HAVE_TSEARCH 1
-
-/* Define if you have the 'uintmax_t' type in <stdint.h> or <inttypes.h>. */
-#define HAVE_UINTMAX_T 1
-
-/* Define to 1 if you have the <unistd.h> header file. */
-#define HAVE_UNISTD_H 1
-
-/* Define if you have the 'unsigned long long' type. */
-#define HAVE_UNSIGNED_LONG_LONG 1
-
-/* Define to 1 or 0, depending whether the compiler supports simple visibility
- declarations. */
-#define HAVE_VISIBILITY 0
-
-/* Define if you have the 'wchar_t' type. */
-#define HAVE_WCHAR_T 1
-
-/* Define to 1 if you have the `wcslen' function. */
-#define HAVE_WCSLEN 1
-
-/* Define if you have the 'wint_t' type. */
-#define HAVE_WINT_T 1
-
-/* Define to 1 if you have the <zlib.h> header file. */
-#define HAVE_ZLIB
-
-/* Define to 1 if you have the `__fsetlocking' function. */
-/* #undef HAVE___FSETLOCKING */
-
-/* Define as const if the declaration of iconv() needs const. */
-#define ICONV_CONST const
-
-/* Define if integer division by zero raises signal SIGFPE. */
-#define INTDIV0_RAISES_SIGFPE 1
-
-/* Name of package */
-#define PACKAGE "navit"
-
-/* Define to the address where bug reports for this package should be sent. */
-#define PACKAGE_BUGREPORT ""
-
-/* Define to the full name of this package. */
-#define PACKAGE_NAME "navit"
-
-/* Define to the full name and version of this package. */
-#define PACKAGE_STRING "navit 0.0.3"
-
-/* Define to the one symbol short name of this package. */
-#define PACKAGE_TARNAME "navit"
-
-/* Define to the version of this package. */
-#define PACKAGE_VERSION "0.0.3"
-
-/* Define if <inttypes.h> exists and defines unusable PRI* macros. */
-/* #undef PRI_MACROS_BROKEN */
-
-/* Define if the pthread_in_use() detection is hard. */
-/* #undef PTHREAD_IN_USE_DETECTION_HARD */
-
-/* Define as the maximum value of type 'size_t', if the system doesn't define
- it. */
-/* #undef SIZE_MAX */
-
-/* If using the C implementation of alloca, define if you know the
- direction of stack growth for your system; otherwise it will be
- automatically deduced at runtime.
- STACK_DIRECTION > 0 => grows toward higher addresses
- STACK_DIRECTION < 0 => grows toward lower addresses
- STACK_DIRECTION = 0 => direction of growth unknown */
-/* #undef STACK_DIRECTION */
-
-/* Define to 1 if you have the ANSI C header files. */
-#define STDC_HEADERS 1
-
-/* Define if the POSIX multithreading library can be used. */
-#define USE_POSIX_THREADS 1
-
-/* Define if references to the POSIX multithreading library should be made
- weak. */
-/* #undef USE_POSIX_THREADS_WEAK */
-
-/* Define if the GNU Pth multithreading library can be used. */
-/* #undef USE_PTH_THREADS */
-
-/* Define if references to the GNU Pth multithreading library should be made
- weak. */
-/* #undef USE_PTH_THREADS_WEAK */
-
-/* Define if the old Solaris multithreading library can be used. */
-/* #undef USE_SOLARIS_THREADS */
-
-/* Define if references to the old Solaris multithreading library should be
- made weak. */
-/* #undef USE_SOLARIS_THREADS_WEAK */
-
-/* Define if the Win32 multithreading API can be used. */
-/* #undef USE_WIN32_THREADS */
-
-/* Version number of package */
-#define VERSION "0.0.3"
-
-/* Enable GNU extensions on systems that have them. */
-#ifndef _GNU_SOURCE
-# define _GNU_SOURCE 1
-#endif
-
-/* Define to `__inline__' or `__inline' if that's what the C compiler
- calls it, or to nothing if 'inline' is not supported under any name. */
-#ifndef __cplusplus
-/* #undef inline */
-#endif
-
-/* Define as the type of the result of subtracting two pointers, if the system
- doesn't define it. */
-/* #undef ptrdiff_t */
-
-/* Define to empty if the C compiler doesn't support this keyword. */
-/* #undef signed */
-
-/* Define to `unsigned int' if <sys/types.h> does not define. */
-/* #undef size_t */
-
-/* Define to unsigned long or unsigned long long if <stdint.h> and
- <inttypes.h> don't define. */
-/* #undef uintmax_t */
-
-
-#define __libc_lock_t gl_lock_t
-#define __libc_lock_define gl_lock_define
-#define __libc_lock_define_initialized gl_lock_define_initialized
-#define __libc_lock_init gl_lock_init
-#define __libc_lock_lock gl_lock_lock
-#define __libc_lock_unlock gl_lock_unlock
-#define __libc_lock_recursive_t gl_recursive_lock_t
-#define __libc_lock_define_recursive gl_recursive_lock_define
-#define __libc_lock_define_initialized_recursive gl_recursive_lock_define_initialized
-#define __libc_lock_init_recursive gl_recursive_lock_init
-#define __libc_lock_lock_recursive gl_recursive_lock_lock
-#define __libc_lock_unlock_recursive gl_recursive_lock_unlock
-#define glthread_in_use libintl_thread_in_use
-#define glthread_lock_init libintl_lock_init
-#define glthread_lock_lock libintl_lock_lock
-#define glthread_lock_unlock libintl_lock_unlock
-#define glthread_lock_destroy libintl_lock_destroy
-#define glthread_rwlock_init libintl_rwlock_init
-#define glthread_rwlock_rdlock libintl_rwlock_rdlock
-#define glthread_rwlock_wrlock libintl_rwlock_wrlock
-#define glthread_rwlock_unlock libintl_rwlock_unlock
-#define glthread_rwlock_destroy libintl_rwlock_destroy
-#define glthread_recursive_lock_init libintl_recursive_lock_init
-#define glthread_recursive_lock_lock libintl_recursive_lock_lock
-#define glthread_recursive_lock_unlock libintl_recursive_lock_unlock
-#define glthread_recursive_lock_destroy libintl_recursive_lock_destroy
-#define glthread_once libintl_once
-#define glthread_once_call libintl_once_call
-#define glthread_once_singlethreaded libintl_once_singlethreaded
-
-#define index(a,b) strchr(a,b)
-#define strtok_r(s,d,p) strtok(s,d)
-
-#define alarm( a )
+++ /dev/null
-#ifndef ENDIAN_H_INCLUDED
-#define ENDIAN_H_INCLUDED
-
-#endif
-
+++ /dev/null
-/*
- Copyright (C) 2007 Alexander Atanasov <aatanasov@gmail.com>
-
- 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; version 2 of the License.
-
- 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
-
-*/
-
-#include <sys/types.h>
-
-#ifdef _WIN32
-#define u_int8_t unsigned char
-#define int8_t char
-#define int16_t short
-#define u_int16_t unsigned short
-#define int32_t int
-#define u_int32_t unsigned int
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-enum {
- L_LBL,
- L_NET,
- L_POI,
-};
-
-struct gcoord {
- int x;
- int y;
-};
-
-#define GS_COUNTRY 1
-#define GS_REGION 2
-#define GS_CITY 3
-#define GS_ZIP 4
-#define GS_ROAD 5
-#define GS_INTERSECT 6
-#define GS_HOUSENUMBER 7
-#define GS_POI 8
-
-#define GM_EXACT 0
-#define GM_START 1
-#define GM_ANY 2
-
-struct gar_search {
- unsigned char type;
- unsigned char match;
- char *needle;
- struct gobject *fromobj;
-};
-
-#define GO_POINT 1
-#define GO_POI 2
-#define GO_POLYLINE 3
-#define GO_POLYGON 4
-#define GO_ROAD 5
-
-struct gar_subfile;
-struct gar_objdraworder;
-
-struct gmap {
- struct gar_objdraworder *draworder;
- int subfiles;
- int lastsub;
- struct gar_subfile **subs;
- int zoomlevels;
- int basebits;
- int minlevel;
- int maxlevel;
-};
-
-struct gobject {
- int type;
- void *gptr;
- void *priv_data;
- struct gobject *next;
-};
-
-struct gar_rect {
- double lulat;
- double lulong;
- double rllat;
- double rllong;
-};
-
-
-/* Walk and parse all data */
-#define OPM_PARSE (1<<0)
-/* Call a callback w/ every object */
-#define OPM_DUMP (1<<1)
-/* Work as a map backend */
-#define OPM_GPS (1<<2)
-
-typedef void (*dump_fn)(struct gobject *obj);
-
-#define DBGM_LBLS (1<<0)
-#define DBGM_OBJSRC (1<<1)
-
-
-struct gar_config {
- int opm;
- int maxsubdivs; /* Load max N subdivs for OPM_GPS */
- dump_fn cb; /* Callback function for OPM_DUMP */
- unsigned debugmask; /* Debuging aid */
- int debuglevel; /* Debug level */
-};
-
-struct gimg;
-struct gar;
-
-typedef void (*log_fn)(char *file, int line, int level, char *fmt, ...)
- __attribute__ ((format(printf,4,5)));
-/* Default init w/ config, keep for the latest navit release */
-struct gar *gar_init(char *tbd, log_fn l);
-struct gar *gar_init_cfg(char *tbd, log_fn l, struct gar_config *cfg);
-void gar_free(struct gar *g);
-int gar_img_load(struct gar *gar, char *file, int data);
-struct gmap *gar_find_subfiles(struct gar *gar, void *select, int flags);
-void gar_free_gmap(struct gmap *g);
-int gar_get_zoomlevels(struct gar_subfile *sub);
-
-#define GO_GET_SORTED (1<<0)
-#define GO_GET_ROUTABLE (1<<1)
-#define GO_GET_SEARCH (1<<2)
-
-struct gobject *gar_get_object(struct gar *gar, void *ptr);
-int gar_get_objects(struct gmap *gm, int level, void *select,
- struct gobject **ret, int flags);
-void gar_free_objects(struct gobject *g);
-u_int8_t gar_obj_type(struct gobject *o);
-int gar_get_object_position(struct gobject *o, struct gcoord *ret);
-int gar_object_subtype(struct gobject *o);
-int gar_get_object_dcoord(struct gmap *gm, struct gobject *o, int ndelta, struct gcoord *ret);
-int gar_get_object_coord(struct gmap *gm, struct gobject *o, struct gcoord *ret);
-
-int gar_is_object_dcoord_node(struct gmap *gm, struct gobject *o, int ndelta);
-
-int gar_get_object_deltas(struct gobject *o);
-/* Get lbl as strdup'ed string */
-char *gar_get_object_lbl(struct gobject *o);
-int gar_get_object_intlbl(struct gobject *o);
-int gar_object_get_draw_order(struct gobject *o);
-char *gar_object_debug_str(struct gobject *o);
-/* Object index is (subdividx << 16) | (idx << 8) | otype */
-int gar_object_index(struct gobject *o);
-/* Object mapid is the id of the file containing the object */
-int gar_object_mapid(struct gobject *o);
-struct gobject *gar_get_object_by_id(struct gar *gar, unsigned int mapid,
- unsigned int objid);
-
-int gar_fat_file2fd(struct gimg *g, char *name, int fd);
-/* Get ptr to a dskimg file */
-struct gimg *gar_get_dskimg(struct gar *gar, char *file);
-
-#define F_ONEWAY (1<<0)
-#define F_SEGMENTED (1<<1)
-
-int gar_object_flags(struct gobject *o);
-
-
-#define GARDEG(x) ((x) < 0x800000 ? (double)(x) * 360.0 / 16777216.0 : -(double)((x) - 0x100000) * 360.0 / 16777216.0)
-#define GARRAD(x) ((x) < 0x800000 ? (double)(x) * TWOPI / 16777216.0 : -(double)((x) - 0x100000) * TWOPI / 16777216.0)
-#define DEGGAR(x) ((x) * (1/(360.0/(1<<24))))
-#define FEET2METER(x) ((x)/3.28084)
-
-#define POI_STREET_NUM (1<<0)
-#define POI_STREET (1<<1)
-#define POI_CITY (1<<2)
-#define POI_ZIP (1<<3)
-#define POI_PHONE (1<<4)
-#define POI_EXIT (1<<5)
-#define POI_TIDE_PREDICT (1<<6)
-#define POI_UNKNOW (1<<7)
-
-
-#ifdef __cplusplus
-}
-#endif
+++ /dev/null
-extern void module_data_textfile_init(void);
-extern void module_data_binfile_init(void);
-extern void module_data_mg_init(void);
-extern void module_data_garmin_init(void);
-extern void module_data_poi_geodownload_init(void);
-extern void module_gtk_graphics_init(void);
-extern void module_gtk_gui_init(void);
-extern void module_vehicle_demo_init(void);
-extern void module_vehicle_file_init(void);
-extern void module_speech_speech_dispatcher_init(void);
-extern void builtin_init(void);
-void builtin_init(void) {
- module_data_textfile_init();
- module_data_binfile_init();
- module_data_mg_init();
- module_data_garmin_init();
- module_data_poi_geodownload_init();
- module_gtk_graphics_init();
- module_gtk_gui_init();
- module_vehicle_demo_init();
- module_vehicle_file_init();
- module_speech_speech_dispatcher_init();
-}
+++ /dev/null
-
-
-extern void module_data_textfile_init(void);
-extern void module_data_binfile_init(void);
-extern void module_data_mg_init(void);
-extern void module_win32_gui_init(void);
-extern void module_data_garmin_init(void);
-extern void module_data_poi_geodownload_init(void);
-extern void module_vehicle_demo_init(void);
-extern void module_vehicle_file_init(void);
-extern void module_speech_speech_dispatcher_init(void);
-
-void builtin_init(void) {
- module_data_textfile_init();
- module_data_binfile_init();
- module_data_mg_init();
- module_win32_gui_init();
- module_data_garmin_init();
- module_data_poi_geodownload_init();
- module_vehicle_demo_init();
- module_vehicle_file_init();
- module_speech_speech_dispatcher_init();
-}
+++ /dev/null
-#include <stdio.h>
-#include <windows.h>
-#include "serial_io.h"
-
-int serial_io_init( const char* port, const char* strsettings )
-{
- HANDLE hCom = NULL;
-
- char strport[16];
- snprintf( strport, sizeof( strport ), "\\\\.\\%s", port );
-
- hCom = CreateFile(
- strport,
- GENERIC_WRITE | GENERIC_READ,
- 0,
- 0,
- OPEN_EXISTING,
- 0,
- NULL);
-
- if (hCom == INVALID_HANDLE_VALUE)
- {
- LPVOID lpMsgBuf;
-
- FormatMessage(
- FORMAT_MESSAGE_ALLOCATE_BUFFER |
- FORMAT_MESSAGE_FROM_SYSTEM |
- FORMAT_MESSAGE_IGNORE_INSERTS,
- NULL,
- GetLastError(),
- MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language
- (LPTSTR) &lpMsgBuf,
- 0,
- NULL
- );
- // g_strSerialError = strPort + wxT(": ") + (LPTSTR) lpMsgBuf;
-
- // Free the buffer.
- LocalFree( lpMsgBuf );
- return -1;
- }
-
- DCB dcb;
-
- ZeroMemory(&dcb, sizeof(DCB));
-
- GetCommState(hCom, &dcb);
-
-// char strsettings[255];
-// snprintf( strsettings, sizeof( strsettings ), "baud=%d parity=N data=8 stop=1", baudrate );
- BuildCommDCB( strsettings, &dcb);
-
- SetupComm(hCom, 4096, 4096);
-
- SetCommState(hCom, &dcb);
-
- COMMTIMEOUTS sCT;
-
- memset(&sCT, 0, sizeof(sCT));
- sCT.ReadTotalTimeoutConstant = 10;
-
- SetCommTimeouts(hCom, &sCT);
-
- return (int)hCom;
-}
-
-int serial_io_read( int fd, char * buffer, int buffer_size )
-{
- DWORD dwBytesIn = 0;
-
- if (fd <= 0)
- {
- // Sleep(1000);
- *buffer = 0;
- return 0;
- }
-
- ReadFile( (HANDLE)fd, buffer, buffer_size - 1, &dwBytesIn, NULL);
-
- if (dwBytesIn > 0)
- {
- printf( "GPS < %s\n",buffer );
- }
- if (dwBytesIn >= 0)
- {
- buffer[dwBytesIn] = 0;
- }
- else{
- buffer[0] = 0;
- }
- buffer[buffer_size - 1] = 0;
-
-
- if (dwBytesIn <= 0)
- {
- Sleep(50);
- dwBytesIn = 0;
- }
-
- return dwBytesIn;
-}
-
-int serial_io_write(int fd, const char * buffer)
-{
- DWORD dwBytesOut = 0;
-
- WriteFile((HANDLE)fd, buffer, strlen(buffer), &dwBytesOut, NULL);
-
- return dwBytesOut;
-}
-
-void serial_io_shutdown(int fd )
-{
- if (fd > 0)
- {
- CloseHandle((HANDLE)fd);
- }
-}
+++ /dev/null
-#ifndef SERIAL_IO_H_INCLUDED
-#define SERIAL_IO_H_INCLUDED
-
-int serial_io_init( const char* port, const char* strsettings );
-int serial_io_read(int fd, char * buffer, int buffer_size );
-int WriteSerial(int fd, const char * buffer);
-void serial_io_shutdown(int fd );
-
-#endif
+++ /dev/null
-#include <stdio.h>
-#include <stdlib.h>
-
-
-int setenv(const char *name, const char *value, int overwrite)
-{
- char strPutEnv[512];
-
- char * hasKey = getenv ( name );
-
- if ( ( overwrite != 0 ) || ( hasKey == NULL ) )
- {
- snprintf( strPutEnv, sizeof( strPutEnv ), "%s=%s", name, value );
- strPutEnv[ sizeof( strPutEnv ) - 1 ] = '\0';
- _putenv( strPutEnv );
- }
- return 0;
-}
-
+++ /dev/null
-#ifndef _SETENV_H_INCLUDED
-#define _SETENV_H_INCLUDED
-
-
-int setenv(const char *name, const char *value, int overwrite);
-
-
-#endif /* !_SETENV_H_INCLUDED */
-
+++ /dev/null
-#include <sys/types.h>
-#include <unistd.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <glib.h>
-#include <stdarg.h>
-#include "config.h"
-#include "plugin.h"
-#include "speech.h"
-#include <windows.h>
-#define COBJMACROS
-#include <sapi.h>
-#include <objbase.h>
-#include <glib.h>
-
-const IID UUID_OF_ISPVOICE; // = {6C44DF74-72B9-4992-A1EC-EF996E0422D4};
-
-
-struct speech_priv {
- ISpVoice* pIspVoice;
-};
-
-static int
-speechd_say(struct speech_priv *this_, const char *text) {
- int err = 1;
-
- if ( this_->pIspVoice )
- {
- WCHAR* pWideString = g_utf8_to_utf16( text, -1, NULL, NULL, NULL );
- ISpVoice_Speak( this_->pIspVoice, pWideString, 0, NULL);
- g_free( pWideString );
- err = 0;
- }
- return err;
-}
-
-static void
-speechd_destroy(struct speech_priv *this) {
- g_free(this);
-}
-
-static struct speech_methods speechd_meth = {
- speechd_destroy,
- speechd_say,
-};
-
-static struct speech_priv *
-speechd_new(char *data, struct speech_methods *meth) {
- struct speech_priv *this_;
-
- this_=g_new(struct speech_priv,1);
-
- this_->pIspVoice = NULL;
-
-
- CLSID clsid_sape;
- CLSID* pw = &clsid_sape;
-
- CoInitialize(NULL);
-
- HRESULT hr = CLSIDFromProgID(L"SAPI.SpVoice", &clsid_sape);
-
- if ( 0 == hr )
- {
- IID UUID_OF_ISPVOICE; // = {6C44DF74-72B9-4992-A1EC-EF996E0422D4};
- UUID_OF_ISPVOICE.Data1 = 0x6C44DF74;
- UUID_OF_ISPVOICE.Data2 = 0x72B9;
- UUID_OF_ISPVOICE.Data3 = 0x4992;
- UUID_OF_ISPVOICE.Data4[0] = 161;
- UUID_OF_ISPVOICE.Data4[1] = 236;
- UUID_OF_ISPVOICE.Data4[2] = 239;
- UUID_OF_ISPVOICE.Data4[3] = 153;
- UUID_OF_ISPVOICE.Data4[4] = 110;
- UUID_OF_ISPVOICE.Data4[5] = 4;
- UUID_OF_ISPVOICE.Data4[6] = 34;
- UUID_OF_ISPVOICE.Data4[7] = 212;
-
- ISpVoice* pIspVoice;
- hr = CoCreateInstance( &clsid_sape, NULL, CLSCTX_ALL, &UUID_OF_ISPVOICE, &pIspVoice );
-
- if ( ( 0 == hr ) && ( this_ != NULL ) )
- {
- this_->pIspVoice = pIspVoice;
- }
- }
-
- // ISpVoice_Speak( pIspVoice, L"If you can hear this, SAPI is working", 0, NULL);
- *meth=speechd_meth;
- return this_;
-}
-
-
-void plugin_init(void)
-{
- plugin_register_speech_type("speech_dispatcher", speechd_new);
-}
+++ /dev/null
-#include <windows.h>
-#include "mman.h"
-
-void * mmap_readonly_win32( const char* name, long* map_handle_ptr, long* map_file_ptr )
-{
- void * mapped_ptr = NULL;
-
- OFSTRUCT of;
- HFILE hFile = OpenFile (name, &of, OF_READ);
-
- *map_file_ptr = (long)hFile;
- *map_handle_ptr = 0;
-
- if ( hFile != HFILE_ERROR )
- {
- HANDLE hMapping = CreateFileMapping( (HANDLE)hFile, NULL, PAGE_READONLY, 0, 0, NULL);
- mapped_ptr = MapViewOfFile(hMapping, FILE_MAP_READ, 0 , 0, 0 );
- *map_handle_ptr = (long)hMapping;
- }
-
- return mapped_ptr;
-}
-
-void mmap_unmap_win32( void* mem_ptr, long map_handle, long map_file )
-{
- if ( mem_ptr != NULL )
- {
- UnmapViewOfFile( mem_ptr );
- }
- if ( map_handle != 0)
- {
- CloseHandle( (HANDLE)map_handle );
- }
- if ( map_file != 0 )
- {
- CloseHandle( (HANDLE)map_file );
- }
-}
+++ /dev/null
-#ifndef _WIN32_MMAN_H_INCLUDED
-#define _WIN32_MMAN_H_INCLUDED
-
-void * mmap_readonly_win32( const char* name, long* map_handle_ptr, long* map_file_ptr );
-void mmap_unmap_win32( void* mem_ptr, long map_handle, long map_file );
-
-#endif /* !_WIN32_MMAN_H_INCLUDED */
-
+++ /dev/null
-#include <sys/types.h>
-#include <assert.h>
-#include <fcntl.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-#include "wordexp.h"
-
-int wordexp(const char * words, wordexp_t * we, int flags)
-{
- int error=0;
-
- assert(we != NULL);
- assert(words != NULL);
-
- we->we_wordc = 1;
- we->we_wordv = NULL;
- we->we_strings = NULL;
- we->we_nbytes = 0;
-
- we->we_wordv = malloc( we->we_wordc * sizeof( char* ) );
-
- we->we_nbytes = strlen( words ) + 1;
- we->we_strings = malloc( we->we_nbytes );
-
- we->we_wordv[0] = &we->we_strings[0];
-
- // copy string & terminate
- memcpy( we->we_strings, words, we->we_nbytes -1 );
- we->we_strings[ we->we_nbytes -1 ] = '\0';
-
- return error;
-}
-
-void wordfree(wordexp_t *we)
-{
- assert(we != NULL);
-
- if ( we->we_wordv )
- {
- free(we->we_wordv);
- }
- if ( we->we_strings )
- {
- free(we->we_strings);
- }
-
- we->we_wordv = NULL;
- we->we_strings = NULL;
- we->we_nbytes = 0;
- we->we_wordc = 0;
-}
+++ /dev/null
-#ifndef _WORDEXP_H_
-#define _WORDEXP_H_
-
-
-typedef struct {
- size_t we_wordc; /* count of words matched */
- char **we_wordv; /* pointer to list of words */
- size_t we_offs; /* slots to reserve in we_wordv */
- /* following are internals */
- char *we_strings; /* storage for wordv strings */
- size_t we_nbytes; /* size of we_strings */
-} wordexp_t;
-
-/*
- * Flags for wordexp().
- */
-#define WRDE_APPEND 0x1 /* append to previously generated */
-#define WRDE_DOOFFS 0x2 /* we_offs member is valid */
-#define WRDE_NOCMD 0x4 /* disallow command substitution */
-#define WRDE_REUSE 0x8 /* reuse wordexp_t */
-#define WRDE_SHOWERR 0x10 /* don't redirect stderr to /dev/null */
-#define WRDE_UNDEF 0x20 /* disallow undefined shell vars */
-
-/*
- * Return values from wordexp().
- */
-#define WRDE_BADCHAR 1 /* unquoted special character */
-#define WRDE_BADVAL 2 /* undefined variable */
-#define WRDE_CMDSUB 3 /* command substitution not allowed */
-#define WRDE_NOSPACE 4 /* no memory for result */
-#if (_XOPEN_SOURCE - 0) >= 4 || defined(_NETBSD_SOURCE)
-#define WRDE_NOSYS 5 /* obsolete, reserved */
-#endif
-#define WRDE_SYNTAX 6 /* shell syntax error */
-#define WRDE_ERRNO 7 /* other errors see errno */
-
-void wordfree(wordexp_t *);
-int wordexp(const char * words, wordexp_t * we, int flags);
-
-
-#endif /* !_WORDEXP_H_ */
-
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
-<CodeBlocks_project_file>
- <FileVersion major="1" minor="6" />
- <Project>
- <Option title="binfile" />
- <Option pch_mode="2" />
- <Option compiler="gcc" />
- <Build>
- <Target title="Debug">
- <Option output=".\bin\Debug\libdata_binfile.la" prefix_auto="1" extension_auto="0" />
- <Option working_dir="" />
- <Option object_output=".\obj\Debug\" />
- <Option type="2" />
- <Option compiler="gcc" />
- <Option createDefFile="1" />
- <Compiler>
- <Add option="-g" />
- </Compiler>
- <Linker>
- <Add directory="%GTK_DIR%\lib" />
- <Add directory="bin\Debug" />
- </Linker>
- </Target>
- <Target title="Release">
- <Option output=".\bin\Release\libdata_binfile.la" prefix_auto="1" extension_auto="0" />
- <Option working_dir="" />
- <Option object_output=".\obj\Release\" />
- <Option type="2" />
- <Option compiler="gcc" />
- <Option createDefFile="1" />
- <Compiler>
- <Add option="-O2" />
- </Compiler>
- <Linker>
- <Add option="-s" />
- <Add directory="%GTK_DIR%\lib" />
- <Add directory="bin\Release" />
- </Linker>
- </Target>
- </Build>
- <Compiler>
- <Add option="-Wall" />
- <Add option="-mms-bitfields" />
- <Add option="-DBUILD_DLL" />
- <Add option="-DMODULE=data_binfile" />
- <Add directory="%GTK_DIR%\include\glib-2.0" />
- <Add directory="%GTK_DIR%\lib\glib-2.0\include" />
- <Add directory="Win32Extra" />
- <Add directory="..\..\src" />
- </Compiler>
- <Linker>
- <Add library="NavitCommonLib" />
- <Add library="glib-2.0" />
- <Add library="user32" />
- <Add library="intl" />
- <Add library="iconv" />
- <Add directory="%GTK_DIR%\lib" />
- </Linker>
- <Unit filename="..\..\src\data\binfile\binfile.c">
- <Option compilerVar="CC" />
- </Unit>
- <Extensions>
- <code_completion />
- <envvars />
- <debugger />
- </Extensions>
- </Project>
-</CodeBlocks_project_file>
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
-<CodeBlocks_project_file>
- <FileVersion major="1" minor="6" />
- <Project>
- <Option title="data_garmin" />
- <Option pch_mode="2" />
- <Option compiler="gcc" />
- <Build>
- <Target title="Debug">
- <Option output=".\bin\Debug\libdata_garmin.la" prefix_auto="1" extension_auto="0" />
- <Option working_dir="" />
- <Option object_output=".\obj\Debug\" />
- <Option type="2" />
- <Option compiler="gcc" />
- <Option createDefFile="1" />
- <Compiler>
- <Add option="-g" />
- </Compiler>
- <Linker>
- <Add directory="%GTK_DIR%\lib" />
- <Add directory="bin\Debug" />
- </Linker>
- </Target>
- <Target title="Release">
- <Option output=".\bin\Release\libdata_garmin.la" prefix_auto="1" extension_auto="0" />
- <Option working_dir="" />
- <Option object_output=".\obj\Release\" />
- <Option type="2" />
- <Option compiler="gcc" />
- <Option createDefFile="1" />
- <Compiler>
- <Add option="-O2" />
- </Compiler>
- <Linker>
- <Add option="-s" />
- <Add directory="%GTK_DIR%\lib" />
- <Add directory="bin\Release" />
- </Linker>
- </Target>
- </Build>
- <Compiler>
- <Add option="-Wall" />
- <Add option="-mms-bitfields" />
- <Add option="-DBUILD_DLL" />
- <Add option="-DMODULE=data_garmin" />
- <Add directory="%GTK_DIR%\include\glib-2.0" />
- <Add directory="%GTK_DIR%\lib\glib-2.0\include" />
- <Add directory="Win32Extra" />
- <Add directory="..\..\src" />
- <Add directory="." />
- <Add directory="Win32Extra\libgarmin" />
- </Compiler>
- <Linker>
- <Add library="NavitCommonLib" />
- <Add library="glib-2.0" />
- <Add library="user32" />
- <Add library="intl" />
- <Add library="iconv" />
- <Add directory="%GTK_DIR%\lib" />
- </Linker>
- <Unit filename="..\..\src\data\garmin\gar2navit.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\src\data\garmin\garmin.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\src\data\garmin\garmin.h" />
- <Extensions>
- <code_completion />
- <envvars />
- <debugger />
- </Extensions>
- </Project>
-</CodeBlocks_project_file>
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
-<CodeBlocks_project_file>
- <FileVersion major="1" minor="6" />
- <Project>
- <Option title="data_garming_img" />
- <Option pch_mode="2" />
- <Option compiler="gcc" />
- <Build>
- <Target title="Debug">
- <Option output=".\bin\Debug\libdata_garmin_img.la" prefix_auto="1" extension_auto="0" />
- <Option working_dir="" />
- <Option object_output=".\obj\Debug\" />
- <Option type="2" />
- <Option compiler="gcc" />
- <Option createDefFile="1" />
- <Compiler>
- <Add option="-g" />
- </Compiler>
- <Linker>
- <Add directory="%GTK_DIR%\lib" />
- <Add directory="bin\Debug" />
- </Linker>
- </Target>
- <Target title="Release">
- <Option output=".\bin\Release\libdata_garmin_img.la" prefix_auto="1" extension_auto="0" />
- <Option working_dir="" />
- <Option object_output=".\obj\Release\" />
- <Option type="2" />
- <Option compiler="gcc" />
- <Option createDefFile="1" />
- <Compiler>
- <Add option="-O2" />
- </Compiler>
- <Linker>
- <Add option="-s" />
- <Add directory="%GTK_DIR%\lib" />
- <Add directory="bin\Release" />
- </Linker>
- </Target>
- </Build>
- <Compiler>
- <Add option="-Wall" />
- <Add option="-mms-bitfields" />
- <Add option="-DBUILD_DLL" />
- <Add option="-DMODULE=data_garmin_img" />
- <Add directory="%GTK_DIR%\include\glib-2.0" />
- <Add directory="%GTK_DIR%\lib\glib-2.0\include" />
- <Add directory="Win32Extra" />
- <Add directory="..\..\src" />
- </Compiler>
- <Linker>
- <Add library="NavitCommonLib" />
- <Add library="glib-2.0" />
- <Add library="user32" />
- <Add library="intl" />
- <Add library="iconv" />
- <Add directory="%GTK_DIR%\lib" />
- </Linker>
- <Unit filename="..\..\src\data\garmin_img\garmin_img.c">
- <Option compilerVar="CC" />
- </Unit>
- <Extensions>
- <code_completion />
- <envvars />
- <debugger />
- </Extensions>
- </Project>
-</CodeBlocks_project_file>
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
-<CodeBlocks_project_file>
- <FileVersion major="1" minor="6" />
- <Project>
- <Option title="data_mg" />
- <Option pch_mode="2" />
- <Option compiler="gcc" />
- <Build>
- <Target title="Debug">
- <Option output=".\bin\Debug\libdata_mg.la" prefix_auto="1" extension_auto="0" />
- <Option working_dir="" />
- <Option object_output=".\obj\Debug\" />
- <Option type="2" />
- <Option compiler="gcc" />
- <Option createDefFile="1" />
- <Compiler>
- <Add option="-g" />
- </Compiler>
- <Linker>
- <Add directory="%GTK_DIR%\lib" />
- <Add directory="bin\Debug" />
- </Linker>
- </Target>
- <Target title="Release">
- <Option output=".\bin\Release\libdata_mg.la" prefix_auto="1" extension_auto="0" />
- <Option working_dir="" />
- <Option object_output=".\obj\Release\" />
- <Option type="2" />
- <Option compiler="gcc" />
- <Option createDefFile="1" />
- <Compiler>
- <Add option="-O2" />
- </Compiler>
- <Linker>
- <Add option="-s" />
- <Add directory="%GTK_DIR%\lib" />
- <Add directory="bin\Release" />
- </Linker>
- </Target>
- </Build>
- <Compiler>
- <Add option="-Wall" />
- <Add option="-mms-bitfields" />
- <Add option="-DBUILD_DLL" />
- <Add option="-DMODULE=data_mg" />
- <Add directory="%GTK_DIR%\include\glib-2.0" />
- <Add directory="%GTK_DIR%\lib\glib-2.0\include" />
- <Add directory="..\..\src" />
- <Add directory="Win32Extra" />
- </Compiler>
- <Linker>
- <Add library="NavitCommonLib" />
- <Add library="glib-2.0" />
- <Add library="user32" />
- <Add library="intl" />
- <Add library="iconv" />
- <Add directory="%GTK_DIR%\lib" />
- </Linker>
- <Unit filename="..\..\src\data\mg\block.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\src\data\mg\map.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\src\data\mg\mg.h" />
- <Unit filename="..\..\src\data\mg\poly.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\src\data\mg\street.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\src\data\mg\town.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\src\data\mg\tree.c">
- <Option compilerVar="CC" />
- </Unit>
- <Extensions>
- <code_completion />
- <envvars />
- <debugger />
- </Extensions>
- </Project>
-</CodeBlocks_project_file>
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
-<CodeBlocks_project_file>
- <FileVersion major="1" minor="6" />
- <Project>
- <Option title="data_poi_geodownload" />
- <Option pch_mode="2" />
- <Option compiler="gcc" />
- <Build>
- <Target title="Debug">
- <Option output=".\bin\Debug\libdata_poi_geodownload.la" prefix_auto="1" extension_auto="0" />
- <Option working_dir="" />
- <Option object_output=".\obj\Debug\" />
- <Option type="2" />
- <Option compiler="gcc" />
- <Option createDefFile="1" />
- <Compiler>
- <Add option="-g" />
- </Compiler>
- <Linker>
- <Add directory="%GTK_DIR%\lib" />
- <Add directory="bin\Debug" />
- </Linker>
- </Target>
- <Target title="Release">
- <Option output=".\bin\Release\libdata_poi_geodownload.la" prefix_auto="1" extension_auto="0" />
- <Option working_dir="" />
- <Option object_output=".\obj\Release\" />
- <Option type="2" />
- <Option compiler="gcc" />
- <Option createDefFile="1" />
- <Compiler>
- <Add option="-O2" />
- </Compiler>
- <Linker>
- <Add option="-s" />
- <Add directory="%GTK_DIR%\lib" />
- <Add directory="bin\Release" />
- </Linker>
- </Target>
- </Build>
- <Compiler>
- <Add option="-Wall" />
- <Add option="-mms-bitfields" />
- <Add option="-DBUILD_DLL" />
- <Add option="-DMODULE=data_poi_geodownload" />
- <Add directory="%GTK_DIR%\include\glib-2.0" />
- <Add directory="%GTK_DIR%\lib\glib-2.0\include" />
- <Add directory="Win32Extra" />
- <Add directory="..\..\src" />
- <Add directory="..\..\src\data\poi_geodownload\libmdb\include" />
- </Compiler>
- <Linker>
- <Add library="glib-2.0" />
- <Add library="user32" />
- <Add library="intl" />
- <Add library="iconv" />
- <Add directory="%GTK_DIR%\lib" />
- </Linker>
- <Unit filename="..\..\src\data\poi_geodownload\poi_geodownload.c">
- <Option compilerVar="CC" />
- </Unit>
- <Extensions>
- <code_completion />
- <envvars />
- <debugger />
- </Extensions>
- </Project>
-</CodeBlocks_project_file>
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
-<CodeBlocks_project_file>
- <FileVersion major="1" minor="6" />
- <Project>
- <Option title="data_textfile" />
- <Option pch_mode="2" />
- <Option compiler="gcc" />
- <Build>
- <Target title="Debug">
- <Option output=".\bin\Debug\libdata_textfile.la" prefix_auto="1" extension_auto="0" />
- <Option working_dir="" />
- <Option object_output=".\obj\Debug\" />
- <Option type="2" />
- <Option compiler="gcc" />
- <Option createDefFile="1" />
- <Compiler>
- <Add option="-g" />
- </Compiler>
- <Linker>
- <Add directory="%GTK_DIR%\lib" />
- <Add directory="bin\Debug" />
- </Linker>
- </Target>
- <Target title="Release">
- <Option output=".\bin\Release\libdata_textfile.la" prefix_auto="1" extension_auto="0" />
- <Option working_dir="" />
- <Option object_output=".\obj\Release\" />
- <Option type="2" />
- <Option compiler="gcc" />
- <Option createDefFile="1" />
- <Compiler>
- <Add option="-O2" />
- </Compiler>
- <Linker>
- <Add option="-s" />
- <Add directory="%GTK_DIR%\lib" />
- <Add directory="bin\Release" />
- </Linker>
- </Target>
- </Build>
- <Compiler>
- <Add option="-Wall" />
- <Add option="-mms-bitfields" />
- <Add option="-DBUILD_DLL" />
- <Add option="-DMODULE=data_textfile" />
- <Add directory="%GTK_DIR%\include\glib-2.0" />
- <Add directory="%GTK_DIR%\lib\glib-2.0\include" />
- <Add directory="..\..\" />
- <Add directory="..\" />
- <Add directory="D:\CB_Projects\Navit\src\" />
- <Add directory="Win32Extra" />
- <Add directory="..\..\src" />
- <Add directory="..\..\src\data\poi_geodownload\libmdb\include" />
- </Compiler>
- <Linker>
- <Add library="glib-2.0" />
- <Add library="user32" />
- <Add library="intl" />
- <Add library="iconv" />
- <Add directory="%GTK_DIR%\lib" />
- </Linker>
- <Unit filename="..\..\src\data\textfile\textfile.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\src\data\textfile\textfile.h" />
- <Extensions>
- <code_completion />
- <envvars />
- <debugger />
- </Extensions>
- </Project>
-</CodeBlocks_project_file>
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
-<CodeBlocks_project_file>
- <FileVersion major="1" minor="6" />
- <Project>
- <Option title="fib-1.1" />
- <Option pch_mode="2" />
- <Option compiler="gcc" />
- <Build>
- <Target title="Debug">
- <Option output=".\bin\Debug\libfib.a" prefix_auto="0" extension_auto="0" />
- <Option working_dir="" />
- <Option object_output="obj\fib-1.1\Debug\" />
- <Option type="2" />
- <Option compiler="gcc" />
- <Option createDefFile="1" />
- <Compiler>
- <Add option="-g" />
- <Add option="-I." />
- </Compiler>
- </Target>
- <Target title="Release">
- <Option output=".\bin\Release\libfib.a" prefix_auto="0" extension_auto="0" />
- <Option working_dir="" />
- <Option object_output="obj\fib-1.1\Release\" />
- <Option type="2" />
- <Option compiler="gcc" />
- <Option createDefFile="1" />
- <Compiler>
- <Add option="-O2" />
- </Compiler>
- <Linker>
- <Add option="-s" />
- </Linker>
- </Target>
- </Build>
- <Compiler>
- <Add option="-Wall" />
- <Add directory="..\..\src\fib-1.1" />
- </Compiler>
- <Unit filename="..\..\src\fib-1.1\fib.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\src\fib-1.1\fib.h" />
- <Unit filename="..\..\src\fib-1.1\fibpriv.h" />
- <Extensions>
- <code_completion />
- <envvars />
- <debugger />
- </Extensions>
- </Project>
-</CodeBlocks_project_file>
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
-<CodeBlocks_project_file>
- <FileVersion major="1" minor="6" />
- <Project>
- <Option title="GenTypes" />
- <Option pch_mode="2" />
- <Option compiler="gcc" />
- <Build>
- <Target title="Debug">
- <Option output="GenTypes" prefix_auto="1" extension_auto="1" />
- <Option object_output="obj\GenTypes\Debug\" />
- <Option type="1" />
- <Option compiler="gcc" />
- <Option use_console_runner="0" />
- <Option parameters="--input-file=d:\CB_Projects\netherlands.osm --attr-debug-level=0 -k netherlands.bin" />
- <Compiler>
- <Add option="-g" />
- </Compiler>
- <Linker>
- <Add directory="%GTK_DIR%\lib" />
- <Add directory="bin\Debug" />
- </Linker>
- </Target>
- <Target title="Release">
- <Option output="GenTypes" prefix_auto="1" extension_auto="1" />
- <Option object_output="obj\GenTypes\Release\" />
- <Option type="1" />
- <Option compiler="gcc" />
- <Compiler>
- <Add option="-O2" />
- </Compiler>
- <Linker>
- <Add option="-s" />
- <Add directory="%GTK_DIR%\lib" />
- <Add directory="bin\Release" />
- </Linker>
- </Target>
- </Build>
- <Compiler>
- <Add option="-Wall" />
- <Add option="-mms-bitfields -DMODULE=GenTypes" />
- <Add directory="%GTK_DIR%\include\glib-2.0" />
- <Add directory="%GTK_DIR%\lib\glib-2.0\include" />
- <Add directory="%GTK_DIR%\include" />
- <Add directory="Win32Extra" />
- <Add directory="..\..\src" />
- </Compiler>
- <Linker>
- <Add library="user32" />
- <Add library="gtk-win32-2.0" />
- <Add library="gdk-win32-2.0" />
- <Add library="gdk_pixbuf-2.0" />
- <Add library="freetype" />
- <Add library="z" />
- <Add library="gobject-2.0" />
- <Add library="gmodule-2.0" />
- <Add library="glib-2.0" />
- <Add library="intl" />
- <Add library="zdll" />
- <Add directory="%GTK_DIR%\lib" />
- </Linker>
- <ExtraCommands>
- <Add after="GenTypes.exe ..\..\src\data\garmin\garmintypes.txt ..\..\src\data\garmin\g2nbuiltin.h" />
- </ExtraCommands>
- <Unit filename="Win32Extra\wordexp.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="Win32Extra\wordexp.h" />
- <Unit filename="..\..\src\attr.h" />
- <Unit filename="..\..\src\attr_def.h" />
- <Unit filename="..\..\src\coord.h" />
- <Unit filename="..\..\src\country.h" />
- <Unit filename="..\..\src\data\garmin\gentypes.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\src\debug.h" />
- <Unit filename="..\..\src\file.h" />
- <Unit filename="..\..\src\item.h" />
- <Unit filename="..\..\src\map.h" />
- <Unit filename="..\..\src\param.h" />
- <Unit filename="..\..\src\plugin.h" />
- <Unit filename="..\..\src\transform.h" />
- <Extensions>
- <code_completion />
- <envvars />
- <debugger />
- </Extensions>
- </Project>
-</CodeBlocks_project_file>
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
-<CodeBlocks_project_file>
- <FileVersion major="1" minor="6" />
- <Project>
- <Option title="gtk_gl_ext" />
- <Option pch_mode="2" />
- <Option compiler="gcc" />
- <Build>
- <Target title="Debug">
- <Option output=".\bin\Debug\libgtk_gl_ext.la" prefix_auto="1" extension_auto="0" />
- <Option working_dir="" />
- <Option object_output=".\obj\Debug\" />
- <Option type="2" />
- <Option compiler="gcc" />
- <Option createDefFile="1" />
- <Compiler>
- <Add option="-g" />
- </Compiler>
- <Linker>
- <Add directory="%GTK_DIR%\lib" />
- <Add directory="bin\Debug" />
- </Linker>
- </Target>
- <Target title="Release">
- <Option output=".\bin\Release\libgtk_gl_ext.la" prefix_auto="1" extension_auto="0" />
- <Option working_dir="" />
- <Option object_output=".\obj\Release\" />
- <Option type="2" />
- <Option compiler="gcc" />
- <Option createDefFile="1" />
- <Compiler>
- <Add option="-O2" />
- </Compiler>
- <Linker>
- <Add option="-s" />
- <Add directory="%GTK_DIR%\lib" />
- <Add directory="bin\Release" />
- </Linker>
- </Target>
- </Build>
- <Compiler>
- <Add option="-Wall" />
- <Add option="-mms-bitfields" />
- <Add option="-DBUILD_DLL" />
- <Add option="-DMODULE=gtk_gl_ext" />
- <Add directory="%GTK_DIR%\include" />
- <Add directory="%GTK_DIR%\include\gtk-2.0" />
- <Add directory="%GTK_DIR%\include\glib-2.0" />
- <Add directory="%GTK_DIR%\lib\gtk-2.0\include" />
- <Add directory="%GTK_DIR%\lib\glib-2.0\include" />
- <Add directory="%GTK_DIR%\include\cairo" />
- <Add directory="%GTK_DIR%\include\pango-1.0" />
- <Add directory="%GTK_DIR%\include\atk-1.0" />
- <Add directory="..\..\src" />
- <Add directory="Win32Extra" />
- <Add directory="%GTK_DIR%\include\freetype2" />
- <Add directory="%GTK_DIR%\include\gtkglext-1.0" />
- <Add directory="%GTK_DIR%\lib\gtkglext-1.0\include" />
- </Compiler>
- <Linker>
- <Add library="glib-2.0" />
- <Add library="user32" />
- <Add library="intl" />
- <Add library="iconv" />
- <Add directory="%GTK_DIR%\lib" />
- </Linker>
- <Unit filename="..\..\src\graphics\gtk_gl_ext\graphics_gtk_gl_ext.c">
- <Option compilerVar="CC" />
- </Unit>
- <Extensions>
- <code_completion />
- <envvars />
- <debugger />
- </Extensions>
- </Project>
-</CodeBlocks_project_file>
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
-<CodeBlocks_project_file>
- <FileVersion major="1" minor="6" />
- <Project>
- <Option title="gtk_graphics" />
- <Option pch_mode="2" />
- <Option compiler="gcc" />
- <Build>
- <Target title="Debug">
- <Option output=".\bin\Debug\libgtk_graphics.la" prefix_auto="1" extension_auto="0" />
- <Option working_dir="" />
- <Option object_output=".\obj\Debug\" />
- <Option type="2" />
- <Option compiler="gcc" />
- <Option createDefFile="1" />
- <Compiler>
- <Add option="-g" />
- </Compiler>
- <Linker>
- <Add directory="%GTK_DIR%\lib" />
- <Add directory="bin\Debug" />
- </Linker>
- </Target>
- <Target title="Release">
- <Option output=".\bin\Release\libgtk_graphics.la" prefix_auto="1" extension_auto="0" />
- <Option working_dir="" />
- <Option object_output=".\obj\Release\" />
- <Option type="2" />
- <Option compiler="gcc" />
- <Option createDefFile="1" />
- <Compiler>
- <Add option="-O2" />
- </Compiler>
- <Linker>
- <Add option="-s" />
- <Add directory="%GTK_DIR%\lib" />
- <Add directory="bin\Release" />
- </Linker>
- </Target>
- </Build>
- <Compiler>
- <Add option="-Wall" />
- <Add option="-mms-bitfields" />
- <Add option="-DBUILD_DLL" />
- <Add option="-DMODULE=gtk_graphics" />
- <Add directory="%GTK_DIR%\include" />
- <Add directory="%GTK_DIR%\include\gtk-2.0" />
- <Add directory="%GTK_DIR%\include\glib-2.0" />
- <Add directory="%GTK_DIR%\lib\gtk-2.0\include" />
- <Add directory="%GTK_DIR%\lib\glib-2.0\include" />
- <Add directory="%GTK_DIR%\include\cairo" />
- <Add directory="%GTK_DIR%\include\pango-1.0" />
- <Add directory="%GTK_DIR%\include\atk-1.0" />
- <Add directory="..\..\src" />
- <Add directory="Win32Extra" />
- <Add directory="%GTK_DIR%\include\freetype2" />
- </Compiler>
- <Linker>
- <Add library="NavitCommonLib" />
- <Add library="glib-2.0" />
- <Add library="user32" />
- <Add library="intl" />
- <Add library="iconv" />
- <Add directory="%GTK_DIR%\lib" />
- </Linker>
- <Unit filename="..\..\src\graphics\gtk_drawing_area\graphics_gtk_drawing_area.c">
- <Option compilerVar="CC" />
- </Unit>
- <Extensions>
- <code_completion />
- <envvars />
- <debugger />
- </Extensions>
- </Project>
-</CodeBlocks_project_file>
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
-<CodeBlocks_project_file>
- <FileVersion major="1" minor="6" />
- <Project>
- <Option title="gtk_gui" />
- <Option pch_mode="2" />
- <Option compiler="gcc" />
- <Build>
- <Target title="Debug">
- <Option output=".\bin\Debug\libgtk_gui.la" prefix_auto="1" extension_auto="0" />
- <Option working_dir="" />
- <Option object_output=".\obj\Debug\" />
- <Option type="2" />
- <Option compiler="gcc" />
- <Option createDefFile="1" />
- <Compiler>
- <Add option="-g" />
- </Compiler>
- <Linker>
- <Add directory="%GTK_DIR%\lib" />
- <Add directory="bin\Debug" />
- </Linker>
- </Target>
- <Target title="Release">
- <Option output=".\bin\Release\libgtk_gui.la" prefix_auto="1" extension_auto="0" />
- <Option working_dir="" />
- <Option object_output=".\obj\Release\" />
- <Option type="2" />
- <Option compiler="gcc" />
- <Option createDefFile="1" />
- <Compiler>
- <Add option="-O2" />
- </Compiler>
- <Linker>
- <Add option="-s" />
- <Add directory="%GTK_DIR%\lib" />
- <Add directory="bin\Release" />
- </Linker>
- </Target>
- </Build>
- <Compiler>
- <Add option="-Wall" />
- <Add option="-mms-bitfields" />
- <Add option="-DBUILD_DLL" />
- <Add option="-DMODULE=gtk_gui" />
- <Add directory="%GTK_DIR%\include" />
- <Add directory="%GTK_DIR%\include\gtk-2.0" />
- <Add directory="%GTK_DIR%\include\glib-2.0" />
- <Add directory="%GTK_DIR%\lib\gtk-2.0\include" />
- <Add directory="%GTK_DIR%\lib\glib-2.0\include" />
- <Add directory="%GTK_DIR%\include\cairo" />
- <Add directory="%GTK_DIR%\include\pango-1.0" />
- <Add directory="%GTK_DIR%\include\atk-1.0" />
- <Add directory="..\..\src" />
- <Add directory="Win32Extra" />
- </Compiler>
- <Linker>
- <Add directory="%GTK_DIR%\lib" />
- </Linker>
- <Unit filename="..\..\src\gui\gtk\datawindow.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\src\gui\gtk\destination.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\src\gui\gtk\gui_gtk.h" />
- <Unit filename="..\..\src\gui\gtk\gui_gtk_action.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\src\gui\gtk\gui_gtk_statusbar.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\src\gui\gtk\gui_gtk_window.c">
- <Option compilerVar="CC" />
- </Unit>
- <Extensions>
- <code_completion />
- <envvars />
- <debugger />
- </Extensions>
- </Project>
-</CodeBlocks_project_file>
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
-<CodeBlocks_project_file>
- <FileVersion major="1" minor="6" />
- <Project>
- <Option title="gui_sdl" />
- <Option pch_mode="2" />
- <Option compiler="gcc" />
- <Build>
- <Target title="Debug">
- <Option output=".\bin\Debug\libgui_sdl.la" prefix_auto="1" extension_auto="0" />
- <Option working_dir="" />
- <Option object_output=".\obj\Debug\" />
- <Option type="2" />
- <Option compiler="gcc" />
- <Option createDefFile="1" />
- <Compiler>
- <Add option="-g" />
- </Compiler>
- <Linker>
- <Add directory="%GTK_DIR%\lib" />
- <Add directory="bin\Debug" />
- </Linker>
- </Target>
- <Target title="Release">
- <Option output=".\bin\Release\libgui_sdl.la" prefix_auto="1" extension_auto="0" />
- <Option working_dir="" />
- <Option object_output=".\obj\Release\" />
- <Option type="2" />
- <Option compiler="gcc" />
- <Option createDefFile="1" />
- <Compiler>
- <Add option="-O2" />
- </Compiler>
- <Linker>
- <Add option="-s" />
- <Add directory="%GTK_DIR%\lib" />
- <Add directory="bin\Release" />
- </Linker>
- </Target>
- </Build>
- <Compiler>
- <Add option="-Wall" />
- <Add option="-mms-bitfields" />
- <Add option="-DBUILD_DLL" />
- <Add option="-DMODULE=gui_sdl" />
- <Add directory="%GTK_DIR%\include" />
- <Add directory="%GTK_DIR%\include\gtk-2.0" />
- <Add directory="%GTK_DIR%\include\glib-2.0" />
- <Add directory="%GTK_DIR%\lib\gtk-2.0\include" />
- <Add directory="%GTK_DIR%\lib\glib-2.0\include" />
- <Add directory="%GTK_DIR%\include\cairo" />
- <Add directory="%GTK_DIR%\include\pango-1.0" />
- <Add directory="%GTK_DIR%\include\atk-1.0" />
- <Add directory="..\..\src" />
- <Add directory="Win32Extra" />
- <Add directory="D:\msys\local\include" />
- </Compiler>
- <Linker>
- <Add directory="%GTK_DIR%\lib" />
- </Linker>
- <Unit filename="..\..\src\gui\sdl\Makefile.am" />
- <Unit filename="..\..\src\gui\sdl\Makefile.in" />
- <Unit filename="..\..\src\gui\sdl\cegui_keyboard.cpp" />
- <Unit filename="..\..\src\gui\sdl\cegui_keyboard.h" />
- <Unit filename="..\..\src\gui\sdl\gui_sdl.h" />
- <Unit filename="..\..\src\gui\sdl\gui_sdl_window.cpp" />
- <Unit filename="..\..\src\gui\sdl\sdl_events.cpp" />
- <Unit filename="..\..\src\gui\sdl\sdl_events.h" />
- <Unit filename="..\..\src\gui\sdl\wmcontrol.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\src\gui\sdl\wmcontrol.h" />
- <Extensions>
- <code_completion />
- <envvars />
- <debugger />
- </Extensions>
- </Project>
-</CodeBlocks_project_file>
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
-<CodeBlocks_project_file>
- <FileVersion major="1" minor="6" />
- <Project>
- <Option title="libgarmin" />
- <Option pch_mode="2" />
- <Option compiler="gcc" />
- <Build>
- <Target title="Debug">
- <Option output="libgarmin" prefix_auto="1" extension_auto="1" />
- <Option working_dir="" />
- <Option object_output="obj\Debug\" />
- <Option type="2" />
- <Option compiler="gcc" />
- <Option createDefFile="1" />
- <Compiler>
- <Add option="-g" />
- </Compiler>
- </Target>
- <Target title="Release">
- <Option output="libgarmin" prefix_auto="1" extension_auto="1" />
- <Option working_dir="" />
- <Option object_output="obj\Release\" />
- <Option type="2" />
- <Option compiler="gcc" />
- <Option createDefFile="1" />
- <Compiler>
- <Add option="-O2" />
- </Compiler>
- <Linker>
- <Add option="-s" />
- </Linker>
- </Target>
- </Build>
- <Compiler>
- <Add option="-Wall" />
- </Compiler>
- <Unit filename="..\..\..\libgarmin\src\GarminTypedef.h" />
- <Unit filename="..\..\..\libgarmin\src\array.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\..\libgarmin\src\array.h" />
- <Unit filename="..\..\..\libgarmin\src\bsp.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\..\libgarmin\src\bsp.h" />
- <Unit filename="..\..\..\libgarmin\src\garmin.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\..\libgarmin\src\garmin_fat.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\..\libgarmin\src\garmin_fat.h" />
- <Unit filename="..\..\..\libgarmin\src\garmin_lbl.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\..\libgarmin\src\garmin_lbl.h" />
- <Unit filename="..\..\..\libgarmin\src\garmin_net.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\..\libgarmin\src\garmin_net.h" />
- <Unit filename="..\..\..\libgarmin\src\garmin_obj.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\..\libgarmin\src\garmin_order.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\..\libgarmin\src\garmin_order.h" />
- <Unit filename="..\..\..\libgarmin\src\garmin_rgn.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\..\libgarmin\src\garmin_rgn.h" />
- <Unit filename="..\..\..\libgarmin\src\garmin_subdiv.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\..\libgarmin\src\garmin_subdiv.h" />
- <Unit filename="..\..\..\libgarmin\src\garmin_tdb.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\..\libgarmin\src\garmin_tdb.h" />
- <Unit filename="..\..\..\libgarmin\src\garmin_typ.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\..\libgarmin\src\geoutils.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\..\libgarmin\src\geoutils.h" />
- <Unit filename="..\..\..\libgarmin\src\libgarmin.h" />
- <Unit filename="..\..\..\libgarmin\src\libgarmin_priv.h" />
- <Unit filename="..\..\..\libgarmin\src\list.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\..\libgarmin\src\list.h" />
- <Unit filename="main.c">
- <Option compilerVar="CC" />
- </Unit>
- <Extensions>
- <code_completion />
- <envvars />
- <debugger />
- </Extensions>
- </Project>
-</CodeBlocks_project_file>
+++ /dev/null
-
-builtin.c:
- ls *.la | sed -e "s/.la/_init(void);/" -e "s/.*lib/extern void module_/" >builtin.c
- echo "extern void builtin_init(void);" >>builtin.c
- echo "void builtin_init(void) {" >>builtin.c
- ls *.la | sed -e "s/.la/_init();/" -e "s/.*lib/ module_/" >>builtin.c
- echo "}" >>builtin.c
+++ /dev/null
-SRC_GTK_PATH = D:/gtk
-SRC_GTK_BIN_PATH = $(SRC_GTK_PATH)/bin
-SRC_GTK_ETC_PATH = $(SRC_GTK_PATH)/etc
-SRC_GTK_LIB_PATH = $(SRC_GTK_PATH)/lib
-
-SRC_MO_PATH = ./locale
-
-SRC_NAVIT_EXE_PATH = ./bin/release
-SRC_XPM_PATH = ../../src/xpm
-
-DST_PATH = ./distr
-DST_BIN_PATH = $(DST_PATH)/bin
-DST_XPM_PATH = $(DST_BIN_PATH)/xpm
-DST_ETC_PATH = $(DST_PATH)/etc
-DST_LIB_PATH = $(DST_PATH)/lib
-DST_MAP_PATH = $(DST_PATH)/maps
-DST_MO_PATH = $(DST_BIN_PATH)/locale
-
-WIN32_DLLS = \
- iconv.dll \
- intl.dll \
- libglib-2.0-0.dll \
- libgmodule-2.0-0.dll \
- libgobject-2.0-0.dll \
- zlib1.dll
-
-GTK_DLLS = \
- freetype6.dll \
- iconv.dll \
- intl.dll \
- libatk-1.0-0.dll \
- libcairo-2.dll \
- libfontconfig-1.dll \
- libfreetype-6.dll \
- libgdk-win32-2.0-0.dll \
- libgdk_pixbuf-2.0-0.dll \
- libglib-2.0-0.dll \
- libgmodule-2.0-0.dll \
- libgobject-2.0-0.dll \
- libgtk-win32-2.0-0.dll \
- libpango-1.0-0.dll \
- libpangocairo-1.0-0.dll \
- libpangoft2-1.0-0.dll \
- libpangowin32-1.0-0.dll \
- libpng12.dll \
- libxml2.dll \
- zlib1.dll
-
-NAVIT_EXES_GTK = navit_gtk.exe osm2navit.exe
-NAVIT_EXES_W32 = navit_win32.exe osm2navit.exe
-
-
-SAMPLE_MAP=osm_bbox_11.3,47.9,11.7,48.2
-
-maps_DATA = $(SAMPLE_MAP).bin
-
-samplemap: $(SAMPLE_MAP).bin
-
-$(SAMPLE_MAP).osm.bz2:
- echo "Downloading osm sample map"
- wget -O $(SAMPLE_MAP).osm.bz2.tmp http://navit.sourceforge.net/maps/$(SAMPLE_MAP).osm.bz2
- mv $(SAMPLE_MAP).osm.bz2.tmp $(SAMPLE_MAP).osm.bz2
-
-$(SAMPLE_MAP).bin: $(SAMPLE_MAP).osm.bz2 ./bin/release/osm2navit.exe
- echo "Converting osm sample map"
- cp $(SAMPLE_MAP).osm.bz2 tmp.osm.bz2 ;
- bunzip2 tmp.osm.bz2;
- cat tmp.osm | ./bin/release/osm2navit.exe --attr-debug-level=5 $(SAMPLE_MAP).bin.tmp ;
- mv $(SAMPLE_MAP).bin.tmp $(SAMPLE_MAP).bin ;
- rm tmp.osm ;
-
-POFILES = cs.mo es.mo fr.mo nl.mo pl.mo de.mo fi.mo it.mo no.mo
-
-MSGFMT=msgfmt.exe
-
-%.mo:../../po/%.po
- $(MSGFMT) --check --verbose --statistics --output-file=$@ $< && \
- mkdir -p ./locale/$(basename $@)/LC_MESSAGES && \
- mv $@ ./locale/$(basename $@)/LC_MESSAGES/navit.mo
-
-
-locale: $(POFILES)
-locale_clean:
- rm -Rf locale
-
-distr_gtk: $(SAMPLE_MAP).bin $(POFILES)
- rm -Rf $(DISTR_TARGET_PATH);
- mkdir -p $(DST_BIN_PATH);
- mkdir -p $(DST_ETC_PATH);
- mkdir -p $(DST_LIB_PATH);
- for i in $(NAVIT_EXES_GTK); do \
- cp $(SRC_NAVIT_EXE_PATH)/$$i $(DST_BIN_PATH)/$$i; \
- done;
- for i in $(GTK_DLLS); do \
- cp $(SRC_GTK_BIN_PATH)/$$i $(DST_BIN_PATH)/$$i; \
- done;
- cp -r $(SRC_GTK_ETC_PATH)/* $(DST_ETC_PATH) ;
- mkdir -p $(DST_LIB_PATH)/gtk-2.0/2.10.0 ;
- cp -r $(SRC_GTK_LIB_PATH)/gtk-2.0/2.10.0/* $(DST_LIB_PATH)/gtk-2.0/2.10.0 ;
- mkdir -p $(DST_LIB_PATH)/pango ;
- cp -r $(SRC_GTK_LIB_PATH)/pango/* $(DST_LIB_PATH)/pango ;
- cp ./navit.xml.distr $(DST_BIN_PATH)/navit.xml ;
- cp ./*.ttf $(DST_BIN_PATH)/ ;
- mkdir -p $(DST_MAP_PATH) ;
- cp $(SAMPLE_MAP).bin $(DST_MAP_PATH)/ ;
- mkdir -p $(DST_XPM_PATH) ;
- cp -r $(SRC_XPM_PATH)/*.xpm $(DST_XPM_PATH)/ ;
- mkdir -p $(DST_MO_PATH) ;
- cp -r $(SRC_MO_PATH)/* $(DST_MO_PATH)/
-
-distr_win32: $(SAMPLE_MAP).bin $(POFILES)
- rm -Rf $(DISTR_TARGET_PATH);
- mkdir -p $(DST_BIN_PATH);
- mkdir -p $(DST_ETC_PATH);
- mkdir -p $(DST_LIB_PATH);
- for i in $(NAVIT_EXES); do \
- cp $(SRC_NAVIT_EXE_W32_PATH)/$$i $(DST_BIN_PATH)/$$i; \
- done;
- for i in $(WIN32_DLLS); do \
- cp $(SRC_GTK_BIN_PATH)/$$i $(DST_BIN_PATH)/$$i; \
- done;
- cp -r $(SRC_GTK_ETC_PATH)/* $(DST_ETC_PATH) ;
- mkdir -p $(DST_LIB_PATH)/gtk-2.0/2.10.0 ;
- cp -r $(SRC_GTK_LIB_PATH)/gtk-2.0/2.10.0/* $(DST_LIB_PATH)/gtk-2.0/2.10.0 ;
- mkdir -p $(DST_LIB_PATH)/pango ;
- cp -r $(SRC_GTK_LIB_PATH)/pango/* $(DST_LIB_PATH)/pango ;
- cp ./navit.xml.distr $(DST_BIN_PATH)/navit.xml ;
- cp ./*.ttf $(DST_BIN_PATH)/ ;
- mkdir -p $(DST_MAP_PATH) ;
- cp $(SAMPLE_MAP).bin $(DST_MAP_PATH)/ ;
- mkdir -p $(DST_XPM_PATH) ;
- cp -r $(SRC_XPM_PATH)/*.xpm $(DST_XPM_PATH)/ ;
- mkdir -p $(DST_MO_PATH) ;
- cp -r $(SRC_MO_PATH)/* $(DST_MO_PATH)/
+++ /dev/null
-POFILES = cs.mo es.mo fr.mo nl.mo pl.mo de.mo fi.mo it.mo no.mo
-
-MSGFMT=msgfmt.exe
-
-%.mo:../../po/%.po
- $(MSGFMT) --check --verbose --statistics --output-file=$@ $< && \
- mkdir -p ./locale/$(basename $@)/LC_MESSAGES && \
- mv $@ ./locale/$(basename $@)/LC_MESSAGES/navit.mo
-
-.PHONY: all clean
-
-# nl.po: ..\..\nl.mo
-
-all: $(POFILES)
-
-clean:
- rm -rf locale/*
-
-
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
-<CodeBlocks_project_file>
- <FileVersion major="1" minor="6" />
- <Project>
- <Option title="mdb" />
- <Option pch_mode="2" />
- <Option compiler="gcc" />
- <Build>
- <Target title="Debug">
- <Option output=".\bin\Debug\libmdb.a" prefix_auto="0" extension_auto="0" />
- <Option working_dir="" />
- <Option object_output="obj\mdb\Debug\" />
- <Option type="2" />
- <Option compiler="gcc" />
- <Option createDefFile="1" />
- <Compiler>
- <Add option="-g" />
- <Add option="-I." />
- </Compiler>
- </Target>
- <Target title="Release">
- <Option output=".\bin\Release\libmdb.a" prefix_auto="0" extension_auto="0" />
- <Option working_dir="" />
- <Option object_output="obj\mdb\Release\" />
- <Option type="2" />
- <Option compiler="gcc" />
- <Option createDefFile="1" />
- <Compiler>
- <Add option="-O2" />
- </Compiler>
- <Linker>
- <Add option="-s" />
- </Linker>
- </Target>
- </Build>
- <Compiler>
- <Add option="-Wall" />
- <Add option="-mms-bitfields" />
- <Add directory="..\..\src\data\poi_geodownload\libmdb\include" />
- <Add directory="%GTK_DIR%\include\glib-2.0" />
- <Add directory="%GTK_DIR%\lib\glib-2.0\include" />
- </Compiler>
- <Unit filename="..\..\src\data\poi_geodownload\libmdb\backend.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\src\data\poi_geodownload\libmdb\catalog.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\src\data\poi_geodownload\libmdb\data.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\src\data\poi_geodownload\libmdb\dump.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\src\data\poi_geodownload\libmdb\file.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\src\data\poi_geodownload\libmdb\iconv.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\src\data\poi_geodownload\libmdb\index.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\src\data\poi_geodownload\libmdb\kkd.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\src\data\poi_geodownload\libmdb\like.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\src\data\poi_geodownload\libmdb\map.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\src\data\poi_geodownload\libmdb\mem.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\src\data\poi_geodownload\libmdb\money.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\src\data\poi_geodownload\libmdb\options.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\src\data\poi_geodownload\libmdb\props.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\src\data\poi_geodownload\libmdb\sargs.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\src\data\poi_geodownload\libmdb\stats.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\src\data\poi_geodownload\libmdb\table.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\src\data\poi_geodownload\libmdb\worktable.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\src\data\poi_geodownload\libmdb\write.c">
- <Option compilerVar="CC" />
- </Unit>
- <Extensions>
- <code_completion />
- <envvars />
- <debugger />
- </Extensions>
- </Project>
-</CodeBlocks_project_file>
+++ /dev/null
-<?xml version="1.0" encoding="utf-8"?>
-<!DOCTYPE navit SYSTEM "navit.dtd">
-<config>
-<plugins>
- <plugin path="$NAVIT_LIBDIR/*/${NAVIT_LIBPREFIX}lib*.so"/>
- <plugin path="$NAVIT_LIBDIR/*/${NAVIT_LIBPREFIX}libgraphics_null.so" active="no" />
-</plugins>
-<debug name="navit:do_draw" level="0" />
-<!--
-Center coordinates format:
-[D][D]DMM.ss[S][S]... N/S [D][D]DMM.ss[S][S]... E/W
-[-][D]D.d[d]... [-][D][D]D.d[d]...
-[-]0xX [-]0xX
-Change to your home coordinates.
--->
-<navit center="4808 N 1134 E" zoom="256" tracking="1" cursor="1" orientation="0">
- <gui type="gtk" />
- <graphics type="gtk_drawing_area" />
-<!-- For SDL, use rather the following lines
- <gui type="sdl" />
- <graphics type="opengl" />
--->
-<!-- <vehicle name="Com4" enabled="yes" active="1" source="file:COM4 baud=115200 parity=N data=8 stop=1" color="#0000ff"/> -->
- <vehicle name="Demo" enabled="yes" active="1" source="demo" color="#0000ff"/>
-
- <!-- <vehicle name="Meins" enabled="yes" source="gpsd://localhost" color="#0000ff"/> -->
- <!-- For SDL, you should add follow="1" refresh="1" to have the view centered on your position
- <vehicle name="Meins" enabled="yes" source="gpsd://localhost" color="#0000ff" follow="1" refresh="1"/>
- -->
-
- <vehicle name="Deins" enabled="no" source="gpsd://somehost" color="#0000aa"/>
- <tracking>
- </tracking>
- <route>
- <speed type="street_0,street_1_city" value="10" />
- <speed type="street_2_city" value="30" />
- <speed type="street_3_city" value="40" />
- <speed type="street_4_city" value="50" />
- <speed type="highway_city" value="80" />
- <speed type="street_1_land" value="60" />
- <speed type="street_2_land" value="65" />
- <speed type="street_3_land" value="70" />
- <speed type="street_4_land" value="80" />
- <speed type="street_n_lanes" value="120" />
- <speed type="highway_land" value="120" />
- <speed type="ramp" value="40" />
- <speed type="ferry" value="40" />
- </route>
- <navigation>
- <announce type="street_0,street_1_city" level0="10" level1="100" level2="200" unit="m" />
- <announce type="street_2_city,street_3_city,street_4_city,ramp" level0="20" level1="200" level2="500" unit="m" />
- <announce type="highway_city,street_1_land,street_2_land,street_3_land,street_4_land" level0="40" level1="400" level2="1000" unit="m" />
- <announce type="street_n_lanes,highway_land" level0="100" level1="1000" level2="2000" unit="m" />
-
- </navigation>
- <speech type="speech_dispatcher" data="echo 'Fix the speech tag in navit.xml to let navit say:' '%s'" />
-<!-- If you have the reiseplaner maps installed, set enabled="yes" in the next line -->
- <mapset enabled="no">
- <map type="mg" enabled="yes" data="/opt/reiseplaner/travel/DE.map" />
- <map type="mg" enabled="yes" data="/opt/reiseplaner/travel/DE.map/smp1.smp" />
- <map type="mg" enabled="yes" data="/opt/reiseplaner/travel/DE.map/smp2.smp" />
- <map type="mg" enabled="yes" data="/opt/reiseplaner/travel/DE.map/smp3.smp" />
- <map type="mg" enabled="yes" data="/opt/reiseplaner/travel/DE.map/smp4.smp" />
- <map type="mg" enabled="yes" data="/opt/reiseplaner/travel/DE.map/smp5.smp" />
- </mapset>
-<!-- If you dont want to use the sample map, set enabled="no" in the next line -->
- <mapset enabled="yes">
- <map type="binfile" enabled="yes" data="../maps/osm_bbox_11.3,47.9,11.7,48.2.bin"/>
- </mapset>
-<!-- Sample mapset for garmin maps -->
- <mapset enabled="no">
- <map type="garmin" enabled="yes" data="/path/to/img" debug="4"/>
- </mapset>
-
- <layout name="Tag">
- <layer name="sea" details="0">
- <item type="poly_wood" order="0-">
- <polygon color="#8ec78d" />
- </item>
- <item type="poly_town" order="0-">
- <polygon color="#ffc895" />
- <polyline color="#ebb481" />
- </item>
- <item type="poly_water" order="0-">
- <polygon color="#82c8ea" />
- <polyline color="#5096b8" />
- <label label_size="5" />
- </item>
- <item type="poly_park" order="0-">
- <polygon color="#7cc334" />
- <label label_size="5" />
- </item>
- <item type="poly_airport" order="0-">
- <polygon color="#a0a0a0" />
- </item>
- <item type="poly_sport" order="0-">
- <polygon color="#4af04f" />
- </item>
- <item type="poly_industry,poly_place" order="0-">
- <polygon color="#e6e6e6" />
- </item>
- <item type="poly_building" order="0-">
- <polygon color="#b6a6a6" />
- </item>
- <item type="water_line" order="0-">
- <polyline color="#5096b8" width="1" />
- <label label_size="5" />
- </item>
- <item type="poly_apron" order="0-">
- <polygon color="#d0d0d0" />
- </item>
- <item type="poly_terminal" order="7-">
- <polygon color="#e3c6a6" />
- </item>
- <item type="poly_cemetery" order="1-">
- <polygon color="#bde3cb" />
- </item>
- <item type="poly_car_parking" order="1-">
- <polygon color="#e7cf87" />
- </item>
- <item type="rail" order="6-">
- <polyline color="#808080" width="3" />
- </item>
- <item type="ferry" order="5-">
- <polyline color="#000000" width="1" />
- </item>
- <item type="border_country" order="0-">
- <polyline color="#b8434e" width="1" />
- </item>
- <item type="border_state" order="0-">
- <polyline color="#808080" width="1" />
- </item>
- <item type="height_line_1" order="0-">
- <polyline color="#000000" width="1" />
- </item>
- <item type="height_line_2" order="0-">
- <polyline color="#000000" width="2" />
- </item>
- <item type="street_route" order="2">
- <polyline color="#0000a0" width="4" />
- </item>
- <item type="street_route" order="3-5">
- <polyline color="#0000a0" width="8" />
- </item>
- <item type="street_route" order="6">
- <polyline color="#0000a0" width="10" />
- </item>
- <item type="street_route" order="7-8">
- <polyline color="#0000a0" width="16" />
- </item>
- <item type="street_route" order="9-10">
- <polyline color="#0000a0" width="20" />
- </item>
- <item type="street_route" order="11">
- <polyline color="#0000a0" width="28" />
- </item>
- <item type="street_route" order="12">
- <polyline color="#0000a0" width="32" />
- </item>
- <item type="street_route" order="13">
- <polyline color="#0000a0" width="52" />
- </item>
- <item type="street_route" order="14">
- <polyline color="#0000a0" width="64" />
- </item>
- <item type="street_route" order="15">
- <polyline color="#0000a0" width="68" />
- </item>
- <item type="street_route" order="16">
- <polyline color="#0000a0" width="132" />
- </item>
- <item type="street_route" order="17">
- <polyline color="#0000a0" width="268" />
- </item>
- <item type="street_route" order="18">
- <polyline color="#0000a0" width="530" />
- </item>
- <item type="street_nopass" order="10-">
- <polyline color="#000000" width="1" />
- </item>
- <item type="street_pedestrian" order="10">
- <polyline color="#d2d2d2" width="3" />
- <polyline color="#dddddd" width="1" />
- </item>
- <item type="street_pedestrian" order="11">
- <polyline color="#d2d2d2" width="5" />
- <polyline color="#dddddd" width="3" />
- </item>
- <item type="street_pedestrian" order="12">
- <polyline color="#d2d2d2" width="8" />
- <polyline color="#dddddd" width="6" />
- </item>
- <item type="street_pedestrian" order="13">
- <polyline color="#d2d2d2" width="9" />
- <polyline color="#dddddd" width="7" />
- </item>
- <item type="street_pedestrian" order="14">
- <polyline color="#d2d2d2" width="13" />
- <polyline color="#dddddd" width="9" />
- </item>
- <item type="street_pedestrian" order="15">
- <polyline color="#d2d2d2" width="18" />
- <polyline color="#dddddd" width="14" />
- </item>
- <item type="street_pedestrian" order="16">
- <polyline color="#d2d2d2" width="21" />
- <polyline color="#dddddd" width="17" />
- </item>
- <item type="street_pedestrian" order="17">
- <polyline color="#d2d2d2" width="25" />
- <polyline color="#dddddd" width="21" />
- </item>
- <item type="street_pedestrian" order="18">
- <polyline color="#d2d2d2" width="40" />
- <polyline color="#dddddd" width="34" />
- </item>
- <item type="street_service" order="11">
- <polyline color="#d2d2d2" width="4" />
- <polyline color="#fefefe" width="2" />
- </item>
- <item type="street_service" order="12">
- <polyline color="#d2d2d2" width="5" />
- <polyline color="#fefefe" width="3" />
- </item>
- <item type="street_service" order="13">
- <polyline color="#d2d2d2" width="6" />
- <polyline color="#fefefe" width="4" />
- </item>
- <item type="street_service" order="14">
- <polyline color="#d2d2d2" width="7" />
- <polyline color="#fefefe" width="5" />
- </item>
- <item type="street_service" order="15">
- <polyline color="#d2d2d2" width="8" />
- <polyline color="#fefefe" width="6" />
- </item>
- <item type="street_service" order="16">
- <polyline color="#d2d2d2" width="9" />
- <polyline color="#fefefe" width="7" />
- </item>
- <item type="street_service" order="17">
- <polyline color="#d2d2d2" width="10" />
- <polyline color="#fefefe" width="8" />
- </item>
- <item type="street_service" order="18">
- <polyline color="#d2d2d2" width="11" />
- <polyline color="#fefefe" width="9" />
- </item>
-
- <item type="street_0,street_1_city,street_1_land" order="10">
- <polyline color="#d2d2d2" width="4" />
- <polyline color="#ffffff" width="2" />
- </item>
- <item type="street_0,street_1_city,street_1_land" order="11">
- <polyline color="#d2d2d2" width="6" />
- <polyline color="#ffffff" width="4" />
- </item>
- <item type="street_0,street_1_city,street_1_land" order="12">
- <polyline color="#d2d2d2" width="10" />
- <polyline color="#ffffff" width="8" />
- </item>
- <item type="street_0,street_1_city,street_1_land" order="13">
- <polyline color="#d2d2d2" width="12" />
- <polyline color="#ffffff" width="9" />
- </item>
- <item type="street_0,street_1_city,street_1_land" order="14">
- <polyline color="#d2d2d2" width="15" />
- <polyline color="#ffffff" width="13" />
- </item>
- <item type="street_0,street_1_city,street_1_land" order="15">
- <polyline color="#d2d2d2" width="17" />
- <polyline color="#ffffff" width="14" />
- </item>
- <item type="street_0,street_1_city,street_1_land" order="16">
- <polyline color="#d2d2d2" width="33" />
- <polyline color="#ffffff" width="26" />
- </item>
- <item type="street_0,street_1_city,street_1_land" order="17">
- <polyline color="#d2d2d2" width="69" />
- <polyline color="#ffffff" width="61" />
- </item>
- <item type="street_0,street_1_city,street_1_land" order="18">
- <polyline color="#d2d2d2" width="132" />
- <polyline color="#ffffff" width="126" />
- </item>
- <item type="street_2_city,street_2_land" order="7-8">
- <polyline color="#c0c0c0" width="2" />
- </item>
- <item type="street_2_city,street_2_land" order="9">
- <polyline color="#c0c0c0" width="4" />
- <polyline color="#ffff00" width="2" />
- </item>
- <item type="street_2_city,street_2_land" order="10">
- <polyline color="#c0c0c0" width="6" />
- <polyline color="#ffff00" width="4" />
- </item>
- <item type="street_2_city,street_2_land" order="11">
- <polyline color="#c0c0c0" width="8" />
- <polyline color="#ffff00" width="6" />
- </item>
- <item type="street_2_city,street_2_land" order="12">
- <polyline color="#c0c0c0" width="12" />
- <polyline color="#ffff00" width="9" />
- </item>
- <item type="street_2_city,street_2_land" order="13">
- <polyline color="#c0c0c0" width="15" />
- <polyline color="#ffff00" width="11" />
- </item>
- <item type="street_2_city,street_2_land" order="14">
- <polyline color="#c0c0c0" width="18" />
- <polyline color="#ffff00" width="14" />
- </item>
- <item type="street_2_city,street_2_land" order="15">
- <polyline color="#c0c0c0" width="21" />
- <polyline color="#ffff00" width="17" />
- </item>
- <item type="street_2_city,street_2_land" order="16">
- <polyline color="#c0c0c0" width="35" />
- <polyline color="#ffff00" width="30" />
- </item>
- <item type="street_2_city,street_2_land" order="17">
- <polyline color="#c0c0c0" width="73" />
- <polyline color="#ffff00" width="67" />
- </item>
- <item type="street_2_city,street_2_land" order="18">
- <polyline color="#c0c0c0" width="144" />
- <polyline color="#ffff00" width="138" />
- </item>
- <item type="street_3_city,street_3_land,ramp" order="7-8">
- <polyline color="#a0a0a0" width="3" />
- <polyline color="#ffff00" width="1" />
- </item>
- <item type="street_3_city,street_3_land,ramp" order="9">
- <polyline color="#a0a0a0" width="5" />
- <polyline color="#ffff00" width="3" />
- </item>
- <item type="street_3_city,street_3_land,ramp" order="10">
- <polyline color="#a0a0a0" width="8" />
- <polyline color="#ffff00" width="6" />
- </item>
- <item type="street_3_city,street_3_land,ramp" order="11">
- <polyline color="#a0a0a0" width="9" />
- <polyline color="#ffff00" width="7" />
- </item>
- <item type="street_3_city,street_3_land,ramp" order="12">
- <polyline color="#a0a0a0" width="13" />
- <polyline color="#ffff00" width="9" />
- </item>
- <item type="street_3_city,street_3_land,ramp" order="13">
- <polyline color="#a0a0a0" width="18" />
- <polyline color="#ffff00" width="14" />
- </item>
- <item type="street_3_city,street_3_land,ramp" order="14">
- <polyline color="#a0a0a0" width="21" />
- <polyline color="#ffff00" width="17" />
- </item>
- <item type="street_3_city,street_3_land,ramp" order="15">
- <polyline color="#a0a0a0" width="25" />
- <polyline color="#ffff00" width="21" />
- </item>
- <item type="street_3_city,street_3_land,ramp" order="16">
- <polyline color="#a0a0a0" width="40" />
- <polyline color="#ffff00" width="34" />
- </item>
- <item type="street_3_city,street_3_land,ramp" order="17">
- <polyline color="#a0a0a0" width="79" />
- <polyline color="#ffff00" width="73" />
- </item>
- <item type="street_3_city,street_3_land,ramp" order="18">
- <polyline color="#a0a0a0" width="156" />
- <polyline color="#ffff00" width="150" />
- </item>
- <item type="street_4_city,street_4_land,street_n_lanes" order="2-6">
- <polyline color="#404040" width="1" />
- </item>
- <item type="street_4_city,street_4_land,street_n_lanes" order="7-8">
- <polyline color="#404040" width="3" />
- <polyline color="#ff0000" width="1" />
- </item>
- <item type="street_4_city,street_4_land,street_n_lanes" order="9">
- <polyline color="#000000" width="5" />
- <polyline color="#ff0000" width="3" />
- </item>
- <item type="street_4_city,street_4_land,street_n_lanes" order="10">
- <polyline color="#000000" width="6" />
- <polyline color="#ff0000" width="4" />
- </item>
- <item type="street_4_city,street_4_land,street_n_lanes" order="11">
- <polyline color="#000000" width="9" />
- <polyline color="#ff0000" width="7" />
- </item>
- <item type="street_4_city,street_4_land,street_n_lanes" order="12">
- <polyline color="#000000" width="13" />
- <polyline color="#ff0000" width="9" />
- </item>
- <item type="street_4_city,street_4_land,street_n_lanes" order="13">
- <polyline color="#000000" width="18" />
- <polyline color="#ff0000" width="14" />
- </item>
- <item type="street_4_city,street_4_land,street_n_lanes" order="14">
- <polyline color="#000000" width="21" />
- <polyline color="#ff0000" width="17" />
- </item>
- <item type="street_4_city,street_4_land,street_n_lanes" order="15">
- <polyline color="#000000" width="24" />
- <polyline color="#ff0000" width="20" />
- </item>
- <item type="street_4_city,street_4_land,street_n_lanes" order="16">
- <polyline color="#000000" width="39" />
- <polyline color="#ff0000" width="33" />
- </item>
- <item type="street_4_city,street_4_land,street_n_lanes" order="17">
- <polyline color="#000000" width="78" />
- <polyline color="#ff0000" width="72" />
- </item>
- <item type="street_4_city,street_4_land,street_n_lanes" order="18">
- <polyline color="#000000" width="156" />
- <polyline color="#ff0000" width="150" />
- </item>
- <item type="highway_city,highway_land" order="2">
- <polyline color="#ff0000" width="1" />
- </item>
- <item type="highway_city,highway_land" order="3-5">
- <polyline color="#ff0000" width="3" />
- <polyline color="#ffff00" width="1" />
- </item>
- <item type="highway_city,highway_land" order="6">
- <polyline color="#ff0000" width="4" />
- <polyline color="#ffff00" width="2" />
- </item>
- <item type="highway_city,highway_land" order="7-8">
- <polyline color="#ff0000" width="7" />
- <polyline color="#ffff00" width="5" />
- <polyline color="#ff0000" width="1" />
- </item>
- <item type="highway_city,highway_land" order="9-10">
- <polyline color="#ff0000" width="9" />
- <polyline color="#ffff00" width="5" />
- <polyline color="#ff0000" width="1" />
- </item>
- <item type="highway_city,highway_land" order="11">
- <polyline color="#ff0000" width="13" />
- <polyline color="#ffff00" width="9" />
- <polyline color="#ff0000" width="1" />
- </item>
- <item type="highway_city,highway_land" order="12">
- <polyline color="#ff0000" width="15" />
- <polyline color="#ffff00" width="10" />
- <polyline color="#ff0000" width="1" />
- </item>
- <item type="highway_city,highway_land" order="13">
- <polyline color="#ff0000" width="25" />
- <polyline color="#ffff00" width="17" />
- <polyline color="#ff0000" width="1" />
- </item>
- <item type="highway_city,highway_land" order="14">
- <polyline color="#ff0000" width="31" />
- <polyline color="#ffff00" width="24" />
- <polyline color="#ff0000" width="1" />
- </item>
- <item type="highway_city,highway_land" order="15">
- <polyline color="#ff0000" width="33" />
- <polyline color="#ffff00" width="27" />
- <polyline color="#ff0000" width="1" />
- </item>
- <item type="highway_city,highway_land" order="16">
- <polyline color="#ff0000" width="65" />
- <polyline color="#ffff00" width="59" />
- <polyline color="#ff0000" width="1" />
- </item>
- <item type="highway_city,highway_land" order="17">
- <polyline color="#ff0000" width="133" />
- <polyline color="#ffff00" width="127" />
- <polyline color="#ff0000" width="1" />
- </item>
- <item type="highway_city,highway_land" order="18">
- <polyline color="#ff0000" width="264" />
- <polyline color="#ffff00" width="258" />
- <polyline color="#ff0000" width="1" />
- </item>
- <item type="street_unkn" order="0-">
- <polyline color="#8080ff" width="3" />
- </item>
- <item type="highway_exit_label" order="10-">
- <circle color="#000000" radius="3" label_size="7" />
- </item>
- <item type="highway_city,highway_land,street_4_city,street_4_land,street_n_lanes" order="10-18">
- <label label_size="8" />
- </item>
- <item type="street_2_city,street_2_land,street_3_city,street_3_land,ramp" order="11-18">
- <label label_size="9" />
- </item>
- <item type="street_nopass,street_0,street_1_city,street_1_land" order="12-18">
- <label label_size="9" />
- </item>
- <item type="aeroway_taxiway" order="10">
- <polyline color="#989994" width="4" />
- <polyline color="#d3dbbc" width="2" />
- </item>
- <item type="aeroway_taxiway" order="11">
- <polyline color="#989994" width="6" />
- <polyline color="#d3dbbc" width="4" />
- </item>
- <item type="aeroway_taxiway" order="12">
- <polyline color="#989994" width="10" />
- <polyline color="#d3dbbc" width="8" />
- </item>
- <item type="aeroway_taxiway" order="13">
- <polyline color="#989994" width="12" />
- <polyline color="#d3dbbc" width="9" />
- </item>
- <item type="aeroway_taxiway" order="14">
- <polyline color="#989994" width="15" />
- <polyline color="#d3dbbc" width="13" />
- </item>
- <item type="aeroway_taxiway" order="15">
- <polyline color="#989994" width="17" />
- <polyline color="#d3dbbc" width="14" />
- </item>
- <item type="aeroway_taxiway" order="16">
- <polyline color="#989994" width="33" />
- <polyline color="#d3dbbc" width="26" />
- </item>
- <item type="aeroway_taxiway" order="17">
- <polyline color="#989994" width="69" />
- <polyline color="#d3dbbc" width="61" />
- </item>
- <item type="aeroway_taxiway" order="18">
- <polyline color="#989994" width="132" />
- <polyline color="#d3dbbc" width="126" />
- </item>
- <item type="aeroway_runway" order="2-6">
- <polyline color="#404040" width="1" />
- </item>
- <item type="aeroway_runway" order="7-8">
- <polyline color="#404040" width="3" />
- <polyline color="#d3dbbc" width="1" />
- </item>
- <item type="aeroway_runway" order="9">
- <polyline color="#6b6f5f" width="5" />
- <polyline color="#d3dbbc" width="3" />
- </item>
- <item type="aeroway_runway" order="10">
- <polyline color="#6b6f5f" width="6" />
- <polyline color="#d3dbbc" width="4" />
- </item>
- <item type="aeroway_runway" order="11">
- <polyline color="#6b6f5f" width="9" />
- <polyline color="#d3dbbc" width="7" />
- </item>
- <item type="aeroway_runway" order="12">
- <polyline color="#6b6f5f" width="13" />
- <polyline color="#d3dbbc" width="9" />
- </item>
- <item type="aeroway_runway" order="13">
- <polyline color="#6b6f5f" width="18" />
- <polyline color="#d3dbbc" width="14" />
- </item>
- <item type="aeroway_runway" order="14">
- <polyline color="#6b6f5f" width="21" />
- <polyline color="#d3dbbc" width="17" />
- </item>
- <item type="aeroway_runway" order="15">
- <polyline color="#6b6f5f" width="24" />
- <polyline color="#d3dbbc" width="20" />
- </item>
- <item type="aeroway_runway" order="16">
- <polyline color="#6b6f5f" width="39" />
- <polyline color="#d3dbbc" width="33" />
- </item>
- <item type="aeroway_runway" order="17">
- <polyline color="#6b6f5f" width="78" />
- <polyline color="#d3dbbc" width="72" />
- </item>
- <item type="aeroway_runway" order="18">
- <polyline color="#6b6f5f" width="156" />
- <polyline color="#d3dbbc" width="150" />
- </item>
- <item type="town_label,district_label,town_label_0e0,town_label_1e0,town_label_2e0,town_label_5e0,town_label_1e1,town_label_2e1,town_label_5e1,town_label_1e2,town_label_2e2,town_label_5e2,district_label_0e0,district_label_1e0,district_label_2e0,district_label_5e0,district_label_1e1,district_label_2e1,district_label_5e1,district_label_1e2,district_label_2e2,district_label_5e2" order="12-">
- <circle color="#000000" radius="3" label_size="7" />
- </item>
- <item type="district_label_1e3,district_label_2e3,district_label_5e3" order="11-">
- <circle color="#000000" radius="3" label_size="7" />
- </item>
- <item type="town_label_1e3,town_label_2e3,town_label_5e3" order="10-">
- <circle color="#000000" radius="3" label_size="7" />
- </item>
- <item type="district_label_1e4,district_label_2e4,district_label_5e4" order="9-">
- <circle color="#000000" radius="3" label_size="7" />
- </item>
- <item type="town_label_1e4,town_label_2e4,town_label_5e4" order="8-">
- <circle color="#000000" radius="3" label_size="7" />
- </item>
- <item type="district_label_1e5,district_label_2e5,district_label_5e5" order="6-">
- <circle color="#000000" radius="3" label_size="10" />
- </item>
- <item type="town_label_1e5,town_label_2e5,town_label_5e5" order="4-">
- <circle color="#000000" radius="3" label_size="10" />
- </item>
- <item type="district_label_1e6,district_label_2e6,district_label_5e6" order="3-">
- <circle color="#000000" radius="3" label_size="15" />
- </item>
- <item type="town_label_1e6,town_label_2e6,town_label_5e6" order="2-">
- <circle color="#000000" radius="3" label_size="15" />
- </item>
- <item type="town_label_1e7,district_label_1e7" order="1-">
- <circle color="#000000" radius="3" label_size="15" />
- </item>
- <item type="track" order="3-">
- <polyline color="#3f3f3f" width="1" />
- </item>
-
- <item type="poi_airport" order="5-">
- <icon src="airport.xpm" />
- </item>
- <item type="town_ghost" order="0-">
- <icon src="ghost_town.xpm" />
- </item>
- <item type="poi_hotel" order="12-">
- <icon src="hotel.xpm" />
- </item>
- <item type="poi_car_parking" order="11-">
- <icon src="parking.xpm" />
- </item>
- <item type="poi_car_dealer_parts" order="0-">
- <icon src="car_dealer.xpm" />
- </item>
- <item type="poi_fuel" order="10-">
- <icon src="fuel.xpm" />
- </item>
- <item type="poi_shopping" order="0-">
- <icon src="shopping.xpm" />
- </item>
- <item type="poi_attraction" order="5-">
- <icon src="attraction.xpm" />
- </item>
- <item type="poi_cafe" order="12-">
- <icon src="cafe.xpm" />
- </item>
- <item type="poi_bar" order="12-">
- <icon src="bar.xpm" />
- </item>
- <item type="poi_bridge" order="0-">
- <icon src="bridge.xpm" />
- </item>
- <item type="highway_exit" order="11-">
- <icon src="exit.xpm" />
- </item>
- <item type="poi_camp_rv" order="9-">
- <icon src="camping.xpm" />
- </item>
- <item type="poi_museum_history" order="12-">
- <icon src="museum.xpm" />
- </item>
- <item type="poi_hospital" order="12-">
- <icon src="hospital.xpm" />
- </item>
- <item type="point_unkn" order="0-">
- <circle color="#8080ff" radius="3" />
- </item>
- <item type="poi_dining" order="12-">
- <icon src="dining.xpm" />
- </item>
- <item type="poi_fastfood" order="12-">
- <icon src="fastfood.xpm" />
- </item>
- <item type="poi_police" order="12-">
- <icon src="police.xpm" />
- </item>
- <item type="poi_auto_club" order="0-">
- <icon src="auto_club.xpm" />
- </item>
- <item type="poi_autoservice" order="0-">
- <icon src="autoservice.xpm" />
- </item>
- <item type="poi_bank" order="12-">
- <icon src="bank.xpm" />
- </item>
- <item type="poi_bay" order="0-">
- <icon src="bay.xpm" />
- </item>
- <item type="poi_bend" order="0-">
- <icon src="bend.xpm" />
- </item>
- <item type="poi_boat_ramp" order="0-">
- <icon src="boat_ramp.xpm" />
- </item>
- <item type="poi_border_station" order="0-">
- <icon src="border_station.xpm" />
- </item>
- <item type="poi_bowling" order="0-">
- <icon src="bowling.xpm" />
- </item>
- <item type="poi_bus_station" order="12-">
- <icon src="bus.xpm" />
- </item>
- <item type="poi_bus_stop" order="12-">
- <icon src="bus.xpm" />
- </item>
- <item type="poi_bussines_service" order="0-">
- <icon src="bussines_service.xpm" />
- </item>
- <item type="poi_car_rent" order="0-">
- <icon src="car_rent.xpm" />
- </item>
- <item type="poi_car_wash" order="0-">
- <icon src="car_wash.xpm" />
- </item>
- <item type="poi_casino" order="0-">
- <icon src="casino.xpm" />
- </item>
- <item type="poi_cemetery" order="0-">
- <icon src="cemetery.xpm" />
- </item>
- <item type="poi_church" order="11-">
- <icon src="church.xpm" />
- </item>
- <item type="poi_cinema" order="12-">
- <icon src="cinema.xpm" />
- </item>
- <item type="poi_civil" order="0-">
- <icon src="civil.xpm" />
- </item>
- <item type="poi_communication" order="0-">
- <icon src="communication.xpm" />
- </item>
- <item type="poi_concert" order="0-">
- <icon src="concert.xpm" />
- </item>
- <item type="poi_cove" order="0-">
- <icon src="cove.xpm" />
- </item>
- <item type="poi_crossing" order="0-">
- <icon src="crossing.xpm" />
- </item>
- <item type="poi_dam" order="0-">
- <icon src="dam.xpm" />
- </item>
- <item type="poi_danger_area" order="0-">
- <icon src="danger_area.xpm" />
- </item>
- <item type="poi_dangerous" order="0-">
- <icon src="dangerous.xpm" />
- </item>
- <item type="poi_daymark" order="0-">
- <icon src="daymark.xpm" />
- </item>
- <item type="poi_diving" order="0-">
- <icon src="diving.xpm" />
- </item>
- <item type="poi_drinking_water" order="0-">
- <icon src="drinking_water.xpm" />
- </item>
- <item type="poi_emergency" order="0-">
- <icon src="emergency.xpm" />
- </item>
- <item type="poi_fair" order="0-">
- <icon src="fair.xpm" />
- </item>
- <item type="poi_firebrigade" order="12-">
- <icon src="firebrigade.xpm" />
- </item>
- <item type="poi_fish" order="0-">
- <icon src="fish.xpm" />
- </item>
- <item type="poi_forbiden_area" order="0-">
- <icon src="forbiden_area.xpm" />
- </item>
- <item type="poi_garmin" order="0-">
- <icon src="garmin.xpm" />
- </item>
- <item type="poi_golf" order="12-">
- <icon src="golf.xpm" />
- </item>
- <item type="poi_goverment_building" order="0-">
- <icon src="goverment_building.xpm" />
- </item>
- <item type="poi_height" order="0-">
- <icon src="height.xpm" />
- </item>
- <item type="poi_heliport" order="0-">
- <icon src="heliport.xpm" />
- </item>
- <item type="poi_hotspring" order="0-">
- <icon src="hotspring.xpm" />
- </item>
- <item type="poi_icesport" order="0-">
- <icon src="icesport.xpm" />
- </item>
- <item type="poi_information" order="12-">
- <icon src="information.xpm" />
- </item>
- <item type="poi_justice" order="0-">
- <icon src="justice.xpm" />
- </item>
- <item type="poi_landmark" order="0-">
- <icon src="landmark.xpm" />
- </item>
- <item type="poi_levee" order="0-">
- <icon src="levee.xpm" />
- </item>
- <item type="poi_library" order="12-">
- <icon src="library.xpm" />
- </item>
- <item type="poi_locale" order="0-">
- <icon src="locale.xpm" />
- </item>
- <item type="poi_loudspeaker" order="0-">
- <icon src="loudspeaker.xpm" />
- </item>
- <item type="poi_mall" order="0-">
- <icon src="mall.xpm" />
- </item>
- <item type="poi_manmade_feature" order="0-">
- <icon src="manmade_feature.xpm" />
- </item>
- <item type="poi_marine" order="0-">
- <icon src="marine.xpm" />
- </item>
- <item type="poi_marine_type" order="0-">
- <icon src="marine_type.xpm" />
- </item>
- <item type="poi_mark" order="0-">
- <icon src="mark.xpm" />
- </item>
- <item type="poi_military" order="0-">
- <icon src="military.xpm" />
- </item>
- <item type="poi_mine" order="0-">
- <icon src="mine.xpm" />
- </item>
- <item type="poi_nondangerous" order="0-">
- <icon src="nondangerous.xpm" />
- </item>
- <item type="poi_oil_field" order="0-">
- <icon src="oil_field.xpm" />
- </item>
- <item type="poi_personal_service" order="0-">
- <icon src="personal_service.xpm" />
- </item>
- <item type="poi_pharmacy" order="12-">
- <icon src="pharmacy.xpm" />
- </item>
- <item type="poi_post" order="13-">
- <icon src="post.xpm" />
- </item>
- <item type="poi_public_office" order="0-">
- <icon src="public_office.xpm" />
- </item>
- <item type="poi_repair_service" order="0-">
- <icon src="repair_service.xpm" />
- </item>
- <item type="poi_resort" order="0-">
- <icon src="resort.xpm" />
- </item>
- <item type="poi_rest_room" order="13-">
- <icon src="rest_room.xpm" />
- </item>
- <item type="poi_restaurant" order="12-">
- <icon src="restaurant.xpm" />
- </item>
- <item type="poi_restricted_area" order="0-">
- <icon src="restricted_area.xpm" />
- </item>
- <item type="poi_restroom" order="13-">
- <icon src="restroom.xpm" />
- </item>
- <item type="poi_sailing" order="0-">
- <icon src="sailing.xpm" />
- </item>
- <item type="poi_scenic_area" order="0-">
- <icon src="scenic_area.xpm" />
- </item>
- <item type="poi_school" order="12-">
- <icon src="school.xpm" />
- </item>
- <item type="poi_service" order="0-">
- <icon src="service.xpm" />
- </item>
- <item type="poi_shop_apparel" order="0-">
- <icon src="shop_apparel.xpm" />
- </item>
- <item type="poi_shop_computer" order="0-">
- <icon src="shop_computer.xpm" />
- </item>
- <item type="poi_shop_department" order="0-">
- <icon src="shop_department.xpm" />
- </item>
- <item type="poi_shop_furnish" order="0-">
- <icon src="shop_furnish.xpm" />
- </item>
- <item type="poi_shop_grocery" order="0-">
- <icon src="shop_grocery.xpm" />
- </item>
- <item type="poi_shop_handg" order="0-">
- <icon src="shop_handg.xpm" />
- </item>
- <item type="poi_shop_merchandise" order="0-">
- <icon src="shop_merchandise.xpm" />
- </item>
- <item type="poi_shop_retail" order="0-">
- <icon src="shop_retail.xpm" />
- </item>
- <item type="poi_shower" order="0-">
- <icon src="shower.xpm" />
- </item>
- <item type="poi_skiing" order="12-">
- <icon src="skiing.xpm" />
- </item>
- <item type="poi_social_service" order="0-">
- <icon src="social_service.xpm" />
- </item>
- <item type="poi_sounding" order="0-">
- <icon src="sounding.xpm" />
- </item>
- <item type="poi_sport" order="0-">
- <icon src="sport.xpm" />
- </item>
- <item type="poi_stadium" order="0-">
- <icon src="stadium.xpm" />
- </item>
- <item type="poi_subdivision" order="0-">
- <icon src="subdivision.xpm" />
- </item>
- <item type="poi_swimming" order="12-">
- <icon src="swimming.xpm" />
- </item>
- <item type="poi_telephone" order="13-">
- <icon src="telephone.xpm" />
- </item>
- <item type="poi_theater" order="12-">
- <icon src="theater.xpm" />
- </item>
- <item type="poi_tide" order="0-">
- <icon src="tide.xpm" />
- </item>
- <item type="poi_tower" order="13-">
- <icon src="tower.xpm" />
- </item>
- <item type="poi_trail" order="0-">
- <icon src="trail.xpm" />
- </item>
- <item type="poi_truck_stop" order="0-">
- <icon src="truck_stop.xpm" />
- </item>
- <item type="poi_tunnel" order="0-">
- <icon src="tunnel.xpm" />
- </item>
- <item type="poi_wine" order="0-">
- <icon src="wine.xpm" />
- </item>
- <item type="poi_worship" order="0-">
- <icon src="worship.xpm" />
- </item>
- <item type="poi_wrecker" order="0-">
- <icon src="wrecker.xpm" />
- </item>
- <item type="poi_zoo" order="0-">
- <icon src="zoo.xpm" />
- </item>
- <item type="poi_picnic" order="11-">
- <icon src="picnic.xpm" />
- </item>
- <item type="poi_gc_multi" order="0-">
- <icon src="gc_multi.xpm" />
- </item>
- <item type="poi_gc_tradi" order="0-">
- <icon src="gc_tradi.xpm" />
- </item>
- <item type="poi_gc_event" order="0-">
- <icon src="gc_event.xpm" />
- </item>
- <item type="poi_gc_mystery" order="0-">
- <icon src="gc_mystery.xpm" />
- </item>
- <item type="poi_gc_question" order="0-">
- <icon src="gc_question.xpm" />
- </item>
- <item type="poi_gc_stages" order="0-">
- <icon src="gc_stages.xpm" />
- </item>
- <item type="poi_gc_reference" order="0-">
- <icon src="gc_reference.xpm" />
- </item>
- <item type="poi_gc_webcam" order="0-">
- <icon src="gc_webcam.xpm" />
- </item>
- <item type="traffic_signals" order="13-">
- <icon src="traffic_signals.xpm" />
- </item>
- <item type="poly_flats,poly_scrub,poly_military_zone,poly_marine,plantation,tundra" order="0-">
- <polygon color="#a0a0a0" />
- <label label_size="5" />
- </item>
- <item type="rg_segment" order="0-">
- <polyline color="#FF089C" width="1" />
- </item>
- <item type="rg_point" order="0-">
- <circle color="#FF089C" radius="10" label_size="7" />
- </item>
- </layer>
- </layout>
- <layout name="Nacht">
- </layout>
-</navit>
-</config>
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
-<CodeBlocks_project_file>
- <FileVersion major="1" minor="6" />
- <Project>
- <Option title="speech" />
- <Option pch_mode="2" />
- <Option compiler="gcc" />
- <Build>
- <Target title="Debug">
- <Option output=".\bin\Debug\libspeech_speech_dispatcher.la" prefix_auto="1" extension_auto="0" />
- <Option working_dir="" />
- <Option object_output=".\obj\Debug\" />
- <Option type="2" />
- <Option compiler="gcc" />
- <Option createDefFile="1" />
- <Compiler>
- <Add option="-g" />
- </Compiler>
- <Linker>
- <Add directory="%GTK_DIR%\lib" />
- <Add directory="bin\Debug" />
- </Linker>
- </Target>
- <Target title="Release">
- <Option output=".\bin\Release\libspeech_speech_dispatcher.la" prefix_auto="1" extension_auto="0" />
- <Option working_dir="" />
- <Option object_output=".\obj\Release\" />
- <Option type="2" />
- <Option compiler="gcc" />
- <Option createDefFile="1" />
- <Compiler>
- <Add option="-O2" />
- </Compiler>
- <Linker>
- <Add option="-s" />
- <Add directory="%GTK_DIR%\lib" />
- <Add directory="bin\Release" />
- </Linker>
- </Target>
- </Build>
- <Compiler>
- <Add option="-Wall" />
- <Add option="-mms-bitfields" />
- <Add option="-DBUILD_DLL" />
- <Add option="-DMODULE=speech_speech_dispatcher" />
- <Add directory="%GTK_DIR%\include\glib-2.0" />
- <Add directory="%GTK_DIR%\lib\glib-2.0\include" />
- <Add directory="Win32Extra" />
- <Add directory="..\..\src" />
- <Add directory="." />
- <Add directory="Win32Extra\libgarmin" />
- <Add directory="C:\Program Files\Microsoft Speech SDK 5.1\Include" />
- </Compiler>
- <Linker>
- <Add library="NavitCommonLib" />
- <Add library="glib-2.0" />
- <Add library="user32" />
- <Add library="intl" />
- <Add library="iconv" />
- <Add directory="%GTK_DIR%\lib" />
- </Linker>
- <Unit filename="Win32Extra\speech_dispatcher_win32.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\src\data\garmin\garmin.h" />
- <Extensions>
- <code_completion />
- <envvars />
- <debugger />
- </Extensions>
- </Project>
-</CodeBlocks_project_file>
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
-<CodeBlocks_project_file>
- <FileVersion major="1" minor="6" />
- <Project>
- <Option title="vehicle_demo" />
- <Option pch_mode="2" />
- <Option compiler="gcc" />
- <Build>
- <Target title="Debug">
- <Option output=".\bin\Debug\libvehicle_demo.la" prefix_auto="1" extension_auto="0" />
- <Option working_dir="" />
- <Option object_output=".\obj\Debug\" />
- <Option type="2" />
- <Option compiler="gcc" />
- <Option createDefFile="1" />
- <Compiler>
- <Add option="-g" />
- </Compiler>
- <Linker>
- <Add directory="%GTK_DIR%\lib" />
- <Add directory="bin\Debug" />
- </Linker>
- </Target>
- <Target title="Release">
- <Option output=".\bin\Release\libvehicle_demo.la" prefix_auto="1" extension_auto="0" />
- <Option working_dir="" />
- <Option object_output=".\obj\Release\" />
- <Option type="2" />
- <Option compiler="gcc" />
- <Option createDefFile="1" />
- <Compiler>
- <Add option="-O2" />
- </Compiler>
- <Linker>
- <Add option="-s" />
- <Add directory="%GTK_DIR%\lib" />
- <Add directory="bin\Release" />
- </Linker>
- </Target>
- </Build>
- <Compiler>
- <Add option="-Wall" />
- <Add option="-mms-bitfields" />
- <Add option="-DBUILD_DLL" />
- <Add option="-DMODULE=vehicle_demo" />
- <Add directory="%GTK_DIR%\include\glib-2.0" />
- <Add directory="%GTK_DIR%\lib\glib-2.0\include" />
- <Add directory="Win32Extra" />
- <Add directory="..\..\src" />
- </Compiler>
- <Linker>
- <Add library="glib-2.0" />
- <Add library="user32" />
- <Add library="intl" />
- <Add library="iconv" />
- <Add directory="%GTK_DIR%\lib" />
- </Linker>
- <Unit filename="..\..\src\vehicle\demo\vehicle_demo.c">
- <Option compilerVar="CC" />
- </Unit>
- <Extensions>
- <code_completion />
- <envvars />
- <debugger />
- </Extensions>
- </Project>
-</CodeBlocks_project_file>
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
-<CodeBlocks_project_file>
- <FileVersion major="1" minor="6" />
- <Project>
- <Option title="vehicle_file" />
- <Option pch_mode="2" />
- <Option compiler="gcc" />
- <Build>
- <Target title="Debug">
- <Option output=".\bin\Debug\libvehicle_file.la" prefix_auto="1" extension_auto="0" />
- <Option working_dir="" />
- <Option object_output=".\obj\Debug\" />
- <Option type="2" />
- <Option compiler="gcc" />
- <Option createDefFile="1" />
- <Compiler>
- <Add option="-g" />
- </Compiler>
- <Linker>
- <Add directory="%GTK_DIR%\lib" />
- <Add directory="bin\Debug" />
- </Linker>
- </Target>
- <Target title="Release">
- <Option output=".\bin\Release\libvehicle_file.la" prefix_auto="1" extension_auto="0" />
- <Option working_dir="" />
- <Option object_output=".\obj\Release\" />
- <Option type="2" />
- <Option compiler="gcc" />
- <Option createDefFile="1" />
- <Compiler>
- <Add option="-O2" />
- </Compiler>
- <Linker>
- <Add option="-s" />
- <Add directory="%GTK_DIR%\lib" />
- <Add directory="bin\Release" />
- </Linker>
- </Target>
- </Build>
- <Compiler>
- <Add option="-Wall" />
- <Add option="-mms-bitfields" />
- <Add option="-DBUILD_DLL" />
- <Add option="-DMODULE=vehicle_file" />
- <Add directory="%GTK_DIR%\include\glib-2.0" />
- <Add directory="%GTK_DIR%\lib\glib-2.0\include" />
- <Add directory="Win32Extra" />
- <Add directory="..\..\src" />
- </Compiler>
- <Linker>
- <Add library="glib-2.0" />
- <Add library="user32" />
- <Add library="intl" />
- <Add library="iconv" />
- <Add directory="%GTK_DIR%\lib" />
- </Linker>
- <Unit filename="..\..\src\vehicle\file\vehicle_file.c">
- <Option compilerVar="CC" />
- </Unit>
- <Extensions>
- <code_completion />
- <envvars />
- <debugger />
- </Extensions>
- </Project>
-</CodeBlocks_project_file>
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
-<CodeBlocks_project_file>
- <FileVersion major="1" minor="6" />
- <Project>
- <Option title="win32_gui" />
- <Option pch_mode="2" />
- <Option compiler="gcc" />
- <Build>
- <Target title="Debug">
- <Option output=".\bin\Debug\libwin32_gui.la" prefix_auto="0" extension_auto="0" />
- <Option working_dir="" />
- <Option object_output="obj\" />
- <Option type="2" />
- <Option compiler="gcc" />
- <Option createDefFile="1" />
- <Compiler>
- <Add option="-g" />
- <Add option="-I." />
- </Compiler>
- </Target>
- <Target title="Release">
- <Option output=".\bin\Release\libwin32_gui.la" prefix_auto="0" extension_auto="0" />
- <Option working_dir="" />
- <Option object_output="obj\" />
- <Option type="2" />
- <Option compiler="gcc" />
- <Option createDefFile="1" />
- <Compiler>
- <Add option="-O2" />
- </Compiler>
- <Linker>
- <Add option="-s" />
- </Linker>
- </Target>
- </Build>
- <Compiler>
- <Add option="-Wall" />
- <Add option="-mms-bitfields" />
- <Add option="-DMODULE=win32_gui" />
- <Add directory="%GTK_DIR%\include\glib-2.0" />
- <Add directory="%GTK_DIR%\lib\glib-2.0\include" />
- <Add directory="..\..\src" />
- <Add directory="Win32Extra" />
- </Compiler>
- <Unit filename="win32gui\win32_graphics.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="win32gui\win32_gui.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="win32gui\win32_gui.h" />
- <Unit filename="win32gui\xpm2bmp.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="win32gui\xpm2bmp.h" />
- <Extensions>
- <code_completion />
- <envvars />
- <debugger />
- </Extensions>
- </Project>
-</CodeBlocks_project_file>
+++ /dev/null
-#include <windows.h>
-
-#define IDI_NAVIT 1100
-#define IDB_NAVITTOOLBAR 1101
+++ /dev/null
-/////////////////////////////////////////////////////////////////////////////
-//
-// Bitmap
-//
-
-#include "resource.h"
-
-/////////////////////////////////////////////////////////////////////////////
-//
-// Bitmap
-//
-
-IDB_NAVITTOOLBAR BITMAP DISCARDABLE "toolbar.bmp"
-IDI_NAVIT ICON DISCARDABLE "navit.ico"
+++ /dev/null
-#include <windows.h>
-#include <wingdi.h>
-#include <glib.h>
-#include <math.h>
-#include <stdio.h>
-#include <stdlib.h>
-
-#include "config.h"
-#include "debug.h"
-#include "point.h"
-#include "graphics.h"
-#include "color.h"
-#include "plugin.h"
-#include "win32_gui.h"
-#include "xpm2bmp.h"
-
-#ifndef GET_WHEEL_DELTA_WPARAM
- #define GET_WHEEL_DELTA_WPARAM(wParam) ((short)HIWORD(wParam))
-#endif
-
-
-static GHashTable *image_cache_hash = NULL;
-
-
-HFONT EzCreateFont (HDC hdc, TCHAR * szFaceName, int iDeciPtHeight,
- int iDeciPtWidth, int iAttributes, BOOL fLogRes) ;
-
-#define EZ_ATTR_BOLD 1
-#define EZ_ATTR_ITALIC 2
-#define EZ_ATTR_UNDERLINE 4
-#define EZ_ATTR_STRIKEOUT 8
-
-HFONT EzCreateFont (HDC hdc, TCHAR * szFaceName, int iDeciPtHeight,
- int iDeciPtWidth, int iAttributes, BOOL fLogRes)
-{
- FLOAT cxDpi, cyDpi ;
- HFONT hFont ;
- LOGFONT lf ;
- POINT pt ;
- TEXTMETRIC tm ;
-
- SaveDC (hdc) ;
-
- SetGraphicsMode (hdc, GM_ADVANCED) ;
- ModifyWorldTransform (hdc, NULL, MWT_IDENTITY) ;
- SetViewportOrgEx (hdc, 0, 0, NULL) ;
- SetWindowOrgEx (hdc, 0, 0, NULL) ;
-
- if (fLogRes)
- {
- cxDpi = (FLOAT) GetDeviceCaps (hdc, LOGPIXELSX) ;
- cyDpi = (FLOAT) GetDeviceCaps (hdc, LOGPIXELSY) ;
- }
- else
- {
- cxDpi = (FLOAT) (25.4 * GetDeviceCaps (hdc, HORZRES) /
- GetDeviceCaps (hdc, HORZSIZE)) ;
-
- cyDpi = (FLOAT) (25.4 * GetDeviceCaps (hdc, VERTRES) /
- GetDeviceCaps (hdc, VERTSIZE)) ;
- }
-
- pt.x = (int) (iDeciPtWidth * cxDpi / 72) ;
- pt.y = (int) (iDeciPtHeight * cyDpi / 72) ;
-
- DPtoLP (hdc, &pt, 1) ;
- lf.lfHeight = - (int) (fabs (pt.y) / 10.0 + 0.5) ;
- lf.lfWidth = 0 ;
- lf.lfEscapement = 0 ;
- lf.lfOrientation = 0 ;
- lf.lfWeight = iAttributes & EZ_ATTR_BOLD ? 700 : 0 ;
- lf.lfItalic = iAttributes & EZ_ATTR_ITALIC ? 1 : 0 ;
- lf.lfUnderline = iAttributes & EZ_ATTR_UNDERLINE ? 1 : 0 ;
- lf.lfStrikeOut = iAttributes & EZ_ATTR_STRIKEOUT ? 1 : 0 ;
- lf.lfCharSet = DEFAULT_CHARSET ;
- lf.lfOutPrecision = 0 ;
- lf.lfClipPrecision = 0 ;
- lf.lfQuality = 0 ;
- lf.lfPitchAndFamily = 0 ;
-
- lstrcpy (lf.lfFaceName, szFaceName) ;
-
- hFont = CreateFontIndirect (&lf) ;
-
- if (iDeciPtWidth != 0)
- {
- hFont = (HFONT) SelectObject (hdc, hFont) ;
-
- GetTextMetrics (hdc, &tm) ;
-
- DeleteObject (SelectObject (hdc, hFont)) ;
-
- lf.lfWidth = (int) (tm.tmAveCharWidth *
- fabs (pt.x) / fabs (pt.y) + 0.5) ;
-
- hFont = CreateFontIndirect (&lf) ;
- }
-
- RestoreDC (hdc, -1) ;
- return hFont ;
-}
-
-struct graphics_image_priv {
- PXPM2BMP pxpm;
-};
-
-
-void ErrorExit(LPTSTR lpszFunction)
-{
- // Retrieve the system error message for the last-error code
-
- LPVOID lpMsgBuf;
- LPVOID lpDisplayBuf;
- DWORD dw = GetLastError();
-
- FormatMessage(
- FORMAT_MESSAGE_ALLOCATE_BUFFER |
- FORMAT_MESSAGE_FROM_SYSTEM |
- FORMAT_MESSAGE_IGNORE_INSERTS,
- NULL,
- dw,
- MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
- (LPTSTR) &lpMsgBuf,
- 0, NULL );
-
- lpDisplayBuf = (LPVOID)LocalAlloc(LMEM_ZEROINIT,
- (lstrlen((LPCTSTR)lpMsgBuf)+lstrlen((LPCTSTR)lpszFunction)+40)*sizeof(TCHAR));
- sprintf((LPTSTR)lpDisplayBuf, TEXT("%s failed with error %d: %s"), lpszFunction, dw, lpMsgBuf);
-
- printf( "%s\n", lpDisplayBuf );
- MessageBox(NULL, (LPCTSTR)lpDisplayBuf, TEXT("Error"), MB_OK);
-
- LocalFree(lpMsgBuf);
- LocalFree(lpDisplayBuf);
- ExitProcess(dw);
-}
-
-
-
-struct graphics_gc_priv {
- HWND hwnd;
- int line_width;
- COLORREF fg_color;
- COLORREF bg_color;
- struct graphics_priv *gr;
-};
-
-
-//struct graphics_priv *g_gra;
-
-static HDC hMemDC;
-static HBITMAP hBitmap;
-static HBITMAP hOldBitmap;
-
-// Fills the region 'rgn' in graded colours
-static void MakeMemoryDC(HANDLE hWnd, HDC hdc )
-{
- if ( hMemDC )
- {
- if ( hOldBitmap )
- {
- SelectObject( hMemDC, hOldBitmap );
- DeleteObject( hBitmap );
- hBitmap = NULL;
- hOldBitmap = NULL;
- }
- }
-
- // Creates memory DC
- hMemDC = CreateCompatibleDC(hdc);
- if ( hMemDC )
- {
- RECT rectRgn;
- GetClientRect( hWnd, &rectRgn );
-
- int Width = rectRgn.right - rectRgn.left;
- int Height = rectRgn.bottom - rectRgn.top;
- printf( "resize memDC to: %d %d \n", Width, Height );
-
- hBitmap = CreateCompatibleBitmap(hdc, Width, Height );
-
- if ( hBitmap )
- {
- hOldBitmap = (HBITMAP) SelectObject( hMemDC, hBitmap);
- }
- }
-}
-
-static void HandleButtonClick( struct graphics_priv *gra_priv, int updown, int button, long lParam )
-{
- int xPos = LOWORD(lParam);
- int yPos = HIWORD(lParam);
-
- if (gra_priv->button_callback )
- {
- struct point pt = {xPos, yPos};
- (*gra_priv->button_callback)(gra_priv->button_callback_data, updown, button, &pt);
- }
-}
-
-static LRESULT CALLBACK WndProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam)
-{
-
-//if ( Message != 15 )
-//printf( "CHILD %d %d %d \n", Message, wParam, lParam );
-
- struct graphics_priv* gra_priv = (struct graphics_priv*)GetWindowLongPtr( hwnd , DWLP_USER );
-
- switch(Message)
- {
- case WM_CREATE:
- {
- HDC hdc;
- hdc = GetDC( hwnd );
- MakeMemoryDC(hwnd, hdc );
- ReleaseDC( hwnd, hdc );
- }
- break;
- case WM_COMMAND:
- switch(LOWORD(wParam))
- {
- case WM_USER + 1:
- break;
- }
- break;
- case WM_CLOSE:
- DestroyWindow(hwnd);
- break;
- case WM_USER+1:
- if ( gra_priv )
- {
- RECT rc ;
- HDC hdc;
-
- GetClientRect( hwnd, &rc );
- gra_priv->width = rc.right;
- gra_priv->height = rc.bottom;
-
- hdc = GetDC( hwnd );
- MakeMemoryDC(hwnd, hdc );
- ReleaseDC( hwnd, hdc );
- (*gra_priv->resize_callback)(gra_priv->resize_callback_data, gra_priv->width, gra_priv->height);
- }
- break;
-
- case WM_SIZE:
- /*
- if ( gra_priv )
- {
- //graphics = GetWindowLong( hwnd, DWL_USER, 0 );
-
-
- {
- HDC hdc;
- hdc = GetDC( hwnd );
- MakeMemoryDC(hwnd, hdc );
- ReleaseDC( hwnd, hdc );
- }
- (*gra_priv->resize_callback)(gra_priv->resize_callback_data, gra_priv->width, gra_priv->height);
-
-
- }
- */
- if ( gra_priv )
- {
- gra_priv->width = LOWORD( lParam );
- gra_priv->height = HIWORD( lParam );
- printf( "resize gfx to: %d %d \n", gra_priv->width, gra_priv->height );
- }
- break;
- case WM_DESTROY:
- PostQuitMessage(0);
- exit( 0 );
- break;
- case WM_PAINT:
- if ( gra_priv )
- {
- HDC hdc = GetDC(hwnd );
- if ( hMemDC )
- {
- BitBlt( hdc, 0, 0, gra_priv->width , gra_priv->height, hMemDC, 0, 0, SRCCOPY );
- }
- ReleaseDC( hwnd, hdc );
- }
- break;
- case WM_MOUSEMOVE:
- {
- int xPos = LOWORD(lParam);
- int yPos = HIWORD(lParam);
- struct point pt = {xPos, yPos};
-
- // printf( "WM_MOUSEMOVE: %d %d \n", xPos, yPos );
- (*gra_priv->motion_callback)(gra_priv->motion_callback_data, &pt);
- }
-
- break;
-
- case WM_LBUTTONDOWN:
- HandleButtonClick( gra_priv,1, 1,lParam );
- break;
- case WM_LBUTTONUP:
- HandleButtonClick( gra_priv, 0, 1,lParam );
- break;
- case WM_RBUTTONDOWN:
- HandleButtonClick( gra_priv, 1, 3,lParam );
- break;
- case WM_RBUTTONUP:
- HandleButtonClick( gra_priv, 0, 3,lParam );
- break;
-
- default:
- return DefWindowProc(hwnd, Message, wParam, lParam);
- }
- return 0;
-}
-
-
-static const char g_szClassName[] = "NAVGRA";
-
-HANDLE CreateGraphicsWindows( struct graphics_priv* gr )
-{
- WNDCLASSEX wc;
- HWND hwnd;
- RECT rcParent;
-
- wc.cbSize = sizeof(WNDCLASSEX);
- wc.style = 0;
- wc.lpfnWndProc = WndProc;
- wc.cbClsExtra = 0;
- wc.cbWndExtra = 64;
- wc.hInstance = NULL;
- wc.hIcon = NULL;
- wc.hCursor = LoadCursor(NULL, IDC_ARROW);
- wc.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
- wc.lpszMenuName = NULL;
- wc.lpszClassName = g_szClassName;
- wc.hIconSm = NULL;
-
-
- HANDLE hdl = gr->wnd_parent_handle;
- GetClientRect( gr->wnd_parent_handle,&rcParent);
-
- if(!RegisterClassEx(&wc))
- {
- ErrorExit( "Window Registration Failed!" );
- return NULL;
- }
-
- gr->width = rcParent.right - rcParent.left;
- gr->height = rcParent.bottom - rcParent.top;
-
- hwnd = CreateWindow( g_szClassName,
- "",
- WS_CHILD ,
- 0,
- 0,
- gr->width,
- gr->height,
- gr->wnd_parent_handle,
- (HMENU)ID_CHILD_GFX,
- NULL,
- NULL);
-
- if(hwnd == NULL)
- {
- ErrorExit( "Window Creation Failed!" );
- return NULL;
- }
-
- SetWindowLongPtr( hwnd , DWLP_USER, gr );
-
- ShowWindow( hwnd, TRUE );
- UpdateWindow( hwnd );
-
- gr->wnd_handle = hwnd;
-
- PostMessage( gr->wnd_parent_handle, WM_USER + 1, 0, 0 );
-
- return hwnd;
-}
-
-
-
-static void graphics_destroy(struct graphics_priv *gr)
-{
- g_free( gr );
-}
-
-
-static void gc_destroy(struct graphics_gc_priv *gc)
-{
- g_free( gc );
-}
-
-static void gc_set_linewidth(struct graphics_gc_priv *gc, int w)
-{
- gc->line_width = w;
-}
-
-static void gc_set_dashes(struct graphics_gc_priv *gc, unsigned char *dash_list, int n)
-{
-// gdk_gc_set_dashes(gc->gc, 0, (gint8 *)dash_list, n);
-// gdk_gc_set_line_attributes(gc->gc, 1, GDK_LINE_ON_OFF_DASH, GDK_CAP_ROUND, GDK_JOIN_ROUND);
-}
-
-
-
-static void gc_set_color(struct graphics_gc_priv *gc, struct color *c, int fg)
-{
-
- gc->fg_color = RGB( c->r, c->g, c->b );
-}
-
-static void gc_set_foreground(struct graphics_gc_priv *gc, struct color *c)
-{
- gc->fg_color = RGB( c->r, c->g, c->b );
-}
-
-static void gc_set_background(struct graphics_gc_priv *gc, struct color *c)
-{
- gc->bg_color = RGB( c->r, c->g, c->b );
- if ( hMemDC )
- SetBkColor( hMemDC, gc->bg_color );
-
-}
-
-static struct graphics_gc_methods gc_methods = {
- gc_destroy,
- gc_set_linewidth,
- gc_set_dashes,
- gc_set_foreground,
- gc_set_background
-};
-
-static struct graphics_gc_priv *gc_new(struct graphics_priv *gr, struct graphics_gc_methods *meth)
-{
- struct graphics_gc_priv *gc=g_new(struct graphics_gc_priv, 1);
- *meth=gc_methods;
- gc->hwnd = gr->wnd_handle;
- gc->line_width = 1;
- gc->fg_color = RGB( 0,0,0 );
- gc->bg_color = RGB( 255,255,255 );
- return gc;
-}
-
-
-static void draw_lines(struct graphics_priv *gr, struct graphics_gc_priv *gc, struct point *p, int count)
-{
- int i;
- HPEN holdpen;
- HPEN hpen;
-
- hpen = CreatePen( PS_SOLID, gc->line_width, gc->fg_color );
- holdpen = SelectObject( hMemDC, hpen );
-
- SetBkColor( hMemDC, gc->bg_color );
-
- int first = 1;
- for ( i = 0; i< count; i++ )
- {
- if ( first )
- {
- first = 0;
- MoveToEx( hMemDC, p[0].x, p[0].y, NULL );
- }
- else
- {
- LineTo( hMemDC, p[i].x, p[i].y );
- }
- }
-
- SelectObject( hMemDC, holdpen );
- DeleteObject( hpen );
-}
-
-static void draw_polygon(struct graphics_priv *gr, struct graphics_gc_priv *gc, struct point *p, int count)
-{
-
- //if (gr->mode == draw_mode_begin || gr->mode == draw_mode_end)
- {
- int i;
- POINT points[ count ];
- for ( i=0;i< count; i++ )
- {
- points[i].x = p[i].x;
- points[i].y = p[i].y;
- }
- HBRUSH holdbrush;
- HBRUSH hbrush;
-
- SetBkColor( hMemDC, gc->bg_color );
-
- hbrush = CreateSolidBrush( gc->fg_color );
- holdbrush = SelectObject( hMemDC, hbrush );
- Polygon( hMemDC, points,count );
- SelectObject( hMemDC, holdbrush );
- DeleteObject( hbrush );
- }
-}
-
-
-static void draw_rectangle(struct graphics_priv *gr, struct graphics_gc_priv *gc, struct point *p, int w, int h)
-{
-// gdk_draw_rectangle(gr->drawable, gc->gc, TRUE, p->x, p->y, w, h);
-}
-
-static void draw_circle(struct graphics_priv *gr, struct graphics_gc_priv *gc, struct point *p, int r)
-{
- HDC dc = hMemDC;
-
- HPEN holdpen;
- HPEN hpen;
-
- hpen = CreatePen( PS_SOLID, gc->line_width, gc->fg_color );
- holdpen = SelectObject( dc, hpen );
-
- SetBkColor( hMemDC, gc->bg_color );
-
- Ellipse( dc, p->x - r, p->y -r, p->x + r, p->y + r );
-
- SelectObject( dc, holdpen );
- DeleteObject( hpen );
-
-// if (gr->mode == draw_mode_begin || gr->mode == draw_mode_end)
-// gdk_draw_arc(gr->drawable, gc->gc, FALSE, p->x-r/2, p->y-r/2, r, r, 0, 64*360);
-// if (gr->mode == draw_mode_end || gr->mode == draw_mode_cursor)
-// gdk_draw_arc(gr->widget->window, gc->gc, FALSE, p->x-r/2, p->y-r/2, r, r, 0, 64*360);
-}
-
-
-
-static void draw_restore(struct graphics_priv *gr, struct point *p, int w, int h)
-{
- InvalidateRect( gr->wnd_handle, NULL, FALSE );
-}
-
-static void draw_mode(struct graphics_priv *gr, enum draw_mode_num mode)
-{
- // printf( "set draw_mode to %d\n", (int)mode );
-
- if ( mode == draw_mode_begin )
- {
- if ( gr->wnd_handle == NULL )
- {
- CreateGraphicsWindows( gr );
- }
- if ( gr->mode != draw_mode_begin )
- {
- if ( hMemDC )
- {
- RECT rcClient;
- HBRUSH bgBrush = CreateSolidBrush( gr->bg_color );
- GetClientRect( gr->wnd_handle, &rcClient );
- FillRect( hMemDC, &rcClient, bgBrush );
- DeleteObject( bgBrush );
- }
- }
- }
-
- // force paint
- if (mode == draw_mode_end && gr->mode == draw_mode_begin)
- {
- InvalidateRect( gr->wnd_handle, NULL, FALSE );
- }
-
- gr->mode=mode;
-
-}
-
-
-static void * get_data(struct graphics_priv *this_, char *type)
-{
- if ( strcmp( "wnd_parent_handle_ptr", type ) == 0 )
- {
- return &( this_->wnd_parent_handle );
- }
- if ( strcmp( "START_CLIENT", type ) == 0 )
- {
- CreateGraphicsWindows( this_ );
- return NULL;
- }
- return NULL;
-}
-
-
-static void register_resize_callback(struct graphics_priv *this_, void (*callback)(void *data, int w, int h), void *data)
-{
- this_->resize_callback=callback;
- this_->resize_callback_data=data;
-}
-
-static void register_motion_callback(struct graphics_priv *this_, void (*callback)(void *data, struct point *p), void *data)
-{
- this_->motion_callback=callback;
- this_->motion_callback_data=data;
-}
-
-static void register_button_callback(struct graphics_priv *this_, void (*callback)(void *data, int press, int button, struct point *p), void *data)
-{
- this_->button_callback=callback;
- this_->button_callback_data=data;
-}
-
-static void background_gc(struct graphics_priv *gr, struct graphics_gc_priv *gc)
-{
- RECT rcClient;
- HBRUSH bgBrush = CreateSolidBrush( gc->bg_color );
- GetClientRect( gr->wnd_handle, &rcClient );
- FillRect( hMemDC, &rcClient, bgBrush );
- DeleteObject( bgBrush );
- gr->bg_color = gc->bg_color;
-}
-
-struct graphics_font_priv {
- LOGFONT lf;
- HFONT hfont;
- int size;
-};
-
-static void draw_text(struct graphics_priv *gr, struct graphics_gc_priv *fg, struct graphics_gc_priv *bg, struct graphics_font_priv *font, char *text, struct point *p, int dx, int dy)
-{
- RECT rcClient;
- GetClientRect( gr->wnd_handle, &rcClient );
-
- int prevBkMode = SetBkMode( hMemDC, TRANSPARENT );
-
- if ( NULL == font->hfont )
- {
- font->hfont = EzCreateFont (hMemDC, TEXT ("Arial"), font->size/2, 0, 0, TRUE) ;
- GetObject ( font->hfont, sizeof (LOGFONT), &font->lf) ;
- }
-
-
- double angle = -atan2( dy, dx ) * 180 / 3.14159 ;
-
- SetTextAlign (hMemDC, TA_BASELINE) ;
- SetViewportOrgEx (hMemDC, p->x, p->y, NULL) ;
- font->lf.lfEscapement = font->lf.lfOrientation = ( angle * 10 ) ;
- DeleteObject (font->hfont) ;
-
- font->hfont = CreateFontIndirect (&font->lf);
- HFONT hOldFont = SelectObject(hMemDC, font->hfont );
-
- gunichar2* utf16 = NULL;
- glong utf16_len = 0;
-
- utf16 = g_utf8_to_utf16( text, -1, NULL, &utf16_len, NULL );
- TextOutW(hMemDC, 0,0, utf16, (size_t)utf16_len );
- g_free( utf16 );
-
-
- SelectObject(hMemDC, hOldFont);
- DeleteObject (font->hfont) ;
-
- SetBkMode( hMemDC, prevBkMode );
-
- SetViewportOrgEx (hMemDC, 0, 0, NULL) ;
-
-}
-
-
-
-static void font_destroy(struct graphics_font_priv *font)
-{
- if ( font->hfont )
- {
- DeleteObject(font->hfont);
- }
- g_free(font);
-}
-
-static struct graphics_font_methods font_methods = {
- font_destroy
-};
-
-static struct graphics_font_priv *font_new(struct graphics_priv *gr, struct graphics_font_methods *meth, int size)
-{
- struct graphics_font_priv *font=g_new(struct graphics_font_priv, 1);
- *meth = font_methods;
-
- font->hfont = NULL;
- font->size = size;
- // FontFamily fontFamily( "Liberation Mono");
-//font( &fontFamily, size, FontStyleRegular, UnitPoint );
- return font;
-}
-
-
-void image_cache_hash_add( const char* key, struct graphics_image_priv* val_ptr)
-{
- if ( image_cache_hash == NULL ) {
- image_cache_hash = g_hash_table_new(g_str_hash, g_str_equal);
- }
-
- if ( g_hash_table_lookup(image_cache_hash, key ) == NULL )
- {
- g_hash_table_insert(image_cache_hash, g_strdup( key ), (gpointer)val_ptr );
- }
-
-}
-
-struct graphics_image_priv* image_cache_hash_lookup( const char* key )
-{
- struct graphics_image_priv* val_ptr = NULL;
-
- if ( image_cache_hash != NULL )
- {
- val_ptr = g_hash_table_lookup(image_cache_hash, key );
- }
- return val_ptr;
-}
-
-
-
-static struct graphics_image_priv *image_new(struct graphics_priv *gr, struct graphics_image_methods *meth, char *name, int *w, int *h, struct point *hot)
-{
- struct graphics_image_priv* ret;
-
- if ( NULL == ( ret = image_cache_hash_lookup( name ) ) )
- {
- ret = g_new( struct graphics_image_priv, 1 );
- printf( "loading image '%s'\n", name );
- ret->pxpm = Xpm2bmp_new();
- Xpm2bmp_load( ret->pxpm, name );
- image_cache_hash_add( name, ret );
- }
-
- return ret;
-}
-
-static void draw_image(struct graphics_priv *gr, struct graphics_gc_priv *fg, struct point *p, struct graphics_image_priv *img)
-{
- Xpm2bmp_paint( img->pxpm , hMemDC, p->x, p->y );
-}
-
-static struct graphics_methods graphics_methods = {
- graphics_destroy,
- draw_mode,
- draw_lines,
- draw_polygon,
- draw_rectangle,
- draw_circle,
- draw_text,
- draw_image,
-#ifdef HAVE_IMLIB2
- NULL, // draw_image_warp,
-#else
- NULL,
-#endif
- draw_restore,
- font_new,
- gc_new,
- background_gc,
- NULL, // overlay_new,
- image_new,
- get_data,
- register_resize_callback,
- register_button_callback,
- register_motion_callback,
-};
-
-static struct graphics_priv * graphics_win32_drawing_area_new_helper(struct graphics_methods *meth)
-{
- struct graphics_priv *this_=g_new0(struct graphics_priv,1);
- *meth=graphics_methods;
- this_->mode = -1;
- return this_;
-}
-
-struct graphics_priv* win32_graphics_new( struct graphics_methods *meth, struct attr **attrs)
-{
- struct graphics_priv* this_=graphics_win32_drawing_area_new_helper(meth);
- return this_;
-}
+++ /dev/null
-#include <stdlib.h>
-#include <process.h>
-#include <windows.h>
-#include <glib.h>
-#include "config.h"
-#include "plugin.h"
-#include "gui.h"
-#include "win32_gui.h"
-#include "point.h"
-#include "menu.h"
-#include "item.h"
-#include "attr.h"
-#include "callback.h"
-#include <commctrl.h>
-#include "debug.h"
-
-
-//static GHashTable *popup_callback_hash = NULL;
-static GArray *popup_menu_array;
-
-const char g_szClassName[] = "navit_gui_class";
-
-
-static menu_id = 0;
-static POINT menu_pt;
-static gunichar2* g_utf16 = NULL;
-
-static gunichar2* Utf8ToUtf16( const char* str )
-{
- if ( g_utf16 )
- {
- g_free( g_utf16 );
- }
- g_utf16 = g_utf8_to_utf16( str, -1, NULL, NULL, NULL );
- return g_utf16;
-}
-
-static gunichar2* Utf8ToUtf16_nd( const char* str )
-{
- gunichar2* utf16= g_utf8_to_utf16( str, -1, NULL, NULL, NULL );
- return utf16;
-}
-
-gboolean message_pump( gpointer data )
-{
- MSG messages;
-
- Sleep( 1 );
-
- if (GetMessage (&messages, NULL, 0, 0))
- {
- TranslateMessage(&messages);
- DispatchMessage(&messages);
- }
- else{
- exit( 0 );
- }
- return TRUE;
-}
-
-
-
-//extern struct graphics_priv *g_gra;
-
-BOOL CALLBACK EnumChildProc(HWND hwndChild, LPARAM lParam)
-{
- LPRECT rcParent;
- int idChild;
-
- idChild = GetWindowLong(hwndChild, GWL_ID);
-
- if ( idChild == ID_CHILD_GFX )
- {
- rcParent = (LPRECT) lParam;
-
- MoveWindow( hwndChild, 0, 0, rcParent->right, rcParent->bottom, TRUE );
- PostMessage( hwndChild, WM_USER+1, 0, 0 );
- }
-
- return TRUE;
-}
-
-#ifndef GET_WHEEL_DELTA_WPARAM
- #define GET_WHEEL_DELTA_WPARAM(wParam) ((short)HIWORD(wParam))
-#endif
-
-static void CreateToolBar(HWND hwnd)
-{
- // Create Toolbar
- HWND hTool;
- TBBUTTON tbb[8];
- TBADDBITMAP tbab;
-
- hTool = CreateWindowEx(0, TOOLBARCLASSNAME, NULL, WS_CHILD | WS_VISIBLE, 0, 0, 0, 0,
- hwnd, (HMENU)ID_CHILD_TOOLBAR, GetModuleHandle(NULL), NULL);
-
- if(hTool == NULL)
- MessageBox(hwnd, "Could not create tool bar.", "Error", MB_OK | MB_ICONERROR);
-
- SendMessage(hTool, TB_BUTTONSTRUCTSIZE, (WPARAM)sizeof(TBBUTTON), 0);
-
- tbab.hInst = GetModuleHandle(NULL);
- tbab.nID = IDB_NAVITTOOLBAR;
- int iImageOffset = SendMessage(hTool, TB_ADDBITMAP, 10, (LPARAM) &tbab);
-
- int iStr;
-
- ZeroMemory(tbb, sizeof(tbb));
-
- tbb[0].iBitmap = iImageOffset;
- tbb[0].fsState = TBSTATE_ENABLED;
- tbb[0].fsStyle = TBSTYLE_BUTTON;
- tbb[0].idCommand = ID_DISPLAY_ZOOMIN;
- iStr = SendMessage(hTool, TB_ADDSTRINGW, 0, (LPARAM) Utf8ToUtf16( _("ZoomIn" ) ) );
- tbb[0].iString = iStr;
-
- tbb[1].iBitmap = iImageOffset+1;
- tbb[1].fsState = TBSTATE_ENABLED;
- tbb[1].fsStyle = TBSTYLE_BUTTON;
- tbb[1].idCommand = ID_DISPLAY_ZOOMOUT;
- iStr = SendMessage(hTool, TB_ADDSTRINGW, 0, (LPARAM) Utf8ToUtf16( _("ZoomOut" ) ) );
- tbb[1].iString = iStr;
-
- tbb[2].iBitmap = iImageOffset+4;
- tbb[2].fsState = TBSTATE_ENABLED;
- tbb[2].fsStyle = TBSTYLE_BUTTON;
- tbb[2].idCommand = ID_DISPLAY_REFRESH;
- iStr = SendMessage(hTool, TB_ADDSTRINGW, 0, (LPARAM) Utf8ToUtf16( _("Refresh" ) ) );
- tbb[2].iString = iStr;
-
- tbb[3].iBitmap = iImageOffset+2;
- tbb[3].fsState = TBSTATE_ENABLED;
- tbb[3].fsStyle = TBSTYLE_BUTTON;
- tbb[3].idCommand = ID_DISPLAY_ZOOMIN;
- iStr = SendMessage(hTool, TB_ADDSTRINGW, 0, (LPARAM) Utf8ToUtf16( _("Cursor" ) ) );
- tbb[3].iString = iStr;
-
- tbb[4].iBitmap = iImageOffset+5;
- tbb[4].fsState = TBSTATE_ENABLED;
- tbb[4].fsStyle = TBSTYLE_BUTTON;
- tbb[4].idCommand = ID_DISPLAY_ORIENT;
- iStr = SendMessage(hTool, TB_ADDSTRINGW, 0, (LPARAM) Utf8ToUtf16( _("Orientation" ) ) );
- tbb[4].iString = iStr;
-
- tbb[5].iBitmap = iImageOffset+8;
- tbb[5].fsState = TBSTATE_ENABLED;
- tbb[5].fsStyle = TBSTYLE_BUTTON;
- tbb[5].idCommand = ID_DISPLAY_ZOOMIN;
- iStr= SendMessage(hTool, TB_ADDSTRINGW, 0, (LPARAM) Utf8ToUtf16( _("Destination" ) ) );
- tbb[5].iString = iStr;
-
- tbb[6].iBitmap = iImageOffset+3;
- tbb[6].fsState = TBSTATE_ENABLED;
- tbb[6].fsStyle = TBSTYLE_BUTTON;
- tbb[6].idCommand = ID_DISPLAY_ZOOMIN;
- iStr= SendMessage(hTool, TB_ADDSTRINGW, 0, (LPARAM) Utf8ToUtf16( _("Roadbook" ) ) );
- tbb[6].iString = iStr;
-
- tbb[7].iBitmap = iImageOffset+9;
- tbb[7].fsState = TBSTATE_ENABLED;
- tbb[7].fsStyle = TBSTYLE_BUTTON;
- tbb[7].idCommand = ID_FILE_EXIT;
- iStr= SendMessage(hTool, TB_ADDSTRINGW, 0, (LPARAM) Utf8ToUtf16( _("_Quit" ) ) );
- tbb[7].iString = iStr;
-
- SendMessage(hTool, TB_ADDBUTTONS, sizeof(tbb)/sizeof(TBBUTTON), (LPARAM)&tbb);
-}
-
-static void window_layout( HWND hwnd )
-{
- RECT rcClient;
- RECT rcTool;
- int iToolHeight;
-
- HWND hChild = GetDlgItem(hwnd, ID_CHILD_TOOLBAR);
- SendMessage(hChild, TB_AUTOSIZE, 0, 0);
-
- GetWindowRect(hChild, &rcTool);
- iToolHeight = rcTool.bottom - rcTool.top;
-
- GetClientRect(hwnd, &rcClient);
- //printf( "BEFORE resize gui to: %d %d %d %d \n", rcClient.left, rcClient.right, rcClient.top, rcClient.bottom );
-
- rcClient.top += iToolHeight;
-
- printf( "resize gui to: %d %d %d %d \n", rcClient.left, rcClient.right, rcClient.top, rcClient.bottom );
-
-
- hChild = GetDlgItem(hwnd, ID_CHILD_GFX);
- if ( hChild )
- {
- MoveWindow( hChild, rcClient.left, rcClient.top, rcClient.right- rcClient.left, rcClient.bottom - rcClient.top, TRUE );
- PostMessage( hChild, WM_USER+1, 0, 0 );
- }
-}
-
-static LRESULT CALLBACK WndProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam)
-{
- RECT rcClient;
-
-// printf( "PARENT %d %d %d \n", Message, wParam, lParam );
-
- switch(Message)
- {
- case WM_CREATE:
- {
- HMENU hMenu, hSubMenu;
-
- CreateToolBar( hwnd );
-
- hMenu = CreateMenu();
- // g_this_->hwnd = hwnd;
-
- hSubMenu = CreatePopupMenu();
-
- AppendMenuW(hSubMenu, MF_STRING, ID_DISPLAY_ZOOMIN, Utf8ToUtf16( _( "ZoomIn" ) ) );
- AppendMenuW(hSubMenu, MF_STRING, ID_DISPLAY_ZOOMOUT, Utf8ToUtf16( _( "ZoomOut" ) ) );
- AppendMenuW(hSubMenu, MF_STRING, ID_DISPLAY_REFRESH, Utf8ToUtf16( _( "Refresh" ) ) );
- AppendMenuW(hSubMenu, MF_SEPARATOR, 0, NULL );
- AppendMenuW(hSubMenu, MF_STRING, ID_FILE_EXIT, Utf8ToUtf16( _( "_Quit" ) ) );
-
- AppendMenuW(hMenu, MF_STRING | MF_POPUP, (UINT)hSubMenu, Utf8ToUtf16( _( "Display" ) ) );
- hSubMenu = CreatePopupMenu();
- AppendMenu(hSubMenu, MF_STRING, ID_STUFF_GO, "&Go");
- AppendMenu(hMenu, MF_STRING | MF_POPUP, (UINT)hSubMenu, "&Stuff");
-
- SetMenu(hwnd, hMenu);
-
- window_layout( hwnd );
-
- }
- break;
- case WM_COMMAND:
- {
- printf( "WM_COMMAND %d\n", LOWORD(wParam) );
- struct gui_priv* gui = (struct gui_priv*)GetWindowLongPtr( hwnd , DWLP_USER );
-
-
- switch(LOWORD(wParam))
- {
- case ID_DISPLAY_ZOOMIN:
- navit_zoom_in(gui->nav, 2, NULL);
- return 0;
- break;
- case ID_DISPLAY_ZOOMOUT:
- navit_zoom_out(gui->nav, 2, NULL);
- return 0;
- break;
- case ID_DISPLAY_REFRESH:
- navit_draw(gui->nav);
- return 0;
- break;
- case ID_DISPLAY_CURSOR:
- {
- struct attr attr;
- attr.type=attr_cursor;
- // TODO attr.u.num=gtk_toggle_action_get_active(GTK_TOGGLE_ACTION(w));
- if(!navit_set_attr(gui->nav, &attr)) {
- dbg(0, "Failed to set attr_cursor\n");
- }
- return 0;
- }
- break;
- case ID_DISPLAY_ORIENT:
- {
- struct attr attr;
-
- attr.type=attr_orientation;
- // attr.u.num=gtk_toggle_action_get_active(GTK_TOGGLE_ACTION(w));
- attr.u.num = 0; // TODO
- if(!navit_set_attr(gui->nav, &attr)) {
- dbg(0, "Failed to set attr_orientation\n");
- }
- return 0;
- }
-
- case ID_FILE_EXIT:
- PostMessage(hwnd, WM_CLOSE, 0, 0);
- return 0;
- break;
- }
- if ( popup_menu_array )
- {
- struct menu_priv* priv = (struct menu_priv*)g_array_index( popup_menu_array, gint, LOWORD(wParam) - POPUP_MENU_OFFSET );
-
- if ( priv )
- {
- struct callback* cb = priv->cb;
- if ( priv->cb )
- {
- callback_call_0( priv->cb );
- return 0;
- }
- }
- }
- }
- break;
- case WM_USER+ 1:
- GetClientRect(hwnd, &rcClient);
- printf( "resize gui to: %d %d \n", rcClient.right, rcClient.bottom );
-
- window_layout( hwnd );
- //EnumChildWindows(hwnd, EnumChildProc, (LPARAM) &rcClient);
- return 0;
- break;
- case WM_CLOSE:
- DestroyWindow(hwnd);
- break;
- case WM_SIZE:
- window_layout( hwnd );
- return 0;
- break;
- case WM_DESTROY:
- PostQuitMessage(0);
- break;
-
-
- case WM_MOUSEWHEEL:
- {
- struct gui_priv* gui = (struct gui_priv*)GetWindowLongPtr( hwnd , DWLP_USER );
-
- short delta = GET_WHEEL_DELTA_WPARAM( wParam );
- if ( delta > 0 )
- {
- navit_zoom_in(gui->nav, 2, NULL);
- }
- else{
- navit_zoom_out(gui->nav, 2, NULL);
- }
- }
- break;
-
- default:
- return DefWindowProc(hwnd, Message, wParam, lParam);
- }
- return 0;
-}
-
-HANDLE CreateWin32Window( void )
-{
- WNDCLASSEX wc;
- HWND hwnd;
- MSG Msg;
-
- wc.cbSize = sizeof(WNDCLASSEX);
- wc.style = 0;
- wc.lpfnWndProc = WndProc;
- wc.cbClsExtra = 0;
- wc.cbWndExtra = 32;
- wc.hInstance = NULL;
- wc.hCursor = LoadCursor(NULL, IDC_ARROW);
- wc.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
- wc.lpszMenuName = NULL;
- wc.lpszClassName = g_szClassName;
- wc.hIconSm = LoadIcon(GetModuleHandle(NULL), MAKEINTRESOURCE(IDI_NAVIT));
- wc.hIcon = LoadIcon(GetModuleHandle(NULL), MAKEINTRESOURCE(IDI_NAVIT));
-
- if(!RegisterClassEx(&wc))
- {
- MessageBox(NULL, "Window Registration Failed!", "Error!", MB_ICONEXCLAMATION | MB_OK);
- return 0;
- }
-
- hwnd = CreateWindowEx(
- WS_EX_CLIENTEDGE,
- g_szClassName,
- _( "Navit" ),
- WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN,
- CW_USEDEFAULT, CW_USEDEFAULT, 800, 600,
- NULL, NULL, NULL, NULL);
-
- if(hwnd == NULL)
- {
- MessageBox(NULL, "Window Creation Failed!", "Error!", MB_ICONEXCLAMATION | MB_OK);
- return 0;
- }
-
- ShowWindow(hwnd, TRUE);
- UpdateWindow(hwnd);
-
- g_idle_add (message_pump, NULL);
-
- return hwnd;
-}
-
-
-static int win32_gui_set_graphics(struct gui_priv *this_, struct graphics *gra)
-{
- HANDLE* wndHandle_ptr = graphics_get_data(gra, "wnd_parent_handle_ptr");
- *wndHandle_ptr = this_->hwnd;
- graphics_get_data(gra, "START_CLIENT");
- return 0;
-}
-
-
-static void win32_gui_add_bookmark_do(struct gui_priv *gui)
-{
-// navit_add_bookmark(gui->nav, &gui->dialog_coord, gtk_entry_get_text(GTK_ENTRY(gui->dialog_entry)));
-// gtk_widget_destroy(gui->dialog_win);
-}
-
-static int win32_gui_add_bookmark(struct gui_priv *gui, struct pcoord *c, char *description)
-{
- return 1;
-}
-
-
-static struct menu_methods menu_methods;
-
-
-static struct menu_priv *add_menu( struct menu_priv *menu,
- struct menu_methods *meth,
- char *name,
- enum menu_type type,
- struct callback *cb)
-{
- struct menu_priv* ret = NULL;
-
- ret = g_new0(struct menu_priv, 1);
-
- *ret = *menu;
- *meth = menu_methods;
-
- if ( type == menu_type_submenu )
- {
- HMENU hSubMenu = NULL;
- hSubMenu = CreatePopupMenu();
- AppendMenu(menu->hMenu, MF_STRING | MF_POPUP, (UINT)hSubMenu, name );
- ret->hMenu = hSubMenu;
- }
- else
- {
- AppendMenu( menu->hMenu, MF_STRING, menu_id, name );
- }
-
- // g_hash_table_insert( popup_callback_hash, GINT_TO_POINTER( menu_id ), (gpointer)cb );
- g_array_append_val( popup_menu_array, ret );
-
- ret->cb = cb;
-
- menu_id++;
-
- return ret;
-
-}
-
-static void set_toggle(struct menu_priv *menu, int active)
-{
- // gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(menu->action), active);
-}
-
-static int get_toggle(struct menu_priv *menu)
-{
- // return gtk_toggle_action_get_active(GTK_TOGGLE_ACTION(menu->action));
- return 0;
-}
-
-static struct menu_methods menu_methods = {
- add_menu,
- set_toggle,
- get_toggle,
-};
-
-static void popup_activate(struct menu_priv *menu)
-{
- POINT pnt;
- GetCursorPos( &pnt );
-
- if (menu->hMenu)
- {
- TrackPopupMenu( menu->hMenu, 0, pnt.x, pnt.y, 0, menu->wnd_handle, NULL );
- DestroyMenu( menu->hMenu );
- }
-}
-
-
-static void popup_deactivate( struct menu_priv *menu )
-{
- DestroyMenu( menu->hMenu );
-}
-
-struct menu_priv* win32_gui_popup_new(struct gui_priv *this_, struct menu_methods *meth)
-{
- struct menu_priv* ret = NULL;
-
- ret = g_new0(struct menu_priv, 1);
- *meth = menu_methods;
-
- menu_id = POPUP_MENU_OFFSET;
-
- if ( popup_menu_array )
- {
- g_array_free (popup_menu_array, TRUE);
- popup_menu_array = NULL;
- }
-
- popup_menu_array = g_array_new (FALSE, FALSE, sizeof (gint));
-
- ret->cb = NULL;
- ret->hMenu = CreatePopupMenu();
- ret->wnd_handle = this_->hwnd;
- meth->popup=popup_activate;
-
-printf( "create popup menu %d \n", ret->hMenu );
-
- return ret;
-}
-
-struct gui_methods win32_gui_methods = {
- NULL, // win32_gui_menubar_new,
- NULL, // win32_gui_toolbar_new,
- NULL, // win32_gui_statusbar_new,
- win32_gui_popup_new,
- win32_gui_set_graphics,
- NULL,
- NULL, // win32_gui_datawindow_new,
- win32_gui_add_bookmark,
-};
-
-
-
-static struct gui_priv *win32_gui_new( struct navit *nav, struct gui_methods *meth, struct attr **attrs)
-{
- struct gui_priv *this_;
-
- *meth=win32_gui_methods;
-
- this_=g_new0(struct gui_priv, 1);
- this_->nav=nav;
-
- this_->hwnd = CreateWin32Window();
- SetWindowLongPtr( this_->hwnd , DWLP_USER, this_ );
-
- return this_;
-}
-
-void plugin_init(void)
-{
- plugin_register_gui_type("win32", win32_gui_new);
- plugin_register_graphics_type("win32_graphics", win32_graphics_new);
-}
+++ /dev/null
-#ifndef WIN32_GUI_INCLUDED
-#define WIN32_GUI_INCLUDED
-
-#include "resources\resource.h"
-#include "coord.h"
-#include "point.h"
-#include "graphics.h"
-
-#define ID_CHILD_GFX 100
-#define ID_CHILD_TOOLBAR (ID_CHILD_GFX + 1)
-#define ID_CHILD_1 (ID_CHILD_TOOLBAR + 1)
-#define ID_CHILD_2 (ID_CHILD_1 + 1)
-#define ID_CHILD_3 (ID_CHILD_2 + 1)
-#define ID_CHILD_4 (ID_CHILD_4 + 1)
-
-#define ID_DISPLAY_ZOOMIN 200
-#define ID_DISPLAY_ZOOMOUT 201
-#define ID_DISPLAY_REFRESH 202
-#define ID_DISPLAY_CURSOR 203
-#define ID_DISPLAY_ORIENT 204
-
-#define ID_FILE_EXIT 9001
-#define ID_STUFF_GO 9002
-
-#define _(text) gettext(text)
-
-#define POPUP_MENU_OFFSET 4000
-
-struct statusbar_methods;
-struct menu_methods;
-struct datawindow_methods;
-struct navit;
-struct callback;
-
-
-struct menu_priv {
- HWND wnd_handle;
- HMENU hMenu;
- struct callback* cb;
-};
-
-struct gui_priv {
- struct navit *nav;
- HANDLE hwnd;
-};
-
-
-struct graphics_priv {
- struct point p;
- int width;
- int height;
- int library_init;
- int visible;
- HANDLE wnd_parent_handle;
- HANDLE wnd_handle;
- COLORREF bg_color;
-
-
- void (*resize_callback)(void *data, int w, int h);
- void *resize_callback_data;
- void (*motion_callback)(void *data, struct point *p);
- void *motion_callback_data;
- void (*button_callback)(void *data, int press, int button, struct point *p);
- void *button_callback_data;
- enum draw_mode_num mode;
-};
-
-struct menu_priv *gui_gtk_menubar_new(struct gui_priv *gui, struct menu_methods *meth);
-struct menu_priv *gui_gtk_toolbar_new(struct gui_priv *gui, struct menu_methods *meth);
-struct statusbar_priv *gui_gtk_statusbar_new(struct gui_priv *gui, struct statusbar_methods *meth);
-struct menu_priv *gui_gtk_popup_new(struct gui_priv *gui, struct menu_methods *meth);
-struct datawindow_priv *gui_gtk_datawindow_new(struct gui_priv *gui, char *name, struct callback *click, struct callback *close, struct datawindow_methods *meth);
-
-struct graphics_priv* win32_graphics_new( struct graphics_methods *meth, struct attr **attrs);
-
-#endif
+++ /dev/null
-#define WIN32_LEAN_AND_MEAN
-
-#include <windows.h>
-
-#include "resource.h"
-
-HINSTANCE hInst;
-
-BOOL CALLBACK DialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
-{
- switch(uMsg)
- {
- case WM_INITDIALOG:
- /*
- * TODO: Add code to initialize the dialog.
- */
- return TRUE;
-
- case WM_CLOSE:
- EndDialog(hwndDlg, 0);
- return TRUE;
-
- case WM_COMMAND:
- switch(LOWORD(wParam))
- {
- /*
- * TODO: Add more control ID's, when needed.
- */
- case IDC_BTN_QUIT:
- EndDialog(hwndDlg, 0);
- return TRUE;
-
- case IDC_BTN_TEST:
- MessageBox(hwndDlg, "You clicked \"Test\" button!", "Information", MB_ICONINFORMATION);
- return TRUE;
- }
- }
-
- return FALSE;
-}
-
-
-#include <windows.h>
-
-/* Declare Windows procedure */
-LRESULT CALLBACK WindowProcedure (HWND, UINT, WPARAM, LPARAM);
-
-/* Make the class name into a global variable */
-char szClassName[ ] = "CodeBlocksWindowsApp";
-
-int WINAPI WinMain1 (HINSTANCE hThisInstance,
- HINSTANCE hPrevInstance,
- LPSTR lpszArgument,
- int nCmdShow)
-{
- HWND hwnd; /* This is the handle for our window */
- MSG messages; /* Here messages to the application are saved */
- WNDCLASSEX wincl; /* Data structure for the windowclass */
-
- /* The Window structure */
- wincl.hInstance = hThisInstance;
- wincl.lpszClassName = szClassName;
- wincl.lpfnWndProc = WindowProcedure; /* This function is called by windows */
- wincl.style = CS_DBLCLKS; /* Catch double-clicks */
- wincl.cbSize = sizeof (WNDCLASSEX);
-
- /* Use default icon and mouse-pointer */
- wincl.hIcon = LoadIcon (NULL, IDI_APPLICATION);
- wincl.hIconSm = LoadIcon (NULL, IDI_APPLICATION);
- wincl.hCursor = LoadCursor (NULL, IDC_ARROW);
- wincl.lpszMenuName = NULL; /* No menu */
- wincl.cbClsExtra = 0; /* No extra bytes after the window class */
- wincl.cbWndExtra = 0; /* structure or the window instance */
- /* Use Windows's default colour as the background of the window */
- wincl.hbrBackground = (HBRUSH) COLOR_BACKGROUND;
-
- /* Register the window class, and if it fails quit the program */
- if (!RegisterClassEx (&wincl))
- return 0;
-
- /* The class is registered, let's create the program*/
- hwnd = CreateWindowEx (
- 0, /* Extended possibilites for variation */
- szClassName, /* Classname */
- "Code::Blocks Template Windows App", /* Title Text */
- WS_OVERLAPPEDWINDOW, /* default window */
- CW_USEDEFAULT, /* Windows decides the position */
- CW_USEDEFAULT, /* where the window ends up on the screen */
- 544, /* The programs width */
- 375, /* and height in pixels */
- HWND_DESKTOP, /* The window is a child-window to desktop */
- NULL, /* No menu */
- hThisInstance, /* Program Instance handler */
- NULL /* No Window Creation data */
- );
-
- /* Make the window visible on the screen */
- ShowWindow (hwnd, nCmdShow);
-
- /* Run the message loop. It will run until GetMessage() returns 0 */
-
-#if 0
- while (GetMessage (&messages, NULL, 0, 0))
- {
- /* Translate virtual-key messages into character messages */
- TranslateMessage(&messages);
- /* Send message to WindowProcedure */
- DispatchMessage(&messages);
- }
-#endif
- /* The program return-value is 0 - The value that PostQuitMessage() gave */
- return messages.wParam;
-}
-
-
-/* This function is called by the Windows function DispatchMessage() */
-
-LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
-{
- switch (message) /* handle the messages */
- {
- case WM_MOUSEMOVE:
- {
- int xPos = LOWORD(lParam);
- int yPos = HIWORD(lParam);
- printf( "mouse at %d %d \n", xPos, yPos );
- }
-
- break;
- case WM_DESTROY:
- PostQuitMessage (0); /* send a WM_QUIT to the message queue */
- break;
- default: /* for messages that we don't deal with */
- return DefWindowProc (hwnd, message, wParam, lParam);
- }
-
- return 0;
-}
-
-/*
-
-int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd)
-{
- hInst = hInstance;
-
- // The user interface is a modal dialog box
- return DialogBox(hInstance, MAKEINTRESOURCE(DLG_MAIN), NULL, DialogProc);
-}
-*/
+++ /dev/null
-#include <stdio.h>
-#include <stdlib.h>
-#include <windows.h>
-#include <wingdi.h>
-#include "Xpm2bmp.h"
-
-#define _DBG
-
-// function prototypes
-static int CreateBitmapFromXpm( const char* filename, PXPM2BMP pXpm2bmp );
-
-// typedefs
-static XPMCOLORENTRY theRGBRecords[] =
-{
- {"ALICEBLUE", 240, 248, 255},
- {"ANTIQUEWHITE", 250, 235, 215},
- {"AQUAMARINE", 50, 191, 193},
- {"AZURE", 240, 255, 255},
- {"BEIGE", 245, 245, 220},
- {"BISQUE", 255, 228, 196},
- {"BLACK", 0, 0, 0},
- {"BLANCHEDALMOND", 255, 235, 205},
- {"BLUE", 0, 0, 255},
- {"BLUEVIOLET", 138, 43, 226},
- {"BROWN", 165, 42, 42},
- {"BURLYWOOD", 222, 184, 135},
- {"CADETBLUE", 95, 146, 158},
- {"CHARTREUSE", 127, 255, 0},
- {"CHOCOLATE", 210, 105, 30},
- {"CORAL", 255, 114, 86},
- {"CORNFLOWERBLUE", 34, 34, 152},
- {"CORNSILK", 255, 248, 220},
- {"CYAN", 0, 255, 255},
- {"DARKGOLDENROD", 184, 134, 11},
- {"DARKGREEN", 0, 86, 45},
- {"DARKKHAKI", 189, 183, 107},
- {"DARKOLIVEGREEN", 85, 86, 47},
- {"DARKORANGE", 255, 140, 0},
- {"DARKORCHID", 139, 32, 139},
- {"DARKSALMON", 233, 150, 122},
- {"DARKSEAGREEN", 143, 188, 143},
- {"DARKSLATEBLUE", 56, 75, 102},
- {"DARKSLATEGRAY", 47, 79, 79},
- {"DARKTURQUOISE", 0, 166, 166},
- {"DARKVIOLET", 148, 0, 211},
- {"DEEPPINK", 255, 20, 147},
- {"DEEPSKYBLUE", 0, 191, 255},
- {"DIMGRAY", 84, 84, 84},
- {"DODGERBLUE", 30, 144, 255},
- {"FIREBRICK", 142, 35, 35},
- {"FLORALWHITE", 255, 250, 240},
- {"FORESTGREEN", 80, 159, 105},
- {"GAINSBORO", 220, 220, 220},
- {"GHOSTWHITE", 248, 248, 255},
- {"GOLD", 218, 170, 0},
- {"GOLDENROD", 239, 223, 132},
- {"GRAY", 126, 126, 126},
- {"GRAY0", 0, 0, 0},
- {"GRAY1", 3, 3, 3},
- {"GRAY10", 26, 26, 26},
- {"GRAY100", 255, 255, 255},
- {"GRAY11", 28, 28, 28},
- {"GRAY12", 31, 31, 31},
- {"GRAY13", 33, 33, 33},
- {"GRAY14", 36, 36, 36},
- {"GRAY15", 38, 38, 38},
- {"GRAY16", 41, 41, 41},
- {"GRAY17", 43, 43, 43},
- {"GRAY18", 46, 46, 46},
- {"GRAY19", 48, 48, 48},
- {"GRAY2", 5, 5, 5},
- {"GRAY20", 51, 51, 51},
- {"GRAY21", 54, 54, 54},
- {"GRAY22", 56, 56, 56},
- {"GRAY23", 59, 59, 59},
- {"GRAY24", 61, 61, 61},
- {"GRAY25", 64, 64, 64},
- {"GRAY26", 66, 66, 66},
- {"GRAY27", 69, 69, 69},
- {"GRAY28", 71, 71, 71},
- {"GRAY29", 74, 74, 74},
- {"GRAY3", 8, 8, 8},
- {"GRAY30", 77, 77, 77},
- {"GRAY31", 79, 79, 79},
- {"GRAY32", 82, 82, 82},
- {"GRAY33", 84, 84, 84},
- {"GRAY34", 87, 87, 87},
- {"GRAY35", 89, 89, 89},
- {"GRAY36", 92, 92, 92},
- {"GRAY37", 94, 94, 94},
- {"GRAY38", 97, 97, 97},
- {"GRAY39", 99, 99, 99},
- {"GRAY4", 10, 10, 10},
- {"GRAY40", 102, 102, 102},
- {"GRAY41", 105, 105, 105},
- {"GRAY42", 107, 107, 107},
- {"GRAY43", 110, 110, 110},
- {"GRAY44", 112, 112, 112},
- {"GRAY45", 115, 115, 115},
- {"GRAY46", 117, 117, 117},
- {"GRAY47", 120, 120, 120},
- {"GRAY48", 122, 122, 122},
- {"GRAY49", 125, 125, 125},
- {"GRAY5", 13, 13, 13},
- {"GRAY50", 127, 127, 127},
- {"GRAY51", 130, 130, 130},
- {"GRAY52", 133, 133, 133},
- {"GRAY53", 135, 135, 135},
- {"GRAY54", 138, 138, 138},
- {"GRAY55", 140, 140, 140},
- {"GRAY56", 143, 143, 143},
- {"GRAY57", 145, 145, 145},
- {"GRAY58", 148, 148, 148},
- {"GRAY59", 150, 150, 150},
- {"GRAY6", 15, 15, 15},
- {"GRAY60", 153, 153, 153},
- {"GRAY61", 156, 156, 156},
- {"GRAY62", 158, 158, 158},
- {"GRAY63", 161, 161, 161},
- {"GRAY64", 163, 163, 163},
- {"GRAY65", 166, 166, 166},
- {"GRAY66", 168, 168, 168},
- {"GRAY67", 171, 171, 171},
- {"GRAY68", 173, 173, 173},
- {"GRAY69", 176, 176, 176},
- {"GRAY7", 18, 18, 18},
- {"GRAY70", 179, 179, 179},
- {"GRAY71", 181, 181, 181},
- {"GRAY72", 184, 184, 184},
- {"GRAY73", 186, 186, 186},
- {"GRAY74", 189, 189, 189},
- {"GRAY75", 191, 191, 191},
- {"GRAY76", 194, 194, 194},
- {"GRAY77", 196, 196, 196},
- {"GRAY78", 199, 199, 199},
- {"GRAY79", 201, 201, 201},
- {"GRAY8", 20, 20, 20},
- {"GRAY80", 204, 204, 204},
- {"GRAY81", 207, 207, 207},
- {"GRAY82", 209, 209, 209},
- {"GRAY83", 212, 212, 212},
- {"GRAY84", 214, 214, 214},
- {"GRAY85", 217, 217, 217},
- {"GRAY86", 219, 219, 219},
- {"GRAY87", 222, 222, 222},
- {"GRAY88", 224, 224, 224},
- {"GRAY89", 227, 227, 227},
- {"GRAY9", 23, 23, 23},
- {"GRAY90", 229, 229, 229},
- {"GRAY91", 232, 232, 232},
- {"GRAY92", 235, 235, 235},
- {"GRAY93", 237, 237, 237},
- {"GRAY94", 240, 240, 240},
- {"GRAY95", 242, 242, 242},
- {"GRAY96", 245, 245, 245},
- {"GRAY97", 247, 247, 247},
- {"GRAY98", 250, 250, 250},
- {"GRAY99", 252, 252, 252},
- {"GREEN", 0, 255, 0},
- {"GREENYELLOW", 173, 255, 47},
- {"HONEYDEW", 240, 255, 240},
- {"HOTPINK", 255, 105, 180},
- {"INDIANRED", 107, 57, 57},
- {"IVORY", 255, 255, 240},
- {"KHAKI", 179, 179, 126},
- {"LAVENDER", 230, 230, 250},
- {"LAVENDERBLUSH", 255, 240, 245},
- {"LAWNGREEN", 124, 252, 0},
- {"LEMONCHIFFON", 255, 250, 205},
- {"LIGHTBLUE", 176, 226, 255},
- {"LIGHTCORAL", 240, 128, 128},
- {"LIGHTCYAN", 224, 255, 255},
- {"LIGHTGOLDENROD", 238, 221, 130},
- {"LIGHTGOLDENRODYELLOW", 250, 250, 210},
- {"LIGHTGRAY", 168, 168, 168},
- {"LIGHTPINK", 255, 182, 193},
- {"LIGHTSALMON", 255, 160, 122},
- {"LIGHTSEAGREEN", 32, 178, 170},
- {"LIGHTSKYBLUE", 135, 206, 250},
- {"LIGHTSLATEBLUE", 132, 112, 255},
- {"LIGHTSLATEGRAY", 119, 136, 153},
- {"LIGHTSTEELBLUE", 124, 152, 211},
- {"LIGHTYELLOW", 255, 255, 224},
- {"LIMEGREEN", 0, 175, 20},
- {"LINEN", 250, 240, 230},
- {"MAGENTA", 255, 0, 255},
- {"MAROON", 143, 0, 82},
- {"MEDIUMAQUAMARINE", 0, 147, 143},
- {"MEDIUMBLUE", 50, 50, 204},
- {"MEDIUMFORESTGREEN", 50, 129, 75},
- {"MEDIUMGOLDENROD", 209, 193, 102},
- {"MEDIUMORCHID", 189, 82, 189},
- {"MEDIUMPURPLE", 147, 112, 219},
- {"MEDIUMSEAGREEN", 52, 119, 102},
- {"MEDIUMSLATEBLUE", 106, 106, 141},
- {"MEDIUMSPRINGGREEN", 35, 142, 35},
- {"MEDIUMTURQUOISE", 0, 210, 210},
- {"MEDIUMVIOLETRED", 213, 32, 121},
- {"MIDNIGHTBLUE", 47, 47, 100},
- {"MINTCREAM", 245, 255, 250},
- {"MISTYROSE", 255, 228, 225},
- {"MOCCASIN", 255, 228, 181},
- {"NAVAJOWHITE", 255, 222, 173},
- {"NAVY", 35, 35, 117},
- {"NAVYBLUE", 35, 35, 117},
- {"OLDLACE", 253, 245, 230},
- {"OLIVEDRAB", 107, 142, 35},
- {"ORANGE", 255, 135, 0},
- {"ORANGERED", 255, 69, 0},
- {"ORCHID", 239, 132, 239},
- {"PALEGOLDENROD", 238, 232, 170},
- {"PALEGREEN", 115, 222, 120},
- {"PALETURQUOISE", 175, 238, 238},
- {"PALEVIOLETRED", 219, 112, 147},
- {"PAPAYAWHIP", 255, 239, 213},
- {"PEACHPUFF", 255, 218, 185},
- {"PERU", 205, 133, 63},
- {"PINK", 255, 181, 197},
- {"PLUM", 197, 72, 155},
- {"POWDERBLUE", 176, 224, 230},
- {"PURPLE", 160, 32, 240},
- {"RED", 255, 0, 0},
- {"ROSYBROWN", 188, 143, 143},
- {"ROYALBLUE", 65, 105, 225},
- {"SADDLEBROWN", 139, 69, 19},
- {"SALMON", 233, 150, 122},
- {"SANDYBROWN", 244, 164, 96},
- {"SEAGREEN", 82, 149, 132},
- {"SEASHELL", 255, 245, 238},
- {"SIENNA", 150, 82, 45},
- {"SKYBLUE", 114, 159, 255},
- {"SLATEBLUE", 126, 136, 171},
- {"SLATEGRAY", 112, 128, 144},
- {"SNOW", 255, 250, 250},
- {"SPRINGGREEN", 65, 172, 65},
- {"STEELBLUE", 84, 112, 170},
- {"TAN", 222, 184, 135},
- {"THISTLE", 216, 191, 216},
- {"TOMATO", 255, 99, 71},
- {"TRANSPARENT", 0, 0, 1},
- {"TURQUOISE", 25, 204, 223},
- {"VIOLET", 156, 62, 206},
- {"VIOLETRED", 243, 62, 150},
- {"WHEAT", 245, 222, 179},
- {"WHITE", 255, 255, 255},
- {"WHITESMOKE", 245, 245, 245},
- {"YELLOW", 255, 255, 0},
- {"YELLOWGREEN", 50, 216, 56}
-};
-
-
-PXPM2BMP Xpm2bmp_new()
-{
- PXPM2BMP preturn = (PXPM2BMP)calloc( sizeof( XPM2BMP ) , 1 );
- return preturn;
-}
-
-
-int Xpm2bmp_load( PXPM2BMP pXpm2bmp, const char* filename )
-{
- return CreateBitmapFromXpm( filename, pXpm2bmp );
-}
-
-int Xpm2bmp_paint( PXPM2BMP pXpm2bmp, HDC hdc, int x1,int y1 )
-{
- StretchDIBits(hdc,
- x1, y1, pXpm2bmp->size_x, pXpm2bmp->size_y,
- 0, 0, pXpm2bmp->size_x, pXpm2bmp->size_y,
- pXpm2bmp->wimage_data_trans,
- (BITMAPINFO *)pXpm2bmp->bmih_trans,
- DIB_RGB_COLORS,
- SRCAND );
-
- StretchDIBits(hdc,
- x1, y1, pXpm2bmp->size_x, pXpm2bmp->size_y,
- 0, 0, pXpm2bmp->size_x, pXpm2bmp->size_y,
- pXpm2bmp->wimage_data,
- (BITMAPINFO *)pXpm2bmp->bmih,
- DIB_RGB_COLORS,
- SRCPAINT );
-
- return 0;
-}
-
-static int parse_line_values( const char* line, PXPM2BMP pXpm2bmp )
-{
- int return_value = 0;
- char* parse_line = (char*)line;
- char* tok;
- int value_pos = 0;
-
- parse_line = strchr( parse_line, '"' );
- parse_line++;
-
- tok = strtok( parse_line, " \t\n" );
-
- while ( tok != 0 )
- {
- int val = atoi( tok );
- switch ( value_pos )
- {
- case 0: pXpm2bmp->size_x = val; break;
- case 1: pXpm2bmp->size_y = val; break;
- case 2: pXpm2bmp->colors = val; break;
- case 3: pXpm2bmp->chars_per_pixel = val; break;
- case 4: pXpm2bmp->hotspot_x = val; break;
- case 5: pXpm2bmp->hotspot_y = val; break;
- }
- tok = strtok( NULL, " \t" );
- value_pos ++;
-
- }
-
- return return_value;
-}
-
-static int hex2int( char c )
-{
- if ((c >= '0') && (c <='9' )) return c - '0';
- if ((c >= 'A') && (c <= 'F')) return c - 'A' + 10;
- if ((c >= 'a') && (c <= 'f')) return c - 'a' + 10;
- return -1;
-}
-
-static DWORD string2hex16( const char* str )
-{
- int i1 = hex2int( str[0] );
- int i2 = hex2int( str[1] );
- if ( ( i1 >= 0 ) && ( i2 >= 0 ) )
- return i1*16+i2;
- return -1;
-}
-
-static int parse_color_values( const char* line, PXPM2BMP pXpm2bmp )
-{
- int return_value = 0;
- char* cq = strchr( line, '"' );
- char* cchar = strchr( cq+pXpm2bmp->chars_per_pixel+1, 'c' );
- char* chash = strchr( cq+pXpm2bmp->chars_per_pixel+1, '#' );
- char* qe = strchr( cq+pXpm2bmp->chars_per_pixel+1, '"' );
-
- cq++;
-
- if ( cq )
- {
- memcpy( pXpm2bmp->color_entires[ pXpm2bmp-> color_entires_size].color_str, cq, pXpm2bmp->chars_per_pixel + 1 );
- pXpm2bmp->color_entires[ pXpm2bmp-> color_entires_size].color_str[ pXpm2bmp->chars_per_pixel ] = '\0';
-
-
- if ( cchar && chash && qe)
- {
- chash++;
- *qe = 0;
- int len = strlen( chash );
-
- pXpm2bmp->color_entires[ pXpm2bmp->color_entires_size].r = string2hex16( &chash[0] );
- pXpm2bmp->color_entires[ pXpm2bmp->color_entires_size].g = string2hex16( &chash[len / 3] );
- pXpm2bmp->color_entires[ pXpm2bmp->color_entires_size].b = string2hex16( &chash[len * 2 / 3] );
-#ifdef _DBG
-printf( "adding color %s => %d RGB %x %x %x to index %d\n",
- line,
- pXpm2bmp->color_entires_size,
- pXpm2bmp->color_entires[ pXpm2bmp->color_entires_size].r,
- pXpm2bmp->color_entires[ pXpm2bmp->color_entires_size].g,
- pXpm2bmp->color_entires[ pXpm2bmp->color_entires_size].b,
- pXpm2bmp->color_entires_size );
-#endif
- }
- else
- {
- int q;
- char *start = cchar + 1;
- char *end = start;
-
- while ( *start != 0 )
- {
- if ( ( *start != '\t' ) && ( *start != ' ' ) )
- {
- break;
- }
- start++;
- }
-
- end = start;
- while ( *end != 0 )
- {
- if ( ( *end == '\t' ) || ( *end == ' ' ) || ( *end == '"' ))
- {
- *end = 0;
- }
- end++;
- }
-
- start = _strupr( start );
-
- for ( q=0; q < sizeof( theRGBRecords ) / sizeof( theRGBRecords[0] ); q++ )
- {
-
- if ( 0 == strcmp( start, theRGBRecords[q].color_str ) )
- {
- pXpm2bmp->color_entires[ pXpm2bmp->color_entires_size].r = theRGBRecords[q].r;
- pXpm2bmp->color_entires[ pXpm2bmp->color_entires_size].g = theRGBRecords[q].g;
- pXpm2bmp->color_entires[ pXpm2bmp->color_entires_size].b = theRGBRecords[q].b;
- }
- }
- if ( 0 == strcmp( start, "NONE" ) )
- {
- pXpm2bmp->color_entires[ pXpm2bmp->color_entires_size].r = 255;
- pXpm2bmp->color_entires[ pXpm2bmp->color_entires_size].g = 0;
- pXpm2bmp->color_entires[ pXpm2bmp->color_entires_size].b = 255;
- }
- }
- }
- pXpm2bmp->color_entires_size++;
-
- return return_value;
-}
-
-static int vv = 0;
-
-static int parse_pixel_line_values( const char* line, PXPM2BMP pXpm2bmp, unsigned char* pixel_data, unsigned char* pixel_data_trans )
-{
- int return_value = 0;
- int i,j;
-
-
- char* cq = strchr( line, '"' );
- int pix_idx = 0;
- int size_x = pXpm2bmp->size_x;
- int len = strlen( cq );
-
- cq++;
-
- if ( len > pXpm2bmp->chars_per_pixel * size_x )
- {
- for ( i=0; i< size_x; i++ )
- {
- int found = 0;
- char* cmp = &cq[ i * pXpm2bmp->chars_per_pixel];
-
- for ( j=0; j< pXpm2bmp-> color_entires_size; j++ )
- {
- if ( strncmp( cmp, pXpm2bmp->color_entires[ j ].color_str, pXpm2bmp->chars_per_pixel ) == 0 )
- {
- int r = pXpm2bmp->color_entires[ j ].r;
- int g = pXpm2bmp->color_entires[ j ].g;
- int b = pXpm2bmp->color_entires[ j ].b;
-
- if ( ( r == 255 ) && ( g == 0 ) && ( r == 255 ) )
- {
- r=g=b=0;
- pixel_data_trans[ pix_idx ] = 255;
- pixel_data_trans[ pix_idx+1 ] = 255;
- pixel_data_trans[ pix_idx+2 ] = 255;
- }
- else
- {
- pixel_data_trans[ pix_idx ] = 0;
- pixel_data_trans[ pix_idx+1 ] = 0;
- pixel_data_trans[ pix_idx+2 ] = 0;
- }
-
- // pixel_data[ pix_idx++ ] = pXpm2bmp->color_entires[ j ].r;
- // pixel_data[ pix_idx++ ] = pXpm2bmp->color_entires[ j ].g;
- // pixel_data[ pix_idx++ ] = pXpm2bmp->color_entires[ j ].b;
- pixel_data[ pix_idx++ ] = b;
- pixel_data[ pix_idx++ ] = g;
- pixel_data[ pix_idx++ ] = r;
- found = 1;
- vv++;
- break;
- }
- }
- if ( !found )
- {
- fprintf( stderr, "XPMLIB: error color not found\n" );
- }
-
- }
- }
- else
- {
- return_value = -1;
- fprintf( stderr, "XPMLIB: invalid line length\n" );
- }
- return return_value;
-}
-
-
-static int CreateBitmapFromXpm( const char* filename, PXPM2BMP pXpm2bmp )
-{
- int return_val = 0;
- unsigned char i, row;
- char line[ 1024 ];
- int nbytes ;
- FILE* file_xpm = fopen( filename, "r" );
-
- int phase = 0;
- row = 0;
-
- if ( file_xpm )
- {
- while ( fgets(line, sizeof( line ), file_xpm ) )
- {
-#ifdef _DBG
- printf( "PARSING: %s\n", line );
-#endif
- if ( line[ 0 ] != '"' )
- continue;
-
- switch ( phase )
- {
- case 0:
- parse_line_values( line, pXpm2bmp );
-#ifdef _DBG
- printf( "size_x %d\n", pXpm2bmp->size_x );
- printf( "size_y %d\n", pXpm2bmp->size_y );
-#endif
- phase = 1;
-
- pXpm2bmp->color_entires_size = 0;
- nbytes = ( pXpm2bmp->chars_per_pixel + 1 ) * pXpm2bmp->colors;
-
- pXpm2bmp->color_entires = calloc( sizeof( XPMCOLORENTRY ), pXpm2bmp->colors + 100 );
- pXpm2bmp->color_entires[0].color_str = calloc( nbytes, pXpm2bmp->colors );
- for ( i = 1; i< pXpm2bmp->colors; i++ )
- {
- pXpm2bmp->color_entires[i].color_str = pXpm2bmp->color_entires[0].color_str + ( pXpm2bmp->chars_per_pixel + 1 ) * i;
- }
-
- if (!(pXpm2bmp->dib = (unsigned char *)malloc(sizeof(BITMAPINFOHEADER) + pXpm2bmp->size_x * pXpm2bmp->size_y * 3)))
- {
- return 4;
- }
- if (!(pXpm2bmp->dib_trans = (unsigned char *)calloc(sizeof(BITMAPINFOHEADER) + pXpm2bmp->size_x * pXpm2bmp->size_y * 3,1)))
- {
- return 4;
- }
-
- memset(pXpm2bmp->dib, 0, sizeof(BITMAPINFOHEADER));
- pXpm2bmp->bmih = (BITMAPINFOHEADER *)pXpm2bmp->dib;
- pXpm2bmp->bmih->biSize = sizeof(BITMAPINFOHEADER);
- pXpm2bmp->bmih->biWidth = pXpm2bmp->size_x;
- pXpm2bmp->bmih->biHeight = -((long)pXpm2bmp->size_y);
- pXpm2bmp->bmih->biPlanes = 1;
- pXpm2bmp->bmih->biBitCount = 24;
- pXpm2bmp->bmih->biCompression = 0;
- pXpm2bmp->wimage_data = pXpm2bmp->dib + sizeof(BITMAPINFOHEADER);
-
-
- pXpm2bmp->bmih_trans = (BITMAPINFOHEADER *)pXpm2bmp->dib_trans;
- pXpm2bmp->bmih_trans->biSize = sizeof(BITMAPINFOHEADER);
- pXpm2bmp->bmih_trans->biWidth = pXpm2bmp->size_x;
- pXpm2bmp->bmih_trans->biHeight = -((long)pXpm2bmp->size_y);
- pXpm2bmp->bmih_trans->biPlanes = 1;
- pXpm2bmp->bmih_trans->biBitCount = 24;
- pXpm2bmp->bmih_trans->biCompression = 0;
- pXpm2bmp->wimage_data_trans = pXpm2bmp->dib_trans + sizeof(BITMAPINFOHEADER);
-// memset( pXpm2bmp->wimage_data_trans, 255, 5* 22 * 3 );
-
- break;
- case 1:
- parse_color_values( line, pXpm2bmp );
- if ( pXpm2bmp->color_entires_size >= pXpm2bmp->colors )
- {
- phase = 2;
- }
-
- break;
- case 2:
- parse_pixel_line_values( line, pXpm2bmp,
- pXpm2bmp->wimage_data + row * pXpm2bmp->size_x * 3,
- pXpm2bmp->wimage_data_trans + row * pXpm2bmp->size_x * 3 );
-
- row++;
- if ( row >= pXpm2bmp->size_y )
- {
- phase = 3;
- }
- break;
- }
-
- }
-
- fclose( file_xpm );
- }
- return return_val;
-}
+++ /dev/null
-#ifndef Xpm2BMP_H_INCLUDED
-#define Xpm2BMP_H_INCLUDED
-
-#include <windows.h>
-#include "wingdi.h"
-
-typedef struct XPMCOLORENTRY_TAG
-{
- char* color_str;
- unsigned long r;
- unsigned long g;
- unsigned long b;
-} XPMCOLORENTRY, *PXPMCOLORENTRY;
-
-typedef struct XPM2BMP_TAG
-{
- unsigned short size_x;
- unsigned short size_y;
- unsigned short colors;
- unsigned short pixels;
- unsigned short chars_per_pixel;
- unsigned short hotspot_x;
- unsigned short hotspot_y;
-
- int color_entires_size;
- PXPMCOLORENTRY color_entires;
-
- unsigned char *dib;
- unsigned char *wimage_data;
- BITMAPINFOHEADER *bmih;
-
- unsigned char *dib_trans;
- unsigned char *wimage_data_trans;
- BITMAPINFOHEADER *bmih_trans;
-
-} XPM2BMP, *PXPM2BMP;
-
-
-PXPM2BMP Xpm2bmp_new();
-int Xpm2bmp_load( PXPM2BMP pXpm2bmp, const char* filename );
-int Xpm2bmp_paint( PXPM2BMP pXpm2bmp, HDC hdc, int x1,int y1 );
-
-
-#endif // Xpm2BMP_H_INCLUDED