From a4d8700ca729fe0ae33cdef65e560726ce92f693 Mon Sep 17 00:00:00 2001 From: Sandro Santilli Date: Mon, 7 Jun 2004 09:16:06 +0000 Subject: [PATCH] Added missing prototypes. git-svn-id: http://svn.osgeo.org/postgis/trunk@597 b70326c6-7e19-0410-871a-916f4a2858ee --- lwgeom/wktparse.lex | 4 ++++ lwgeom/wktunparse.c | 42 ++++++++++++++++++++++++++++++++++-------- 2 files changed, 38 insertions(+), 8 deletions(-) diff --git a/lwgeom/wktparse.lex b/lwgeom/wktparse.lex index 5273ac8b2..ae694ac06 100644 --- a/lwgeom/wktparse.lex +++ b/lwgeom/wktparse.lex @@ -10,6 +10,10 @@ %{ #include "wktparse.tab.h" +void init_parser(const char *src); +void close_parser(void); +int lwg_parse_yywrap(void); + static YY_BUFFER_STATE buf_state; void init_parser(const char *src) { BEGIN(0);buf_state = lwg_parse_yy_scan_string(src); } void close_parser() { lwg_parse_yy_delete_buffer(buf_state); } diff --git a/lwgeom/wktunparse.c b/lwgeom/wktunparse.c index f6df8be07..cf4084313 100644 --- a/lwgeom/wktunparse.c +++ b/lwgeom/wktunparse.c @@ -19,14 +19,40 @@ static int endian_check_int = 1; // dont modify this!!! -#define LITTLE_ENDIAN 1 +#define LITTLE_ENDIAN_CHECK 1 static char getMachineEndian() { return *((char *) &endian_check_int); // 0 = big endian, 1 = little endian } +//-- Typedefs ---------------------------------------------- typedef unsigned long int4; +typedef byte* (*outfunc)(byte*,int); +typedef byte* (*outwkbfunc)(byte*); + +//-- Prototypes -------------------------------------------- + +void ensure(int chars); +void to_end(void); +void write_str(const char* str); +void write_double(double val); +void write_int(int i); +int4 read_int(byte** geom); +double read_double(byte** geom); +byte* output_point(byte* geom,int supress); +byte* output_single(byte* geom,int supress); +byte* output_collection(byte* geom,outfunc func,int supress); +byte* output_collection_2(byte* geom,int suppress); +byte* output_multipoint(byte* geom,int suppress); +void write_wkb_bytes(byte* ptr,int cnt); +byte* output_wkb_point(byte* geom); +void write_wkb_int(int i); +byte* output_wkb_collection(byte* geom,outwkbfunc func); +byte* output_wkb_collection_2(byte* geom); +byte* output_wkb(byte* geom); + +//-- Globals ----------------------------------------------- static int dims; static allocator local_malloc; @@ -36,6 +62,10 @@ static char* out_pos; static int len; static int lwgi; +//---------------------------------------------------------- + + + void ensure(int chars){ int pos = out_pos - out_start; @@ -80,7 +110,7 @@ void write_int(int i){ int4 read_int(byte** geom){ int4 ret; #ifdef SHRINK_INTS - if ( getMachineEndian() == LITTLE_ENDIAN ){ + if ( getMachineEndian() == LITTLE_ENDIAN_CHECK ){ if( (**geom)& 0x01){ ret = **geom >>1; (*geom)++; @@ -98,7 +128,7 @@ int4 read_int(byte** geom){ memcpy(&ret,*geom,4); #ifdef SHRINK_INTS - if ( getMachineEndian() == LITTLE_ENDIAN ){ + if ( getMachineEndian() == LITTLE_ENDIAN_CHECK ){ ret >>= 1; } #endif @@ -125,8 +155,6 @@ double read_double(byte** geom){ } } -typedef byte* (*outfunc)(byte*,int); - byte* output_point(byte* geom,int supress){ int i; @@ -290,8 +318,6 @@ byte* output_wkb_point(byte* geom){ } } -typedef byte* (*outwkbfunc)(byte*); - void write_wkb_int(int i){ write_wkb_bytes((byte*)&i,4); } @@ -330,7 +356,7 @@ byte* output_wkb(byte* geom){ else if (dims==4) type |=0x40000000; - if ( getMachineEndian() != LITTLE_ENDIAN ){ + if ( getMachineEndian() != LITTLE_ENDIAN_CHECK ){ byte endian=0; write_wkb_bytes(&endian,1); } -- 2.40.0