Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

Tree [78bbe5] default tip /
History



File Date Author Commit
doc 2012-03-15 Victor Anyakin Victor Anyakin [3d5e00] expanded intro documentation, added illustration
gadm 2012-04-18 Victor Anyakin Victor Anyakin [78bbe5] Added GADM KOATUU codes table
v6.0.1 2012-03-15 Victor Anyakin Victor Anyakin [540227] added simple test code; improved structures def...
README.txt 2012-03-13 Victor Anyakin Victor Anyakin [7e6d25] microscript RENDER-POINT is functional

Read Me

==============================
MapScript Common Lisp Bindings
==============================

Sample Usage
============



Producing wrappers
==================

The wrappers consist of a native binding glue, mapscript_wrap.c and
CFFI lisp wrappers for this glue.

Current SWIG CFFI translator produces incomplete wrappers. AllegroCL
translator for SWIG produces complete bindings that are not CFFI
compatible.

The routine consists of several steps.

1. Produce AllegroCL bindings: in a mapscript/cffi directory run

  swig -allegrocl -outcurrentdir ../mapscript.i

This will create the C glue file mapscript_wrap.c

2. Create Lisp bindings for the functions from mapscript_wrap.c

Using MakeHeaders tool

  mkhdr mapscript_wrap.c

Will create the mapscript_wrap.h. Remove the trash from the header and
replace it with

  #include "mapserver.h"

Get rid of the SWIGINTERN string from the header and generate the
Common Lisp wrapper code:

  swig -cffi -outcurrentdir -module mapscript_wrap mapscript_wrap.h

This will generate wrappers for functions.

3. Wrappers for data types and structures are generated based on the
mapscript.i file. The mapserver.h, mapprimitive.h and some other
headers included by the mapscript.i have guards against SWIG that
result in incomplete structures being generated. The way around is to
edit these files and replace "#ifndef SWIG" strings with "#ifdef
SWIG".

  swig -cffi -outcurrentdir -module mapscript ../mapscript.i

The generated mapscript.lisp file must be edited to get rid of the
redundand functions and to correct errors in structures' definitions.

4. Compile the library.  Now you have two Lisp files:
mapscript_wrap.lisp with wrappers for functions and mapscript.lisp
with definitions of data types and structures. The mapscript_wrap.c
must be compiled into a shared library that will be used by the Common
Lisp implementation. The build.sh script relies on the MS_BUILD_DIR
environment variable to get the location of the MapServer build dir.


List of native MapScript functions
==================================

Following functions are defined in the mapscript.h header and are
exported for use by external applications.

("msSaveImage" msSaveImage)
("msFreeImage" msFreeImage)
("msSetup" msSetup)
("msCleanup" msCleanup)
("msLoadMapFromString" msLoadMapFromString)
("msGetErrorObj" msGetErrorObj)
("msResetErrorList" msResetErrorList)
("msGetVersion" msGetVersion)
("msGetVersionInt" msGetVersionInt)
("msGetErrorString" msGetErrorString)
("msConnPoolCloseUnreferenced" msConnPoolCloseUnreferenced)
("msIO_resetHandlers" msIO_resetHandlers)
("msIO_installStdoutToBuffer" msIO_installStdoutToBuffer)
("msIO_installStdinFromBuffer" msIO_installStdinFromBuffer)
("msIO_stripStdoutBufferContentType" msIO_stripStdoutBufferContentType)
("msIO_stripStdoutBufferContentHeaders" msIO_stripStdoutBufferContentHeaders)
("msIO_getStdoutBufferString" msIO_getStdoutBufferString)
("msIO_getStdoutBufferBytes" msIO_getStdoutBufferBytes)

# EOF