2011-03-07 12:53 UTC+0100 Viktor Szakats (harbour.01 syenar.hu)

* INSTALL
  * contrib/hbplist
  + contrib/hbgs
  + contrib/hbgs/core.c
  + contrib/hbgs/hbgs.hbx
  + contrib/hbgs/hbgs.hbp
  + contrib/hbgs/hbgs.hbc
  + contrib/hbgs/tests
  + contrib/hbgs/tests/testgs.prg
  + contrib/hbgs/tests/hbmk.hbm
    + Added basic, high-level Ghostscript wrapper.
      (only tested on win/win64)
This commit is contained in:
Viktor Szakats
2011-03-07 11:54:38 +00:00
parent 017debeb6e
commit 4d02ecd18b
9 changed files with 210 additions and 0 deletions

View File

@@ -16,6 +16,20 @@
The license applies to all entries newer than 2009-04-28.
*/
2011-03-07 12:53 UTC+0100 Viktor Szakats (harbour.01 syenar.hu)
* INSTALL
* contrib/hbplist
+ contrib/hbgs
+ contrib/hbgs/core.c
+ contrib/hbgs/hbgs.hbx
+ contrib/hbgs/hbgs.hbp
+ contrib/hbgs/hbgs.hbc
+ contrib/hbgs/tests
+ contrib/hbgs/tests/testgs.prg
+ contrib/hbgs/tests/hbmk.hbm
+ Added basic, high-level Ghostscript wrapper.
(only tested on win/win64)
2011-03-07 12:44 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
* harbour/src/rtl/valtype.c
* modified to work with any HB_IT_STRING flags we may add in the future

View File

@@ -341,6 +341,8 @@ HARBOUR
HB_WITH_FREEIMAGE=C:\FreeImage\Dist
HB_WITH_GD=C:\gd\include
HB_WITH_GPM= (on Linux only)
HB_WITH_GS=C:\ghostscript-9.01\psi
HB_WITH_GS_BIN=C:\ghostscript-9.01\bin (on Windows)
HB_WITH_JPEG=C:\jpeglib (defaults to locally hosted version if not found)
HB_WITH_LIBHARU=C:\libharu\include (defaults to locally hosted version)
HB_WITH_LIBMAGIC= (currently on *nix systems)
@@ -1510,6 +1512,8 @@ HARBOUR
http://freeimage.sourceforge.net/
HB_WITH_GD - GD Graphics Library [multiplatform, free, open-source]
http://www.boutell.com/gd/
HB_WITH_GS - Ghostscript [multiplatform, free, open-source]
http://pages.cs.wisc.edu/~ghost/
HB_WITH_JPEG - jpeglib [multiplatform, free, open-source]
http://www.ijg.org/
HB_WITH_LIBHARU - libharu (PDF creation) [multiplatform, free, open-source]

101
harbour/contrib/hbgs/core.c Normal file
View File

@@ -0,0 +1,101 @@
/*
* $Id$
*/
/*
* Harbour Project source code:
* Ghostscript high-level API
*
* Copyright 2011 Viktor Szakats (harbour.01 syenar.hu)
* www - http://harbour-project.org
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this software; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
* Boston, MA 02111-1307 USA (or visit the web site http://www.gnu.org/).
*
* As a special exception, the Harbour Project gives permission for
* additional uses of the text contained in its release of Harbour.
*
* The exception is that, if you link the Harbour libraries with other
* files to produce an executable, this does not by itself cause the
* resulting executable to be covered by the GNU General Public License.
* Your use of that executable is in no way restricted on account of
* linking the Harbour library code into it.
*
* This exception does not however invalidate any other reasons why
* the executable file might be covered by the GNU General Public License.
*
* This exception applies only to the code released by the Harbour
* Project under the name Harbour. If you copy code from other
* Harbour Project or Free Software Foundation releases into a copy of
* Harbour, as the General Public License permits, the exception does
* not apply to the code that you add in this way. To avoid misleading
* anyone as to the status of such modified files, you must delete
* this exception notice from them.
*
* If you write modifications of your own for Harbour, it is your choice
* whether to permit this exception to apply to your modifications.
* If you do not wish that, delete this exception notice.
*
*/
#include "hbapi.h"
#if defined( HB_OS_WIN ) && ! defined( _Windows )
# define _Windows
# include <windows.h>
# define GSDLLEXPORT __declspec( dllimport )
#endif
#include "ierrors.h"
#include "iapi.h"
HB_FUNC( HB_GS )
{
HB_BOOL bResult = HB_FALSE;
PHB_ITEM pParam = hb_param( 1, HB_IT_ARRAY );
if( pParam )
{
void * minst;
int gsargc = ( int ) hb_arrayLen( pParam ) + 1;
int pos;
int code, code1;
char ** gsargv = ( char ** ) hb_xgrab( gsargc * sizeof( const char * ) );
gsargv[ 0 ] = "hbgs"; /* actual value doesn't matter */
for( pos = 1; pos < gsargc; ++pos )
{
const char * pszParam = hb_arrayGetCPtr( pParam, pos );
gsargv[ pos ] = ( char * ) ( pszParam ? pszParam : "" );
}
code = gsapi_new_instance( &minst, NULL );
if( code >= 0 )
{
code = gsapi_init_with_args( minst, gsargc, gsargv );
code1 = gsapi_exit( minst );
if( ( code == 0 ) || ( code == e_Quit ) )
code = code1;
gsapi_delete_instance( minst );
bResult = ( code == 0 || code == e_Quit );
}
}
hb_retl( bResult );
}

View File

@@ -0,0 +1,7 @@
#
# $Id$
#
libs=${_HB_DYNPREF}${hb_name}${_HB_DYNSUFF}
libs=gs

View File

@@ -0,0 +1,23 @@
#
# $Id$
#
-hblib
-inc
-o${hb_name}
-w3 -es2
-depoptional=gs:yes
-depkeyhead=gs:iapi.h
-depcontrol=gs:${HB_WITH_GS}
-depimplibs=gs:${HB_WITH_GS_BIN}/gsdll32.dll{win&&x86}
-depimplibs=gs:${HB_WITH_GS_BIN}/gsdll64.dll{win&&x86_64}
-depimplibd=gs:gs
-instfile=inc:hbgs.hbx
hbgs.hbx
core.c

View File

@@ -0,0 +1,34 @@
/*
* $Id$
*/
/* -------------------------------------------------------------------- */
/* NOTE: You can add manual override which functions to include or */
/* exclude from automatically generated EXTERNAL/DYNAMIC list. */
/* Syntax: // HB_FUNC_INCLUDE <func> */
/* // HB_FUNC_EXCLUDE <func> */
/* -------------------------------------------------------------------- */
/* -------------------------------------------------------------------- */
/* WARNING: Automatically generated code below. DO NOT EDIT! */
/* Regenerate using hbmk2 '-hbx=' option. */
/* -------------------------------------------------------------------- */
#ifndef __HBEXTERN_CH__HBGS__
#define __HBEXTERN_CH__HBGS__
#if defined( __HBEXTREQ__ ) .OR. defined( __HBEXTERN__HBGS__ANNOUNCE )
ANNOUNCE __HBEXTERN__HBGS__
#endif
#if defined( __HBEXTREQ__ ) .OR. defined( __HBEXTERN__HBGS__REQUEST )
#command DYNAMIC <fncs,...> => EXTERNAL <fncs>
#endif
DYNAMIC HB_GS
#if defined( __HBEXTREQ__ ) .OR. defined( __HBEXTERN__HBGS__REQUEST )
#uncommand DYNAMIC <fncs,...> => EXTERNAL <fncs>
#endif
#endif

View File

@@ -0,0 +1,7 @@
#
# $Id$
#
../hbgs.hbc
-w3 -es2

View File

@@ -0,0 +1,19 @@
/*
* $Id$
*/
/*
* Harbour Project source code:
*
* Copyright 2011 Viktor Szakats (harbour.01 syenar.hu)
* www - http://harbour-project.org
*
*/
#include "simpleio.ch"
PROCEDURE Main()
? HB_GS( { "--version" } )
RETURN

View File

@@ -21,6 +21,7 @@ hbformat/utils/hbformat.hbp
hbfoxpro/hbfoxpro.hbp
hbfship/hbfship.hbp
hbgd/hbgd.hbp
hbgs/hbgs.hbp
hbgt/hbgt.hbp
hbhpdf/hbhpdf.hbp # uses: libhpdf (locally hosted)
hbhttpd/hbhttpd.hbp