2007-04-17 23:05 UTC+0200 Lorenzo Fiorini (lorenzo.fiorini/at/gmail.com)

* harbour/contrib/gd/Makefile
    * added install of gd.ch
  * harbour/contrib/gd/gd.prg
    * removed two unused vars
  * harbour/contrib/libct/ctnet.c
  * harbour/contrib/libct/Makefile
    * added ctnet.c borrowed from xHarbour
  * harbour/contrib/pgsql/postgres.c
    * fixes some warnings
  * harbour/contrib/tip/cgi.prg
    * added session name parameter
  * harbour/include/hbcompat.ch
    * added gtProcessMessages() translate
This commit is contained in:
Lorenzo Fiorini
2007-04-17 21:03:14 +00:00
parent 5fdd83dc27
commit 9f6c8a1dc8
8 changed files with 335 additions and 13 deletions

View File

@@ -8,6 +8,21 @@
2002-12-01 13:30 UTC+0100 Foo Bar <foo.bar@foobar.org>
*/
2007-04-17 23:05 UTC+0200 Lorenzo Fiorini (lorenzo.fiorini/at/gmail.com)
* harbour/contrib/gd/Makefile
* added install of gd.ch
* harbour/contrib/gd/gd.prg
* removed two unused vars
* harbour/contrib/libct/ctnet.c
* harbour/contrib/libct/Makefile
* added ctnet.c borrowed from xHarbour
* harbour/contrib/pgsql/postgres.c
* fixes some warnings
* harbour/contrib/tip/cgi.prg
* added session name parameter
* harbour/include/hbcompat.ch
* added gtProcessMessages() translate
2007-04-17 20:00 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
* harbour/source/rdd/dbcmd.c
! update NetErr() in ordListAdd()

View File

@@ -7,6 +7,9 @@ ROOT = ../../
C_SOURCES=\
gdwrp.c \
PRG_HEADERS=\
gd.ch \
PRG_SOURCES=\
gd.prg \
gdbar.prg \
@@ -23,3 +26,6 @@ ifeq ($(HB_COMPILER),mingw32)
else
CFLAGS := $(CFLAGS) -I/usr/include
endif
include $(TOP)$(ROOT)config/header.cf

View File

@@ -239,7 +239,6 @@ PROCEDURE gdImageToFile( oImage, cFile )
RETURN
PROCEDURE gdImageToHandle( oImage, nHandle )
LOCAL cString, cExt
DEFAULT nHandle TO 1

View File

@@ -26,6 +26,7 @@ C_SOURCES = \
ctc.c \
ctmath.c \
ctmath2.c \
ctnet.c \
ctset.c \
ctstr.c \
ctchksum.c \

View File

@@ -0,0 +1,281 @@
/*
* $Id$
*
* xHarbour Project source code:
* CT3 NET functions to PC-LAN/MS-NET.
*
* Copyright 2004 Eduardo Fernandes <eduardo@modalsistemas.com.br>
* www - http://www.xharbour.org
*
*******
*
* CT3 NET Functions Comments:
*
* NETCANCEL( <cLocalDevice> ) -> lReleased
* Return true if <cLocalDevice> was disconnected.
*
* NETDISK( cDrive ) -> lSuccess
* Return true if <cDrive> is a network drive, otherwise return false if is a local drive.
*
* NETLOCNAME( cSahredDevice ) -> cLocalDevice
* Not implemented yet.
*
* NETPRINTER() -> lSuccess
* Return true if a current local printer seted by SET PRINTER TO was connected to a
* network printer.
*
* NETREDIR( cLocalDevice, cSharedDevice, [ cPassword ], [ lShowError] ) -> lSuccess
* Return true if <cLocalDevice> was connected to <cSharedDevice> with <cPassword>, if any.
*
* NETRMTNAME( cLocalDevice ) -> cSharedName
* Return the shared resource name connected to a <cLocalDevice>.
* The original parameter <nDevice> in CA-Clipper Tools was changed to <cLocalName> in
* xHarbour because in Windows Network I didn´t find a number table like in MS-DOS. See
* CA-Tools help for more details.
*
* NETWORK() -> lSuccess
* Return true if a PC-LAN/MS-NET or Netware type is active.
*
* NNETWORK() -> lSuccess
* Return true if a Netware type is active.
*
******
* 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.
*
*
* See doc/license.txt for licensing terms.
*
*/
#include "hbapi.h"
#include "hbapiitm.h"
#include "hbset.h"
#include "hbapierr.h"
#if defined(HB_OS_WIN_32)
#include <windows.h>
#include <winnetwk.h>
#define HB_OS_WIN_32_USED
BOOL WINAPI WNetErrorHandler(DWORD dwErrorCode, LPSTR lpszFunction)
{
DWORD dwWNetResult, dwLastError;
CHAR szDescription[256];
CHAR szProvider[256];
HB_ITEM_PTR pError;
if (dwErrorCode != ERROR_EXTENDED_ERROR)
{
pError = hb_errRT_New(
ES_ERROR,
HB_ERR_SS_TOOLS,
9999,
9999,
"Windows Network operation failed",
lpszFunction,
(USHORT) dwErrorCode,
EF_NONE );
hb_errLaunch( pError );
hb_itemRelease( pError );
}
else
{
dwWNetResult = WNetGetLastError(&dwLastError, (LPSTR) szDescription, sizeof(szDescription),
(LPSTR) szProvider,
sizeof(szProvider));
if(dwWNetResult != NO_ERROR) {
pError = hb_errRT_New( ES_ERROR, HB_ERR_SS_TOOLS, 9999, 9999, "WNetGetLastError failed", "see OS error", (USHORT) dwWNetResult, EF_NONE );
hb_errLaunch( pError );
hb_itemRelease( pError );
return FALSE;
}
/*
extern PHB_ITEM HB_EXPORT hb_errRT_New(
USHORT uiSeverity,
char * szSubSystem,
ULONG ulGenCode,
ULONG ulSubCode,
char * szDescription,
char * szOperation,
USHORT uiOsCode,
USHORT uiFlags );
*/
pError = hb_errRT_New( ES_ERROR, HB_ERR_SS_TOOLS, 9999, 9999, szDescription, szProvider, (USHORT) dwLastError, EF_NONE );
hb_errLaunch( pError );
hb_itemRelease( pError );
}
return TRUE;
}
static BOOL hb_IsNetShared(LPSTR szLocalDevice )
{
char szRemoteDevice[80] ;
DWORD dwResult;
DWORD cchBuff = sizeof(szRemoteDevice) ;
dwResult = WNetGetConnection( (LPSTR) szLocalDevice , (LPSTR) szRemoteDevice , &cchBuff) ;
if ( dwResult == NO_ERROR )
{
return TRUE;
}
return FALSE;
}
HB_FUNC ( NETCANCEL )
{
DWORD dwResult;
char *cDevice = (char *)hb_parc (1);
dwResult = WNetCancelConnection( cDevice , TRUE ) ; // FALSE = fail if exist open files or print jobs.
// TRUE = force cancel connection even if exist
// open files or print jobs.
hb_retl( dwResult == NO_ERROR ? TRUE : FALSE );
}
HB_FUNC ( NETPRINTER )
{
char *cPrn = hb_set.HB_SET_PRINTFILE ; // query default local printer port.
hb_retl( hb_IsNetShared( cPrn ) );
}
HB_FUNC ( NETDISK )
{
char cDrive[3];
strncpy( cDrive, hb_parcx( 1 ), 1 );
cDrive[1] = ':';
cDrive[2] = '\0';
hb_retl( hb_IsNetShared( cDrive ) );
}
HB_FUNC ( NETREDIR )
{
DWORD dwResult;
char *cLocalDev = hb_parcx( 1 );
char *cSharedRes = hb_parcx( 2 );
char *cPassword = hb_parcx( 3 );
BOOL bShowError = ( ISLOG(4) ? hb_parl(4) : FALSE );
char szCommand[80];
if ( hb_pcount() >= 3 && ISCHAR( 3 ) )
{
dwResult = WNetAddConnection( cSharedRes, cPassword, cLocalDev ) ;
}
else
{
dwResult = WNetAddConnection( cSharedRes, NULL, cLocalDev ) ;
}
if( dwResult == NO_ERROR )
{
hb_retl( TRUE );
}
else
{
if ( bShowError )
{
snprintf( szCommand, 80, "NETREDIR( \"%s\", \"%s\", \"%s\" )", cLocalDev, cSharedRes, cPassword );
WNetErrorHandler( dwResult, szCommand );
}
hb_retl( FALSE );
}
}
HB_FUNC ( NETRMTNAME )
{
char szRemoteDevice[ 80 ];
char *szLocalDevice = ( char * )hb_parc ( 1 ) ;
DWORD dwResult;
DWORD cchBuff = sizeof( szRemoteDevice );
dwResult = WNetGetConnection( (LPSTR) szLocalDevice, (LPSTR) szRemoteDevice, &cchBuff);
hb_retc( dwResult == NO_ERROR ? szRemoteDevice : "" ) ;
}
HB_FUNC ( NETWORK )
{
DWORD dwResult;
char szProviderName[80];
DWORD cchBuff = sizeof(szProviderName);
dwResult = WNetGetProviderName( WNNC_NET_MSNET, (LPSTR) szProviderName, &cchBuff);
if ( dwResult != NO_ERROR )
{
dwResult = WNetGetProviderName( WNNC_NET_LANMAN, (LPSTR) szProviderName, &cchBuff);
if ( dwResult != NO_ERROR )
{
dwResult = WNetGetProviderName( WNNC_NET_NETWARE, (LPSTR) szProviderName, &cchBuff);
}
}
hb_retl( dwResult == NO_ERROR ? TRUE : FALSE );
}
HB_FUNC ( NNETWORK )
{
DWORD dwResult;
char szProviderName[80];
DWORD cchBuff = sizeof(szProviderName);
dwResult = WNetGetProviderName( WNNC_NET_NETWARE, (LPSTR) szProviderName, &cchBuff);
hb_retl( dwResult == NO_ERROR ? TRUE : FALSE );
}
#endif

View File

@@ -504,30 +504,46 @@ HB_FUNC(PQESCAPESTRING)
}
HB_FUNC(PQESCAPEBYTEA)
HB_FUNC(PQESCAPEBYTEA) /* deprecated */
{
char *from;
char *to;
unsigned const char *from;
unsigned char *to;
size_t from_length;
size_t to_length;
from = hb_parcx(1);
from_length = strlen(from);
to_length = strlen(from) * 5 + 1;
from = ( BYTE * ) hb_parc(1);
from_length = hb_parclen(1);
to_length = from_length * 5 + 1;
to = PQescapeBytea(from, from_length, &to_length);
hb_retc(to);
hb_retc( ( char * ) to );
PQfreemem(to);
}
HB_FUNC(PQESCAPEBYTEACONN)
{
unsigned const char *from;
unsigned char *to;
size_t from_length;
size_t to_length;
from = ( BYTE * ) hb_parc(2);
from_length = hb_parclen(2);
to_length = from_length * 5 + 1;
to = PQescapeByteaConn(( PGconn * ) hb_parptr(1), from, from_length, &to_length);
hb_retc( ( char * ) to );
PQfreemem(to);
}
HB_FUNC(PQUNESCAPEBYTEA)
{
char *from;
unsigned char *from;
size_t to_length;
from = PQunescapeBytea(hb_parcx(1), &to_length);
hb_retclen(from, to_length);
from = PQunescapeBytea(( BYTE * ) hb_parcx(1), &to_length);
hb_retclen( ( char * ) from, to_length);
PQfreemem(from);
}

View File

@@ -372,20 +372,23 @@ METHOD SaveHtmlPage( cFile ) CLASS TIpCgi
RETURN lSuccess
METHOD StartSession() CLASS TIpCgi
METHOD StartSession( cSID ) CLASS TIpCgi
local cSID
local nH
local cFile
local nFileSize
local cBuffer
if empty( cSID )
if ( nH := hGetPos( ::hGets, 'SESSIONID' ) ) != 0
cSID := hGetValueAt( ::hGets, nH )
elseif ( nH := hGetPos( ::hPosts, 'SESSIONID' ) ) != 0
cSID := hGetValueAt( ::hPosts, nH )
elseif ( nH := hGetPos( ::hCookies, 'SESSIONID' ) ) != 0
cSID := hGetValueAt( ::hCookies, nH )
endif
endif
if empty( ::cSessionSavePath )

View File

@@ -76,6 +76,7 @@
#xtranslate gtGetClipboard() => hb_gtInfo( GTI_CLIPBOARDDATA )
#xtranslate gtGetClipBoardSize() => len( hb_gtInfo( GTI_CLIPBOARDDATA ) )
#xtranslate gtPasteClipBoard([<n>]) => hb_gtInfo( GTI_CLIPBOARDPAST )
#xtranslate gtProcessMessages() => nextkey()
#xtranslate gfxPrimitive([<xx,...>])=> hb_gfxPrimitive([<xx>])
#xtranslate gfxText([<xx,...>]) => hb_gfxText([<xx>])