[GRASS-SVN] r33038 - in grass/trunk: . db db/drivers db/drivers/dbf
db/drivers/mysql db/drivers/odbc db/drivers/ogr
db/drivers/postgres db/drivers/sqlite doc general
general/manage general/manage/lib gui gui/tcltk
gui/tcltk/gis.m gui/wxpython gui/wxpython/docs
gui/wxpython/scripts imagery imagery/i.ortho.photo
imagery/i.smap include/Make lib lib/bitmap lib/btree
lib/btree/test lib/cdhc lib/datetime lib/db lib/db/sqlp
lib/db/sqlp/test lib/driver lib/external lib/external/bwidget
lib/fonts lib/fonts/fonts lib/form lib/gtcltk lib/init
lib/iostream lib/linkm lib/linkm/test lib/nviz lib/ogsf
lib/pngdriver lib/proj lib/python lib/raster lib/rst
lib/segment lib/vector lib/vector/dglib lib/vector/diglib
lib/vector/rtree lib/vector/rtree/docs locale macosx
macosx/app macosx/modbuild misc ps raster raster/r.le
raster/r.li raster/r.mapcalc raster/r.watershed raster/simwe
raster/wildfire raster3d rfc scripts sites testsuite tools
vector vector/lidar vector/v.digit vector/v.lrs visualization
visualization/nviz visualization/nviz/html
visualization/nviz/src visualization/nviz2 visualization/nviz2/cmd
svn_grass at osgeo.org
svn_grass at osgeo.org
Sat Aug 23 17:13:07 EDT 2008
Author: glynn
Date: 2008-08-23 17:13:06 -0400 (Sat, 23 Aug 2008)
New Revision: 33038
Added:
grass/trunk/db/drivers/mysql/dbe.c
grass/trunk/db/drivers/mysql/replace.c
grass/trunk/include/Make/Compile.make
grass/trunk/include/Make/DB.make
grass/trunk/include/Make/Other.make
grass/trunk/include/Make/Vars.make
grass/trunk/lib/btree/test/
grass/trunk/lib/btree/test/try.c
grass/trunk/lib/cdhc/c-drive.c.txt
grass/trunk/lib/db/sqlp/sqlp.l
grass/trunk/lib/db/sqlp/sqlp.y
grass/trunk/lib/linkm/test/
grass/trunk/lib/linkm/test/linkm.c
grass/trunk/lib/linkm/test/malloc.c
grass/trunk/lib/linkm/test/speed.c
grass/trunk/lib/linkm/test/speed2.c
grass/trunk/lib/linkm/test/speed3.c
grass/trunk/lib/linkm/test/try.c
grass/trunk/lib/linkm/test/try2.c
grass/trunk/lib/vector/rtree/docs/test.c
Removed:
grass/trunk/lib/btree/try.c
grass/trunk/lib/cdhc/c-drive.c
grass/trunk/lib/db/sqlp/lex.l
grass/trunk/lib/db/sqlp/yac.y
grass/trunk/lib/init/grass-run.src
grass/trunk/lib/init/grass-xterm-wrapper
grass/trunk/lib/linkm/destroy.c
grass/trunk/lib/linkm/linkm.c
grass/trunk/lib/linkm/malloc.c
grass/trunk/lib/linkm/speed.c
grass/trunk/lib/linkm/speed2.c
grass/trunk/lib/linkm/speed3.c
grass/trunk/lib/linkm/try.c
grass/trunk/lib/linkm/try2.c
grass/trunk/lib/segment/debug.c
grass/trunk/lib/segment/try.c
grass/trunk/lib/vector/diglib/portable/
grass/trunk/lib/vector/rtree/sphvol.c
grass/trunk/lib/vector/rtree/test.c
grass/trunk/visualization/nviz/src/buildPg.c
grass/trunk/visualization/nviz/src/getCat.c
grass/trunk/visualization/nviz/src/openvect.c
grass/trunk/visualization/nviz/src/query_postgr.c
grass/trunk/visualization/nviz/src/runPg.c
grass/trunk/visualization/nviz/src/vect.c
Modified:
grass/trunk/Makefile
grass/trunk/db/Makefile
grass/trunk/db/drivers/Makefile
grass/trunk/db/drivers/dbf/Makefile
grass/trunk/db/drivers/mysql/Makefile
grass/trunk/db/drivers/mysql/db.c
grass/trunk/db/drivers/mysql/proto.h
grass/trunk/db/drivers/odbc/Makefile
grass/trunk/db/drivers/ogr/Makefile
grass/trunk/db/drivers/postgres/Makefile
grass/trunk/db/drivers/sqlite/Makefile
grass/trunk/doc/Makefile
grass/trunk/general/Makefile
grass/trunk/general/manage/Makefile
grass/trunk/general/manage/lib/Makefile
grass/trunk/gui/Makefile
grass/trunk/gui/tcltk/Makefile
grass/trunk/gui/tcltk/gis.m/Makefile
grass/trunk/gui/wxpython/Makefile
grass/trunk/gui/wxpython/docs/Makefile
grass/trunk/gui/wxpython/scripts/Makefile
grass/trunk/imagery/Makefile
grass/trunk/imagery/i.ortho.photo/Makefile
grass/trunk/imagery/i.smap/Makefile
grass/trunk/include/Make/Dir.make
grass/trunk/include/Make/Doxygen.make
grass/trunk/include/Make/Etc.make
grass/trunk/include/Make/Grass.make
grass/trunk/include/Make/Html.make
grass/trunk/include/Make/Lib.make
grass/trunk/include/Make/Module.make
grass/trunk/include/Make/Multi.make
grass/trunk/include/Make/Rules.make
grass/trunk/include/Make/Script.make
grass/trunk/include/Make/Shlib.make
grass/trunk/lib/Makefile
grass/trunk/lib/bitmap/Makefile
grass/trunk/lib/btree/Makefile
grass/trunk/lib/cdhc/Makefile
grass/trunk/lib/datetime/Makefile
grass/trunk/lib/db/Makefile
grass/trunk/lib/db/sqlp/
grass/trunk/lib/db/sqlp/Makefile
grass/trunk/lib/db/sqlp/test/Makefile
grass/trunk/lib/driver/Makefile
grass/trunk/lib/external/Makefile
grass/trunk/lib/external/bwidget/Makefile
grass/trunk/lib/fonts/Makefile
grass/trunk/lib/fonts/fonts/Makefile
grass/trunk/lib/form/Makefile
grass/trunk/lib/gtcltk/Makefile
grass/trunk/lib/init/Makefile
grass/trunk/lib/iostream/Makefile
grass/trunk/lib/linkm/Makefile
grass/trunk/lib/nviz/Makefile
grass/trunk/lib/ogsf/Makefile
grass/trunk/lib/pngdriver/Makefile
grass/trunk/lib/proj/Makefile
grass/trunk/lib/python/Makefile
grass/trunk/lib/raster/Makefile
grass/trunk/lib/rst/Makefile
grass/trunk/lib/segment/Makefile
grass/trunk/lib/vector/Makefile
grass/trunk/lib/vector/dglib/Makefile
grass/trunk/lib/vector/diglib/Makefile
grass/trunk/lib/vector/rtree/Makefile
grass/trunk/locale/Makefile
grass/trunk/macosx/Makefile
grass/trunk/macosx/app/Makefile
grass/trunk/macosx/modbuild/Makefile
grass/trunk/misc/Makefile
grass/trunk/ps/Makefile
grass/trunk/raster/Makefile
grass/trunk/raster/r.le/Makefile
grass/trunk/raster/r.li/Makefile
grass/trunk/raster/r.mapcalc/
grass/trunk/raster/r.mapcalc/Makefile
grass/trunk/raster/r.mapcalc/mapcalc.l
grass/trunk/raster/r.watershed/Makefile
grass/trunk/raster/simwe/Makefile
grass/trunk/raster/wildfire/Makefile
grass/trunk/raster3d/Makefile
grass/trunk/rfc/Makefile
grass/trunk/scripts/Makefile
grass/trunk/sites/Makefile
grass/trunk/testsuite/Makefile
grass/trunk/tools/Makefile
grass/trunk/vector/Makefile
grass/trunk/vector/lidar/Makefile
grass/trunk/vector/v.digit/Makefile
grass/trunk/vector/v.lrs/Makefile
grass/trunk/visualization/Makefile
grass/trunk/visualization/nviz/Makefile
grass/trunk/visualization/nviz/html/Makefile
grass/trunk/visualization/nviz/src/Makefile
grass/trunk/visualization/nviz2/Makefile
grass/trunk/visualization/nviz2/cmd/Makefile
Log:
Major build system clean-up
Remove dead code
Modified: grass/trunk/Makefile
===================================================================
--- grass/trunk/Makefile 2008-08-23 21:08:33 UTC (rev 33037)
+++ grass/trunk/Makefile 2008-08-23 21:13:06 UTC (rev 33038)
@@ -19,8 +19,7 @@
MODULE_TOPDIR = .
-include $(MODULE_TOPDIR)/include/Make/Platform.make
-include $(MODULE_TOPDIR)/include/Make/Grass.make
+include $(MODULE_TOPDIR)/include/Make/Vars.make
# Install directories
exec_prefix= ${prefix}
@@ -121,41 +120,9 @@
-cp -f $(FILES) ${ARCH_DISTDIR}/
-cp -fr --parents include ${ARCH_DISTDIR}/
-#we leave this target for a while so that people can easily upgrade (11/2004):
-mix:
- @echo "NOTE: 'make mix' is no longer needed (changed 9 Nov 2004)"
-
-mixclean:
- list='$(SUBDIRS)'; \
- find include -type l -exec rm {} \; 2>/dev/null; \
- for subdir in $$list; do \
- find $$subdir -type l -exec rm {} \; 2>/dev/null; \
- done
- -rm -f MIX
-
-# Any target that has a dependency on this target will be forced to be made.
-# If we switch to GNU Make then this feature can be replaced with .PHONY
-FORCE:
-
cleandistdirs:
- -rm -rf ${ARCH_DISTDIR}/bin/ 2>/dev/null
- -rm -rf ${ARCH_DISTDIR}/bwidget/ 2>/dev/null
- -rm -rf ${ARCH_DISTDIR}/docs/ 2>/dev/null
- -rm -rf ${ARCH_DISTDIR}/driver/ 2>/dev/null
- -rm -rf ${ARCH_DISTDIR}/etc/ 2>/dev/null
- -rm -rf ${ARCH_DISTDIR}/fonts/ 2>/dev/null
- -rm -rf ${ARCH_DISTDIR}/include/ 2>/dev/null
- -rm -rf ${ARCH_DISTDIR}/lib/ 2>/dev/null
- -rm -rf ${ARCH_DISTDIR}/locale/ 2>/dev/null
- -rm -rf ${ARCH_DISTDIR}/man/ 2>/dev/null
- -rm -rf ${ARCH_DISTDIR}/scripts/ 2>/dev/null
- -rm -rf ${ARCH_DISTDIR}/demolocation/ 2>/dev/null
- -rm -rf ${ARCH_DISTDIR}/tcltkgrass/ 2>/dev/null
- -rm -f ${ARCH_DISTDIR}/AUTHORS ${ARCH_DISTDIR}/CHANGES ${ARCH_DISTDIR}/REQUIREMENTS.html ${ARCH_DISTDIR}/COPYING ${ARCH_DISTDIR}/GPL.TXT ${ARCH_DISTDIR}/grass${GRASS_VERSION_MAJOR}${GRASS_VERSION_MINOR}.tmp 2>/dev/null
- -rmdir ${ARCH_DISTDIR}
- -rm -f ${ARCH_BINDIR}/grass${GRASS_VERSION_MAJOR}${GRASS_VERSION_MINOR} 2>/dev/null
- -rm -f ${ARCH_BINDIR}/grass${GRASS_VERSION_MAJOR}${GRASS_VERSION_MINOR}.bat 2>/dev/null
- -rmdir ${ARCH_BINDIR}
+ -rm -rf ${ARCH_DISTDIR}
+ -rm -rf ${ARCH_BINDIR}
# Clean out the strings extracted from scripts for translation
cleanscriptstrings:
Modified: grass/trunk/db/Makefile
===================================================================
--- grass/trunk/db/Makefile 2008-08-23 21:08:33 UTC (rev 33037)
+++ grass/trunk/db/Makefile 2008-08-23 21:13:06 UTC (rev 33038)
@@ -14,4 +14,3 @@
htmldir: subdirs
-clean: cleansubdirs
Modified: grass/trunk/db/drivers/Makefile
===================================================================
--- grass/trunk/db/drivers/Makefile 2008-08-23 21:08:33 UTC (rev 33037)
+++ grass/trunk/db/drivers/Makefile 2008-08-23 21:13:06 UTC (rev 33038)
@@ -4,7 +4,7 @@
#always compile dialog lib and dbf driver:
SUBDIRS1 = dbf
-include $(MODULE_TOPDIR)/include/Make/Platform.make
+include $(MODULE_TOPDIR)/include/Make/Vars.make
# add odbc:
ifneq ($(strip $(ODBCLIB)),)
@@ -36,5 +36,3 @@
include $(MODULE_TOPDIR)/include/Make/Dir.make
default: parsubdirs
-
-clean: cleansubdirs
Modified: grass/trunk/db/drivers/dbf/Makefile
===================================================================
--- grass/trunk/db/drivers/dbf/Makefile 2008-08-23 21:08:33 UTC (rev 33037)
+++ grass/trunk/db/drivers/dbf/Makefile 2008-08-23 21:13:06 UTC (rev 33038)
@@ -1,41 +1,13 @@
-
MODULE_TOPDIR = ../../..
-include $(MODULE_TOPDIR)/include/Make/Platform.make
-include $(MODULE_TOPDIR)/include/Make/Grass.make
-include $(MODULE_TOPDIR)/include/Make/Rules.make
-
-DRIVER=$(DBDRIVERDIR)/dbf$(EXE)
DEPENDENCIES = $(GISDEP)
-EXTRA_INC = -I$(MODULE_TOPDIR)/lib/db/dbmi_driver
-LIBES = $(DBMIDRIVERLIB) $(DBMIBASELIB) $(DBMIEXTRALIB) $(SQLPLIB) $(SHAPELIB) $(DBSTUBSLIB) $(GISLIB) $(DATETIMELIB)
+PGM = dbf
-DRVDOC=$(GISBASE)/docs/html/grass-dbf.html
+include $(MODULE_TOPDIR)/include/Make/Vars.make
+MOD_OBJS := $(filter-out main_debug.o,$(AUTO_OBJS))
+include $(MODULE_TOPDIR)/include/Make/DB.make
-OBJS = \
- column.o \
- cursor.o \
- db.o \
- dbfexe.o \
- describe.o \
- driver.o \
- error.o \
- execute.o \
- fetch.o \
- listtab.o \
- main.o \
- select.o \
- str.o \
- table.o \
- create_table.o
+LIBES = $(DBMIDRIVERLIB) $(DBMIBASELIB) $(DBMIEXTRALIB) $(SQLPLIB) $(SHAPELIB) $(DBSTUBSLIB) $(GISLIB) $(DATETIMELIB)
-ARCH_OBJS := $(foreach obj,$(OBJS),$(OBJDIR)/$(obj))
-
-default: $(DRIVER) $(DRVDOC)
-
-$(DRIVER): $(ARCH_OBJS)
- $(CC) $(LDFLAGS) -o $@ $(ARCH_OBJS) $(FMODE_OBJ) $(LIBES) $(MATHLIB) $(XDRLIB)
-
-$(DRVDOC): grass-dbf.html
- $(INSTALL_DATA) grass-dbf.html $(DRVDOC)
+default: dbmi
Modified: grass/trunk/db/drivers/mysql/Makefile
===================================================================
--- grass/trunk/db/drivers/mysql/Makefile 2008-08-23 21:08:33 UTC (rev 33037)
+++ grass/trunk/db/drivers/mysql/Makefile 2008-08-23 21:13:06 UTC (rev 33038)
@@ -1,67 +1,37 @@
-
MODULE_TOPDIR = ../../..
-include $(MODULE_TOPDIR)/include/Make/Platform.make
-include $(MODULE_TOPDIR)/include/Make/Grass.make
-include $(MODULE_TOPDIR)/include/Make/Rules.make
-
-CLIENT_DRIVER=$(DBDRIVERDIR)/mysql$(EXE)
-EMBEDED_DRIVER=$(DBDRIVERDIR)/mesql$(EXE)
-
-LIBES = $(DBMIDRIVERLIB) $(DBMIBASELIB) $(SQLPLIB) $(DBSTUBSLIB) \
- $(GISLIB) $(DATETIMELIB)
-
-EXTRA_CFLAGS = $(MYSQLINCPATH) $(TCLINCDIR) $(TKINCDIR)
-EXTRA_INC = -I$(MODULE_TOPDIR)/lib/db/dbmi_driver
-
DEPENDENCIES = $(GISDEP)
-DRVDOC=$(GISBASE)/docs/html/grass-mysql.html
-EDRVDOC=$(GISBASE)/docs/html/grass-mesql.html
+include $(MODULE_TOPDIR)/include/Make/Vars.make
-OBJS = \
- create_table.o \
- cursor.o \
- describe.o \
- driver.o \
- error.o \
- execute.o \
- fetch.o \
- index.o \
- listtab.o \
- main.o \
- parse.o \
- select.o
+ifeq ($(PGM),mysql)
+MOD_OBJS := $(filter-out dbe.o,$(MOD_OBJS))
+else
+MOD_OBJS := $(filter-out db.o,$(MOD_OBJS))
+endif
-CLIENT_OBJS = $(OBJS) db.o
-EMBEDED_OBJS = $(OBJS) dbe.o
+include $(MODULE_TOPDIR)/include/Make/DB.make
-CLIENT_ARCH_OBJS := $(foreach obj,$(CLIENT_OBJS),$(OBJDIR)/$(obj))
-EMBEDED_ARCH_OBJS := $(foreach obj,$(EMBEDED_OBJS),$(OBJDIR)/$(obj))
+LIBES = $(DBMIDRIVERLIB) $(DBMIBASELIB) $(DBSTUBSLIB) \
+ $(GISLIB) $(DATETIMELIB)
+EXTRA_CFLAGS = $(MYSQLINCPATH) $(TCLINCDIR) $(TKINCDIR)
+EXTRA_LDFLAGS = $(MYSQLLIBPATH)
-ifneq ($(strip $(MYSQLDLIB)),)
-ifneq ($(strip $(CXX)),)
- EDRIVER = $(EMBEDED_DRIVER)
+ifeq ($(PGM),mysql)
+LIBES += $(MYSQLLIB)
+else
+LIBES += $(MYSQLDLIB)
+LINK = $(CXX)
endif
-endif
-default: $(CLIENT_DRIVER) $(EDRIVER) $(DRVDOC) $(EDRVDOC)
-
-$(CLIENT_DRIVER): $(CLIENT_ARCH_OBJS)
- $(CC) $(LDFLAGS) -o $@ $(CLIENT_ARCH_OBJS) $(FMODE_OBJ) $(LIBES) \
- $(MYSQLLIBPATH) $(MYSQLLIB) $(MATHLIB) $(XDRLIB)
-
-$(EMBEDED_DRIVER): $(EMBEDED_ARCH_OBJS)
- $(CXX) $(LDFLAGS) -o $@ $(EMBEDED_ARCH_OBJS) $(FMODE_OBJ) \
- $(MYSQLDLIB) $(LIBES) $(MATHLIB) $(XDRLIB)
-
-$(OBJDIR)/dbe.o : db.c $(DEPENDENCIES) $(LOCAL_HEADERS)
- @test -d $(OBJDIR) || mkdir $(OBJDIR)
- $(CC) -DMESQL=1 $(CFLAGS) $(EXTRA_CFLAGS) $(NLS_CFLAGS) $(EXTRA_INC) $(INC) \
- -o $@ -c db.c
-
-$(DRVDOC): grass-mysql.html
- $(INSTALL_DATA) grass-mysql.html $(DRVDOC)
-
-$(EDRVDOC): grass-mesql.html
- $(INSTALL_DATA) grass-mesql.html $(EDRVDOC)
+ifeq ($(PGM),)
+default:
+ $(MAKE) PGM=mysql
+ifneq ($(strip $(MYSQLDLIB)),)
+ifneq ($(strip $(CXX)),)
+ $(MAKE) PGM=mesql
+endif
+endif
+else
+default: dbmi
+endif
Modified: grass/trunk/db/drivers/mysql/db.c
===================================================================
--- grass/trunk/db/drivers/mysql/db.c 2008-08-23 21:08:33 UTC (rev 33037)
+++ grass/trunk/db/drivers/mysql/db.c 2008-08-23 21:13:06 UTC (rev 33038)
@@ -19,8 +19,6 @@
#include "globals.h"
#include "proto.h"
-int replace_variables(char *, char **, char **);
-
int db__driver_open_database(dbHandle * handle)
{
char *name;
@@ -38,7 +36,6 @@
G_debug(3, "db_driver_open_database() mysql: database definition = '%s'",
name);
-#ifndef MESQL
{
/* Client version */
char *user, *password;
@@ -71,118 +68,14 @@
}
}
-#else
-
- /* Embedded version */
- {
- char *datadir, *database;
- char *server_args[4];
- char *buf;
-
- if (!replace_variables(name, &datadir, &database)) {
- append_error(_("Cannot parse MySQL embedded database name"));
- append_error(mysql_error(connection));
- report_error();
- return DB_FAILED;
- }
-
- server_args[0] = "mesql"; /* this string is not used */
- G_asprintf(&buf, "--datadir=%s", datadir);
- server_args[1] = buf;
- /* With InnoDB it is very slow to close the database */
- server_args[2] = "--skip-innodb"; /* OK? */
- /* Without --bootstrap it complains about missing
- * mysql.time_zone_leap_second table */
- server_args[3] = "--bootstrap"; /* OK? */
-
- if (mysql_server_init(4, server_args, NULL)) {
- append_error(_("Cannot initialize MySQL embedded server"));
- append_error(mysql_error(connection));
- report_error();
- free(datadir);
- free(database);
- return DB_FAILED;
- }
-
- connection = mysql_init(NULL);
- mysql_options(connection, MYSQL_OPT_USE_EMBEDDED_CONNECTION, NULL);
-
- res =
- mysql_real_connect(connection, NULL, NULL, NULL, database, 0,
- NULL, 0);
-
- free(datadir);
- free(database);
-
- if (res == NULL) {
- append_error(_("Cannot connect to MySQL embedded server: "));
- append_error(mysql_error(connection));
- report_error();
- return DB_FAILED;
- }
- }
-
-#endif
-
return DB_OK;
}
-int db__driver_close_database()
+int db__driver_close_database(void)
{
init_error();
mysql_close(connection); /* this will also release connection */
-#ifdef MESQL
- mysql_server_end();
-#endif
-
return DB_OK;
}
-int replace_variables(char *in, char **datadir, char **database)
-{
- *datadir = NULL;
- *database = NULL;
-
- /* parse/replace variables in input string */
- char tmp[2000];
- char **tokens;
- int no_tokens, n;
-
- if (!strchr(in, '/')) { /* no path */
- *datadir = G_store("./");
- *database = G_store(in);
- }
- else {
- tokens = G_tokenize(in, "/");
- no_tokens = G_number_of_tokens(tokens);
-
- G_debug(3, "no_tokens = %d", no_tokens);
-
- tmp[0] = '\0';
- for (n = 0; n < no_tokens - 1; n++) {
- if (n > 0)
- strcat(tmp, "/");
-
- G_debug(3, "tokens[%d] = %s", n, tokens[n]);
- if (tokens[n][0] == '$') {
- G_strchg(tokens[n], '$', ' ');
- G_chop(tokens[n]);
- strcat(tmp, G__getenv(tokens[n]));
- G_debug(3, " -> %s", G__getenv(tokens[n]));
- }
- else {
- strcat(tmp, tokens[n]);
- }
- }
- *datadir = G_store(tmp);
- *database = G_store(tokens[n]);
-
- G_free_tokens(tokens);
- }
-
- G_debug(2, "datadir = '%s'", *datadir);
- G_debug(2, "database = '%s'", *database);
-
- return 1;
-}
Added: grass/trunk/db/drivers/mysql/dbe.c
===================================================================
--- grass/trunk/db/drivers/mysql/dbe.c (rev 0)
+++ grass/trunk/db/drivers/mysql/dbe.c 2008-08-23 21:13:06 UTC (rev 33038)
@@ -0,0 +1,99 @@
+
+/**********************************************************
+ * MODULE: mysql
+ * AUTHOR(S): Radim Blazek (radim.blazek at gmail.com)
+ * PURPOSE: MySQL database driver
+ * COPYRIGHT: (C) 2001 by the GRASS Development Team
+ * This program is free software under the
+ * GNU General Public License (>=v2).
+ * Read the file COPYING that comes with GRASS
+ * for details.
+ **********************************************************/
+#include <stdlib.h>
+#include <string.h>
+
+#include <grass/dbmi.h>
+#include <grass/gis.h>
+#include <grass/glocale.h>
+
+#include "globals.h"
+#include "proto.h"
+
+int db__driver_open_database(dbHandle * handle)
+{
+ char *name;
+ dbConnection default_connection;
+ MYSQL *res;
+
+ init_error();
+ db_get_connection(&default_connection);
+ name = db_get_handle_dbname(handle);
+
+ /* if name is empty use default_connection.databaseName */
+ if (strlen(name) == 0)
+ name = default_connection.databaseName;
+
+ G_debug(3, "db_driver_open_database() mysql: database definition = '%s'",
+ name);
+
+ /* Embedded version */
+ {
+ char *datadir, *database;
+ char *server_args[4];
+ char *buf;
+
+ if (!replace_variables(name, &datadir, &database)) {
+ append_error(_("Cannot parse MySQL embedded database name"));
+ append_error(mysql_error(connection));
+ report_error();
+ return DB_FAILED;
+ }
+
+ server_args[0] = "mesql"; /* this string is not used */
+ G_asprintf(&buf, "--datadir=%s", datadir);
+ server_args[1] = buf;
+ /* With InnoDB it is very slow to close the database */
+ server_args[2] = "--skip-innodb"; /* OK? */
+ /* Without --bootstrap it complains about missing
+ * mysql.time_zone_leap_second table */
+ server_args[3] = "--bootstrap"; /* OK? */
+
+ if (mysql_server_init(4, server_args, NULL)) {
+ append_error(_("Cannot initialize MySQL embedded server"));
+ append_error(mysql_error(connection));
+ report_error();
+ free(datadir);
+ free(database);
+ return DB_FAILED;
+ }
+
+ connection = mysql_init(NULL);
+ mysql_options(connection, MYSQL_OPT_USE_EMBEDDED_CONNECTION, NULL);
+
+ res =
+ mysql_real_connect(connection, NULL, NULL, NULL, database, 0,
+ NULL, 0);
+
+ free(datadir);
+ free(database);
+
+ if (res == NULL) {
+ append_error(_("Cannot connect to MySQL embedded server: "));
+ append_error(mysql_error(connection));
+ report_error();
+ return DB_FAILED;
+ }
+ }
+
+ return DB_OK;
+}
+
+int db__driver_close_database(void)
+{
+ init_error();
+ mysql_close(connection); /* this will also release connection */
+
+ mysql_server_end();
+
+ return DB_OK;
+}
Modified: grass/trunk/db/drivers/mysql/proto.h
===================================================================
--- grass/trunk/db/drivers/mysql/proto.h 2008-08-23 21:08:33 UTC (rev 33037)
+++ grass/trunk/db/drivers/mysql/proto.h 2008-08-23 21:13:06 UTC (rev 33038)
@@ -13,3 +13,6 @@
/* parse.c */
int parse_conn(char *, CONNPAR *);
+
+/* replace.c */
+int replace_variables(char *, char **, char **);
Added: grass/trunk/db/drivers/mysql/replace.c
===================================================================
--- grass/trunk/db/drivers/mysql/replace.c (rev 0)
+++ grass/trunk/db/drivers/mysql/replace.c 2008-08-23 21:13:06 UTC (rev 33038)
@@ -0,0 +1,70 @@
+
+/**********************************************************
+ * MODULE: mysql
+ * AUTHOR(S): Radim Blazek (radim.blazek at gmail.com)
+ * PURPOSE: MySQL database driver
+ * COPYRIGHT: (C) 2001,2008 by the GRASS Development Team
+ * This program is free software under the
+ * GNU General Public License (>=v2).
+ * Read the file COPYING that comes with GRASS
+ * for details.
+ **********************************************************/
+
+#include <stdlib.h>
+#include <string.h>
+
+#include <grass/dbmi.h>
+#include <grass/gis.h>
+#include <grass/glocale.h>
+
+#include "globals.h"
+#include "proto.h"
+
+int replace_variables(char *in, char **datadir, char **database)
+{
+ *datadir = NULL;
+ *database = NULL;
+
+ /* parse/replace variables in input string */
+ char tmp[2000];
+ char **tokens;
+ int no_tokens, n;
+
+ if (!strchr(in, '/')) { /* no path */
+ *datadir = G_store("./");
+ *database = G_store(in);
+ }
+ else {
+ tokens = G_tokenize(in, "/");
+ no_tokens = G_number_of_tokens(tokens);
+
+ G_debug(3, "no_tokens = %d", no_tokens);
+
+ tmp[0] = '\0';
+ for (n = 0; n < no_tokens - 1; n++) {
+ if (n > 0)
+ strcat(tmp, "/");
+
+ G_debug(3, "tokens[%d] = %s", n, tokens[n]);
+ if (tokens[n][0] == '$') {
+ G_strchg(tokens[n], '$', ' ');
+ G_chop(tokens[n]);
+ strcat(tmp, G__getenv(tokens[n]));
+ G_debug(3, " -> %s", G__getenv(tokens[n]));
+ }
+ else {
+ strcat(tmp, tokens[n]);
+ }
+ }
+ *datadir = G_store(tmp);
+ *database = G_store(tokens[n]);
+
+ G_free_tokens(tokens);
+ }
+
+ G_debug(2, "datadir = '%s'", *datadir);
+ G_debug(2, "database = '%s'", *database);
+
+ return 1;
+}
+
Modified: grass/trunk/db/drivers/odbc/Makefile
===================================================================
--- grass/trunk/db/drivers/odbc/Makefile 2008-08-23 21:08:33 UTC (rev 33037)
+++ grass/trunk/db/drivers/odbc/Makefile 2008-08-23 21:13:06 UTC (rev 33038)
@@ -1,39 +1,10 @@
MODULE_TOPDIR = ../../..
-include $(MODULE_TOPDIR)/include/Make/Platform.make
-include $(MODULE_TOPDIR)/include/Make/Grass.make
-include $(MODULE_TOPDIR)/include/Make/Rules.make
+PGM = odbc
+include $(MODULE_TOPDIR)/include/Make/DB.make
-DRIVER=$(DBDRIVERDIR)/odbc$(EXE)
-EXTRA_INC = $(ODBCINC) -I$(MODULE_TOPDIR)/lib/db/dbmi_driver
DEPENDENCIES = $(GISDEP)
-LIBES = $(DBMIDRIVERLIB) $(DBMIBASELIB) $(DBMIEXTRALIB) $(DBSTUBSLIB) $(GISLIB) $(DATETIMELIB)
+LIBES = $(DBMIDRIVERLIB) $(DBMIBASELIB) $(DBMIEXTRALIB) $(DBSTUBSLIB) $(GISLIB) $(DATETIMELIB) $(ODBCLIB)
-OBJS = \
- connect.o \
- cursor.o \
- db.o \
- describe.o \
- driver.o \
- error.o \
- execute.o \
- fetch.o \
- listdb.o \
- listtab.o \
- main.o \
- select.o \
- table.o \
- create_table.o
-
-ARCH_OBJS := $(foreach obj,$(OBJS),$(OBJDIR)/$(obj))
-
-DRVDOC=$(GISBASE)/docs/html/grass-odbc.html
-
-default: $(DRIVER) $(DRVDOC)
-
-$(DRIVER): $(ARCH_OBJS)
- $(CC) $(LDFLAGS) -o $@ $(ARCH_OBJS) $(FMODE_OBJ) $(LIBES) $(ODBCLIB) $(MATHLIB) $(XDRLIB) $(ICONVLIB)
-
-$(DRVDOC): grass-odbc.html
- $(INSTALL_DATA) grass-odbc.html $(DRVDOC)
+default: dbmi
Modified: grass/trunk/db/drivers/ogr/Makefile
===================================================================
--- grass/trunk/db/drivers/ogr/Makefile 2008-08-23 21:08:33 UTC (rev 33037)
+++ grass/trunk/db/drivers/ogr/Makefile 2008-08-23 21:13:06 UTC (rev 33038)
@@ -2,28 +2,12 @@
DEPENDENCIES = $(GISDEP)
-include $(MODULE_TOPDIR)/include/Make/Platform.make
-include $(MODULE_TOPDIR)/include/Make/Grass.make
-include $(MODULE_TOPDIR)/include/Make/Rules.make
+PGM = ogr
+include $(MODULE_TOPDIR)/include/Make/DB.make
-DRIVER=$(DBDRIVERDIR)/ogr$(EXE)
-
-LIBES = $(DBMIDRIVERLIB) $(DBMIBASELIB) $(DBMIEXTRALIB) $(SQLPLIB) $(DBSTUBSLIB) \
+LIBES = $(DBMIDRIVERLIB) $(DBMIBASELIB) $(DBMIEXTRALIB) $(DBSTUBSLIB) \
$(GISLIB) $(DATETIMELIB) $(GDALLIBS)
EXTRA_CFLAGS = $(GDALCFLAGS) $(TCLINCDIR) $(TKINCDIR)
-EXTRA_INC = -I$(MODULE_TOPDIR)/lib/db/dbmi_driver
+EXTRA_LDFLAGS = $(PQLIBPATH) $(TCLTKLIBPATH) $(TCLTKLIBS)
-DRVDOC=$(GISBASE)/docs/html/grass-ogr.html
-
-OBJS = $(subst .c,.o,$(wildcard *.c))
-
-ARCH_OBJS := $(foreach obj,$(OBJS),$(OBJDIR)/$(obj))
-
-default: $(DRIVER) $(DRVDOC)
-
-$(DRIVER): $(ARCH_OBJS)
- $(CC) $(LDFLAGS) -o $@ $(ARCH_OBJS) $(PQLIBPATH) $(FMODE_OBJ) $(LIBES) $(TCLTKLIBPATH) $(TCLTKLIBS) \
- $(MATHLIB) $(XDRLIB)
-
-$(DRVDOC): grass-ogr.html
- $(INSTALL_DATA) grass-ogr.html $(DRVDOC)
+default: dbmi
Modified: grass/trunk/db/drivers/postgres/Makefile
===================================================================
--- grass/trunk/db/drivers/postgres/Makefile 2008-08-23 21:08:33 UTC (rev 33037)
+++ grass/trunk/db/drivers/postgres/Makefile 2008-08-23 21:13:06 UTC (rev 33038)
@@ -2,29 +2,13 @@
DEPENDENCIES = $(GISDEP)
-include $(MODULE_TOPDIR)/include/Make/Platform.make
-include $(MODULE_TOPDIR)/include/Make/Grass.make
-include $(MODULE_TOPDIR)/include/Make/Rules.make
+PGM = pg
+include $(MODULE_TOPDIR)/include/Make/DB.make
-DRIVER=$(DBDRIVERDIR)/pg$(EXE)
-
-LIBES = $(DBMIDRIVERLIB) $(DBMIBASELIB) $(DBMIEXTRALIB) $(SQLPLIB) $(DBSTUBSLIB) \
+LIBES = $(DBMIDRIVERLIB) $(DBMIBASELIB) $(DBMIEXTRALIB) $(DBSTUBSLIB) \
$(GISLIB) $(DATETIMELIB) $(PQLIB)
EXTRA_CFLAGS = $(PQINCPATH)
-EXTRA_INC = -I$(MODULE_TOPDIR)/lib/db/dbmi_driver
+EXTRA_LDFLAGS = $(PQLIBPATH)
-OBJS = $(subst .c,.o,$(wildcard *.c))
-
-ARCH_OBJS := $(foreach obj,$(OBJS),$(OBJDIR)/$(obj))
-
-DRVDOC=$(GISBASE)/docs/html/grass-pg.html
-
-default: $(DRIVER) $(DRVDOC)
-
-$(DRIVER): $(ARCH_OBJS)
- $(CC) $(LDFLAGS) -o $@ $(ARCH_OBJS) $(FMODE_OBJ) $(PQLIBPATH) $(LIBES) \
- $(MATHLIB) $(XDRLIB)
-
-$(DRVDOC): grass-pg.html
- $(INSTALL_DATA) grass-pg.html $(DRVDOC)
+default: dbmi
Modified: grass/trunk/db/drivers/sqlite/Makefile
===================================================================
--- grass/trunk/db/drivers/sqlite/Makefile 2008-08-23 21:08:33 UTC (rev 33037)
+++ grass/trunk/db/drivers/sqlite/Makefile 2008-08-23 21:13:06 UTC (rev 33038)
@@ -2,29 +2,13 @@
DEPENDENCIES = $(GISDEP)
-include $(MODULE_TOPDIR)/include/Make/Platform.make
-include $(MODULE_TOPDIR)/include/Make/Grass.make
-include $(MODULE_TOPDIR)/include/Make/Rules.make
+PGM = sqlite
+include $(MODULE_TOPDIR)/include/Make/DB.make
-DRIVER=$(DBDRIVERDIR)/sqlite$(EXE)
-
LIBES = $(DBMIDRIVERLIB) $(DBMIBASELIB) $(DBMIEXTRALIB) $(DBSTUBSLIB) \
$(GISLIB) $(DATETIMELIB) $(SQLITELIB)
EXTRA_CFLAGS = $(SQLITEINCPATH)
-EXTRA_INC = -I$(MODULE_TOPDIR)/lib/db/dbmi_driver
+EXTRA_LDFLAGS = $(SQLITELIBPATH)
-OBJS = $(subst .c,.o,$(wildcard *.c))
-
-ARCH_OBJS := $(foreach obj,$(OBJS),$(OBJDIR)/$(obj))
-
-DRVDOC=$(GISBASE)/docs/html/grass-sqlite.html
-
-default: $(DRIVER) $(DRVDOC)
-
-$(DRIVER): $(ARCH_OBJS)
- $(CC) $(LDFLAGS) -o $@ $(ARCH_OBJS) $(FMODE_OBJ) $(SQLITELIBPATH) $(LIBES) \
- $(MATHLIB) $(XDRLIB)
-
-$(DRVDOC): grass-sqlite.html
- $(INSTALL_DATA) grass-sqlite.html $(DRVDOC)
+default: dbmi
Modified: grass/trunk/doc/Makefile
===================================================================
--- grass/trunk/doc/Makefile 2008-08-23 21:08:33 UTC (rev 33037)
+++ grass/trunk/doc/Makefile 2008-08-23 21:13:06 UTC (rev 33038)
@@ -6,4 +6,3 @@
default: htmldir
-clean: cleansubdirs
Modified: grass/trunk/general/Makefile
===================================================================
--- grass/trunk/general/Makefile 2008-08-23 21:08:33 UTC (rev 33037)
+++ grass/trunk/general/Makefile 2008-08-23 21:13:06 UTC (rev 33038)
@@ -28,4 +28,3 @@
default: parsubdirs
-clean: cleansubdirs
Modified: grass/trunk/general/manage/Makefile
===================================================================
--- grass/trunk/general/manage/Makefile 2008-08-23 21:08:33 UTC (rev 33037)
+++ grass/trunk/general/manage/Makefile 2008-08-23 21:13:06 UTC (rev 33038)
@@ -10,5 +10,4 @@
default: subdirs
-clean: cleansubdirs
Modified: grass/trunk/general/manage/lib/Makefile
===================================================================
--- grass/trunk/general/manage/lib/Makefile 2008-08-23 21:08:33 UTC (rev 33037)
+++ grass/trunk/general/manage/lib/Makefile 2008-08-23 21:13:06 UTC (rev 33038)
@@ -1,17 +1,16 @@
MODULE_TOPDIR = ../../..
-EXTRA_LIBS=$(GISLIB) $(VECTLIB) $(G3DLIB)
-
LIB_NAME = $(MANAGE_LIBNAME)
+DEPENDENCIES = $(GISDEP) $(VECTDEP) $(G3DDEP)
-LOCAL_HEADERS = $(wildcard *.h) ../list.h
+include $(MODULE_TOPDIR)/include/Make/Lib.make
+LOCAL_HEADERS := $(wildcard *.h) ../list.h
+
EXTRA_INC = -I.. $(VECT_INC)
EXTRA_CFLAGS = $(VECT_CFLAGS)
-DEPENDENCIES = $(GISDEP) $(VECTDEP) $(G3DDEP)
+EXTRA_LIBS = $(GISLIB) $(VECTLIB) $(G3DLIB)
-include $(MODULE_TOPDIR)/include/Make/Lib.make
-
default: stlib $(ETC)/element_list
$(ETC)/element_list: Element_List
Modified: grass/trunk/gui/Makefile
===================================================================
--- grass/trunk/gui/Makefile 2008-08-23 21:08:33 UTC (rev 33037)
+++ grass/trunk/gui/Makefile 2008-08-23 21:13:06 UTC (rev 33038)
@@ -2,10 +2,6 @@
SUBDIRS = icons images scripts xml tcltk wxpython
-include $(MODULE_TOPDIR)/include/Make/Platform.make
-
include $(MODULE_TOPDIR)/include/Make/Dir.make
default: parsubdirs
-
-clean: cleansubdirs
Modified: grass/trunk/gui/tcltk/Makefile
===================================================================
--- grass/trunk/gui/tcltk/Makefile 2008-08-23 21:08:33 UTC (rev 33037)
+++ grass/trunk/gui/tcltk/Makefile 2008-08-23 21:13:06 UTC (rev 33038)
@@ -6,5 +6,4 @@
default: parsubdirs
-clean: cleansubdirs
Modified: grass/trunk/gui/tcltk/gis.m/Makefile
===================================================================
--- grass/trunk/gui/tcltk/gis.m/Makefile 2008-08-23 21:08:33 UTC (rev 33037)
+++ grass/trunk/gui/tcltk/gis.m/Makefile 2008-08-23 21:13:06 UTC (rev 33038)
@@ -6,13 +6,18 @@
default: script install_scripts
-install_scripts:
- if [ ! -d $(GISBASE)/etc/gm ] ; then $(MKDIR) $(GISBASE)/etc/gm; fi
- for file in *.tcl ; do $(INSTALL) $$file $(GISBASE)/etc/gm/ ; done
- for file in *.gif ; do $(INSTALL_DATA) $$file $(GISBASE)/etc/gm/ ; done
- for file in docs/gm_*.html ; do $(INSTALL_DATA) $$file $(GISBASE)/docs/html/ ; done
- for file in docs/gm_*.png ; do $(INSTALL_DATA) $$file $(GISBASE)/docs/html/ ; done
- for file in docs/gm_*.jpg ; do $(INSTALL_DATA) $$file $(GISBASE)/docs/html/ ; done
+TCLFILES = $(patsubst %,$(ETC)/gm/%,$(wildcard *.tcl))
+GIFFILES = $(patsubst %,$(ETC)/gm/%,$(wildcard *.gif))
+DOCFILES = $(patsubst docs/%,$(HTMLDIR)/%,$(wildcard docs/gm_*.*))
+$(HTMLDIR)/%: docs/%
+ $(INSTALL_DATA) $< $@
+
+$(ETC)/gm/%: %
+ -test -d $(ETC)/gm || $(MKDIR) $(ETC)/gm
+ $(INSTALL_DATA) $< $@
+
+install_scripts: $(TCLFILES) $(GIFFILES) $(DOCFILES)
+
$(BIN)/$(PGM).bat: $(PGM).bat
$(INSTALL_DATA) $< $@
Modified: grass/trunk/gui/wxpython/Makefile
===================================================================
--- grass/trunk/gui/wxpython/Makefile 2008-08-23 21:08:33 UTC (rev 33037)
+++ grass/trunk/gui/wxpython/Makefile 2008-08-23 21:13:06 UTC (rev 33038)
@@ -2,7 +2,7 @@
SUBDIRS = docs scripts
-include $(MODULE_TOPDIR)/include/Make/Platform.make
+include $(MODULE_TOPDIR)/include/Make/Vars.make
#compile if wxWidgets, Python, CXX present
ifneq ($(USE_WXWIDGETS),)
@@ -35,5 +35,3 @@
$(INSTALL_DATA) gis_set.py wxgui.py README $(ETCDIR)/
$(INSTALL) scripts/* $(ETCDIR)/scripts/
$(INSTALL) wxgui $(ETCDIR)/scripts/
-
-clean: cleansubdirs
Modified: grass/trunk/gui/wxpython/docs/Makefile
===================================================================
--- grass/trunk/gui/wxpython/docs/Makefile 2008-08-23 21:08:33 UTC (rev 33037)
+++ grass/trunk/gui/wxpython/docs/Makefile 2008-08-23 21:13:06 UTC (rev 33038)
@@ -1,12 +1,10 @@
MODULE_TOPDIR = ../../..
+include $(MODULE_TOPDIR)/include/Make/Other.make
+
FILES = wxGUI \
wxGUI.Vector_Digitizing_Tool \
wxGUI.Attribute_Table_Manager \
wxGUI.Nviz
-include $(MODULE_TOPDIR)/include/Make/Platform.make
-include $(MODULE_TOPDIR)/include/Make/Grass.make
-include $(MODULE_TOPDIR)/include/Make/Rules.make
-
default: $(patsubst %,$(HTMLDIR)/%.html,$(FILES))
Modified: grass/trunk/gui/wxpython/scripts/Makefile
===================================================================
--- grass/trunk/gui/wxpython/scripts/Makefile 2008-08-23 21:08:33 UTC (rev 33037)
+++ grass/trunk/gui/wxpython/scripts/Makefile 2008-08-23 21:13:06 UTC (rev 33038)
@@ -1,6 +1,5 @@
MODULE_TOPDIR = ../../..
-include $(MODULE_TOPDIR)/include/Make/Platform.make
include $(MODULE_TOPDIR)/include/Make/Dir.make
ETCDIR = $(ETC)/gui/scripts
@@ -11,4 +10,3 @@
$(MKDIR) $(ETCDIR)
$(INSTALL) d.rast3d $(ETCDIR)/
-clean: cleansubdirs
Modified: grass/trunk/imagery/Makefile
===================================================================
--- grass/trunk/imagery/Makefile 2008-08-23 21:08:33 UTC (rev 33037)
+++ grass/trunk/imagery/Makefile 2008-08-23 21:13:06 UTC (rev 33038)
@@ -1,5 +1,7 @@
MODULE_TOPDIR = ..
+include $(MODULE_TOPDIR)/include/Make/Vars.make
+
SUBDIRS = \
i.atcorr \
i.cluster \
@@ -16,8 +18,6 @@
i.pca \
i.cca
-include $(MODULE_TOPDIR)/include/Make/Platform.make
-
FFTWBASED = i.fft i.ifft i.zc
#compile if FFTW present:
@@ -33,4 +33,3 @@
htmldir: parsubdirs
-clean: cleansubdirs
Modified: grass/trunk/imagery/i.ortho.photo/Makefile
===================================================================
--- grass/trunk/imagery/i.ortho.photo/Makefile 2008-08-23 21:08:33 UTC (rev 33037)
+++ grass/trunk/imagery/i.ortho.photo/Makefile 2008-08-23 21:13:06 UTC (rev 33038)
@@ -19,5 +19,4 @@
default: parsubdirs
-clean: cleansubdirs
Modified: grass/trunk/imagery/i.smap/Makefile
===================================================================
--- grass/trunk/imagery/i.smap/Makefile 2008-08-23 21:08:33 UTC (rev 33037)
+++ grass/trunk/imagery/i.smap/Makefile 2008-08-23 21:13:06 UTC (rev 33038)
@@ -9,7 +9,6 @@
default: parsubdirs
-clean: cleansubdirs
shapiro: bouman
Added: grass/trunk/include/Make/Compile.make
===================================================================
--- grass/trunk/include/Make/Compile.make (rev 0)
+++ grass/trunk/include/Make/Compile.make 2008-08-23 21:13:06 UTC (rev 33038)
@@ -0,0 +1,50 @@
+
+# for i18N support
+NLS_CFLAGS = -DPACKAGE=\"$(PACKAGE)\"
+
+LINK = $(CC)
+
+linker_x = $(1) $(LDFLAGS) $(EXTRA_LDFLAGS) -o $@ $(filter %.o,$^) $(FMODE_OBJ) $(LIBES) $(EXTRA_LIBS) $(MATHLIB) $(XDRLIB)
+linker_c = $(call linker_x,$(CC))
+linker_cxx = $(call linker_x,$(CXX))
+linker = $(call linker_x,$(LINK))
+
+compiler_x = $(1) $(2) $(EXTRA_CFLAGS) $(NLS_CFLAGS) $(DEFS) $(EXTRA_INC) $(INC) -o $@ -c $<
+compiler_c = $(call compiler_x,$(CC),$(CFLAGS))
+compiler_cxx = $(call compiler_x,$(CXX),$(CXXFLAGS))
+compiler = $(call compiler_x,$(CC))
+
+# default cc rules
+ifeq ($(BROKEN_MAKE),)
+
+$(OBJDIR)/%.o : %.c $(LOCAL_HEADERS) $(EXTRA_HEADERS) | $(OBJDIR)
+ $(call compiler_c)
+
+$(OBJDIR)/%.o : %.cc $(LOCAL_HEADERS) $(EXTRA_HEADERS) | $(OBJDIR)
+ $(call compiler_cxx)
+
+$(OBJDIR)/%.o : %.cpp $(LOCAL_HEADERS) $(EXTRA_HEADERS) | $(OBJDIR)
+ $(call compiler_cxx)
+
+else
+
+$(OBJDIR)/%.o : %.c $(LOCAL_HEADERS) $(EXTRA_HEADERS)
+ $(MAKE) $(OBJDIR)
+ $(call compiler_c)
+
+$(OBJDIR)/%.o : %.cc $(LOCAL_HEADERS) $(EXTRA_HEADERS)
+ $(MAKE) $(OBJDIR)
+ $(call compiler_cxx)
+
+$(OBJDIR)/%.o : %.cpp $(LOCAL_HEADERS) $(EXTRA_HEADERS)
+ $(MAKE) $(OBJDIR)
+ $(call compiler_cxx)
+
+endif
+
+# default parser generation rules, include prefix for files/vars
+%.yy.c: %.l
+ $(LEX) $(LFLAGS) $< > $@
+
+%.output %.tab.h %.tab.c: %.y
+ $(YACC) -b$* $(YFLAGS) $<
Added: grass/trunk/include/Make/DB.make
===================================================================
--- grass/trunk/include/Make/DB.make (rev 0)
+++ grass/trunk/include/Make/DB.make 2008-08-23 21:13:06 UTC (rev 33038)
@@ -0,0 +1,20 @@
+
+# common dependencies and rules for building DBMI driver
+
+PACKAGE = "grassmods"
+
+include $(MODULE_TOPDIR)/include/Make/Vars.make
+include $(MODULE_TOPDIR)/include/Make/Rules.make
+include $(MODULE_TOPDIR)/include/Make/Html.make
+include $(MODULE_TOPDIR)/include/Make/Compile.make
+
+EXTRA_INC += -I$(MODULE_TOPDIR)/lib/db/dbmi_driver
+
+dbmi: $(DBDRIVERDIR)/$(PGM)$(EXE) db_html
+
+db_html: $(HTMLDIR)/grass-$(PGM).html
+
+$(DBDRIVERDIR)/$(PGM)$(EXE): $(ARCH_OBJS) $(DEPENDENCIES)
+ $(call linker)
+
+.PHONY: dbmi db_html
Modified: grass/trunk/include/Make/Dir.make
===================================================================
--- grass/trunk/include/Make/Dir.make 2008-08-23 21:08:33 UTC (rev 33037)
+++ grass/trunk/include/Make/Dir.make 2008-08-23 21:13:06 UTC (rev 33038)
@@ -1,9 +1,9 @@
# common dependencies and rules for building subdirs
-include $(MODULE_TOPDIR)/include/Make/Platform.make
-include $(MODULE_TOPDIR)/include/Make/Grass.make
+include $(MODULE_TOPDIR)/include/Make/Vars.make
include $(MODULE_TOPDIR)/include/Make/Rules.make
+include $(MODULE_TOPDIR)/include/Make/Html.make
subdirs:
@list='$(SUBDIRS)'; \
@@ -19,6 +19,8 @@
$(MAKE) -C $$subdir clean; \
done
+clean: cleansubdirs
+
htmldir: html
.PHONY: subdirs cleansubdirs parsubdirs htmldir $(SUBDIRS)
Modified: grass/trunk/include/Make/Doxygen.make
===================================================================
--- grass/trunk/include/Make/Doxygen.make 2008-08-23 21:08:33 UTC (rev 33037)
+++ grass/trunk/include/Make/Doxygen.make 2008-08-23 21:13:06 UTC (rev 33038)
@@ -1,5 +1,4 @@
# common dependencies and rules for building libraries
-include $(MODULE_TOPDIR)/include/Make/Platform.make
DOXINPUT=$(DOXNAME)lib.dox
DOXOUTPUT=$(DOXNAME)lib
Modified: grass/trunk/include/Make/Etc.make
===================================================================
--- grass/trunk/include/Make/Etc.make 2008-08-23 21:08:33 UTC (rev 33037)
+++ grass/trunk/include/Make/Etc.make 2008-08-23 21:13:06 UTC (rev 33038)
@@ -5,13 +5,14 @@
HTMLSRC = $(ETC)/$(PGM)$(EXE)
-include $(MODULE_TOPDIR)/include/Make/Platform.make
-include $(MODULE_TOPDIR)/include/Make/Grass.make
+include $(MODULE_TOPDIR)/include/Make/Vars.make
include $(MODULE_TOPDIR)/include/Make/Rules.make
+include $(MODULE_TOPDIR)/include/Make/Html.make
+include $(MODULE_TOPDIR)/include/Make/Compile.make
etc: $(ETC)/$(PGM)$(EXE) html
-$(ETC)/$(PGM)$(EXE): $(ARCH_CMD_OBJS) $(DEPENDENCIES)
- $(LINK) $(LDFLAGS) $(XTRA_LDFLAGS) -o $@ $(ARCH_CMD_OBJS) $(FMODE_OBJ) $(LIBES) $(MATHLIB) $(XDRLIB)
+$(ETC)/$(PGM)$(EXE): $(ARCH_OBJS) $(DEPENDENCIES)
+ $(call linker)
.PHONY: etc
Modified: grass/trunk/include/Make/Grass.make
===================================================================
--- grass/trunk/include/Make/Grass.make 2008-08-23 21:08:33 UTC (rev 33037)
+++ grass/trunk/include/Make/Grass.make 2008-08-23 21:13:06 UTC (rev 33038)
@@ -51,6 +51,8 @@
ETC = $(ARCH_DISTDIR)/etc
DRIVERDIR = $(ARCH_DISTDIR)/driver
DBDRIVERDIR = $(ARCH_DISTDIR)/driver/db
+DOCSDIR = $(ARCH_DISTDIR)/docs
+HTMLDIR = $(ARCH_DISTDIR)/docs/html
FONTDIR = $(ARCH_DISTDIR)/fonts
@@ -71,6 +73,12 @@
FMODE_OBJ = $(MODULE_TOPDIR)/lib/gis/$(OBJDIR)/fmode.o
endif
+# lexical analyzer and default options
+LFLAGS = -d -i -s -t
+
+# parser generator and default options
+YFLAGS = -d -v -t
+
##################### library names #####################################
ARRAYSTATS_LIBNAME = grass_arraystats
@@ -172,7 +180,7 @@
##################### library switches ##################################
-ARRAYSTATSLIB = -l$(ARRAYSTATS_LIBNAME) $(GISLIB)
+ARRAYSTATSLIB = -l$(ARRAYSTATS_LIBNAME) $(GISLIB)
BITMAPLIB = -l$(BITMAP_LIBNAME) $(LINKMLIB)
BTREELIB = -l$(BTREE_LIBNAME)
CLUSTERLIB = -l$(CLUSTER_LIBNAME) $(IMAGERYLIB) $(GISLIB)
@@ -185,7 +193,7 @@
DRIVERLIB = -l$(DRIVER_LIBNAME) $(GISLIB) $(FTLIB) $(ICONVLIB)
PNGDRIVERLIB = -l$(PNGDRIVER_LIBNAME) $(DRIVERLIB) $(GISLIB) $(PNGLIB)
PSDRIVERLIB = -l$(PSDRIVER_LIBNAME) $(DRIVERLIB) $(GISLIB)
-CAIRODRIVERLIB = -l$(CAIRODRIVER_LIBNAME) $(DRIVERLIB) $(GISLIB)
+CAIRODRIVERLIB= -l$(CAIRODRIVER_LIBNAME) $(DRIVERLIB) $(GISLIB)
HTMLDRIVERLIB = -l$(HTMLDRIVER_LIBNAME) $(DRIVERLIB) $(GISLIB)
EDITLIB = -l$(EDIT_LIBNAME) $(GISLIB) $(VASKLIB)
G3DLIB = -l$(G3D_LIBNAME) $(GISLIB)
@@ -364,53 +372,3 @@
# LRS
LRSDEP = $(ARCH_LIBDIR)/$(LIB_PREFIX)$(LRS_LIBNAME)$(LIB_SUFFIX)
-##################### rules #############################################
-# first found target
-first: pre default
- @if test -n "$(INST_NOW)" ; then \
- $(MAKE) inst_now ; \
- fi
-
-# This helps compile and install modules directly into $(INST_DIR)
-# without having to install whole distribution even after modifying only
-# one module. It will update both $(GRASS_HOME)/dist.$(ARCH) and $(INST_DIR).
-# Usage:
-# INST_NOW=y make
-# alias gmake='INST_NOW=y make' will be useful.
-ifdef INST_NOW
-ARCH_DISTDIR = $(INST_DIR)
-ARCH_BINDIR = $(UNIX_BIN)
-endif
-
-inst_now:
- INST_NOW= $(MAKE)
-
-# create platform dirs
-pre: $(ARCH_BINDIR) $(ARCH_INCDIR) $(ARCH_LIBDIR) \
- $(BIN) $(ETC) \
- $(DRIVERDIR) $(DBDRIVERDIR) $(FONTDIR)
-
-$(ARCH_BINDIR):
- mkdir -p $(ARCH_BINDIR)
-
-$(ARCH_INCDIR):
- mkdir -p $(ARCH_INCDIR)
-
-$(ARCH_LIBDIR):
- mkdir -p $(ARCH_LIBDIR)
-
-$(BIN):
- mkdir -p $(BIN)
-
-$(ETC):
- mkdir -p $(ETC)
-
-$(DRIVERDIR):
- mkdir -p $(DRIVERDIR)
-
-$(DBDRIVERDIR):
- mkdir -p $(DBDRIVERDIR)
-
-$(FONTDIR):
- mkdir -p $(FONTDIR)
-
Modified: grass/trunk/include/Make/Html.make
===================================================================
--- grass/trunk/include/Make/Html.make 2008-08-23 21:08:33 UTC (rev 33037)
+++ grass/trunk/include/Make/Html.make 2008-08-23 21:13:06 UTC (rev 33038)
@@ -1,7 +1,4 @@
-#NOTE: parts of the header are generated in ../../lib/gis/parser.c
-HTMLDIR = $(ARCH_DISTDIR)/docs/html
-
# generic html rules for all commands
ifdef CROSS_COMPILING
Modified: grass/trunk/include/Make/Lib.make
===================================================================
--- grass/trunk/include/Make/Lib.make 2008-08-23 21:08:33 UTC (rev 33037)
+++ grass/trunk/include/Make/Lib.make 2008-08-23 21:13:06 UTC (rev 33038)
@@ -4,21 +4,16 @@
#for i18N support
PACKAGE ="grasslibs"
-include $(MODULE_TOPDIR)/include/Make/Platform.make
-include $(MODULE_TOPDIR)/include/Make/Grass.make
+include $(MODULE_TOPDIR)/include/Make/Vars.make
+include $(MODULE_TOPDIR)/include/Make/Rules.make
+include $(MODULE_TOPDIR)/include/Make/Html.make
+include $(MODULE_TOPDIR)/include/Make/Compile.make
-ifndef LIB_OBJS
-LIB_OBJS := $(subst .c,.o,$(wildcard *.c))
-endif
-
-ARCH_LIB_OBJS := $(foreach obj,$(LIB_OBJS),$(OBJDIR)/$(obj))
-
STLIB_NAME = $(LIB_NAME)
-STLIB_OBJS = $(ARCH_LIB_OBJS)
+STLIB_OBJS = $(ARCH_OBJS)
SHLIB_NAME = $(LIB_NAME)
-SHLIB_OBJS = $(ARCH_LIB_OBJS)
+SHLIB_OBJS = $(ARCH_OBJS)
-include $(MODULE_TOPDIR)/include/Make/Rules.make
include $(MODULE_TOPDIR)/include/Make/Stlib.make
include $(MODULE_TOPDIR)/include/Make/Shlib.make
Modified: grass/trunk/include/Make/Module.make
===================================================================
--- grass/trunk/include/Make/Module.make 2008-08-23 21:08:33 UTC (rev 33037)
+++ grass/trunk/include/Make/Module.make 2008-08-23 21:13:06 UTC (rev 33038)
@@ -5,13 +5,14 @@
HTMLSRC = $(BIN)/$(PGM)$(EXE)
-include $(MODULE_TOPDIR)/include/Make/Platform.make
-include $(MODULE_TOPDIR)/include/Make/Grass.make
+include $(MODULE_TOPDIR)/include/Make/Vars.make
include $(MODULE_TOPDIR)/include/Make/Rules.make
+include $(MODULE_TOPDIR)/include/Make/Html.make
+include $(MODULE_TOPDIR)/include/Make/Compile.make
cmd: $(BIN)/$(PGM)$(EXE) html
-$(BIN)/$(PGM)$(EXE): $(ARCH_CMD_OBJS) $(DEPENDENCIES)
- $(LINK) $(LDFLAGS) $(XTRA_LDFLAGS) -o $@ $(ARCH_CMD_OBJS) $(FMODE_OBJ) $(LIBES) $(MATHLIB) $(XDRLIB)
+$(BIN)/$(PGM)$(EXE): $(ARCH_OBJS) $(DEPENDENCIES)
+ $(call linker)
.PHONY: cmd
Modified: grass/trunk/include/Make/Multi.make
===================================================================
--- grass/trunk/include/Make/Multi.make 2008-08-23 21:08:33 UTC (rev 33037)
+++ grass/trunk/include/Make/Multi.make 2008-08-23 21:13:06 UTC (rev 33038)
@@ -1,9 +1,10 @@
PACKAGE = "grassmods"
-include $(MODULE_TOPDIR)/include/Make/Platform.make
-include $(MODULE_TOPDIR)/include/Make/Grass.make
+include $(MODULE_TOPDIR)/include/Make/Vars.make
include $(MODULE_TOPDIR)/include/Make/Rules.make
+include $(MODULE_TOPDIR)/include/Make/Html.make
+include $(MODULE_TOPDIR)/include/Make/Compile.make
PROGFILES = $(patsubst %,$(BIN)/%$(EXE),$(PROGRAMS))
HTMLFILES = $(patsubst %,$(HTMLDIR)/%.html,$(PROGRAMS))
@@ -15,7 +16,7 @@
htmlmulti: $(HTMLFILES)
$(BIN)/%$(EXE): $(DEPENDENCIES)
- $(LINK) $(LDFLAGS) $(XTRA_LDFLAGS) -o $@ $(filter %.o,$^) $(FMODE_OBJ) $(LIBES) $(MATHLIB) $(XDRLIB)
+ $(call linker)
define objs_rule
$(BIN)/$(1)$(EXE): $$(patsubst %.o,$(OBJDIR)/%.o,$$($$(subst .,_,$(1)_OBJS)))
Added: grass/trunk/include/Make/Other.make
===================================================================
--- grass/trunk/include/Make/Other.make (rev 0)
+++ grass/trunk/include/Make/Other.make 2008-08-23 21:13:06 UTC (rev 33038)
@@ -0,0 +1,4 @@
+include $(MODULE_TOPDIR)/include/Make/Vars.make
+include $(MODULE_TOPDIR)/include/Make/Rules.make
+include $(MODULE_TOPDIR)/include/Make/Html.make
+
Modified: grass/trunk/include/Make/Rules.make
===================================================================
--- grass/trunk/include/Make/Rules.make 2008-08-23 21:08:33 UTC (rev 33037)
+++ grass/trunk/include/Make/Rules.make 2008-08-23 21:13:06 UTC (rev 33038)
@@ -1,75 +1,27 @@
-# lexical analyzer and default options
-LEXFLAGS= -d -i -s -t
-# parser generator and default options
-YACCFLAGS = -d -v -t
+# first found target
+first: pre default
-ifndef LOCAL_HEADERS
-LOCAL_HEADERS = $(wildcard *.h)
-endif
+# create platform dirs
+ARCH_DIRS = $(ARCH_DISTDIR) $(ARCH_BINDIR) $(ARCH_INCDIR) $(ARCH_LIBDIR) \
+ $(BIN) $(ETC) \
+ $(DRIVERDIR) $(DBDRIVERDIR) $(FONTDIR) $(DOCSDIR) $(HTMLDIR)
-# for i18N support
-DEFS=-DPACKAGE=\"$(PACKAGE)\"
-NLS_CFLAGS=$(DEFS)
+pre: $(ARCH_DIRS)
-MOD_OBJS := $(subst .c,.o,$(wildcard *.c)) $(subst .cpp,.o,$(wildcard *.cpp)) $(subst .cc,.o,$(wildcard *.cc))
-CMD_OBJS = $(MOD_OBJS)
-ARCH_CMD_OBJS = $(patsubst %.o,$(OBJDIR)/%.o,$(CMD_OBJS))
+$(ARCH_DIRS):
+ $(MKDIR) $@
$(OBJDIR):
-test -d $(OBJDIR) || $(MKDIR) $(OBJDIR)
-ifndef BROKEN_MAKE
-ifneq ($(MAKE_VERSION),3.81)
-BROKEN_MAKE=1
-endif
-endif
-
-LINK = $(CC)
-
-# default cc rules
-ifeq ($(BROKEN_MAKE),)
-$(OBJDIR)/%.o : %.c $(LOCAL_HEADERS) $(EXTRA_HEADERS) | $(OBJDIR)
- $(CC) $(CFLAGS) $(EXTRA_CFLAGS) $(NLS_CFLAGS) $(EXTRA_INC) $(INC) -o $@ -c $<
-
-$(OBJDIR)/%.o : %.cc $(LOCAL_HEADERS) $(EXTRA_HEADERS) | $(OBJDIR)
- $(CXX) $(CXXFLAGS) $(EXTRA_CFLAGS) $(NLS_CFLAGS) $(EXTRA_INC) $(INC) -o $@ -c $<
-
-$(OBJDIR)/%.o : %.cpp $(LOCAL_HEADERS) $(EXTRA_HEADERS) | $(OBJDIR)
- $(CXX) $(CXXFLAGS) $(EXTRA_CFLAGS) $(NLS_CFLAGS) $(EXTRA_INC) $(INC) -o $@ -c $<
-else
-$(OBJDIR)/%.o : %.c $(LOCAL_HEADERS) $(EXTRA_HEADERS)
- $(MAKE) $(OBJDIR)
- $(CC) $(CFLAGS) $(EXTRA_CFLAGS) $(NLS_CFLAGS) $(EXTRA_INC) $(INC) -o $@ -c $<
-
-$(OBJDIR)/%.o : %.cc $(LOCAL_HEADERS) $(EXTRA_HEADERS)
- $(MAKE) $(OBJDIR)
- $(CXX) $(CXXFLAGS) $(EXTRA_CFLAGS) $(NLS_CFLAGS) $(EXTRA_INC) $(INC) -o $@ -c $<
-
-$(OBJDIR)/%.o : %.cpp $(LOCAL_HEADERS) $(EXTRA_HEADERS)
- $(MAKE) $(OBJDIR)
- $(CXX) $(CXXFLAGS) $(EXTRA_CFLAGS) $(NLS_CFLAGS) $(EXTRA_INC) $(INC) -o $@ -c $<
-endif
-
-# default parser generation rules, include prefix for files/vars
-%.yy.c: %.l
- $(LEX) -P$* $(LEXFLAGS) $*.l | \
- $(SED) -e 's/unistd.h/limits.h/g' \
- > $@
-
-%.tab.h %.tab.c: %.y
- $(YACC) -b$* -p$* $(YACCFLAGS) $<
-
-
# default clean rules
clean:
-rm -rf $(OBJDIR) $(EXTRA_CLEAN_DIRS)
- -rm -f $(EXTRA_CLEAN_FILES) *.tmp.html
+ -rm -f $(EXTRA_CLEAN_FILES) *.tab.[ch] *.yy.c *.output *.backup *.tmp.html
-if [ "$(CLEAN_SUBDIRS)" != "" ] ; then \
for dir in $(CLEAN_SUBDIRS) ; do \
$(MAKE) -C $$dir clean ; \
done ; \
fi
-# HTML page rules:
-include $(MODULE_TOPDIR)/include/Make/Html.make
Modified: grass/trunk/include/Make/Script.make
===================================================================
--- grass/trunk/include/Make/Script.make 2008-08-23 21:08:33 UTC (rev 33037)
+++ grass/trunk/include/Make/Script.make 2008-08-23 21:13:06 UTC (rev 33038)
@@ -8,9 +8,9 @@
HTMLSRC = $(SCRIPT)
-include $(MODULE_TOPDIR)/include/Make/Platform.make
-include $(MODULE_TOPDIR)/include/Make/Grass.make
+include $(MODULE_TOPDIR)/include/Make/Vars.make
include $(MODULE_TOPDIR)/include/Make/Rules.make
+include $(MODULE_TOPDIR)/include/Make/Html.make
SCRIPT_ACTIONS = $(SCRIPT) html scriptstrings
ifdef MINGW
Modified: grass/trunk/include/Make/Shlib.make
===================================================================
--- grass/trunk/include/Make/Shlib.make 2008-08-23 21:08:33 UTC (rev 33037)
+++ grass/trunk/include/Make/Shlib.make 2008-08-23 21:13:06 UTC (rev 33038)
@@ -7,7 +7,7 @@
LDFLAGS += $(SHLIB_LDFLAGS)
$(SHLIB): $(SHLIB_OBJS)
- $(SHLIB_LD) -o $@ $(LDFLAGS) $^ $(EXTRA_LIBS) && \
+ $(SHLIB_LD) -o $@ $(LDFLAGS) $^ $(LIBES) $(EXTRA_LIBS) && \
(cd $(ARCH_LIBDIR); ln -f -s $(notdir $@) $(patsubst %.$(GRASS_VERSION_NUMBER)$(SHLIB_SUFFIX),%$(SHLIB_SUFFIX),$@))
shlib: $(SHLIB)
Added: grass/trunk/include/Make/Vars.make
===================================================================
--- grass/trunk/include/Make/Vars.make (rev 0)
+++ grass/trunk/include/Make/Vars.make 2008-08-23 21:13:06 UTC (rev 33038)
@@ -0,0 +1,32 @@
+include $(MODULE_TOPDIR)/include/Make/Platform.make
+include $(MODULE_TOPDIR)/include/Make/Grass.make
+
+ifndef BROKEN_MAKE
+ifneq ($(MAKE_VERSION),3.81)
+BROKEN_MAKE=1
+endif
+endif
+
+C_SOURCES := $(wildcard *.c)
+CC_SOURCES := $(wildcard *.cc)
+CPP_SOURCES := $(wildcard *.cpp)
+LEX_SOURCES := $(wildcard *.l)
+YACC_SOURCES := $(wildcard *.y)
+
+AUTO_OBJS := \
+ $(subst .c,.o,$(C_SOURCES)) \
+ $(subst .cc,.o,$(CC_SOURCES)) \
+ $(subst .cpp,.o,$(CPP_SOURCES)) \
+ $(subst .l,.yy.o,$(LEX_SOURCES)) \
+ $(subst .y,.tab.o,$(YACC_SOURCES))
+
+ifndef MOD_OBJS
+MOD_OBJS = $(AUTO_OBJS)
+endif
+
+ARCH_OBJS = $(patsubst %.o,$(OBJDIR)/%.o,$(MOD_OBJS))
+
+LOCAL_HEADERS := $(wildcard *.h)
+
+LINK = $(CC)
+
Modified: grass/trunk/lib/Makefile
===================================================================
--- grass/trunk/lib/Makefile 2008-08-23 21:08:33 UTC (rev 33037)
+++ grass/trunk/lib/Makefile 2008-08-23 21:13:06 UTC (rev 33038)
@@ -1,5 +1,7 @@
MODULE_TOPDIR = ..
+include $(MODULE_TOPDIR)/include/Make/Vars.make
+
#order is relevant:
SUBDIRS = \
datetime \
@@ -36,19 +38,10 @@
cdhc \
stats \
arraystats \
- python
-
-include $(MODULE_TOPDIR)/include/Make/Platform.make
-
-OPENGLBASED = \
+ python \
ogsf \
nviz
-#compile if OPENGLBASED present:
-ifneq ($(strip $(OPENGLLIB)),)
- SUBDIRS += $(OPENGLBASED)
-endif
-
#compile if C++ compiler present:
ifneq ($(strip $(CXX)),)
SUBDIRS += iostream
@@ -73,5 +66,3 @@
for file in ../include/vect/*.h ; do $(INSTALL_DATA) $$file $(GISBASE)/include/grass/vect/ ; done
for file in ../include/iostream/*.h ; do $(INSTALL_DATA) $$file $(GISBASE)/include/grass/iostream/ ; done
for file in ../include/Make/*.make ; do $(INSTALL_DATA) $$file $(GISBASE)/include/Make/ ; done
-
-clean: cleansubdirs
Modified: grass/trunk/lib/bitmap/Makefile
===================================================================
--- grass/trunk/lib/bitmap/Makefile 2008-08-23 21:08:33 UTC (rev 33037)
+++ grass/trunk/lib/bitmap/Makefile 2008-08-23 21:13:06 UTC (rev 33038)
@@ -1,15 +1,15 @@
MODULE_TOPDIR = ../..
-EXTRA_LIBS=$(LINKMLIB)
+include $(MODULE_TOPDIR)/include/Make/Vars.make
+MOD_OBJS := bitmap.o sparse.o
+
LIB_NAME = $(BITMAP_LIBNAME)
-LIB_OBJS = \
- bitmap.o\
- sparse.o
-
include $(MODULE_TOPDIR)/include/Make/Lib.make
+EXTRA_LIBS = $(LINKMLIB)
+
default: lib
Modified: grass/trunk/lib/btree/Makefile
===================================================================
--- grass/trunk/lib/btree/Makefile 2008-08-23 21:08:33 UTC (rev 33037)
+++ grass/trunk/lib/btree/Makefile 2008-08-23 21:13:06 UTC (rev 33038)
@@ -1,19 +1,11 @@
-
MODULE_TOPDIR = ../..
-LIB_NAME = $(BTREE_LIBNAME)
+include $(MODULE_TOPDIR)/include/Make/Vars.make
-LIB_OBJS = \
- create.o\
- find.o\
- free.o\
- next.o\
- rewind.o\
- update.o
+MOD_OBJS := $(filter-out try.o,$(AUTO_OBJS))
+LIB_NAME = $(BTREE_LIBNAME)
+
include $(MODULE_TOPDIR)/include/Make/Lib.make
default: lib
-
-try: $(OBJDIR)/try.o $(BTREELIB)
- $(CC) $(LDFLAGS) $(OBJDIR)/try.o $(BTREELIB) -o $(OBJDIR)/try
Copied: grass/trunk/lib/btree/test/try.c (from rev 33017, grass/trunk/lib/btree/try.c)
===================================================================
--- grass/trunk/lib/btree/test/try.c (rev 0)
+++ grass/trunk/lib/btree/test/try.c 2008-08-23 21:13:06 UTC (rev 33038)
@@ -0,0 +1,58 @@
+
+/****************************************************************************
+ *
+ * MODULE: btree
+ * AUTHOR(S): CERL (present in ver 4.x)
+ * Radim Blazek <radim.blazek gmail.com>
+ * Glynn Clements <glynn gclements.plus.com>
+ * PURPOSE: balanced tree - possibly duplicating libavl functionality; see
+ * http://grass.itc.it/pipermail/grass-dev/2007-April/030396.html
+ * COPYRIGHT: (C) 2002-2007 by the GRASS Development Team
+ *
+ * This program is free software under the GNU General Public
+ * License (>=v2). Read the file COPYING that comes with GRASS
+ * for details.
+ *
+ *****************************************************************************/
+#include <stdio.h>
+#include <string.h>
+#include <grass/btree.h>
+
+static int cmp(const void *a, const void *b)
+{
+ return strcmp(a, b);
+}
+
+int main(void)
+{
+ char key[100], data[100];
+ void *k, *d;
+ BTREE B;
+
+ btree_create(&B, strcmp, 10);
+ while (1) {
+ fprintf(stdout, "enter key (or RETURN if done): ");
+ if (!gets(key))
+ exit(0);
+ if (*key == 0)
+ break;
+ fprintf(stdout, " ");
+ if (btree_find(&B, key, &d))
+ fprintf(stdout, "%s = %s\n", key, d);
+ else
+ fprintf(stdout, "%s - not found\n", key);
+ fprintf(stdout, " ");
+ fprintf(stdout, "enter new value (or RETURN if none): ");
+ if (!gets(data))
+ exit(0);
+ if (*data)
+ btree_update(&B, key, strlen(key) + 1, data, strlen(data) + 1);
+ }
+
+ fprintf(stdout, "final tree\n");
+ btree_rewind(&B);
+ while (btree_next(&B, &k, &d))
+ fprintf(stdout, "%s:%s\n", (const char *)k, (const char *)d);
+
+ return 0;
+}
Deleted: grass/trunk/lib/btree/try.c
===================================================================
--- grass/trunk/lib/btree/try.c 2008-08-23 21:08:33 UTC (rev 33037)
+++ grass/trunk/lib/btree/try.c 2008-08-23 21:13:06 UTC (rev 33038)
@@ -1,58 +0,0 @@
-
-/****************************************************************************
- *
- * MODULE: btree
- * AUTHOR(S): CERL (present in ver 4.x)
- * Radim Blazek <radim.blazek gmail.com>
- * Glynn Clements <glynn gclements.plus.com>
- * PURPOSE: balanced tree - possibly duplicating libavl functionality; see
- * http://grass.itc.it/pipermail/grass-dev/2007-April/030396.html
- * COPYRIGHT: (C) 2002-2007 by the GRASS Development Team
- *
- * This program is free software under the GNU General Public
- * License (>=v2). Read the file COPYING that comes with GRASS
- * for details.
- *
- *****************************************************************************/
-#include <stdio.h>
-#include <string.h>
-#include <grass/btree.h>
-
-static int cmp(const void *a, const void *b)
-{
- return strcmp(a, b);
-}
-
-int main(void)
-{
- char key[100], data[100];
- void *k, *d;
- BTREE B;
-
- btree_create(&B, strcmp, 10);
- while (1) {
- fprintf(stdout, "enter key (or RETURN if done): ");
- if (!gets(key))
- exit(0);
- if (*key == 0)
- break;
- fprintf(stdout, " ");
- if (btree_find(&B, key, &d))
- fprintf(stdout, "%s = %s\n", key, d);
- else
- fprintf(stdout, "%s - not found\n", key);
- fprintf(stdout, " ");
- fprintf(stdout, "enter new value (or RETURN if none): ");
- if (!gets(data))
- exit(0);
- if (*data)
- btree_update(&B, key, strlen(key) + 1, data, strlen(data) + 1);
- }
-
- fprintf(stdout, "final tree\n");
- btree_rewind(&B);
- while (btree_next(&B, &k, &d))
- fprintf(stdout, "%s:%s\n", (const char *)k, (const char *)d);
-
- return 0;
-}
Modified: grass/trunk/lib/cdhc/Makefile
===================================================================
--- grass/trunk/lib/cdhc/Makefile 2008-08-23 21:08:33 UTC (rev 33037)
+++ grass/trunk/lib/cdhc/Makefile 2008-08-23 21:13:06 UTC (rev 33038)
@@ -2,17 +2,6 @@
LIB_NAME = $(CDHC_LIBNAME)
-LIB_OBJS = \
- dcmp.o \
- enormp.o normp.o xinormal.o \
- omnibus.o geary.o extreme.o dagstndn.o kuiprsvn.o \
- watsonun.o durbins.o andrsndn.o cvmw2n.o ksn.o \
- dmax.o dmaxe.o chisqn.o shapiro1.o shapiro2.o shapiroe.o \
- cvmw2e.o kse.o kuiprsve.o watsonue.o andrsnde.o \
- chisqe.o kotz.o \
- royston.o as181.o as177.o as241.o as66.o \
- weisberg.o
-
include $(MODULE_TOPDIR)/include/Make/Lib.make
default: lib
Deleted: grass/trunk/lib/cdhc/c-drive.c
===================================================================
--- grass/trunk/lib/cdhc/c-drive.c 2008-08-23 21:08:33 UTC (rev 33037)
+++ grass/trunk/lib/cdhc/c-drive.c 2008-08-23 21:13:06 UTC (rev 33038)
@@ -1,48 +0,0 @@
-#include <stdio.h>
-#include <stdlib.h>
-#include <grass/cdhc.h>
-
-
-int main(int argc, char **argv)
-{
- double x[1000];
- double *y;
- int n = 0;
-
- while (scanf("%lf", &x[n++]) != EOF) ;
- n--;
-
- fprintf(stdout, "N=%d\n", n);
- fprintf(stdout, "*y=%ld\n", y);
- y = omnibus_moments(x, n);
- fprintf(stdout, "*y=%ld\n", y);
- y = geary_test(x, n);
- fprintf(stdout, "*y=%ld\n", y);
- y = dagostino_d(x, n);
- fprintf(stdout, "y=%g\n", y[1]);
- y = kuipers_v(x, n);
- y = watson_u2(x, n);
- y = durbins_exact(x, n);
- y = anderson_darling(x, n);
- y = cramer_von_mises(x, n);
-
- /* for ks and lillefors, the discrepancy seems to come
- in in computing the sum of x*x */
-
- y = kolmogorov_smirnov(x, n);
- y = chi_square(x, n);
- y = shapiro_wilk(x, n);
- y = shapiro_francia(x, n);
- y = shapiro_wilk_exp(x, n);
- y = cramer_von_mises_exp(x, n);
- y = kolmogorov_smirnov_exp(x, n);
- y = kuipers_v_exp(x, n);
- y = watson_u2_exp(x, n);
- y = anderson_darling_exp(x, n);
- y = chi_square_exp(x, n);
- y = mod_maxlik_ratio(x, n);
- y = coeff_variation(x, n);
- y = kotz_families(x, n);
-
- return EXIT_SUCCESS;
-}
Copied: grass/trunk/lib/cdhc/c-drive.c.txt (from rev 33017, grass/trunk/lib/cdhc/c-drive.c)
===================================================================
--- grass/trunk/lib/cdhc/c-drive.c.txt (rev 0)
+++ grass/trunk/lib/cdhc/c-drive.c.txt 2008-08-23 21:13:06 UTC (rev 33038)
@@ -0,0 +1,48 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <grass/cdhc.h>
+
+
+int main(int argc, char **argv)
+{
+ double x[1000];
+ double *y;
+ int n = 0;
+
+ while (scanf("%lf", &x[n++]) != EOF) ;
+ n--;
+
+ fprintf(stdout, "N=%d\n", n);
+ fprintf(stdout, "*y=%ld\n", y);
+ y = omnibus_moments(x, n);
+ fprintf(stdout, "*y=%ld\n", y);
+ y = geary_test(x, n);
+ fprintf(stdout, "*y=%ld\n", y);
+ y = dagostino_d(x, n);
+ fprintf(stdout, "y=%g\n", y[1]);
+ y = kuipers_v(x, n);
+ y = watson_u2(x, n);
+ y = durbins_exact(x, n);
+ y = anderson_darling(x, n);
+ y = cramer_von_mises(x, n);
+
+ /* for ks and lillefors, the discrepancy seems to come
+ in in computing the sum of x*x */
+
+ y = kolmogorov_smirnov(x, n);
+ y = chi_square(x, n);
+ y = shapiro_wilk(x, n);
+ y = shapiro_francia(x, n);
+ y = shapiro_wilk_exp(x, n);
+ y = cramer_von_mises_exp(x, n);
+ y = kolmogorov_smirnov_exp(x, n);
+ y = kuipers_v_exp(x, n);
+ y = watson_u2_exp(x, n);
+ y = anderson_darling_exp(x, n);
+ y = chi_square_exp(x, n);
+ y = mod_maxlik_ratio(x, n);
+ y = coeff_variation(x, n);
+ y = kotz_families(x, n);
+
+ return EXIT_SUCCESS;
+}
Modified: grass/trunk/lib/datetime/Makefile
===================================================================
--- grass/trunk/lib/datetime/Makefile 2008-08-23 21:08:33 UTC (rev 33037)
+++ grass/trunk/lib/datetime/Makefile 2008-08-23 21:13:06 UTC (rev 33038)
@@ -3,32 +3,6 @@
LIB_NAME = $(DATETIME_LIBNAME)
-LIB_OBJS = \
- between.o \
- copy.o\
- same.o\
- diff.o\
- error.o \
- format.o\
- incr1.o\
- incr2.o\
- incr3.o\
- local.o\
- misc.o \
- change.o\
- scan.o\
- sign.o\
- type.o \
- tz1.o\
- tz2.o\
- values.o
-
include $(MODULE_TOPDIR)/include/Make/Lib.make
default: lib
-
-
-# $(LIB_OBJS): $(INCLUDE_DIR)/datetime.h $(INCLUDE_DIR)/P_datetime.h
-
-#proto:
-# make.proto *.c > P_datetime.h
Modified: grass/trunk/lib/db/Makefile
===================================================================
--- grass/trunk/lib/db/Makefile 2008-08-23 21:08:33 UTC (rev 33037)
+++ grass/trunk/lib/db/Makefile 2008-08-23 21:13:06 UTC (rev 33038)
@@ -17,7 +17,6 @@
default: parsubdirs
-clean: cleansubdirs
stubs: dbmi_base
Property changes on: grass/trunk/lib/db/sqlp
___________________________________________________________________
Name: svn:ignore
-
*OBJ*
y.tab.h
y.output
lex.yy.c
y.tab.c
+ *OBJ*
sqlp.tab.c
sqlp.tab.h
sqlp.output
sqlp.yy.c
Modified: grass/trunk/lib/db/sqlp/Makefile
===================================================================
--- grass/trunk/lib/db/sqlp/Makefile 2008-08-23 21:08:33 UTC (rev 33037)
+++ grass/trunk/lib/db/sqlp/Makefile 2008-08-23 21:13:06 UTC (rev 33038)
@@ -3,25 +3,12 @@
LIB_NAME = $(SQLP_LIBNAME)
PGM = sql
-LIB_OBJS = \
- alloc.o \
- print.o \
- sql.o \
- lex.yy.o \
- y.tab.o
-
-EXTRA_CLEAN_FILES = lex.yy.c y.tab.c y.output y.tab.h
-EXTRA_HEADERS = y.tab.h
-
include $(MODULE_TOPDIR)/include/Make/Lib.make
default: lib
-y.tab.c y.tab.h: yac.y
- $(YACC) -d -v yac.y
+$(OBJDIR)/sqlp.yy.o: sqlp.tab.h
-lex.yy.c: lex.l
- $(LEX) lex.l
+.INTERMEDIATE: sqlp.tab.c sqlp.tab.h sqlp.output
-$(OBJDIR)/lex.yy.o: lex.yy.c y.tab.h
-
+.INTERMEDIATE: sqlp.yy.c
Deleted: grass/trunk/lib/db/sqlp/lex.l
===================================================================
--- grass/trunk/lib/db/sqlp/lex.l 2008-08-23 21:08:33 UTC (rev 33037)
+++ grass/trunk/lib/db/sqlp/lex.l 2008-08-23 21:13:06 UTC (rev 33038)
@@ -1,268 +0,0 @@
-/*****************************************************************************
-*
-* MODULE: SQL statement parser library
-*
-* AUTHOR(S): lex.l and yac.y were originaly taken from unixODBC and
-* probably written by Peter Harvey <pharvey at codebydesigns.com>,
-* modifications and other code by Radim Blazek
-*
-* PURPOSE: Parse input string containing SQL statement to
-* SQLPSTMT structure.
-* SQL parser may be used by simple database drivers.
-*
-* COPYRIGHT: (C) 2000 by the GRASS Development Team
-*
-* This program is free software under the GNU General Public
-* License (>=v2). Read the file COPYING that comes with GRASS
-* for details.
-*
-*****************************************************************************/
-
-/**************** C-CODE *****************/
-
-%{
-#include <grass/sqlp.h>
-#include "y.tab.h"
-#include <string.h>
-
-#undef YY_INPUT
-#define YY_INPUT(b, r, ms) (r = my_yyinput(b, ms))
-
-%}
-
-/*************** LEX HEADER **************/
-
-%e 1200
-
-/**************** LEX BODY ****************/
-%%
-%{
- /***************************************
- * LITERALS KEYWORDS TOKENS
- ***************************************/
-
- /* following case insensitives are ugly
- but I do not know better at this time */
-%}
-[Aa][Dd][Dd] { return ADD; }
-[Aa][Ll][Tt][Ee][Rr] { return ALTER; }
-[Cc][Oo][Ll][Uu][Mm][Nn] { return COLUMN; }
-[Dd][Ee][Ll][Ee][Tt][Ee] { return DELETE; }
-[Ff][Rr][Oo][Mm] { return FROM; }
-[Ii][Nn][Ss][Ee][Rr][Tt] { return INSERT; }
-[Ii][Nn][Tt][Oo] { return INTO; }
-[Ss][Ee][Ll][Ee][Cc][Tt] { return SELECT; }
-[Ss][Ee][Tt] { return SET; }
-[Uu][Pp][Dd][Aa][Tt][Ee] { return UPDATE; }
-[Vv][Aa][Ll][Uu][Ee][Ss] { return VALUES; }
-[Ww][Hh][Ee][Rr][Ee] { return WHERE; }
-[Aa][Nn][Dd] { return AND; }
-[Cc][Rr][Ee][Aa][Tt][Ee] { return CREATE; }
-[Dd][Rr][Oo][Pp] { return DROP; }
-[Tt][Aa][Bb][Ll][Ee] { return TABLE; }
-[Nn][Uu][Ll][Ll] { return NULL_VALUE; }
-[Vv][Aa][Rr][Cc][Hh][Aa][Rr] { return VARCHAR; }
-[Ii][Nn][Tt] { return INT; }
-[Ii][Nn][Tt][Ee][Gg][Ee][Rr] { return INTEGER; }
-[Dd][Oo][Uu][Bb][Ll][Ee] { return DOUBLE; }
-[Pp][Rr][Ee][Cc][Ii][Ss][Ii][Oo][Nn] { return PRECISION; }
-[Dd][Aa][Tt][Ee] { return DATE; }
-[Tt][Ii][Mm][Ee] { return TIME; }
-[Oo][Rr] { return OR; }
-[Nn][Oo][Tt] { return NOT; }
-[Oo][Rr][Dd][Ee][Rr] { return ORDER; }
-[Bb][Yy] { return BY; }
-[Aa][Ss][Cc] { return ASC; }
-[Dd][Ee][Ss][Cc] { return DESC; }
-[Ii][Ss] { return IS; }
-[Ll][Ii][Kk][Ee] {
- yylval.strval = (char*)strdup("~");
- return COMPARISON_OPERATOR;
- }
-%{
- /* [Dd][Ii][Ss][Tt][Ii][Nn][Cc][Tt] { return DISTINCT; } */
- /***************************************
- * EQUAL
- ***************************************/
-%}
-"=" {
- return EQUAL;
- }
-%{
- /***************************************
- * COMPARISON OPERATOR
- ***************************************/
-%}
-"<>" |
-"<" |
-">" |
-"<=" |
-">=" |
-"~" {
- yylval.strval = (char*)strdup(yytext);
- return COMPARISON_OPERATOR;
- }
-%{
- /***************************************
- * PUNCTUATION
- ***************************************/
-%}
-[-+*/:(),.;] {
- yylval.strval = (char*)strdup(yytext);
- return yytext[0];
- }
-%{
- /***************************************
- * NAMES
- ***************************************/
-%}
-[A-Za-z][A-Za-z0-9_]* {
- yylval.strval = (char*)strdup(yytext);
- return NAME;
- }
-
-%{
- /***************************************
- * INTEGER
- ***************************************/
-%}
-[0-9]+ {
- yylval.intval = atoi(yytext);
- /* yylval.strval = (char*)strdup(yytext); */
- return INTNUM;
- }
-%{
- /***************************************
- * FLOATING POINT NUM
- ***************************************/
-%}
-"."[0-9]* |
-[0-9]+"."[0-9]* |
-[0-9]+[eE][+-]?[0-9]+ |
-[0-9]+"."[0-9]*[eE][+-]?[0-9]+ |
-"."[0-9]*[eE][+-]?[0-9]+ {
- yylval.floatval = atof(yytext);
- /* yylval.strval = (char*)strdup(yytext); */
- return FLOATNUM;
- }
-
-%{
- /***************************************
- * STRINGS (single quotes)
- ***************************************/
-%}
-'[^']*' {
- char *Buffer, *ptra, *ptrb;
- int c = input();
- int len;
-
- Buffer = (char*)strdup(yytext); /* store here because we lose it when unput() */
- unput( c ); /* just peeking - checking for a double quote... embedded quote */
-
- if ( c != '\'' )
- {
- len = strlen (Buffer);
- Buffer[len-1] = '\0';
- /* Hopefully replace all '' by ' */
- ptrb = Buffer + 1;
- while ( (ptra = strchr(ptrb, '\'')) != NULL ) {
- ptra++; ptrb = ptra;
- while ( ptra[1] != 0 ) { ptra[0] = ptra[1]; ptra++; }
- ptra[0] = 0;
- }
-
- yylval.strval = (char*)strdup(Buffer+1);
- free( Buffer );
- return STRING;
- }
- else
- {
- free( Buffer );
- yymore();
- }
- }
-%{
- /***************************************
- * STRINGS (unterminated)
- ***************************************/
-%}
-'[^'\n]*$ { yyerror("Unterminated string"); }
-%{
- /***************************************
- * NEW LINE (ignored)
- ***************************************/
-%}
-\n ;
-%{
- /***************************************
- * WHITE SPACE (ignored)
- ***************************************/
-%}
-[ \t\r]+ ; /* white space */
-%{
- /***************************************
- * COMMENTS (ignored)
- ***************************************/
-%}
-"--".*$ ; /* comment */
-
-%%
-/**********************************************************************
- *
- * C-CODE
- *
- **********************************************************************/
-
-
-
-/**********************************************************************
- * my_yyinput
- *
- * Lexer will ask this function for input when it requires more.
- *
- **********************************************************************/
-int my_yyinput(char *buf, int max_size)
-{
- int rest, n;
-
- rest = sqlpStmt->stmt + strlen( sqlpStmt->stmt) - sqlpStmt->cur;
- n = ( max_size < rest ? max_size : rest );
-
- if ( n > 0 )
- {
- memcpy( buf, sqlpStmt->cur, n );
- sqlpStmt->cur += n;
- }
-
- return n;
-}
-
-/**********************************************************************
- * yyerror
- *
- * This should be called just before failing. It formats a meaningfull
- * message and deposits it in a usefull place.
- *
- **********************************************************************/
-void yyerror( char *s )
-{
- snprintf( sqlpStmt->errmsg, 500, "%s processing '%s'", s, yytext );
-
-#ifdef YY_CURRENT_BUFFER
- yy_flush_buffer(YY_CURRENT_BUFFER);
-#endif
-
-}
-
-/**********************************************************************
- * yywrap
- *
- * We are not doing any buffer switching but lets not use the Flex version of
- * of this func anyway so we can avoid the link dependency.
- *
- **********************************************************************/
-int yywrap()
-{
- return 1;
-}
-
Copied: grass/trunk/lib/db/sqlp/sqlp.l (from rev 33017, grass/trunk/lib/db/sqlp/lex.l)
===================================================================
--- grass/trunk/lib/db/sqlp/sqlp.l (rev 0)
+++ grass/trunk/lib/db/sqlp/sqlp.l 2008-08-23 21:13:06 UTC (rev 33038)
@@ -0,0 +1,268 @@
+/*****************************************************************************
+*
+* MODULE: SQL statement parser library
+*
+* AUTHOR(S): lex.l and yac.y were originaly taken from unixODBC and
+* probably written by Peter Harvey <pharvey at codebydesigns.com>,
+* modifications and other code by Radim Blazek
+*
+* PURPOSE: Parse input string containing SQL statement to
+* SQLPSTMT structure.
+* SQL parser may be used by simple database drivers.
+*
+* COPYRIGHT: (C) 2000 by the GRASS Development Team
+*
+* This program is free software under the GNU General Public
+* License (>=v2). Read the file COPYING that comes with GRASS
+* for details.
+*
+*****************************************************************************/
+
+/**************** C-CODE *****************/
+
+%{
+#include <grass/sqlp.h>
+#include "sqlp.tab.h"
+#include <string.h>
+
+#undef YY_INPUT
+#define YY_INPUT(b, r, ms) (r = my_yyinput(b, ms))
+
+%}
+
+/*************** LEX HEADER **************/
+
+%e 1200
+
+/**************** LEX BODY ****************/
+%%
+%{
+ /***************************************
+ * LITERALS KEYWORDS TOKENS
+ ***************************************/
+
+ /* following case insensitives are ugly
+ but I do not know better at this time */
+%}
+[Aa][Dd][Dd] { return ADD; }
+[Aa][Ll][Tt][Ee][Rr] { return ALTER; }
+[Cc][Oo][Ll][Uu][Mm][Nn] { return COLUMN; }
+[Dd][Ee][Ll][Ee][Tt][Ee] { return DELETE; }
+[Ff][Rr][Oo][Mm] { return FROM; }
+[Ii][Nn][Ss][Ee][Rr][Tt] { return INSERT; }
+[Ii][Nn][Tt][Oo] { return INTO; }
+[Ss][Ee][Ll][Ee][Cc][Tt] { return SELECT; }
+[Ss][Ee][Tt] { return SET; }
+[Uu][Pp][Dd][Aa][Tt][Ee] { return UPDATE; }
+[Vv][Aa][Ll][Uu][Ee][Ss] { return VALUES; }
+[Ww][Hh][Ee][Rr][Ee] { return WHERE; }
+[Aa][Nn][Dd] { return AND; }
+[Cc][Rr][Ee][Aa][Tt][Ee] { return CREATE; }
+[Dd][Rr][Oo][Pp] { return DROP; }
+[Tt][Aa][Bb][Ll][Ee] { return TABLE; }
+[Nn][Uu][Ll][Ll] { return NULL_VALUE; }
+[Vv][Aa][Rr][Cc][Hh][Aa][Rr] { return VARCHAR; }
+[Ii][Nn][Tt] { return INT; }
+[Ii][Nn][Tt][Ee][Gg][Ee][Rr] { return INTEGER; }
+[Dd][Oo][Uu][Bb][Ll][Ee] { return DOUBLE; }
+[Pp][Rr][Ee][Cc][Ii][Ss][Ii][Oo][Nn] { return PRECISION; }
+[Dd][Aa][Tt][Ee] { return DATE; }
+[Tt][Ii][Mm][Ee] { return TIME; }
+[Oo][Rr] { return OR; }
+[Nn][Oo][Tt] { return NOT; }
+[Oo][Rr][Dd][Ee][Rr] { return ORDER; }
+[Bb][Yy] { return BY; }
+[Aa][Ss][Cc] { return ASC; }
+[Dd][Ee][Ss][Cc] { return DESC; }
+[Ii][Ss] { return IS; }
+[Ll][Ii][Kk][Ee] {
+ yylval.strval = (char*)strdup("~");
+ return COMPARISON_OPERATOR;
+ }
+%{
+ /* [Dd][Ii][Ss][Tt][Ii][Nn][Cc][Tt] { return DISTINCT; } */
+ /***************************************
+ * EQUAL
+ ***************************************/
+%}
+"=" {
+ return EQUAL;
+ }
+%{
+ /***************************************
+ * COMPARISON OPERATOR
+ ***************************************/
+%}
+"<>" |
+"<" |
+">" |
+"<=" |
+">=" |
+"~" {
+ yylval.strval = (char*)strdup(yytext);
+ return COMPARISON_OPERATOR;
+ }
+%{
+ /***************************************
+ * PUNCTUATION
+ ***************************************/
+%}
+[-+*/:(),.;] {
+ yylval.strval = (char*)strdup(yytext);
+ return yytext[0];
+ }
+%{
+ /***************************************
+ * NAMES
+ ***************************************/
+%}
+[A-Za-z][A-Za-z0-9_]* {
+ yylval.strval = (char*)strdup(yytext);
+ return NAME;
+ }
+
+%{
+ /***************************************
+ * INTEGER
+ ***************************************/
+%}
+[0-9]+ {
+ yylval.intval = atoi(yytext);
+ /* yylval.strval = (char*)strdup(yytext); */
+ return INTNUM;
+ }
+%{
+ /***************************************
+ * FLOATING POINT NUM
+ ***************************************/
+%}
+"."[0-9]* |
+[0-9]+"."[0-9]* |
+[0-9]+[eE][+-]?[0-9]+ |
+[0-9]+"."[0-9]*[eE][+-]?[0-9]+ |
+"."[0-9]*[eE][+-]?[0-9]+ {
+ yylval.floatval = atof(yytext);
+ /* yylval.strval = (char*)strdup(yytext); */
+ return FLOATNUM;
+ }
+
+%{
+ /***************************************
+ * STRINGS (single quotes)
+ ***************************************/
+%}
+'[^']*' {
+ char *Buffer, *ptra, *ptrb;
+ int c = input();
+ int len;
+
+ Buffer = (char*)strdup(yytext); /* store here because we lose it when unput() */
+ unput( c ); /* just peeking - checking for a double quote... embedded quote */
+
+ if ( c != '\'' )
+ {
+ len = strlen (Buffer);
+ Buffer[len-1] = '\0';
+ /* Hopefully replace all '' by ' */
+ ptrb = Buffer + 1;
+ while ( (ptra = strchr(ptrb, '\'')) != NULL ) {
+ ptra++; ptrb = ptra;
+ while ( ptra[1] != 0 ) { ptra[0] = ptra[1]; ptra++; }
+ ptra[0] = 0;
+ }
+
+ yylval.strval = (char*)strdup(Buffer+1);
+ free( Buffer );
+ return STRING;
+ }
+ else
+ {
+ free( Buffer );
+ yymore();
+ }
+ }
+%{
+ /***************************************
+ * STRINGS (unterminated)
+ ***************************************/
+%}
+'[^'\n]*$ { yyerror("Unterminated string"); }
+%{
+ /***************************************
+ * NEW LINE (ignored)
+ ***************************************/
+%}
+\n ;
+%{
+ /***************************************
+ * WHITE SPACE (ignored)
+ ***************************************/
+%}
+[ \t\r]+ ; /* white space */
+%{
+ /***************************************
+ * COMMENTS (ignored)
+ ***************************************/
+%}
+"--".*$ ; /* comment */
+
+%%
+/**********************************************************************
+ *
+ * C-CODE
+ *
+ **********************************************************************/
+
+
+
+/**********************************************************************
+ * my_yyinput
+ *
+ * Lexer will ask this function for input when it requires more.
+ *
+ **********************************************************************/
+int my_yyinput(char *buf, int max_size)
+{
+ int rest, n;
+
+ rest = sqlpStmt->stmt + strlen( sqlpStmt->stmt) - sqlpStmt->cur;
+ n = ( max_size < rest ? max_size : rest );
+
+ if ( n > 0 )
+ {
+ memcpy( buf, sqlpStmt->cur, n );
+ sqlpStmt->cur += n;
+ }
+
+ return n;
+}
+
+/**********************************************************************
+ * yyerror
+ *
+ * This should be called just before failing. It formats a meaningfull
+ * message and deposits it in a usefull place.
+ *
+ **********************************************************************/
+void yyerror( char *s )
+{
+ snprintf( sqlpStmt->errmsg, 500, "%s processing '%s'", s, yytext );
+
+#ifdef YY_CURRENT_BUFFER
+ yy_flush_buffer(YY_CURRENT_BUFFER);
+#endif
+
+}
+
+/**********************************************************************
+ * yywrap
+ *
+ * We are not doing any buffer switching but lets not use the Flex version of
+ * of this func anyway so we can avoid the link dependency.
+ *
+ **********************************************************************/
+int yywrap()
+{
+ return 1;
+}
+
Copied: grass/trunk/lib/db/sqlp/sqlp.y (from rev 33017, grass/trunk/lib/db/sqlp/yac.y)
===================================================================
--- grass/trunk/lib/db/sqlp/sqlp.y (rev 0)
+++ grass/trunk/lib/db/sqlp/sqlp.y 2008-08-23 21:13:06 UTC (rev 33038)
@@ -0,0 +1,301 @@
+/*****************************************************************************
+*
+* MODULE: SQL statement parser library
+*
+* AUTHOR(S): lex.l and yac.y were originaly taken from unixODBC and
+* probably written by Peter Harvey <pharvey at codebydesigns.com>,
+* modifications and other code by Radim Blazek
+*
+* PURPOSE: Parse input string containing SQL statement to
+* SQLPSTMT structure.
+* SQL parser may be used by simple database drivers.
+*
+* COPYRIGHT: (C) 2000 by the GRASS Development Team
+*
+* This program is free software under the GNU General Public
+* License (>=v2). Read the file COPYING that comes with GRASS
+* for details.
+*
+*****************************************************************************/
+
+%{
+#include <stdlib.h>
+#include <string.h>
+#include <math.h>
+#include <grass/sqlp.h>
+
+#define YYDEBUG 1
+#define YYERROR_VERBOSE 1
+
+%}
+
+ /* symbolic tokens */
+
+%union {
+ int intval;
+ double floatval;
+ char *strval;
+ int subtok;
+ SQLPNODE *node;
+}
+
+ /* operators */
+%type <node> y_column
+%type <node> y_value
+%type <node> y_atom
+%type <node> y_term
+%type <node> y_product
+%type <node> y_expression
+%type <node> y_comparison
+%type <node> y_boolean
+%type <node> y_sub_condition2
+%type <node> y_sub_condition
+%type <node> y_condition
+
+ /* literal keyword tokens */
+%token <strval> COMPARISON_OPERATOR
+%token <strval> NAME
+%token <strval> STRING
+%token <intval> INTNUM
+%token <floatval> FLOATNUM
+
+%token ADD
+%token DROP
+%token COLUMN
+%token EQUAL
+%token SELECT FROM WHERE
+%token DELETE
+%token INSERT INTO VALUES
+%token UPDATE SET
+%token AND
+%token OR
+%token NOT
+%token ALTER TABLE
+%token CREATE
+%token NULL_VALUE
+%token VARCHAR
+%token INT
+%token INTEGER
+%token DOUBLE
+%token PRECISION
+%token DATE
+%token TIME
+%token ORDER BY
+%token IS
+%token ASC
+%token DESC
+
+%{
+
+extern int yylex(void);
+
+%}
+
+%%
+
+y_sql:
+ y_alter
+ | y_create
+ | y_drop
+ | y_insert
+ | y_select
+ | y_update
+ | y_delete
+ | y_sql ';'
+ ;
+
+y_alter:
+ ALTER TABLE y_table ADD COLUMN y_columndef { sqpCommand(SQLP_ADD_COLUMN); }
+ | ALTER TABLE y_table ADD y_columndef { sqpCommand(SQLP_ADD_COLUMN); }
+ | ALTER TABLE y_table DROP COLUMN NAME { sqpCommand(SQLP_DROP_COLUMN); sqpColumn($6);}
+ ;
+
+y_create:
+ CREATE TABLE y_table '(' y_columndefs ')' { sqpCommand(SQLP_CREATE); }
+ ;
+
+y_drop:
+ DROP TABLE y_table { sqpCommand(SQLP_DROP); }
+ ;
+
+y_select:
+ SELECT y_columns FROM y_table { sqpCommand(SQLP_SELECT); }
+ | SELECT y_columns FROM y_table WHERE y_condition { sqpCommand(SQLP_SELECT); }
+ | SELECT y_columns FROM y_table ORDER BY y_order { sqpCommand(SQLP_SELECT); }
+ | SELECT y_columns FROM y_table WHERE y_condition ORDER BY y_order { sqpCommand(SQLP_SELECT); }
+ ;
+
+y_delete:
+ DELETE FROM y_table { sqpCommand(SQLP_DELETE); }
+ | DELETE FROM y_table WHERE y_condition { sqpCommand(SQLP_DELETE); }
+ ;
+
+y_insert:
+ INSERT INTO y_table y_values { sqpCommand(SQLP_INSERT); }
+ | INSERT INTO y_table '(' y_columns ')' y_values { sqpCommand(SQLP_INSERT); }
+ ;
+
+y_update:
+ UPDATE y_table SET y_assignments { sqpCommand(SQLP_UPDATE); }
+ | UPDATE y_table SET y_assignments WHERE y_condition { sqpCommand(SQLP_UPDATE); }
+
+ ;
+
+y_columndefs:
+ y_columndef
+ | y_columndefs ',' y_columndef
+ ;
+
+y_columndef:
+ NAME VARCHAR '(' INTNUM ')' { sqpColumnDef( $1, SQLP_VARCHAR, $4, 0 ); }
+ | NAME INT { sqpColumnDef( $1, SQLP_INTEGER, 0, 0 ); }
+ | NAME INTEGER { sqpColumnDef( $1, SQLP_INTEGER, 0, 0 ); }
+ | NAME DOUBLE { sqpColumnDef( $1, SQLP_DOUBLE, 0, 0 ); }
+ | NAME DOUBLE PRECISION { sqpColumnDef( $1, SQLP_DOUBLE, 0, 0 ); }
+ | NAME DATE { sqpColumnDef( $1, SQLP_DATE, 0, 0 ); }
+ | NAME TIME { sqpColumnDef( $1, SQLP_TIME, 0, 0 ); }
+ ;
+
+y_columns:
+ '*'
+ | y_column_list
+ ;
+
+y_column_list:
+ NAME { sqpColumn( $1 ); }
+ | y_column_list ',' NAME { sqpColumn( $3 ); }
+ ;
+
+y_table:
+ NAME { sqpTable( $1 ); }
+ ;
+
+y_values:
+ VALUES '(' y_value_list ')'
+ ;
+
+y_value_list:
+ NULL_VALUE { sqpValue( NULL, 0, 0.0, SQLP_NULL ); }
+ | STRING { sqpValue( $1, 0, 0.0, SQLP_S ); }
+ | INTNUM { sqpValue( NULL, $1, 0.0, SQLP_I ); }
+ | '-' INTNUM { sqpValue( NULL, -$2, 0.0, SQLP_I ); }
+ | FLOATNUM { sqpValue( NULL, 0, $1, SQLP_D ); }
+ | '-' FLOATNUM { sqpValue( NULL, 0, -$2, SQLP_D ); }
+ | y_value_list ',' NULL_VALUE { sqpValue( NULL, 0, 0.0, SQLP_NULL ); }
+ | y_value_list ',' STRING { sqpValue( $3, 0, 0.0, SQLP_S ); }
+ | y_value_list ',' INTNUM { sqpValue( NULL, $3, 0.0, SQLP_I ); }
+ | y_value_list ',' '-' INTNUM { sqpValue( NULL, -$4, 0.0, SQLP_I ); }
+ | y_value_list ',' FLOATNUM { sqpValue( NULL, 0, $3, SQLP_D ); }
+ | y_value_list ',' '-' FLOATNUM { sqpValue( NULL, 0, -$4, SQLP_D ); }
+ ;
+
+y_assignments:
+ y_assignment
+ | y_assignments ',' y_assignment
+ ;
+
+y_assignment:
+ NAME EQUAL NULL_VALUE { sqpAssignment( $1, NULL, 0, 0.0, NULL, SQLP_NULL ); }
+/* | NAME EQUAL STRING { sqpAssignment( $1, $3, 0, 0.0, NULL, SQLP_S ); }
+ | NAME EQUAL INTNUM { sqpAssignment( $1, NULL, $3, 0.0, NULL, SQLP_I ); }
+ | NAME EQUAL FLOATNUM { sqpAssignment( $1, NULL, 0, $3, NULL, SQLP_D ); }
+*/ | NAME EQUAL y_expression { sqpAssignment( $1, NULL, 0, 0.0, $3, SQLP_EXPR ); }
+ ;
+
+y_condition:
+ y_sub_condition {
+ $$ = $1;
+ sqlpStmt->upperNodeptr = $$;
+ }
+ ;
+
+y_sub_condition:
+ y_sub_condition2 { $$ = $1; }
+ | y_sub_condition OR y_sub_condition2 { $$ = sqpNewExpressionNode (SQLP_OR, $1, $3); }
+ ;
+
+y_sub_condition2:
+ y_boolean { $$ = $1; }
+ | y_sub_condition2 AND y_boolean { $$ = sqpNewExpressionNode (SQLP_AND, $1, $3); }
+ ;
+
+y_boolean:
+ y_comparison { $$ = $1; }
+ | '(' y_sub_condition ')' { $$ = $2; }
+ | NOT y_boolean { $$ = sqpNewExpressionNode ( SQLP_NOT, NULL, $2); }
+ ;
+
+/* Note EQUAL should be one of COMPARISON but there is maybe some reason ... */
+y_comparison:
+ y_expression EQUAL y_expression {
+ $$ = sqpNewExpressionNode ( SQLP_EQ, $1, $3);
+ }
+ | y_expression COMPARISON_OPERATOR y_expression {
+ $$ = sqpNewExpressionNode ( sqpOperatorCode($2), $1, $3);
+ }
+ | y_expression IS NULL_VALUE {
+ $$ = sqpNewExpressionNode ( SQLP_ISNULL, NULL, $1);
+ }
+ | y_expression NOT NULL_VALUE {
+ $$ = sqpNewExpressionNode ( SQLP_NOTNULL, NULL, $1);
+ }
+ ;
+
+/* Mathematical expression */
+y_expression:
+ y_product { $$ = $1; }
+ | y_expression '+' y_product {
+ $$ = sqpNewExpressionNode ( sqpOperatorCode("+"), $1, $3 );
+ }
+ | y_expression '-' y_product {
+ $$ = sqpNewExpressionNode ( sqpOperatorCode("-"), $1, $3 );
+ }
+ ;
+
+y_product:
+ y_term { $$ = $1; }
+ | y_product '*' y_term {
+ $$ = sqpNewExpressionNode ( sqpOperatorCode("*"), $1, $3 );
+ }
+ | y_product '/' y_term {
+ $$ = sqpNewExpressionNode ( sqpOperatorCode("/"), $1, $3 );
+ }
+ ;
+
+y_term:
+ y_atom { $$ = $1; }
+ | '-' y_term {
+ $$ = sqpNewExpressionNode ( sqpOperatorCode("-"), sqpNewValueNode ( NULL, 0, 0.0, SQLP_I ), $2 );
+ }
+ ;
+
+y_atom:
+ y_value { $$ = $1; }
+ | y_column { $$ = $1; }
+ | '(' y_expression ')' { $$ = $2; }
+ ;
+
+/* Value used in expressions */
+y_value:
+ STRING { $$ = sqpNewValueNode ( $1, 0, 0.0, SQLP_S ); }
+ | INTNUM { $$ = sqpNewValueNode ( NULL, $1, 0.0, SQLP_I ); }
+ | FLOATNUM { $$ = sqpNewValueNode ( NULL, 0, $1, SQLP_D ); }
+ ;
+
+/* Column used in expressions */
+y_column:
+ NAME {$$ = sqpNewColumnNode ( $1 );}
+ ;
+
+y_order: y_order_asc | y_order_desc;
+
+y_order_asc:
+ NAME { sqpOrderColumn( $1, SORT_ASC ); }
+ | NAME ASC { sqpOrderColumn( $1, SORT_ASC ); }
+ ;
+y_order_desc:
+ NAME DESC { sqpOrderColumn( $1, SORT_DESC ); }
+ ;
+%%
+
+
Modified: grass/trunk/lib/db/sqlp/test/Makefile
===================================================================
--- grass/trunk/lib/db/sqlp/test/Makefile 2008-08-23 21:08:33 UTC (rev 33037)
+++ grass/trunk/lib/db/sqlp/test/Makefile 2008-08-23 21:13:06 UTC (rev 33038)
@@ -1,9 +1,7 @@
MODULE_TOPDIR = ../../../..
-include $(MODULE_TOPDIR)/include/Make/Platform.make
-include $(MODULE_TOPDIR)/include/Make/Grass.make
-include $(MODULE_TOPDIR)/include/Make/Rules.make
+include $(MODULE_TOPDIR)/include/Make/Other.make
LIBES = $(SQLPLIB) $(DBMILIB) $(GISLIB) $(LEXLIB)
Deleted: grass/trunk/lib/db/sqlp/yac.y
===================================================================
--- grass/trunk/lib/db/sqlp/yac.y 2008-08-23 21:08:33 UTC (rev 33037)
+++ grass/trunk/lib/db/sqlp/yac.y 2008-08-23 21:13:06 UTC (rev 33038)
@@ -1,301 +0,0 @@
-/*****************************************************************************
-*
-* MODULE: SQL statement parser library
-*
-* AUTHOR(S): lex.l and yac.y were originaly taken from unixODBC and
-* probably written by Peter Harvey <pharvey at codebydesigns.com>,
-* modifications and other code by Radim Blazek
-*
-* PURPOSE: Parse input string containing SQL statement to
-* SQLPSTMT structure.
-* SQL parser may be used by simple database drivers.
-*
-* COPYRIGHT: (C) 2000 by the GRASS Development Team
-*
-* This program is free software under the GNU General Public
-* License (>=v2). Read the file COPYING that comes with GRASS
-* for details.
-*
-*****************************************************************************/
-
-%{
-#include <stdlib.h>
-#include <string.h>
-#include <math.h>
-#include <grass/sqlp.h>
-
-#define YYDEBUG 1
-#define YYERROR_VERBOSE 1
-
-%}
-
- /* symbolic tokens */
-
-%union {
- int intval;
- double floatval;
- char *strval;
- int subtok;
- SQLPNODE *node;
-}
-
- /* operators */
-%type <node> y_column
-%type <node> y_value
-%type <node> y_atom
-%type <node> y_term
-%type <node> y_product
-%type <node> y_expression
-%type <node> y_comparison
-%type <node> y_boolean
-%type <node> y_sub_condition2
-%type <node> y_sub_condition
-%type <node> y_condition
-
- /* literal keyword tokens */
-%token <strval> COMPARISON_OPERATOR
-%token <strval> NAME
-%token <strval> STRING
-%token <intval> INTNUM
-%token <floatval> FLOATNUM
-
-%token ADD
-%token DROP
-%token COLUMN
-%token EQUAL
-%token SELECT FROM WHERE
-%token DELETE
-%token INSERT INTO VALUES
-%token UPDATE SET
-%token AND
-%token OR
-%token NOT
-%token ALTER TABLE
-%token CREATE
-%token NULL_VALUE
-%token VARCHAR
-%token INT
-%token INTEGER
-%token DOUBLE
-%token PRECISION
-%token DATE
-%token TIME
-%token ORDER BY
-%token IS
-%token ASC
-%token DESC
-
-%{
-
-extern int yylex(void);
-
-%}
-
-%%
-
-y_sql:
- y_alter
- | y_create
- | y_drop
- | y_insert
- | y_select
- | y_update
- | y_delete
- | y_sql ';'
- ;
-
-y_alter:
- ALTER TABLE y_table ADD COLUMN y_columndef { sqpCommand(SQLP_ADD_COLUMN); }
- | ALTER TABLE y_table ADD y_columndef { sqpCommand(SQLP_ADD_COLUMN); }
- | ALTER TABLE y_table DROP COLUMN NAME { sqpCommand(SQLP_DROP_COLUMN); sqpColumn($6);}
- ;
-
-y_create:
- CREATE TABLE y_table '(' y_columndefs ')' { sqpCommand(SQLP_CREATE); }
- ;
-
-y_drop:
- DROP TABLE y_table { sqpCommand(SQLP_DROP); }
- ;
-
-y_select:
- SELECT y_columns FROM y_table { sqpCommand(SQLP_SELECT); }
- | SELECT y_columns FROM y_table WHERE y_condition { sqpCommand(SQLP_SELECT); }
- | SELECT y_columns FROM y_table ORDER BY y_order { sqpCommand(SQLP_SELECT); }
- | SELECT y_columns FROM y_table WHERE y_condition ORDER BY y_order { sqpCommand(SQLP_SELECT); }
- ;
-
-y_delete:
- DELETE FROM y_table { sqpCommand(SQLP_DELETE); }
- | DELETE FROM y_table WHERE y_condition { sqpCommand(SQLP_DELETE); }
- ;
-
-y_insert:
- INSERT INTO y_table y_values { sqpCommand(SQLP_INSERT); }
- | INSERT INTO y_table '(' y_columns ')' y_values { sqpCommand(SQLP_INSERT); }
- ;
-
-y_update:
- UPDATE y_table SET y_assignments { sqpCommand(SQLP_UPDATE); }
- | UPDATE y_table SET y_assignments WHERE y_condition { sqpCommand(SQLP_UPDATE); }
-
- ;
-
-y_columndefs:
- y_columndef
- | y_columndefs ',' y_columndef
- ;
-
-y_columndef:
- NAME VARCHAR '(' INTNUM ')' { sqpColumnDef( $1, SQLP_VARCHAR, $4, 0 ); }
- | NAME INT { sqpColumnDef( $1, SQLP_INTEGER, 0, 0 ); }
- | NAME INTEGER { sqpColumnDef( $1, SQLP_INTEGER, 0, 0 ); }
- | NAME DOUBLE { sqpColumnDef( $1, SQLP_DOUBLE, 0, 0 ); }
- | NAME DOUBLE PRECISION { sqpColumnDef( $1, SQLP_DOUBLE, 0, 0 ); }
- | NAME DATE { sqpColumnDef( $1, SQLP_DATE, 0, 0 ); }
- | NAME TIME { sqpColumnDef( $1, SQLP_TIME, 0, 0 ); }
- ;
-
-y_columns:
- '*'
- | y_column_list
- ;
-
-y_column_list:
- NAME { sqpColumn( $1 ); }
- | y_column_list ',' NAME { sqpColumn( $3 ); }
- ;
-
-y_table:
- NAME { sqpTable( $1 ); }
- ;
-
-y_values:
- VALUES '(' y_value_list ')'
- ;
-
-y_value_list:
- NULL_VALUE { sqpValue( NULL, 0, 0.0, SQLP_NULL ); }
- | STRING { sqpValue( $1, 0, 0.0, SQLP_S ); }
- | INTNUM { sqpValue( NULL, $1, 0.0, SQLP_I ); }
- | '-' INTNUM { sqpValue( NULL, -$2, 0.0, SQLP_I ); }
- | FLOATNUM { sqpValue( NULL, 0, $1, SQLP_D ); }
- | '-' FLOATNUM { sqpValue( NULL, 0, -$2, SQLP_D ); }
- | y_value_list ',' NULL_VALUE { sqpValue( NULL, 0, 0.0, SQLP_NULL ); }
- | y_value_list ',' STRING { sqpValue( $3, 0, 0.0, SQLP_S ); }
- | y_value_list ',' INTNUM { sqpValue( NULL, $3, 0.0, SQLP_I ); }
- | y_value_list ',' '-' INTNUM { sqpValue( NULL, -$4, 0.0, SQLP_I ); }
- | y_value_list ',' FLOATNUM { sqpValue( NULL, 0, $3, SQLP_D ); }
- | y_value_list ',' '-' FLOATNUM { sqpValue( NULL, 0, -$4, SQLP_D ); }
- ;
-
-y_assignments:
- y_assignment
- | y_assignments ',' y_assignment
- ;
-
-y_assignment:
- NAME EQUAL NULL_VALUE { sqpAssignment( $1, NULL, 0, 0.0, NULL, SQLP_NULL ); }
-/* | NAME EQUAL STRING { sqpAssignment( $1, $3, 0, 0.0, NULL, SQLP_S ); }
- | NAME EQUAL INTNUM { sqpAssignment( $1, NULL, $3, 0.0, NULL, SQLP_I ); }
- | NAME EQUAL FLOATNUM { sqpAssignment( $1, NULL, 0, $3, NULL, SQLP_D ); }
-*/ | NAME EQUAL y_expression { sqpAssignment( $1, NULL, 0, 0.0, $3, SQLP_EXPR ); }
- ;
-
-y_condition:
- y_sub_condition {
- $$ = $1;
- sqlpStmt->upperNodeptr = $$;
- }
- ;
-
-y_sub_condition:
- y_sub_condition2 { $$ = $1; }
- | y_sub_condition OR y_sub_condition2 { $$ = sqpNewExpressionNode (SQLP_OR, $1, $3); }
- ;
-
-y_sub_condition2:
- y_boolean { $$ = $1; }
- | y_sub_condition2 AND y_boolean { $$ = sqpNewExpressionNode (SQLP_AND, $1, $3); }
- ;
-
-y_boolean:
- y_comparison { $$ = $1; }
- | '(' y_sub_condition ')' { $$ = $2; }
- | NOT y_boolean { $$ = sqpNewExpressionNode ( SQLP_NOT, NULL, $2); }
- ;
-
-/* Note EQUAL should be one of COMPARISON but there is maybe some reason ... */
-y_comparison:
- y_expression EQUAL y_expression {
- $$ = sqpNewExpressionNode ( SQLP_EQ, $1, $3);
- }
- | y_expression COMPARISON_OPERATOR y_expression {
- $$ = sqpNewExpressionNode ( sqpOperatorCode($2), $1, $3);
- }
- | y_expression IS NULL_VALUE {
- $$ = sqpNewExpressionNode ( SQLP_ISNULL, NULL, $1);
- }
- | y_expression NOT NULL_VALUE {
- $$ = sqpNewExpressionNode ( SQLP_NOTNULL, NULL, $1);
- }
- ;
-
-/* Mathematical expression */
-y_expression:
- y_product { $$ = $1; }
- | y_expression '+' y_product {
- $$ = sqpNewExpressionNode ( sqpOperatorCode("+"), $1, $3 );
- }
- | y_expression '-' y_product {
- $$ = sqpNewExpressionNode ( sqpOperatorCode("-"), $1, $3 );
- }
- ;
-
-y_product:
- y_term { $$ = $1; }
- | y_product '*' y_term {
- $$ = sqpNewExpressionNode ( sqpOperatorCode("*"), $1, $3 );
- }
- | y_product '/' y_term {
- $$ = sqpNewExpressionNode ( sqpOperatorCode("/"), $1, $3 );
- }
- ;
-
-y_term:
- y_atom { $$ = $1; }
- | '-' y_term {
- $$ = sqpNewExpressionNode ( sqpOperatorCode("-"), sqpNewValueNode ( NULL, 0, 0.0, SQLP_I ), $2 );
- }
- ;
-
-y_atom:
- y_value { $$ = $1; }
- | y_column { $$ = $1; }
- | '(' y_expression ')' { $$ = $2; }
- ;
-
-/* Value used in expressions */
-y_value:
- STRING { $$ = sqpNewValueNode ( $1, 0, 0.0, SQLP_S ); }
- | INTNUM { $$ = sqpNewValueNode ( NULL, $1, 0.0, SQLP_I ); }
- | FLOATNUM { $$ = sqpNewValueNode ( NULL, 0, $1, SQLP_D ); }
- ;
-
-/* Column used in expressions */
-y_column:
- NAME {$$ = sqpNewColumnNode ( $1 );}
- ;
-
-y_order: y_order_asc | y_order_desc;
-
-y_order_asc:
- NAME { sqpOrderColumn( $1, SORT_ASC ); }
- | NAME ASC { sqpOrderColumn( $1, SORT_ASC ); }
- ;
-y_order_desc:
- NAME DESC { sqpOrderColumn( $1, SORT_DESC ); }
- ;
-%%
-
-
Modified: grass/trunk/lib/driver/Makefile
===================================================================
--- grass/trunk/lib/driver/Makefile 2008-08-23 21:08:33 UTC (rev 33037)
+++ grass/trunk/lib/driver/Makefile 2008-08-23 21:13:06 UTC (rev 33038)
@@ -1,6 +1,6 @@
MODULE_TOPDIR = ../..
-include $(MODULE_TOPDIR)/include/Make/Platform.make
+include $(MODULE_TOPDIR)/include/Make/Vars.make
EXTRA_CFLAGS=$(FTINC)
EXTRA_LIBS=$(GISLIB) $(FTLIB) $(ICONVLIB)
Modified: grass/trunk/lib/external/Makefile
===================================================================
--- grass/trunk/lib/external/Makefile 2008-08-23 21:08:33 UTC (rev 33037)
+++ grass/trunk/lib/external/Makefile 2008-08-23 21:13:06 UTC (rev 33038)
@@ -9,5 +9,4 @@
default: parsubdirs
-clean: cleansubdirs
Modified: grass/trunk/lib/external/bwidget/Makefile
===================================================================
--- grass/trunk/lib/external/bwidget/Makefile 2008-08-23 21:08:33 UTC (rev 33037)
+++ grass/trunk/lib/external/bwidget/Makefile 2008-08-23 21:13:06 UTC (rev 33038)
@@ -1,7 +1,6 @@
MODULE_TOPDIR = ../../..
-include $(MODULE_TOPDIR)/include/Make/Platform.make
-include $(MODULE_TOPDIR)/include/Make/Grass.make
+include $(MODULE_TOPDIR)/include/Make/Other.make
default:
if [ ! -d $(GISBASE)/bwidget ]; then $(MKDIR) $(GISBASE)/bwidget; fi
@@ -10,5 +9,3 @@
for file in images/*.* ; do $(INSTALL_DATA) $$file $(GISBASE)/bwidget/images/ ; done
for file in lang/*.* ; do $(INSTALL_DATA) $$file $(GISBASE)/bwidget/lang/ ; done
for file in *.tcl *.txt README.grass ; do $(INSTALL_DATA) $$file $(GISBASE)/bwidget/ ; done
-
-clean:
Modified: grass/trunk/lib/fonts/Makefile
===================================================================
--- grass/trunk/lib/fonts/Makefile 2008-08-23 21:08:33 UTC (rev 33037)
+++ grass/trunk/lib/fonts/Makefile 2008-08-23 21:13:06 UTC (rev 33038)
@@ -8,5 +8,4 @@
default: parsubdirs
-clean: cleansubdirs
Modified: grass/trunk/lib/fonts/fonts/Makefile
===================================================================
--- grass/trunk/lib/fonts/fonts/Makefile 2008-08-23 21:08:33 UTC (rev 33037)
+++ grass/trunk/lib/fonts/fonts/Makefile 2008-08-23 21:13:06 UTC (rev 33038)
@@ -1,9 +1,7 @@
MODULE_TOPDIR = ../../..
-include $(MODULE_TOPDIR)/include/Make/Platform.make
-include $(MODULE_TOPDIR)/include/Make/Grass.make
-include $(MODULE_TOPDIR)/include/Make/Rules.make
+include $(MODULE_TOPDIR)/include/Make/Other.make
SRCFONTS := $(wildcard hersh.oc?)
SRCMAPS := $(wildcard *.hmp)
Modified: grass/trunk/lib/form/Makefile
===================================================================
--- grass/trunk/lib/form/Makefile 2008-08-23 21:08:33 UTC (rev 33037)
+++ grass/trunk/lib/form/Makefile 2008-08-23 21:13:06 UTC (rev 33038)
@@ -1,48 +1,39 @@
MODULE_TOPDIR = ../..
-EXTRA_LIBS=$(GISLIB) $(DBMILIB)
+include $(MODULE_TOPDIR)/include/Make/Vars.make
+MOD_OBJS = generate.o open.o
+
LIB_NAME = $(FORM_LIBNAME)
-FORMDIR=$(GISBASE)/etc/form
+include $(MODULE_TOPDIR)/include/Make/Lib.make
-HTMLLIB=$(FORMDIR)/html_library.tcl
+EXTRA_LIBS=$(GISLIB) $(DBMILIB)
+EXTRA_CFLAGS = $(XCFLAGS) $(TCLINCDIR) $(TKINCDIR)
+
+FORMDIR=$(GISBASE)/etc/form
FORM=$(FORMDIR)/form.tcl
FORMPROG=$(FORMDIR)/form
-EXTRA_CFLAGS = $(XCFLAGS) $(TCLINCDIR) $(TKINCDIR)
+HTMLLIB=$(FORMDIR)/html_library.tcl
-include $(MODULE_TOPDIR)/include/Make/Platform.make
-
-LIB_OBJS = generate.o open.o
ifneq ($(TCLTKLIBS),)
GTCLTKFORM = $(HTMLLIB) $(FORM) $(FORMPROG)
endif
-include $(MODULE_TOPDIR)/include/Make/Lib.make
-
default: lib $(GTCLTKFORM)
$(FORMDIR):
if [ ! -d $@ ]; then $(MKDIR) $@; fi
-ifneq ($(BROKEN_MAKE),)
-$(HTMLLIB): html_library_grass.tcl $(FORMDIR)
-else
-$(HTMLLIB): html_library_grass.tcl | $(FORMDIR)
-endif
+$(HTMLLIB): html_library_grass.tcl
+ $(MAKE) $(FORMDIR)
$(INSTALL_DATA) $< $@
-ifneq ($(BROKEN_MAKE),)
-$(FORM): form.tcl $(FORMDIR)
-else
-$(FORM): form.tcl | $(FORMDIR)
-endif
+$(FORM): form.tcl
+ $(MAKE) $(FORMDIR)
$(INSTALL_DATA) $< $@
-ifneq ($(BROKEN_MAKE),)
-$(FORMPROG): $(OBJDIR)/form.o $(FORMDIR)
-else
-$(FORMPROG): $(OBJDIR)/form.o | $(FORMDIR)
-endif
+$(FORMPROG): $(OBJDIR)/form.o
+ $(MAKE) $(FORMDIR)
$(CC) $(LDFLAGS) -o $@ $(OBJDIR)/form.o $(DBMILIB) $(GISLIB) $(DATETIMELIB) \
$(TCLTKLIBPATH) $(TCLTKLIBS) $(MATHLIB) $(XDRLIB)
Modified: grass/trunk/lib/gtcltk/Makefile
===================================================================
--- grass/trunk/lib/gtcltk/Makefile 2008-08-23 21:08:33 UTC (rev 33037)
+++ grass/trunk/lib/gtcltk/Makefile 2008-08-23 21:13:06 UTC (rev 33038)
@@ -1,16 +1,11 @@
MODULE_TOPDIR = ../..
-include $(MODULE_TOPDIR)/include/Make/Platform.make
-include $(MODULE_TOPDIR)/include/Make/Grass.make
-include $(MODULE_TOPDIR)/include/Make/Rules.make
+PGM=grocat
+include $(MODULE_TOPDIR)/include/Make/Etc.make
+include $(MODULE_TOPDIR)/include/Make/NoHtml.make
-default: $(ETC)/gtcltk $(ETC)/grocat$(EXE)
+default: etc $(ETC)/gtcltk
$(ETC)/gtcltk: *.tcl
if [ ! -d $(ETC)/gtcltk ]; then $(MKDIR) $(ETC)/gtcltk; fi
for file in *.tcl ; do $(INSTALL_DATA) $$file $(ETC)/gtcltk/ ; done
-
-$(ETC)/grocat$(EXE): $(OBJDIR)/grocat.o
- $(CC) $(LDFLAGS) $(OBJDIR)/grocat.o -o $@
-
-clean:
Modified: grass/trunk/lib/init/Makefile
===================================================================
--- grass/trunk/lib/init/Makefile 2008-08-23 21:08:33 UTC (rev 33037)
+++ grass/trunk/lib/init/Makefile 2008-08-23 21:13:06 UTC (rev 33038)
@@ -16,14 +16,19 @@
MODULE_TOPDIR = ../..
-include $(MODULE_TOPDIR)/include/Make/Platform.make
-include $(MODULE_TOPDIR)/include/Make/Grass.make
-include $(MODULE_TOPDIR)/include/Make/Rules.make
+include $(MODULE_TOPDIR)/include/Make/Other.make
+include $(MODULE_TOPDIR)/include/Make/Compile.make
START_UP=grass$(GRASS_VERSION_MAJOR)$(GRASS_VERSION_MINOR)
-EXTRA_CFLAGS = -DD_LOCATION_NAME=\"$(DEFAULT_LOCATION)\" -DD_GISDBASE=\"$(DEFAULT_DATABASE)\" -DGRASS_VERSION_NUMBER=\"'$(GRASS_VERSION_NUMBER)'\" -DGRASS_VERSION_UPDATE_PKG=\"'$(GRASS_VERSION_UPDATE_PKG)'\"
+EXTRA_CFLAGS = \
+ -DD_LOCATION_NAME=\"$(DEFAULT_LOCATION)\" \
+ -DD_GISDBASE=\"$(DEFAULT_DATABASE)\" \
+ -DGRASS_VERSION_NUMBER=\"'$(GRASS_VERSION_NUMBER)'\" \
+ -DGRASS_VERSION_UPDATE_PKG=\"'$(GRASS_VERSION_UPDATE_PKG)'\"
+LIBES = $(GISLIB) $(DATETIMELIB)
+
FILES = \
$(ARCH_BINDIR)/$(START_UP) \
$(ETC)/Init.sh \
@@ -39,28 +44,23 @@
$(ETC)/gis_set.tcl \
$(ETC)/epsg_option.tcl \
$(ETC)/file_option.tcl \
- $(ETC)/grass-run.sh \
- $(ETC)/grass-xterm-wrapper
+ $(HTMLDIR)/variables.html \
+ $(HTMLDIR)/grass7.html \
+ $(HTMLDIR)/helptext.html \
+ $(HTMLDIR)/help_loc_struct.png
ifeq ($(findstring darwin,$(ARCH)),darwin)
FILES += \
- $(ETC)/grass-xterm-mac \
$(ETC)/html_browser_mac.sh
endif
ifneq ($(strip $(MINGW)),)
FILES += \
$(ARCH_BINDIR)/$(START_UP).bat \
- $(ETC)/Init.bat \
- $(ETC)/grass-run.bat
+ $(ETC)/Init.bat
endif
default: $(FILES)
- $(MKDIR) $(GISBASE)/docs/html
- $(INSTALL_DATA) variables.html $(GISBASE)/docs/html/variables.html
- $(INSTALL_DATA) grass7.html $(GISBASE)/docs/html/grass7.html
- $(INSTALL_DATA) helptext.html $(GISBASE)/docs/html/helptext.html
- $(INSTALL_DATA) help_loc_struct.png $(GISBASE)/docs/html/help_loc_struct.png
$(ARCH_BINDIR)/$(START_UP): init.sh grass.src
@test -d $(ARCH_BINDIR) || (echo 'ARCH_DISTDIR($(ARCH_BINDIR))' not found; exit 1)
@@ -102,79 +102,25 @@
$< > $@"
chmod +x $@
-$(ETC)/echo$(EXE): $(OBJDIR)/echo.o
- $(CC) $(LDFLAGS) $(OBJDIR)/echo.o -o $@
+$(ETC)/echo$(EXE) $(ETC)/run$(EXE): $(ETC)/%$(EXE): $(OBJDIR)/%.o
+ $(CC) $(LDFLAGS) $< -o $@
-$(ETC)/clean_temp$(EXE): $(OBJDIR)/clean_temp.o
- $(CC) $(LDFLAGS) $(OBJDIR)/clean_temp.o $(GISLIB) $(DATETIMELIB) $(MATHLIB) $(XDRLIB) -o $@
+$(ETC)/clean_temp$(EXE) $(ETC)/lock$(EXE): $(ETC)/%$(EXE): $(OBJDIR)/%.o
+ $(call linker)
-$(ETC)/run$(EXE): $(OBJDIR)/run.o
- $(CC) $(LDFLAGS) $(OBJDIR)/run.o -o $@
-
-$(ETC)/lock$(EXE): $(OBJDIR)/lock.o
- $(CC) $(LDFLAGS) $(OBJDIR)/lock.o $(GISLIB) $(DATETIMELIB) $(MATHLIB) $(XDRLIB) -o $@
-
-$(BIN)/exit:
- touch $@
- chmod 600 $@
-
$(ETC)/VERSIONNUMBER:
rm -f $@
echo "$(GRASS_VERSION_NUMBER)" > $@
chmod +r $@
-$(ETC)/grass_intro: grass_intro.txt version.sed
+$(ETC)/grass_intro $(ETC)/license $(ETC)/welcome: $(ETC)/%: %.txt version.sed
rm -f $@
- sh ./version.sed "$(GRASS_VERSION_NUMBER)" "$(GRASS_VERSION_DATE)" "$(GRASS_VERSION_UPDATE_PKG)" grass_intro.txt > $@
+ sh ./version.sed "$(GRASS_VERSION_NUMBER)" "$(GRASS_VERSION_DATE)" "$(GRASS_VERSION_UPDATE_PKG)" $< > $@
chmod +r $@
-$(ETC)/license: license.txt version.sed
- rm -f $@
- sh ./version.sed "$(GRASS_VERSION_NUMBER)" "$(GRASS_VERSION_DATE)" "$(GRASS_VERSION_UPDATE_PKG)" license.txt > $@
- chmod +r $@
+$(HTMLDIR)/%: %
+ $(INSTALL_DATA) $< $@
-$(ETC)/welcome: welcome.txt version.sed
- rm -f $@
- sh ./version.sed "$(GRASS_VERSION_NUMBER)" "$(GRASS_VERSION_DATE)" "$(GRASS_VERSION_UPDATE_PKG)" welcome.txt > $@
- chmod +r $@
+$(ETC)/%: %
+ $(INSTALL) $< $@
-$(ETC)/msgs: msgs
- rm -rf $@
- $(MKDIR) $@
- $(INSTALL_DATA) msgs/*.msg $@
-
-$(ETC)/gis_set.tcl: gis_set.tcl
- rm -f $@
- $(INSTALL) gis_set.tcl $(ETC)
-
-$(ETC)/epsg_option.tcl: epsg_option.tcl
- rm -f $@
- $(INSTALL) epsg_option.tcl $(ETC)
-
-$(ETC)/file_option.tcl: file_option.tcl
- rm -f $@
- $(INSTALL) file_option.tcl $(ETC)
-
-$(ETC)/grass-run.sh: grass-run.src
- rm -f $@
- $(SHELL) -c "sed \
- -e \"s#LD_LIBRARY_PATH_VAR#$(LD_LIBRARY_PATH_VAR)#g\" \
- grass-run.src > $@"
- chmod +x $@
-
-$(ETC)/grass-run.bat: grass-run.bat
- $(INSTALL) grass-run.bat $(ETC)
-
-$(ETC)/grass-xterm-wrapper: grass-xterm-wrapper
- $(INSTALL) grass-xterm-wrapper $(ETC)
-
-$(ETC)/grass-xterm-mac: grass-xterm-mac
- $(INSTALL) grass-xterm-mac $(ETC)
-
-$(ETC)/prompt.sh: prompt.sh
- rm -f $@
- $(INSTALL) prompt.sh $(ETC)
-
-$(ETC)/html_browser_mac.sh: html_browser_mac.sh
- $(INSTALL) html_browser_mac.sh $(ETC)
-
Deleted: grass/trunk/lib/init/grass-run.src
===================================================================
--- grass/trunk/lib/init/grass-run.src 2008-08-23 21:08:33 UTC (rev 33037)
+++ grass/trunk/lib/init/grass-run.src 2008-08-23 21:13:06 UTC (rev 33038)
@@ -1,38 +0,0 @@
-#!/bin/sh
-# script to launch GRASS commands
-
-# change console title to name of module
-if [ "$TERM" = "xterm" ] && [ -n "$BASH" ] ; then
- TITLE="GRASS: $1"
- echo -e "\033]0;${TITLE}\007\c"
-fi
-
-
-# force command line startup mode
-GRASS_UI_TERM=1
-export GRASS_UI_TERM
-
-
-# workaround for systems with xterm is setuid/setgid
-# http://grass.itc.it/pipermail/grass5/2004-September/015409.html
-LD_LIBRARY_PATH_VAR=$GRASS_LD_LIBRARY_PATH
-export LD_LIBRARY_PATH_VAR
-
-echo
-echo "================================================================="
-echo "If you wish to resize the X monitor, do so now. Window size is"
-echo "locked while interactive modules are running."
-echo "================================================================="
-echo
-
-# run command
-"$@"
-
-EXIT_VAL=$?
-if [ $EXIT_VAL -ne 0 ] ; then
- echo
- echo "ERROR: $1 exited abnormally. Press <enter> to continue."
- read
-fi
-
-exit $EXIT_VAL
Deleted: grass/trunk/lib/init/grass-xterm-wrapper
===================================================================
--- grass/trunk/lib/init/grass-xterm-wrapper 2008-08-23 21:08:33 UTC (rev 33037)
+++ grass/trunk/lib/init/grass-xterm-wrapper 2008-08-23 21:13:06 UTC (rev 33038)
@@ -1,21 +0,0 @@
-#!/bin/sh
-# script to wrap xterm
-
-if [ -z "$GRASS_XTERM" ] ; then
- # find a working xterm or xterm compatible executable
- TERM_TRY="xterm rxvt x-terminal-emulator"
- for TERM_PROG in $TERM_TRY ; do
- if [ -x "`which $TERM_PROG`" ] ; then
- GRASS_XTERM="$TERM_PROG"
- break
- fi
- done
- if [ -z "$GRASS_XTERM" ] ; then
- # no luck, use a default
- g.message -w "No terminal program found, trying xterm"
- GRASS_XTERM=xterm
- fi
-fi
-
-# run command
-exec "$GRASS_XTERM" "$@"
Modified: grass/trunk/lib/iostream/Makefile
===================================================================
--- grass/trunk/lib/iostream/Makefile 2008-08-23 21:08:33 UTC (rev 33037)
+++ grass/trunk/lib/iostream/Makefile 2008-08-23 21:13:06 UTC (rev 33038)
@@ -1,6 +1,5 @@
MODULE_TOPDIR = ../..
-LIB_OBJS = mm.o mm_utils.o ami_stream.o rtimer.o
LIB_NAME = $(IOSTREAM_LIBNAME)
include $(MODULE_TOPDIR)/include/Make/Lib.make
Modified: grass/trunk/lib/linkm/Makefile
===================================================================
--- grass/trunk/lib/linkm/Makefile 2008-08-23 21:08:33 UTC (rev 33037)
+++ grass/trunk/lib/linkm/Makefile 2008-08-23 21:13:06 UTC (rev 33038)
@@ -3,19 +3,6 @@
LIB_NAME = $(LINKM_LIBNAME)
-LIB_OBJS = \
- init.o\
- new.o\
- next.o\
- oom.o\
- dispose.o
-
include $(MODULE_TOPDIR)/include/Make/Lib.make
default: lib
-
-try: try.o $(LINKMLIB)
- $(CC) $(LDFLAGS) try.o $(LINKMLIB) -o try
-
-try2: try2.o $(LINKMLIB)
- $(CC) $(LDFLAGS) try2.o $(LINKMLIB) -o try2
Deleted: grass/trunk/lib/linkm/destroy.c
===================================================================
--- grass/trunk/lib/linkm/destroy.c 2008-08-23 21:08:33 UTC (rev 33037)
+++ grass/trunk/lib/linkm/destroy.c 2008-08-23 21:13:06 UTC (rev 33038)
@@ -1,17 +0,0 @@
-/*
- ** Written by David Gerdes US Army Construction Engineering Research Lab
- ** April 1992
- ** Copyright 1992 USA-CERL All rights reserved.
- **
- */
-#include <grass/linkm.h>
-
-
-void link_destroy(struct link_head *Head, VOID_T * ptr)
-{
- if (NULL == ptr)
- return;
-
- link__set_next(ptr, Head->Unused); /* ptr->next = Unused */
- Head->Unused = ptr; /* Unused = ptr */
-}
Deleted: grass/trunk/lib/linkm/linkm.c
===================================================================
--- grass/trunk/lib/linkm/linkm.c 2008-08-23 21:08:33 UTC (rev 33037)
+++ grass/trunk/lib/linkm/linkm.c 2008-08-23 21:13:06 UTC (rev 33038)
@@ -1,53 +0,0 @@
-
-/*
- ** Written by David Gerdes US Army Construction Engineering Research Lab
- ** April 1992
- ** Copyright 1992 USA-CERL All rights reserved.
- **
- */
-
-/*
- ** takes 1st command line argument and stuffs each letter of it into
- ** a linked list. then prints it back out to stdout.
- ** If a second argument is specified, the first argument is put in the
- ** list backwards.
- */
-#include <stdio.h>
-#include <grass/linkm.h>
-
-struct link
-{
- char let;
- struct link *next;
-};
-
-int main(int argc, char *argv[])
-{
- register int i;
- VOID_T *head;
- struct link List, *tmp, *p;
- int rev = 0;
-
-
- /*
- List.next = NULL;
- List.let = ' ';
- */
-
-
- head = (VOID_T *) link_init(sizeof(struct link));
-
-
- for (i = 0; i < 2000000; i++) {
- /*
- p = (struct link *) malloc (sizeof (struct link));
- free (p);
- */
- p = (struct link *)link_new(head);
- link_destroy(head, p);
- }
-
- link_cleanup(head);
-
- exit(0);
-}
Deleted: grass/trunk/lib/linkm/malloc.c
===================================================================
--- grass/trunk/lib/linkm/malloc.c 2008-08-23 21:08:33 UTC (rev 33037)
+++ grass/trunk/lib/linkm/malloc.c 2008-08-23 21:13:06 UTC (rev 33038)
@@ -1,38 +0,0 @@
-/*
- ** Written by David Gerdes US Army Construction Engineering Research Lab
- ** April 1992
- ** Copyright 1992 USA-CERL All rights reserved.
- **
- */
-
-/*
- ** takes 1st command line argument and stuffs each letter of it into
- ** a linked list. then prints it back out to stdout.
- ** If a second argument is specified, the first argument is put in the
- ** list backwards.
- */
-#include <stdio.h>
-#include <grass/linkm.h>
-
-struct link
-{
- char let;
- struct link *next;
-};
-
-int main(int argc, char *argv[])
-{
- register int i;
- VOID_T *head;
- struct link List, *tmp, *p;
- int rev = 0;
-
-
- for (i = 0; i < 2000000; i++) {
- p = (struct link *)malloc(sizeof(struct link));
- free(p);
- }
-
-
- exit(0);
-}
Deleted: grass/trunk/lib/linkm/speed.c
===================================================================
--- grass/trunk/lib/linkm/speed.c 2008-08-23 21:08:33 UTC (rev 33037)
+++ grass/trunk/lib/linkm/speed.c 2008-08-23 21:13:06 UTC (rev 33038)
@@ -1,53 +0,0 @@
-/*
- ** Written by David Gerdes US Army Construction Engineering Research Lab
- ** April 1992
- ** Copyright 1992 USA-CERL All rights reserved.
- **
- */
-
-/*
- ** This is a simple best case performance comparison between linkm and malloc
- */
-#include <stdio.h>
-#include <grass/linkm.h>
-
-struct link
-{
- char let;
- struct link *next;
-};
-
-/*
- #define LINKM
- */
-
-int main(int argc, char *argv[])
-{
- register int i;
- VOID_T *head;
- struct link List, *tmp, *p;
- int rev = 0;
-
-
-
-#ifdef LINKM
- head = (VOID_T *) link_init(sizeof(struct link));
-#endif
-
-
- for (i = 0; i < 2000000; i++) {
-#ifdef LINKM
- p = (struct link *)link_new(head);
- link_dispose(head, p);
-#else
- p = (struct link *)malloc(sizeof(struct link));
- free(p);
-#endif
- }
-
-#ifdef LINKM
- link_cleanup(head);
-#endif
-
- exit(0);
-}
Deleted: grass/trunk/lib/linkm/speed2.c
===================================================================
--- grass/trunk/lib/linkm/speed2.c 2008-08-23 21:08:33 UTC (rev 33037)
+++ grass/trunk/lib/linkm/speed2.c 2008-08-23 21:13:06 UTC (rev 33038)
@@ -1,69 +0,0 @@
-
-
-/*
- ** Written by David Gerdes US Army Construction Engineering Research Lab
- ** April 1992
- ** Copyright 1992 USA-CERL All rights reserved.
- **
- */
-
-/*
- ** This is a simple worst case performance comparison between linkm and malloc
- */
-#include <stdio.h>
-#include <grass/linkm.h>
-
-struct link
-{
- char let;
- struct link *next;
-};
-
-/*
- #define LINKM
- */
-
-int main(int argc, char *argv[])
-{
- register int i;
- VOID_T *head;
- struct link List, *tmp, *p;
- int rev = 0;
-
-
- tmp = &List;
-
-#ifdef LINKM
- /* link_set_chunk_size (2000); */
- head = (VOID_T *) link_init(sizeof(struct link));
-#endif
-
-
- for (i = 0; i < 2000000; i++) {
-#ifdef LINKM
- p = (struct link *)link_new(head);
-#else
- p = (struct link *)malloc(sizeof(struct link));
-#endif
- tmp->next = p;
- tmp = p;
- tmp->next = NULL;
- }
-
- for (p = List.next; p != NULL;) {
- tmp = p->next;
-#ifdef LINKM
- link_dispose(head, p);
-#else
- free(p);
-#endif
- p = tmp;
- }
-
-
-#ifdef LINKM
- link_cleanup(head);
-#endif
-
- exit(0);
-}
Deleted: grass/trunk/lib/linkm/speed3.c
===================================================================
--- grass/trunk/lib/linkm/speed3.c 2008-08-23 21:08:33 UTC (rev 33037)
+++ grass/trunk/lib/linkm/speed3.c 2008-08-23 21:13:06 UTC (rev 33038)
@@ -1,68 +0,0 @@
-/*
- ** Written by David Gerdes US Army Construction Engineering Research Lab
- ** April 1992
- ** Copyright 1992 USA-CERL All rights reserved.
- **
- */
-
-/*
- ** This is a simple performance comparison between linkm and malloc
- ** I think it better simulates normal use of the library than
- ** speed.c or speed2.c
- */
-#include <stdio.h>
-#include <grass/linkm.h>
-
-struct link
-{
- char let;
- struct link *next;
-};
-
-#define LINKM
-
-int main(int argc, char *argv[])
-{
- register int i, j;
- VOID_T *head;
- struct link List, *tmp, *p;
-
-
-
-#ifdef LINKM
- head = (VOID_T *) link_init(sizeof(struct link));
-#endif
-
-
- for (j = 0; j < 1000; j++) {
- tmp = &List;
-
- for (i = 0; i < 2000; i++) {
-#ifdef LINKM
- p = (struct link *)link_new(head);
-#else
- p = (struct link *)malloc(sizeof(struct link));
-#endif
- tmp->next = p;
- tmp = p;
- tmp->next = NULL;
- }
-
- for (p = List.next; p != NULL;) {
- tmp = p->next;
-#ifdef LINKM
- link_dispose(head, p);
-#else
- free(p);
-#endif
- p = tmp;
- }
- }
-
-
-#ifdef LINKM
- link_cleanup(head);
-#endif
-
- exit(0);
-}
Copied: grass/trunk/lib/linkm/test/linkm.c (from rev 33017, grass/trunk/lib/linkm/linkm.c)
===================================================================
--- grass/trunk/lib/linkm/test/linkm.c (rev 0)
+++ grass/trunk/lib/linkm/test/linkm.c 2008-08-23 21:13:06 UTC (rev 33038)
@@ -0,0 +1,53 @@
+
+/*
+ ** Written by David Gerdes US Army Construction Engineering Research Lab
+ ** April 1992
+ ** Copyright 1992 USA-CERL All rights reserved.
+ **
+ */
+
+/*
+ ** takes 1st command line argument and stuffs each letter of it into
+ ** a linked list. then prints it back out to stdout.
+ ** If a second argument is specified, the first argument is put in the
+ ** list backwards.
+ */
+#include <stdio.h>
+#include <grass/linkm.h>
+
+struct link
+{
+ char let;
+ struct link *next;
+};
+
+int main(int argc, char *argv[])
+{
+ register int i;
+ VOID_T *head;
+ struct link List, *tmp, *p;
+ int rev = 0;
+
+
+ /*
+ List.next = NULL;
+ List.let = ' ';
+ */
+
+
+ head = (VOID_T *) link_init(sizeof(struct link));
+
+
+ for (i = 0; i < 2000000; i++) {
+ /*
+ p = (struct link *) malloc (sizeof (struct link));
+ free (p);
+ */
+ p = (struct link *)link_new(head);
+ link_destroy(head, p);
+ }
+
+ link_cleanup(head);
+
+ exit(0);
+}
Copied: grass/trunk/lib/linkm/test/malloc.c (from rev 33017, grass/trunk/lib/linkm/malloc.c)
===================================================================
--- grass/trunk/lib/linkm/test/malloc.c (rev 0)
+++ grass/trunk/lib/linkm/test/malloc.c 2008-08-23 21:13:06 UTC (rev 33038)
@@ -0,0 +1,38 @@
+/*
+ ** Written by David Gerdes US Army Construction Engineering Research Lab
+ ** April 1992
+ ** Copyright 1992 USA-CERL All rights reserved.
+ **
+ */
+
+/*
+ ** takes 1st command line argument and stuffs each letter of it into
+ ** a linked list. then prints it back out to stdout.
+ ** If a second argument is specified, the first argument is put in the
+ ** list backwards.
+ */
+#include <stdio.h>
+#include <grass/linkm.h>
+
+struct link
+{
+ char let;
+ struct link *next;
+};
+
+int main(int argc, char *argv[])
+{
+ register int i;
+ VOID_T *head;
+ struct link List, *tmp, *p;
+ int rev = 0;
+
+
+ for (i = 0; i < 2000000; i++) {
+ p = (struct link *)malloc(sizeof(struct link));
+ free(p);
+ }
+
+
+ exit(0);
+}
Copied: grass/trunk/lib/linkm/test/speed.c (from rev 33017, grass/trunk/lib/linkm/speed.c)
===================================================================
--- grass/trunk/lib/linkm/test/speed.c (rev 0)
+++ grass/trunk/lib/linkm/test/speed.c 2008-08-23 21:13:06 UTC (rev 33038)
@@ -0,0 +1,53 @@
+/*
+ ** Written by David Gerdes US Army Construction Engineering Research Lab
+ ** April 1992
+ ** Copyright 1992 USA-CERL All rights reserved.
+ **
+ */
+
+/*
+ ** This is a simple best case performance comparison between linkm and malloc
+ */
+#include <stdio.h>
+#include <grass/linkm.h>
+
+struct link
+{
+ char let;
+ struct link *next;
+};
+
+/*
+ #define LINKM
+ */
+
+int main(int argc, char *argv[])
+{
+ register int i;
+ VOID_T *head;
+ struct link List, *tmp, *p;
+ int rev = 0;
+
+
+
+#ifdef LINKM
+ head = (VOID_T *) link_init(sizeof(struct link));
+#endif
+
+
+ for (i = 0; i < 2000000; i++) {
+#ifdef LINKM
+ p = (struct link *)link_new(head);
+ link_dispose(head, p);
+#else
+ p = (struct link *)malloc(sizeof(struct link));
+ free(p);
+#endif
+ }
+
+#ifdef LINKM
+ link_cleanup(head);
+#endif
+
+ exit(0);
+}
Copied: grass/trunk/lib/linkm/test/speed2.c (from rev 33017, grass/trunk/lib/linkm/speed2.c)
===================================================================
--- grass/trunk/lib/linkm/test/speed2.c (rev 0)
+++ grass/trunk/lib/linkm/test/speed2.c 2008-08-23 21:13:06 UTC (rev 33038)
@@ -0,0 +1,69 @@
+
+
+/*
+ ** Written by David Gerdes US Army Construction Engineering Research Lab
+ ** April 1992
+ ** Copyright 1992 USA-CERL All rights reserved.
+ **
+ */
+
+/*
+ ** This is a simple worst case performance comparison between linkm and malloc
+ */
+#include <stdio.h>
+#include <grass/linkm.h>
+
+struct link
+{
+ char let;
+ struct link *next;
+};
+
+/*
+ #define LINKM
+ */
+
+int main(int argc, char *argv[])
+{
+ register int i;
+ VOID_T *head;
+ struct link List, *tmp, *p;
+ int rev = 0;
+
+
+ tmp = &List;
+
+#ifdef LINKM
+ /* link_set_chunk_size (2000); */
+ head = (VOID_T *) link_init(sizeof(struct link));
+#endif
+
+
+ for (i = 0; i < 2000000; i++) {
+#ifdef LINKM
+ p = (struct link *)link_new(head);
+#else
+ p = (struct link *)malloc(sizeof(struct link));
+#endif
+ tmp->next = p;
+ tmp = p;
+ tmp->next = NULL;
+ }
+
+ for (p = List.next; p != NULL;) {
+ tmp = p->next;
+#ifdef LINKM
+ link_dispose(head, p);
+#else
+ free(p);
+#endif
+ p = tmp;
+ }
+
+
+#ifdef LINKM
+ link_cleanup(head);
+#endif
+
+ exit(0);
+}
Copied: grass/trunk/lib/linkm/test/speed3.c (from rev 33017, grass/trunk/lib/linkm/speed3.c)
===================================================================
--- grass/trunk/lib/linkm/test/speed3.c (rev 0)
+++ grass/trunk/lib/linkm/test/speed3.c 2008-08-23 21:13:06 UTC (rev 33038)
@@ -0,0 +1,68 @@
+/*
+ ** Written by David Gerdes US Army Construction Engineering Research Lab
+ ** April 1992
+ ** Copyright 1992 USA-CERL All rights reserved.
+ **
+ */
+
+/*
+ ** This is a simple performance comparison between linkm and malloc
+ ** I think it better simulates normal use of the library than
+ ** speed.c or speed2.c
+ */
+#include <stdio.h>
+#include <grass/linkm.h>
+
+struct link
+{
+ char let;
+ struct link *next;
+};
+
+#define LINKM
+
+int main(int argc, char *argv[])
+{
+ register int i, j;
+ VOID_T *head;
+ struct link List, *tmp, *p;
+
+
+
+#ifdef LINKM
+ head = (VOID_T *) link_init(sizeof(struct link));
+#endif
+
+
+ for (j = 0; j < 1000; j++) {
+ tmp = &List;
+
+ for (i = 0; i < 2000; i++) {
+#ifdef LINKM
+ p = (struct link *)link_new(head);
+#else
+ p = (struct link *)malloc(sizeof(struct link));
+#endif
+ tmp->next = p;
+ tmp = p;
+ tmp->next = NULL;
+ }
+
+ for (p = List.next; p != NULL;) {
+ tmp = p->next;
+#ifdef LINKM
+ link_dispose(head, p);
+#else
+ free(p);
+#endif
+ p = tmp;
+ }
+ }
+
+
+#ifdef LINKM
+ link_cleanup(head);
+#endif
+
+ exit(0);
+}
Copied: grass/trunk/lib/linkm/test/try.c (from rev 33017, grass/trunk/lib/linkm/try.c)
===================================================================
--- grass/trunk/lib/linkm/test/try.c (rev 0)
+++ grass/trunk/lib/linkm/test/try.c 2008-08-23 21:13:06 UTC (rev 33038)
@@ -0,0 +1,96 @@
+/*
+ ** Written by David Gerdes US Army Construction Engineering Research Lab
+ ** April 1992
+ ** Copyright 1992 USA-CERL All rights reserved.
+ **
+ */
+
+/*
+ ** takes 1st command line argument and stuffs each letter of it into
+ ** a linked list. then prints it back out to stdout.
+ ** If a second argument is specified, the first argument is put in the
+ ** list backwards.
+ */
+#include <stdio.h>
+#include <grass/linkm.h>
+
+struct link
+{
+ char let;
+ struct link *next;
+};
+
+int main(int argc, char *argv[])
+{
+ register int i;
+ VOID_T *head;
+ struct link List, *tmp, *p;
+ int rev = 0;
+
+ if (argc < 2)
+ fprintf(stderr, "Usage: %s str [rev]\n", argv[0]), exit(1);
+
+ if (argc > 2)
+ rev = 1;
+
+
+ List.next = NULL;
+ List.let = ' ';
+
+
+ head = (VOID_T *) link_init(sizeof(struct link));
+
+ for (i = 0; argv[1][i]; i++) {
+ tmp = (struct link *)link_new(head);
+ tmp->let = argv[1][i];
+ if (rev)
+ add_link_rev(&List, tmp);
+ else
+ add_link(&List, tmp);
+ }
+
+ dumplist(&List);
+
+ p = List.next;
+ while (p->next != NULL) {
+ tmp = p->next;
+ link_dispose(head, p);
+ p = tmp;
+ }
+
+ link_cleanup(head);
+
+ exit(0);
+}
+
+int add_link_rev(struct link *List, struct link *link)
+{
+ struct link *p;
+
+ p = List->next;
+ List->next = link;
+ link->next = p;
+}
+
+int add_link(struct link *List, struct link *link)
+{
+ struct link *p;
+
+ p = List;
+ while (p->next != NULL)
+ p = p->next;
+ p->next = link;
+ link->next = NULL;
+}
+
+int dumplist(struct link *List)
+{
+ struct link *p;
+
+ p = List->next;
+ while (p != NULL) {
+ putchar(p->let);
+ p = p->next;
+ }
+ putchar('\n');
+}
Copied: grass/trunk/lib/linkm/test/try2.c (from rev 33017, grass/trunk/lib/linkm/try2.c)
===================================================================
--- grass/trunk/lib/linkm/test/try2.c (rev 0)
+++ grass/trunk/lib/linkm/test/try2.c 2008-08-23 21:13:06 UTC (rev 33038)
@@ -0,0 +1,101 @@
+/*
+ ** Written by David Gerdes US Army Construction Engineering Research Lab
+ ** April 1992
+ ** Copyright 1992 USA-CERL All rights reserved.
+ **
+ */
+
+
+/*
+ ** read from stdin and each line into a linked list of chars
+ ** then print it back out. if there is any argument specified
+ ** the lines will be printed out reversed.
+ */
+
+#include <stdio.h>
+#include <grass/linkm.h>
+
+struct link
+{
+ char let;
+ struct link *next;
+};
+
+int main(int argc, char *argv[])
+{
+ register int i;
+ VOID_T *head;
+ struct link List, *tmp, *p;
+ int rev = 0;
+ char buf[4096];
+
+ if (argc == 2)
+ rev = 1;
+
+
+ List.next = NULL;
+ List.let = ' ';
+
+
+ link_set_chunk_size(1);
+ head = (VOID_T *) link_init(sizeof(struct link));
+
+
+ while (NULL != gets(buf)) {
+ for (i = 0; buf[i] != '\0'; i++) {
+ tmp = (struct link *)link_new(head);
+ tmp->let = buf[i];
+ if (rev)
+ add_link_rev(&List, tmp);
+ else
+ add_link(&List, tmp);
+ }
+
+ dumplist(&List);
+
+ p = List.next;
+
+ while (p != NULL && p->next != NULL) {
+ tmp = p->next;
+ link_dispose(head, p);
+ p = tmp;
+ }
+ List.next = NULL;
+ }
+
+ link_cleanup(head);
+
+ exit(0);
+}
+
+int add_link_rev(struct link *List, struct link *link)
+{
+ struct link *p;
+
+ p = List->next;
+ List->next = link;
+ link->next = p;
+}
+
+int add_link(struct link *List, struct link *link)
+{
+ struct link *p;
+
+ p = List;
+ while (p->next != NULL)
+ p = p->next;
+ p->next = link;
+ link->next = NULL;
+}
+
+int dumplist(struct link *List)
+{
+ struct link *p;
+
+ p = List->next;
+ while (p != NULL) {
+ putchar(p->let);
+ p = p->next;
+ }
+ putchar('\n');
+}
Deleted: grass/trunk/lib/linkm/try.c
===================================================================
--- grass/trunk/lib/linkm/try.c 2008-08-23 21:08:33 UTC (rev 33037)
+++ grass/trunk/lib/linkm/try.c 2008-08-23 21:13:06 UTC (rev 33038)
@@ -1,96 +0,0 @@
-/*
- ** Written by David Gerdes US Army Construction Engineering Research Lab
- ** April 1992
- ** Copyright 1992 USA-CERL All rights reserved.
- **
- */
-
-/*
- ** takes 1st command line argument and stuffs each letter of it into
- ** a linked list. then prints it back out to stdout.
- ** If a second argument is specified, the first argument is put in the
- ** list backwards.
- */
-#include <stdio.h>
-#include <grass/linkm.h>
-
-struct link
-{
- char let;
- struct link *next;
-};
-
-int main(int argc, char *argv[])
-{
- register int i;
- VOID_T *head;
- struct link List, *tmp, *p;
- int rev = 0;
-
- if (argc < 2)
- fprintf(stderr, "Usage: %s str [rev]\n", argv[0]), exit(1);
-
- if (argc > 2)
- rev = 1;
-
-
- List.next = NULL;
- List.let = ' ';
-
-
- head = (VOID_T *) link_init(sizeof(struct link));
-
- for (i = 0; argv[1][i]; i++) {
- tmp = (struct link *)link_new(head);
- tmp->let = argv[1][i];
- if (rev)
- add_link_rev(&List, tmp);
- else
- add_link(&List, tmp);
- }
-
- dumplist(&List);
-
- p = List.next;
- while (p->next != NULL) {
- tmp = p->next;
- link_dispose(head, p);
- p = tmp;
- }
-
- link_cleanup(head);
-
- exit(0);
-}
-
-int add_link_rev(struct link *List, struct link *link)
-{
- struct link *p;
-
- p = List->next;
- List->next = link;
- link->next = p;
-}
-
-int add_link(struct link *List, struct link *link)
-{
- struct link *p;
-
- p = List;
- while (p->next != NULL)
- p = p->next;
- p->next = link;
- link->next = NULL;
-}
-
-int dumplist(struct link *List)
-{
- struct link *p;
-
- p = List->next;
- while (p != NULL) {
- putchar(p->let);
- p = p->next;
- }
- putchar('\n');
-}
Deleted: grass/trunk/lib/linkm/try2.c
===================================================================
--- grass/trunk/lib/linkm/try2.c 2008-08-23 21:08:33 UTC (rev 33037)
+++ grass/trunk/lib/linkm/try2.c 2008-08-23 21:13:06 UTC (rev 33038)
@@ -1,101 +0,0 @@
-/*
- ** Written by David Gerdes US Army Construction Engineering Research Lab
- ** April 1992
- ** Copyright 1992 USA-CERL All rights reserved.
- **
- */
-
-
-/*
- ** read from stdin and each line into a linked list of chars
- ** then print it back out. if there is any argument specified
- ** the lines will be printed out reversed.
- */
-
-#include <stdio.h>
-#include <grass/linkm.h>
-
-struct link
-{
- char let;
- struct link *next;
-};
-
-int main(int argc, char *argv[])
-{
- register int i;
- VOID_T *head;
- struct link List, *tmp, *p;
- int rev = 0;
- char buf[4096];
-
- if (argc == 2)
- rev = 1;
-
-
- List.next = NULL;
- List.let = ' ';
-
-
- link_set_chunk_size(1);
- head = (VOID_T *) link_init(sizeof(struct link));
-
-
- while (NULL != gets(buf)) {
- for (i = 0; buf[i] != '\0'; i++) {
- tmp = (struct link *)link_new(head);
- tmp->let = buf[i];
- if (rev)
- add_link_rev(&List, tmp);
- else
- add_link(&List, tmp);
- }
-
- dumplist(&List);
-
- p = List.next;
-
- while (p != NULL && p->next != NULL) {
- tmp = p->next;
- link_dispose(head, p);
- p = tmp;
- }
- List.next = NULL;
- }
-
- link_cleanup(head);
-
- exit(0);
-}
-
-int add_link_rev(struct link *List, struct link *link)
-{
- struct link *p;
-
- p = List->next;
- List->next = link;
- link->next = p;
-}
-
-int add_link(struct link *List, struct link *link)
-{
- struct link *p;
-
- p = List;
- while (p->next != NULL)
- p = p->next;
- p->next = link;
- link->next = NULL;
-}
-
-int dumplist(struct link *List)
-{
- struct link *p;
-
- p = List->next;
- while (p != NULL) {
- putchar(p->let);
- p = p->next;
- }
- putchar('\n');
-}
Modified: grass/trunk/lib/nviz/Makefile
===================================================================
--- grass/trunk/lib/nviz/Makefile 2008-08-23 21:08:33 UTC (rev 33037)
+++ grass/trunk/lib/nviz/Makefile 2008-08-23 21:13:06 UTC (rev 33038)
@@ -15,7 +15,11 @@
EXTRA_CFLAGS = $(VECT_CFLAGS) $(XCFLAGS)
+ifneq ($(USE_OPENGL),)
default: lib
+else
+default:
+endif
# doxygen
DOXNAME=nviz
Modified: grass/trunk/lib/ogsf/Makefile
===================================================================
--- grass/trunk/lib/ogsf/Makefile 2008-08-23 21:08:33 UTC (rev 33037)
+++ grass/trunk/lib/ogsf/Makefile 2008-08-23 21:13:06 UTC (rev 33038)
@@ -10,7 +10,11 @@
EXTRA_INC = $(VECT_INC) $(OPENGLINC) $(TIFFINCPATH) $(FFMPEGINCPATH)
EXTRA_CFLAGS = $(VECT_CFLAGS) $(XCFLAGS)
+ifneq ($(USE_OPENGL),)
default: lib
+else
+default:
+endif
#doxygen:
DOXNAME=ogsf
Modified: grass/trunk/lib/pngdriver/Makefile
===================================================================
--- grass/trunk/lib/pngdriver/Makefile 2008-08-23 21:08:33 UTC (rev 33037)
+++ grass/trunk/lib/pngdriver/Makefile 2008-08-23 21:13:06 UTC (rev 33038)
@@ -1,40 +1,17 @@
MODULE_TOPDIR = ../..
-include $(MODULE_TOPDIR)/include/Make/Platform.make
+include $(MODULE_TOPDIR)/include/Make/Vars.make
-EXTRA_CFLAGS=$(GETHOSTNAME) $(ZLIBINCPATH) $(PNGINC) -I../driver
+ifeq ($(USE_PNG),)
+ MOD_OBJS := $(filter-out read_png.o write_png.o,$(AUTO_OBJS))
+endif
-EXTRA_LIBS=$(DRIVERLIB) $(GISLIB) $(PNGLIB)
LIB_NAME = $(PNGDRIVER_LIBNAME)
PGM = pngdriver
+include $(MODULE_TOPDIR)/include/Make/Lib.make
-LIB_OBJS = \
- Box.o \
- Color.o \
- Color_table.o \
- Draw_bitmap.o \
- Draw_line.o \
- Draw_point.o \
- Driver.o \
- Erase.o \
- Graph_close.o \
- Graph_set.o \
- Line_width.o \
- Polygon.o \
- Raster.o \
- Respond.o \
- Set_window.o \
- read.o \
- read_ppm.o \
- read_bmp.o \
- write.o \
- write_ppm.o \
- write_bmp.o
+EXTRA_CFLAGS=$(GETHOSTNAME) $(ZLIBINCPATH) $(PNGINC) -I../driver
-ifneq ($(USE_PNG),)
- LIB_OBJS += read_png.o write_png.o
-endif
+EXTRA_LIBS=$(DRIVERLIB) $(GISLIB) $(PNGLIB)
-include $(MODULE_TOPDIR)/include/Make/Lib.make
-
default: lib
Modified: grass/trunk/lib/proj/Makefile
===================================================================
--- grass/trunk/lib/proj/Makefile 2008-08-23 21:08:33 UTC (rev 33037)
+++ grass/trunk/lib/proj/Makefile 2008-08-23 21:13:06 UTC (rev 33038)
@@ -2,18 +2,15 @@
LIB_NAME = $(GPROJ_LIBNAME)
-PACKAGE ="libgproj"
-DEFS=-DPACKAGE=\"$(PACKAGE)\"
+include $(MODULE_TOPDIR)/include/Make/Lib.make
+include $(MODULE_TOPDIR)/include/Make/Doxygen.make
EXTRA_LIBS=$(GISLIB) $(PROJLIB) $(GDALLIBS)
EXTRA_CFLAGS = $(GETHOSTNAME) $(ZLIBINCPATH) $(PICFLAGS) $(GDALCFLAGS) $(DEFS)
EXTRA_INC = $(PROJINC)
-LIB_OBJS = get_proj.o do_proj.o convert.o datum.o ellipse.o
+NAD_TABLES := $(wildcard *.lla)
-NAD_TABLES = FL.lla MD.lla TN.lla WI.lla WO.lla alaska.lla conus.lla \
- hawaii.lla prvi.lla stgeorge.lla stlrnc.lla stpaul.lla
-
NT_TABLES = ntv1_can.dat nzgd2kgrid0005.gsb
CSV_FILES := $(wildcard *.csv)
@@ -22,9 +19,6 @@
NAD2BIN = nad2bin
CSV_DIR = $(GISBASE)/etc/ogr_csv
-include $(MODULE_TOPDIR)/include/Make/Lib.make
-include $(MODULE_TOPDIR)/include/Make/Doxygen.make
-
default: lib $(NAD_DIR) $(CSV_DIR)
$(NAD_DIR): $(NAD_TABLES) $(NT_TABLES)
Modified: grass/trunk/lib/python/Makefile
===================================================================
--- grass/trunk/lib/python/Makefile 2008-08-23 21:08:33 UTC (rev 33037)
+++ grass/trunk/lib/python/Makefile 2008-08-23 21:13:06 UTC (rev 33038)
@@ -1,8 +1,6 @@
MODULE_TOPDIR = ../..
-include $(MODULE_TOPDIR)/include/Make/Platform.make
-include $(MODULE_TOPDIR)/include/Make/Grass.make
-include $(MODULE_TOPDIR)/include/Make/Rules.make
+include $(MODULE_TOPDIR)/include/Make/Other.make
default: $(ETC)/python
@@ -12,4 +10,3 @@
.PHONY: $(ETC)/python
-clean:
Modified: grass/trunk/lib/raster/Makefile
===================================================================
--- grass/trunk/lib/raster/Makefile 2008-08-23 21:08:33 UTC (rev 33037)
+++ grass/trunk/lib/raster/Makefile 2008-08-23 21:13:06 UTC (rev 33038)
@@ -1,6 +1,6 @@
MODULE_TOPDIR = ../..
-include $(MODULE_TOPDIR)/include/Make/Platform.make
+include $(MODULE_TOPDIR)/include/Make/Vars.make
PACKAGE ="libraster"
DEFS=-DPACKAGE=\"$(PACKAGE)\"
Modified: grass/trunk/lib/rst/Makefile
===================================================================
--- grass/trunk/lib/rst/Makefile 2008-08-23 21:08:33 UTC (rev 33037)
+++ grass/trunk/lib/rst/Makefile 2008-08-23 21:13:06 UTC (rev 33038)
@@ -9,7 +9,6 @@
default: parsubdirs
-clean: cleansubdirs
interp_float: data qtree
Modified: grass/trunk/lib/segment/Makefile
===================================================================
--- grass/trunk/lib/segment/Makefile 2008-08-23 21:08:33 UTC (rev 33037)
+++ grass/trunk/lib/segment/Makefile 2008-08-23 21:13:06 UTC (rev 33038)
@@ -4,21 +4,6 @@
LIB_NAME = $(SEGMENT_LIBNAME)
-LIB_OBJS = \
- address.o\
- flush.o\
- format.o\
- get.o\
- get_row.o\
- init.o\
- pagein.o\
- pageout.o\
- put.o\
- put_row.o\
- release.o\
- seek.o\
- setup.o
-
include $(MODULE_TOPDIR)/include/Make/Lib.make
include $(MODULE_TOPDIR)/include/Make/Doxygen.make
Deleted: grass/trunk/lib/segment/debug.c
===================================================================
--- grass/trunk/lib/segment/debug.c 2008-08-23 21:08:33 UTC (rev 33037)
+++ grass/trunk/lib/segment/debug.c 2008-08-23 21:13:06 UTC (rev 33038)
@@ -1,128 +0,0 @@
-
-/**
- * \file debug.c
- *
- * \brief Segment debug routines.
- *
- * This file has debug versions of <i>segment_get()</i> and
- * <i>segment_put()</i> which check the row,col and print error messages
- * to <em>stderr</em> upon violations.
- *
- * <b>Build Note:</b> Load the debug.o file before the SEGMENTLIB and
- * the debug versions will supercede the original.
- *
- * This program is free software under the GNU General Public License
- * (>=v2). Read the file COPYING that comes with GRASS for details.
- *
- * \author GRASS GIS Development Team
- *
- * \date 2005-2006
- */
-
-#include <stdio.h>
-#include <string.h>
-#include <grass/segment.h>
-
-
-static int check(const SEGMENT *, int, int, char *);
-
-
-/**
- * \fn int segment_get (SEGMENT *SEG, void *buf, int row, int col)
- *
- * \brief Get value from segment file.
- *
- * Provides random read access to the segmented data. It gets
- * <i>len</i> bytes of data into <b>value</b> from the segment file
- * <b>seg</b> for the corresponding <b>row</b> and <b>col</b> in the
- * original data matrix.
- *
- * \param[in] seg
- * \param[in,out] buf
- * \param[in] row
- * \param[in] col
- * \return 1 on success
- * \return -1 if unable to seek or read segment file
- */
-
-int segment_get(SEGMENT * SEG, void *buf, int row, int col)
-{
- int index, n;
-
- if (!check(SEG, row, col, "segment_get"))
- return -1;
-
- segment_address(SEG, row, col, &n, &index);
- if ((i = segment_pagein(SEG, n)) < 0)
- return -1;
-
- memcpy(buf, &SEG->scb[i].buf[index], SEG->len);
-
- return 1;
-}
-
-
-/**
- * \fn int segment_put (SEGMENT *SEG, void *buf, int row, int col)
- *
- * \brief Put value to segment file.
- *
- * Provides random write access to the segmented data. It
- * copies <i>len</i> bytes of data from <b>value</b> into the segment
- * structure <b>seg</b> for the corresponding <b>row</b> and <b>col</b> in
- * the original data matrix.
- *
- * The data is not written to disk immediately. It is stored in a memory segment
- * until the segment routines decide to page the segment to disk.
- *
- * \param[in] seg
- * \param[in,out] buf
- * \param[in] row
- * \param[in] col
- * \return 1 on success
- * \return -1 if unable to seek or write segment file
- */
-
-int segment_put(SEGMENT * SEG, const void *buf, int row, int col)
-{
- int index, n;
-
- if (!check(SEG, row, col, "segment_put"))
- return -1;
-
- segment_address(SEG, row, col, &n, &index);
- if ((i = segment_pagein(SEG, n)) < 0)
- return -1;
-
- SEG->scb[i].dirty = 1;
-
- memcpy(&SEG->scb[i].buf[index], buf, SEG->len);
-
- return 1;
-}
-
-
-static int check(const SEGMENT * SEG, int row, int col, char *me)
-{
- int r = row >= 0 && row < SEG->nrows;
- int c = col >= 0 && col < SEG->ncols;
-
- if (r && c)
- return 1;
-
- fprintf(stderr, "%s(SEG=%lx,fd=%d,row=%d,col=%d) ",
- me, (unsigned long int)SEG, SEG->fd, row, col);
- if (!r) {
- fprintf(stderr, "bad row ");
- if (row >= SEG->nrows)
- fprintf(stderr, "(max %d) ", SEG->nrows - 1);
- }
- if (!c) {
- fprintf(stderr, "bad col ");
- if (col >= SEG->ncols)
- fprintf(stderr, "(max %d) ", SEG->ncols - 1);
- }
- fprintf(stderr, "\n");
-
- return 0;
-}
Deleted: grass/trunk/lib/segment/try.c
===================================================================
--- grass/trunk/lib/segment/try.c 2008-08-23 21:08:33 UTC (rev 33037)
+++ grass/trunk/lib/segment/try.c 2008-08-23 21:13:06 UTC (rev 33038)
@@ -1,111 +0,0 @@
-
-/****************************************************************************
- *
- * MODULE: segment
- * AUTHOR(S): CERL (original contributors)
- * Markus Neteler <neteler itc.it>,
- * Bernhard Reiter <bernhard intevation.de>,
- * Brad Douglas <rez touchofmadness.com>,
- * Glynn Clements <glynn gclements.plus.com>
- * PURPOSE: Segment test routines
- * COPYRIGHT: (C) 1999-2006 by the GRASS Development Team
- *
- * This program is free software under the GNU General Public
- * License (>=v2). Read the file COPYING that comes with GRASS
- * for details.
- *
- *****************************************************************************/
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <grass/segment.h>
-
-
-#define NCOLS 100
-#define NROWS 100
-#define SROWS 8
-#define SCOLS 8
-#define LEN 2
-#define NSEGS 4
-
-
-/**
- * \fn int main (int argc, char **argv)
- *
- * \brief Segment library test program.
- *
- * \return 0 on success
- * \return calls <i>exit()</i> on error
- */
-
-int main(int argc, char **argv)
-{
- SEGMENT seg;
- char data[NROWS * NCOLS * LEN];
- int row, col;
- int i;
- int fd;
- char junk[3];
-
- fprintf(stdout, "creating seg.file\n");
- fd = creat("seg.file", 0666);
- if (fd < 0) {
- perror("seg.file");
- exit(EXIT_FAILURE);
- }
- segment_format(fd, NROWS, NCOLS, SROWS, SCOLS, LEN);
- close(fd);
-
- fprintf(stdout, "opening seg.file\n");
- fd = open("seg.file", 2);
- if (fd < 0) {
- perror("seg.file");
- exit(EXIT_FAILURE);
- }
- segment_init(&seg, fd, NSEGS);
-
- fprintf(stdout, "rows %d, cols %d (len %d)\n", seg.nrows, seg.ncols,
- seg.len);
- if (seg.nrows != NROWS || seg.ncols != NCOLS || seg.len != LEN) {
- fprintf(stdout, "OOPS - wrong segment file\n");
- exit(EXIT_FAILURE);
- }
-
- fprintf(stdout, "writing seg.file\n");
- for (row = 0; row < NROWS; row++) {
- for (col = 0; col < NCOLS; col++) {
- data[col * 2] = row;
- data[col * 2 + 1] = col;
- }
- segment_put_row(&seg, data, row);
- }
-
- while (1) {
- for (i = 0; i < seg.nseg; i++)
- if (seg.scb[i].n >= 0) {
- fprintf(stdout, "segment %d age %d",
- seg.scb[i].n, seg.scb[i].age);
- if (i == seg.cur)
- fprintf(stdout, " current");
- fprintf(stdout, "\n");
- }
- fprintf(stdout, "\nenter row col: ");
- if (!fgets(data, 20, stdin))
- break;
- if (sscanf(data, "%1s", junk) != 1)
- continue;
- if (sscanf(data, "%d%d", &row, &col) != 2)
- fprintf(stdout, "??\n");
- else if (row < 0 || row >= NROWS || col < 0 || col >= NCOLS)
- fprintf(stdout, "bad row/col value(s)\n");
- else {
- segment_get(&seg, data, row, col);
- fprintf(stdout, "data = %d %d\n", data[0], data[1]);
- }
- }
-
- segment_release(&seg);
- close(fd);
-
- return 0;
-}
Modified: grass/trunk/lib/vector/Makefile
===================================================================
--- grass/trunk/lib/vector/Makefile 2008-08-23 21:08:33 UTC (rev 33037)
+++ grass/trunk/lib/vector/Makefile 2008-08-23 21:13:06 UTC (rev 33038)
@@ -15,7 +15,6 @@
default: parsubdirs
-clean: cleansubdirs
diglib: rtree
Modified: grass/trunk/lib/vector/dglib/Makefile
===================================================================
--- grass/trunk/lib/vector/dglib/Makefile 2008-08-23 21:08:33 UTC (rev 33037)
+++ grass/trunk/lib/vector/dglib/Makefile 2008-08-23 21:13:06 UTC (rev 33038)
@@ -1,17 +1,11 @@
MODULE_TOPDIR = ../../..
-LIB_NAME = $(GRAPH_LIBNAME)
+include $(MODULE_TOPDIR)/include/Make/Vars.make
-LIB_OBJS = \
- avl.o \
- tavl.o \
- graph.o \
- heap.o \
- tree.o \
- helpers.o \
- graph_v1.o \
- graph_v2.o
+MOD_OBJS := $(filter-out %-template.o,$(AUTO_OBJS))
+LIB_NAME = $(GRAPH_LIBNAME)
+
include $(MODULE_TOPDIR)/include/Make/Lib.make
include $(MODULE_TOPDIR)/include/Make/Doxygen.make
Modified: grass/trunk/lib/vector/diglib/Makefile
===================================================================
--- grass/trunk/lib/vector/diglib/Makefile 2008-08-23 21:08:33 UTC (rev 33037)
+++ grass/trunk/lib/vector/diglib/Makefile 2008-08-23 21:13:06 UTC (rev 33038)
@@ -1,42 +1,16 @@
MODULE_TOPDIR = ../../..
-EXTRA_LIBS=$(GISLIB) $(RTREELIB) $(MATHLIB)
+include $(MODULE_TOPDIR)/include/Make/Vars.make
+MOD_OBJS := $(filter-out test.o port_test.o,$(AUTO_OBJS))
+
LIB_NAME = $(DIG2_LIBNAME)
-LIB_OBJS = \
- allocation.o \
- angle.o \
- box.o \
- cindex.o \
- cindex_rw.o \
- file.o \
- frmt.o \
- head.o \
- inside.o \
- linecros.o \
- line_dist.o \
- list.o \
- plus.o \
- plus_area.o \
- plus_line.o \
- plus_node.o \
- plus_struct.o \
- poly.o \
- port_init.o \
- portable.o \
- prune.o \
- spindex.o \
- spindex_rw.o \
- struct_alloc.o \
- type.o \
- update.o
-
-
include $(MODULE_TOPDIR)/include/Make/Lib.make
EXTRA_INC = $(VECT_INC)
EXTRA_CFLAGS = $(VECT_CFLAGS)
+LIBES = $(GISLIB) $(RTREELIB) $(MATHLIB)
TEST = $(OBJDIR)/test
@@ -44,7 +18,7 @@
$(MAKE) $(TEST)
# Test portable read/write functions
-$(OBJDIR)/test: test.c $(DEPENDENCIES) $(ARCH_LIB_OBJS)
+$(OBJDIR)/test: test.c $(DIG2DEP)
echo "==============TEST============="
$(CC) $(LDFLAGS) $(COMPILE_FLAGS) $(VECT_CFLAGS) $(INC) $(VECT_INC) -o $@ test.c $(DIG2LIB) $(RTREELIB) \
$(GISLIB) $(DATETIMELIB) $(MATHLIB) $(XDRLIB)
Modified: grass/trunk/lib/vector/rtree/Makefile
===================================================================
--- grass/trunk/lib/vector/rtree/Makefile 2008-08-23 21:08:33 UTC (rev 33037)
+++ grass/trunk/lib/vector/rtree/Makefile 2008-08-23 21:13:06 UTC (rev 33038)
@@ -2,17 +2,10 @@
LIB_NAME = $(RTREE_LIBNAME)
-LIB_OBJS = card.o \
- gammavol.o \
- index.o \
- node.o \
- rect.o \
- split_q.o
+include $(MODULE_TOPDIR)/include/Make/Lib.make
EXTRA_LIBS = $(MATHLIB)
-include $(MODULE_TOPDIR)/include/Make/Lib.make
-
RTLINC = $(ARCH_INCDIR)/rtree
HEADERS := $(RTLINC)/card.h $(RTLINC)/index.h $(RTLINC)/split_q.h \
$(ARCH_INCDIR)/rtree.h
Copied: grass/trunk/lib/vector/rtree/docs/test.c (from rev 33017, grass/trunk/lib/vector/rtree/test.c)
===================================================================
--- grass/trunk/lib/vector/rtree/docs/test.c (rev 0)
+++ grass/trunk/lib/vector/rtree/docs/test.c 2008-08-23 21:13:06 UTC (rev 33038)
@@ -0,0 +1,63 @@
+
+/****************************************************************************
+* MODULE: R-Tree library
+*
+* AUTHOR(S): Antonin Guttman - original code
+* Daniel Green (green at superliminal.com) - major clean-up
+* and implementation of bounding spheres
+*
+* PURPOSE: Multidimensional index
+*
+* COPYRIGHT: (C) 2001 by the GRASS Development Team
+*
+* This program is free software under the GNU General Public
+* License (>=v2). Read the file COPYING that comes with GRASS
+* for details.
+*****************************************************************************/
+
+#include <stdio.h>
+#include "index.h"
+
+struct Rect rects[] = {
+ {{0, 0, 0, 2, 2, 0}}, /* xmin, ymin, zmin, xmax, ymax, zmax (for 3 dimensional RTree) */
+ {{5, 5, 0, 7, 7, 0}},
+ {{8, 5, 0, 9, 6, 0}},
+ {{7, 1, 0, 9, 2, 0}}
+};
+
+
+int nrects = sizeof(rects) / sizeof(rects[0]);
+struct Rect search_rect = {
+ {6, 4, 0, 10, 6, 0} /* search will find above rects that this one overlaps */
+};
+
+int MySearchCallback(int id, void *arg)
+{
+ /* Note: -1 to make up for the +1 when data was inserted */
+ fprintf(stdout, "Hit data rect %d\n", id - 1);
+ return 1; /* keep going */
+}
+
+int main()
+{
+ struct Node *root = RTreeNewIndex();
+ int i, nhits;
+
+ fprintf(stdout, "nrects = %d\n", nrects);
+ /*
+ * Insert all the data rects.
+ * Notes about the arguments:
+ * parameter 1 is the rect being inserted,
+ * parameter 2 is its ID. NOTE: *** ID MUST NEVER BE ZERO ***, hence the +1,
+ * parameter 3 is the root of the tree. Note: its address is passed
+ * because it can change as a result of this call, therefore no other parts
+ * of this code should stash its address since it could change undernieth.
+ * parameter 4 is always zero which means to add from the root.
+ */
+ for (i = 0; i < nrects; i++)
+ RTreeInsertRect(&rects[i], i + 1, &root, 0); /* i+1 is rect ID. Note: root can change */
+ nhits = RTreeSearch(root, &search_rect, MySearchCallback, 0);
+ fprintf(stdout, "Search resulted in %d hits\n", nhits);
+
+ return 0;
+}
Deleted: grass/trunk/lib/vector/rtree/sphvol.c
===================================================================
--- grass/trunk/lib/vector/rtree/sphvol.c 2008-08-23 21:08:33 UTC (rev 33037)
+++ grass/trunk/lib/vector/rtree/sphvol.c 2008-08-23 21:13:06 UTC (rev 33038)
@@ -1,71 +0,0 @@
-
-/****************************************************************************
-* MODULE: R-Tree library
-*
-* AUTHOR(S): Antonin Guttman - original code
-* Daniel Green (green at superliminal.com) - major clean-up
-* and implementation of bounding spheres
-*
-* PURPOSE: Multidimensional index
-*
-* COPYRIGHT: (C) 2001 by the GRASS Development Team
-*
-* This program is free software under the GNU General Public
-* License (>=v2). Read the file COPYING that comes with GRASS
-* for details.
-*****************************************************************************/
-
-/*
- * SPHERE VOLUME
- * by Daniel Green
- * dgreen at superliminal.com
- *
- * Calculates and prints the volumes of the unit hyperspheres for
- * dimensions zero through the given value, or 9 by default.
- * Prints in the form of a C array of double called sphere_volumes.
- *
- * From formule in "Regular Polytopes" by H.S.M Coxeter, the volume
- * of a hypersphere of dimension d is:
- * Pi^(d/2) / gamma(d/2 + 1)
- *
- * This implementation works by first computing the log of the above
- * function and then returning the exp of that value in order to avoid
- * instabilities due to the huge values that the real gamma function
- * would return.
- *
- * Multiply the output volumes by R^n to get the volume of an n
- * dimensional sphere of radius R.
- */
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <math.h>
-#include <grass/gis.h>
-
-static void print_volume(int dimension, double volume)
-{
- fprintf(stdout, "\t%.6f, /* dimension %3d */\n", volume, dimension);
-}
-
-static double sphere_volume(double dimension)
-{
- double log_gamma, log_volume;
-
- log_gamma = gamma(dimension / 2.0 + 1);
- log_volume = dimension / 2.0 * log(M_PI) - log_gamma;
- return exp(log_volume);
-}
-
-extern int main(int argc, char *argv[])
-{
- int dim, max_dims = 9;
-
- if (2 == argc)
- max_dims = atoi(argv[1]);
-
- fprintf(stdout, "static const double sphere_volumes[] = {\n");
- for (dim = 0; dim < max_dims + 1; dim++)
- print_volume(dim, sphere_volume(dim));
- fprintf(stdout, "};\n");
- return 0;
-}
Deleted: grass/trunk/lib/vector/rtree/test.c
===================================================================
--- grass/trunk/lib/vector/rtree/test.c 2008-08-23 21:08:33 UTC (rev 33037)
+++ grass/trunk/lib/vector/rtree/test.c 2008-08-23 21:13:06 UTC (rev 33038)
@@ -1,63 +0,0 @@
-
-/****************************************************************************
-* MODULE: R-Tree library
-*
-* AUTHOR(S): Antonin Guttman - original code
-* Daniel Green (green at superliminal.com) - major clean-up
-* and implementation of bounding spheres
-*
-* PURPOSE: Multidimensional index
-*
-* COPYRIGHT: (C) 2001 by the GRASS Development Team
-*
-* This program is free software under the GNU General Public
-* License (>=v2). Read the file COPYING that comes with GRASS
-* for details.
-*****************************************************************************/
-
-#include <stdio.h>
-#include "index.h"
-
-struct Rect rects[] = {
- {{0, 0, 0, 2, 2, 0}}, /* xmin, ymin, zmin, xmax, ymax, zmax (for 3 dimensional RTree) */
- {{5, 5, 0, 7, 7, 0}},
- {{8, 5, 0, 9, 6, 0}},
- {{7, 1, 0, 9, 2, 0}}
-};
-
-
-int nrects = sizeof(rects) / sizeof(rects[0]);
-struct Rect search_rect = {
- {6, 4, 0, 10, 6, 0} /* search will find above rects that this one overlaps */
-};
-
-int MySearchCallback(int id, void *arg)
-{
- /* Note: -1 to make up for the +1 when data was inserted */
- fprintf(stdout, "Hit data rect %d\n", id - 1);
- return 1; /* keep going */
-}
-
-int main()
-{
- struct Node *root = RTreeNewIndex();
- int i, nhits;
-
- fprintf(stdout, "nrects = %d\n", nrects);
- /*
- * Insert all the data rects.
- * Notes about the arguments:
- * parameter 1 is the rect being inserted,
- * parameter 2 is its ID. NOTE: *** ID MUST NEVER BE ZERO ***, hence the +1,
- * parameter 3 is the root of the tree. Note: its address is passed
- * because it can change as a result of this call, therefore no other parts
- * of this code should stash its address since it could change undernieth.
- * parameter 4 is always zero which means to add from the root.
- */
- for (i = 0; i < nrects; i++)
- RTreeInsertRect(&rects[i], i + 1, &root, 0); /* i+1 is rect ID. Note: root can change */
- nhits = RTreeSearch(root, &search_rect, MySearchCallback, 0);
- fprintf(stdout, "Search resulted in %d hits\n", nhits);
-
- return 0;
-}
Modified: grass/trunk/locale/Makefile
===================================================================
--- grass/trunk/locale/Makefile 2008-08-23 21:08:33 UTC (rev 33037)
+++ grass/trunk/locale/Makefile 2008-08-23 21:13:06 UTC (rev 33038)
@@ -3,9 +3,7 @@
# wxpython by Martin Landa
MODULE_TOPDIR = ..
-include $(MODULE_TOPDIR)/include/Make/Platform.make
-include $(MODULE_TOPDIR)/include/Make/Grass.make
-include $(MODULE_TOPDIR)/include/Make/Rules.make
+include $(MODULE_TOPDIR)/include/Make/Other.make
default:
@if [ "$(HAVE_NLS)" != "" ] ; then \
Modified: grass/trunk/macosx/Makefile
===================================================================
--- grass/trunk/macosx/Makefile 2008-08-23 21:08:33 UTC (rev 33037)
+++ grass/trunk/macosx/Makefile 2008-08-23 21:13:06 UTC (rev 33038)
@@ -1,7 +1,14 @@
MODULE_TOPDIR = ..
-include $(MODULE_TOPDIR)/include/Make/Platform.make
+include $(MODULE_TOPDIR)/include/Make/Vars.make
+SUBDIRS =
+ifeq ($(MACOSX_APP),1)
+SUBDIRS = app modbuild
+endif
+
+include $(MODULE_TOPDIR)/include/Make/Dir.make
+
MACOSX_APP_NAME = GRASS-${GRASS_VERSION_MAJOR}.${GRASS_VERSION_MINOR}.app
MACOSX_APPDIR = ${MACOSX_APP_NAME}/Contents/MacOS
INST_DIR_MACOSX = ${prefix}/${MACOSX_APPDIR}
@@ -24,13 +31,6 @@
PKG_INST_DIR = ${prefix}/${MACOSX_APP_NAME}
endif
-SUBDIRS =
-ifeq ($(MACOSX_APP),1)
-SUBDIRS = app modbuild
-endif
-
-include $(MODULE_TOPDIR)/include/Make/Dir.make
-
default: subdirs
install-macosx:
@@ -120,7 +120,3 @@
${MAKE_DIR_CMD} ${MACOSX_SUPPDIR}/Modules/docs/html
${MAKE_DIR_CMD} ${MACOSX_SUPPDIR}/Modules/etc
${MAKE_DIR_CMD} ${MACOSX_SUPPDIR}/Modules/lib
-
-clean: cleansubdirs
- -rm -rf ${ARCH_DISTDIR}/${MACOSX_APP_NAME}/ 2>/dev/null
- -rm -rf ${ARCH_DISTDIR}/modbuild/ 2>/dev/null
Modified: grass/trunk/macosx/app/Makefile
===================================================================
--- grass/trunk/macosx/app/Makefile 2008-08-23 21:08:33 UTC (rev 33037)
+++ grass/trunk/macosx/app/Makefile 2008-08-23 21:13:06 UTC (rev 33038)
@@ -2,12 +2,12 @@
MODULE_TOPDIR = ../..
-include $(MODULE_TOPDIR)/include/Make/Platform.make
-include $(MODULE_TOPDIR)/include/Make/Grass.make
+include $(MODULE_TOPDIR)/include/Make/Vars.make
+MOD_OBJS = Info.plist GRASS.scpt grass.sh main.o
EXTRA_INC =
EXTRA_CFLAGS =
-XTRA_LDFLAGS = -framework Cocoa -framework AppleScriptKit
+EXTRA_LDFLAGS = -framework Cocoa -framework AppleScriptKit
ifndef MACOSX_APP_NAME
MACOSX_APP_NAME = GRASS-${GRASS_VERSION_MAJOR}.${GRASS_VERSION_MINOR}.app
endif
@@ -15,10 +15,6 @@
MAKE_DIR_CMD = mkdir -p -m 755
GRASS_VERSION_BUILD = `/bin/date "+%y%m%d"`
-OBJS = Info.plist GRASS.scpt grass.sh main.o
-
-ARCH_OBJS := $(foreach obj,$(OBJS),$(OBJDIR)/$(obj))
-
# ugly hack - assume gdal prefix starts with -L flag
ifndef GDAL_BIN
GDAL_BIN = `echo "${GDALLIBS}" | sed -e "s,-L,," -e "s,/lib.*$$,/bin,"`
@@ -49,7 +45,7 @@
$(APPDIR)/MacOS/GRASS: $(OBJDIR)/main.o
-$(MAKE_DIR_CMD) ${APPDIR}/MacOS
- $(CC) $(LDFLAGS) -o ${APPDIR}/MacOS/GRASS $(OBJDIR)/main.o $(XTRA_LDFLAGS)
+ $(CC) $(LDFLAGS) -o ${APPDIR}/MacOS/GRASS $(OBJDIR)/main.o $(EXTRA_LDFLAGS)
$(OBJDIR)/Info.plist: Info.plist.in
$(MAKE_DIR_CMD) $(OBJDIR)
Modified: grass/trunk/macosx/modbuild/Makefile
===================================================================
--- grass/trunk/macosx/modbuild/Makefile 2008-08-23 21:08:33 UTC (rev 33037)
+++ grass/trunk/macosx/modbuild/Makefile 2008-08-23 21:13:06 UTC (rev 33038)
@@ -2,8 +2,7 @@
MODULE_TOPDIR = ../..
-include $(MODULE_TOPDIR)/include/Make/Platform.make
-include $(MODULE_TOPDIR)/include/Make/Grass.make
+include $(MODULE_TOPDIR)/include/Make/Other.make
ifndef MACOSX_APP_NAME
MACOSX_APP_NAME = GRASS-${GRASS_VERSION_MAJOR}.${GRASS_VERSION_MINOR}.app
@@ -58,6 +57,3 @@
mkdir -p $(ARCH_DISTDIR)/modbuild/tools/g.html2man
-cp $(MODULE_TOPDIR)/tools/g.html2man/g.html2man $(ARCH_DISTDIR)/modbuild/tools/g.html2man/
-cp $(MODULE_TOPDIR)/tools/mkhtml.sh $(ARCH_DISTDIR)/modbuild/tools/
-
-clean:
-
Modified: grass/trunk/misc/Makefile
===================================================================
--- grass/trunk/misc/Makefile 2008-08-23 21:08:33 UTC (rev 33037)
+++ grass/trunk/misc/Makefile 2008-08-23 21:13:06 UTC (rev 33038)
@@ -7,4 +7,3 @@
default: parsubdirs
-clean: cleansubdirs
Modified: grass/trunk/ps/Makefile
===================================================================
--- grass/trunk/ps/Makefile 2008-08-23 21:08:33 UTC (rev 33037)
+++ grass/trunk/ps/Makefile 2008-08-23 21:13:06 UTC (rev 33038)
@@ -8,5 +8,4 @@
default: parsubdirs
-clean: cleansubdirs
Modified: grass/trunk/raster/Makefile
===================================================================
--- grass/trunk/raster/Makefile 2008-08-23 21:08:33 UTC (rev 33037)
+++ grass/trunk/raster/Makefile 2008-08-23 21:13:06 UTC (rev 33038)
@@ -121,7 +121,7 @@
TIFFBASED = r.out.tiff
-include $(MODULE_TOPDIR)/include/Make/Platform.make
+include $(MODULE_TOPDIR)/include/Make/Vars.make
#compile if GDAL present:
ifneq ($(USE_GDAL),)
@@ -157,4 +157,3 @@
htmldir: parsubdirs
-clean: cleansubdirs
Modified: grass/trunk/raster/r.le/Makefile
===================================================================
--- grass/trunk/raster/r.le/Makefile 2008-08-23 21:08:33 UTC (rev 33037)
+++ grass/trunk/raster/r.le/Makefile 2008-08-23 21:13:06 UTC (rev 33038)
@@ -12,4 +12,3 @@
default: parsubdirs
-clean: cleansubdirs
Modified: grass/trunk/raster/r.li/Makefile
===================================================================
--- grass/trunk/raster/r.li/Makefile 2008-08-23 21:08:33 UTC (rev 33037)
+++ grass/trunk/raster/r.li/Makefile 2008-08-23 21:13:06 UTC (rev 33038)
@@ -25,7 +25,6 @@
default: parsubdirs htmldir
-clean: cleansubdirs
$(SUBDIRS1): r.li.daemon
Property changes on: grass/trunk/raster/r.mapcalc
___________________________________________________________________
Name: svn:ignore
-
*OBJ*
y.tab.c
y.tab.h
lex.yy.c
+ *OBJ*
mapcalc.tab.c
mapcalc.tab.h
mapcalc.yy.c
mapcalc.output
Modified: grass/trunk/raster/r.mapcalc/Makefile
===================================================================
--- grass/trunk/raster/r.mapcalc/Makefile 2008-08-23 21:08:33 UTC (rev 33037)
+++ grass/trunk/raster/r.mapcalc/Makefile 2008-08-23 21:13:06 UTC (rev 33038)
@@ -1,18 +1,14 @@
MODULE_TOPDIR = ../..
+include $(MODULE_TOPDIR)/include/Make/Vars.make
+
PGM2 = r.mapcalc
PGM3 = r3.mapcalc
PROGRAMS = $(PGM2) $(PGM3)
-EXTRA_HEADERS = y.tab.h
-EXTRA_CLEAN_FILES = y.tab.c y.tab.h lex.yy.c y.output lex.backup
+r_mapcalc_OBJS := $(filter-out map3.o xcoor3.o xres3.o, $(AUTO_OBJS))
+r3_mapcalc_OBJS := $(filter-out map.o xcoor.o xres.o, $(AUTO_OBJS))
-OBJS1 := y.tab.o lex.yy.o
-OBJS2 := $(filter-out $(OBJS1), $(patsubst %.c,%.o,$(wildcard *.c)))
-OBJS := $(OBJS1) $(OBJS2)
-r_mapcalc_OBJS := $(filter-out map3.o xcoor3.o xres3.o, $(OBJS))
-r3_mapcalc_OBJS := $(filter-out map.o xcoor.o xres.o, $(OBJS))
-
include $(MODULE_TOPDIR)/include/Make/Multi.make
EXTRA_CFLAGS = $(READLINEINCPATH)
@@ -24,8 +20,8 @@
$(BIN)/$(PGM2)$(EXE): LIBES = $(LIBES2)
$(BIN)/$(PGM3)$(EXE): LIBES = $(LIBES3)
-y.tab.c y.tab.h: mapcalc.y
- $(YACC) -b y -d mapcalc.y
+$(OBJDIR)/mapcalc.yy.o: mapcalc.tab.h
-lex.yy.c: mapcalc.l y.tab.h
- $(LEX) -t mapcalc.l > $@
+.INTERMEDIATE: mapcalc.tab.c mapcalc.tab.h mapcalc.output
+
+.INTERMEDIATE: mapcalc.yy.c
Modified: grass/trunk/raster/r.mapcalc/mapcalc.l
===================================================================
--- grass/trunk/raster/r.mapcalc/mapcalc.l 2008-08-23 21:08:33 UTC (rev 33037)
+++ grass/trunk/raster/r.mapcalc/mapcalc.l 2008-08-23 21:13:06 UTC (rev 33038)
@@ -15,7 +15,7 @@
#include "mapcalc.h"
-#include "y.tab.h"
+#include "mapcalc.tab.h"
#ifndef YY_NULL
#define YY_NULL 0
Modified: grass/trunk/raster/r.watershed/Makefile
===================================================================
--- grass/trunk/raster/r.watershed/Makefile 2008-08-23 21:08:33 UTC (rev 33037)
+++ grass/trunk/raster/r.watershed/Makefile 2008-08-23 21:13:06 UTC (rev 33038)
@@ -11,5 +11,4 @@
default: parsubdirs
-clean: cleansubdirs
Modified: grass/trunk/raster/simwe/Makefile
===================================================================
--- grass/trunk/raster/simwe/Makefile 2008-08-23 21:08:33 UTC (rev 33037)
+++ grass/trunk/raster/simwe/Makefile 2008-08-23 21:13:06 UTC (rev 33038)
@@ -11,7 +11,6 @@
default: parsubdirs
-clean: cleansubdirs
$(SUBDIRS1): simlib
Modified: grass/trunk/raster/wildfire/Makefile
===================================================================
--- grass/trunk/raster/wildfire/Makefile 2008-08-23 21:08:33 UTC (rev 33037)
+++ grass/trunk/raster/wildfire/Makefile 2008-08-23 21:13:06 UTC (rev 33038)
@@ -10,4 +10,3 @@
default: parsubdirs
-clean: cleansubdirs
Modified: grass/trunk/raster3d/Makefile
===================================================================
--- grass/trunk/raster3d/Makefile 2008-08-23 21:08:33 UTC (rev 33037)
+++ grass/trunk/raster3d/Makefile 2008-08-23 21:13:06 UTC (rev 33038)
@@ -13,8 +13,6 @@
r3.to.rast \
base
-include $(MODULE_TOPDIR)/include/Make/Platform.make
-
PGM = raster3dintro
include $(MODULE_TOPDIR)/include/Make/Dir.make
@@ -23,4 +21,3 @@
htmldir: parsubdirs
-clean: cleansubdirs
Modified: grass/trunk/rfc/Makefile
===================================================================
--- grass/trunk/rfc/Makefile 2008-08-23 21:08:33 UTC (rev 33037)
+++ grass/trunk/rfc/Makefile 2008-08-23 21:13:06 UTC (rev 33038)
@@ -1,5 +1,6 @@
MODULE_TOPDIR = ..
+include $(MODULE_TOPDIR)/include/Make/Vars.make
include $(MODULE_TOPDIR)/include/Make/Doxygen.make
all:
Modified: grass/trunk/scripts/Makefile
===================================================================
--- grass/trunk/scripts/Makefile 2008-08-23 21:08:33 UTC (rev 33037)
+++ grass/trunk/scripts/Makefile 2008-08-23 21:13:06 UTC (rev 33038)
@@ -69,4 +69,3 @@
default: parsubdirs
-clean: cleansubdirs
Modified: grass/trunk/sites/Makefile
===================================================================
--- grass/trunk/sites/Makefile 2008-08-23 21:08:33 UTC (rev 33037)
+++ grass/trunk/sites/Makefile 2008-08-23 21:13:06 UTC (rev 33038)
@@ -10,5 +10,4 @@
default: parsubdirs
-clean: cleansubdirs
Modified: grass/trunk/testsuite/Makefile
===================================================================
--- grass/trunk/testsuite/Makefile 2008-08-23 21:08:33 UTC (rev 33037)
+++ grass/trunk/testsuite/Makefile 2008-08-23 21:13:06 UTC (rev 33038)
@@ -7,4 +7,3 @@
default: parsubdirs
-clean: cleansubdirs
Modified: grass/trunk/tools/Makefile
===================================================================
--- grass/trunk/tools/Makefile 2008-08-23 21:08:33 UTC (rev 33037)
+++ grass/trunk/tools/Makefile 2008-08-23 21:13:06 UTC (rev 33038)
@@ -6,4 +6,3 @@
default: parsubdirs
-clean: cleansubdirs
Modified: grass/trunk/vector/Makefile
===================================================================
--- grass/trunk/vector/Makefile 2008-08-23 21:08:33 UTC (rev 33037)
+++ grass/trunk/vector/Makefile 2008-08-23 21:13:06 UTC (rev 33038)
@@ -1,6 +1,8 @@
MODULE_TOPDIR = ..
+include $(MODULE_TOPDIR)/include/Make/Vars.make
+
SUBDIRS = \
v.buffer \
v.build \
@@ -71,8 +73,6 @@
v.vol.rst \
lidar
-include $(MODULE_TOPDIR)/include/Make/Platform.make
-
OGRBASED = v.out.ogr v.in.ogr v.external
#compile if OGR present:
@@ -103,4 +103,3 @@
htmldir: parsubdirs
-clean: cleansubdirs
Modified: grass/trunk/vector/lidar/Makefile
===================================================================
--- grass/trunk/vector/lidar/Makefile 2008-08-23 21:08:33 UTC (rev 33037)
+++ grass/trunk/vector/lidar/Makefile 2008-08-23 21:13:06 UTC (rev 33038)
@@ -13,7 +13,6 @@
default: parsubdirs
-clean: cleansubdirs
$(SUBDIRS1): lidarlib
Modified: grass/trunk/vector/v.digit/Makefile
===================================================================
--- grass/trunk/vector/v.digit/Makefile 2008-08-23 21:08:33 UTC (rev 33037)
+++ grass/trunk/vector/v.digit/Makefile 2008-08-23 21:13:06 UTC (rev 33038)
@@ -5,29 +5,31 @@
LIBES = $(DISPLAYLIB) $(RASTERLIB) $(VECTLIB) $(GISLIB) $(TCLTKLIBPATH) $(TCLTKLIBS)
DEPENDENCIES= $(DISPLAYDEP) $(RASTERDEP) $(VECTDEP) $(GISDEP)
+include $(MODULE_TOPDIR)/include/Make/Module.make
+
EXTRA_CFLAGS = $(XCFLAGS) $(TCLINCDIR) $(TKINCDIR) $(VECT_CFLAGS)
-XTRA_LDFLAGS=$(DFLAGS)
+EXTRA_LDFLAGS = $(DFLAGS)
EXTRA_INC = $(VECT_INC)
-include $(MODULE_TOPDIR)/include/Make/Module.make
-
AUXDIR := $(GISBASE)/etc/v.digit
TCLFILES := $(patsubst %,$(AUXDIR)/%,$(wildcard *.tcl))
GIFFILES := $(patsubst icons/%,$(AUXDIR)/%,$(wildcard icons/*.gif))
XBMFILES := $(patsubst icons/%,$(AUXDIR)/%,$(wildcard icons/*.xbm))
+pre: $(AUXDIR)
+
default: cmd $(TCLFILES) $(GIFFILES) $(XBMFILES)
$(AUXDIR):
if [ ! -d $(ETC) ]; then $(MKDIR) $(ETC); fi
if [ ! -d $(AUXDIR) ]; then $(MKDIR) $@; fi
-$(AUXDIR)/%.tcl: %.tcl $(AUXDIR)
+$(AUXDIR)/%.tcl: %.tcl
$(INSTALL_DATA) $< $@
-$(AUXDIR)/%.gif: icons/%.gif $(AUXDIR)
+$(AUXDIR)/%.gif: icons/%.gif
$(INSTALL_DATA) $< $@
-$(AUXDIR)/%.xbm: icons/%.xbm $(AUXDIR)
+$(AUXDIR)/%.xbm: icons/%.xbm
$(INSTALL_DATA) $< $@
Modified: grass/trunk/vector/v.lrs/Makefile
===================================================================
--- grass/trunk/vector/v.lrs/Makefile 2008-08-23 21:08:33 UTC (rev 33037)
+++ grass/trunk/vector/v.lrs/Makefile 2008-08-23 21:13:06 UTC (rev 33038)
@@ -16,7 +16,6 @@
default: parsubdirs htmldir
-clean: cleansubdirs
$(SUBDIRS1): lib
Modified: grass/trunk/visualization/Makefile
===================================================================
--- grass/trunk/visualization/Makefile 2008-08-23 21:08:33 UTC (rev 33037)
+++ grass/trunk/visualization/Makefile 2008-08-23 21:13:06 UTC (rev 33038)
@@ -2,17 +2,17 @@
SUBDIRS =
-include $(MODULE_TOPDIR)/include/Make/Platform.make
+include $(MODULE_TOPDIR)/include/Make/Vars.make
#compile if OpenGL and Tcl/Tk present:
-ifneq ($(strip $(OPENGLLIB)),)
+ifneq ($(USE_OPENGL),)
ifneq ($(strip $(TCLTKLIBS)),)
SUBDIRS += nviz
endif
endif
#compile if OpenGL present
-ifneq ($(strip $(OPENGLLIB)),)
+ifneq ($(USE_OPENGL),)
SUBDIRS += nviz2
endif
@@ -29,5 +29,4 @@
default: parsubdirs
-clean: cleansubdirs
Modified: grass/trunk/visualization/nviz/Makefile
===================================================================
--- grass/trunk/visualization/nviz/Makefile 2008-08-23 21:08:33 UTC (rev 33037)
+++ grass/trunk/visualization/nviz/Makefile 2008-08-23 21:13:06 UTC (rev 33038)
@@ -1,17 +1,15 @@
MODULE_TOPDIR = ../..
-include $(MODULE_TOPDIR)/include/Make/Platform.make
-include $(MODULE_TOPDIR)/include/Make/Grass.make
+PGM=nviz
+include $(MODULE_TOPDIR)/include/Make/Other.make
+
VER=2.2
NV_VER=nviz$(VER)
-PGM=nviz
INSTALL_DIR=$(GISBASE)/etc/$(NV_VER)
CLEAN_SUBDIRS = src
-include $(MODULE_TOPDIR)/include/Make/Rules.make
-
SCRIPTS := \
scripts/script_get_line \
scripts/script_play \
Modified: grass/trunk/visualization/nviz/html/Makefile
===================================================================
--- grass/trunk/visualization/nviz/html/Makefile 2008-08-23 21:08:33 UTC (rev 33037)
+++ grass/trunk/visualization/nviz/html/Makefile 2008-08-23 21:13:06 UTC (rev 33038)
@@ -1,7 +1,6 @@
MODULE_TOPDIR = ../../..
-include $(MODULE_TOPDIR)/include/Make/Platform.make
-include $(MODULE_TOPDIR)/include/Make/Grass.make
+include $(MODULE_TOPDIR)/include/Make/Vars.make
GRASS_NVIZ_DOCS=$(GISBASE)/docs/html/nviz
Modified: grass/trunk/visualization/nviz/src/Makefile
===================================================================
--- grass/trunk/visualization/nviz/src/Makefile 2008-08-23 21:08:33 UTC (rev 33037)
+++ grass/trunk/visualization/nviz/src/Makefile 2008-08-23 21:13:06 UTC (rev 33038)
@@ -3,9 +3,10 @@
MODULE_TOPDIR = ../../..
-include $(MODULE_TOPDIR)/include/Make/Platform.make
-include $(MODULE_TOPDIR)/include/Make/Grass.make
-include $(MODULE_TOPDIR)/include/Make/Rules.make
+include $(MODULE_TOPDIR)/include/Make/Vars.make
+MOD_OBJS := $(filter-out mkdspf_%.o,$(AUTO_OBJS))
+include $(MODULE_TOPDIR)/include/Make/Other.make
+include $(MODULE_TOPDIR)/include/Make/Compile.make
# These should be set by the doconfigure script
NVWISH_VER=NVWISH2.2
@@ -22,10 +23,6 @@
SURFLIB = $(OGSFLIB)
-# Stuff for mkdspf - not yet implemented
-# DSPLIB = $(LIBDIR)/libes/dspf/libdsp3.a
-# DSPINC = -I$(LIBDIR)/libes/dspf
-
EXTRA_INC = $(VECT_INC)
EXTRA_CFLAGS= $(TCLINCDIR) $(TKINCDIR) \
$(INC) \
@@ -36,29 +33,18 @@
EXTRA_CFLAGS += $(XCFLAGS)
endif
-XTRA_LDFLAGS=$(TCLTKLIBPATH) $(TCLTKLIBS) $(OGL_LIBS)
+EXTRA_LDFLAGS=$(TCLTKLIBPATH) $(TCLTKLIBS) $(OGL_LIBS)
-OBJS = nvizAppInit.o change_view.o draw.o exag.o glwrappers.o \
- init_commands.o lights.o map_obj.o misc.o nviz_init.o \
- position.o quick_draw.o anim_support.o cutplane_obj.o \
- script_support.o do_zoom.o \
- label.o nvizMain.o togl.o togl_cb.o\
- query_vect.o \
- volume.o \
- togl_flythrough.o pick_vect_commands.o site_attr_commands.o site_highlight_commands.o
+LIBES = $(SURFLIB) \
+ $(BITMAPLIB) $(LINKMLIB) $(VECTLIB) $(SITESLIB) $(FORMLIB) $(DBMILIB) \
+ $(G3DLIB) $(GISLIB) \
+ $(DATETIMELIB) $(TIFFLIBPATH) $(TIFFLIB)
-# mkdspf_calc_linefax.o mkdspf_init_file.o mkdspf_main.o \
-# mkdspf_fill_cfax.o mkdspf_iso_surface.o
+DEPENDENCIES = $(VECTDEP) $(BITMAPDEP) $(LINKMDEP) $(FORMDEP) $(DBMIDEP) $(GISDEP)
-ARCH_OBJS := $(foreach obj,$(OBJS),$(OBJDIR)/$(obj))
-
EXTRA_CLEAN_FILES = nvwish$(EXE)
default: nvwish$(EXE)
-nvwish$(EXE): $(ARCH_OBJS) $(VECTDEP) $(BITMAPDEP) $(LINKMDEP) $(FORMDEP) $(DBMIDEP $(GISDEP)
- $(CC) $(LDFLAGS) $(XTRA_LDFLAGS) -o $@ $(ARCH_OBJS) $(FMODE_OBJ) $(SURFLIB) \
- $(BITMAPLIB) $(LINKMLIB) $(VECTLIB) $(SITESLIB) $(FORMLIB) $(DBMILIB) \
- $(G3DLIB) $(GISLIB) $(XDRLIB) \
- $(DATETIMELIB) $(TIFFLIBPATH) $(TIFFLIB) \
- $(MATHLIB)
+nvwish$(EXE): $(ARCH_OBJS) $(DEPENDENCIES)
+ $(call linker)
Deleted: grass/trunk/visualization/nviz/src/buildPg.c
===================================================================
--- grass/trunk/visualization/nviz/src/buildPg.c 2008-08-23 21:08:33 UTC (rev 33037)
+++ grass/trunk/visualization/nviz/src/buildPg.c 2008-08-23 21:13:06 UTC (rev 33038)
@@ -1,28 +0,0 @@
-#include <grass/gis.h>
-#include "pg.h"
-#include <stdio.h>
-
-
-char *buildPg(char *ktab, char *keycat, int curcat)
-{
-
-
- static char SQL_stmt[QRY_LENGTH];
-
-
- sprintf(SQL_stmt, "SELECT * from %s where %s=%d", ktab, keycat, curcat);
-
- return (SQL_stmt);
-
-}
-
-char *buildPgSite(char *ktab, char *ycol, char *xcol)
-{
- static char SQL_stmt[QRY_LENGTH];
-
- sprintf(SQL_stmt,
- "SELECT * from %s where point(%s,%s) ", ktab, xcol, ycol);
-
- return (SQL_stmt);
-
-}
Deleted: grass/trunk/visualization/nviz/src/getCat.c
===================================================================
--- grass/trunk/visualization/nviz/src/getCat.c 2008-08-23 21:08:33 UTC (rev 33037)
+++ grass/trunk/visualization/nviz/src/getCat.c 2008-08-23 21:13:06 UTC (rev 33038)
@@ -1,94 +0,0 @@
-#include <grass/gis.h>
-#include <grass/display.h>
-#include <grass/Vect.h>
-#include "pg.h"
-#include <stdio.h>
-#include <string.h>
-
-char *getCat(struct Map_info *Map, float x, float y, int *i)
-{
-
- static char buf[32];
- double east, north;
-
-
- plus_t line, area;
- int dbCat;
-
- memset(buf, '\0', sizeof(buf));
- dbCat = -1;
- east = (double)x;
- north = (double)y;
-
-
-
-
- line = dig_point_to_line(Map, east, north, -1);
- area = dig_point_to_area(Map, east, north);
-
-
- if (line + area == 0) {
- sprintf(buf, "Nothing found.\n");
- dbCat = -1;
- *i = dbCat;
- return buf;
-
- }
-
- if ((line > 0) && (area == 0)) {
-
- if ((dbCat = V2_line_att(Map, line))) {
-
- sprintf(buf, "Line category:\n");
- }
- else
- sprintf(buf, "Line category not found\n");
- }
- else if (area > 0) {
-
- if ((dbCat = V2_area_att(Map, area))) {
-
- sprintf(buf, "Area category:\n");
- }
- else {
- sprintf(buf, "Area category not found\n");
- if (line > 0) {
- if ((dbCat = V2_line_att(Map, line))) {
- sprintf(buf, "Line category:\n");
- }
- else
- sprintf(buf, "Line category not found\n");
- }
- }
- }
-
- *i = dbCat;
- return buf;
-}
-
-int fillSQLstruct(struct Sql *tp, float x, float y, int dist)
-{
- double east, north;
- int ret = 0;
-
-
- east = (double)x;
- north = (double)y;
- tp->centX = east;
- tp->centY = north;
- tp->distance = (double)dist;
- tp->permX = east + tp->distance;
- tp->permY = north + tp->distance;
- tp->maxX = east + tp->distance;
- tp->maxY = north + tp->distance;
- tp->minX = east - tp->distance;
- tp->minY = north - tp->distance;
-
-
- tp->rad2 = ((tp->permX - tp->centX) * (tp->permX - tp->centX) +
- (tp->permY - tp->centY) * (tp->permY - tp->centY));
-
-
- return (ret);
-
-}
Deleted: grass/trunk/visualization/nviz/src/openvect.c
===================================================================
--- grass/trunk/visualization/nviz/src/openvect.c 2008-08-23 21:08:33 UTC (rev 33037)
+++ grass/trunk/visualization/nviz/src/openvect.c 2008-08-23 21:13:06 UTC (rev 33038)
@@ -1,13 +0,0 @@
-#include <grass/gis.h>
-
-char *openvect(name)
- char *name;
-{
- char *mapset;
-
- mapset = G_find_vector2(name, "");
-
- if (mapset == NULL)
- fprintf(stderr, "warning: %s - vector map not found\n", name);
- return mapset;
-}
Deleted: grass/trunk/visualization/nviz/src/query_postgr.c
===================================================================
--- grass/trunk/visualization/nviz/src/query_postgr.c 2008-08-23 21:08:33 UTC (rev 33037)
+++ grass/trunk/visualization/nviz/src/query_postgr.c 2008-08-23 21:13:06 UTC (rev 33038)
@@ -1,142 +0,0 @@
-#include <stdio.h>
-#include <string.h>
-#include <grass/gis.h>
-#include <grass/display.h>
-#include <grass/Vect.h>
-#include "pg.h"
-
-
-
-char *query_postgr(name, keytable, col, x, y)
-
- char *name, *keytable, *col;
- float x, y;
-
-#if defined(HAVE_LIBPQ_FE_H)
-
-{
-
- char *openvect();
- int level;
- static char buf[32];
- struct Map_info P_map;
-
- char *SQL_stmt;
- static char long_str[2 * QRY_LENGTH];
- char *qry_str;
-
- int dbCat;
- char *mapset, *dbname;
-
-
- memset(buf, '\0', sizeof(buf));
- memset(long_str, '\0', sizeof(long_str));
-
- /* Check DATABASE env variable */
- if ((dbname = G__getenv("PG_DBASE")) == NULL) {
- sprintf(buf, "Please run g.select.pg first\n");
- return buf;
- }
-
-
- if ((mapset = openvect(name)) == NULL) {
- sprintf(buf, "Unable to open %s\n", name);
- return buf;
- }
-
-
- level = Vect_open_old(&P_map, name, mapset);
- if (level < 0)
- G_fatal_error("Can't open vector map");
- if (level < 2)
- G_fatal_error("You must first run v.support on vector map");
-
-
-
- qry_str = (char *)getCat(&P_map, x, y, &dbCat);
- sprintf(long_str, "%s", qry_str);
- if (dbCat > 0) {
- SQL_stmt = (char *)buildPg(keytable, col, dbCat);
- qry_str = (char *)runPg(SQL_stmt);
- if (qry_str != NULL)
- strncat(long_str, qry_str, QRY_LENGTH);
- else {
- qry_str = "\nThere's been ERROR from Postgres\n";
- strncat(long_str, qry_str, QRY_LENGTH);
- }
- }
-
- Vect_close(&P_map);
- return long_str;
-
-}
-#else
-{
-
-
-
- static char long_str[128] =
- "Postgres support had not been enabled during pre-compile.\nYou should recompile NVIZ with Postgres support.\n";
-
-
-
- return long_str;
-
-}
-
-#endif
-char *query_pg_site(name, xcol, ycol, dist, x, y)
-
- char *name, *xcol, *ycol;
- int dist;
- float x, y;
-
-#if defined(HAVE_LIBPQ_FE_H)
-
-{
-
- char *dbname;
- static char buf[32];
- char *SQL_stmt;
- static char long_str[2 * QRY_LENGTH];
- char *qry_str;
- struct Sql *pts;
- int ret;
-
- memset(buf, '\0', sizeof(buf));
- memset(long_str, '\0', sizeof(long_str));
-
- /* Check DATABASE env variable */
- if ((dbname = G__getenv("PG_DBASE")) == NULL) {
- sprintf(buf, "Please run g.select.pg first\n");
- return buf;
- }
- SQL_stmt = buildPgSite(name, ycol, xcol);
-
- /* Initialze SQL query structure */
- pts = (struct Sql *)G_malloc(sizeof(struct Sql));
- G_zero(pts, sizeof(struct Sql));
- ret = fillSQLstruct(pts, x, y, dist);
-
- qry_str = do_query(SQL_stmt, pts);
-
- if (qry_str != NULL)
- strncat(long_str, qry_str, QRY_LENGTH);
- else {
- qry_str = "\nThere's been ERROR from Postgres\n";
- strncat(long_str, qry_str, QRY_LENGTH);
- }
- return long_str;
-}
-#else
-{
-
- static char long_str[128] =
- "Postgres support had not been enabled during pre-compile.\nYou should recompile NVIZ with Postgres support.\n";
-
-
-
- return long_str;
-}
-
-#endif
Deleted: grass/trunk/visualization/nviz/src/runPg.c
===================================================================
--- grass/trunk/visualization/nviz/src/runPg.c 2008-08-23 21:08:33 UTC (rev 33037)
+++ grass/trunk/visualization/nviz/src/runPg.c 2008-08-23 21:13:06 UTC (rev 33038)
@@ -1,181 +0,0 @@
-#include <grass/config.h>
-#if defined(HAVE_LIBPQ_FE_H)
-#include <grass/gis.h>
-#include "pg.h"
-#include <libpq-fe.h>
-#include <stdio.h>
-#include <string.h>
-
-char *runPg(char *SQL_stmt)
-{
- char buf[QRY_LENGTH];
- char chunk[QRY_LENGTH];
- static char long_str[2 * QRY_LENGTH];
-
- char sqlcmd[QRY_LENGTH];
- int i, j, nrows, nfields;
-
- PGconn *pg_conn;
- PGresult *res;
- char *pghost;
- int vrbs = 1;
-
- memset(long_str, '\0', sizeof(long_str));
- memset(sqlcmd, '\0', sizeof(sqlcmd));
- memset(buf, '\0', sizeof(buf));
- memset(chunk, '\0', sizeof(chunk));
-
- sprintf(sqlcmd, "%s", SQL_stmt);
-
- if (vrbs)
- fprintf(stderr, "\n\nExecuting\n%s\n---------------------\n", sqlcmd);
-
- pghost = G__getenv("PG_HOST");
- pg_conn = PQsetdb(pghost, NULL, NULL, NULL, G_getenv("PG_DBASE"));
-
- if (PQstatus(pg_conn) == CONNECTION_BAD) {
- fprintf(stderr, "Error: connect Postgres:%s\n",
- PQerrorMessage(pg_conn));
- PQfinish(pg_conn);
- return NULL;
- }
-
- res = PQexec(pg_conn, sqlcmd);
- if (!res || PQresultStatus(res) != PGRES_TUPLES_OK) {
- fprintf(stderr, "Error: select Postgres:%s\n",
- PQerrorMessage(pg_conn));
- PQclear(res);
- PQfinish(pg_conn);
- return NULL;
- }
-
- nfields = PQnfields(res);
- nrows = PQntuples(res);
-
- if (nrows == 1 && vrbs) {
- for (j = 0; j < nfields; j++) {
- strncpy(buf, PQgetvalue(res, 0, j), QRY_LENGTH);
- sprintf(chunk, "%10s I %s\n", PQfname(res, j), buf);
- strncat(long_str, chunk, QRY_LENGTH);
- }
- }
- else if (nrows) {
-
- fprintf(stderr, "%s", PQfname(res, 0));
- for (j = 1; j < nfields; j++) {
- fprintf(stderr, ",%s", PQfname(res, j));
- }
- fprintf(stderr, "\n");
-
- for (i = 0; i < nrows; i++) {
- for (j = 0; j < nfields; j++) {
- strncpy(buf, PQgetvalue(res, i, j), QRY_LENGTH);
- fprintf(stderr, "%s,", buf);
- }
- fprintf(stderr, "\n");
- }
- fprintf(stderr, "\n%d rows selected\n", nrows);
- }
-
- if (vrbs) {
- sprintf(chunk, "\n%d rows selected\n", nrows);
- strncat(long_str, chunk, QRY_LENGTH);
- }
-
-
- PQclear(res);
- /* explicitly close select result to avoid memory leaks */
-
- PQfinish(pg_conn);
- /* close connection to database */
-
- return long_str;
-}
-
-char *do_query(char *SQL_stmt, struct Sql *pts)
-{
- char buf[QRY_LENGTH];
- char chunk[QRY_LENGTH];
- static char long_str[2 * QRY_LENGTH];
-
- char sqlcmd[QRY_LENGTH];
- int i, j, nrows, nfields;
-
- PGconn *pg_conn;
- PGresult *res;
- char *pghost;
-
- memset(long_str, '\0', sizeof(long_str));
- memset(sqlcmd, '\0', sizeof(sqlcmd));
- memset(buf, '\0', sizeof(buf));
- memset(chunk, '\0', sizeof(chunk));
-
-
- sprintf(sqlcmd,
- "%s @ '(%f,%f,%f,%f)'::box", SQL_stmt,
- pts->minX, pts->minY, pts->maxX, pts->maxY);
-
- fprintf(stderr,
- "\n\nExecuting\n%s;\n clause @ '( )'::box addded autonmatically.\n\n",
- sqlcmd);
- pghost = G__getenv("PG_HOST");
- pg_conn = PQsetdb(pghost, NULL, NULL, NULL, G_getenv("PG_DBASE"));
-
- if (PQstatus(pg_conn) == CONNECTION_BAD) {
- fprintf(stderr, "Error: connect Postgres:%s\n",
- PQerrorMessage(pg_conn));
- PQfinish(pg_conn);
- return NULL;
- }
-
- res = PQexec(pg_conn, sqlcmd);
- if (!res || PQresultStatus(res) != PGRES_TUPLES_OK) {
- fprintf(stderr, "Error: select Postgres:%s\n",
- PQerrorMessage(pg_conn));
- PQclear(res);
- PQfinish(pg_conn);
- return NULL;
- }
-
- nfields = PQnfields(res);
- nrows = PQntuples(res);
-
- if (nrows == 1) {
- for (j = 0; j < nfields; j++) {
- strncpy(buf, PQgetvalue(res, 0, j), QRY_LENGTH);
- sprintf(chunk, "%10s I %s\n", PQfname(res, j), buf);
- strncat(long_str, chunk, QRY_LENGTH);
- }
- }
- else if (nrows) {
-
- fprintf(stderr, "%s", PQfname(res, 0));
- for (j = 1; j < nfields; j++) {
- fprintf(stderr, ",%s", PQfname(res, j));
- }
- fprintf(stderr, "\n");
-
- for (i = 0; i < nrows; i++) {
- for (j = 0; j < nfields; j++) {
- strncpy(buf, PQgetvalue(res, i, j), QRY_LENGTH);
- fprintf(stderr, "%s,", buf);
- }
- fprintf(stderr, "\n");
- }
- fprintf(stderr, "\n%d rows selected\n", nrows);
- }
-
-
- sprintf(chunk, "\n%d rows selected\n", nrows);
- strncat(long_str, chunk, QRY_LENGTH);
-
-
- PQclear(res);
- /* explicitly close select result to avoid memory leaks */
-
- PQfinish(pg_conn);
- /* close connection to database */
-
- return long_str;
-}
-#endif
Deleted: grass/trunk/visualization/nviz/src/vect.c
===================================================================
--- grass/trunk/visualization/nviz/src/vect.c 2008-08-23 21:08:33 UTC (rev 33037)
+++ grass/trunk/visualization/nviz/src/vect.c 2008-08-23 21:13:06 UTC (rev 33038)
@@ -1,17 +0,0 @@
-#include "interface.h"
-#include "string.h"
-#include "coldefs.h"
-
-vect_translate(id, type, data, interp)
- int id, type;
- Nv_data *data;
- Tcl_Interp *interp;
-{
- /* Currently I can find no routine which uses this so I'll take it out
- vect_data *vect;
-
- vect = &(data->vect[data->CurVect]);
-
- GV_set_trans(vect->id, vect->xtrans, vect->ytrans, vect->ztrans);
- */ ;
-}
Modified: grass/trunk/visualization/nviz2/Makefile
===================================================================
--- grass/trunk/visualization/nviz2/Makefile 2008-08-23 21:08:33 UTC (rev 33037)
+++ grass/trunk/visualization/nviz2/Makefile 2008-08-23 21:13:06 UTC (rev 33038)
@@ -2,9 +2,7 @@
SUBDIRS = cmd
-include $(MODULE_TOPDIR)/include/Make/Platform.make
include $(MODULE_TOPDIR)/include/Make/Dir.make
default: parsubdirs
-clean: cleansubdirs
Modified: grass/trunk/visualization/nviz2/cmd/Makefile
===================================================================
--- grass/trunk/visualization/nviz2/cmd/Makefile 2008-08-23 21:08:33 UTC (rev 33037)
+++ grass/trunk/visualization/nviz2/cmd/Makefile 2008-08-23 21:13:06 UTC (rev 33038)
@@ -21,7 +21,7 @@
EXTRA_CFLAGS += $(XCFLAGS)
endif
-XTRA_LDFLAGS = $(OGL_LIBS)
+EXTRA_LDFLAGS = $(OGL_LIBS)
EXTRA_CFLAGS=$(XCFLAGS) $(XMINC)
More information about the grass-commit
mailing list