[GRASS-SVN] r37477 - in grass/branches/releasebranch_6_4:
include/Make swig swig/include swig/include/python swig/python
svn_grass at osgeo.org
svn_grass at osgeo.org
Mon May 25 11:54:04 EDT 2009
Author: martinl
Date: 2009-05-25 11:54:04 -0400 (Mon, 25 May 2009)
New Revision: 37477
Added:
grass/branches/releasebranch_6_4/include/Make/Python.make
grass/branches/releasebranch_6_4/swig/include/
grass/branches/releasebranch_6_4/swig/include/arraystats.i
grass/branches/releasebranch_6_4/swig/include/cluster.i
grass/branches/releasebranch_6_4/swig/include/date.i
grass/branches/releasebranch_6_4/swig/include/dbmi.i
grass/branches/releasebranch_6_4/swig/include/display.i
grass/branches/releasebranch_6_4/swig/include/g3d.i
grass/branches/releasebranch_6_4/swig/include/grass.i
grass/branches/releasebranch_6_4/swig/include/imagery.i
grass/branches/releasebranch_6_4/swig/include/math.i
grass/branches/releasebranch_6_4/swig/include/proj.i
grass/branches/releasebranch_6_4/swig/include/python/
grass/branches/releasebranch_6_4/swig/include/python/common.i
grass/branches/releasebranch_6_4/swig/include/python/my_typemaps.i
grass/branches/releasebranch_6_4/swig/include/python/utils.i
grass/branches/releasebranch_6_4/swig/include/raster.i
grass/branches/releasebranch_6_4/swig/include/stats.i
grass/branches/releasebranch_6_4/swig/include/trans.i
grass/branches/releasebranch_6_4/swig/include/vector.i
grass/branches/releasebranch_6_4/swig/include/vedit.i
grass/branches/releasebranch_6_4/swig/python/Makefile
grass/branches/releasebranch_6_4/swig/python/__init__.py
Removed:
grass/branches/releasebranch_6_4/swig/include/arraystats.i
grass/branches/releasebranch_6_4/swig/include/cluster.i
grass/branches/releasebranch_6_4/swig/include/date.i
grass/branches/releasebranch_6_4/swig/include/dbmi.i
grass/branches/releasebranch_6_4/swig/include/display.i
grass/branches/releasebranch_6_4/swig/include/g3d.i
grass/branches/releasebranch_6_4/swig/include/grass.i
grass/branches/releasebranch_6_4/swig/include/imagery.i
grass/branches/releasebranch_6_4/swig/include/math.i
grass/branches/releasebranch_6_4/swig/include/proj.i
grass/branches/releasebranch_6_4/swig/include/python/
grass/branches/releasebranch_6_4/swig/include/python/common.i
grass/branches/releasebranch_6_4/swig/include/python/my_typemaps.i
grass/branches/releasebranch_6_4/swig/include/python/utils.i
grass/branches/releasebranch_6_4/swig/include/raster.i
grass/branches/releasebranch_6_4/swig/include/stats.i
grass/branches/releasebranch_6_4/swig/include/trans.i
grass/branches/releasebranch_6_4/swig/include/vector.i
grass/branches/releasebranch_6_4/swig/include/vedit.i
grass/branches/releasebranch_6_4/swig/python/Makefile.in
grass/branches/releasebranch_6_4/swig/python/my_typemaps.i
grass/branches/releasebranch_6_4/swig/python/python_grass6.i
grass/branches/releasebranch_6_4/swig/python/renames.i
Modified:
grass/branches/releasebranch_6_4/swig/python/
Log:
glynn: Move SWIG interfaces to swig/include
(merge from devbr6, r37476)
Copied: grass/branches/releasebranch_6_4/include/Make/Python.make (from rev 37476, grass/branches/develbranch_6/include/Make/Python.make)
===================================================================
--- grass/branches/releasebranch_6_4/include/Make/Python.make (rev 0)
+++ grass/branches/releasebranch_6_4/include/Make/Python.make 2009-05-25 15:54:04 UTC (rev 37477)
@@ -0,0 +1,14 @@
+
+PYTHON = python
+PYMOD_LD = $(SHLIB_LD)
+PYMOD_LDFLAGS = $(SHLIB_LDFLAGS) -L$(ARCH_LIBDIR) $(PYTHONLDFLAGS)
+PYMOD_CFLAGS = $(SHLIB_CFLAGS) $(PYTHONINC) $(PYTHON_CFLAGS)
+
+%.pyc: %.py
+ $(PYTHON) -m py_compile $<
+
+%_wrap.c %.py: %.i $(EXTRA_SWIG)
+ $(SWIG) $(ARCH_INC) -python -module $* -shadow $<
+
+_%.so: $(OBJDIR)/%_wrap.o $(_%_so_FILES)
+ $(PYMOD_LD) -o $@ $(LDFLAGS) $(EXTRA_LDFLAGS) $(PYMOD_LDFLAGS) $(filter %.o,$^) $($*_LIBS) $(LIBES) $(EXTRA_LIBS)
Copied: grass/branches/releasebranch_6_4/swig/include (from rev 37476, grass/branches/develbranch_6/swig/include)
Deleted: grass/branches/releasebranch_6_4/swig/include/arraystats.i
===================================================================
--- grass/branches/develbranch_6/swig/include/arraystats.i 2009-05-25 15:43:01 UTC (rev 37476)
+++ grass/branches/releasebranch_6_4/swig/include/arraystats.i 2009-05-25 15:54:04 UTC (rev 37477)
@@ -1,8 +0,0 @@
-
-%include "common.i"
-
-%{
-#include <grass/arraystats.h>
-%}
-
-%include "grass/arraystats.h"
Copied: grass/branches/releasebranch_6_4/swig/include/arraystats.i (from rev 37476, grass/branches/develbranch_6/swig/include/arraystats.i)
===================================================================
--- grass/branches/releasebranch_6_4/swig/include/arraystats.i (rev 0)
+++ grass/branches/releasebranch_6_4/swig/include/arraystats.i 2009-05-25 15:54:04 UTC (rev 37477)
@@ -0,0 +1,8 @@
+
+%include "common.i"
+
+%{
+#include <grass/arraystats.h>
+%}
+
+%include "grass/arraystats.h"
Deleted: grass/branches/releasebranch_6_4/swig/include/cluster.i
===================================================================
--- grass/branches/develbranch_6/swig/include/cluster.i 2009-05-25 15:43:01 UTC (rev 37476)
+++ grass/branches/releasebranch_6_4/swig/include/cluster.i 2009-05-25 15:54:04 UTC (rev 37477)
@@ -1,8 +0,0 @@
-
-%include "common.i"
-
-%{
-#include <grass/cluster.h>
-%}
-
-%include "grass/cluster.h"
Copied: grass/branches/releasebranch_6_4/swig/include/cluster.i (from rev 37476, grass/branches/develbranch_6/swig/include/cluster.i)
===================================================================
--- grass/branches/releasebranch_6_4/swig/include/cluster.i (rev 0)
+++ grass/branches/releasebranch_6_4/swig/include/cluster.i 2009-05-25 15:54:04 UTC (rev 37477)
@@ -0,0 +1,8 @@
+
+%include "common.i"
+
+%{
+#include <grass/cluster.h>
+%}
+
+%include "grass/cluster.h"
Deleted: grass/branches/releasebranch_6_4/swig/include/date.i
===================================================================
--- grass/branches/develbranch_6/swig/include/date.i 2009-05-25 15:43:01 UTC (rev 37476)
+++ grass/branches/releasebranch_6_4/swig/include/date.i 2009-05-25 15:54:04 UTC (rev 37477)
@@ -1,9 +0,0 @@
-
-%include "common.i"
-
-%{
-#include <grass/datetime.h>
-%}
-
-%include "grass/datetime.h"
-%include "grass/P_datetime.h"
Copied: grass/branches/releasebranch_6_4/swig/include/date.i (from rev 37476, grass/branches/develbranch_6/swig/include/date.i)
===================================================================
--- grass/branches/releasebranch_6_4/swig/include/date.i (rev 0)
+++ grass/branches/releasebranch_6_4/swig/include/date.i 2009-05-25 15:54:04 UTC (rev 37477)
@@ -0,0 +1,9 @@
+
+%include "common.i"
+
+%{
+#include <grass/datetime.h>
+%}
+
+%include "grass/datetime.h"
+%include "grass/P_datetime.h"
Deleted: grass/branches/releasebranch_6_4/swig/include/dbmi.i
===================================================================
--- grass/branches/develbranch_6/swig/include/dbmi.i 2009-05-25 15:43:01 UTC (rev 37476)
+++ grass/branches/releasebranch_6_4/swig/include/dbmi.i 2009-05-25 15:54:04 UTC (rev 37477)
@@ -1,8 +0,0 @@
-
-%include "common.i"
-
-%{
-#include <grass/dbmi.h>
-%}
-
-%include "grass/dbmi.h"
Copied: grass/branches/releasebranch_6_4/swig/include/dbmi.i (from rev 37476, grass/branches/develbranch_6/swig/include/dbmi.i)
===================================================================
--- grass/branches/releasebranch_6_4/swig/include/dbmi.i (rev 0)
+++ grass/branches/releasebranch_6_4/swig/include/dbmi.i 2009-05-25 15:54:04 UTC (rev 37477)
@@ -0,0 +1,8 @@
+
+%include "common.i"
+
+%{
+#include <grass/dbmi.h>
+%}
+
+%include "grass/dbmi.h"
Deleted: grass/branches/releasebranch_6_4/swig/include/display.i
===================================================================
--- grass/branches/develbranch_6/swig/include/display.i 2009-05-25 15:43:01 UTC (rev 37476)
+++ grass/branches/releasebranch_6_4/swig/include/display.i 2009-05-25 15:54:04 UTC (rev 37477)
@@ -1,8 +0,0 @@
-
-%include "common.i"
-
-%{
-#include <grass/display.h>
-%}
-
-%include "grass/display.h"
Copied: grass/branches/releasebranch_6_4/swig/include/display.i (from rev 37476, grass/branches/develbranch_6/swig/include/display.i)
===================================================================
--- grass/branches/releasebranch_6_4/swig/include/display.i (rev 0)
+++ grass/branches/releasebranch_6_4/swig/include/display.i 2009-05-25 15:54:04 UTC (rev 37477)
@@ -0,0 +1,8 @@
+
+%include "common.i"
+
+%{
+#include <grass/display.h>
+%}
+
+%include "grass/display.h"
Deleted: grass/branches/releasebranch_6_4/swig/include/g3d.i
===================================================================
--- grass/branches/develbranch_6/swig/include/g3d.i 2009-05-25 15:43:01 UTC (rev 37476)
+++ grass/branches/releasebranch_6_4/swig/include/g3d.i 2009-05-25 15:54:04 UTC (rev 37477)
@@ -1,8 +0,0 @@
-
-%include "common.i"
-
-%{
-#include <grass/G3d.h>
-%}
-
-%include "grass/G3d.h"
Copied: grass/branches/releasebranch_6_4/swig/include/g3d.i (from rev 37476, grass/branches/develbranch_6/swig/include/g3d.i)
===================================================================
--- grass/branches/releasebranch_6_4/swig/include/g3d.i (rev 0)
+++ grass/branches/releasebranch_6_4/swig/include/g3d.i 2009-05-25 15:54:04 UTC (rev 37477)
@@ -0,0 +1,8 @@
+
+%include "common.i"
+
+%{
+#include <grass/G3d.h>
+%}
+
+%include "grass/G3d.h"
Deleted: grass/branches/releasebranch_6_4/swig/include/grass.i
===================================================================
--- grass/branches/develbranch_6/swig/include/grass.i 2009-05-25 15:43:01 UTC (rev 37476)
+++ grass/branches/releasebranch_6_4/swig/include/grass.i 2009-05-25 15:54:04 UTC (rev 37477)
@@ -1,31 +0,0 @@
-
-%include "common.i"
-
-%include "grass/gis.h"
-%include "grass/gisdefs.h"
-
-%pythoncode %{
-import sys
-
-def G_gisinit(pgm):
- G__gisinit(GIS_H_VERSION, pgm)
-
-def G__get_trace():
- f = sys._getframe(1)
- ln = f.f_lineno
- fi = f.f_code.co_filename
- return fi, ln
-
-def G_malloc(n):
- fi, ln = G__get_trace()
- return G__malloc(fi, ln, n)
-
-def G_calloc(m, n):
- fi, ln = G__get_trace()
- return G__calloc(fi, ln, m, n)
-
-def G_realloc(p, n):
- fi, ln = G__get_trace()
- return G__realloc(fi, ln, p, n)
-%}
-
Copied: grass/branches/releasebranch_6_4/swig/include/grass.i (from rev 37476, grass/branches/develbranch_6/swig/include/grass.i)
===================================================================
--- grass/branches/releasebranch_6_4/swig/include/grass.i (rev 0)
+++ grass/branches/releasebranch_6_4/swig/include/grass.i 2009-05-25 15:54:04 UTC (rev 37477)
@@ -0,0 +1,31 @@
+
+%include "common.i"
+
+%include "grass/gis.h"
+%include "grass/gisdefs.h"
+
+%pythoncode %{
+import sys
+
+def G_gisinit(pgm):
+ G__gisinit(GIS_H_VERSION, pgm)
+
+def G__get_trace():
+ f = sys._getframe(1)
+ ln = f.f_lineno
+ fi = f.f_code.co_filename
+ return fi, ln
+
+def G_malloc(n):
+ fi, ln = G__get_trace()
+ return G__malloc(fi, ln, n)
+
+def G_calloc(m, n):
+ fi, ln = G__get_trace()
+ return G__calloc(fi, ln, m, n)
+
+def G_realloc(p, n):
+ fi, ln = G__get_trace()
+ return G__realloc(fi, ln, p, n)
+%}
+
Deleted: grass/branches/releasebranch_6_4/swig/include/imagery.i
===================================================================
--- grass/branches/develbranch_6/swig/include/imagery.i 2009-05-25 15:43:01 UTC (rev 37476)
+++ grass/branches/releasebranch_6_4/swig/include/imagery.i 2009-05-25 15:54:04 UTC (rev 37477)
@@ -1,9 +0,0 @@
-
-%include "common.i"
-
-%{
-#include <grass/imagery.h>
-%}
-
-%include "grass/imagery.h"
-%include "grass/imagedefs.h"
Copied: grass/branches/releasebranch_6_4/swig/include/imagery.i (from rev 37476, grass/branches/develbranch_6/swig/include/imagery.i)
===================================================================
--- grass/branches/releasebranch_6_4/swig/include/imagery.i (rev 0)
+++ grass/branches/releasebranch_6_4/swig/include/imagery.i 2009-05-25 15:54:04 UTC (rev 37477)
@@ -0,0 +1,9 @@
+
+%include "common.i"
+
+%{
+#include <grass/imagery.h>
+%}
+
+%include "grass/imagery.h"
+%include "grass/imagedefs.h"
Deleted: grass/branches/releasebranch_6_4/swig/include/math.i
===================================================================
--- grass/branches/develbranch_6/swig/include/math.i 2009-05-25 15:43:01 UTC (rev 37476)
+++ grass/branches/releasebranch_6_4/swig/include/math.i 2009-05-25 15:54:04 UTC (rev 37477)
@@ -1,8 +0,0 @@
-
-%include "common.i"
-
-%{
-#include <grass/gmath.h>
-%}
-
-%include "grass/gmath.h"
Copied: grass/branches/releasebranch_6_4/swig/include/math.i (from rev 37476, grass/branches/develbranch_6/swig/include/math.i)
===================================================================
--- grass/branches/releasebranch_6_4/swig/include/math.i (rev 0)
+++ grass/branches/releasebranch_6_4/swig/include/math.i 2009-05-25 15:54:04 UTC (rev 37477)
@@ -0,0 +1,8 @@
+
+%include "common.i"
+
+%{
+#include <grass/gmath.h>
+%}
+
+%include "grass/gmath.h"
Deleted: grass/branches/releasebranch_6_4/swig/include/proj.i
===================================================================
--- grass/branches/develbranch_6/swig/include/proj.i 2009-05-25 15:43:01 UTC (rev 37476)
+++ grass/branches/releasebranch_6_4/swig/include/proj.i 2009-05-25 15:54:04 UTC (rev 37477)
@@ -1,8 +0,0 @@
-
-%include "common.i"
-
-%{
-#include <grass/gprojects.h>
-%}
-
-%include "grass/gprojects.h"
Copied: grass/branches/releasebranch_6_4/swig/include/proj.i (from rev 37476, grass/branches/develbranch_6/swig/include/proj.i)
===================================================================
--- grass/branches/releasebranch_6_4/swig/include/proj.i (rev 0)
+++ grass/branches/releasebranch_6_4/swig/include/proj.i 2009-05-25 15:54:04 UTC (rev 37477)
@@ -0,0 +1,8 @@
+
+%include "common.i"
+
+%{
+#include <grass/gprojects.h>
+%}
+
+%include "grass/gprojects.h"
Copied: grass/branches/releasebranch_6_4/swig/include/python (from rev 37476, grass/branches/develbranch_6/swig/include/python)
Deleted: grass/branches/releasebranch_6_4/swig/include/python/common.i
===================================================================
--- grass/branches/develbranch_6/swig/include/python/common.i 2009-05-25 15:43:01 UTC (rev 37476)
+++ grass/branches/releasebranch_6_4/swig/include/python/common.i 2009-05-25 15:54:04 UTC (rev 37477)
@@ -1,11 +0,0 @@
-%{
-#include <stdio.h>
-#include <grass/gis.h>
-%}
-
-%rename(my_def) def;
-//%rename(my_class) class;
-
-%include "file.i"
-
-%include "my_typemaps.i"
Copied: grass/branches/releasebranch_6_4/swig/include/python/common.i (from rev 37476, grass/branches/develbranch_6/swig/include/python/common.i)
===================================================================
--- grass/branches/releasebranch_6_4/swig/include/python/common.i (rev 0)
+++ grass/branches/releasebranch_6_4/swig/include/python/common.i 2009-05-25 15:54:04 UTC (rev 37477)
@@ -0,0 +1,11 @@
+%{
+#include <stdio.h>
+#include <grass/gis.h>
+%}
+
+%rename(my_def) def;
+//%rename(my_class) class;
+
+%include "file.i"
+
+%include "my_typemaps.i"
Deleted: grass/branches/releasebranch_6_4/swig/include/python/my_typemaps.i
===================================================================
--- grass/branches/develbranch_6/swig/include/python/my_typemaps.i 2009-05-25 15:43:01 UTC (rev 37476)
+++ grass/branches/releasebranch_6_4/swig/include/python/my_typemaps.i 2009-05-25 15:54:04 UTC (rev 37477)
@@ -1,172 +0,0 @@
-#ifdef SWIGPYTHON
-
-%typemap(in) string_allows_none {
- if($input==Py_None) {
- $1=NULL;
- } else {
- $1=PyString_AsString($input);
- if(!$1) {
- return NULL;
- }
- }
-}
-
-%inline %{
-typedef char * string_allows_none;
-%}
-
-%typemap(out) char ** {
- int len=0,i;
- PyObject * stringobject;
-
- if(!$1) {
- $result=PyList_New(0);
- } else {
-
- for(len=0;$1[len];len++);
-
- $result=PyList_New(len);
- if(!$result){
- // G_free_list($1);
- return NULL;
- }
-
- for(i=0;i<len;i++) {
- stringobject=PyString_FromString($1[i]);
- if(!stringobject) return NULL;
- PyList_SetItem($result,i,stringobject);
- }
-// G_free_list($1);
- }
-}
-
-%typemap(argout) return_string (char * temp) {
- if($1 && *$1) {
- $result=t_output_helper($result,PyString_FromString(*$1));
- G_free(*$1);
- } else {
- $result=t_output_helper($result,Py_None);
- Py_INCREF(Py_None);
- }
-
-}
-
-%inline %{
-typedef char ** return_string;
-%}
-
-#undef __attribute__
-#define __attribute__(x)
-
-%{
-
-static void *pyseq_to_ptr(PyObject *input, int data_type) __attribute__ ((unused));
-static void *pyobj_to_ptr(PyObject *input, int data_type) __attribute__ ((unused));
-
-static void *pyseq_to_ptr(PyObject *input, int data_type)
-{
- size_t size;
- Py_ssize_t len;
- void *array;
- int i;
-
- if (!PySequence_Check(input)) {
- PyErr_SetString(PyExc_ValueError,"Expected a CObject, buffer or sequence");
- return NULL;
- }
-
- switch (data_type) {
- case (int) 'c': size = sizeof(char ); break;
- case (int) 'b': size = sizeof(signed char ); break;
- case (int) 'B': size = sizeof(unsigned char ); break;
- case (int) 'u': size = sizeof(Py_UNICODE ); break;
- case (int) 'h': size = sizeof(signed short ); break;
- case (int) 'H': size = sizeof(unsigned short ); break;
- case (int) 'i': size = sizeof(signed int ); break;
- case (int) 'I': size = sizeof(unsigned int ); break;
- case (int) 'l': size = sizeof(signed long ); break;
- case (int) 'L': size = sizeof(unsigned long ); break;
- case (int) 'f': size = sizeof(float ); break;
- case (int) 'd': size = sizeof(double ); break;
- default:
- PyErr_SetString(PyExc_ValueError,"Invalid type code; must be one of [cbBuhHiIlLfd]");
- return NULL;
- }
-
- len = PySequence_Length(input);
- array = malloc(len * size);
-
- for (i = 0; i < len; i++) {
- PyObject *val = PySequence_GetItem(input, i);
- DCELL n;
-
- if (!PyNumber_Check(val)) {
- PyErr_SetString(PyExc_ValueError,"Sequence elements must be numbers");
- Py_XDECREF(val);
- return NULL;
- }
-
- n = PyFloat_AsDouble(val);
- if (PyErr_Occurred()) {
- PyErr_SetString(PyExc_ValueError,"Sequence elements must be numbers");
- Py_XDECREF(val);
- return NULL;
- }
-
- Py_DECREF(val);
-
- switch (data_type) {
- case (int) 'c': ((char *) array)[i] = (char ) n; break;
- case (int) 'b': ((signed char *) array)[i] = (signed char ) n; break;
- case (int) 'B': ((unsigned char *) array)[i] = (unsigned char ) n; break;
- case (int) 'u': ((Py_UNICODE *) array)[i] = (Py_UNICODE ) n; break;
- case (int) 'h': ((signed short *) array)[i] = (signed short ) n; break;
- case (int) 'H': ((unsigned short*) array)[i] = (unsigned short ) n; break;
- case (int) 'i': ((signed int *) array)[i] = (signed int ) n; break;
- case (int) 'I': ((unsigned int *) array)[i] = (unsigned int ) n; break;
- case (int) 'l': ((signed long *) array)[i] = (signed long ) n; break;
- case (int) 'L': ((unsigned long *) array)[i] = (unsigned long ) n; break;
- case (int) 'f': ((float *) array)[i] = (float ) n; break;
- case (int) 'd': ((double *) array)[i] = (double ) n; break;
- default:
- PyErr_SetString(PyExc_ValueError,"Invalid type code; must be one of [cbBuhHiIlLfd]");
- return NULL;
- }
- }
-
- return array;
-}
-
-static void *pyobj_to_ptr(PyObject *input, int data_type)
-{
- const void *cbuffer;
- void *buffer;
- Py_ssize_t len;
-
- if (PyCObject_Check(input))
- return PyCObject_AsVoidPtr(input);
-
- if (PyObject_AsWriteBuffer(input, &buffer, &len) == 0)
- return buffer;
-
- if (PyObject_AsReadBuffer(input, &cbuffer, &len) == 0)
- return (void *) cbuffer;
-
- return pyseq_to_ptr(input, data_type);
-}
-
-%}
-
-%typemap(in) CELL * {
- $1 = (CELL *) pyobj_to_ptr($input, 'i');
-}
-
-%typemap(in) FCELL * {
- $1 = (FCELL *) pyobj_to_ptr($input, 'f');
-}
-
-%typemap(in) DCELL * {
- $1 = (DCELL *) pyobj_to_ptr($input, 'd');
-}
-
-#endif
Copied: grass/branches/releasebranch_6_4/swig/include/python/my_typemaps.i (from rev 37476, grass/branches/develbranch_6/swig/include/python/my_typemaps.i)
===================================================================
--- grass/branches/releasebranch_6_4/swig/include/python/my_typemaps.i (rev 0)
+++ grass/branches/releasebranch_6_4/swig/include/python/my_typemaps.i 2009-05-25 15:54:04 UTC (rev 37477)
@@ -0,0 +1,172 @@
+#ifdef SWIGPYTHON
+
+%typemap(in) string_allows_none {
+ if($input==Py_None) {
+ $1=NULL;
+ } else {
+ $1=PyString_AsString($input);
+ if(!$1) {
+ return NULL;
+ }
+ }
+}
+
+%inline %{
+typedef char * string_allows_none;
+%}
+
+%typemap(out) char ** {
+ int len=0,i;
+ PyObject * stringobject;
+
+ if(!$1) {
+ $result=PyList_New(0);
+ } else {
+
+ for(len=0;$1[len];len++);
+
+ $result=PyList_New(len);
+ if(!$result){
+ // G_free_list($1);
+ return NULL;
+ }
+
+ for(i=0;i<len;i++) {
+ stringobject=PyString_FromString($1[i]);
+ if(!stringobject) return NULL;
+ PyList_SetItem($result,i,stringobject);
+ }
+// G_free_list($1);
+ }
+}
+
+%typemap(argout) return_string (char * temp) {
+ if($1 && *$1) {
+ $result=t_output_helper($result,PyString_FromString(*$1));
+ G_free(*$1);
+ } else {
+ $result=t_output_helper($result,Py_None);
+ Py_INCREF(Py_None);
+ }
+
+}
+
+%inline %{
+typedef char ** return_string;
+%}
+
+#undef __attribute__
+#define __attribute__(x)
+
+%{
+
+static void *pyseq_to_ptr(PyObject *input, int data_type) __attribute__ ((unused));
+static void *pyobj_to_ptr(PyObject *input, int data_type) __attribute__ ((unused));
+
+static void *pyseq_to_ptr(PyObject *input, int data_type)
+{
+ size_t size;
+ Py_ssize_t len;
+ void *array;
+ int i;
+
+ if (!PySequence_Check(input)) {
+ PyErr_SetString(PyExc_ValueError,"Expected a CObject, buffer or sequence");
+ return NULL;
+ }
+
+ switch (data_type) {
+ case (int) 'c': size = sizeof(char ); break;
+ case (int) 'b': size = sizeof(signed char ); break;
+ case (int) 'B': size = sizeof(unsigned char ); break;
+ case (int) 'u': size = sizeof(Py_UNICODE ); break;
+ case (int) 'h': size = sizeof(signed short ); break;
+ case (int) 'H': size = sizeof(unsigned short ); break;
+ case (int) 'i': size = sizeof(signed int ); break;
+ case (int) 'I': size = sizeof(unsigned int ); break;
+ case (int) 'l': size = sizeof(signed long ); break;
+ case (int) 'L': size = sizeof(unsigned long ); break;
+ case (int) 'f': size = sizeof(float ); break;
+ case (int) 'd': size = sizeof(double ); break;
+ default:
+ PyErr_SetString(PyExc_ValueError,"Invalid type code; must be one of [cbBuhHiIlLfd]");
+ return NULL;
+ }
+
+ len = PySequence_Length(input);
+ array = malloc(len * size);
+
+ for (i = 0; i < len; i++) {
+ PyObject *val = PySequence_GetItem(input, i);
+ DCELL n;
+
+ if (!PyNumber_Check(val)) {
+ PyErr_SetString(PyExc_ValueError,"Sequence elements must be numbers");
+ Py_XDECREF(val);
+ return NULL;
+ }
+
+ n = PyFloat_AsDouble(val);
+ if (PyErr_Occurred()) {
+ PyErr_SetString(PyExc_ValueError,"Sequence elements must be numbers");
+ Py_XDECREF(val);
+ return NULL;
+ }
+
+ Py_DECREF(val);
+
+ switch (data_type) {
+ case (int) 'c': ((char *) array)[i] = (char ) n; break;
+ case (int) 'b': ((signed char *) array)[i] = (signed char ) n; break;
+ case (int) 'B': ((unsigned char *) array)[i] = (unsigned char ) n; break;
+ case (int) 'u': ((Py_UNICODE *) array)[i] = (Py_UNICODE ) n; break;
+ case (int) 'h': ((signed short *) array)[i] = (signed short ) n; break;
+ case (int) 'H': ((unsigned short*) array)[i] = (unsigned short ) n; break;
+ case (int) 'i': ((signed int *) array)[i] = (signed int ) n; break;
+ case (int) 'I': ((unsigned int *) array)[i] = (unsigned int ) n; break;
+ case (int) 'l': ((signed long *) array)[i] = (signed long ) n; break;
+ case (int) 'L': ((unsigned long *) array)[i] = (unsigned long ) n; break;
+ case (int) 'f': ((float *) array)[i] = (float ) n; break;
+ case (int) 'd': ((double *) array)[i] = (double ) n; break;
+ default:
+ PyErr_SetString(PyExc_ValueError,"Invalid type code; must be one of [cbBuhHiIlLfd]");
+ return NULL;
+ }
+ }
+
+ return array;
+}
+
+static void *pyobj_to_ptr(PyObject *input, int data_type)
+{
+ const void *cbuffer;
+ void *buffer;
+ Py_ssize_t len;
+
+ if (PyCObject_Check(input))
+ return PyCObject_AsVoidPtr(input);
+
+ if (PyObject_AsWriteBuffer(input, &buffer, &len) == 0)
+ return buffer;
+
+ if (PyObject_AsReadBuffer(input, &cbuffer, &len) == 0)
+ return (void *) cbuffer;
+
+ return pyseq_to_ptr(input, data_type);
+}
+
+%}
+
+%typemap(in) CELL * {
+ $1 = (CELL *) pyobj_to_ptr($input, 'i');
+}
+
+%typemap(in) FCELL * {
+ $1 = (FCELL *) pyobj_to_ptr($input, 'f');
+}
+
+%typemap(in) DCELL * {
+ $1 = (DCELL *) pyobj_to_ptr($input, 'd');
+}
+
+#endif
Deleted: grass/branches/releasebranch_6_4/swig/include/python/utils.i
===================================================================
--- grass/branches/develbranch_6/swig/include/python/utils.i 2009-05-25 15:43:01 UTC (rev 37476)
+++ grass/branches/releasebranch_6_4/swig/include/python/utils.i 2009-05-25 15:54:04 UTC (rev 37477)
@@ -1,72 +0,0 @@
-
-%include "common.i"
-
-%include "carrays.i"
-%array_functions(int, intArray);
-%array_functions(float, floatArray);
-%array_functions(double, doubleArray);
-
-%include "cpointer.i"
-%pointer_functions(int, intp);
-%pointer_functions(float, floatp);
-%pointer_functions(double, doublep);
-
-PyObject *ptr_to_cobj(void *p);
-void *cobj_to_ptr(PyObject *o);
-PyObject *ptr_to_buffer_const(const void *p, int size);
-PyObject *ptr_to_buffer(void *p, int size);
-const void *buffer_to_ptr_const(PyObject *o);
-void *buffer_to_ptr(PyObject *o);
-
-%{
-
-static PyObject *ptr_to_cobj(void *p)
-{
- return PyCObject_FromVoidPtr(p, NULL);
-}
-
-static void *cobj_to_ptr(PyObject *o)
-{
- if (PyCObject_Check(o))
- return PyCObject_AsVoidPtr(o);
-
- PyErr_SetString(PyExc_ValueError,"CObject Expected");
- return NULL;
-}
-
-static PyObject *ptr_to_buffer_const(const void *p, int size)
-{
- return PyBuffer_FromMemory((void *) p, size);
-}
-
-static PyObject *ptr_to_buffer(void *p, int size)
-{
- return PyBuffer_FromReadWriteMemory(p, size);
-}
-
-static const void *buffer_to_ptr_const(PyObject *o)
-{
- const void *p;
- Py_ssize_t len;
-
- if (PyObject_AsReadBuffer(o, &p, &len) == 0)
- return p;
-
- PyErr_SetString(PyExc_ValueError,"buffer object expected");
- return NULL;
-}
-
-static void *buffer_to_ptr(PyObject *o)
-{
- void *p;
- Py_ssize_t len;
-
- if (PyObject_AsWriteBuffer(o, &p, &len) == 0)
- return p;
-
- PyErr_SetString(PyExc_ValueError,"buffer object expected");
- return NULL;
-}
-
-%}
-
Copied: grass/branches/releasebranch_6_4/swig/include/python/utils.i (from rev 37476, grass/branches/develbranch_6/swig/include/python/utils.i)
===================================================================
--- grass/branches/releasebranch_6_4/swig/include/python/utils.i (rev 0)
+++ grass/branches/releasebranch_6_4/swig/include/python/utils.i 2009-05-25 15:54:04 UTC (rev 37477)
@@ -0,0 +1,72 @@
+
+%include "common.i"
+
+%include "carrays.i"
+%array_functions(int, intArray);
+%array_functions(float, floatArray);
+%array_functions(double, doubleArray);
+
+%include "cpointer.i"
+%pointer_functions(int, intp);
+%pointer_functions(float, floatp);
+%pointer_functions(double, doublep);
+
+PyObject *ptr_to_cobj(void *p);
+void *cobj_to_ptr(PyObject *o);
+PyObject *ptr_to_buffer_const(const void *p, int size);
+PyObject *ptr_to_buffer(void *p, int size);
+const void *buffer_to_ptr_const(PyObject *o);
+void *buffer_to_ptr(PyObject *o);
+
+%{
+
+static PyObject *ptr_to_cobj(void *p)
+{
+ return PyCObject_FromVoidPtr(p, NULL);
+}
+
+static void *cobj_to_ptr(PyObject *o)
+{
+ if (PyCObject_Check(o))
+ return PyCObject_AsVoidPtr(o);
+
+ PyErr_SetString(PyExc_ValueError,"CObject Expected");
+ return NULL;
+}
+
+static PyObject *ptr_to_buffer_const(const void *p, int size)
+{
+ return PyBuffer_FromMemory((void *) p, size);
+}
+
+static PyObject *ptr_to_buffer(void *p, int size)
+{
+ return PyBuffer_FromReadWriteMemory(p, size);
+}
+
+static const void *buffer_to_ptr_const(PyObject *o)
+{
+ const void *p;
+ Py_ssize_t len;
+
+ if (PyObject_AsReadBuffer(o, &p, &len) == 0)
+ return p;
+
+ PyErr_SetString(PyExc_ValueError,"buffer object expected");
+ return NULL;
+}
+
+static void *buffer_to_ptr(PyObject *o)
+{
+ void *p;
+ Py_ssize_t len;
+
+ if (PyObject_AsWriteBuffer(o, &p, &len) == 0)
+ return p;
+
+ PyErr_SetString(PyExc_ValueError,"buffer object expected");
+ return NULL;
+}
+
+%}
+
Deleted: grass/branches/releasebranch_6_4/swig/include/raster.i
===================================================================
--- grass/branches/develbranch_6/swig/include/raster.i 2009-05-25 15:43:01 UTC (rev 37476)
+++ grass/branches/releasebranch_6_4/swig/include/raster.i 2009-05-25 15:54:04 UTC (rev 37477)
@@ -1,8 +0,0 @@
-
-%include "common.i"
-
-%{
-#include <grass/raster.h>
-%}
-
-%include "grass/raster.h"
Copied: grass/branches/releasebranch_6_4/swig/include/raster.i (from rev 37476, grass/branches/develbranch_6/swig/include/raster.i)
===================================================================
--- grass/branches/releasebranch_6_4/swig/include/raster.i (rev 0)
+++ grass/branches/releasebranch_6_4/swig/include/raster.i 2009-05-25 15:54:04 UTC (rev 37477)
@@ -0,0 +1,8 @@
+
+%include "common.i"
+
+%{
+#include <grass/raster.h>
+%}
+
+%include "grass/raster.h"
Deleted: grass/branches/releasebranch_6_4/swig/include/stats.i
===================================================================
--- grass/branches/develbranch_6/swig/include/stats.i 2009-05-25 15:43:01 UTC (rev 37476)
+++ grass/branches/releasebranch_6_4/swig/include/stats.i 2009-05-25 15:54:04 UTC (rev 37477)
@@ -1,9 +0,0 @@
-
-%include "common.i"
-
-%{
-#undef c_sum
-#include <grass/stats.h>
-%}
-
-%include "grass/stats.h"
Copied: grass/branches/releasebranch_6_4/swig/include/stats.i (from rev 37476, grass/branches/develbranch_6/swig/include/stats.i)
===================================================================
--- grass/branches/releasebranch_6_4/swig/include/stats.i (rev 0)
+++ grass/branches/releasebranch_6_4/swig/include/stats.i 2009-05-25 15:54:04 UTC (rev 37477)
@@ -0,0 +1,9 @@
+
+%include "common.i"
+
+%{
+#undef c_sum
+#include <grass/stats.h>
+%}
+
+%include "grass/stats.h"
Deleted: grass/branches/releasebranch_6_4/swig/include/trans.i
===================================================================
--- grass/branches/develbranch_6/swig/include/trans.i 2009-05-25 15:43:01 UTC (rev 37476)
+++ grass/branches/releasebranch_6_4/swig/include/trans.i 2009-05-25 15:54:04 UTC (rev 37477)
@@ -1,8 +0,0 @@
-
-%include "common.i"
-
-%{
-#include <grass/transform.h>
-%}
-
-%include "grass/transform.h"
Copied: grass/branches/releasebranch_6_4/swig/include/trans.i (from rev 37476, grass/branches/develbranch_6/swig/include/trans.i)
===================================================================
--- grass/branches/releasebranch_6_4/swig/include/trans.i (rev 0)
+++ grass/branches/releasebranch_6_4/swig/include/trans.i 2009-05-25 15:54:04 UTC (rev 37477)
@@ -0,0 +1,8 @@
+
+%include "common.i"
+
+%{
+#include <grass/transform.h>
+%}
+
+%include "grass/transform.h"
Deleted: grass/branches/releasebranch_6_4/swig/include/vector.i
===================================================================
--- grass/branches/develbranch_6/swig/include/vector.i 2009-05-25 15:43:01 UTC (rev 37476)
+++ grass/branches/releasebranch_6_4/swig/include/vector.i 2009-05-25 15:54:04 UTC (rev 37477)
@@ -1,11 +0,0 @@
-
-%include "common.i"
-
-%{
-#include <grass/Vect.h>
-#include <grass/vect/dig_structs.h>
-%}
-
-%include "grass/Vect.h"
-%include "grass/vect/dig_structs.h"
-%include "grass/vect/dig_defines.h"
Copied: grass/branches/releasebranch_6_4/swig/include/vector.i (from rev 37476, grass/branches/develbranch_6/swig/include/vector.i)
===================================================================
--- grass/branches/releasebranch_6_4/swig/include/vector.i (rev 0)
+++ grass/branches/releasebranch_6_4/swig/include/vector.i 2009-05-25 15:54:04 UTC (rev 37477)
@@ -0,0 +1,11 @@
+
+%include "common.i"
+
+%{
+#include <grass/Vect.h>
+#include <grass/vect/dig_structs.h>
+%}
+
+%include "grass/Vect.h"
+%include "grass/vect/dig_structs.h"
+%include "grass/vect/dig_defines.h"
Deleted: grass/branches/releasebranch_6_4/swig/include/vedit.i
===================================================================
--- grass/branches/develbranch_6/swig/include/vedit.i 2009-05-25 15:43:01 UTC (rev 37476)
+++ grass/branches/releasebranch_6_4/swig/include/vedit.i 2009-05-25 15:54:04 UTC (rev 37477)
@@ -1,8 +0,0 @@
-
-%include "common.i"
-
-%{
-#include <grass/vedit.h>
-%}
-
-%include "grass/vedit.h"
Copied: grass/branches/releasebranch_6_4/swig/include/vedit.i (from rev 37476, grass/branches/develbranch_6/swig/include/vedit.i)
===================================================================
--- grass/branches/releasebranch_6_4/swig/include/vedit.i (rev 0)
+++ grass/branches/releasebranch_6_4/swig/include/vedit.i 2009-05-25 15:54:04 UTC (rev 37477)
@@ -0,0 +1,8 @@
+
+%include "common.i"
+
+%{
+#include <grass/vedit.h>
+%}
+
+%include "grass/vedit.h"
Property changes on: grass/branches/releasebranch_6_4/swig/python
___________________________________________________________________
Name: svn:ignore
- Makefile
+ imagery.py
vedit_wrap.c
raster.py
g3d_wrap.c
date_wrap.c
vector.py
display.py
trans_wrap.c
proj.py
dbmi.py
grass.py
imagery_wrap.c
cluster.py
raster_wrap.c
vector_wrap.c
display_wrap.c
math.py
arraystats.py
proj_wrap.c
dbmi_wrap.c
stats.py
utils.py
OBJ.*
grass_wrap.c
cluster_wrap.c
vedit.py
math_wrap.c
date.py
g3d.py
arraystats_wrap.c
stats_wrap.c
utils_wrap.c
trans.py
Copied: grass/branches/releasebranch_6_4/swig/python/Makefile (from rev 37476, grass/branches/develbranch_6/swig/python/Makefile)
===================================================================
--- grass/branches/releasebranch_6_4/swig/python/Makefile (rev 0)
+++ grass/branches/releasebranch_6_4/swig/python/Makefile 2009-05-25 15:54:04 UTC (rev 37477)
@@ -0,0 +1,106 @@
+MODULE_TOPDIR = ../..
+
+PACKAGE = "grasslibs"
+
+include $(MODULE_TOPDIR)/include/Make/Lib.make
+include $(MODULE_TOPDIR)/include/Make/Doxygen.make
+
+# doxygen:
+DOXNAME=
+DOXINPUT=grasspython.dox
+
+MODULES = utils date grass math proj imagery vector raster display stats \
+ dbmi g3d arraystats cluster trans vedit
+
+date_LIBS = $(DATETIMELIB)
+grass_LIBS = $(GISLIB)
+math_LIBS = $(GMATHLIB)
+proj_LIBS = $(GPROJLIB)
+imagery_LIBS = $(IMAGERYLIB)
+vector_LIBS = $(VECTLIB)
+raster_LIBS = $(RASTERLIB)
+display_LIBS = $(DISPLAYLIB)
+stats_LIBS = $(STATSLIB)
+dbmi_LIBS = $(DBMILIB)
+g3d_LIBS = $(G3DLIB)
+arraystats_LIBS = $(ARRAYSTATSLIB)
+cluster_LIBS = $(CLUSTERLIB)
+trans_LIBS = $(TRANSLIB)
+vedit_LIBS = $(VEDITLIB)
+
+vector_wrap_c_FLAGS = $(VECT_INC)
+proj_wrap_c_FLAGS = $(PROJINC) $(GDALCFLAGS)
+
+EXTRA_SWIG = ../include/python/my_typemaps.i ../include/python/common.i
+SWIGFLAGS = $(ARCH_INC) -I../include/python -outdir .
+EXTRA_CFLAGS = $(PYMOD_CFLAGS)
+EXTRA_CLEAN_FILES := $(foreach M,$(MODULES),$(M)_wrap.o $(M)_wrap.c $(M).pyc $(M).py _$(M).so)
+CLEAN_SUBDIRS = NumPtr
+
+include $(MODULE_TOPDIR)/include/Make/Python.make
+
+PYDIR = $(ETC)/python
+GDIR = $(PYDIR)/grass
+DSTDIR = $(GDIR)/lib
+
+LIBFILES := $(patsubst %,$(DSTDIR)/_%.so,$(MODULES))
+PYFILES := $(patsubst %,$(DSTDIR)/%.py,$(MODULES) __init__)
+
+default:
+ $(MAKE) $(DSTDIR)
+ $(MAKE) $(LIBFILES) $(PYFILES)
+
+%_wrap.c %.py: ../include/%.i $(EXTRA_SWIG)
+ $(SWIG) $(SWIGFLAGS) -python -o $*_wrap.c -module $* -shadow $<
+
+%_wrap.c %.py: ../include/python/%.i $(EXTRA_SWIG)
+ $(SWIG) $(SWIGFLAGS) -python -o $*_wrap.c -module $* -shadow $<
+
+$(PYDIR):
+ test -d $@ || $(MKDIR) -p $@
+
+$(GDIR): $(PYDIR)
+ test -d $@ || $(MKDIR) -p $@
+
+$(DSTDIR): $(GDIR)
+ test -d $@ || $(MKDIR) -p $@
+ test -f __init__.py || touch $(GDIR)/__init__.py
+ @echo "import lib" >> $(GDIR)/__init__.py
+
+$(DSTDIR)/_%.so: _%.so
+ $(INSTALL) $< $@
+
+$(DSTDIR)/%.py: %.py
+ $(INSTALL_DATA) $< $@
+
+numptr:
+ $(MAKE) -C NumPtr
+
+.PHONY: numptr
+
+.SECONDARY: $(patsubst %,$(OBJDIR)/%_wrap.o,$(MODULES))
+
+.SECONDARY: $(patsubst %,_%.so,$(MODULES))
+
+date_wrap.c: $(ARCH_INCDIR)/datetime.h
+date_wrap.c: $(ARCH_INCDIR)/P_datetime.h
+grass_wrap.c: $(ARCH_INCDIR)/gis.h
+grass_wrap.c: $(ARCH_INCDIR)/gisdefs.h
+math_wrap.c: $(ARCH_INCDIR)/gmath.h
+proj_wrap.c: $(ARCH_INCDIR)/gprojects.h
+imagery_wrap.c: $(ARCH_INCDIR)/imagedefs.h
+imagery_wrap.c: $(ARCH_INCDIR)/imagery.h
+vector_wrap.c: $(ARCH_INCDIR)/Vect.h
+vector_wrap.c: $(ARCH_INCDIR)/vect/dig_defines.h
+vector_wrap.c: $(ARCH_INCDIR)/vect/dig_structs.h
+raster_wrap.c: $(ARCH_INCDIR)/raster.h
+display_wrap.c: $(ARCH_INCDIR)/display.h
+stats_wrap.c: $(ARCH_INCDIR)/stats.h
+dbmi_wrap.c: $(ARCH_INCDIR)/dbmi.h
+dbmi_wrap.c: $(ARCH_INCDIR)/proto_dbmi.h
+g3d_wrap.c: $(ARCH_INCDIR)/G3d.h
+arraystats_wrap.c: $(ARCH_INCDIR)/arraystats.h
+cluster_wrap.c: $(ARCH_INCDIR)/cluster.h
+trans_wrap.c: $(ARCH_INCDIR)/transform.h
+vedit_wrap.c: $(ARCH_INCDIR)/vedit.h
+utils_wrap.c:
Deleted: grass/branches/releasebranch_6_4/swig/python/Makefile.in
===================================================================
--- grass/branches/releasebranch_6_4/swig/python/Makefile.in 2009-05-25 15:43:01 UTC (rev 37476)
+++ grass/branches/releasebranch_6_4/swig/python/Makefile.in 2009-05-25 15:54:04 UTC (rev 37477)
@@ -1,46 +0,0 @@
-# Cloned automatically from Makefile.in by configure.
-MODULE_TOPDIR = ../..
-
-include $(MODULE_TOPDIR)/include/Make/Lib.make
-include $(MODULE_TOPDIR)/include/Make/Doxygen.make
-
-LIB_NAME = python_grass6
-
-CFLAGS=-c -fpic -I. $(ARCH_INC) $(GDALCFLAGS) $(PYTHONCFLAGS)
-LDFLAGS=-shared -L$(ARCH_LIBDIR) $(GDALLIBS) $(PYTHONLDFLAGS) $(VECTLIB) $(IMAGERYLIB) $(GMATHLIB) $(GISLIB)
-
-
-default: _$(LIB_NAME).so numptr
-
-clean:
- -rm -f *.o *.so $(LIB_NAME)_wrap.c $(LIB_NAME).pyc $(LIB_NAME).py
- $(MAKE) -C NumPtr clean
-
-distclean: clean
- -rm -f Makefile
-
-$(LIB_NAME)_wrap.c: $(LIB_NAME).i
- $(SWIG) $(ARCH_INC) -python -shadow $<
-
-$(LIB_NAME)_wrap.o: $(LIB_NAME)_wrap.c
- $(CC) $(CFLAGS) $(INCLUDE_DIRS) $<
-
-_$(LIB_NAME).so: $(LIB_NAME)_wrap.o
- $(LD) $(LDFLAGS) $< -o _$(LIB_NAME).so
- # build bytecode .pyc file; ignore undefined symbol error
- echo "import $(LIB_NAME)" | python; true
-
-numptr:
- $(MAKE) -C NumPtr
-
-# doxygen:
-DOXNAME=
-DOXINPUT=grasspython.dox
-
-$(LIB_NAME)_wrap.c: $(ARCH_INCDIR)/gis.h
-$(LIB_NAME)_wrap.c: $(ARCH_INCDIR)/gisdefs.h
-$(LIB_NAME)_wrap.c: $(ARCH_INCDIR)/imagery.h
-$(LIB_NAME)_wrap.c: $(ARCH_INCDIR)/imagedefs.h
-$(LIB_NAME)_wrap.c: $(ARCH_INCDIR)/Vect.h
-$(LIB_NAME)_wrap.c: $(ARCH_INCDIR)/vect/dig_structs.h
-$(LIB_NAME)_wrap.c: $(ARCH_INCDIR)/vect/dig_defines.h
Copied: grass/branches/releasebranch_6_4/swig/python/__init__.py (from rev 37476, grass/branches/develbranch_6/swig/python/__init__.py)
===================================================================
--- grass/branches/releasebranch_6_4/swig/python/__init__.py (rev 0)
+++ grass/branches/releasebranch_6_4/swig/python/__init__.py 2009-05-25 15:54:04 UTC (rev 37477)
@@ -0,0 +1,10 @@
+import date
+import grass
+import math
+import imagery
+import vector
+import proj
+import stats
+import raster
+import display
+import utils
Deleted: grass/branches/releasebranch_6_4/swig/python/my_typemaps.i
===================================================================
--- grass/branches/releasebranch_6_4/swig/python/my_typemaps.i 2009-05-25 15:43:01 UTC (rev 37476)
+++ grass/branches/releasebranch_6_4/swig/python/my_typemaps.i 2009-05-25 15:54:04 UTC (rev 37477)
@@ -1,114 +0,0 @@
-#ifdef SWIGPYTHON
-%typemap(in) string_allows_none {
- if($input==Py_None) {
- $1=NULL;
- } else {
- $1=PyString_AsString($input);
- if(!$1) {
- return NULL;
- }
- }
-}
-
-%inline %{
-typedef char * string_allows_none;
-%}
-
-%typemap(out) char ** {
- int len=0,i;
- PyObject * stringobject;
-
- if(!$1) {
- $result=PyList_New(0);
- } else {
-
- for(len=0;$1[len];len++);
-
- $result=PyList_New(len);
- if(!$result){
- // G_free_list($1);
- return NULL;
- }
-
- for(i=0;i<len;i++) {
- stringobject=PyString_FromString($1[i]);
- if(!stringobject) return NULL;
- PyList_SetItem($1,i,stringobject);
- }
-// G_free_list($1);
- }
-}
-%typemap(in,numinputs=0) return_string (char * temp) {
- temp=NULL;
- $1=&temp;
-}
-
-
-%typemap(argout) CELL * {
- int len=0,i;
- len=G_window_cols();
- $result=PyList_New(len);
- for(i=0;i<len;i++)
- {
- PyList_SetItem($result,i,PyInt_FromLong($1[i]));
- }
-}
-
-%typemap(argout) FCELL * {
- int len=0,i;
- len=G_window_cols();
- $result=PyList_New(len);
- for(i=0;i<len;i++)
- {
- PyList_SetItem($result,i,PyFloat_FromDouble($1[i]) );
- }
-}
-
-%typemap(argout) DCELL * {
- int len=0,i;
- len=G_window_cols();
- $result=PyList_New(len);
- for(i=0;i<len;i++)
- {
- PyList_SetItem($result,i,PyFloat_FromDouble($1[i]));
- }
-}
-
-
-%typemap(in)CELL * {
- int len=0,i=0; CELL *tmp;
- PyObject obj;
- len=G_window_cols();
- $1=G_allocate_cell_buf();
-}
-
-%typemap(in)FCELL * {
- int len=0,i=0; FCELL *tmp;
- PyObject obj;
- len=G_window_cols();
- $1=G_allocate_f_raster_buf();
-}
-
-%typemap(in)DCELL * {
- int len=0,i=0; FCELL *tmp;
- PyObject obj;
- len=G_window_cols();
- $1=G_allocate_d_raster_buf();
-}
-
-
-%typemap(argout) return_string (char * temp) {
- if($1 && *$1) {
- $result=t_output_helper($result,PyString_FromString(*$1));
- G_free(*$1);
- } else {
- $result=t_output_helper($result,Py_None);
- Py_INCREF(Py_None);
- }
-
-}
-
-%inline %{
-typedef char ** return_string;
-%}
-#endif
Deleted: grass/branches/releasebranch_6_4/swig/python/python_grass6.i
===================================================================
--- grass/branches/releasebranch_6_4/swig/python/python_grass6.i 2009-05-25 15:43:01 UTC (rev 37476)
+++ grass/branches/releasebranch_6_4/swig/python/python_grass6.i 2009-05-25 15:54:04 UTC (rev 37477)
@@ -1,39 +0,0 @@
-//File : python_grass6.i
-
-%include "carrays.i"
-%array_functions(int, intArray);
-%array_functions(float, floatArray);
-%array_functions(double, doubleArray);
-
-%include "cpointer.i"
-%pointer_functions(int, intp);
-%pointer_functions(float, floatp);
-%pointer_functions(double, doublep);
-
-%module python_grass6
-%{
-#include <stdio.h>
-#include <stdarg.h>
-#include <grass/gis.h>
-#include <grass/gisdefs.h>
-#include <grass/imagery.h>
-#include <grass/imagedefs.h>
-#include <grass/Vect.h>
-#include <grass/vect/dig_structs.h>
-%}
-
-%include "my_typemaps.i"
-%include "renames.i"
-%include "grass/gis.h"
-%include "grass/gisdefs.h"
-%include "grass/imagery.h"
-%include "grass/imagedefs.h"
-%include "grass/Vect.h"
-%include "grass/vect/dig_structs.h"
-%include "grass/vect/dig_defines.h"
-
-%pythoncode %{
-def G_gisinit(pgm):
- G__gisinit(GIS_H_VERSION, pgm)
-
-%}
Deleted: grass/branches/releasebranch_6_4/swig/python/renames.i
===================================================================
--- grass/branches/releasebranch_6_4/swig/python/renames.i 2009-05-25 15:43:01 UTC (rev 37476)
+++ grass/branches/releasebranch_6_4/swig/python/renames.i 2009-05-25 15:54:04 UTC (rev 37477)
@@ -1,2 +0,0 @@
-%rename(my_def) def;
-%rename(my_class) class;
More information about the grass-commit
mailing list