From: Paul Ramsey Date: Wed, 17 Dec 2008 18:20:18 +0000 (+0000) Subject: Re-locate cunit, add a STYLE guideline draft and some TODO notes. X-Git-Tag: 1.4.0b1~396 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=b93970cd9be9ec74052ec1d12275cff867d0e387;p=postgis Re-locate cunit, add a STYLE guideline draft and some TODO notes. git-svn-id: http://svn.osgeo.org/postgis/trunk@3435 b70326c6-7e19-0410-871a-916f4a2858ee --- diff --git a/STYLE b/STYLE new file mode 100644 index 000000000..aa2c040bd --- /dev/null +++ b/STYLE @@ -0,0 +1,58 @@ +Coding Style Guidelines for PostGIS +----------------------------------- + +:Preamble: + +PostGIS was created over many years, by many different people, some in a +hurry. As a result, the existing coding style is all over the map. We +recognize this, and understand it will be the work of many years before +PostGIS has a consistently named internal set of functions, but, +we can dream. + +If new functions follow this guideline, if we do a little rennovation work +from time to time, we will eventually get there. + + +:Formatting: + +All C code should use an ANSI standard formatting with tabs for block +indenting. When not block indenting, use spaces. To convert a file +to the standard format use: + + astyle --style=ansi --indent=tab + +Do not get too happy with this command. If you want to re-format a file you +are working on: + + a) run astyle on it + b) commit + c) do your work + d) commit + e) if you are really finicky run astyle again + f) commit + +The idea is to avoid combining style-only commits and commits that change +logic, so the logic commits are easier to read. + +Macros should be ALL_UPPERCASE. +Enumerations should be ALL_UPPERCASE. + + +:Naming: + +For liblwgeom: + +- Files should be named with an lw prefix. +- Functions should have an lw prefix (lw_getPoint). +- Function names should use underscores, not camel case. +- Function names should indicate the geometry type of inputs + if relevant (lwline_split) + +For lwgeom: + +- C functions called by the back-end directly (function(PG_FUNCTION_ARGS)) + should be named to match their most likely SQL alias. So + the SQL ST_Distance(geometry) maps to the C function + ST_Distance(PG_FUNCTION_ARG) +- C utility functions should be prefixed with pgis_ (lower case) + diff --git a/TODO b/TODO index f8d8e736c..59faeac7d 100644 --- a/TODO +++ b/TODO @@ -84,3 +84,11 @@ See, http://citeseer.ist.psu.edu/roussopoulos95nearest.html http://citeseer.ist.psu.edu/91356.html + +== Breaking Changes == + +* Convert the "default SRID" from -1 to 0 +* Convert the LWGEOM struct(s) to have enough padding that the coordinates + are double-aligned and can be accessed directly as doubles on all + architectures + diff --git a/cunit/Makefile b/liblwgeom/cunit/Makefile similarity index 95% rename from cunit/Makefile rename to liblwgeom/cunit/Makefile index 4e089153d..a016c85c4 100644 --- a/cunit/Makefile +++ b/liblwgeom/cunit/Makefile @@ -1,5 +1,5 @@ -LWGEOM=../liblwgeom +LWGEOM=.. LIBCUNIT=/usr/local/lib/libcunit.a LIBLWGEOM=$(LWGEOM)/liblwgeom.a diff --git a/cunit/cu_algorithm.c b/liblwgeom/cunit/cu_algorithm.c similarity index 100% rename from cunit/cu_algorithm.c rename to liblwgeom/cunit/cu_algorithm.c diff --git a/cunit/cu_algorithm.h b/liblwgeom/cunit/cu_algorithm.h similarity index 100% rename from cunit/cu_algorithm.h rename to liblwgeom/cunit/cu_algorithm.h diff --git a/cunit/cu_tester.c b/liblwgeom/cunit/cu_tester.c similarity index 100% rename from cunit/cu_tester.c rename to liblwgeom/cunit/cu_tester.c