[Ils-source] r1458 - in branches/1.6: . addons/ccure addons/ccure/pre9000 addons/ccure/pre9000/ilsccureconnector addons/ccure/vws webapp/api/ccure/user/put
scribe at crosswire.org
scribe at crosswire.org
Mon May 9 16:15:46 MST 2016
Author: scribe
Date: 2016-05-09 16:15:45 -0700 (Mon, 09 May 2016)
New Revision: 1458
Added:
branches/1.6/addons/ccure/pre9000/
branches/1.6/addons/ccure/pre9000/README.txt
branches/1.6/addons/ccure/pre9000/ilsccureconnector.exe
branches/1.6/addons/ccure/pre9000/ilsccureconnector/
branches/1.6/addons/ccure/pre9000/ilsccureconnector/ILSCCUREConnector.bpg
branches/1.6/addons/ccure/pre9000/ilsccureconnector/Project3.bpr
branches/1.6/addons/ccure/pre9000/ilsccureconnector/Project3.cpp
branches/1.6/addons/ccure/pre9000/ilsccureconnector/Project3.res
branches/1.6/addons/ccure/pre9000/ilsccureconnector/Unit1.cpp
branches/1.6/addons/ccure/pre9000/ilsccureconnector/Unit3.cpp
branches/1.6/addons/ccure/pre9000/ilsccureconnector/Unit3.dfm
branches/1.6/addons/ccure/pre9000/ilsccureconnector/Unit3.h
branches/1.6/addons/ccure/pre9000/ilsccureconnector/defs.h
branches/1.6/addons/ccure/pre9000/ilsccureconnector/filemgr.cpp
branches/1.6/addons/ccure/pre9000/ilsccureconnector/filemgr.h
branches/1.6/addons/ccure/pre9000/ilsccureconnector/floppy.bmp
branches/1.6/addons/ccure/pre9000/ilsccureconnector/handshak.ico
branches/1.6/addons/ccure/pre9000/ilsccureconnector/ilsccureconnector.bpr
branches/1.6/addons/ccure/pre9000/ilsccureconnector/ilsccureconnector.cpp
branches/1.6/addons/ccure/pre9000/ilsccureconnector/ilsccureconnector.res
branches/1.6/addons/ccure/pre9000/ilsccureconnector/ilsccurehook.bpf
branches/1.6/addons/ccure/pre9000/ilsccureconnector/ilsccurehook.bpr
branches/1.6/addons/ccure/pre9000/ilsccureconnector/ilsccurehook.res
branches/1.6/addons/ccure/pre9000/ilsccureconnector/ilsccuremainfrm.cpp
branches/1.6/addons/ccure/pre9000/ilsccureconnector/ilsccuremainfrm.dfm
branches/1.6/addons/ccure/pre9000/ilsccureconnector/ilsccuremainfrm.h
branches/1.6/addons/ccure/pre9000/ilsccureconnector/ilshook.h
branches/1.6/addons/ccure/pre9000/ilsccureconnector/multimapwdef.h
branches/1.6/addons/ccure/pre9000/ilsccureconnector/swbuf.cpp
branches/1.6/addons/ccure/pre9000/ilsccureconnector/swbuf.h
branches/1.6/addons/ccure/pre9000/ilsccureconnector/swcacher.cpp
branches/1.6/addons/ccure/pre9000/ilsccureconnector/swcacher.h
branches/1.6/addons/ccure/pre9000/ilsccureconnector/swconfig.cpp
branches/1.6/addons/ccure/pre9000/ilsccureconnector/swconfig.h
branches/1.6/addons/ccure/pre9000/ilsccureconnector/swlog.h
branches/1.6/addons/ccure/pre9000/ilsccureconnector/sysdata.h
branches/1.6/addons/ccure/pre9000/ilsccureconnector/utilstr.cpp
branches/1.6/addons/ccure/pre9000/ilsccureconnector/utilstr.h
branches/1.6/addons/ccure/pre9000/ilsccurehook.dll
branches/1.6/addons/ccure/vws/
branches/1.6/addons/ccure/vws/README.txt
branches/1.6/addons/ccure/vws/SimpleMessageQueue-installer.exe
Removed:
branches/1.6/addons/ccure/README.txt
branches/1.6/addons/ccure/ilsccureconnector.exe
branches/1.6/addons/ccure/ilsccureconnector/
branches/1.6/addons/ccure/ilsccurehook.dll
branches/1.6/addons/ccure/pre9000/README.txt
branches/1.6/addons/ccure/pre9000/ilsccureconnector.exe
branches/1.6/addons/ccure/pre9000/ilsccureconnector/
branches/1.6/addons/ccure/pre9000/ilsccureconnector/ILSCCUREConnector.bpg
branches/1.6/addons/ccure/pre9000/ilsccureconnector/Project3.bpr
branches/1.6/addons/ccure/pre9000/ilsccureconnector/Project3.cpp
branches/1.6/addons/ccure/pre9000/ilsccureconnector/Project3.res
branches/1.6/addons/ccure/pre9000/ilsccureconnector/Unit1.cpp
branches/1.6/addons/ccure/pre9000/ilsccureconnector/Unit3.cpp
branches/1.6/addons/ccure/pre9000/ilsccureconnector/Unit3.dfm
branches/1.6/addons/ccure/pre9000/ilsccureconnector/Unit3.h
branches/1.6/addons/ccure/pre9000/ilsccureconnector/defs.h
branches/1.6/addons/ccure/pre9000/ilsccureconnector/filemgr.cpp
branches/1.6/addons/ccure/pre9000/ilsccureconnector/filemgr.h
branches/1.6/addons/ccure/pre9000/ilsccureconnector/floppy.bmp
branches/1.6/addons/ccure/pre9000/ilsccureconnector/handshak.ico
branches/1.6/addons/ccure/pre9000/ilsccureconnector/ilsccureconnector.bpr
branches/1.6/addons/ccure/pre9000/ilsccureconnector/ilsccureconnector.cpp
branches/1.6/addons/ccure/pre9000/ilsccureconnector/ilsccureconnector.res
branches/1.6/addons/ccure/pre9000/ilsccureconnector/ilsccurehook.bpf
branches/1.6/addons/ccure/pre9000/ilsccureconnector/ilsccurehook.bpr
branches/1.6/addons/ccure/pre9000/ilsccureconnector/ilsccurehook.res
branches/1.6/addons/ccure/pre9000/ilsccureconnector/ilsccuremainfrm.cpp
branches/1.6/addons/ccure/pre9000/ilsccureconnector/ilsccuremainfrm.dfm
branches/1.6/addons/ccure/pre9000/ilsccureconnector/ilsccuremainfrm.h
branches/1.6/addons/ccure/pre9000/ilsccureconnector/ilshook.h
branches/1.6/addons/ccure/pre9000/ilsccureconnector/multimapwdef.h
branches/1.6/addons/ccure/pre9000/ilsccureconnector/swbuf.cpp
branches/1.6/addons/ccure/pre9000/ilsccureconnector/swbuf.h
branches/1.6/addons/ccure/pre9000/ilsccureconnector/swcacher.cpp
branches/1.6/addons/ccure/pre9000/ilsccureconnector/swcacher.h
branches/1.6/addons/ccure/pre9000/ilsccureconnector/swconfig.cpp
branches/1.6/addons/ccure/pre9000/ilsccureconnector/swconfig.h
branches/1.6/addons/ccure/pre9000/ilsccureconnector/swlog.h
branches/1.6/addons/ccure/pre9000/ilsccureconnector/sysdata.h
branches/1.6/addons/ccure/pre9000/ilsccureconnector/utilstr.cpp
branches/1.6/addons/ccure/pre9000/ilsccureconnector/utilstr.h
branches/1.6/addons/ccure/pre9000/ilsccurehook.dll
branches/1.6/addons/ccure/vws/README.txt
branches/1.6/addons/ccure/vws/SimpleMessageQueue-installer.exe
Modified:
branches/1.6/
branches/1.6/webapp/api/ccure/user/put/index.jsp
Log:
merged in updates for CCURE integration with new README.txt for configuration information
Property changes on: branches/1.6
___________________________________________________________________
Modified: svn:mergeinfo
- /trunk:796-1303,1306-1307,1309-1311,1319-1320,1322-1323,1325,1328-1330,1332,1334-1335,1337,1339,1349-1356,1359-1365,1369,1373-1374,1380-1383,1391,1393,1401-1404,1407,1409,1412,1416-1419,1421-1424,1427,1429,1431,1434,1436,1441,1446-1448
+ /trunk:796-1303,1306-1307,1309-1311,1319-1320,1322-1323,1325,1328-1330,1332,1334-1335,1337,1339,1349-1356,1359-1365,1369,1373-1374,1380-1383,1391,1393,1401-1404,1407,1409,1412,1416-1419,1421-1424,1427,1429,1431,1434,1436,1441,1446-1448,1457
Deleted: branches/1.6/addons/ccure/README.txt
===================================================================
--- branches/1.6/addons/ccure/README.txt 2016-05-09 23:12:32 UTC (rev 1457)
+++ branches/1.6/addons/ccure/README.txt 2016-05-09 23:15:45 UTC (rev 1458)
@@ -1,76 +0,0 @@
-# jobs.xml
-# Need to uncomment a scheduling job to run the CCURE
-#<trigger>
-# <cron>
-# <name>CCURELockedRecords</name>
-# <group>ILSTriggers</group>
-# <job-name>CCURERetryLockedRecords</job-name>
-# <job-group>CCURE</job-group>
-# <cron-expression>0 * * * * ?</cron-expression>
-# </cron>
-#</trigger>
-#
-#
-#
-#
-#-----------------------------------------------
-
-
-
-#sysconfig.properties parameters with examples:
-
-# URL to exactly the root of the ILS, including port if necessary
-ILSURL=http://localhost:8081
-
-# hostname[:port] for the CCURE system
-CCUREHost=216.119.104.185:2500
-
-# CCURE user with ODBC rights
-CCUREDBUser=sysprogress
-
-# password for the CCURE user with ODBC rights
-CCUREDBPassword=manager
-
-# ----------------------------------------------------------------------
-# static ILS Role into which we place all new CCURE users in the ILS
-# unless CCURERoleField, below, is specified and contains data
-CCURERole=GA
-
-# CCURE Role Field Name which specifies into which ILS Role a new CCURE user
-# should be placed in the ILS. If parameter is not specified or the
-# field does not contain data in the CCURE database, then the above CCURERole
-# value will be used as the new ILS user's Role.
-CCUREFieldRole=Text14
-# ----------------------------------------------------------------------
-
-# ----------------------------------------------------------------------
-# static ILS Location into which we place all new CCURE users in the ILS
-# unless CCURELocationField, below, is specified and contains data
-CCURELocation=FAA
-
-# CCURE Location Field Name which specifies into which ILS Location a new CCURE
-# user should be placed in the ILS. If parameter is not specified or the field
-# does not contain data in the CCURE database, then the above CCURELocation
-# value will be used as the new ILS user's Location.
-CCUREFieldLocation=Text1
-# ----------------------------------------------------------------------
-
-# These parameters are optional if the defaulted values, given in the examples
-# below match your system.
-
-CCUREFieldAddr1=Text1
-CCUREFieldCity=Text2
-CCUREFieldState=Text3
-CCUREFieldZip=Text4
-CCUREFieldPhone=Text5
-
-CCURECourse.1=Security Awareness
-CCUREFieldCourseResult.1=Text15
-CCURECourse.2=SIDA
-CCUREFieldCourseResult.2=Text16
-CCURECourse.3=Authorized Signer
-CCUREFieldCourseResult.3=Text17
-CCURECourse.4=Non-Movement Area Drivers Training
-CCUREFieldCourseResult.4=Text18
-CCURECourse.5=Movement Area Drivers Training
-CCUREFieldCourseResult.5=Text19
Deleted: branches/1.6/addons/ccure/ilsccureconnector.exe
===================================================================
(Binary files differ)
Deleted: branches/1.6/addons/ccure/ilsccurehook.dll
===================================================================
(Binary files differ)
Deleted: branches/1.6/addons/ccure/pre9000/README.txt
===================================================================
--- trunk/addons/ccure/pre9000/README.txt 2016-05-09 23:12:32 UTC (rev 1457)
+++ branches/1.6/addons/ccure/pre9000/README.txt 2016-05-09 23:15:45 UTC (rev 1458)
@@ -1,76 +0,0 @@
-# jobs.xml
-# Need to uncomment a scheduling job to run the CCURE
-#<trigger>
-# <cron>
-# <name>CCURELockedRecords</name>
-# <group>ILSTriggers</group>
-# <job-name>CCURERetryLockedRecords</job-name>
-# <job-group>CCURE</job-group>
-# <cron-expression>0 * * * * ?</cron-expression>
-# </cron>
-#</trigger>
-#
-#
-#
-#
-#-----------------------------------------------
-
-
-
-#sysconfig.properties parameters with examples:
-
-# URL to exactly the root of the ILS, including port if necessary
-ILSURL=http://localhost:8081
-
-# hostname[:port] for the CCURE system
-CCUREHost=216.119.104.185:2500
-
-# CCURE user with ODBC rights
-CCUREDBUser=sysprogress
-
-# password for the CCURE user with ODBC rights
-CCUREDBPassword=manager
-
-# ----------------------------------------------------------------------
-# static ILS Role into which we place all new CCURE users in the ILS
-# unless CCURERoleField, below, is specified and contains data
-CCURERole=GA
-
-# CCURE Role Field Name which specifies into which ILS Role a new CCURE user
-# should be placed in the ILS. If parameter is not specified or the
-# field does not contain data in the CCURE database, then the above CCURERole
-# value will be used as the new ILS user's Role.
-CCUREFieldRole=Text14
-# ----------------------------------------------------------------------
-
-# ----------------------------------------------------------------------
-# static ILS Location into which we place all new CCURE users in the ILS
-# unless CCURELocationField, below, is specified and contains data
-CCURELocation=FAA
-
-# CCURE Location Field Name which specifies into which ILS Location a new CCURE
-# user should be placed in the ILS. If parameter is not specified or the field
-# does not contain data in the CCURE database, then the above CCURELocation
-# value will be used as the new ILS user's Location.
-CCUREFieldLocation=Text1
-# ----------------------------------------------------------------------
-
-# These parameters are optional if the defaulted values, given in the examples
-# below match your system.
-
-CCUREFieldAddr1=Text1
-CCUREFieldCity=Text2
-CCUREFieldState=Text3
-CCUREFieldZip=Text4
-CCUREFieldPhone=Text5
-
-CCURECourse.1=Security Awareness
-CCUREFieldCourseResult.1=Text15
-CCURECourse.2=SIDA
-CCUREFieldCourseResult.2=Text16
-CCURECourse.3=Authorized Signer
-CCUREFieldCourseResult.3=Text17
-CCURECourse.4=Non-Movement Area Drivers Training
-CCUREFieldCourseResult.4=Text18
-CCURECourse.5=Movement Area Drivers Training
-CCUREFieldCourseResult.5=Text19
Copied: branches/1.6/addons/ccure/pre9000/README.txt (from rev 1457, trunk/addons/ccure/pre9000/README.txt)
===================================================================
--- branches/1.6/addons/ccure/pre9000/README.txt (rev 0)
+++ branches/1.6/addons/ccure/pre9000/README.txt 2016-05-09 23:15:45 UTC (rev 1458)
@@ -0,0 +1,76 @@
+# jobs.xml
+# Need to uncomment a scheduling job to run the CCURE
+#<trigger>
+# <cron>
+# <name>CCURELockedRecords</name>
+# <group>ILSTriggers</group>
+# <job-name>CCURERetryLockedRecords</job-name>
+# <job-group>CCURE</job-group>
+# <cron-expression>0 * * * * ?</cron-expression>
+# </cron>
+#</trigger>
+#
+#
+#
+#
+#-----------------------------------------------
+
+
+
+#sysconfig.properties parameters with examples:
+
+# URL to exactly the root of the ILS, including port if necessary
+ILSURL=http://localhost:8081
+
+# hostname[:port] for the CCURE system
+CCUREHost=216.119.104.185:2500
+
+# CCURE user with ODBC rights
+CCUREDBUser=sysprogress
+
+# password for the CCURE user with ODBC rights
+CCUREDBPassword=manager
+
+# ----------------------------------------------------------------------
+# static ILS Role into which we place all new CCURE users in the ILS
+# unless CCURERoleField, below, is specified and contains data
+CCURERole=GA
+
+# CCURE Role Field Name which specifies into which ILS Role a new CCURE user
+# should be placed in the ILS. If parameter is not specified or the
+# field does not contain data in the CCURE database, then the above CCURERole
+# value will be used as the new ILS user's Role.
+CCUREFieldRole=Text14
+# ----------------------------------------------------------------------
+
+# ----------------------------------------------------------------------
+# static ILS Location into which we place all new CCURE users in the ILS
+# unless CCURELocationField, below, is specified and contains data
+CCURELocation=FAA
+
+# CCURE Location Field Name which specifies into which ILS Location a new CCURE
+# user should be placed in the ILS. If parameter is not specified or the field
+# does not contain data in the CCURE database, then the above CCURELocation
+# value will be used as the new ILS user's Location.
+CCUREFieldLocation=Text1
+# ----------------------------------------------------------------------
+
+# These parameters are optional if the defaulted values, given in the examples
+# below match your system.
+
+CCUREFieldAddr1=Text1
+CCUREFieldCity=Text2
+CCUREFieldState=Text3
+CCUREFieldZip=Text4
+CCUREFieldPhone=Text5
+
+CCURECourse.1=Security Awareness
+CCUREFieldCourseResult.1=Text15
+CCURECourse.2=SIDA
+CCUREFieldCourseResult.2=Text16
+CCURECourse.3=Authorized Signer
+CCUREFieldCourseResult.3=Text17
+CCURECourse.4=Non-Movement Area Drivers Training
+CCUREFieldCourseResult.4=Text18
+CCURECourse.5=Movement Area Drivers Training
+CCUREFieldCourseResult.5=Text19
Deleted: branches/1.6/addons/ccure/pre9000/ilsccureconnector/ILSCCUREConnector.bpg
===================================================================
--- trunk/addons/ccure/pre9000/ilsccureconnector/ILSCCUREConnector.bpg 2016-05-09 23:12:32 UTC (rev 1457)
+++ branches/1.6/addons/ccure/pre9000/ilsccureconnector/ILSCCUREConnector.bpg 2016-05-09 23:15:45 UTC (rev 1458)
@@ -1,29 +0,0 @@
-#------------------------------------------------------------------------------
-VERSION = BWS.01
-#------------------------------------------------------------------------------
-!ifndef ROOT
-ROOT = $(MAKEDIR)\..
-!endif
-#------------------------------------------------------------------------------
-MAKE = $(ROOT)\bin\make.exe -$(MAKEFLAGS) -f$**
-DCC = $(ROOT)\bin\dcc32.exe $**
-BRCC = $(ROOT)\bin\brcc32.exe $**
-#------------------------------------------------------------------------------
-PROJECTS = ilsccurehook.dll ilsccureconnector.exe Project3.exe
-#------------------------------------------------------------------------------
-default: $(PROJECTS)
-#------------------------------------------------------------------------------
-
-Project3.exe: Project3.bpr
- $(ROOT)\bin\bpr2mak $**
- $(ROOT)\bin\make -$(MAKEFLAGS) -f$*.mak
-
-ilsccurehook.dll: ilsccurehook.bpr
- $(ROOT)\bin\bpr2mak $**
- $(ROOT)\bin\make -$(MAKEFLAGS) -f$*.mak
-
-ilsccureconnector.exe: ilsccureconnector.bpr
- $(ROOT)\bin\bpr2mak $**
- $(ROOT)\bin\make -$(MAKEFLAGS) -f$*.mak
-
-
Copied: branches/1.6/addons/ccure/pre9000/ilsccureconnector/ILSCCUREConnector.bpg (from rev 1457, trunk/addons/ccure/pre9000/ilsccureconnector/ILSCCUREConnector.bpg)
===================================================================
--- branches/1.6/addons/ccure/pre9000/ilsccureconnector/ILSCCUREConnector.bpg (rev 0)
+++ branches/1.6/addons/ccure/pre9000/ilsccureconnector/ILSCCUREConnector.bpg 2016-05-09 23:15:45 UTC (rev 1458)
@@ -0,0 +1,29 @@
+#------------------------------------------------------------------------------
+VERSION = BWS.01
+#------------------------------------------------------------------------------
+!ifndef ROOT
+ROOT = $(MAKEDIR)\..
+!endif
+#------------------------------------------------------------------------------
+MAKE = $(ROOT)\bin\make.exe -$(MAKEFLAGS) -f$**
+DCC = $(ROOT)\bin\dcc32.exe $**
+BRCC = $(ROOT)\bin\brcc32.exe $**
+#------------------------------------------------------------------------------
+PROJECTS = ilsccurehook.dll ilsccureconnector.exe Project3.exe
+#------------------------------------------------------------------------------
+default: $(PROJECTS)
+#------------------------------------------------------------------------------
+
+Project3.exe: Project3.bpr
+ $(ROOT)\bin\bpr2mak $**
+ $(ROOT)\bin\make -$(MAKEFLAGS) -f$*.mak
+
+ilsccurehook.dll: ilsccurehook.bpr
+ $(ROOT)\bin\bpr2mak $**
+ $(ROOT)\bin\make -$(MAKEFLAGS) -f$*.mak
+
+ilsccureconnector.exe: ilsccureconnector.bpr
+ $(ROOT)\bin\bpr2mak $**
+ $(ROOT)\bin\make -$(MAKEFLAGS) -f$*.mak
+
+
Deleted: branches/1.6/addons/ccure/pre9000/ilsccureconnector/Project3.bpr
===================================================================
--- trunk/addons/ccure/pre9000/ilsccureconnector/Project3.bpr 2016-05-09 23:12:32 UTC (rev 1457)
+++ branches/1.6/addons/ccure/pre9000/ilsccureconnector/Project3.bpr 2016-05-09 23:15:45 UTC (rev 1458)
@@ -1,93 +0,0 @@
-<?xml version='1.0' encoding='utf-8' ?>
-<!-- C++Builder XML Project -->
-<PROJECT>
- <MACROS>
- <VERSION value="BCB.05.03"/>
- <PROJECT value="Project3.exe"/>
- <OBJFILES value="Project3.obj Unit3.obj"/>
- <RESFILES value="Project3.res"/>
- <DEFFILE value=""/>
- <RESDEPEN value="$(RESFILES) Unit3.dfm"/>
- <LIBFILES value=""/>
- <LIBRARIES value=""/>
- <SPARELIBS value="Vcl50.lib"/>
- <PACKAGES value="Vcl50.bpi Vclx50.bpi bcbsmp50.bpi Qrpt50.bpi Vcldb50.bpi Vclbde50.bpi
- ibsmp50.bpi vcldbx50.bpi TeeUI50.bpi TeeDB50.bpi Tee50.bpi TeeQR50.bpi
- VCLIB50.bpi bcbie50.bpi vclie50.bpi Inetdb50.bpi Inet50.bpi NMFast50.bpi
- dclocx50.bpi bcb2kaxserver50.bpi"/>
- <PATHCPP value=".;"/>
- <PATHPAS value=".;"/>
- <PATHRC value=".;"/>
- <PATHASM value=".;"/>
- <DEBUGLIBPATH value="$(BCB)\lib\debug"/>
- <RELEASELIBPATH value="$(BCB)\lib\release"/>
- <LINKER value="tlink32"/>
- <USERDEFINES value="_DEBUG"/>
- <SYSDEFINES value="_RTLDLL;NO_STRICT;USEPACKAGES"/>
- <MAINSOURCE value="Project3.cpp"/>
- <INCLUDEPATH value="$(BCB)\include;$(BCB)\include\vcl"/>
- <LIBPATH value="$(BCB)\lib\obj;$(BCB)\lib"/>
- <WARNINGS value="-w-par"/>
- </MACROS>
- <OPTIONS>
- <CFLAG1 value="-Od -H=$(BCB)\lib\vcl50.csm -Hc -Vx -Ve -X- -r- -a8 -b- -k -y -v -vi- -c
- -tW -tWM"/>
- <PFLAGS value="-$YD -$W -$O- -v -JPHNE -M"/>
- <RFLAGS value=""/>
- <AFLAGS value="/mx /w2 /zd"/>
- <LFLAGS value="-D"" -aa -Tpe -x -Gn -v"/>
- </OPTIONS>
- <LINKER>
- <ALLOBJ value="c0w32.obj $(PACKAGES) Memmgr.Lib sysinit.obj $(OBJFILES)"/>
- <ALLRES value="$(RESFILES)"/>
- <ALLLIB value="$(LIBFILES) $(LIBRARIES) import32.lib cp32mti.lib"/>
- </LINKER>
- <IDEOPTIONS>
-[Version Info]
-IncludeVerInfo=0
-AutoIncBuild=0
-MajorVer=1
-MinorVer=0
-Release=0
-Build=0
-Debug=0
-PreRelease=0
-Special=0
-Private=0
-DLL=0
-Locale=1033
-CodePage=1252
-
-[Version Info Keys]
-CompanyName=
-FileDescription=
-FileVersion=1.0.0.0
-InternalName=
-LegalCopyright=
-LegalTrademarks=
-OriginalFilename=
-ProductName=
-ProductVersion=1.0.0.0
-Comments=
-
-[Debugging]
-DebugSourceDirs=$(BCB)\source\vcl
-
-[Parameters]
-RunParams=
-HostApplication=
-RemoteHost=
-RemotePath=
-RemoteDebug=0
-
-[Compiler]
-ShowInfoMsgs=0
-LinkDebugVcl=0
-LinkCGLIB=0
-
-[Language]
-ActiveLang=
-ProjectLang=
-RootDir=
- </IDEOPTIONS>
-</PROJECT>
\ No newline at end of file
Copied: branches/1.6/addons/ccure/pre9000/ilsccureconnector/Project3.bpr (from rev 1457, trunk/addons/ccure/pre9000/ilsccureconnector/Project3.bpr)
===================================================================
--- branches/1.6/addons/ccure/pre9000/ilsccureconnector/Project3.bpr (rev 0)
+++ branches/1.6/addons/ccure/pre9000/ilsccureconnector/Project3.bpr 2016-05-09 23:15:45 UTC (rev 1458)
@@ -0,0 +1,93 @@
+<?xml version='1.0' encoding='utf-8' ?>
+<!-- C++Builder XML Project -->
+<PROJECT>
+ <MACROS>
+ <VERSION value="BCB.05.03"/>
+ <PROJECT value="Project3.exe"/>
+ <OBJFILES value="Project3.obj Unit3.obj"/>
+ <RESFILES value="Project3.res"/>
+ <DEFFILE value=""/>
+ <RESDEPEN value="$(RESFILES) Unit3.dfm"/>
+ <LIBFILES value=""/>
+ <LIBRARIES value=""/>
+ <SPARELIBS value="Vcl50.lib"/>
+ <PACKAGES value="Vcl50.bpi Vclx50.bpi bcbsmp50.bpi Qrpt50.bpi Vcldb50.bpi Vclbde50.bpi
+ ibsmp50.bpi vcldbx50.bpi TeeUI50.bpi TeeDB50.bpi Tee50.bpi TeeQR50.bpi
+ VCLIB50.bpi bcbie50.bpi vclie50.bpi Inetdb50.bpi Inet50.bpi NMFast50.bpi
+ dclocx50.bpi bcb2kaxserver50.bpi"/>
+ <PATHCPP value=".;"/>
+ <PATHPAS value=".;"/>
+ <PATHRC value=".;"/>
+ <PATHASM value=".;"/>
+ <DEBUGLIBPATH value="$(BCB)\lib\debug"/>
+ <RELEASELIBPATH value="$(BCB)\lib\release"/>
+ <LINKER value="tlink32"/>
+ <USERDEFINES value="_DEBUG"/>
+ <SYSDEFINES value="_RTLDLL;NO_STRICT;USEPACKAGES"/>
+ <MAINSOURCE value="Project3.cpp"/>
+ <INCLUDEPATH value="$(BCB)\include;$(BCB)\include\vcl"/>
+ <LIBPATH value="$(BCB)\lib\obj;$(BCB)\lib"/>
+ <WARNINGS value="-w-par"/>
+ </MACROS>
+ <OPTIONS>
+ <CFLAG1 value="-Od -H=$(BCB)\lib\vcl50.csm -Hc -Vx -Ve -X- -r- -a8 -b- -k -y -v -vi- -c
+ -tW -tWM"/>
+ <PFLAGS value="-$YD -$W -$O- -v -JPHNE -M"/>
+ <RFLAGS value=""/>
+ <AFLAGS value="/mx /w2 /zd"/>
+ <LFLAGS value="-D"" -aa -Tpe -x -Gn -v"/>
+ </OPTIONS>
+ <LINKER>
+ <ALLOBJ value="c0w32.obj $(PACKAGES) Memmgr.Lib sysinit.obj $(OBJFILES)"/>
+ <ALLRES value="$(RESFILES)"/>
+ <ALLLIB value="$(LIBFILES) $(LIBRARIES) import32.lib cp32mti.lib"/>
+ </LINKER>
+ <IDEOPTIONS>
+[Version Info]
+IncludeVerInfo=0
+AutoIncBuild=0
+MajorVer=1
+MinorVer=0
+Release=0
+Build=0
+Debug=0
+PreRelease=0
+Special=0
+Private=0
+DLL=0
+Locale=1033
+CodePage=1252
+
+[Version Info Keys]
+CompanyName=
+FileDescription=
+FileVersion=1.0.0.0
+InternalName=
+LegalCopyright=
+LegalTrademarks=
+OriginalFilename=
+ProductName=
+ProductVersion=1.0.0.0
+Comments=
+
+[Debugging]
+DebugSourceDirs=$(BCB)\source\vcl
+
+[Parameters]
+RunParams=
+HostApplication=
+RemoteHost=
+RemotePath=
+RemoteDebug=0
+
+[Compiler]
+ShowInfoMsgs=0
+LinkDebugVcl=0
+LinkCGLIB=0
+
+[Language]
+ActiveLang=
+ProjectLang=
+RootDir=
+ </IDEOPTIONS>
+</PROJECT>
\ No newline at end of file
Deleted: branches/1.6/addons/ccure/pre9000/ilsccureconnector/Project3.cpp
===================================================================
--- trunk/addons/ccure/pre9000/ilsccureconnector/Project3.cpp 2016-05-09 23:12:32 UTC (rev 1457)
+++ branches/1.6/addons/ccure/pre9000/ilsccureconnector/Project3.cpp 2016-05-09 23:15:45 UTC (rev 1458)
@@ -1,22 +0,0 @@
-//---------------------------------------------------------------------------
-
-#include <vcl.h>
-#pragma hdrstop
-USERES("Project3.res");
-USEFORM("Unit3.cpp", Form3);
-//---------------------------------------------------------------------------
-WINAPI WinMain(HINSTANCE, HINSTANCE, LPSTR, int)
-{
- try
- {
- Application->Initialize();
- Application->CreateForm(__classid(TForm3), &Form3);
- Application->Run();
- }
- catch (Exception &exception)
- {
- Application->ShowException(&exception);
- }
- return 0;
-}
-//---------------------------------------------------------------------------
Copied: branches/1.6/addons/ccure/pre9000/ilsccureconnector/Project3.cpp (from rev 1457, trunk/addons/ccure/pre9000/ilsccureconnector/Project3.cpp)
===================================================================
--- branches/1.6/addons/ccure/pre9000/ilsccureconnector/Project3.cpp (rev 0)
+++ branches/1.6/addons/ccure/pre9000/ilsccureconnector/Project3.cpp 2016-05-09 23:15:45 UTC (rev 1458)
@@ -0,0 +1,22 @@
+//---------------------------------------------------------------------------
+
+#include <vcl.h>
+#pragma hdrstop
+USERES("Project3.res");
+USEFORM("Unit3.cpp", Form3);
+//---------------------------------------------------------------------------
+WINAPI WinMain(HINSTANCE, HINSTANCE, LPSTR, int)
+{
+ try
+ {
+ Application->Initialize();
+ Application->CreateForm(__classid(TForm3), &Form3);
+ Application->Run();
+ }
+ catch (Exception &exception)
+ {
+ Application->ShowException(&exception);
+ }
+ return 0;
+}
+//---------------------------------------------------------------------------
Deleted: branches/1.6/addons/ccure/pre9000/ilsccureconnector/Project3.res
===================================================================
(Binary files differ)
Copied: branches/1.6/addons/ccure/pre9000/ilsccureconnector/Project3.res (from rev 1457, trunk/addons/ccure/pre9000/ilsccureconnector/Project3.res)
===================================================================
(Binary files differ)
Deleted: branches/1.6/addons/ccure/pre9000/ilsccureconnector/Unit1.cpp
===================================================================
--- trunk/addons/ccure/pre9000/ilsccureconnector/Unit1.cpp 2016-05-09 23:12:32 UTC (rev 1457)
+++ branches/1.6/addons/ccure/pre9000/ilsccureconnector/Unit1.cpp 2016-05-09 23:15:45 UTC (rev 1458)
@@ -1,217 +0,0 @@
-//---------------------------------------------------------------------------
-#include <vcl.h>
-#include <windows.h>
-#include <SysUtils.hpp>
-#include "ilshook.h"
-
-#pragma argsused
-
-extern "C" {
-UINT SG_TARGET_EVENT=RegisterWindowMessage("SG_TARGET_EVENT");
-}
-
-typedef struct tagMSGREC {
- HHOOK sysMsgFilter;
- HINSTANCE hInst;
- long personID; // EmployeeId
- long controlNumber;
- char lastEditValue[65];
-
-/*
- char birthDate[25]; // Employer Tab - Birth_Date -> Password
- char hireDate[25]; // Employer Tab - Hire_Date -> Hire Date
- char text1[25]; // Text 1 (Company Name) -> ????
- char firstName[40]; // Header - First Name -> First Name
- char lastName[40]; // Header - Last Name -> Last Name
- char addr1[40]; // Employer Tab - HOME_ADDRESS ->Address 1
- char city[40]; // Employer Tab - CITY -> City/Providence
- char state[5]Employer Tab - STATE -> State
-Employer Tab - ZIP_CODE -> Zip
-Employer Tab - HOME_PHONE -> Phone
-Text 14 ->Role
-*/
-
-} TMSGREC;
-
-typedef TMSGREC* PMSGREC;
-
-HINSTANCE hInst;
-HANDLE hObjHandle;
-PMSGREC lpMsgRec;
-
-void __fastcall MapFileMemory(DWORD dwAllocSize)
-{
- // Create a process wide memory mapped variable
- if(hObjHandle == NULL)
- {
- hObjHandle = CreateFileMapping((HANDLE)0xFFFFFFFF,
- NULL,
- PAGE_READWRITE,
- 0,
- dwAllocSize,
- "HookRecMemBlock");
-
- if(hObjHandle == NULL)
- {
- MessageBox(0,
- "Could not create file map object",
- "Hook DLL",
- MB_OK);
- return;
- }
- }
-
- // Get a pointer to our process wide memory mapped variable
- if(lpMsgRec == NULL)
- {
- lpMsgRec = (PMSGREC)MapViewOfFile(hObjHandle,
- FILE_MAP_WRITE,
- 0,
- 0,
- dwAllocSize);
-
- if(lpMsgRec == NULL)
- {
- CloseHandle(hObjHandle);
- MessageBox(0,
- "Could not map file",
- "Hook DLL",
- MB_OK);
- return;
- }
- }
-}
-
-void __fastcall UnMapFileMemory()
-{
- // Delete our process wide memory mapped variable
- if(lpMsgRec != NULL)
- {
- UnmapViewOfFile(lpMsgRec);
- lpMsgRec = NULL;
- }
-
- if(hObjHandle > 0)
- {
- CloseHandle(hObjHandle);
- hObjHandle = 0;
- }
-}
-
-PMSGREC __stdcall GetMsgRecPointer()
-{
- // Return a pointer to our process wide memory mapped variable
- return lpMsgRec;
-}
-
-
-UINT APIENTRY installHook(void) {
- if (!lpMsgRec) {
- return 0;
- }
-
- if(lpMsgRec->sysMsgFilter == NULL) {
- lpMsgRec->sysMsgFilter = SetWindowsHookEx(WH_CALLWNDPROC, (HOOKPROC)sysMsgFilter, hInst, 0);
- }
- return SG_TARGET_EVENT;
-}
-
-bool APIENTRY uninstallHook(void) {
- if (!lpMsgRec) {
- return false;
- }
- if(lpMsgRec->sysMsgFilter != NULL ) {
- if(UnhookWindowsHookEx(lpMsgRec->sysMsgFilter)) {
- lpMsgRec->sysMsgFilter = NULL;
- }
- }
- return (lpMsgRec->sysMsgFilter == NULL);
-}
-
-BOOL CALLBACK readControls(HWND hwnd, LPARAM userData) {
- char buf[65];
- memset(buf, 0, 65);
-
- GetClassName(hwnd, buf, 64);
- bool editControl = (!strcmp(buf, "Edit"));
- memset(buf, 0, 65);
- GetWindowText(hwnd, buf, 64);
-
- if (editControl) {
- if (lpMsgRec->controlNumber) {
- switch (lpMsgRec->controlNumber++) {
- case 8:
- // GetWindowText(hwnd, buf, 64);
- // lpMsgRec->personID = strtol(buf, 0, 10);
- // return false;
- break;
- default:
- break;
- }
- }
- // we're not to our controls yet, so just keep holding on to the last edit control cuz we need -1 once we hit our controls
- else {
- memset(lpMsgRec->lastEditValue, 0, 65);
- strncpy(lpMsgRec->lastEditValue, buf, 64);
- }
- }
- else if (!strcmp(buf, "Person ID:")) {
- lpMsgRec->controlNumber = 1;
- lpMsgRec->personID = strtol(lpMsgRec->lastEditValue, 0, 10);
- }
- return true;
-}
-
-
-
-LRESULT CALLBACK sysMsgFilter(int nCode, WPARAM wParam, LPARAM lParam) {
-
- CWPSTRUCT *msg = (CWPSTRUCT *)lParam;
- HWND hwnd = msg->hwnd;
- if (msg->message == 533) {
- char buf[65];
- memset(buf, 0, 65);
- GetWindowText(hwnd, buf, 64);
- if (!strcmp(buf, "&OK")) {
- if (hwnd) {
- HWND parent = GetParent(hwnd);
- if (hwnd) {
- hwnd = GetParent(parent);
- if (hwnd) {
- hwnd = GetParent(hwnd);
- if (hwnd) {
- hwnd = GetParent(hwnd);
- if (hwnd) {
- memset(buf, 0, 65);
- GetWindowText(hwnd, buf, 64);
- if (!strcmp(buf, "Add Personnel Record")) {
- lpMsgRec->controlNumber = 0;
- ::EnumChildWindows(parent, (WNDENUMPROC)readControls, 0L);
- PostMessage(HWND_BROADCAST, SG_TARGET_EVENT, msg->message, lpMsgRec->personID);
- }
- }
- }
- }
- }
- }
- }
- }
- return CallNextHookEx(lpMsgRec->sysMsgFilter, nCode, wParam, lParam);
-}
-
-int WINAPI DllEntryPoint(HINSTANCE hinst, unsigned long reason, void*)
-{
- hInst = hinst;
- switch(reason)
- {
- case DLL_PROCESS_ATTACH:
- hObjHandle = 0;
- lpMsgRec = NULL;
- MapFileMemory(sizeof(*lpMsgRec));
- break;
- case DLL_PROCESS_DETACH:
- UnMapFileMemory();
- break;
- }
- return 1;
-}
\ No newline at end of file
Copied: branches/1.6/addons/ccure/pre9000/ilsccureconnector/Unit1.cpp (from rev 1457, trunk/addons/ccure/pre9000/ilsccureconnector/Unit1.cpp)
===================================================================
--- branches/1.6/addons/ccure/pre9000/ilsccureconnector/Unit1.cpp (rev 0)
+++ branches/1.6/addons/ccure/pre9000/ilsccureconnector/Unit1.cpp 2016-05-09 23:15:45 UTC (rev 1458)
@@ -0,0 +1,217 @@
+//---------------------------------------------------------------------------
+#include <vcl.h>
+#include <windows.h>
+#include <SysUtils.hpp>
+#include "ilshook.h"
+
+#pragma argsused
+
+extern "C" {
+UINT SG_TARGET_EVENT=RegisterWindowMessage("SG_TARGET_EVENT");
+}
+
+typedef struct tagMSGREC {
+ HHOOK sysMsgFilter;
+ HINSTANCE hInst;
+ long personID; // EmployeeId
+ long controlNumber;
+ char lastEditValue[65];
+
+/*
+ char birthDate[25]; // Employer Tab - Birth_Date -> Password
+ char hireDate[25]; // Employer Tab - Hire_Date -> Hire Date
+ char text1[25]; // Text 1 (Company Name) -> ????
+ char firstName[40]; // Header - First Name -> First Name
+ char lastName[40]; // Header - Last Name -> Last Name
+ char addr1[40]; // Employer Tab - HOME_ADDRESS ->Address 1
+ char city[40]; // Employer Tab - CITY -> City/Providence
+ char state[5]Employer Tab - STATE -> State
+Employer Tab - ZIP_CODE -> Zip
+Employer Tab - HOME_PHONE -> Phone
+Text 14 ->Role
+*/
+
+} TMSGREC;
+
+typedef TMSGREC* PMSGREC;
+
+HINSTANCE hInst;
+HANDLE hObjHandle;
+PMSGREC lpMsgRec;
+
+void __fastcall MapFileMemory(DWORD dwAllocSize)
+{
+ // Create a process wide memory mapped variable
+ if(hObjHandle == NULL)
+ {
+ hObjHandle = CreateFileMapping((HANDLE)0xFFFFFFFF,
+ NULL,
+ PAGE_READWRITE,
+ 0,
+ dwAllocSize,
+ "HookRecMemBlock");
+
+ if(hObjHandle == NULL)
+ {
+ MessageBox(0,
+ "Could not create file map object",
+ "Hook DLL",
+ MB_OK);
+ return;
+ }
+ }
+
+ // Get a pointer to our process wide memory mapped variable
+ if(lpMsgRec == NULL)
+ {
+ lpMsgRec = (PMSGREC)MapViewOfFile(hObjHandle,
+ FILE_MAP_WRITE,
+ 0,
+ 0,
+ dwAllocSize);
+
+ if(lpMsgRec == NULL)
+ {
+ CloseHandle(hObjHandle);
+ MessageBox(0,
+ "Could not map file",
+ "Hook DLL",
+ MB_OK);
+ return;
+ }
+ }
+}
+
+void __fastcall UnMapFileMemory()
+{
+ // Delete our process wide memory mapped variable
+ if(lpMsgRec != NULL)
+ {
+ UnmapViewOfFile(lpMsgRec);
+ lpMsgRec = NULL;
+ }
+
+ if(hObjHandle > 0)
+ {
+ CloseHandle(hObjHandle);
+ hObjHandle = 0;
+ }
+}
+
+PMSGREC __stdcall GetMsgRecPointer()
+{
+ // Return a pointer to our process wide memory mapped variable
+ return lpMsgRec;
+}
+
+
+UINT APIENTRY installHook(void) {
+ if (!lpMsgRec) {
+ return 0;
+ }
+
+ if(lpMsgRec->sysMsgFilter == NULL) {
+ lpMsgRec->sysMsgFilter = SetWindowsHookEx(WH_CALLWNDPROC, (HOOKPROC)sysMsgFilter, hInst, 0);
+ }
+ return SG_TARGET_EVENT;
+}
+
+bool APIENTRY uninstallHook(void) {
+ if (!lpMsgRec) {
+ return false;
+ }
+ if(lpMsgRec->sysMsgFilter != NULL ) {
+ if(UnhookWindowsHookEx(lpMsgRec->sysMsgFilter)) {
+ lpMsgRec->sysMsgFilter = NULL;
+ }
+ }
+ return (lpMsgRec->sysMsgFilter == NULL);
+}
+
+BOOL CALLBACK readControls(HWND hwnd, LPARAM userData) {
+ char buf[65];
+ memset(buf, 0, 65);
+
+ GetClassName(hwnd, buf, 64);
+ bool editControl = (!strcmp(buf, "Edit"));
+ memset(buf, 0, 65);
+ GetWindowText(hwnd, buf, 64);
+
+ if (editControl) {
+ if (lpMsgRec->controlNumber) {
+ switch (lpMsgRec->controlNumber++) {
+ case 8:
+ // GetWindowText(hwnd, buf, 64);
+ // lpMsgRec->personID = strtol(buf, 0, 10);
+ // return false;
+ break;
+ default:
+ break;
+ }
+ }
+ // we're not to our controls yet, so just keep holding on to the last edit control cuz we need -1 once we hit our controls
+ else {
+ memset(lpMsgRec->lastEditValue, 0, 65);
+ strncpy(lpMsgRec->lastEditValue, buf, 64);
+ }
+ }
+ else if (!strcmp(buf, "Person ID:")) {
+ lpMsgRec->controlNumber = 1;
+ lpMsgRec->personID = strtol(lpMsgRec->lastEditValue, 0, 10);
+ }
+ return true;
+}
+
+
+
+LRESULT CALLBACK sysMsgFilter(int nCode, WPARAM wParam, LPARAM lParam) {
+
+ CWPSTRUCT *msg = (CWPSTRUCT *)lParam;
+ HWND hwnd = msg->hwnd;
+ if (msg->message == 533) {
+ char buf[65];
+ memset(buf, 0, 65);
+ GetWindowText(hwnd, buf, 64);
+ if (!strcmp(buf, "&OK")) {
+ if (hwnd) {
+ HWND parent = GetParent(hwnd);
+ if (hwnd) {
+ hwnd = GetParent(parent);
+ if (hwnd) {
+ hwnd = GetParent(hwnd);
+ if (hwnd) {
+ hwnd = GetParent(hwnd);
+ if (hwnd) {
+ memset(buf, 0, 65);
+ GetWindowText(hwnd, buf, 64);
+ if (!strcmp(buf, "Add Personnel Record")) {
+ lpMsgRec->controlNumber = 0;
+ ::EnumChildWindows(parent, (WNDENUMPROC)readControls, 0L);
+ PostMessage(HWND_BROADCAST, SG_TARGET_EVENT, msg->message, lpMsgRec->personID);
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ return CallNextHookEx(lpMsgRec->sysMsgFilter, nCode, wParam, lParam);
+}
+
+int WINAPI DllEntryPoint(HINSTANCE hinst, unsigned long reason, void*)
+{
+ hInst = hinst;
+ switch(reason)
+ {
+ case DLL_PROCESS_ATTACH:
+ hObjHandle = 0;
+ lpMsgRec = NULL;
+ MapFileMemory(sizeof(*lpMsgRec));
+ break;
+ case DLL_PROCESS_DETACH:
+ UnMapFileMemory();
+ break;
+ }
+ return 1;
+}
\ No newline at end of file
Deleted: branches/1.6/addons/ccure/pre9000/ilsccureconnector/Unit3.cpp
===================================================================
--- trunk/addons/ccure/pre9000/ilsccureconnector/Unit3.cpp 2016-05-09 23:12:32 UTC (rev 1457)
+++ branches/1.6/addons/ccure/pre9000/ilsccureconnector/Unit3.cpp 2016-05-09 23:15:45 UTC (rev 1458)
@@ -1,17 +0,0 @@
-//---------------------------------------------------------------------------
-
-#include <vcl.h>
-#pragma hdrstop
-
-#include "Unit3.h"
-//---------------------------------------------------------------------------
-#pragma package(smart_init)
-#pragma resource "*.dfm"
-TForm3 *Form3;
-//---------------------------------------------------------------------------
-__fastcall TForm3::TForm3(TComponent* Owner)
- : TForm(Owner)
-{
-}
-//---------------------------------------------------------------------------
-
Copied: branches/1.6/addons/ccure/pre9000/ilsccureconnector/Unit3.cpp (from rev 1457, trunk/addons/ccure/pre9000/ilsccureconnector/Unit3.cpp)
===================================================================
--- branches/1.6/addons/ccure/pre9000/ilsccureconnector/Unit3.cpp (rev 0)
+++ branches/1.6/addons/ccure/pre9000/ilsccureconnector/Unit3.cpp 2016-05-09 23:15:45 UTC (rev 1458)
@@ -0,0 +1,17 @@
+//---------------------------------------------------------------------------
+
+#include <vcl.h>
+#pragma hdrstop
+
+#include "Unit3.h"
+//---------------------------------------------------------------------------
+#pragma package(smart_init)
+#pragma resource "*.dfm"
+TForm3 *Form3;
+//---------------------------------------------------------------------------
+__fastcall TForm3::TForm3(TComponent* Owner)
+ : TForm(Owner)
+{
+}
+//---------------------------------------------------------------------------
+
Deleted: branches/1.6/addons/ccure/pre9000/ilsccureconnector/Unit3.dfm
===================================================================
--- trunk/addons/ccure/pre9000/ilsccureconnector/Unit3.dfm 2016-05-09 23:12:32 UTC (rev 1457)
+++ branches/1.6/addons/ccure/pre9000/ilsccureconnector/Unit3.dfm 2016-05-09 23:15:45 UTC (rev 1458)
@@ -1,48 +0,0 @@
-object Form3: TForm3
- Left = 248
- Top = 849
- Width = 260
- Height = 233
- Caption = 'Add Personnel Record'
- Color = clBtnFace
- Font.Charset = DEFAULT_CHARSET
- Font.Color = clWindowText
- Font.Height = -11
- Font.Name = 'MS Sans Serif'
- Font.Style = []
- OldCreateOrder = False
- PixelsPerInch = 96
- TextHeight = 13
- object Panel1: TPanel
- Left = 0
- Top = 0
- Width = 244
- Height = 195
- Align = alClient
- TabOrder = 0
- object Panel2: TPanel
- Left = 8
- Top = 16
- Width = 199
- Height = 148
- Anchors = [akLeft, akTop, akRight, akBottom]
- TabOrder = 0
- object Panel3: TPanel
- Left = 28
- Top = 24
- Width = 131
- Height = 96
- Anchors = [akLeft, akTop, akRight, akBottom]
- TabOrder = 0
- object Button1: TButton
- Left = 32
- Top = 32
- Width = 75
- Height = 25
- Caption = '&OK'
- TabOrder = 0
- end
- end
- end
- end
-end
Copied: branches/1.6/addons/ccure/pre9000/ilsccureconnector/Unit3.dfm (from rev 1457, trunk/addons/ccure/pre9000/ilsccureconnector/Unit3.dfm)
===================================================================
--- branches/1.6/addons/ccure/pre9000/ilsccureconnector/Unit3.dfm (rev 0)
+++ branches/1.6/addons/ccure/pre9000/ilsccureconnector/Unit3.dfm 2016-05-09 23:15:45 UTC (rev 1458)
@@ -0,0 +1,48 @@
+object Form3: TForm3
+ Left = 248
+ Top = 849
+ Width = 260
+ Height = 233
+ Caption = 'Add Personnel Record'
+ Color = clBtnFace
+ Font.Charset = DEFAULT_CHARSET
+ Font.Color = clWindowText
+ Font.Height = -11
+ Font.Name = 'MS Sans Serif'
+ Font.Style = []
+ OldCreateOrder = False
+ PixelsPerInch = 96
+ TextHeight = 13
+ object Panel1: TPanel
+ Left = 0
+ Top = 0
+ Width = 244
+ Height = 195
+ Align = alClient
+ TabOrder = 0
+ object Panel2: TPanel
+ Left = 8
+ Top = 16
+ Width = 199
+ Height = 148
+ Anchors = [akLeft, akTop, akRight, akBottom]
+ TabOrder = 0
+ object Panel3: TPanel
+ Left = 28
+ Top = 24
+ Width = 131
+ Height = 96
+ Anchors = [akLeft, akTop, akRight, akBottom]
+ TabOrder = 0
+ object Button1: TButton
+ Left = 32
+ Top = 32
+ Width = 75
+ Height = 25
+ Caption = '&OK'
+ TabOrder = 0
+ end
+ end
+ end
+ end
+end
Deleted: branches/1.6/addons/ccure/pre9000/ilsccureconnector/Unit3.h
===================================================================
--- trunk/addons/ccure/pre9000/ilsccureconnector/Unit3.h 2016-05-09 23:12:32 UTC (rev 1457)
+++ branches/1.6/addons/ccure/pre9000/ilsccureconnector/Unit3.h 2016-05-09 23:15:45 UTC (rev 1458)
@@ -1,26 +0,0 @@
-//---------------------------------------------------------------------------
-
-#ifndef Unit3H
-#define Unit3H
-//---------------------------------------------------------------------------
-#include <Classes.hpp>
-#include <Controls.hpp>
-#include <StdCtrls.hpp>
-#include <Forms.hpp>
-#include <ExtCtrls.hpp>
-//---------------------------------------------------------------------------
-class TForm3 : public TForm
-{
-__published: // IDE-managed Components
- TPanel *Panel1;
- TPanel *Panel2;
- TPanel *Panel3;
- TButton *Button1;
-private: // User declarations
-public: // User declarations
- __fastcall TForm3(TComponent* Owner);
-};
-//---------------------------------------------------------------------------
-extern PACKAGE TForm3 *Form3;
-//---------------------------------------------------------------------------
-#endif
Copied: branches/1.6/addons/ccure/pre9000/ilsccureconnector/Unit3.h (from rev 1457, trunk/addons/ccure/pre9000/ilsccureconnector/Unit3.h)
===================================================================
--- branches/1.6/addons/ccure/pre9000/ilsccureconnector/Unit3.h (rev 0)
+++ branches/1.6/addons/ccure/pre9000/ilsccureconnector/Unit3.h 2016-05-09 23:15:45 UTC (rev 1458)
@@ -0,0 +1,26 @@
+//---------------------------------------------------------------------------
+
+#ifndef Unit3H
+#define Unit3H
+//---------------------------------------------------------------------------
+#include <Classes.hpp>
+#include <Controls.hpp>
+#include <StdCtrls.hpp>
+#include <Forms.hpp>
+#include <ExtCtrls.hpp>
+//---------------------------------------------------------------------------
+class TForm3 : public TForm
+{
+__published: // IDE-managed Components
+ TPanel *Panel1;
+ TPanel *Panel2;
+ TPanel *Panel3;
+ TButton *Button1;
+private: // User declarations
+public: // User declarations
+ __fastcall TForm3(TComponent* Owner);
+};
+//---------------------------------------------------------------------------
+extern PACKAGE TForm3 *Form3;
+//---------------------------------------------------------------------------
+#endif
Deleted: branches/1.6/addons/ccure/pre9000/ilsccureconnector/defs.h
===================================================================
--- trunk/addons/ccure/pre9000/ilsccureconnector/defs.h 2016-05-09 23:12:32 UTC (rev 1457)
+++ branches/1.6/addons/ccure/pre9000/ilsccureconnector/defs.h 2016-05-09 23:15:45 UTC (rev 1458)
@@ -1,116 +0,0 @@
-// ----------------------------------------------------------------------------
-// Making or using sword as a Windows DLL
-// ----------------------------------------------------------------------------
-#ifndef SWORDDEFS_H
-#define SWORDDEFS_H
-
-#ifdef NO_SWORD_NAMESPACE
- #define SWORD_NAMESPACE_START namespace sword {
- #define SWORD_NAMESPACE_END }; using namespace sword;
-#else
- #define SWORD_NAMESPACE_START namespace sword {
- #define SWORD_NAMESPACE_END }
-#endif
-
-SWORD_NAMESPACE_START
-
-#define SWTRY try
-#define SWCATCH(x) catch (x)
-
-#ifdef _WIN32_WCE
-#define SWTRY
-#define SWCATCH(x) if (0)
-#define GLOBCONFPATH "/Program Files/sword/sword.conf"
-#endif
-
-#ifdef ANDROID
-#define _NO_IOSTREAM_
-#undef SWTRY
-#undef SWCATCH
-#define SWTRY
-#define SWCATCH(x) if (0)
-#endif
-
-// _declspec works in BC++ 5 and later, as well as VC++
-#if defined(_MSC_VER)
-
-# ifdef SWMAKINGDLL
-# define SWDLLEXPORT _declspec( dllexport )
-# define SWDLLEXPORT_DATA(type) _declspec( dllexport ) type
-# define SWDLLEXPORT_CTORFN
-# elif defined(SWUSINGDLL)
-# define SWDLLEXPORT _declspec( dllimport )
-# define SWDLLEXPORT_DATA(type) _declspec( dllimport ) type
-# define SWDLLEXPORT_CTORFN
-# else
-# define SWDLLEXPORT
-# define SWDLLEXPORT_DATA(type) type
-# define SWDLLEXPORT_CTORFN
-# endif
-
-#elif defined(__SWPM__)
-
-# ifdef SWMAKINGDLL
-# define SWDLLEXPORT _Export
-# define SWDLLEXPORT_DATA(type) _Export type
-# define SWDLLEXPORT_CTORFN
-# elif defined(SWUSINGDLL)
-# define SWDLLEXPORT _Export
-# define SWDLLEXPORT_DATA(type) _Export type
-# define SWDLLEXPORT_CTORFN
-# else
-# define SWDLLEXPORT
-# define SWDLLEXPORT_DATA(type) type
-# define SWDLLEXPORT_CTORFN
-# endif
-
-#elif defined(__GNUWIN32__)
-
-# ifdef SWMAKINGDLL
-# define SWDLLEXPORT __declspec( dllexport )
-# define SWDLLEXPORT_DATA(type) __declspec( dllexport ) type
-# define SWDLLEXPORT_CTORFN
-# elif defined(SWUSINGDLL)
-# define SWDLLEXPORT __declspec( dllimport )
-# define SWDLLEXPORT_DATA(type) __declspec( dllimport ) type
-# define SWDLLEXPORT_CTORFN
-# else
-# define SWDLLEXPORT
-# define SWDLLEXPORT_DATA(type) type
-# define SWDLLEXPORT_CTORFN
-# endif
-
-#elif defined(__BORLANDC__)
-# ifdef SWMAKINGDLL
-# define SWDLLEXPORT _export
-# define SWDLLEXPORT_DATA(type) __declspec( dllexport ) type
-# define SWDLLEXPORT_CTORFN
-# elif defined(SWUSINGDLL)
-# define SWDLLEXPORT __declspec( dllimport )
-# define SWDLLEXPORT_DATA(type) __declspec( dllimport ) type
-# define SWDLLEXPORT_CTORFN
-# else
-# define SWDLLEXPORT
-# define SWDLLEXPORT_DATA(type) type
-# define SWDLLEXPORT_CTORFN
-# endif
-
-#else
-# define SWDLLEXPORT
-# define SWDLLEXPORT_DATA(type) type
-# define SWDLLEXPORT_CTORFN
-#endif
-
-// For ostream, istream ofstream
-#if defined(__BORLANDC__) && defined( _RTLDLL )
-# define SWDLLIMPORT __import
-#else
-# define SWDLLIMPORT
-#endif
-
-enum {DIRECTION_LTR = 0, DIRECTION_RTL, DIRECTION_BIDI};
-enum {FMT_UNKNOWN = 0, FMT_PLAIN, FMT_THML, FMT_GBF, FMT_HTML, FMT_HTMLHREF, FMT_RTF, FMT_OSIS, FMT_WEBIF, FMT_TEI, FMT_XHTML};
-enum {ENC_UNKNOWN = 0, ENC_LATIN1, ENC_UTF8, ENC_UTF16, ENC_RTF, ENC_HTML};
-
-SWORD_NAMESPACE_END
-#endif //SWORDDEFS_H
Copied: branches/1.6/addons/ccure/pre9000/ilsccureconnector/defs.h (from rev 1457, trunk/addons/ccure/pre9000/ilsccureconnector/defs.h)
===================================================================
--- branches/1.6/addons/ccure/pre9000/ilsccureconnector/defs.h (rev 0)
+++ branches/1.6/addons/ccure/pre9000/ilsccureconnector/defs.h 2016-05-09 23:15:45 UTC (rev 1458)
@@ -0,0 +1,116 @@
+// ----------------------------------------------------------------------------
+// Making or using sword as a Windows DLL
+// ----------------------------------------------------------------------------
+#ifndef SWORDDEFS_H
+#define SWORDDEFS_H
+
+#ifdef NO_SWORD_NAMESPACE
+ #define SWORD_NAMESPACE_START namespace sword {
+ #define SWORD_NAMESPACE_END }; using namespace sword;
+#else
+ #define SWORD_NAMESPACE_START namespace sword {
+ #define SWORD_NAMESPACE_END }
+#endif
+
+SWORD_NAMESPACE_START
+
+#define SWTRY try
+#define SWCATCH(x) catch (x)
+
+#ifdef _WIN32_WCE
+#define SWTRY
+#define SWCATCH(x) if (0)
+#define GLOBCONFPATH "/Program Files/sword/sword.conf"
+#endif
+
+#ifdef ANDROID
+#define _NO_IOSTREAM_
+#undef SWTRY
+#undef SWCATCH
+#define SWTRY
+#define SWCATCH(x) if (0)
+#endif
+
+// _declspec works in BC++ 5 and later, as well as VC++
+#if defined(_MSC_VER)
+
+# ifdef SWMAKINGDLL
+# define SWDLLEXPORT _declspec( dllexport )
+# define SWDLLEXPORT_DATA(type) _declspec( dllexport ) type
+# define SWDLLEXPORT_CTORFN
+# elif defined(SWUSINGDLL)
+# define SWDLLEXPORT _declspec( dllimport )
+# define SWDLLEXPORT_DATA(type) _declspec( dllimport ) type
+# define SWDLLEXPORT_CTORFN
+# else
+# define SWDLLEXPORT
+# define SWDLLEXPORT_DATA(type) type
+# define SWDLLEXPORT_CTORFN
+# endif
+
+#elif defined(__SWPM__)
+
+# ifdef SWMAKINGDLL
+# define SWDLLEXPORT _Export
+# define SWDLLEXPORT_DATA(type) _Export type
+# define SWDLLEXPORT_CTORFN
+# elif defined(SWUSINGDLL)
+# define SWDLLEXPORT _Export
+# define SWDLLEXPORT_DATA(type) _Export type
+# define SWDLLEXPORT_CTORFN
+# else
+# define SWDLLEXPORT
+# define SWDLLEXPORT_DATA(type) type
+# define SWDLLEXPORT_CTORFN
+# endif
+
+#elif defined(__GNUWIN32__)
+
+# ifdef SWMAKINGDLL
+# define SWDLLEXPORT __declspec( dllexport )
+# define SWDLLEXPORT_DATA(type) __declspec( dllexport ) type
+# define SWDLLEXPORT_CTORFN
+# elif defined(SWUSINGDLL)
+# define SWDLLEXPORT __declspec( dllimport )
+# define SWDLLEXPORT_DATA(type) __declspec( dllimport ) type
+# define SWDLLEXPORT_CTORFN
+# else
+# define SWDLLEXPORT
+# define SWDLLEXPORT_DATA(type) type
+# define SWDLLEXPORT_CTORFN
+# endif
+
+#elif defined(__BORLANDC__)
+# ifdef SWMAKINGDLL
+# define SWDLLEXPORT _export
+# define SWDLLEXPORT_DATA(type) __declspec( dllexport ) type
+# define SWDLLEXPORT_CTORFN
+# elif defined(SWUSINGDLL)
+# define SWDLLEXPORT __declspec( dllimport )
+# define SWDLLEXPORT_DATA(type) __declspec( dllimport ) type
+# define SWDLLEXPORT_CTORFN
+# else
+# define SWDLLEXPORT
+# define SWDLLEXPORT_DATA(type) type
+# define SWDLLEXPORT_CTORFN
+# endif
+
+#else
+# define SWDLLEXPORT
+# define SWDLLEXPORT_DATA(type) type
+# define SWDLLEXPORT_CTORFN
+#endif
+
+// For ostream, istream ofstream
+#if defined(__BORLANDC__) && defined( _RTLDLL )
+# define SWDLLIMPORT __import
+#else
+# define SWDLLIMPORT
+#endif
+
+enum {DIRECTION_LTR = 0, DIRECTION_RTL, DIRECTION_BIDI};
+enum {FMT_UNKNOWN = 0, FMT_PLAIN, FMT_THML, FMT_GBF, FMT_HTML, FMT_HTMLHREF, FMT_RTF, FMT_OSIS, FMT_WEBIF, FMT_TEI, FMT_XHTML};
+enum {ENC_UNKNOWN = 0, ENC_LATIN1, ENC_UTF8, ENC_UTF16, ENC_RTF, ENC_HTML};
+
+SWORD_NAMESPACE_END
+#endif //SWORDDEFS_H
Deleted: branches/1.6/addons/ccure/pre9000/ilsccureconnector/filemgr.cpp
===================================================================
--- trunk/addons/ccure/pre9000/ilsccureconnector/filemgr.cpp 2016-05-09 23:12:32 UTC (rev 1457)
+++ branches/1.6/addons/ccure/pre9000/ilsccureconnector/filemgr.cpp 2016-05-09 23:15:45 UTC (rev 1458)
@@ -1,581 +0,0 @@
-/******************************************************************************
- * filemgr.cpp - implementation of class FileMgr used for pooling file
- * handles
- *
- * $Id: filemgr.cpp 2643 2011-07-18 11:23:26Z scribe $
- *
- * Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
- * CrossWire Bible Society
- * P. O. Box 2528
- * Tempe, AZ 85280-2528
- *
- * 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 version 2.
- *
- * 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.
- *
- */
-
-#include "filemgr.h"
-#include "utilstr.h"
-
-#include <dirent.h>
-#include <fcntl.h>
-#include <sys/stat.h>
-#include <sys/types.h>
-#include <stdio.h>
-#include <string.h>
-#include "swbuf.h"
-#if !defined(__GNUC__) && !defined(_WIN32_WCE)
-#include <io.h>
-#include <direct.h>
-#else
-#include <unistd.h>
-#endif
-
-
-#ifndef O_BINARY
-#define O_BINARY 0
-#endif
-
-#ifndef S_IRGRP
-#define S_IRGRP 0
-#endif
-
-#ifndef S_IROTH
-#define S_IROTH 0
-#endif
-
-// Fix for VC6
-#ifndef S_IREAD
-#ifdef _S_IREAD
-#define S_IREAD _S_IREAD
-#define S_IWRITE _S_IWRITE
-#endif
-#endif
-// -----------
-
-// ------- if we still don't have something
-#ifndef S_IREAD
-#define S_IREAD 0400
-#endif
-#ifndef S_IWRITE
-#define S_IWRITE 0200
-#endif
-// -------
-
-
-SWORD_NAMESPACE_START
-
-
-int FileMgr::CREAT = O_CREAT;
-int FileMgr::APPEND = O_APPEND;
-int FileMgr::TRUNC = O_TRUNC;
-int FileMgr::RDONLY = O_RDONLY;
-int FileMgr::RDWR = O_RDWR;
-int FileMgr::WRONLY = O_WRONLY;
-int FileMgr::IREAD = S_IREAD;
-int FileMgr::IWRITE = S_IWRITE;
-
-
-// ---------------- statics -----------------
-FileMgr *FileMgr::systemFileMgr = 0;
-
-class __staticsystemFileMgr {
-public:
- __staticsystemFileMgr() { }
- ~__staticsystemFileMgr() { delete FileMgr::systemFileMgr; }
-} _staticsystemFileMgr;
-
-
-FileMgr *FileMgr::getSystemFileMgr() {
- if (!systemFileMgr)
- systemFileMgr = new FileMgr();
-
- return systemFileMgr;
-}
-
-
-void FileMgr::setSystemFileMgr(FileMgr *newFileMgr) {
- if (systemFileMgr)
- delete systemFileMgr;
- systemFileMgr = newFileMgr;
-}
-
-// --------------- end statics --------------
-
-
-FileDesc::FileDesc(FileMgr *parent, const char *path, int mode, int perms, bool tryDowngrade) {
- this->parent = parent;
- this->path = 0;
- stdstr(&this->path, path);
- this->mode = mode;
- this->perms = perms;
- this->tryDowngrade = tryDowngrade;
- offset = 0;
- fd = -77;
-}
-
-
-FileDesc::~FileDesc() {
- if (fd > 0)
- close(fd);
-
- if (path)
- delete [] path;
-}
-
-
-int FileDesc::getFd() {
- if (fd == -77)
- fd = parent->sysOpen(this);
-// if ((fd < -1) && (fd != -77)) // kludge to hand ce
-// return 777;
- return fd;
-}
-
-
-long FileDesc::seek(long offset, int whence) {
- return lseek(getFd(), offset, whence);
-}
-
-
-long FileDesc::read(void *buf, long count) {
- return ::read(getFd(), buf, count);
-}
-
-
-long FileDesc::write(const void *buf, long count) {
- return ::write(getFd(), buf, count);
-}
-
-
-FileMgr::FileMgr(int maxFiles) {
- this->maxFiles = maxFiles; // must be at least 2
- files = 0;
-}
-
-
-FileMgr::~FileMgr() {
- FileDesc *tmp;
-
- while(files) {
- tmp = files->next;
- delete files;
- files = tmp;
- }
-}
-
-
-FileDesc *FileMgr::open(const char *path, int mode, bool tryDowngrade) {
- return open(path, mode, S_IREAD|S_IWRITE|S_IRGRP|S_IROTH, tryDowngrade);
-}
-
-
-FileDesc *FileMgr::open(const char *path, int mode, int perms, bool tryDowngrade) {
- FileDesc **tmp, *tmp2;
-
- for (tmp = &files; *tmp; tmp = &((*tmp)->next)) {
- if ((*tmp)->fd < 0) // insert as first non-system_open file
- break;
- }
-
- tmp2 = new FileDesc(this, path, mode, perms, tryDowngrade);
- tmp2->next = *tmp;
- *tmp = tmp2;
-
- return tmp2;
-}
-
-
-void FileMgr::close(FileDesc *file) {
- FileDesc **loop;
-
- for (loop = &files; *loop; loop = &((*loop)->next)) {
- if (*loop == file) {
- *loop = (*loop)->next;
- delete file;
- break;
- }
- }
-}
-
-
-int FileMgr::sysOpen(FileDesc *file) {
- FileDesc **loop;
- int openCount = 1; // because we are presently opening 1 file, and we need to be sure to close files to accomodate, if necessary
-
- for (loop = &files; *loop; loop = &((*loop)->next)) {
-
- if ((*loop)->fd > 0) {
- if (++openCount > maxFiles) {
- (*loop)->offset = lseek((*loop)->fd, 0, SEEK_CUR);
- ::close((*loop)->fd);
- (*loop)->fd = -77;
- }
- }
-
- if (*loop == file) {
- if (*loop != files) {
- *loop = (*loop)->next;
- file->next = files;
- files = file;
- }
- if ((!access(file->path, 04)) || ((file->mode & O_CREAT) == O_CREAT)) { // check for at least file exists / read access before we try to open
- char tries = (((file->mode & O_RDWR) == O_RDWR) && (file->tryDowngrade)) ? 2 : 1; // try read/write if possible
- for (int i = 0; i < tries; i++) {
- if (i > 0) {
- file->mode = (file->mode & ~O_RDWR); // remove write access
- file->mode = (file->mode | O_RDONLY);// add read access
- }
- file->fd = ::open(file->path, file->mode|O_BINARY, file->perms);
-
- if (file->fd >= 0)
- break;
- }
-
- if (file->fd >= 0)
- lseek(file->fd, file->offset, SEEK_SET);
- }
- else file->fd = -1;
- if (!*loop)
- break;
- }
- }
- return file->fd;
-}
-
-
-// to truncate a file at its current position
-// leaving byte at current possition intact
-// deleting everything afterward.
-signed char FileMgr::trunc(FileDesc *file) {
-
- static const char *writeTest = "x";
- long size = file->seek(1, SEEK_CUR);
- if (size == 1) // was empty
- size = 0;
- char nibble [ 32767 ];
- bool writable = file->write(writeTest, 1);
- int bytes = 0;
-
- if (writable) {
- // get tmpfilename
- char *buf = new char [ strlen(file->path) + 10 ];
- int i;
- for (i = 0; i < 9999; i++) {
- sprintf(buf, "%stmp%.4d", file->path, i);
- if (!existsFile(buf))
- break;
- }
- if (i == 9999)
- return -2;
-
- int fd = ::open(buf, O_CREAT|O_RDWR, S_IREAD|S_IWRITE|S_IRGRP|S_IROTH);
- if (fd < 0)
- return -3;
-
- file->seek(0, SEEK_SET);
- while (size > 0) {
- bytes = file->read(nibble, 32767);
- bytes = (bytes < size)?bytes:size;
- if (write(fd, nibble, bytes) != bytes) { break; }
- size -= bytes;
- }
- if (size < 1) {
- // zero out the file
- ::close(file->fd);
- file->fd = ::open(file->path, O_TRUNC, S_IREAD|S_IWRITE|S_IRGRP|S_IROTH);
- ::close(file->fd);
- file->fd = -77; // force file open by filemgr
- // copy tmp file back (dumb, but must preserve file permissions)
- lseek(fd, 0, SEEK_SET);
- do {
- bytes = read(fd, nibble, 32767);
- file->write(nibble, bytes);
- } while (bytes == 32767);
- }
-
- ::close(fd);
- ::close(file->fd);
- removeFile(buf); // remove our tmp file
- file->fd = -77; // causes file to be swapped out forcing open on next call to getFd()
- }
- else { // put offset back and return failure
- file->seek(-1, SEEK_CUR);
- return -1;
- }
- return 0;
-}
-
-
-signed char FileMgr::existsFile(const char *ipath, const char *ifileName)
-{
- int len = strlen(ipath) + ((ifileName)?strlen(ifileName):0) + 3;
- char *ch;
- char *path = new char [ len ];
- strcpy(path, ipath);
-
- if ((path[strlen(path)-1] == '\\') || (path[strlen(path)-1] == '/'))
- path[strlen(path)-1] = 0;
-
- if (ifileName) {
- ch = path + strlen(path);
- sprintf(ch, "/%s", ifileName);
- }
- signed char retVal = !access(path, 04);
- delete [] path;
- return retVal;
-}
-
-
-signed char FileMgr::existsDir(const char *ipath, const char *idirName)
-{
- char *ch;
- int len = strlen(ipath) + ((idirName)?strlen(idirName):0) + 1;
- if (idirName)
- len += strlen(idirName);
- char *path = new char [ len ];
- strcpy(path, ipath);
-
- if ((path[strlen(path)-1] == '\\') || (path[strlen(path)-1] == '/'))
- path[strlen(path)-1] = 0;
-
- if (idirName) {
- ch = path + strlen(path);
- sprintf(ch, "/%s", idirName);
- }
- signed char retVal = !access(path, 04);
- delete [] path;
- return retVal;
-}
-
-
-int FileMgr::createParent(const char *pName) {
- char *buf = new char [ strlen(pName) + 1 ];
- int retCode = 0;
-
- strcpy(buf, pName);
- int end = strlen(buf) - 1;
- while (end) {
- if ((buf[end] == '/') || (buf[end] == '\\'))
- break;
- end--;
- }
- buf[end] = 0;
- if (strlen(buf)>0) {
- if (access(buf, 02)) { // not exists with write access?
- if ((retCode = mkdir(buf
-#ifndef WIN32
- , 0755
-#endif
- ))) {
- createParent(buf);
- retCode = mkdir(buf
-#ifndef WIN32
- , 0755
-#endif
- );
- }
- }
- }
- else retCode = -1;
- delete [] buf;
- return retCode;
-}
-
-
-int FileMgr::openFileReadOnly(const char *fName) {
- int fd = ::open(fName, O_RDONLY|O_BINARY, S_IREAD|S_IWRITE|S_IRGRP|S_IROTH);
- return fd;
-}
-
-
-int FileMgr::createPathAndFile(const char *fName) {
- int fd;
-
- fd = ::open(fName, O_CREAT|O_WRONLY|O_BINARY, S_IREAD|S_IWRITE|S_IRGRP|S_IROTH);
- if (fd < 1) {
- createParent(fName);
- fd = ::open(fName, O_CREAT|O_WRONLY|O_BINARY, S_IREAD|S_IWRITE|S_IRGRP|S_IROTH);
- }
- return fd;
-}
-
-
-int FileMgr::copyFile(const char *sourceFile, const char *targetFile) {
- int sfd, dfd, len;
- char buf[4096];
-
- if ((sfd = ::open(sourceFile, O_RDONLY|O_BINARY, S_IREAD|S_IWRITE|S_IRGRP|S_IROTH)) < 1)
- return -1;
- if ((dfd = createPathAndFile(targetFile)) < 1)
- return -1;
-
- do {
- len = read(sfd, buf, 4096);
- if (write(dfd, buf, len) != len) break;
- }
- while(len == 4096);
- ::close(dfd);
- ::close(sfd);
-
- return 0;
-}
-
-
-int FileMgr::removeFile(const char *fName) {
- return ::remove(fName);
-}
-
-char FileMgr::getLine(FileDesc *fDesc, SWBuf &line) {
- int len;
- bool more = true;
- char chunk[255];
-
- line = "";
-
- // assert we have a valid file handle
- if (fDesc->getFd() < 1)
- return 0;
-
- while (more) {
- more = false;
- long index = fDesc->seek(0, SEEK_CUR);
- len = fDesc->read(chunk, 254);
-
- // assert we have a readable file (not a directory)
- if (len < 1)
- break;
-
- int start = 0;
- // clean up any preceding white space if we're at the beginning of line
- if (!line.length()) {
- for (;start < len; start++) {
- if ((chunk[start] != 13) && (chunk[start] != ' ') && (chunk[start] != '\t'))
- break;
- }
- }
-
- // find the end
- int end;
- for (end = start; ((end < (len-1)) && (chunk[end] != 10)); end++);
-
- if ((chunk[end] != 10) && (len == 254)) {
- more = true;
- }
- index += (end + 1);
-
- // reposition to next valid place to read
- fDesc->seek(index, SEEK_SET);
-
- // clean up any trailing junk on line if we're at the end
- if (!more) {
- for (; end > start; end--) {
- if ((chunk[end] != 10) && (chunk[end] != 13) && (chunk[end] != ' ') && (chunk[end] != '\t')) {
- if (chunk[end] == '\\') {
- more = true;
- end--;
- }
- break;
- }
- }
- }
-
- int size = (end - start) + 1;
-
- if (size > 0) {
- // line.appendFormatted("%.*s", size, chunk+start);
- line.append(chunk+start, size);
- }
- }
- return ((len > 0) || line.length());
-}
-
-
-char FileMgr::isDirectory(const char *path) {
- struct stat stats;
- if (stat(path, &stats))
- return 0;
- return ((stats.st_mode & S_IFDIR) == S_IFDIR);
-}
-
-
-int FileMgr::copyDir(const char *srcDir, const char *destDir) {
- DIR *dir;
- struct dirent *ent;
- if ((dir = opendir(srcDir))) {
- rewinddir(dir);
- while ((ent = readdir(dir))) {
- if ((strcmp(ent->d_name, ".")) && (strcmp(ent->d_name, ".."))) {
- SWBuf srcPath = (SWBuf)srcDir + (SWBuf)"/" + ent->d_name;
- SWBuf destPath = (SWBuf)destDir + (SWBuf)"/" + ent->d_name;
- if (!isDirectory(srcPath.c_str())) {
- copyFile(srcPath.c_str(), destPath.c_str());
- }
- else {
- copyDir(srcPath.c_str(), destPath.c_str());
- }
- }
- }
- closedir(dir);
- }
- return 0;
-}
-
-
-int FileMgr::removeDir(const char *targetDir) {
- DIR *dir = opendir(targetDir);
- struct dirent *ent;
- if (dir) {
- rewinddir(dir);
- while ((ent = readdir(dir))) {
- if ((strcmp(ent->d_name, ".")) && (strcmp(ent->d_name, ".."))) {
- SWBuf targetPath = (SWBuf)targetDir + (SWBuf)"/" + ent->d_name;
- if (!isDirectory(targetPath.c_str())) {
- FileMgr::removeFile(targetPath.c_str());
- }
- else {
- FileMgr::removeDir(targetPath.c_str());
- }
- }
- }
- closedir(dir);
- int status = FileMgr::removeFile(targetDir);
- int stuff = errno;
- char *err = strerror(errno);
- int x = stuff;
- }
- return 0;
-}
-
-
-void FileMgr::flush() {
- FileDesc **loop;
-
- for (loop = &files; *loop; loop = &((*loop)->next)) {
- if ((*loop)->fd > 0) {
- (*loop)->offset = lseek((*loop)->fd, 0, SEEK_CUR);
- ::close((*loop)->fd);
- (*loop)->fd = -77;
- }
- }
-}
-
-long FileMgr::resourceConsumption() {
- long count = 0;
- FileDesc **loop;
- for (loop = &files; *loop; loop = &((*loop)->next)) {
- if ((*loop)->fd > 0) {
- count++;
- }
- }
- return count;
-}
-
-
-SWORD_NAMESPACE_END
Copied: branches/1.6/addons/ccure/pre9000/ilsccureconnector/filemgr.cpp (from rev 1457, trunk/addons/ccure/pre9000/ilsccureconnector/filemgr.cpp)
===================================================================
--- branches/1.6/addons/ccure/pre9000/ilsccureconnector/filemgr.cpp (rev 0)
+++ branches/1.6/addons/ccure/pre9000/ilsccureconnector/filemgr.cpp 2016-05-09 23:15:45 UTC (rev 1458)
@@ -0,0 +1,581 @@
+/******************************************************************************
+ * filemgr.cpp - implementation of class FileMgr used for pooling file
+ * handles
+ *
+ * $Id: filemgr.cpp 2643 2011-07-18 11:23:26Z scribe $
+ *
+ * Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
+ * CrossWire Bible Society
+ * P. O. Box 2528
+ * Tempe, AZ 85280-2528
+ *
+ * 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 version 2.
+ *
+ * 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.
+ *
+ */
+
+#include "filemgr.h"
+#include "utilstr.h"
+
+#include <dirent.h>
+#include <fcntl.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+#include <stdio.h>
+#include <string.h>
+#include "swbuf.h"
+#if !defined(__GNUC__) && !defined(_WIN32_WCE)
+#include <io.h>
+#include <direct.h>
+#else
+#include <unistd.h>
+#endif
+
+
+#ifndef O_BINARY
+#define O_BINARY 0
+#endif
+
+#ifndef S_IRGRP
+#define S_IRGRP 0
+#endif
+
+#ifndef S_IROTH
+#define S_IROTH 0
+#endif
+
+// Fix for VC6
+#ifndef S_IREAD
+#ifdef _S_IREAD
+#define S_IREAD _S_IREAD
+#define S_IWRITE _S_IWRITE
+#endif
+#endif
+// -----------
+
+// ------- if we still don't have something
+#ifndef S_IREAD
+#define S_IREAD 0400
+#endif
+#ifndef S_IWRITE
+#define S_IWRITE 0200
+#endif
+// -------
+
+
+SWORD_NAMESPACE_START
+
+
+int FileMgr::CREAT = O_CREAT;
+int FileMgr::APPEND = O_APPEND;
+int FileMgr::TRUNC = O_TRUNC;
+int FileMgr::RDONLY = O_RDONLY;
+int FileMgr::RDWR = O_RDWR;
+int FileMgr::WRONLY = O_WRONLY;
+int FileMgr::IREAD = S_IREAD;
+int FileMgr::IWRITE = S_IWRITE;
+
+
+// ---------------- statics -----------------
+FileMgr *FileMgr::systemFileMgr = 0;
+
+class __staticsystemFileMgr {
+public:
+ __staticsystemFileMgr() { }
+ ~__staticsystemFileMgr() { delete FileMgr::systemFileMgr; }
+} _staticsystemFileMgr;
+
+
+FileMgr *FileMgr::getSystemFileMgr() {
+ if (!systemFileMgr)
+ systemFileMgr = new FileMgr();
+
+ return systemFileMgr;
+}
+
+
+void FileMgr::setSystemFileMgr(FileMgr *newFileMgr) {
+ if (systemFileMgr)
+ delete systemFileMgr;
+ systemFileMgr = newFileMgr;
+}
+
+// --------------- end statics --------------
+
+
+FileDesc::FileDesc(FileMgr *parent, const char *path, int mode, int perms, bool tryDowngrade) {
+ this->parent = parent;
+ this->path = 0;
+ stdstr(&this->path, path);
+ this->mode = mode;
+ this->perms = perms;
+ this->tryDowngrade = tryDowngrade;
+ offset = 0;
+ fd = -77;
+}
+
+
+FileDesc::~FileDesc() {
+ if (fd > 0)
+ close(fd);
+
+ if (path)
+ delete [] path;
+}
+
+
+int FileDesc::getFd() {
+ if (fd == -77)
+ fd = parent->sysOpen(this);
+// if ((fd < -1) && (fd != -77)) // kludge to hand ce
+// return 777;
+ return fd;
+}
+
+
+long FileDesc::seek(long offset, int whence) {
+ return lseek(getFd(), offset, whence);
+}
+
+
+long FileDesc::read(void *buf, long count) {
+ return ::read(getFd(), buf, count);
+}
+
+
+long FileDesc::write(const void *buf, long count) {
+ return ::write(getFd(), buf, count);
+}
+
+
+FileMgr::FileMgr(int maxFiles) {
+ this->maxFiles = maxFiles; // must be at least 2
+ files = 0;
+}
+
+
+FileMgr::~FileMgr() {
+ FileDesc *tmp;
+
+ while(files) {
+ tmp = files->next;
+ delete files;
+ files = tmp;
+ }
+}
+
+
+FileDesc *FileMgr::open(const char *path, int mode, bool tryDowngrade) {
+ return open(path, mode, S_IREAD|S_IWRITE|S_IRGRP|S_IROTH, tryDowngrade);
+}
+
+
+FileDesc *FileMgr::open(const char *path, int mode, int perms, bool tryDowngrade) {
+ FileDesc **tmp, *tmp2;
+
+ for (tmp = &files; *tmp; tmp = &((*tmp)->next)) {
+ if ((*tmp)->fd < 0) // insert as first non-system_open file
+ break;
+ }
+
+ tmp2 = new FileDesc(this, path, mode, perms, tryDowngrade);
+ tmp2->next = *tmp;
+ *tmp = tmp2;
+
+ return tmp2;
+}
+
+
+void FileMgr::close(FileDesc *file) {
+ FileDesc **loop;
+
+ for (loop = &files; *loop; loop = &((*loop)->next)) {
+ if (*loop == file) {
+ *loop = (*loop)->next;
+ delete file;
+ break;
+ }
+ }
+}
+
+
+int FileMgr::sysOpen(FileDesc *file) {
+ FileDesc **loop;
+ int openCount = 1; // because we are presently opening 1 file, and we need to be sure to close files to accomodate, if necessary
+
+ for (loop = &files; *loop; loop = &((*loop)->next)) {
+
+ if ((*loop)->fd > 0) {
+ if (++openCount > maxFiles) {
+ (*loop)->offset = lseek((*loop)->fd, 0, SEEK_CUR);
+ ::close((*loop)->fd);
+ (*loop)->fd = -77;
+ }
+ }
+
+ if (*loop == file) {
+ if (*loop != files) {
+ *loop = (*loop)->next;
+ file->next = files;
+ files = file;
+ }
+ if ((!access(file->path, 04)) || ((file->mode & O_CREAT) == O_CREAT)) { // check for at least file exists / read access before we try to open
+ char tries = (((file->mode & O_RDWR) == O_RDWR) && (file->tryDowngrade)) ? 2 : 1; // try read/write if possible
+ for (int i = 0; i < tries; i++) {
+ if (i > 0) {
+ file->mode = (file->mode & ~O_RDWR); // remove write access
+ file->mode = (file->mode | O_RDONLY);// add read access
+ }
+ file->fd = ::open(file->path, file->mode|O_BINARY, file->perms);
+
+ if (file->fd >= 0)
+ break;
+ }
+
+ if (file->fd >= 0)
+ lseek(file->fd, file->offset, SEEK_SET);
+ }
+ else file->fd = -1;
+ if (!*loop)
+ break;
+ }
+ }
+ return file->fd;
+}
+
+
+// to truncate a file at its current position
+// leaving byte at current possition intact
+// deleting everything afterward.
+signed char FileMgr::trunc(FileDesc *file) {
+
+ static const char *writeTest = "x";
+ long size = file->seek(1, SEEK_CUR);
+ if (size == 1) // was empty
+ size = 0;
+ char nibble [ 32767 ];
+ bool writable = file->write(writeTest, 1);
+ int bytes = 0;
+
+ if (writable) {
+ // get tmpfilename
+ char *buf = new char [ strlen(file->path) + 10 ];
+ int i;
+ for (i = 0; i < 9999; i++) {
+ sprintf(buf, "%stmp%.4d", file->path, i);
+ if (!existsFile(buf))
+ break;
+ }
+ if (i == 9999)
+ return -2;
+
+ int fd = ::open(buf, O_CREAT|O_RDWR, S_IREAD|S_IWRITE|S_IRGRP|S_IROTH);
+ if (fd < 0)
+ return -3;
+
+ file->seek(0, SEEK_SET);
+ while (size > 0) {
+ bytes = file->read(nibble, 32767);
+ bytes = (bytes < size)?bytes:size;
+ if (write(fd, nibble, bytes) != bytes) { break; }
+ size -= bytes;
+ }
+ if (size < 1) {
+ // zero out the file
+ ::close(file->fd);
+ file->fd = ::open(file->path, O_TRUNC, S_IREAD|S_IWRITE|S_IRGRP|S_IROTH);
+ ::close(file->fd);
+ file->fd = -77; // force file open by filemgr
+ // copy tmp file back (dumb, but must preserve file permissions)
+ lseek(fd, 0, SEEK_SET);
+ do {
+ bytes = read(fd, nibble, 32767);
+ file->write(nibble, bytes);
+ } while (bytes == 32767);
+ }
+
+ ::close(fd);
+ ::close(file->fd);
+ removeFile(buf); // remove our tmp file
+ file->fd = -77; // causes file to be swapped out forcing open on next call to getFd()
+ }
+ else { // put offset back and return failure
+ file->seek(-1, SEEK_CUR);
+ return -1;
+ }
+ return 0;
+}
+
+
+signed char FileMgr::existsFile(const char *ipath, const char *ifileName)
+{
+ int len = strlen(ipath) + ((ifileName)?strlen(ifileName):0) + 3;
+ char *ch;
+ char *path = new char [ len ];
+ strcpy(path, ipath);
+
+ if ((path[strlen(path)-1] == '\\') || (path[strlen(path)-1] == '/'))
+ path[strlen(path)-1] = 0;
+
+ if (ifileName) {
+ ch = path + strlen(path);
+ sprintf(ch, "/%s", ifileName);
+ }
+ signed char retVal = !access(path, 04);
+ delete [] path;
+ return retVal;
+}
+
+
+signed char FileMgr::existsDir(const char *ipath, const char *idirName)
+{
+ char *ch;
+ int len = strlen(ipath) + ((idirName)?strlen(idirName):0) + 1;
+ if (idirName)
+ len += strlen(idirName);
+ char *path = new char [ len ];
+ strcpy(path, ipath);
+
+ if ((path[strlen(path)-1] == '\\') || (path[strlen(path)-1] == '/'))
+ path[strlen(path)-1] = 0;
+
+ if (idirName) {
+ ch = path + strlen(path);
+ sprintf(ch, "/%s", idirName);
+ }
+ signed char retVal = !access(path, 04);
+ delete [] path;
+ return retVal;
+}
+
+
+int FileMgr::createParent(const char *pName) {
+ char *buf = new char [ strlen(pName) + 1 ];
+ int retCode = 0;
+
+ strcpy(buf, pName);
+ int end = strlen(buf) - 1;
+ while (end) {
+ if ((buf[end] == '/') || (buf[end] == '\\'))
+ break;
+ end--;
+ }
+ buf[end] = 0;
+ if (strlen(buf)>0) {
+ if (access(buf, 02)) { // not exists with write access?
+ if ((retCode = mkdir(buf
+#ifndef WIN32
+ , 0755
+#endif
+ ))) {
+ createParent(buf);
+ retCode = mkdir(buf
+#ifndef WIN32
+ , 0755
+#endif
+ );
+ }
+ }
+ }
+ else retCode = -1;
+ delete [] buf;
+ return retCode;
+}
+
+
+int FileMgr::openFileReadOnly(const char *fName) {
+ int fd = ::open(fName, O_RDONLY|O_BINARY, S_IREAD|S_IWRITE|S_IRGRP|S_IROTH);
+ return fd;
+}
+
+
+int FileMgr::createPathAndFile(const char *fName) {
+ int fd;
+
+ fd = ::open(fName, O_CREAT|O_WRONLY|O_BINARY, S_IREAD|S_IWRITE|S_IRGRP|S_IROTH);
+ if (fd < 1) {
+ createParent(fName);
+ fd = ::open(fName, O_CREAT|O_WRONLY|O_BINARY, S_IREAD|S_IWRITE|S_IRGRP|S_IROTH);
+ }
+ return fd;
+}
+
+
+int FileMgr::copyFile(const char *sourceFile, const char *targetFile) {
+ int sfd, dfd, len;
+ char buf[4096];
+
+ if ((sfd = ::open(sourceFile, O_RDONLY|O_BINARY, S_IREAD|S_IWRITE|S_IRGRP|S_IROTH)) < 1)
+ return -1;
+ if ((dfd = createPathAndFile(targetFile)) < 1)
+ return -1;
+
+ do {
+ len = read(sfd, buf, 4096);
+ if (write(dfd, buf, len) != len) break;
+ }
+ while(len == 4096);
+ ::close(dfd);
+ ::close(sfd);
+
+ return 0;
+}
+
+
+int FileMgr::removeFile(const char *fName) {
+ return ::remove(fName);
+}
+
+char FileMgr::getLine(FileDesc *fDesc, SWBuf &line) {
+ int len;
+ bool more = true;
+ char chunk[255];
+
+ line = "";
+
+ // assert we have a valid file handle
+ if (fDesc->getFd() < 1)
+ return 0;
+
+ while (more) {
+ more = false;
+ long index = fDesc->seek(0, SEEK_CUR);
+ len = fDesc->read(chunk, 254);
+
+ // assert we have a readable file (not a directory)
+ if (len < 1)
+ break;
+
+ int start = 0;
+ // clean up any preceding white space if we're at the beginning of line
+ if (!line.length()) {
+ for (;start < len; start++) {
+ if ((chunk[start] != 13) && (chunk[start] != ' ') && (chunk[start] != '\t'))
+ break;
+ }
+ }
+
+ // find the end
+ int end;
+ for (end = start; ((end < (len-1)) && (chunk[end] != 10)); end++);
+
+ if ((chunk[end] != 10) && (len == 254)) {
+ more = true;
+ }
+ index += (end + 1);
+
+ // reposition to next valid place to read
+ fDesc->seek(index, SEEK_SET);
+
+ // clean up any trailing junk on line if we're at the end
+ if (!more) {
+ for (; end > start; end--) {
+ if ((chunk[end] != 10) && (chunk[end] != 13) && (chunk[end] != ' ') && (chunk[end] != '\t')) {
+ if (chunk[end] == '\\') {
+ more = true;
+ end--;
+ }
+ break;
+ }
+ }
+ }
+
+ int size = (end - start) + 1;
+
+ if (size > 0) {
+ // line.appendFormatted("%.*s", size, chunk+start);
+ line.append(chunk+start, size);
+ }
+ }
+ return ((len > 0) || line.length());
+}
+
+
+char FileMgr::isDirectory(const char *path) {
+ struct stat stats;
+ if (stat(path, &stats))
+ return 0;
+ return ((stats.st_mode & S_IFDIR) == S_IFDIR);
+}
+
+
+int FileMgr::copyDir(const char *srcDir, const char *destDir) {
+ DIR *dir;
+ struct dirent *ent;
+ if ((dir = opendir(srcDir))) {
+ rewinddir(dir);
+ while ((ent = readdir(dir))) {
+ if ((strcmp(ent->d_name, ".")) && (strcmp(ent->d_name, ".."))) {
+ SWBuf srcPath = (SWBuf)srcDir + (SWBuf)"/" + ent->d_name;
+ SWBuf destPath = (SWBuf)destDir + (SWBuf)"/" + ent->d_name;
+ if (!isDirectory(srcPath.c_str())) {
+ copyFile(srcPath.c_str(), destPath.c_str());
+ }
+ else {
+ copyDir(srcPath.c_str(), destPath.c_str());
+ }
+ }
+ }
+ closedir(dir);
+ }
+ return 0;
+}
+
+
+int FileMgr::removeDir(const char *targetDir) {
+ DIR *dir = opendir(targetDir);
+ struct dirent *ent;
+ if (dir) {
+ rewinddir(dir);
+ while ((ent = readdir(dir))) {
+ if ((strcmp(ent->d_name, ".")) && (strcmp(ent->d_name, ".."))) {
+ SWBuf targetPath = (SWBuf)targetDir + (SWBuf)"/" + ent->d_name;
+ if (!isDirectory(targetPath.c_str())) {
+ FileMgr::removeFile(targetPath.c_str());
+ }
+ else {
+ FileMgr::removeDir(targetPath.c_str());
+ }
+ }
+ }
+ closedir(dir);
+ int status = FileMgr::removeFile(targetDir);
+ int stuff = errno;
+ char *err = strerror(errno);
+ int x = stuff;
+ }
+ return 0;
+}
+
+
+void FileMgr::flush() {
+ FileDesc **loop;
+
+ for (loop = &files; *loop; loop = &((*loop)->next)) {
+ if ((*loop)->fd > 0) {
+ (*loop)->offset = lseek((*loop)->fd, 0, SEEK_CUR);
+ ::close((*loop)->fd);
+ (*loop)->fd = -77;
+ }
+ }
+}
+
+long FileMgr::resourceConsumption() {
+ long count = 0;
+ FileDesc **loop;
+ for (loop = &files; *loop; loop = &((*loop)->next)) {
+ if ((*loop)->fd > 0) {
+ count++;
+ }
+ }
+ return count;
+}
+
+
+SWORD_NAMESPACE_END
Deleted: branches/1.6/addons/ccure/pre9000/ilsccureconnector/filemgr.h
===================================================================
--- trunk/addons/ccure/pre9000/ilsccureconnector/filemgr.h 2016-05-09 23:12:32 UTC (rev 1457)
+++ branches/1.6/addons/ccure/pre9000/ilsccureconnector/filemgr.h 2016-05-09 23:15:45 UTC (rev 1458)
@@ -1,190 +0,0 @@
-/******************************************************************************
-* filemgr.h - definition of class FileMgr used for pooling file handles
-*
-* $Id: filemgr.h 2295 2009-03-29 17:11:27Z scribe $
-*
-* Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
-* CrossWire Bible Society
-* P. O. Box 2528
-* Tempe, AZ 85280-2528
-*
-* 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 version 2.
-*
-* 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.
-*
-*/
-
-#ifndef FILEMGR_H
-#define FILEMGR_H
-
-#include <sys/stat.h>
-#include <fcntl.h>
-
-#include "defs.h"
-#include "swcacher.h"
-#include "swbuf.h"
-
-SWORD_NAMESPACE_START
-
-class SWDLLEXPORT FileMgr;
-
-struct SWDLLEXPORT DirEntry {
-public:
- SWBuf name;
- unsigned long size;
- bool isDirectory;
-};
-/**
-* This class represents one file. It works with the FileMgr object.
-*/
-class SWDLLEXPORT FileDesc {
-
- friend class FileMgr;
-
- long offset;
- int fd; // -77 closed;
- FileMgr *parent;
- FileDesc *next;
-
- FileDesc(FileMgr * parent, const char *path, int mode, int perms, bool tryDowngrade);
- virtual ~FileDesc();
-
-public:
- /** @return File handle.
- */
- int getFd();
-
- long seek(long offset, int whence);
- long read(void *buf, long count);
- long write(const void *buf, long count);
-
- /** Path to file.
- */
- char *path;
- /** File access mode.
- */
- int mode;
- /** File permissions.
- */
- int perms;
- /**
- */
- bool tryDowngrade;
-};
-
-/**
-* This class ist used make file access operations easier.
-* It keeps a list of all open files internally and closes them
-* when the destructor is called.
-*/
-class SWDLLEXPORT FileMgr : public SWCacher {
-
- friend class FileDesc;
- friend class __staticsystemFileMgr;
-
- FileDesc *files;
- int sysOpen(FileDesc * file);
-protected:
- static FileMgr *systemFileMgr;
-public:
- static int CREAT;
- static int APPEND;
- static int TRUNC;
- static int RDONLY;
- static int RDWR;
- static int WRONLY;
- static int IREAD;
- static int IWRITE;
-
- /** Maximum number of open files set in the constructor.
- * determines the max number of real system files that
- * filemgr will open. Adjust for tuning.
- */
- int maxFiles;
-
- static FileMgr *getSystemFileMgr();
- static void setSystemFileMgr(FileMgr *newFileMgr);
-
- /** Constructor.
- * @param maxFiles The number of files that this FileMgr may open in parallel, if necessary.
- */
- FileMgr(int maxFiles = 35);
-
- /**
- * Destructor. Clean things up. Will close all files opened by this FileMgr object.
- */
- ~FileMgr();
-
- /** Open a file and return a FileDesc for it.
- * The file itself will only be opened when FileDesc::getFd() is called.
- * @param path Filename.
- * @param mode File access mode.
- * @param tryDowngrade
- * @return FileDesc object for the requested file.
- */
- FileDesc *open(const char *path, int mode, bool tryDowngrade);
-
- /** Open a file and return a FileDesc for it.
- * The file itself will only be opened when FileDesc::getFd() is called.
- * @param path Filename.
- * @param mode File access mode.
- * @param perms Permissions.
- * @param tryDowngrade
- * @return FileDesc object for the requested file.
- */
- FileDesc *open(const char *path, int mode, int perms = IREAD | IWRITE, bool tryDowngrade = false);
-
- /** Close a given file and delete its FileDesc object.
- * Will only close the file if it was created by this FileMgr object.
- * @param file The file to close.
- */
- void close(FileDesc *file);
-
- /** Cacher methods overridden
- */
- virtual void flush();
- virtual long resourceConsumption();
-
- /** Checks for the existence of a file.
- * @param ipath Path to file.
- * @param ifileName Name of file to check for.
- */
- static signed char existsFile(const char *ipath, const char *ifileName = 0);
-
- /** Checks for the existence of a directory.
- * @param ipath Path to directory.
- * @param idirName Name of directory to check for.
- */
- static signed char existsDir(const char *ipath, const char *idirName = 0);
-
- /** Truncate a file at its current position
- * leaving byte at current possition intact deleting everything afterward.
- * @param file The file to operate on.
- */
- signed char trunc(FileDesc *file);
-
- static char isDirectory(const char *path);
- static int createParent(const char *pName);
- static int createPathAndFile(const char *fName);
-
- /** attempts to open a file readonly
- * @param fName filename to open
- * @return fd; < 0 = error
- */
- static int openFileReadOnly(const char *fName);
- static int copyFile(const char *srcFile, const char *destFile);
- static int copyDir(const char *srcDir, const char *destDir);
- static int removeDir(const char *targetDir);
- static int removeFile(const char *fName);
- static char getLine(FileDesc *fDesc, SWBuf &line);
-
-};
-
-
-SWORD_NAMESPACE_END
-#endif
Copied: branches/1.6/addons/ccure/pre9000/ilsccureconnector/filemgr.h (from rev 1457, trunk/addons/ccure/pre9000/ilsccureconnector/filemgr.h)
===================================================================
--- branches/1.6/addons/ccure/pre9000/ilsccureconnector/filemgr.h (rev 0)
+++ branches/1.6/addons/ccure/pre9000/ilsccureconnector/filemgr.h 2016-05-09 23:15:45 UTC (rev 1458)
@@ -0,0 +1,190 @@
+/******************************************************************************
+* filemgr.h - definition of class FileMgr used for pooling file handles
+*
+* $Id: filemgr.h 2295 2009-03-29 17:11:27Z scribe $
+*
+* Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
+* CrossWire Bible Society
+* P. O. Box 2528
+* Tempe, AZ 85280-2528
+*
+* 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 version 2.
+*
+* 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.
+*
+*/
+
+#ifndef FILEMGR_H
+#define FILEMGR_H
+
+#include <sys/stat.h>
+#include <fcntl.h>
+
+#include "defs.h"
+#include "swcacher.h"
+#include "swbuf.h"
+
+SWORD_NAMESPACE_START
+
+class SWDLLEXPORT FileMgr;
+
+struct SWDLLEXPORT DirEntry {
+public:
+ SWBuf name;
+ unsigned long size;
+ bool isDirectory;
+};
+/**
+* This class represents one file. It works with the FileMgr object.
+*/
+class SWDLLEXPORT FileDesc {
+
+ friend class FileMgr;
+
+ long offset;
+ int fd; // -77 closed;
+ FileMgr *parent;
+ FileDesc *next;
+
+ FileDesc(FileMgr * parent, const char *path, int mode, int perms, bool tryDowngrade);
+ virtual ~FileDesc();
+
+public:
+ /** @return File handle.
+ */
+ int getFd();
+
+ long seek(long offset, int whence);
+ long read(void *buf, long count);
+ long write(const void *buf, long count);
+
+ /** Path to file.
+ */
+ char *path;
+ /** File access mode.
+ */
+ int mode;
+ /** File permissions.
+ */
+ int perms;
+ /**
+ */
+ bool tryDowngrade;
+};
+
+/**
+* This class ist used make file access operations easier.
+* It keeps a list of all open files internally and closes them
+* when the destructor is called.
+*/
+class SWDLLEXPORT FileMgr : public SWCacher {
+
+ friend class FileDesc;
+ friend class __staticsystemFileMgr;
+
+ FileDesc *files;
+ int sysOpen(FileDesc * file);
+protected:
+ static FileMgr *systemFileMgr;
+public:
+ static int CREAT;
+ static int APPEND;
+ static int TRUNC;
+ static int RDONLY;
+ static int RDWR;
+ static int WRONLY;
+ static int IREAD;
+ static int IWRITE;
+
+ /** Maximum number of open files set in the constructor.
+ * determines the max number of real system files that
+ * filemgr will open. Adjust for tuning.
+ */
+ int maxFiles;
+
+ static FileMgr *getSystemFileMgr();
+ static void setSystemFileMgr(FileMgr *newFileMgr);
+
+ /** Constructor.
+ * @param maxFiles The number of files that this FileMgr may open in parallel, if necessary.
+ */
+ FileMgr(int maxFiles = 35);
+
+ /**
+ * Destructor. Clean things up. Will close all files opened by this FileMgr object.
+ */
+ ~FileMgr();
+
+ /** Open a file and return a FileDesc for it.
+ * The file itself will only be opened when FileDesc::getFd() is called.
+ * @param path Filename.
+ * @param mode File access mode.
+ * @param tryDowngrade
+ * @return FileDesc object for the requested file.
+ */
+ FileDesc *open(const char *path, int mode, bool tryDowngrade);
+
+ /** Open a file and return a FileDesc for it.
+ * The file itself will only be opened when FileDesc::getFd() is called.
+ * @param path Filename.
+ * @param mode File access mode.
+ * @param perms Permissions.
+ * @param tryDowngrade
+ * @return FileDesc object for the requested file.
+ */
+ FileDesc *open(const char *path, int mode, int perms = IREAD | IWRITE, bool tryDowngrade = false);
+
+ /** Close a given file and delete its FileDesc object.
+ * Will only close the file if it was created by this FileMgr object.
+ * @param file The file to close.
+ */
+ void close(FileDesc *file);
+
+ /** Cacher methods overridden
+ */
+ virtual void flush();
+ virtual long resourceConsumption();
+
+ /** Checks for the existence of a file.
+ * @param ipath Path to file.
+ * @param ifileName Name of file to check for.
+ */
+ static signed char existsFile(const char *ipath, const char *ifileName = 0);
+
+ /** Checks for the existence of a directory.
+ * @param ipath Path to directory.
+ * @param idirName Name of directory to check for.
+ */
+ static signed char existsDir(const char *ipath, const char *idirName = 0);
+
+ /** Truncate a file at its current position
+ * leaving byte at current possition intact deleting everything afterward.
+ * @param file The file to operate on.
+ */
+ signed char trunc(FileDesc *file);
+
+ static char isDirectory(const char *path);
+ static int createParent(const char *pName);
+ static int createPathAndFile(const char *fName);
+
+ /** attempts to open a file readonly
+ * @param fName filename to open
+ * @return fd; < 0 = error
+ */
+ static int openFileReadOnly(const char *fName);
+ static int copyFile(const char *srcFile, const char *destFile);
+ static int copyDir(const char *srcDir, const char *destDir);
+ static int removeDir(const char *targetDir);
+ static int removeFile(const char *fName);
+ static char getLine(FileDesc *fDesc, SWBuf &line);
+
+};
+
+
+SWORD_NAMESPACE_END
+#endif
Deleted: branches/1.6/addons/ccure/pre9000/ilsccureconnector/floppy.bmp
===================================================================
(Binary files differ)
Copied: branches/1.6/addons/ccure/pre9000/ilsccureconnector/floppy.bmp (from rev 1457, trunk/addons/ccure/pre9000/ilsccureconnector/floppy.bmp)
===================================================================
(Binary files differ)
Deleted: branches/1.6/addons/ccure/pre9000/ilsccureconnector/handshak.ico
===================================================================
(Binary files differ)
Copied: branches/1.6/addons/ccure/pre9000/ilsccureconnector/handshak.ico (from rev 1457, trunk/addons/ccure/pre9000/ilsccureconnector/handshak.ico)
===================================================================
(Binary files differ)
Deleted: branches/1.6/addons/ccure/pre9000/ilsccureconnector/ilsccureconnector.bpr
===================================================================
--- trunk/addons/ccure/pre9000/ilsccureconnector/ilsccureconnector.bpr 2016-05-09 23:12:32 UTC (rev 1457)
+++ branches/1.6/addons/ccure/pre9000/ilsccureconnector/ilsccureconnector.bpr 2016-05-09 23:15:45 UTC (rev 1458)
@@ -1,93 +0,0 @@
-<?xml version='1.0' encoding='utf-8' ?>
-<!-- C++Builder XML Project -->
-<PROJECT>
- <MACROS>
- <VERSION value="BCB.05.03"/>
- <PROJECT value="ilsccureconnector.exe"/>
- <OBJFILES value="ilsccureconnector.obj ilsccuremainfrm.obj swconfig.obj filemgr.obj
- utilstr.obj swbuf.obj swcacher.obj"/>
- <RESFILES value="ilsccureconnector.res"/>
- <DEFFILE value=""/>
- <RESDEPEN value="$(RESFILES) ilsccuremainfrm.dfm"/>
- <LIBFILES value="ilsccurehook.lib"/>
- <LIBRARIES value="VCLX50.lib NMFast50.lib Vcl50.lib"/>
- <SPARELIBS value="Vcl50.lib NMFast50.lib VCLX50.lib"/>
- <PACKAGES value="Vcl50.bpi Vclx50.bpi bcbsmp50.bpi Qrpt50.bpi Vcldb50.bpi Vclbde50.bpi
- ibsmp50.bpi vcldbx50.bpi TeeUI50.bpi TeeDB50.bpi Tee50.bpi TeeQR50.bpi
- VCLIB50.bpi bcbie50.bpi vclie50.bpi Inetdb50.bpi Inet50.bpi NMFast50.bpi
- dclocx50.bpi bcb2kaxserver50.bpi"/>
- <PATHCPP value=".;"/>
- <PATHPAS value=".;"/>
- <PATHRC value=".;"/>
- <PATHASM value=".;"/>
- <DEBUGLIBPATH value="$(BCB)\lib\debug"/>
- <RELEASELIBPATH value="$(BCB)\lib\release"/>
- <LINKER value="tlink32"/>
- <USERDEFINES value=""/>
- <SYSDEFINES value="NO_STRICT"/>
- <MAINSOURCE value="ilsccureconnector.cpp"/>
- <INCLUDEPATH value="..\biblecs\TNGImage;$(BCB)\include;$(BCB)\include\vcl"/>
- <LIBPATH value="..\biblecs\TNGImage;$(BCB)\lib\obj;$(BCB)\lib"/>
- <WARNINGS value="-w-par"/>
- </MACROS>
- <OPTIONS>
- <CFLAG1 value="-O2 -H=$(BCB)\lib\vcl50.csm -Hc -Vx -Ve -X- -a8 -b- -k- -vi -c -tW -tWM"/>
- <PFLAGS value="-$Y- -$L- -$D- -v -JPHNE -M"/>
- <RFLAGS value=""/>
- <AFLAGS value="/mx /w2 /zn"/>
- <LFLAGS value="-D"" -aa -Tpe -x -Gn"/>
- </OPTIONS>
- <LINKER>
- <ALLOBJ value="c0w32.obj sysinit.obj $(OBJFILES)"/>
- <ALLRES value="$(RESFILES)"/>
- <ALLLIB value="$(LIBFILES) $(LIBRARIES) import32.lib cp32mt.lib"/>
- </LINKER>
- <IDEOPTIONS>
-[Version Info]
-IncludeVerInfo=1
-AutoIncBuild=0
-MajorVer=1
-MinorVer=0
-Release=1
-Build=0
-Debug=0
-PreRelease=0
-Special=0
-Private=0
-DLL=0
-Locale=1033
-CodePage=1252
-
-[Version Info Keys]
-CompanyName=RMGI
-FileDescription=iLS CCure Connector
-FileVersion=1.0.1.0
-InternalName=
-LegalCopyright=
-LegalTrademarks=
-OriginalFilename=
-ProductName=iLS
-ProductVersion=1.0.1.0
-Comments=
-
-[Debugging]
-DebugSourceDirs=$(BCB)\source\vcl
-
-[Parameters]
-RunParams=
-HostApplication=
-RemoteHost=
-RemotePath=
-RemoteDebug=0
-
-[Compiler]
-ShowInfoMsgs=0
-LinkDebugVcl=0
-LinkCGLIB=0
-
-[Language]
-ActiveLang=
-ProjectLang=
-RootDir=
- </IDEOPTIONS>
-</PROJECT>
\ No newline at end of file
Copied: branches/1.6/addons/ccure/pre9000/ilsccureconnector/ilsccureconnector.bpr (from rev 1457, trunk/addons/ccure/pre9000/ilsccureconnector/ilsccureconnector.bpr)
===================================================================
--- branches/1.6/addons/ccure/pre9000/ilsccureconnector/ilsccureconnector.bpr (rev 0)
+++ branches/1.6/addons/ccure/pre9000/ilsccureconnector/ilsccureconnector.bpr 2016-05-09 23:15:45 UTC (rev 1458)
@@ -0,0 +1,93 @@
+<?xml version='1.0' encoding='utf-8' ?>
+<!-- C++Builder XML Project -->
+<PROJECT>
+ <MACROS>
+ <VERSION value="BCB.05.03"/>
+ <PROJECT value="ilsccureconnector.exe"/>
+ <OBJFILES value="ilsccureconnector.obj ilsccuremainfrm.obj swconfig.obj filemgr.obj
+ utilstr.obj swbuf.obj swcacher.obj"/>
+ <RESFILES value="ilsccureconnector.res"/>
+ <DEFFILE value=""/>
+ <RESDEPEN value="$(RESFILES) ilsccuremainfrm.dfm"/>
+ <LIBFILES value="ilsccurehook.lib"/>
+ <LIBRARIES value="VCLX50.lib NMFast50.lib Vcl50.lib"/>
+ <SPARELIBS value="Vcl50.lib NMFast50.lib VCLX50.lib"/>
+ <PACKAGES value="Vcl50.bpi Vclx50.bpi bcbsmp50.bpi Qrpt50.bpi Vcldb50.bpi Vclbde50.bpi
+ ibsmp50.bpi vcldbx50.bpi TeeUI50.bpi TeeDB50.bpi Tee50.bpi TeeQR50.bpi
+ VCLIB50.bpi bcbie50.bpi vclie50.bpi Inetdb50.bpi Inet50.bpi NMFast50.bpi
+ dclocx50.bpi bcb2kaxserver50.bpi"/>
+ <PATHCPP value=".;"/>
+ <PATHPAS value=".;"/>
+ <PATHRC value=".;"/>
+ <PATHASM value=".;"/>
+ <DEBUGLIBPATH value="$(BCB)\lib\debug"/>
+ <RELEASELIBPATH value="$(BCB)\lib\release"/>
+ <LINKER value="tlink32"/>
+ <USERDEFINES value=""/>
+ <SYSDEFINES value="NO_STRICT"/>
+ <MAINSOURCE value="ilsccureconnector.cpp"/>
+ <INCLUDEPATH value="..\biblecs\TNGImage;$(BCB)\include;$(BCB)\include\vcl"/>
+ <LIBPATH value="..\biblecs\TNGImage;$(BCB)\lib\obj;$(BCB)\lib"/>
+ <WARNINGS value="-w-par"/>
+ </MACROS>
+ <OPTIONS>
+ <CFLAG1 value="-O2 -H=$(BCB)\lib\vcl50.csm -Hc -Vx -Ve -X- -a8 -b- -k- -vi -c -tW -tWM"/>
+ <PFLAGS value="-$Y- -$L- -$D- -v -JPHNE -M"/>
+ <RFLAGS value=""/>
+ <AFLAGS value="/mx /w2 /zn"/>
+ <LFLAGS value="-D"" -aa -Tpe -x -Gn"/>
+ </OPTIONS>
+ <LINKER>
+ <ALLOBJ value="c0w32.obj sysinit.obj $(OBJFILES)"/>
+ <ALLRES value="$(RESFILES)"/>
+ <ALLLIB value="$(LIBFILES) $(LIBRARIES) import32.lib cp32mt.lib"/>
+ </LINKER>
+ <IDEOPTIONS>
+[Version Info]
+IncludeVerInfo=1
+AutoIncBuild=0
+MajorVer=1
+MinorVer=0
+Release=1
+Build=0
+Debug=0
+PreRelease=0
+Special=0
+Private=0
+DLL=0
+Locale=1033
+CodePage=1252
+
+[Version Info Keys]
+CompanyName=RMGI
+FileDescription=iLS CCure Connector
+FileVersion=1.0.1.0
+InternalName=
+LegalCopyright=
+LegalTrademarks=
+OriginalFilename=
+ProductName=iLS
+ProductVersion=1.0.1.0
+Comments=
+
+[Debugging]
+DebugSourceDirs=$(BCB)\source\vcl
+
+[Parameters]
+RunParams=
+HostApplication=
+RemoteHost=
+RemotePath=
+RemoteDebug=0
+
+[Compiler]
+ShowInfoMsgs=0
+LinkDebugVcl=0
+LinkCGLIB=0
+
+[Language]
+ActiveLang=
+ProjectLang=
+RootDir=
+ </IDEOPTIONS>
+</PROJECT>
\ No newline at end of file
Deleted: branches/1.6/addons/ccure/pre9000/ilsccureconnector/ilsccureconnector.cpp
===================================================================
--- trunk/addons/ccure/pre9000/ilsccureconnector/ilsccureconnector.cpp 2016-05-09 23:12:32 UTC (rev 1457)
+++ branches/1.6/addons/ccure/pre9000/ilsccureconnector/ilsccureconnector.cpp 2016-05-09 23:15:45 UTC (rev 1458)
@@ -1,29 +0,0 @@
-//---------------------------------------------------------------------------
-
-#include <vcl.h>
-#pragma hdrstop
-HINSTANCE g_hinst;
-USERES("ilsccureconnector.res");
-USEFORM("ilsccuremainfrm.cpp", ILSCCUREMainForm);
-USELIB("ilsccurehook.lib");
-USEUNIT("swconfig.cpp");
-USEUNIT("filemgr.cpp");
-USEUNIT("utilstr.cpp");
-USEUNIT("swbuf.cpp");
-USEUNIT("swcacher.cpp");
-//---------------------------------------------------------------------------
-WINAPI WinMain(HINSTANCE, HINSTANCE hInstance, LPSTR, int)
-{
- try {
- Application->Initialize();
- g_hinst = hInstance;
- Application->Title = "ILS CCure Connector";
- Application->CreateForm(__classid(TILSCCUREMainForm), &ILSCCUREMainForm);
- Application->Run();
- }
- catch (Exception &exception) {
- Application->ShowException(&exception);
- }
- return 0;
-}
-//---------------------------------------------------------------------------
Copied: branches/1.6/addons/ccure/pre9000/ilsccureconnector/ilsccureconnector.cpp (from rev 1457, trunk/addons/ccure/pre9000/ilsccureconnector/ilsccureconnector.cpp)
===================================================================
--- branches/1.6/addons/ccure/pre9000/ilsccureconnector/ilsccureconnector.cpp (rev 0)
+++ branches/1.6/addons/ccure/pre9000/ilsccureconnector/ilsccureconnector.cpp 2016-05-09 23:15:45 UTC (rev 1458)
@@ -0,0 +1,29 @@
+//---------------------------------------------------------------------------
+
+#include <vcl.h>
+#pragma hdrstop
+HINSTANCE g_hinst;
+USERES("ilsccureconnector.res");
+USEFORM("ilsccuremainfrm.cpp", ILSCCUREMainForm);
+USELIB("ilsccurehook.lib");
+USEUNIT("swconfig.cpp");
+USEUNIT("filemgr.cpp");
+USEUNIT("utilstr.cpp");
+USEUNIT("swbuf.cpp");
+USEUNIT("swcacher.cpp");
+//---------------------------------------------------------------------------
+WINAPI WinMain(HINSTANCE, HINSTANCE hInstance, LPSTR, int)
+{
+ try {
+ Application->Initialize();
+ g_hinst = hInstance;
+ Application->Title = "ILS CCure Connector";
+ Application->CreateForm(__classid(TILSCCUREMainForm), &ILSCCUREMainForm);
+ Application->Run();
+ }
+ catch (Exception &exception) {
+ Application->ShowException(&exception);
+ }
+ return 0;
+}
+//---------------------------------------------------------------------------
Deleted: branches/1.6/addons/ccure/pre9000/ilsccureconnector/ilsccureconnector.res
===================================================================
(Binary files differ)
Copied: branches/1.6/addons/ccure/pre9000/ilsccureconnector/ilsccureconnector.res (from rev 1457, trunk/addons/ccure/pre9000/ilsccureconnector/ilsccureconnector.res)
===================================================================
(Binary files differ)
Deleted: branches/1.6/addons/ccure/pre9000/ilsccureconnector/ilsccurehook.bpf
===================================================================
--- trunk/addons/ccure/pre9000/ilsccureconnector/ilsccurehook.bpf 2016-05-09 23:12:32 UTC (rev 1457)
+++ branches/1.6/addons/ccure/pre9000/ilsccureconnector/ilsccurehook.bpf 2016-05-09 23:15:45 UTC (rev 1458)
@@ -1,7 +0,0 @@
-USEUNIT("Unit1.cpp");
-USERES("ilsccurehook.res");
-//---------------------------------------------------------------------------
-This file is used by the project manager only and should be treated like the project file
-
-
-DllMain
\ No newline at end of file
Copied: branches/1.6/addons/ccure/pre9000/ilsccureconnector/ilsccurehook.bpf (from rev 1457, trunk/addons/ccure/pre9000/ilsccureconnector/ilsccurehook.bpf)
===================================================================
--- branches/1.6/addons/ccure/pre9000/ilsccureconnector/ilsccurehook.bpf (rev 0)
+++ branches/1.6/addons/ccure/pre9000/ilsccureconnector/ilsccurehook.bpf 2016-05-09 23:15:45 UTC (rev 1458)
@@ -0,0 +1,7 @@
+USEUNIT("Unit1.cpp");
+USERES("ilsccurehook.res");
+//---------------------------------------------------------------------------
+This file is used by the project manager only and should be treated like the project file
+
+
+DllMain
\ No newline at end of file
Deleted: branches/1.6/addons/ccure/pre9000/ilsccureconnector/ilsccurehook.bpr
===================================================================
--- trunk/addons/ccure/pre9000/ilsccureconnector/ilsccurehook.bpr 2016-05-09 23:12:32 UTC (rev 1457)
+++ branches/1.6/addons/ccure/pre9000/ilsccureconnector/ilsccurehook.bpr 2016-05-09 23:15:45 UTC (rev 1458)
@@ -1,92 +0,0 @@
-<?xml version='1.0' encoding='utf-8' ?>
-<!-- C++Builder XML Project -->
-<PROJECT>
- <MACROS>
- <VERSION value="BCB.05.03"/>
- <PROJECT value="ilsccurehook.dll"/>
- <OBJFILES value="Unit1.obj"/>
- <RESFILES value="ilsccurehook.res"/>
- <DEFFILE value=""/>
- <RESDEPEN value="$(RESFILES)"/>
- <LIBFILES value=""/>
- <LIBRARIES value="Vcl50.lib"/>
- <SPARELIBS value="Vcl50.lib"/>
- <PACKAGES value="Vcl50.bpi Vclx50.bpi bcbsmp50.bpi Qrpt50.bpi Vcldb50.bpi Vclbde50.bpi
- ibsmp50.bpi vcldbx50.bpi TeeUI50.bpi TeeDB50.bpi Tee50.bpi TeeQR50.bpi
- VCLIB50.bpi bcbie50.bpi vclie50.bpi Inetdb50.bpi Inet50.bpi NMFast50.bpi
- dclocx50.bpi bcb2kaxserver50.bpi"/>
- <PATHCPP value=".;"/>
- <PATHPAS value=".;"/>
- <PATHRC value=".;"/>
- <PATHASM value=".;"/>
- <DEBUGLIBPATH value="$(BCB)\lib\debug"/>
- <RELEASELIBPATH value="$(BCB)\lib\release"/>
- <LINKER value="tlink32"/>
- <USERDEFINES value=""/>
- <SYSDEFINES value="NO_STRICT"/>
- <MAINSOURCE value="ilsccurehook.bpf"/>
- <INCLUDEPATH value="$(BCB)\include;$(BCB)\include\vcl"/>
- <LIBPATH value="$(BCB)\lib\obj;$(BCB)\lib"/>
- <WARNINGS value="-w-par"/>
- </MACROS>
- <OPTIONS>
- <CFLAG1 value="-WD -O2 -H=$(BCB)\lib\vcl50.csm -Hc -Vx -Ve -X- -a8 -b- -k- -vi -tWD -tWM -c"/>
- <PFLAGS value="-$Y- -$L- -$D- -v -JPHNE -M"/>
- <RFLAGS value=""/>
- <AFLAGS value="/mx /w2 /zn"/>
- <LFLAGS value="-D"" -aa -Tpd -x -Gn -Gi"/>
- </OPTIONS>
- <LINKER>
- <ALLOBJ value="c0d32.obj sysinit.obj $(OBJFILES)"/>
- <ALLRES value="$(RESFILES)"/>
- <ALLLIB value="$(LIBFILES) $(LIBRARIES) import32.lib cp32mt.lib"/>
- </LINKER>
- <IDEOPTIONS>
-[Version Info]
-IncludeVerInfo=1
-AutoIncBuild=0
-MajorVer=1
-MinorVer=0
-Release=0
-Build=0
-Debug=0
-PreRelease=0
-Special=0
-Private=0
-DLL=0
-Locale=1033
-CodePage=1252
-
-[Version Info Keys]
-CompanyName=RMGI
-FileDescription=iLS CCure Intercept Hook
-FileVersion=1.0.0.0
-InternalName=
-LegalCopyright=
-LegalTrademarks=
-OriginalFilename=
-ProductName=
-ProductVersion=1.0.0.0
-Comments=
-
-[Debugging]
-DebugSourceDirs=$(BCB)\source\vcl
-
-[Parameters]
-RunParams=
-HostApplication=
-RemoteHost=
-RemotePath=
-RemoteDebug=0
-
-[Compiler]
-ShowInfoMsgs=0
-LinkDebugVcl=0
-LinkCGLIB=0
-
-[Language]
-ActiveLang=
-ProjectLang=
-RootDir=
- </IDEOPTIONS>
-</PROJECT>
\ No newline at end of file
Copied: branches/1.6/addons/ccure/pre9000/ilsccureconnector/ilsccurehook.bpr (from rev 1457, trunk/addons/ccure/pre9000/ilsccureconnector/ilsccurehook.bpr)
===================================================================
--- branches/1.6/addons/ccure/pre9000/ilsccureconnector/ilsccurehook.bpr (rev 0)
+++ branches/1.6/addons/ccure/pre9000/ilsccureconnector/ilsccurehook.bpr 2016-05-09 23:15:45 UTC (rev 1458)
@@ -0,0 +1,92 @@
+<?xml version='1.0' encoding='utf-8' ?>
+<!-- C++Builder XML Project -->
+<PROJECT>
+ <MACROS>
+ <VERSION value="BCB.05.03"/>
+ <PROJECT value="ilsccurehook.dll"/>
+ <OBJFILES value="Unit1.obj"/>
+ <RESFILES value="ilsccurehook.res"/>
+ <DEFFILE value=""/>
+ <RESDEPEN value="$(RESFILES)"/>
+ <LIBFILES value=""/>
+ <LIBRARIES value="Vcl50.lib"/>
+ <SPARELIBS value="Vcl50.lib"/>
+ <PACKAGES value="Vcl50.bpi Vclx50.bpi bcbsmp50.bpi Qrpt50.bpi Vcldb50.bpi Vclbde50.bpi
+ ibsmp50.bpi vcldbx50.bpi TeeUI50.bpi TeeDB50.bpi Tee50.bpi TeeQR50.bpi
+ VCLIB50.bpi bcbie50.bpi vclie50.bpi Inetdb50.bpi Inet50.bpi NMFast50.bpi
+ dclocx50.bpi bcb2kaxserver50.bpi"/>
+ <PATHCPP value=".;"/>
+ <PATHPAS value=".;"/>
+ <PATHRC value=".;"/>
+ <PATHASM value=".;"/>
+ <DEBUGLIBPATH value="$(BCB)\lib\debug"/>
+ <RELEASELIBPATH value="$(BCB)\lib\release"/>
+ <LINKER value="tlink32"/>
+ <USERDEFINES value=""/>
+ <SYSDEFINES value="NO_STRICT"/>
+ <MAINSOURCE value="ilsccurehook.bpf"/>
+ <INCLUDEPATH value="$(BCB)\include;$(BCB)\include\vcl"/>
+ <LIBPATH value="$(BCB)\lib\obj;$(BCB)\lib"/>
+ <WARNINGS value="-w-par"/>
+ </MACROS>
+ <OPTIONS>
+ <CFLAG1 value="-WD -O2 -H=$(BCB)\lib\vcl50.csm -Hc -Vx -Ve -X- -a8 -b- -k- -vi -tWD -tWM -c"/>
+ <PFLAGS value="-$Y- -$L- -$D- -v -JPHNE -M"/>
+ <RFLAGS value=""/>
+ <AFLAGS value="/mx /w2 /zn"/>
+ <LFLAGS value="-D"" -aa -Tpd -x -Gn -Gi"/>
+ </OPTIONS>
+ <LINKER>
+ <ALLOBJ value="c0d32.obj sysinit.obj $(OBJFILES)"/>
+ <ALLRES value="$(RESFILES)"/>
+ <ALLLIB value="$(LIBFILES) $(LIBRARIES) import32.lib cp32mt.lib"/>
+ </LINKER>
+ <IDEOPTIONS>
+[Version Info]
+IncludeVerInfo=1
+AutoIncBuild=0
+MajorVer=1
+MinorVer=0
+Release=0
+Build=0
+Debug=0
+PreRelease=0
+Special=0
+Private=0
+DLL=0
+Locale=1033
+CodePage=1252
+
+[Version Info Keys]
+CompanyName=RMGI
+FileDescription=iLS CCure Intercept Hook
+FileVersion=1.0.0.0
+InternalName=
+LegalCopyright=
+LegalTrademarks=
+OriginalFilename=
+ProductName=
+ProductVersion=1.0.0.0
+Comments=
+
+[Debugging]
+DebugSourceDirs=$(BCB)\source\vcl
+
+[Parameters]
+RunParams=
+HostApplication=
+RemoteHost=
+RemotePath=
+RemoteDebug=0
+
+[Compiler]
+ShowInfoMsgs=0
+LinkDebugVcl=0
+LinkCGLIB=0
+
+[Language]
+ActiveLang=
+ProjectLang=
+RootDir=
+ </IDEOPTIONS>
+</PROJECT>
\ No newline at end of file
Deleted: branches/1.6/addons/ccure/pre9000/ilsccureconnector/ilsccurehook.res
===================================================================
(Binary files differ)
Copied: branches/1.6/addons/ccure/pre9000/ilsccureconnector/ilsccurehook.res (from rev 1457, trunk/addons/ccure/pre9000/ilsccureconnector/ilsccurehook.res)
===================================================================
(Binary files differ)
Deleted: branches/1.6/addons/ccure/pre9000/ilsccureconnector/ilsccuremainfrm.cpp
===================================================================
--- trunk/addons/ccure/pre9000/ilsccureconnector/ilsccuremainfrm.cpp 2016-05-09 23:12:32 UTC (rev 1457)
+++ branches/1.6/addons/ccure/pre9000/ilsccureconnector/ilsccuremainfrm.cpp 2016-05-09 23:15:45 UTC (rev 1458)
@@ -1,347 +0,0 @@
-//---------------------------------------------------------------------------
-
-#include <vcl.h>
-#pragma hdrstop
-
-#include "ilsccuremainfrm.h"
-#include "ilshook.h"
-//---------------------------------------------------------------------------
-#pragma package(smart_init)
-#pragma resource "*.dfm"
-
-#include <string>
-#include "swconfig.h"
-#include "filemgr.h"
-
-
-using std::string;
-using sword::SWConfig;
-using sword::FileMgr;
-
-TILSCCUREMainForm *ILSCCUREMainForm;
-
-
-namespace {
- int ws = 0;
-
- string getDataRootPath() {
- string dataRootPath = getenv("ALLUSERSPROFILE");
- if (dataRootPath.length()) {
- if ((dataRootPath[dataRootPath.length()-1] != '\\') && (dataRootPath[dataRootPath.length()-1] != '/'))
- dataRootPath += "/";
- dataRootPath += "Application Data/ilsccureconnector/";
- }
- else {
- dataRootPath = "./";
- }
- return dataRootPath;
- }
-
- void defaultAll() {
- ILSCCUREMainForm->ilsURL->Text = "http://localhost:8081/api/ccure/";
- ILSCCUREMainForm->user->Text = "admin";
- ILSCCUREMainForm->passwd->Text = "Administrator1";
- ILSCCUREMainForm->askBefore->Checked = true;
- }
-
-
-}
-
-
-
-
-LRESULT IconDrawItem(LPDRAWITEMSTRUCT lpdi)
-{
- HICON hIcon;
-
- hIcon = (HICON)LoadImage(g_hinst, MAKEINTRESOURCE(lpdi->CtlID), IMAGE_ICON,
- 16, 16, 0);
- if (!hIcon)
- return(FALSE);
-
- DrawIconEx(lpdi->hDC, lpdi->rcItem.left, lpdi->rcItem.top, hIcon,
- 16, 16, 0, NULL, DI_NORMAL);
-
- return(TRUE);
-}
-void __fastcall TILSCCUREMainForm::DrawItem(TMessage& Msg)
-{
- IconDrawItem((LPDRAWITEMSTRUCT)Msg.LParam);
- TForm::Dispatch(&Msg);
-}
-//---------------------------------------------------------------------------
-void __fastcall TILSCCUREMainForm::MyNotify(TMessage& Msg)
-{
- POINT MousePos;
-
- switch(Msg.LParam)
- {
- case WM_RBUTTONUP:
- if (GetCursorPos(&MousePos))
- {
- PopupMenu1->PopupComponent = ILSCCUREMainForm;
- SetForegroundWindow(Handle);
- PopupMenu1->Popup(MousePos.x, MousePos.y);
- }
- else
- Show();
- break;
- case WM_LBUTTONUP:
- ToggleState();
- break;
- case WM_LBUTTONDBLCLK:
- if (this->Visible)
- Hide();
- else Show();
- default:
- break;
- }
- TForm::Dispatch(&Msg);
-}
-
-void __fastcall TILSCCUREMainForm::MyFinishedConstruction(TMessage& Msg)
-{
- Hide();
-}
-
-
-//---------------------------------------------------------------------------
-bool __fastcall TILSCCUREMainForm::TrayMessage(DWORD dwMessage)
-{
- NOTIFYICONDATA tnd;
- PSTR pszTip;
-
- pszTip = TipText();
-
- tnd.cbSize = sizeof(NOTIFYICONDATA);
- tnd.hWnd = Handle;
- tnd.uID = IDC_MYICON;
- tnd.uFlags = NIF_MESSAGE | NIF_ICON | NIF_TIP;
- tnd.uCallbackMessage = MYWM_NOTIFY;
-
- if (dwMessage == NIM_MODIFY)
- {
- tnd.hIcon = (HICON)IconHandle();
- if (pszTip)
- lstrcpyn(tnd.szTip, pszTip, sizeof(tnd.szTip));
- else
- tnd.szTip[0] = '\0';
- }
- else
- {
- tnd.hIcon = NULL;
- tnd.szTip[0] = '\0';
- }
-
- return (Shell_NotifyIcon(dwMessage, &tnd));
-}
-//---------------------------------------------------------------------------
-HICON __fastcall TILSCCUREMainForm::IconHandle(void)
-{
-// if (RadioButton1->Checked)
- return (Image1->Picture->Icon->Handle);
-// else
-// return (Image2->Picture->Icon->Handle);
-}
-//---------------------------------------------------------------------------
-void __fastcall TILSCCUREMainForm::ToggleState(void)
-{
-/*
- if (RadioButton1->Checked)
- {
- RadioButton1->Checked = false;
- RadioButton2->Checked = true;
- }
- else
- {
- RadioButton2->Checked = false;
- RadioButton1->Checked = true;
- }
-*/
- TrayMessage(NIM_MODIFY);
-}
-//---------------------------------------------------------------------------
-PSTR __fastcall TILSCCUREMainForm::TipText(void)
-{
- return "ILS CCURE Connector";
-/*
- if (RadioButton1->Checked)
- return (Edit1->Text.c_str());
- else
- return (Edit2->Text.c_str());
-*/
-}
-
-//---------------------------------------------------------------------------
-__fastcall TILSCCUREMainForm::TILSCCUREMainForm(TComponent* Owner)
- : TForm(Owner)
-{
- reallyClose = false;
-}
-//---------------------------------------------------------------------------
-void __fastcall TILSCCUREMainForm::FormCreate(TObject *Sender)
-{
- SG_TARGET_EVENT = installHook();
- Application->OnMessage = AppMessage;
- TrayMessage(NIM_ADD);
- TrayMessage(NIM_MODIFY);
-
- string configPath = getDataRootPath() + (string)"configuration.conf";
- SWConfig config(configPath.c_str());
- ilsURL->Text = config["settings"]["ilsURL"].c_str();
- user->Text = config["settings"]["user"].c_str();
- passwd->Text = config["settings"]["passwd"].c_str();
- askBefore->Checked = config["settings"]["askBefore"] == "yes";
-
- if (!ilsURL->Text.Length()) {
- defaultAll();
- }
-
-
- PostMessage(this->WindowHandle, MYWM_FINISHED_CONSTRUCTION, 0, 0);
-
-}
-//---------------------------------------------------------------------------
-
-void TILSCCUREMainForm::postToILS(long personID) {
- Memo1->Lines->Add((String)"Sending Add Request to iLS for Person ID: (" + String(personID) + String(")"));
- String url = ilsURL->Text;
- if (url.Length() < 5 || url.SubString(url.Length() - 4, 4) != "echo") {
- if (url.Length() > 1 && url[url.Length()-1] != '/') {
- url += "/";
- }
- url += "adduser/";
- }
- url += String("?")+String("personID=")+String(personID);
- urlEncoder->InputString = user->Text;
- url += String("&")+String("ILSUSER=")+ urlEncoder->Encode;
- urlEncoder->InputString = passwd->Text;
- url += String("&")+String("ILSPASSWD=")+ urlEncoder->Encode;
- NMHTTP1->Post(url, "");
-}
-//---------------------------------------------------------------------------
-
-
-void __fastcall TILSCCUREMainForm::AppMessage(tagMSG &Msg, bool &Handled)
-{
- if (Msg.message == SG_TARGET_EVENT) {
-// Memo1->Lines->Add((String)"(" + String(Msg.wParam) + String("): ") + String(Msg.lParam));
- Memo1->Lines->Add((String)"Intercepted Add Personnel OK Click for Person ID: (" + String(Msg.lParam) + String(")"));
- trigger->Caption = String(Msg.lParam);
-
- if (askBefore->Checked) {
- ws = this->WindowState;
- this->WindowState = wsNormal;
- Application->BringToFront();
- }
- trigger->Checked = true;
-
- Handled = true;
- }
- /* for all other messages, Handled remains False so that other message handlers can respond */
-}
-
-//---------------------------------------------------------------------------
-
-void __fastcall TILSCCUREMainForm::Button1Click(TObject *Sender)
-{
- Memo1->Text = "";
-}
-
-//---------------------------------------------------------------------------
-
-void __fastcall TILSCCUREMainForm::FormDestroy(TObject *Sender)
-{
- uninstallHook();
- TrayMessage(NIM_DELETE);
-}
-//---------------------------------------------------------------------------
-
-
-void __fastcall TILSCCUREMainForm::Button2Click(TObject *Sender)
-{
- defaultAll();
-}
-//---------------------------------------------------------------------------
-
-void __fastcall TILSCCUREMainForm::triggerClick(TObject *Sender)
-{
- if (trigger->Checked) {
- bool post = false;
- trigger->Checked = false;
- if (askBefore->Checked) {
-// SetFocus();
- if (IDOK == ::MessageBox(0, String("Create ILS User for Person ID: " + trigger->Caption).c_str(), "Create iLS User", MB_OKCANCEL)) {
- post = true;
- }
- this->WindowState = ws;
- }
- else {
- post = true;
- }
- if (post) {
- postToILS(strtol(trigger->Caption.c_str(), 0, 10));
- }
- }
-}
-//---------------------------------------------------------------------------
-
-void __fastcall TILSCCUREMainForm::NMHTTP1Success(CmdType Cmd)
-{
- Memo1->Lines->Add("Post to iLS successful, returned:");
- Memo1->Lines->Add(NMHTTP1->Body);
-}
-//---------------------------------------------------------------------------
-
-void __fastcall TILSCCUREMainForm::NMHTTP1Failure(CmdType Cmd)
-{
- Memo1->Lines->Add("Post to iLS FAILED!");
- Memo1->Lines->Add(NMHTTP1->Body);
-}
-//---------------------------------------------------------------------------
-
-
-void __fastcall TILSCCUREMainForm::Configure1Click(TObject *Sender)
-{
- PageControl1->ActivePageIndex = 0;
- Show();
-}
-//---------------------------------------------------------------------------
-
-void __fastcall TILSCCUREMainForm::Exit1Click(TObject *Sender)
-{
- reallyClose = true;
- Close();
-}
-//---------------------------------------------------------------------------
-
-
-void __fastcall TILSCCUREMainForm::FormCloseQuery(TObject *Sender,
- bool &CanClose)
-{
- CanClose = reallyClose;
- Hide();
-}
-//---------------------------------------------------------------------------
-
-void __fastcall TILSCCUREMainForm::Log1Click(TObject *Sender)
-{
- PageControl1->ActivePageIndex = 1;
- Show();
-}
-//---------------------------------------------------------------------------
-
-
-void __fastcall TILSCCUREMainForm::SaveButtonClick(TObject *Sender)
-{
- string configPath = getDataRootPath() + (string)"configuration.conf";
- SWConfig config(configPath.c_str());
- config["settings"]["ilsURL"] = ilsURL->Text.c_str();
- config["settings"]["user"] = user->Text.c_str();
- config["settings"]["passwd"] = passwd->Text.c_str();
- config["settings"]["askBefore"] = askBefore->Checked ? "yes":"no";
- FileMgr::createParent(configPath.c_str());
- config.Save();
-}
-//---------------------------------------------------------------------------
-
Copied: branches/1.6/addons/ccure/pre9000/ilsccureconnector/ilsccuremainfrm.cpp (from rev 1457, trunk/addons/ccure/pre9000/ilsccureconnector/ilsccuremainfrm.cpp)
===================================================================
--- branches/1.6/addons/ccure/pre9000/ilsccureconnector/ilsccuremainfrm.cpp (rev 0)
+++ branches/1.6/addons/ccure/pre9000/ilsccureconnector/ilsccuremainfrm.cpp 2016-05-09 23:15:45 UTC (rev 1458)
@@ -0,0 +1,347 @@
+//---------------------------------------------------------------------------
+
+#include <vcl.h>
+#pragma hdrstop
+
+#include "ilsccuremainfrm.h"
+#include "ilshook.h"
+//---------------------------------------------------------------------------
+#pragma package(smart_init)
+#pragma resource "*.dfm"
+
+#include <string>
+#include "swconfig.h"
+#include "filemgr.h"
+
+
+using std::string;
+using sword::SWConfig;
+using sword::FileMgr;
+
+TILSCCUREMainForm *ILSCCUREMainForm;
+
+
+namespace {
+ int ws = 0;
+
+ string getDataRootPath() {
+ string dataRootPath = getenv("ALLUSERSPROFILE");
+ if (dataRootPath.length()) {
+ if ((dataRootPath[dataRootPath.length()-1] != '\\') && (dataRootPath[dataRootPath.length()-1] != '/'))
+ dataRootPath += "/";
+ dataRootPath += "Application Data/ilsccureconnector/";
+ }
+ else {
+ dataRootPath = "./";
+ }
+ return dataRootPath;
+ }
+
+ void defaultAll() {
+ ILSCCUREMainForm->ilsURL->Text = "http://localhost:8081/api/ccure/";
+ ILSCCUREMainForm->user->Text = "admin";
+ ILSCCUREMainForm->passwd->Text = "Administrator1";
+ ILSCCUREMainForm->askBefore->Checked = true;
+ }
+
+
+}
+
+
+
+
+LRESULT IconDrawItem(LPDRAWITEMSTRUCT lpdi)
+{
+ HICON hIcon;
+
+ hIcon = (HICON)LoadImage(g_hinst, MAKEINTRESOURCE(lpdi->CtlID), IMAGE_ICON,
+ 16, 16, 0);
+ if (!hIcon)
+ return(FALSE);
+
+ DrawIconEx(lpdi->hDC, lpdi->rcItem.left, lpdi->rcItem.top, hIcon,
+ 16, 16, 0, NULL, DI_NORMAL);
+
+ return(TRUE);
+}
+void __fastcall TILSCCUREMainForm::DrawItem(TMessage& Msg)
+{
+ IconDrawItem((LPDRAWITEMSTRUCT)Msg.LParam);
+ TForm::Dispatch(&Msg);
+}
+//---------------------------------------------------------------------------
+void __fastcall TILSCCUREMainForm::MyNotify(TMessage& Msg)
+{
+ POINT MousePos;
+
+ switch(Msg.LParam)
+ {
+ case WM_RBUTTONUP:
+ if (GetCursorPos(&MousePos))
+ {
+ PopupMenu1->PopupComponent = ILSCCUREMainForm;
+ SetForegroundWindow(Handle);
+ PopupMenu1->Popup(MousePos.x, MousePos.y);
+ }
+ else
+ Show();
+ break;
+ case WM_LBUTTONUP:
+ ToggleState();
+ break;
+ case WM_LBUTTONDBLCLK:
+ if (this->Visible)
+ Hide();
+ else Show();
+ default:
+ break;
+ }
+ TForm::Dispatch(&Msg);
+}
+
+void __fastcall TILSCCUREMainForm::MyFinishedConstruction(TMessage& Msg)
+{
+ Hide();
+}
+
+
+//---------------------------------------------------------------------------
+bool __fastcall TILSCCUREMainForm::TrayMessage(DWORD dwMessage)
+{
+ NOTIFYICONDATA tnd;
+ PSTR pszTip;
+
+ pszTip = TipText();
+
+ tnd.cbSize = sizeof(NOTIFYICONDATA);
+ tnd.hWnd = Handle;
+ tnd.uID = IDC_MYICON;
+ tnd.uFlags = NIF_MESSAGE | NIF_ICON | NIF_TIP;
+ tnd.uCallbackMessage = MYWM_NOTIFY;
+
+ if (dwMessage == NIM_MODIFY)
+ {
+ tnd.hIcon = (HICON)IconHandle();
+ if (pszTip)
+ lstrcpyn(tnd.szTip, pszTip, sizeof(tnd.szTip));
+ else
+ tnd.szTip[0] = '\0';
+ }
+ else
+ {
+ tnd.hIcon = NULL;
+ tnd.szTip[0] = '\0';
+ }
+
+ return (Shell_NotifyIcon(dwMessage, &tnd));
+}
+//---------------------------------------------------------------------------
+HICON __fastcall TILSCCUREMainForm::IconHandle(void)
+{
+// if (RadioButton1->Checked)
+ return (Image1->Picture->Icon->Handle);
+// else
+// return (Image2->Picture->Icon->Handle);
+}
+//---------------------------------------------------------------------------
+void __fastcall TILSCCUREMainForm::ToggleState(void)
+{
+/*
+ if (RadioButton1->Checked)
+ {
+ RadioButton1->Checked = false;
+ RadioButton2->Checked = true;
+ }
+ else
+ {
+ RadioButton2->Checked = false;
+ RadioButton1->Checked = true;
+ }
+*/
+ TrayMessage(NIM_MODIFY);
+}
+//---------------------------------------------------------------------------
+PSTR __fastcall TILSCCUREMainForm::TipText(void)
+{
+ return "ILS CCURE Connector";
+/*
+ if (RadioButton1->Checked)
+ return (Edit1->Text.c_str());
+ else
+ return (Edit2->Text.c_str());
+*/
+}
+
+//---------------------------------------------------------------------------
+__fastcall TILSCCUREMainForm::TILSCCUREMainForm(TComponent* Owner)
+ : TForm(Owner)
+{
+ reallyClose = false;
+}
+//---------------------------------------------------------------------------
+void __fastcall TILSCCUREMainForm::FormCreate(TObject *Sender)
+{
+ SG_TARGET_EVENT = installHook();
+ Application->OnMessage = AppMessage;
+ TrayMessage(NIM_ADD);
+ TrayMessage(NIM_MODIFY);
+
+ string configPath = getDataRootPath() + (string)"configuration.conf";
+ SWConfig config(configPath.c_str());
+ ilsURL->Text = config["settings"]["ilsURL"].c_str();
+ user->Text = config["settings"]["user"].c_str();
+ passwd->Text = config["settings"]["passwd"].c_str();
+ askBefore->Checked = config["settings"]["askBefore"] == "yes";
+
+ if (!ilsURL->Text.Length()) {
+ defaultAll();
+ }
+
+
+ PostMessage(this->WindowHandle, MYWM_FINISHED_CONSTRUCTION, 0, 0);
+
+}
+//---------------------------------------------------------------------------
+
+void TILSCCUREMainForm::postToILS(long personID) {
+ Memo1->Lines->Add((String)"Sending Add Request to iLS for Person ID: (" + String(personID) + String(")"));
+ String url = ilsURL->Text;
+ if (url.Length() < 5 || url.SubString(url.Length() - 4, 4) != "echo") {
+ if (url.Length() > 1 && url[url.Length()-1] != '/') {
+ url += "/";
+ }
+ url += "adduser/";
+ }
+ url += String("?")+String("personID=")+String(personID);
+ urlEncoder->InputString = user->Text;
+ url += String("&")+String("ILSUSER=")+ urlEncoder->Encode;
+ urlEncoder->InputString = passwd->Text;
+ url += String("&")+String("ILSPASSWD=")+ urlEncoder->Encode;
+ NMHTTP1->Post(url, "");
+}
+//---------------------------------------------------------------------------
+
+
+void __fastcall TILSCCUREMainForm::AppMessage(tagMSG &Msg, bool &Handled)
+{
+ if (Msg.message == SG_TARGET_EVENT) {
+// Memo1->Lines->Add((String)"(" + String(Msg.wParam) + String("): ") + String(Msg.lParam));
+ Memo1->Lines->Add((String)"Intercepted Add Personnel OK Click for Person ID: (" + String(Msg.lParam) + String(")"));
+ trigger->Caption = String(Msg.lParam);
+
+ if (askBefore->Checked) {
+ ws = this->WindowState;
+ this->WindowState = wsNormal;
+ Application->BringToFront();
+ }
+ trigger->Checked = true;
+
+ Handled = true;
+ }
+ /* for all other messages, Handled remains False so that other message handlers can respond */
+}
+
+//---------------------------------------------------------------------------
+
+void __fastcall TILSCCUREMainForm::Button1Click(TObject *Sender)
+{
+ Memo1->Text = "";
+}
+
+//---------------------------------------------------------------------------
+
+void __fastcall TILSCCUREMainForm::FormDestroy(TObject *Sender)
+{
+ uninstallHook();
+ TrayMessage(NIM_DELETE);
+}
+//---------------------------------------------------------------------------
+
+
+void __fastcall TILSCCUREMainForm::Button2Click(TObject *Sender)
+{
+ defaultAll();
+}
+//---------------------------------------------------------------------------
+
+void __fastcall TILSCCUREMainForm::triggerClick(TObject *Sender)
+{
+ if (trigger->Checked) {
+ bool post = false;
+ trigger->Checked = false;
+ if (askBefore->Checked) {
+// SetFocus();
+ if (IDOK == ::MessageBox(0, String("Create ILS User for Person ID: " + trigger->Caption).c_str(), "Create iLS User", MB_OKCANCEL)) {
+ post = true;
+ }
+ this->WindowState = ws;
+ }
+ else {
+ post = true;
+ }
+ if (post) {
+ postToILS(strtol(trigger->Caption.c_str(), 0, 10));
+ }
+ }
+}
+//---------------------------------------------------------------------------
+
+void __fastcall TILSCCUREMainForm::NMHTTP1Success(CmdType Cmd)
+{
+ Memo1->Lines->Add("Post to iLS successful, returned:");
+ Memo1->Lines->Add(NMHTTP1->Body);
+}
+//---------------------------------------------------------------------------
+
+void __fastcall TILSCCUREMainForm::NMHTTP1Failure(CmdType Cmd)
+{
+ Memo1->Lines->Add("Post to iLS FAILED!");
+ Memo1->Lines->Add(NMHTTP1->Body);
+}
+//---------------------------------------------------------------------------
+
+
+void __fastcall TILSCCUREMainForm::Configure1Click(TObject *Sender)
+{
+ PageControl1->ActivePageIndex = 0;
+ Show();
+}
+//---------------------------------------------------------------------------
+
+void __fastcall TILSCCUREMainForm::Exit1Click(TObject *Sender)
+{
+ reallyClose = true;
+ Close();
+}
+//---------------------------------------------------------------------------
+
+
+void __fastcall TILSCCUREMainForm::FormCloseQuery(TObject *Sender,
+ bool &CanClose)
+{
+ CanClose = reallyClose;
+ Hide();
+}
+//---------------------------------------------------------------------------
+
+void __fastcall TILSCCUREMainForm::Log1Click(TObject *Sender)
+{
+ PageControl1->ActivePageIndex = 1;
+ Show();
+}
+//---------------------------------------------------------------------------
+
+
+void __fastcall TILSCCUREMainForm::SaveButtonClick(TObject *Sender)
+{
+ string configPath = getDataRootPath() + (string)"configuration.conf";
+ SWConfig config(configPath.c_str());
+ config["settings"]["ilsURL"] = ilsURL->Text.c_str();
+ config["settings"]["user"] = user->Text.c_str();
+ config["settings"]["passwd"] = passwd->Text.c_str();
+ config["settings"]["askBefore"] = askBefore->Checked ? "yes":"no";
+ FileMgr::createParent(configPath.c_str());
+ config.Save();
+}
+//---------------------------------------------------------------------------
+
Deleted: branches/1.6/addons/ccure/pre9000/ilsccureconnector/ilsccuremainfrm.dfm
===================================================================
--- trunk/addons/ccure/pre9000/ilsccureconnector/ilsccuremainfrm.dfm 2016-05-09 23:12:32 UTC (rev 1457)
+++ branches/1.6/addons/ccure/pre9000/ilsccureconnector/ilsccuremainfrm.dfm 2016-05-09 23:15:45 UTC (rev 1458)
@@ -1,246 +0,0 @@
-object ILSCCUREMainForm: TILSCCUREMainForm
- Left = 1308
- Top = 873
- BorderIcons = [biSystemMenu]
- BorderStyle = bsSingle
- Caption = 'iLS CCURE Connector'
- ClientHeight = 214
- ClientWidth = 481
- Color = clBtnFace
- Font.Charset = DEFAULT_CHARSET
- Font.Color = clWindowText
- Font.Height = -11
- Font.Name = 'MS Sans Serif'
- Font.Style = []
- OldCreateOrder = False
- PopupMenu = PopupMenu1
- Position = poScreenCenter
- OnCloseQuery = FormCloseQuery
- OnCreate = FormCreate
- OnDestroy = FormDestroy
- PixelsPerInch = 96
- TextHeight = 13
- object PageControl1: TPageControl
- Left = 0
- Top = 0
- Width = 481
- Height = 214
- ActivePage = TabSheet1
- Align = alClient
- TabOrder = 0
- object TabSheet1: TTabSheet
- Caption = 'Configuration'
- object Label1: TLabel
- Left = 8
- Top = 36
- Width = 40
- Height = 13
- Caption = 'iLS URL'
- end
- object Label2: TLabel
- Left = 8
- Top = 72
- Width = 40
- Height = 13
- Caption = 'iLS User'
- end
- object Label3: TLabel
- Left = 8
- Top = 96
- Width = 64
- Height = 13
- Caption = 'iLS Password'
- end
- object Image1: TImage
- Left = 304
- Top = 72
- Width = 33
- Height = 41
- Picture.Data = {
- 055449636F6E0000010001002020100000000000E80200001600000028000000
- 2000000040000000010004000000000080020000000000000000000000000000
- 0000000000000000000080000080000000808000800000008000800080800000
- 80808000C0C0C0000000FF0000FF000000FFFF00FF000000FF00FF00FFFF0000
- FFFFFF0000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000330000000000000000000000033303303303300
- 0000000000000003303330333003003300000000000000033003330330002333
- 0000000000000030000033003033333000000000000033333330000003330003
- 33000000080333333333333333300233330000000F033333333333333302333B
- B03000004F8333333333333333333BB003BB00004FF3333333333333B33BB003
- 3BBB00004FF333333333B3BB3BB0033BBBB000004FF83B333B3B3B3BBBB03BBB
- BB0300F04FFF33B3B3B3BBBBBBBBBBBB00330FF04FFF8B3B3333BBBBBBBBBB00
- 33330FF044FFF8BBB03033BBBBB330333330FFF444FFF8BB0BB3003B33000333
- 3330FF44444FF88B3BBB300000033333B33FFF44444FFF3BB0BBB3000333B33B
- B38FF4444444FF003B0BB333333BBBBBB3FFF44444444FF00030BBBBBBBBBBBB
- BBFF444444440000000303BBB3300000BFF44444440000000000000000000000
- 0FF4444400000000000000000000000000444444000000000000000000000000
- 0000444400000000000000000000000000000444000000000000000000000000
- 0000000400000000000000000000000000000000000000000000000000000000
- 00000000FFFFFFFFFFFFFFFFFFFF1FFFFF8003FFFC0000FFF800007FF800007F
- E000003F0000001F0000001F0000000F00000007000000070000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000C000000FE01F003FFFFF80FFFFFFC0FFFFFFF0FFFFFFF8FFFFFFFE
- FFFFFFFF}
- Stretch = True
- Visible = False
- end
- object ilsURL: TEdit
- Left = 76
- Top = 32
- Width = 277
- Height = 21
- TabOrder = 0
- Text = 'http://localhost:8081/api/ccure/'
- end
- object Button2: TButton
- Left = 356
- Top = 28
- Width = 49
- Height = 25
- Caption = 'Default'
- TabOrder = 1
- OnClick = Button2Click
- end
- object askBefore: TCheckBox
- Left = 8
- Top = 132
- Width = 221
- Height = 17
- Caption = 'Ask Before Posting to iLS'
- Checked = True
- State = cbChecked
- TabOrder = 2
- end
- object Button3: TButton
- Left = 408
- Top = 28
- Width = 57
- Height = 25
- Caption = 'Test'
- TabOrder = 3
- end
- object trigger: TCheckBox
- Left = 316
- Top = 152
- Width = 97
- Height = 17
- Enabled = False
- TabOrder = 4
- Visible = False
- OnClick = triggerClick
- end
- object user: TEdit
- Left = 76
- Top = 68
- Width = 121
- Height = 21
- TabOrder = 5
- Text = 'admin'
- end
- object passwd: TEdit
- Left = 76
- Top = 92
- Width = 121
- Height = 21
- PasswordChar = '*'
- TabOrder = 6
- Text = 'Administrator1'
- end
- object SaveButton: TBitBtn
- Left = 8
- Top = 156
- Width = 129
- Height = 25
- Caption = '&Save Configuration'
- TabOrder = 7
- OnClick = SaveButtonClick
- Glyph.Data = {
- 76010000424D7601000000000000760000002800000020000000100000000100
- 04000000000000010000120B0000120B00001000000000000000000000000000
- 800000800000008080008000000080008000808000007F7F7F00BFBFBF000000
- FF0000FF000000FFFF00FF000000FF00FF00FFFF0000FFFFFF00333333333333
- 333333FFFFFFFFFFFFF33000077777770033377777777777773F000007888888
- 00037F3337F3FF37F37F00000780088800037F3337F77F37F37F000007800888
- 00037F3337F77FF7F37F00000788888800037F3337777777337F000000000000
- 00037F3FFFFFFFFFFF7F00000000000000037F77777777777F7F000FFFFFFFFF
- 00037F7F333333337F7F000FFFFFFFFF00037F7F333333337F7F000FFFFFFFFF
- 00037F7F333333337F7F000FFFFFFFFF00037F7F333333337F7F000FFFFFFFFF
- 00037F7F333333337F7F000FFFFFFFFF07037F7F33333333777F000FFFFFFFFF
- 0003737FFFFFFFFF7F7330099999999900333777777777777733}
- NumGlyphs = 2
- end
- end
- object TabSheet2: TTabSheet
- Caption = 'Log'
- ImageIndex = 1
- object Panel1: TPanel
- Left = 0
- Top = 0
- Width = 473
- Height = 41
- Align = alTop
- TabOrder = 0
- object Button1: TButton
- Left = 388
- Top = 8
- Width = 75
- Height = 25
- Caption = 'Clear Log'
- TabOrder = 0
- OnClick = Button1Click
- end
- end
- object Panel2: TPanel
- Left = 0
- Top = 41
- Width = 473
- Height = 145
- Align = alClient
- Caption = 'Panel2'
- TabOrder = 1
- object Memo1: TMemo
- Left = 1
- Top = 1
- Width = 471
- Height = 143
- Align = alClient
- TabOrder = 0
- end
- end
- end
- end
- object NMHTTP1: TNMHTTP
- Port = 0
- ReportLevel = 0
- Body = 'Default.htm'
- Header = 'Head.txt'
- InputFileMode = False
- OutputFileMode = False
- OnSuccess = NMHTTP1Success
- OnFailure = NMHTTP1Failure
- ProxyPort = 0
- Left = 432
- Top = 172
- end
- object urlEncoder: TNMURL
- Left = 432
- Top = 136
- end
- object PopupMenu1: TPopupMenu
- Left = 268
- Top = 124
- object Configure1: TMenuItem
- Caption = '&Configure...'
- OnClick = Configure1Click
- end
- object Log1: TMenuItem
- Caption = 'Log...'
- OnClick = Log1Click
- end
- object Exit1: TMenuItem
- Caption = '&Shutdown'
- OnClick = Exit1Click
- end
- end
-end
Copied: branches/1.6/addons/ccure/pre9000/ilsccureconnector/ilsccuremainfrm.dfm (from rev 1457, trunk/addons/ccure/pre9000/ilsccureconnector/ilsccuremainfrm.dfm)
===================================================================
--- branches/1.6/addons/ccure/pre9000/ilsccureconnector/ilsccuremainfrm.dfm (rev 0)
+++ branches/1.6/addons/ccure/pre9000/ilsccureconnector/ilsccuremainfrm.dfm 2016-05-09 23:15:45 UTC (rev 1458)
@@ -0,0 +1,246 @@
+object ILSCCUREMainForm: TILSCCUREMainForm
+ Left = 1308
+ Top = 873
+ BorderIcons = [biSystemMenu]
+ BorderStyle = bsSingle
+ Caption = 'iLS CCURE Connector'
+ ClientHeight = 214
+ ClientWidth = 481
+ Color = clBtnFace
+ Font.Charset = DEFAULT_CHARSET
+ Font.Color = clWindowText
+ Font.Height = -11
+ Font.Name = 'MS Sans Serif'
+ Font.Style = []
+ OldCreateOrder = False
+ PopupMenu = PopupMenu1
+ Position = poScreenCenter
+ OnCloseQuery = FormCloseQuery
+ OnCreate = FormCreate
+ OnDestroy = FormDestroy
+ PixelsPerInch = 96
+ TextHeight = 13
+ object PageControl1: TPageControl
+ Left = 0
+ Top = 0
+ Width = 481
+ Height = 214
+ ActivePage = TabSheet1
+ Align = alClient
+ TabOrder = 0
+ object TabSheet1: TTabSheet
+ Caption = 'Configuration'
+ object Label1: TLabel
+ Left = 8
+ Top = 36
+ Width = 40
+ Height = 13
+ Caption = 'iLS URL'
+ end
+ object Label2: TLabel
+ Left = 8
+ Top = 72
+ Width = 40
+ Height = 13
+ Caption = 'iLS User'
+ end
+ object Label3: TLabel
+ Left = 8
+ Top = 96
+ Width = 64
+ Height = 13
+ Caption = 'iLS Password'
+ end
+ object Image1: TImage
+ Left = 304
+ Top = 72
+ Width = 33
+ Height = 41
+ Picture.Data = {
+ 055449636F6E0000010001002020100000000000E80200001600000028000000
+ 2000000040000000010004000000000080020000000000000000000000000000
+ 0000000000000000000080000080000000808000800000008000800080800000
+ 80808000C0C0C0000000FF0000FF000000FFFF00FF000000FF00FF00FFFF0000
+ FFFFFF0000000000000000000000000000000000000000000000000000000000
+ 0000000000000000000000000000000000000000000000000000000000000000
+ 0000000000000000000000000330000000000000000000000033303303303300
+ 0000000000000003303330333003003300000000000000033003330330002333
+ 0000000000000030000033003033333000000000000033333330000003330003
+ 33000000080333333333333333300233330000000F033333333333333302333B
+ B03000004F8333333333333333333BB003BB00004FF3333333333333B33BB003
+ 3BBB00004FF333333333B3BB3BB0033BBBB000004FF83B333B3B3B3BBBB03BBB
+ BB0300F04FFF33B3B3B3BBBBBBBBBBBB00330FF04FFF8B3B3333BBBBBBBBBB00
+ 33330FF044FFF8BBB03033BBBBB330333330FFF444FFF8BB0BB3003B33000333
+ 3330FF44444FF88B3BBB300000033333B33FFF44444FFF3BB0BBB3000333B33B
+ B38FF4444444FF003B0BB333333BBBBBB3FFF44444444FF00030BBBBBBBBBBBB
+ BBFF444444440000000303BBB3300000BFF44444440000000000000000000000
+ 0FF4444400000000000000000000000000444444000000000000000000000000
+ 0000444400000000000000000000000000000444000000000000000000000000
+ 0000000400000000000000000000000000000000000000000000000000000000
+ 00000000FFFFFFFFFFFFFFFFFFFF1FFFFF8003FFFC0000FFF800007FF800007F
+ E000003F0000001F0000001F0000000F00000007000000070000000000000000
+ 0000000000000000000000000000000000000000000000000000000000000000
+ 0000000000C000000FE01F003FFFFF80FFFFFFC0FFFFFFF0FFFFFFF8FFFFFFFE
+ FFFFFFFF}
+ Stretch = True
+ Visible = False
+ end
+ object ilsURL: TEdit
+ Left = 76
+ Top = 32
+ Width = 277
+ Height = 21
+ TabOrder = 0
+ Text = 'http://localhost:8081/api/ccure/'
+ end
+ object Button2: TButton
+ Left = 356
+ Top = 28
+ Width = 49
+ Height = 25
+ Caption = 'Default'
+ TabOrder = 1
+ OnClick = Button2Click
+ end
+ object askBefore: TCheckBox
+ Left = 8
+ Top = 132
+ Width = 221
+ Height = 17
+ Caption = 'Ask Before Posting to iLS'
+ Checked = True
+ State = cbChecked
+ TabOrder = 2
+ end
+ object Button3: TButton
+ Left = 408
+ Top = 28
+ Width = 57
+ Height = 25
+ Caption = 'Test'
+ TabOrder = 3
+ end
+ object trigger: TCheckBox
+ Left = 316
+ Top = 152
+ Width = 97
+ Height = 17
+ Enabled = False
+ TabOrder = 4
+ Visible = False
+ OnClick = triggerClick
+ end
+ object user: TEdit
+ Left = 76
+ Top = 68
+ Width = 121
+ Height = 21
+ TabOrder = 5
+ Text = 'admin'
+ end
+ object passwd: TEdit
+ Left = 76
+ Top = 92
+ Width = 121
+ Height = 21
+ PasswordChar = '*'
+ TabOrder = 6
+ Text = 'Administrator1'
+ end
+ object SaveButton: TBitBtn
+ Left = 8
+ Top = 156
+ Width = 129
+ Height = 25
+ Caption = '&Save Configuration'
+ TabOrder = 7
+ OnClick = SaveButtonClick
+ Glyph.Data = {
+ 76010000424D7601000000000000760000002800000020000000100000000100
+ 04000000000000010000120B0000120B00001000000000000000000000000000
+ 800000800000008080008000000080008000808000007F7F7F00BFBFBF000000
+ FF0000FF000000FFFF00FF000000FF00FF00FFFF0000FFFFFF00333333333333
+ 333333FFFFFFFFFFFFF33000077777770033377777777777773F000007888888
+ 00037F3337F3FF37F37F00000780088800037F3337F77F37F37F000007800888
+ 00037F3337F77FF7F37F00000788888800037F3337777777337F000000000000
+ 00037F3FFFFFFFFFFF7F00000000000000037F77777777777F7F000FFFFFFFFF
+ 00037F7F333333337F7F000FFFFFFFFF00037F7F333333337F7F000FFFFFFFFF
+ 00037F7F333333337F7F000FFFFFFFFF00037F7F333333337F7F000FFFFFFFFF
+ 00037F7F333333337F7F000FFFFFFFFF07037F7F33333333777F000FFFFFFFFF
+ 0003737FFFFFFFFF7F7330099999999900333777777777777733}
+ NumGlyphs = 2
+ end
+ end
+ object TabSheet2: TTabSheet
+ Caption = 'Log'
+ ImageIndex = 1
+ object Panel1: TPanel
+ Left = 0
+ Top = 0
+ Width = 473
+ Height = 41
+ Align = alTop
+ TabOrder = 0
+ object Button1: TButton
+ Left = 388
+ Top = 8
+ Width = 75
+ Height = 25
+ Caption = 'Clear Log'
+ TabOrder = 0
+ OnClick = Button1Click
+ end
+ end
+ object Panel2: TPanel
+ Left = 0
+ Top = 41
+ Width = 473
+ Height = 145
+ Align = alClient
+ Caption = 'Panel2'
+ TabOrder = 1
+ object Memo1: TMemo
+ Left = 1
+ Top = 1
+ Width = 471
+ Height = 143
+ Align = alClient
+ TabOrder = 0
+ end
+ end
+ end
+ end
+ object NMHTTP1: TNMHTTP
+ Port = 0
+ ReportLevel = 0
+ Body = 'Default.htm'
+ Header = 'Head.txt'
+ InputFileMode = False
+ OutputFileMode = False
+ OnSuccess = NMHTTP1Success
+ OnFailure = NMHTTP1Failure
+ ProxyPort = 0
+ Left = 432
+ Top = 172
+ end
+ object urlEncoder: TNMURL
+ Left = 432
+ Top = 136
+ end
+ object PopupMenu1: TPopupMenu
+ Left = 268
+ Top = 124
+ object Configure1: TMenuItem
+ Caption = '&Configure...'
+ OnClick = Configure1Click
+ end
+ object Log1: TMenuItem
+ Caption = 'Log...'
+ OnClick = Log1Click
+ end
+ object Exit1: TMenuItem
+ Caption = '&Shutdown'
+ OnClick = Exit1Click
+ end
+ end
+end
Deleted: branches/1.6/addons/ccure/pre9000/ilsccureconnector/ilsccuremainfrm.h
===================================================================
--- trunk/addons/ccure/pre9000/ilsccureconnector/ilsccuremainfrm.h 2016-05-09 23:12:32 UTC (rev 1457)
+++ branches/1.6/addons/ccure/pre9000/ilsccureconnector/ilsccuremainfrm.h 2016-05-09 23:15:45 UTC (rev 1458)
@@ -1,88 +0,0 @@
-//---------------------------------------------------------------------------
-
-#ifndef ilsccuremainfrmH
-#define ilsccuremainfrmH
-//---------------------------------------------------------------------------
-#include <Classes.hpp>
-#include <Controls.hpp>
-#include <StdCtrls.hpp>
-#include <Forms.hpp>
-#include <ExtCtrls.hpp>
-#include <ComCtrls.hpp>
-#include <NMHttp.hpp>
-#include <Psock.hpp>
-#include <NMURL.hpp>
-#include <Menus.hpp>
-#include <Graphics.hpp>
-#include <Buttons.hpp>
-#define MYWM_NOTIFY (WM_APP+100)
-#define MYWM_FINISHED_CONSTRUCTION (WM_APP+101)
-#define IDC_MYICON 1006
-extern HINSTANCE g_hinst;
-LRESULT IconDrawItem(LPDRAWITEMSTRUCT lpdi);
-//---------------------------------------------------------------------------
-class TILSCCUREMainForm : public TForm
-{
- protected:
- void postToILS(long personID);
- UINT SG_TARGET_EVENT;
- void __fastcall AppMessage(tagMSG &Msg, bool &Handled);
-__published: // IDE-managed Components
- TPageControl *PageControl1;
- TTabSheet *TabSheet1;
- TTabSheet *TabSheet2;
- TPanel *Panel1;
- TButton *Button1;
- TPanel *Panel2;
- TMemo *Memo1;
- TLabel *Label1;
- TEdit *ilsURL;
- TButton *Button2;
- TCheckBox *askBefore;
- TButton *Button3;
- TCheckBox *trigger;
- TNMHTTP *NMHTTP1;
- TEdit *user;
- TEdit *passwd;
- TLabel *Label2;
- TLabel *Label3;
- TNMURL *urlEncoder;
- TPopupMenu *PopupMenu1;
- TMenuItem *Configure1;
- TMenuItem *Exit1;
- TImage *Image1;
- TMenuItem *Log1;
- TBitBtn *SaveButton;
- void __fastcall FormCreate(TObject *Sender);
- void __fastcall Button1Click(TObject *Sender);
- void __fastcall FormDestroy(TObject *Sender);
- void __fastcall Button2Click(TObject *Sender);
- void __fastcall triggerClick(TObject *Sender);
- void __fastcall NMHTTP1Success(CmdType Cmd);
- void __fastcall NMHTTP1Failure(CmdType Cmd);
- void __fastcall Configure1Click(TObject *Sender);
- void __fastcall Exit1Click(TObject *Sender);
- void __fastcall FormCloseQuery(TObject *Sender, bool &CanClose);
- void __fastcall Log1Click(TObject *Sender);
- void __fastcall SaveButtonClick(TObject *Sender);
-private: // User declarations
- bool reallyClose;
- void __fastcall DrawItem(TMessage& Msg);
- void __fastcall MyNotify(TMessage& Msg);
- void __fastcall MyFinishedConstruction(TMessage& Msg);
- bool __fastcall TrayMessage(DWORD dwMessage);
- HICON __fastcall IconHandle(void);
- void __fastcall ToggleState(void);
- PSTR __fastcall TipText(void);
-public: // User declarations
- __fastcall TILSCCUREMainForm(TComponent* Owner);
-BEGIN_MESSAGE_MAP
-MESSAGE_HANDLER(WM_DRAWITEM,TMessage,DrawItem)
-MESSAGE_HANDLER(MYWM_NOTIFY,TMessage,MyNotify)
-MESSAGE_HANDLER(MYWM_FINISHED_CONSTRUCTION,TMessage,MyFinishedConstruction)
-END_MESSAGE_MAP(TForm)
-};
-//---------------------------------------------------------------------------
-extern PACKAGE TILSCCUREMainForm *ILSCCUREMainForm;
-//---------------------------------------------------------------------------
-#endif
Copied: branches/1.6/addons/ccure/pre9000/ilsccureconnector/ilsccuremainfrm.h (from rev 1457, trunk/addons/ccure/pre9000/ilsccureconnector/ilsccuremainfrm.h)
===================================================================
--- branches/1.6/addons/ccure/pre9000/ilsccureconnector/ilsccuremainfrm.h (rev 0)
+++ branches/1.6/addons/ccure/pre9000/ilsccureconnector/ilsccuremainfrm.h 2016-05-09 23:15:45 UTC (rev 1458)
@@ -0,0 +1,88 @@
+//---------------------------------------------------------------------------
+
+#ifndef ilsccuremainfrmH
+#define ilsccuremainfrmH
+//---------------------------------------------------------------------------
+#include <Classes.hpp>
+#include <Controls.hpp>
+#include <StdCtrls.hpp>
+#include <Forms.hpp>
+#include <ExtCtrls.hpp>
+#include <ComCtrls.hpp>
+#include <NMHttp.hpp>
+#include <Psock.hpp>
+#include <NMURL.hpp>
+#include <Menus.hpp>
+#include <Graphics.hpp>
+#include <Buttons.hpp>
+#define MYWM_NOTIFY (WM_APP+100)
+#define MYWM_FINISHED_CONSTRUCTION (WM_APP+101)
+#define IDC_MYICON 1006
+extern HINSTANCE g_hinst;
+LRESULT IconDrawItem(LPDRAWITEMSTRUCT lpdi);
+//---------------------------------------------------------------------------
+class TILSCCUREMainForm : public TForm
+{
+ protected:
+ void postToILS(long personID);
+ UINT SG_TARGET_EVENT;
+ void __fastcall AppMessage(tagMSG &Msg, bool &Handled);
+__published: // IDE-managed Components
+ TPageControl *PageControl1;
+ TTabSheet *TabSheet1;
+ TTabSheet *TabSheet2;
+ TPanel *Panel1;
+ TButton *Button1;
+ TPanel *Panel2;
+ TMemo *Memo1;
+ TLabel *Label1;
+ TEdit *ilsURL;
+ TButton *Button2;
+ TCheckBox *askBefore;
+ TButton *Button3;
+ TCheckBox *trigger;
+ TNMHTTP *NMHTTP1;
+ TEdit *user;
+ TEdit *passwd;
+ TLabel *Label2;
+ TLabel *Label3;
+ TNMURL *urlEncoder;
+ TPopupMenu *PopupMenu1;
+ TMenuItem *Configure1;
+ TMenuItem *Exit1;
+ TImage *Image1;
+ TMenuItem *Log1;
+ TBitBtn *SaveButton;
+ void __fastcall FormCreate(TObject *Sender);
+ void __fastcall Button1Click(TObject *Sender);
+ void __fastcall FormDestroy(TObject *Sender);
+ void __fastcall Button2Click(TObject *Sender);
+ void __fastcall triggerClick(TObject *Sender);
+ void __fastcall NMHTTP1Success(CmdType Cmd);
+ void __fastcall NMHTTP1Failure(CmdType Cmd);
+ void __fastcall Configure1Click(TObject *Sender);
+ void __fastcall Exit1Click(TObject *Sender);
+ void __fastcall FormCloseQuery(TObject *Sender, bool &CanClose);
+ void __fastcall Log1Click(TObject *Sender);
+ void __fastcall SaveButtonClick(TObject *Sender);
+private: // User declarations
+ bool reallyClose;
+ void __fastcall DrawItem(TMessage& Msg);
+ void __fastcall MyNotify(TMessage& Msg);
+ void __fastcall MyFinishedConstruction(TMessage& Msg);
+ bool __fastcall TrayMessage(DWORD dwMessage);
+ HICON __fastcall IconHandle(void);
+ void __fastcall ToggleState(void);
+ PSTR __fastcall TipText(void);
+public: // User declarations
+ __fastcall TILSCCUREMainForm(TComponent* Owner);
+BEGIN_MESSAGE_MAP
+MESSAGE_HANDLER(WM_DRAWITEM,TMessage,DrawItem)
+MESSAGE_HANDLER(MYWM_NOTIFY,TMessage,MyNotify)
+MESSAGE_HANDLER(MYWM_FINISHED_CONSTRUCTION,TMessage,MyFinishedConstruction)
+END_MESSAGE_MAP(TForm)
+};
+//---------------------------------------------------------------------------
+extern PACKAGE TILSCCUREMainForm *ILSCCUREMainForm;
+//---------------------------------------------------------------------------
+#endif
Deleted: branches/1.6/addons/ccure/pre9000/ilsccureconnector/ilshook.h
===================================================================
--- trunk/addons/ccure/pre9000/ilsccureconnector/ilshook.h 2016-05-09 23:12:32 UTC (rev 1457)
+++ branches/1.6/addons/ccure/pre9000/ilsccureconnector/ilshook.h 2016-05-09 23:15:45 UTC (rev 1458)
@@ -1,12 +0,0 @@
-#ifndef ILSHOOK_H
-#define ILSHOOK_H
-
-extern "C" {
-
-__declspec(dllexport) UINT APIENTRY installHook(void);
-__declspec(dllexport) bool APIENTRY uninstallHook(void);
-__declspec(dllexport) LRESULT CALLBACK sysMsgFilter(int, WPARAM, LPARAM);
-//__declspec(dllexport) BOOL CALLBACK readControls(HWND, LPARAM);
-}
-
-#endif
\ No newline at end of file
Copied: branches/1.6/addons/ccure/pre9000/ilsccureconnector/ilshook.h (from rev 1457, trunk/addons/ccure/pre9000/ilsccureconnector/ilshook.h)
===================================================================
--- branches/1.6/addons/ccure/pre9000/ilsccureconnector/ilshook.h (rev 0)
+++ branches/1.6/addons/ccure/pre9000/ilsccureconnector/ilshook.h 2016-05-09 23:15:45 UTC (rev 1458)
@@ -0,0 +1,12 @@
+#ifndef ILSHOOK_H
+#define ILSHOOK_H
+
+extern "C" {
+
+__declspec(dllexport) UINT APIENTRY installHook(void);
+__declspec(dllexport) bool APIENTRY uninstallHook(void);
+__declspec(dllexport) LRESULT CALLBACK sysMsgFilter(int, WPARAM, LPARAM);
+//__declspec(dllexport) BOOL CALLBACK readControls(HWND, LPARAM);
+}
+
+#endif
\ No newline at end of file
Deleted: branches/1.6/addons/ccure/pre9000/ilsccureconnector/multimapwdef.h
===================================================================
--- trunk/addons/ccure/pre9000/ilsccureconnector/multimapwdef.h 2016-05-09 23:12:32 UTC (rev 1457)
+++ branches/1.6/addons/ccure/pre9000/ilsccureconnector/multimapwdef.h 2016-05-09 23:15:45 UTC (rev 1458)
@@ -1,39 +0,0 @@
-#ifndef MULTIMAPWDEF
-#define MULTIMAPWDEF
-
-#include <map>
-
-SWORD_NAMESPACE_START
-
-// multmap that still lets you use [] to reference FIRST
-// entry of a key if multiples exist
-template <class Key, class T, class Compare>
-class multimapwithdefault : public std::multimap<Key, T, Compare> {
-public:
- typedef std::pair<const Key, T> value_type;
- T& getWithDefault(const Key& k, const T& defaultValue) {
- if (find(k) == this->end()) {
- insert(value_type(k, defaultValue));
- }
- return (*(find(k))).second;
- }
-
- T& operator[](const Key& k) {
- if (find(k) == this->end()) {
- insert(value_type(k, T()));
- }
- return (*(find(k))).second;
- }
- bool has(const Key& k, const T &val) const {
- typename std::multimap<Key, T, Compare>::const_iterator start = lower_bound(k);
- typename std::multimap<Key, T, Compare>::const_iterator end = upper_bound(k);
- for (; start!=end; start++) {
- if (start->second == val)
- return true;
- }
- return false;
- }
-};
-
-SWORD_NAMESPACE_END
-#endif
Copied: branches/1.6/addons/ccure/pre9000/ilsccureconnector/multimapwdef.h (from rev 1457, trunk/addons/ccure/pre9000/ilsccureconnector/multimapwdef.h)
===================================================================
--- branches/1.6/addons/ccure/pre9000/ilsccureconnector/multimapwdef.h (rev 0)
+++ branches/1.6/addons/ccure/pre9000/ilsccureconnector/multimapwdef.h 2016-05-09 23:15:45 UTC (rev 1458)
@@ -0,0 +1,39 @@
+#ifndef MULTIMAPWDEF
+#define MULTIMAPWDEF
+
+#include <map>
+
+SWORD_NAMESPACE_START
+
+// multmap that still lets you use [] to reference FIRST
+// entry of a key if multiples exist
+template <class Key, class T, class Compare>
+class multimapwithdefault : public std::multimap<Key, T, Compare> {
+public:
+ typedef std::pair<const Key, T> value_type;
+ T& getWithDefault(const Key& k, const T& defaultValue) {
+ if (find(k) == this->end()) {
+ insert(value_type(k, defaultValue));
+ }
+ return (*(find(k))).second;
+ }
+
+ T& operator[](const Key& k) {
+ if (find(k) == this->end()) {
+ insert(value_type(k, T()));
+ }
+ return (*(find(k))).second;
+ }
+ bool has(const Key& k, const T &val) const {
+ typename std::multimap<Key, T, Compare>::const_iterator start = lower_bound(k);
+ typename std::multimap<Key, T, Compare>::const_iterator end = upper_bound(k);
+ for (; start!=end; start++) {
+ if (start->second == val)
+ return true;
+ }
+ return false;
+ }
+};
+
+SWORD_NAMESPACE_END
+#endif
Deleted: branches/1.6/addons/ccure/pre9000/ilsccureconnector/swbuf.cpp
===================================================================
--- trunk/addons/ccure/pre9000/ilsccureconnector/swbuf.cpp 2016-05-09 23:12:32 UTC (rev 1457)
+++ branches/1.6/addons/ccure/pre9000/ilsccureconnector/swbuf.cpp 2016-05-09 23:15:45 UTC (rev 1458)
@@ -1,168 +0,0 @@
-/******************************************************************************
-* swbuf.cpp - code for SWBuf used as a transport and utility for data buffers
-*
-* $Id: swbuf.cpp 2198 2008-09-11 20:59:30Z scribe $
-*
-* Copyright 2003 CrossWire Bible Society (http://www.crosswire.org)
-* CrossWire Bible Society
-* P. O. Box 2528
-* Tempe, AZ 85280-2528
-*
-* 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 version 2.
-*
-* 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.
-*
-*/
-
-#include "swbuf.h"
-
-#include <stdlib.h>
-#include <stdarg.h>
-#include <stdio.h>
-
-SWORD_NAMESPACE_START
-
-char *SWBuf::nullStr = (char *)"";
-char SWBuf::junkBuf[JUNKBUFSIZE];
-
-/******************************************************************************
-* SWBuf Constructor - Creates an empty SWBuf object or an SWBuf initialized
-* to a value from a const char *
-*
-*/
-SWBuf::SWBuf(const char *initVal, unsigned long initSize) {
- init(initSize);
- if (initVal)
- set(initVal);
-}
-
-/******************************************************************************
-* SWBuf Constructor - Creates an SWBuf initialized
-* to a value from another SWBuf
-*
-*/
-SWBuf::SWBuf(const SWBuf &other, unsigned long initSize) {
- init(initSize);
- set(other);
-}
-
-/******************************************************************************
-* SWBuf Constructor - Creates an SWBuf initialized
-* to a value from a char
-*
-*/
-SWBuf::SWBuf(char initVal, unsigned long initSize) {
- init(initSize+1);
- *buf = initVal;
- end = buf+1;
- *end = 0;
-}
-
-/*
-SWBuf::SWBuf(unsigned long initSize) {
- init(initSize);
- set((const char *)0);
-}
-*/
-
-
-/******************************************************************************
-* SWBuf::setFormatted - sets this buf to a formatted string
-* WARNING: This function can only write at most
-* JUNKBUFSIZE to the string per call.
-*/
-SWBuf &SWBuf::setFormatted(const char *format, ...) {
- va_list argptr;
-
- va_start(argptr, format);
-#ifdef NO_VSNPRINTF
- int len = vsprintf(junkBuf, format, argptr)+1;
-#else
- int len = vsnprintf(0, 0, format, argptr)+1;
-#endif
- va_end(argptr);
- assureSize(len);
- va_start(argptr, format);
- end = vsprintf(buf, format, argptr) + buf;
- va_end(argptr);
- return *this;
-}
-
-/******************************************************************************
-* SWBuf::append - appends a value to the current value of this SWBuf
-*
-*/
-void SWBuf::append(const char *str, long max) {
-// if (!str) //A null string was passed
-// return;
- if (max < 0)
- max = strlen(str);
- assureMore(max+1);
- for (;((max)&&(*str));max--)
- *end++ = *str++;
- *end = 0;
-}
-
-/******************************************************************************
-* SWBuf::setSize - Size this buffer to a specific length
-*/
-void SWBuf::setSize(unsigned long len) {
- assureSize(len+1);
- if ((unsigned)(end - buf) < len)
- memset(end, fillByte, len - (end-buf));
- end = buf + len;
- *end = 0;
-}
-
-/******************************************************************************
-* SWBuf::appendFormatted - appends formatted strings to the current value of this SWBuf
-* WARNING: This function can only write at most
-* JUNKBUFSIZE to the string per call.
-*/
-void SWBuf::appendFormatted(const char *format, ...) {
- va_list argptr;
-
- va_start(argptr, format);
-#ifdef NO_VSNPRINTF
- int len = vsprintf(junkBuf, format, argptr)+1;
-#else
- int len = vsnprintf(0, 0, format, argptr)+1;
-#endif
- va_end(argptr);
- assureMore(len);
- va_start(argptr, format);
- end += vsprintf(end, format, argptr);
- va_end(argptr);
-}
-
-void SWBuf::insert(unsigned long pos, const char* str, unsigned long start, signed long max) {
-// if (!str) //A null string was passed
-// return;
-
- str += start;
- int len = (max > -1) ? max : strlen(str);
-
- if (!len || (pos > length())) //nothing to do, return
- return;
-
- // pos==length(), so we can call append in this case
- if (pos == length()) { //append is more efficient
- append(str, max);
- return;
- }
-
- assureMore( len );
-
- memmove(buf + pos + len, buf + pos, (end - buf) - pos); //make a gap of "len" bytes
- memcpy(buf+pos, str, len);
-
- end += len;
- *end = 0;
-}
-
-SWORD_NAMESPACE_END
Copied: branches/1.6/addons/ccure/pre9000/ilsccureconnector/swbuf.cpp (from rev 1457, trunk/addons/ccure/pre9000/ilsccureconnector/swbuf.cpp)
===================================================================
--- branches/1.6/addons/ccure/pre9000/ilsccureconnector/swbuf.cpp (rev 0)
+++ branches/1.6/addons/ccure/pre9000/ilsccureconnector/swbuf.cpp 2016-05-09 23:15:45 UTC (rev 1458)
@@ -0,0 +1,168 @@
+/******************************************************************************
+* swbuf.cpp - code for SWBuf used as a transport and utility for data buffers
+*
+* $Id: swbuf.cpp 2198 2008-09-11 20:59:30Z scribe $
+*
+* Copyright 2003 CrossWire Bible Society (http://www.crosswire.org)
+* CrossWire Bible Society
+* P. O. Box 2528
+* Tempe, AZ 85280-2528
+*
+* 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 version 2.
+*
+* 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.
+*
+*/
+
+#include "swbuf.h"
+
+#include <stdlib.h>
+#include <stdarg.h>
+#include <stdio.h>
+
+SWORD_NAMESPACE_START
+
+char *SWBuf::nullStr = (char *)"";
+char SWBuf::junkBuf[JUNKBUFSIZE];
+
+/******************************************************************************
+* SWBuf Constructor - Creates an empty SWBuf object or an SWBuf initialized
+* to a value from a const char *
+*
+*/
+SWBuf::SWBuf(const char *initVal, unsigned long initSize) {
+ init(initSize);
+ if (initVal)
+ set(initVal);
+}
+
+/******************************************************************************
+* SWBuf Constructor - Creates an SWBuf initialized
+* to a value from another SWBuf
+*
+*/
+SWBuf::SWBuf(const SWBuf &other, unsigned long initSize) {
+ init(initSize);
+ set(other);
+}
+
+/******************************************************************************
+* SWBuf Constructor - Creates an SWBuf initialized
+* to a value from a char
+*
+*/
+SWBuf::SWBuf(char initVal, unsigned long initSize) {
+ init(initSize+1);
+ *buf = initVal;
+ end = buf+1;
+ *end = 0;
+}
+
+/*
+SWBuf::SWBuf(unsigned long initSize) {
+ init(initSize);
+ set((const char *)0);
+}
+*/
+
+
+/******************************************************************************
+* SWBuf::setFormatted - sets this buf to a formatted string
+* WARNING: This function can only write at most
+* JUNKBUFSIZE to the string per call.
+*/
+SWBuf &SWBuf::setFormatted(const char *format, ...) {
+ va_list argptr;
+
+ va_start(argptr, format);
+#ifdef NO_VSNPRINTF
+ int len = vsprintf(junkBuf, format, argptr)+1;
+#else
+ int len = vsnprintf(0, 0, format, argptr)+1;
+#endif
+ va_end(argptr);
+ assureSize(len);
+ va_start(argptr, format);
+ end = vsprintf(buf, format, argptr) + buf;
+ va_end(argptr);
+ return *this;
+}
+
+/******************************************************************************
+* SWBuf::append - appends a value to the current value of this SWBuf
+*
+*/
+void SWBuf::append(const char *str, long max) {
+// if (!str) //A null string was passed
+// return;
+ if (max < 0)
+ max = strlen(str);
+ assureMore(max+1);
+ for (;((max)&&(*str));max--)
+ *end++ = *str++;
+ *end = 0;
+}
+
+/******************************************************************************
+* SWBuf::setSize - Size this buffer to a specific length
+*/
+void SWBuf::setSize(unsigned long len) {
+ assureSize(len+1);
+ if ((unsigned)(end - buf) < len)
+ memset(end, fillByte, len - (end-buf));
+ end = buf + len;
+ *end = 0;
+}
+
+/******************************************************************************
+* SWBuf::appendFormatted - appends formatted strings to the current value of this SWBuf
+* WARNING: This function can only write at most
+* JUNKBUFSIZE to the string per call.
+*/
+void SWBuf::appendFormatted(const char *format, ...) {
+ va_list argptr;
+
+ va_start(argptr, format);
+#ifdef NO_VSNPRINTF
+ int len = vsprintf(junkBuf, format, argptr)+1;
+#else
+ int len = vsnprintf(0, 0, format, argptr)+1;
+#endif
+ va_end(argptr);
+ assureMore(len);
+ va_start(argptr, format);
+ end += vsprintf(end, format, argptr);
+ va_end(argptr);
+}
+
+void SWBuf::insert(unsigned long pos, const char* str, unsigned long start, signed long max) {
+// if (!str) //A null string was passed
+// return;
+
+ str += start;
+ int len = (max > -1) ? max : strlen(str);
+
+ if (!len || (pos > length())) //nothing to do, return
+ return;
+
+ // pos==length(), so we can call append in this case
+ if (pos == length()) { //append is more efficient
+ append(str, max);
+ return;
+ }
+
+ assureMore( len );
+
+ memmove(buf + pos + len, buf + pos, (end - buf) - pos); //make a gap of "len" bytes
+ memcpy(buf+pos, str, len);
+
+ end += len;
+ *end = 0;
+}
+
+SWORD_NAMESPACE_END
Deleted: branches/1.6/addons/ccure/pre9000/ilsccureconnector/swbuf.h
===================================================================
--- trunk/addons/ccure/pre9000/ilsccureconnector/swbuf.h 2016-05-09 23:12:32 UTC (rev 1457)
+++ branches/1.6/addons/ccure/pre9000/ilsccureconnector/swbuf.h 2016-05-09 23:15:45 UTC (rev 1458)
@@ -1,436 +0,0 @@
-/******************************************************************************
-* swbuf.h - code for SWBuf used as a transport and utility for data buffers
-*
-* $Id: swbuf.h 2378 2009-05-04 23:18:51Z scribe $
-*
-* Copyright 2003 CrossWire Bible Society (http://www.crosswire.org)
-* CrossWire Bible Society
-* P. O. Box 2528
-* Tempe, AZ 85280-2528
-*
-* 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 version 2.
-*
-* 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.
-*
-*/
-
-#ifndef SWBUF_H
-#define SWBUF_H
-
-#include "defs.h"
-#include <stdlib.h>
-#include <string.h>
-#ifdef __BORLANDC__
-#include <mem.h>
-#endif
-
-SWORD_NAMESPACE_START
-
-
-#define JUNKBUFSIZE 65534
-
-/**
-* This class is used as a transport and utility for data buffers.
-*
-* @warning This class does not perform pointer validity checks (for speed reasons).
-* Therefore, never try to pass an invalid string (const char* 0) as an argument-
-* it will crash your program. You need to perform the checks yourself!
-*/
-class SWDLLEXPORT SWBuf {
- char *buf;
- char *end;
- char *endAlloc;
- char fillByte;
- unsigned long allocSize;
- static char *nullStr;
- static char junkBuf[JUNKBUFSIZE];
-
- inline void assureMore(size_t pastEnd) {
- if (size_t(endAlloc-end) < pastEnd) {
- assureSize(allocSize + pastEnd);
- }
- }
-
- inline void assureSize(size_t checkSize) {
- if (checkSize > allocSize) {
- long size = (end - buf);
- checkSize += 128;
- buf = (char *)((allocSize) ? realloc(buf, checkSize) : malloc(checkSize));
- allocSize = checkSize;
- end = (buf + size);
- *end = 0;
- endAlloc = buf + allocSize - 1;
- }
- }
-
- inline void init(size_t initSize) {
- fillByte = ' ';
- allocSize = 0;
- buf = nullStr;
- end = buf;
- endAlloc = buf;
- if (initSize)
- assureSize(initSize);
- }
-
-
-public:
-
- /******************************************************************************
- * SWBuf Constructor - Creates an empty SWBuf object
- *
- */
- inline SWBuf() {
- init(0);
- }
-
- /**
- * SWBuf Constructor - Creates an SWBuf initialized
- * to a value from a const char *
- *
- */
- SWBuf(const char *initVal, unsigned long initSize = 0);
-// SWBuf(unsigned long initSize);
-
- /**
- * SWBuf Constructor - Creates an SWBuf initialized
- * to a value from a char
- *
- */
- SWBuf(char initVal, unsigned long initSize = 0);
-
- /**
- * SWBuf Constructor - Creates an SWBuf initialized
- * to a value from another SWBuf
- *
- */
- SWBuf(const SWBuf &other, unsigned long initSize = 0);
-
- /******************************************************************************
- * SWBuf Destructor - Cleans up instance of SWBuf
- */
- inline ~SWBuf() {
- if ((buf) && (buf != nullStr))
- free(buf);
- }
-
- /**
- * SWBuf::setFillByte - Set the fillByte character
- *
- * @param ch This character is used when the SWBuf is (re)sized.
- * The memory will be filled with this character. \see setSize() \see resize()
- */
- inline void setFillByte(char ch) { fillByte = ch; }
-
- /**
- * SWBuf::getFillByte - Get the fillByte character
- *
- * @return The character used for filling memory. \see setFillByte.
- */
- inline char getFillByte() { return fillByte; }
-
- /**
- * @return a pointer to the buffer content (null-terminated string)
- */
- inline const char *c_str() const{ return buf; }
-
- /**
- * @param pos The position of the requested character.
- * @return The character at the specified position
- */
- inline char &charAt(unsigned long pos) { return ((pos <= (unsigned long)(end - buf)) ? buf[pos] : ((*junkBuf=0),*junkBuf)); }
-
- /**
- * @return size() and length() return only the number of characters of the string.
- * Add one for the following null and one for each char to be appended!
- */
- inline unsigned long size() const { return length(); }
-
- /**
- * set's the size of the buffer. This is a quick inline method which checks
- * for changes before actually calling setSize().
- * @param newSize new size of the buffer
- */
- inline void size(unsigned long newSize) { if (end - buf - newSize) setSize(newSize); }
-
- /**
- * @return size() and length() return only the number of characters of the string.
- */
- inline unsigned long length() const { return end - buf; }
-
- /**
- * SWBuf::set - sets this buf to a new value
- * If the allocated memory is bigger than the new string, it will NOT be resized.
- * @param newVal the value to set this buffer to.
- */
- inline void set(const SWBuf &newVal) {
- unsigned long len = newVal.length() + 1;
- assureSize(len);
-// const char *n = newVal.c_str();
-// for (end = buf;len;len--) *end++ = *n++;
- memcpy(buf, newVal.c_str(), len);
- end = buf + (len - 1);
- }
-
- /**
- * SWBuf::set - sets this buf to a new value.
- * If the allocated memory is bigger than the new string, it will NOT be resized.
- * @param newVal the value to set this buffer to.
- */
- inline void set(const char *newVal) {
- if (newVal) {
- unsigned long len = strlen(newVal) + 1;
- assureSize(len);
- memcpy(buf, newVal, len);
- end = buf + (len - 1);
- }
- else {
- assureSize(1);
- end = buf;
- *end = 0;
- }
- }
-
- /**
- * SWBuf::setFormatted - sets this buf to a formatted string.
- * If the allocated memory is bigger than the new string, it will NOT be resized.
- *
- * @warning This function can only write at most JUNKBUFSIZE to the string per call.
- *
- * @warning This function is not very fast. For loops with many iterations you might
- * consider replacing it by other calls.
- * Example:
- * \code SWBuf buf.setFormatted("<%s>", stringVal); \endcode
- * should be replaced by:
- * \code buf.set("<"); buf.append(stringVal); buf.append(">"); \endcode
- * This will produce much faster results.
- *
- * @param format The format string. Same syntax as printf, for example.
- * @param ... Add all arguments here.
- */
- SWBuf &setFormatted(const char *format, ...);
-
- /**
- * SWBuf::setSize - Size this buffer to a specific length.
- * @param len The new size of the buffer. One byte for the null will be added.
- */
- void setSize(unsigned long len);
- /**
- * SWBuf::resize - Resize this buffer to a specific length.
- * @param len The new size of the buffer. One byte for the null will be added.
- */
- inline void resize(unsigned long len) { setSize(len); }
-
- /**
- * SWBuf::append - appends a value to the current value of this SWBuf.
- * If the allocated memory is not enough, it will be resized accordingly.
- * @param str Append this.
- * @param max Append only max chars.
- */
- void append(const char *str, long max = -1);
-
- /**
- * SWBuf::append - appends a value to the current value of this SWBuf
- * If the allocated memory is not enough, it will be resized accordingly.
- * @param str Append this.
- * @param max Append only max chars.
- */
- inline void append(const SWBuf &str, long max = -1) { append(str.c_str(), max); }
-
- /**
- * SWBuf::append - appends a value to the current value of this SWBuf
- * If the allocated memory is not enough, it will be resized accordingly.
- * @param ch Append this.
- */
- inline void append(char ch) {
- assureMore(1);
- *end++ = ch;
- *end = 0;
- }
-
- /**
- * SWBuf::appendFormatted - appends formatted strings to the current value of this SWBuf.
- *
- * @warning This function can only write at most JUNKBUFSIZE to the string per call.
- *
- * @warning This function is not very fast. For loops with many iterations you might
- * consider replacing it by other calls.
- * Example:
- * \code SWBuf buf.appendFormatted("<%s>", stringVal); \endcode
- * should be replaced by:
- * \code buf.append("<"); buf.append(stringVal); buf.append(">"); \endcode
- * This will produce much faster results.
- *
- * @param format The format string. Same syntax as printf, for example.
- * @param ... Add all arguments here.
- */
- void appendFormatted(const char *format, ...);
-
- /**
- * SWBuf::insert - inserts the given string at position into this string
- * @param pos The position where to insert. pos=0 inserts at the beginning, pos=1 after the first char, etc. Using pos=length() is the same as calling append(s)
- * @param str string to be inserted
- * @param start start from this position in the string to be inserted
- * @param max Insert only max chars.
- */
- void insert(unsigned long pos, const char* str, unsigned long start = 0, signed long max = -1);
-
- /**
- * SWBuf::insert - inserts the given string at position into this string
- * @param pos The position where to insert. pos=0 inserts at the beginning, pos=1 after the first char, etc. Using pos=length() is the same as calling append(s)
- * @param str string to be inserted
- * @param start start from this position in the string to be inserted
- * @param max Insert only max chars.
- */
- inline void insert(unsigned long pos, const SWBuf &str, unsigned long start = 0, signed long max = -1) {
- insert(pos, str.c_str(), start, max);
- };
-
- /**
- * SWBuf::insert - inserts the given character at position into this string
- * @param pos The position where to insert. pos=0 inserts at the beginning, pos=1 after the first char, etc. Using pos=length() is the same as calling append(s)
- * @param c Insert this.
- */
- inline void insert(unsigned long pos, char c) {
- insert(pos, SWBuf(c));
- }
-
- /** SWBuf::getRawData
- *
- * @warning be careful! Probably setSize needs to be called in conjunction before and maybe after
- *
- * @return Pointer to the allocated memory of the SWBuf.
- */
- inline char *getRawData() { return buf; }
-
- inline operator const char *() const { return c_str(); }
- inline char &operator[](unsigned long pos) { return charAt(pos); }
- inline char &operator[](long pos) { return charAt((unsigned long)pos); }
- inline char &operator[](unsigned int pos) { return charAt((unsigned long)pos); }
- inline char &operator[](int pos) { return charAt((unsigned long)pos); }
- inline SWBuf &operator =(const char *newVal) { set(newVal); return *this; }
- inline SWBuf &operator =(const SWBuf &other) { set(other); return *this; }
- inline SWBuf &operator +=(const char *str) { append(str); return *this; }
- inline SWBuf &operator +=(char ch) { append(ch); return *this; }
-
- /**
- * Decrease the buffer size, discarding the last characters
- * @param len how many bytes to decrease the buffer size
- */
- inline SWBuf &operator -=(unsigned long len) { setSize(length()-len); return *this; }
-
- /**
- * Decrease the buffer size, discarding the last character
- */
- inline SWBuf &operator --(int) { operator -=(1); return *this; }
-
- /**
- * Shift the buffer to the left, discarding the first bytes, decreasing the buffer size
- */
- inline SWBuf &operator <<(unsigned long n) { if (n && length()) { n = (n<=length())?n:(length()-1); memmove(buf, buf+n, length()-n); (*this)-=n; } return *this; }
-
- /**
- * Shift the buffer to the right, increasing the buffer size
- */
- inline SWBuf &operator >>(unsigned long n) { setSize(length()+n); memmove(buf+n, buf, length()-n); return *this; }
-
- /**
- * Concatenate another buffer to the end of this buffer
- */
- inline SWBuf operator +(const SWBuf &other) const {
- SWBuf retVal = buf;
- retVal += other;
- return retVal;
- }
-
- /**
- * Concatenate a byte to the end of this buffer
- */
- inline SWBuf operator +(char ch) const { return (*this) + SWBuf(ch); }
-
- /**
- * Trim whitespace from the start of this buffer, shifting the buffer left as necessary
- */
- inline SWBuf &trimStart() { while (size() && (strchr("\t\r\n ", *(buf)))) *this << 1; return *this; }
-
- /**
- * Trim whitespace from the end of this buffer, decreasing the size as necessary
- */
- inline SWBuf &trimEnd() { while (size() && (strchr("\t\r\n ", *(end-1)))) setSize(size()-1); return *this; }
-
- /**
- * Trim whitespace from the start and end of this buffer, shifting left and decreasing size as necessary
- */
- inline SWBuf &trim() { trimStart(); return trimEnd(); }
-
-
- /**
- * Strip a prefix from this buffer up to a separator byte.
- * Returns the prefix and modifies this buffer, shifting left to remove prefix
- * @param separator to use (e.g. ':')
- * @param endOfStringAsSeparator - also count end of string as separator.
- * this is useful for tokenizing entire string like:
- * x|y|z
- * if true it will also include 'z'.
- *
- * @return prefix if separator character found; otherwise, null and leaves buffer unmodified
- */
- inline const char *stripPrefix(char separator, bool endOfStringAsSeparator = false) { const char *m = strchr(buf, separator); if (!m && endOfStringAsSeparator) { if (*buf) { operator >>(1); *buf=0; end = buf; return buf + 1;} else return buf; } if (m) { int len = m-buf; char *hold = new char[len]; memcpy(hold, buf, len); *this << (len+1); memcpy(end+1, hold, len); delete [] hold; end[len+1] = 0; } return (m) ? end+1 : 0; } // safe. we know we don't actually realloc and shrink buffer when shifting, so we can place our return val at end.
-
- // this could be nicer, like replacing a contiguous series of target bytes with single replacement; offering replacement const char *
- /**
- * Replace with a new byte value all occurances in this buffer of any byte value specified in a set
- * @param targets a set of bytes, any of which will be replaced
- * @param newByte value to use as replacement.
- *
- * Example: replaceBytes("abc", 'z'); // replaces all occurances of 'a', 'b', and 'c' with 'z'
- */
- inline SWBuf &replaceBytes(const char *targets, char newByte) { for (unsigned int i = 0; (i < size()); i++) { if (strchr(targets, buf[i])) buf[i] = newByte; } return *this; }
-
- /**
- * @return returns true if this buffer starts with the specified prefix
- */
- inline bool startsWith(const SWBuf &prefix) const { return !strncmp(c_str(), prefix.c_str(), prefix.size()); }
-
- /**
- * @return returns true if this buffer ends with the specified postfix
- */
- inline bool endsWith(const SWBuf &postfix) const { return (size() >= postfix.size())?!strncmp(end-postfix.size(), postfix.c_str(), postfix.size()):false; }
-
- inline int compare(const SWBuf &other) const { return strcmp(c_str(), other.c_str()); }
- inline bool operator ==(const SWBuf &other) const { return compare(other) == 0; }
- inline bool operator !=(const SWBuf &other) const { return compare(other) != 0; }
- inline bool operator > (const SWBuf &other) const { return compare(other) > 0; }
- inline bool operator < (const SWBuf &other) const { return compare(other) < 0; }
- inline bool operator <=(const SWBuf &other) const { return compare(other) <= 0; }
- inline bool operator >=(const SWBuf &other) const { return compare(other) >= 0; }
-
- /**
- * @return returns true if this buffer starts with the specified prefix
- */
- inline bool startsWith(const char *prefix) const { return !strncmp(c_str(), prefix, strlen(prefix)); }
-
- /**
- * @return returns true if this buffer ends with the specified postfix
- */
- inline bool endsWith(const char *postfix) const { unsigned int psize = strlen(postfix); return (size() >= psize)?!strncmp(end-psize, postfix, psize):false; }
-
- // be sure we've been given a valid pointer to compare. If not, we return !=; specifically less-than, for lack of better options
- inline int compare(const char *other) const { return (other?strcmp(c_str(), other):-1); }
- inline bool operator ==(const char *other) const { return compare(other) == 0; }
- inline bool operator !=(const char *other) const { return compare(other) != 0; }
- inline bool operator > (const char *other) const { return other && compare(other) > 0; }
- inline bool operator < (const char *other) const { return other && compare(other) < 0; }
- inline bool operator <=(const char *other) const { return other && compare(other) <= 0; }
- inline bool operator >=(const char *other) const { return other && compare(other) >= 0; }
-};
-
-
-
-SWORD_NAMESPACE_END
-#endif
Copied: branches/1.6/addons/ccure/pre9000/ilsccureconnector/swbuf.h (from rev 1457, trunk/addons/ccure/pre9000/ilsccureconnector/swbuf.h)
===================================================================
--- branches/1.6/addons/ccure/pre9000/ilsccureconnector/swbuf.h (rev 0)
+++ branches/1.6/addons/ccure/pre9000/ilsccureconnector/swbuf.h 2016-05-09 23:15:45 UTC (rev 1458)
@@ -0,0 +1,436 @@
+/******************************************************************************
+* swbuf.h - code for SWBuf used as a transport and utility for data buffers
+*
+* $Id: swbuf.h 2378 2009-05-04 23:18:51Z scribe $
+*
+* Copyright 2003 CrossWire Bible Society (http://www.crosswire.org)
+* CrossWire Bible Society
+* P. O. Box 2528
+* Tempe, AZ 85280-2528
+*
+* 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 version 2.
+*
+* 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.
+*
+*/
+
+#ifndef SWBUF_H
+#define SWBUF_H
+
+#include "defs.h"
+#include <stdlib.h>
+#include <string.h>
+#ifdef __BORLANDC__
+#include <mem.h>
+#endif
+
+SWORD_NAMESPACE_START
+
+
+#define JUNKBUFSIZE 65534
+
+/**
+* This class is used as a transport and utility for data buffers.
+*
+* @warning This class does not perform pointer validity checks (for speed reasons).
+* Therefore, never try to pass an invalid string (const char* 0) as an argument-
+* it will crash your program. You need to perform the checks yourself!
+*/
+class SWDLLEXPORT SWBuf {
+ char *buf;
+ char *end;
+ char *endAlloc;
+ char fillByte;
+ unsigned long allocSize;
+ static char *nullStr;
+ static char junkBuf[JUNKBUFSIZE];
+
+ inline void assureMore(size_t pastEnd) {
+ if (size_t(endAlloc-end) < pastEnd) {
+ assureSize(allocSize + pastEnd);
+ }
+ }
+
+ inline void assureSize(size_t checkSize) {
+ if (checkSize > allocSize) {
+ long size = (end - buf);
+ checkSize += 128;
+ buf = (char *)((allocSize) ? realloc(buf, checkSize) : malloc(checkSize));
+ allocSize = checkSize;
+ end = (buf + size);
+ *end = 0;
+ endAlloc = buf + allocSize - 1;
+ }
+ }
+
+ inline void init(size_t initSize) {
+ fillByte = ' ';
+ allocSize = 0;
+ buf = nullStr;
+ end = buf;
+ endAlloc = buf;
+ if (initSize)
+ assureSize(initSize);
+ }
+
+
+public:
+
+ /******************************************************************************
+ * SWBuf Constructor - Creates an empty SWBuf object
+ *
+ */
+ inline SWBuf() {
+ init(0);
+ }
+
+ /**
+ * SWBuf Constructor - Creates an SWBuf initialized
+ * to a value from a const char *
+ *
+ */
+ SWBuf(const char *initVal, unsigned long initSize = 0);
+// SWBuf(unsigned long initSize);
+
+ /**
+ * SWBuf Constructor - Creates an SWBuf initialized
+ * to a value from a char
+ *
+ */
+ SWBuf(char initVal, unsigned long initSize = 0);
+
+ /**
+ * SWBuf Constructor - Creates an SWBuf initialized
+ * to a value from another SWBuf
+ *
+ */
+ SWBuf(const SWBuf &other, unsigned long initSize = 0);
+
+ /******************************************************************************
+ * SWBuf Destructor - Cleans up instance of SWBuf
+ */
+ inline ~SWBuf() {
+ if ((buf) && (buf != nullStr))
+ free(buf);
+ }
+
+ /**
+ * SWBuf::setFillByte - Set the fillByte character
+ *
+ * @param ch This character is used when the SWBuf is (re)sized.
+ * The memory will be filled with this character. \see setSize() \see resize()
+ */
+ inline void setFillByte(char ch) { fillByte = ch; }
+
+ /**
+ * SWBuf::getFillByte - Get the fillByte character
+ *
+ * @return The character used for filling memory. \see setFillByte.
+ */
+ inline char getFillByte() { return fillByte; }
+
+ /**
+ * @return a pointer to the buffer content (null-terminated string)
+ */
+ inline const char *c_str() const{ return buf; }
+
+ /**
+ * @param pos The position of the requested character.
+ * @return The character at the specified position
+ */
+ inline char &charAt(unsigned long pos) { return ((pos <= (unsigned long)(end - buf)) ? buf[pos] : ((*junkBuf=0),*junkBuf)); }
+
+ /**
+ * @return size() and length() return only the number of characters of the string.
+ * Add one for the following null and one for each char to be appended!
+ */
+ inline unsigned long size() const { return length(); }
+
+ /**
+ * set's the size of the buffer. This is a quick inline method which checks
+ * for changes before actually calling setSize().
+ * @param newSize new size of the buffer
+ */
+ inline void size(unsigned long newSize) { if (end - buf - newSize) setSize(newSize); }
+
+ /**
+ * @return size() and length() return only the number of characters of the string.
+ */
+ inline unsigned long length() const { return end - buf; }
+
+ /**
+ * SWBuf::set - sets this buf to a new value
+ * If the allocated memory is bigger than the new string, it will NOT be resized.
+ * @param newVal the value to set this buffer to.
+ */
+ inline void set(const SWBuf &newVal) {
+ unsigned long len = newVal.length() + 1;
+ assureSize(len);
+// const char *n = newVal.c_str();
+// for (end = buf;len;len--) *end++ = *n++;
+ memcpy(buf, newVal.c_str(), len);
+ end = buf + (len - 1);
+ }
+
+ /**
+ * SWBuf::set - sets this buf to a new value.
+ * If the allocated memory is bigger than the new string, it will NOT be resized.
+ * @param newVal the value to set this buffer to.
+ */
+ inline void set(const char *newVal) {
+ if (newVal) {
+ unsigned long len = strlen(newVal) + 1;
+ assureSize(len);
+ memcpy(buf, newVal, len);
+ end = buf + (len - 1);
+ }
+ else {
+ assureSize(1);
+ end = buf;
+ *end = 0;
+ }
+ }
+
+ /**
+ * SWBuf::setFormatted - sets this buf to a formatted string.
+ * If the allocated memory is bigger than the new string, it will NOT be resized.
+ *
+ * @warning This function can only write at most JUNKBUFSIZE to the string per call.
+ *
+ * @warning This function is not very fast. For loops with many iterations you might
+ * consider replacing it by other calls.
+ * Example:
+ * \code SWBuf buf.setFormatted("<%s>", stringVal); \endcode
+ * should be replaced by:
+ * \code buf.set("<"); buf.append(stringVal); buf.append(">"); \endcode
+ * This will produce much faster results.
+ *
+ * @param format The format string. Same syntax as printf, for example.
+ * @param ... Add all arguments here.
+ */
+ SWBuf &setFormatted(const char *format, ...);
+
+ /**
+ * SWBuf::setSize - Size this buffer to a specific length.
+ * @param len The new size of the buffer. One byte for the null will be added.
+ */
+ void setSize(unsigned long len);
+ /**
+ * SWBuf::resize - Resize this buffer to a specific length.
+ * @param len The new size of the buffer. One byte for the null will be added.
+ */
+ inline void resize(unsigned long len) { setSize(len); }
+
+ /**
+ * SWBuf::append - appends a value to the current value of this SWBuf.
+ * If the allocated memory is not enough, it will be resized accordingly.
+ * @param str Append this.
+ * @param max Append only max chars.
+ */
+ void append(const char *str, long max = -1);
+
+ /**
+ * SWBuf::append - appends a value to the current value of this SWBuf
+ * If the allocated memory is not enough, it will be resized accordingly.
+ * @param str Append this.
+ * @param max Append only max chars.
+ */
+ inline void append(const SWBuf &str, long max = -1) { append(str.c_str(), max); }
+
+ /**
+ * SWBuf::append - appends a value to the current value of this SWBuf
+ * If the allocated memory is not enough, it will be resized accordingly.
+ * @param ch Append this.
+ */
+ inline void append(char ch) {
+ assureMore(1);
+ *end++ = ch;
+ *end = 0;
+ }
+
+ /**
+ * SWBuf::appendFormatted - appends formatted strings to the current value of this SWBuf.
+ *
+ * @warning This function can only write at most JUNKBUFSIZE to the string per call.
+ *
+ * @warning This function is not very fast. For loops with many iterations you might
+ * consider replacing it by other calls.
+ * Example:
+ * \code SWBuf buf.appendFormatted("<%s>", stringVal); \endcode
+ * should be replaced by:
+ * \code buf.append("<"); buf.append(stringVal); buf.append(">"); \endcode
+ * This will produce much faster results.
+ *
+ * @param format The format string. Same syntax as printf, for example.
+ * @param ... Add all arguments here.
+ */
+ void appendFormatted(const char *format, ...);
+
+ /**
+ * SWBuf::insert - inserts the given string at position into this string
+ * @param pos The position where to insert. pos=0 inserts at the beginning, pos=1 after the first char, etc. Using pos=length() is the same as calling append(s)
+ * @param str string to be inserted
+ * @param start start from this position in the string to be inserted
+ * @param max Insert only max chars.
+ */
+ void insert(unsigned long pos, const char* str, unsigned long start = 0, signed long max = -1);
+
+ /**
+ * SWBuf::insert - inserts the given string at position into this string
+ * @param pos The position where to insert. pos=0 inserts at the beginning, pos=1 after the first char, etc. Using pos=length() is the same as calling append(s)
+ * @param str string to be inserted
+ * @param start start from this position in the string to be inserted
+ * @param max Insert only max chars.
+ */
+ inline void insert(unsigned long pos, const SWBuf &str, unsigned long start = 0, signed long max = -1) {
+ insert(pos, str.c_str(), start, max);
+ };
+
+ /**
+ * SWBuf::insert - inserts the given character at position into this string
+ * @param pos The position where to insert. pos=0 inserts at the beginning, pos=1 after the first char, etc. Using pos=length() is the same as calling append(s)
+ * @param c Insert this.
+ */
+ inline void insert(unsigned long pos, char c) {
+ insert(pos, SWBuf(c));
+ }
+
+ /** SWBuf::getRawData
+ *
+ * @warning be careful! Probably setSize needs to be called in conjunction before and maybe after
+ *
+ * @return Pointer to the allocated memory of the SWBuf.
+ */
+ inline char *getRawData() { return buf; }
+
+ inline operator const char *() const { return c_str(); }
+ inline char &operator[](unsigned long pos) { return charAt(pos); }
+ inline char &operator[](long pos) { return charAt((unsigned long)pos); }
+ inline char &operator[](unsigned int pos) { return charAt((unsigned long)pos); }
+ inline char &operator[](int pos) { return charAt((unsigned long)pos); }
+ inline SWBuf &operator =(const char *newVal) { set(newVal); return *this; }
+ inline SWBuf &operator =(const SWBuf &other) { set(other); return *this; }
+ inline SWBuf &operator +=(const char *str) { append(str); return *this; }
+ inline SWBuf &operator +=(char ch) { append(ch); return *this; }
+
+ /**
+ * Decrease the buffer size, discarding the last characters
+ * @param len how many bytes to decrease the buffer size
+ */
+ inline SWBuf &operator -=(unsigned long len) { setSize(length()-len); return *this; }
+
+ /**
+ * Decrease the buffer size, discarding the last character
+ */
+ inline SWBuf &operator --(int) { operator -=(1); return *this; }
+
+ /**
+ * Shift the buffer to the left, discarding the first bytes, decreasing the buffer size
+ */
+ inline SWBuf &operator <<(unsigned long n) { if (n && length()) { n = (n<=length())?n:(length()-1); memmove(buf, buf+n, length()-n); (*this)-=n; } return *this; }
+
+ /**
+ * Shift the buffer to the right, increasing the buffer size
+ */
+ inline SWBuf &operator >>(unsigned long n) { setSize(length()+n); memmove(buf+n, buf, length()-n); return *this; }
+
+ /**
+ * Concatenate another buffer to the end of this buffer
+ */
+ inline SWBuf operator +(const SWBuf &other) const {
+ SWBuf retVal = buf;
+ retVal += other;
+ return retVal;
+ }
+
+ /**
+ * Concatenate a byte to the end of this buffer
+ */
+ inline SWBuf operator +(char ch) const { return (*this) + SWBuf(ch); }
+
+ /**
+ * Trim whitespace from the start of this buffer, shifting the buffer left as necessary
+ */
+ inline SWBuf &trimStart() { while (size() && (strchr("\t\r\n ", *(buf)))) *this << 1; return *this; }
+
+ /**
+ * Trim whitespace from the end of this buffer, decreasing the size as necessary
+ */
+ inline SWBuf &trimEnd() { while (size() && (strchr("\t\r\n ", *(end-1)))) setSize(size()-1); return *this; }
+
+ /**
+ * Trim whitespace from the start and end of this buffer, shifting left and decreasing size as necessary
+ */
+ inline SWBuf &trim() { trimStart(); return trimEnd(); }
+
+
+ /**
+ * Strip a prefix from this buffer up to a separator byte.
+ * Returns the prefix and modifies this buffer, shifting left to remove prefix
+ * @param separator to use (e.g. ':')
+ * @param endOfStringAsSeparator - also count end of string as separator.
+ * this is useful for tokenizing entire string like:
+ * x|y|z
+ * if true it will also include 'z'.
+ *
+ * @return prefix if separator character found; otherwise, null and leaves buffer unmodified
+ */
+ inline const char *stripPrefix(char separator, bool endOfStringAsSeparator = false) { const char *m = strchr(buf, separator); if (!m && endOfStringAsSeparator) { if (*buf) { operator >>(1); *buf=0; end = buf; return buf + 1;} else return buf; } if (m) { int len = m-buf; char *hold = new char[len]; memcpy(hold, buf, len); *this << (len+1); memcpy(end+1, hold, len); delete [] hold; end[len+1] = 0; } return (m) ? end+1 : 0; } // safe. we know we don't actually realloc and shrink buffer when shifting, so we can place our return val at end.
+
+ // this could be nicer, like replacing a contiguous series of target bytes with single replacement; offering replacement const char *
+ /**
+ * Replace with a new byte value all occurances in this buffer of any byte value specified in a set
+ * @param targets a set of bytes, any of which will be replaced
+ * @param newByte value to use as replacement.
+ *
+ * Example: replaceBytes("abc", 'z'); // replaces all occurances of 'a', 'b', and 'c' with 'z'
+ */
+ inline SWBuf &replaceBytes(const char *targets, char newByte) { for (unsigned int i = 0; (i < size()); i++) { if (strchr(targets, buf[i])) buf[i] = newByte; } return *this; }
+
+ /**
+ * @return returns true if this buffer starts with the specified prefix
+ */
+ inline bool startsWith(const SWBuf &prefix) const { return !strncmp(c_str(), prefix.c_str(), prefix.size()); }
+
+ /**
+ * @return returns true if this buffer ends with the specified postfix
+ */
+ inline bool endsWith(const SWBuf &postfix) const { return (size() >= postfix.size())?!strncmp(end-postfix.size(), postfix.c_str(), postfix.size()):false; }
+
+ inline int compare(const SWBuf &other) const { return strcmp(c_str(), other.c_str()); }
+ inline bool operator ==(const SWBuf &other) const { return compare(other) == 0; }
+ inline bool operator !=(const SWBuf &other) const { return compare(other) != 0; }
+ inline bool operator > (const SWBuf &other) const { return compare(other) > 0; }
+ inline bool operator < (const SWBuf &other) const { return compare(other) < 0; }
+ inline bool operator <=(const SWBuf &other) const { return compare(other) <= 0; }
+ inline bool operator >=(const SWBuf &other) const { return compare(other) >= 0; }
+
+ /**
+ * @return returns true if this buffer starts with the specified prefix
+ */
+ inline bool startsWith(const char *prefix) const { return !strncmp(c_str(), prefix, strlen(prefix)); }
+
+ /**
+ * @return returns true if this buffer ends with the specified postfix
+ */
+ inline bool endsWith(const char *postfix) const { unsigned int psize = strlen(postfix); return (size() >= psize)?!strncmp(end-psize, postfix, psize):false; }
+
+ // be sure we've been given a valid pointer to compare. If not, we return !=; specifically less-than, for lack of better options
+ inline int compare(const char *other) const { return (other?strcmp(c_str(), other):-1); }
+ inline bool operator ==(const char *other) const { return compare(other) == 0; }
+ inline bool operator !=(const char *other) const { return compare(other) != 0; }
+ inline bool operator > (const char *other) const { return other && compare(other) > 0; }
+ inline bool operator < (const char *other) const { return other && compare(other) < 0; }
+ inline bool operator <=(const char *other) const { return other && compare(other) <= 0; }
+ inline bool operator >=(const char *other) const { return other && compare(other) >= 0; }
+};
+
+
+
+SWORD_NAMESPACE_END
+#endif
Deleted: branches/1.6/addons/ccure/pre9000/ilsccureconnector/swcacher.cpp
===================================================================
--- trunk/addons/ccure/pre9000/ilsccureconnector/swcacher.cpp 2016-05-09 23:12:32 UTC (rev 1457)
+++ branches/1.6/addons/ccure/pre9000/ilsccureconnector/swcacher.cpp 2016-05-09 23:15:45 UTC (rev 1458)
@@ -1,47 +0,0 @@
-/******************************************************************************
- * swcacher.h - definition of class SWCacher used to provide an interface for
- * objects that cache and want a standard interface for cleaning up.
- *
- * $Id: swcacher.cpp 1688 2005-01-01 04:42:26Z scribe $
- *
- * Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
- * CrossWire Bible Society
- * P. O. Box 2528
- * Tempe, AZ 85280-2528
- *
- * 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 version 2.
- *
- * 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.
- *
- */
-
-#include "swcacher.h"
-
-SWORD_NAMESPACE_START
-
-
-SWCacher::SWCacher() {
-}
-
-
-SWCacher::~SWCacher() {
-}
-
-
-void SWCacher::flush() {
-}
-
-long SWCacher::resourceConsumption() {
- return 0;
-}
-
-long SWCacher::lastAccess() {
- return 0;
-}
-
-SWORD_NAMESPACE_END
Copied: branches/1.6/addons/ccure/pre9000/ilsccureconnector/swcacher.cpp (from rev 1457, trunk/addons/ccure/pre9000/ilsccureconnector/swcacher.cpp)
===================================================================
--- branches/1.6/addons/ccure/pre9000/ilsccureconnector/swcacher.cpp (rev 0)
+++ branches/1.6/addons/ccure/pre9000/ilsccureconnector/swcacher.cpp 2016-05-09 23:15:45 UTC (rev 1458)
@@ -0,0 +1,47 @@
+/******************************************************************************
+ * swcacher.h - definition of class SWCacher used to provide an interface for
+ * objects that cache and want a standard interface for cleaning up.
+ *
+ * $Id: swcacher.cpp 1688 2005-01-01 04:42:26Z scribe $
+ *
+ * Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
+ * CrossWire Bible Society
+ * P. O. Box 2528
+ * Tempe, AZ 85280-2528
+ *
+ * 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 version 2.
+ *
+ * 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.
+ *
+ */
+
+#include "swcacher.h"
+
+SWORD_NAMESPACE_START
+
+
+SWCacher::SWCacher() {
+}
+
+
+SWCacher::~SWCacher() {
+}
+
+
+void SWCacher::flush() {
+}
+
+long SWCacher::resourceConsumption() {
+ return 0;
+}
+
+long SWCacher::lastAccess() {
+ return 0;
+}
+
+SWORD_NAMESPACE_END
Deleted: branches/1.6/addons/ccure/pre9000/ilsccureconnector/swcacher.h
===================================================================
--- trunk/addons/ccure/pre9000/ilsccureconnector/swcacher.h 2016-05-09 23:12:32 UTC (rev 1457)
+++ branches/1.6/addons/ccure/pre9000/ilsccureconnector/swcacher.h 2016-05-09 23:15:45 UTC (rev 1458)
@@ -1,43 +0,0 @@
-/******************************************************************************
- * swcacher.h - definition of class SWCacher used to provide an interface for
- * objects that cache and want a standard interface for cleaning up.
- *
- * $Id: swcacher.h 1688 2005-01-01 04:42:26Z scribe $
- *
- * Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
- * CrossWire Bible Society
- * P. O. Box 2528
- * Tempe, AZ 85280-2528
- *
- * 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 version 2.
- *
- * 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.
- *
- */
-
-#ifndef SWCACHER_H
-#define SWCACHER_H
-
-#include "defs.h"
-
-SWORD_NAMESPACE_START
-
-/** used to provide an interface for objects that cache and want
- * a standard interface for cleaning up.
- */
-class SWDLLEXPORT SWCacher {
-public:
- SWCacher();
- virtual ~SWCacher();
- virtual void flush();
- virtual long resourceConsumption();
- virtual long lastAccess();
-};
-
-SWORD_NAMESPACE_END
-#endif
Copied: branches/1.6/addons/ccure/pre9000/ilsccureconnector/swcacher.h (from rev 1457, trunk/addons/ccure/pre9000/ilsccureconnector/swcacher.h)
===================================================================
--- branches/1.6/addons/ccure/pre9000/ilsccureconnector/swcacher.h (rev 0)
+++ branches/1.6/addons/ccure/pre9000/ilsccureconnector/swcacher.h 2016-05-09 23:15:45 UTC (rev 1458)
@@ -0,0 +1,43 @@
+/******************************************************************************
+ * swcacher.h - definition of class SWCacher used to provide an interface for
+ * objects that cache and want a standard interface for cleaning up.
+ *
+ * $Id: swcacher.h 1688 2005-01-01 04:42:26Z scribe $
+ *
+ * Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
+ * CrossWire Bible Society
+ * P. O. Box 2528
+ * Tempe, AZ 85280-2528
+ *
+ * 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 version 2.
+ *
+ * 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.
+ *
+ */
+
+#ifndef SWCACHER_H
+#define SWCACHER_H
+
+#include "defs.h"
+
+SWORD_NAMESPACE_START
+
+/** used to provide an interface for objects that cache and want
+ * a standard interface for cleaning up.
+ */
+class SWDLLEXPORT SWCacher {
+public:
+ SWCacher();
+ virtual ~SWCacher();
+ virtual void flush();
+ virtual long resourceConsumption();
+ virtual long lastAccess();
+};
+
+SWORD_NAMESPACE_END
+#endif
Deleted: branches/1.6/addons/ccure/pre9000/ilsccureconnector/swconfig.cpp
===================================================================
--- trunk/addons/ccure/pre9000/ilsccureconnector/swconfig.cpp 2016-05-09 23:12:32 UTC (rev 1457)
+++ branches/1.6/addons/ccure/pre9000/ilsccureconnector/swconfig.cpp 2016-05-09 23:15:45 UTC (rev 1458)
@@ -1,167 +0,0 @@
-/******************************************************************************
- * swconfig.cpp - implementation of Class SWConfig used for saving and
- * retrieval of configuration information
- *
- * $Id: swconfig.cpp 2218 2008-12-23 09:33:38Z scribe $
- *
- * Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
- * CrossWire Bible Society
- * P. O. Box 2528
- * Tempe, AZ 85280-2528
- *
- * 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 version 2.
- *
- * 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.
- *
- */
-
-#include "swconfig.h"
-#include "utilstr.h"
-#include "filemgr.h"
-#include <fcntl.h>
-
-
-SWORD_NAMESPACE_START
-
-SWConfig::SWConfig() {
-}
-
-SWConfig::SWConfig(const char * ifilename) {
- filename = ifilename;
- Load();
-}
-
-
-SWConfig::~SWConfig() {
-}
-
-void SWConfig::Load() {
-
- if (!filename.size()) return; // assert we have a filename
-
- FileDesc *cfile;
- char *buf, *data;
- SWBuf line;
- ConfigEntMap cursect;
- SWBuf sectname;
- bool first = true;
-
- Sections.erase(Sections.begin(), Sections.end());
-
- cfile = FileMgr::getSystemFileMgr()->open(filename.c_str(), FileMgr::RDONLY);
- if (cfile->getFd() > 0) {
- bool goodLine = FileMgr::getLine(cfile, line);
-
- // clean UTF encoding tags at start of file
- while (goodLine && line.length() &&
- ((((unsigned char)line[0]) == 0xEF) ||
- (((unsigned char)line[0]) == 0xBB) ||
- (((unsigned char)line[0]) == 0xBF))) {
- line << 1;
- }
-
- while (goodLine) {
- // ignore commented lines
- if (!line.startsWith("#")) {
- buf = new char [ line.length() + 1 ];
- strcpy(buf, line.c_str());
- if (*strstrip(buf) == '[') {
- if (!first)
- Sections.insert(SectionMap::value_type(sectname, cursect));
- else first = false;
-
- cursect.erase(cursect.begin(), cursect.end());
-
- strtok(buf, "]");
- sectname = buf+1;
- }
- else {
- strtok(buf, "=");
- if ((*buf) && (*buf != '=')) {
- if ((data = strtok(NULL, "")))
- cursect.insert(ConfigEntMap::value_type(buf, strstrip(data)));
- else cursect.insert(ConfigEntMap::value_type(buf, ""));
- }
- }
- delete [] buf;
- }
- goodLine = FileMgr::getLine(cfile, line);
- }
- if (!first)
- Sections.insert(SectionMap::value_type(sectname, cursect));
-
- FileMgr::getSystemFileMgr()->close(cfile);
- }
-}
-
-
-void SWConfig::Save() {
-
- if (!filename.size()) return; // assert we have a filename
-
- FileDesc *cfile;
- SWBuf buf;
- SectionMap::iterator sit;
- ConfigEntMap::iterator entry;
- SWBuf sectname;
-
- cfile = FileMgr::getSystemFileMgr()->open(filename.c_str(), FileMgr::RDWR|FileMgr::CREAT|FileMgr::TRUNC);
- if (cfile->getFd() > 0) {
-
- for (sit = Sections.begin(); sit != Sections.end(); sit++) {
- buf = "\n[";
- buf += (*sit).first.c_str();
- buf += "]\n";
- cfile->write(buf.c_str(), buf.length());
- for (entry = (*sit).second.begin(); entry != (*sit).second.end(); entry++) {
- buf = (*entry).first.c_str();
- buf += "=";
- buf += (*entry).second.c_str();
- buf += "\n";
- cfile->write(buf.c_str(), buf.length());
- }
- }
- buf = "\n";
- cfile->write(buf.c_str(), buf.length());
- FileMgr::getSystemFileMgr()->close(cfile);
- }
-}
-
-
-void SWConfig::augment(SWConfig &addFrom) {
-
- SectionMap::iterator section;
- ConfigEntMap::iterator entry, start, end;
-
- for (section = addFrom.Sections.begin(); section != addFrom.Sections.end(); section++) {
- for (entry = (*section).second.begin(); entry != (*section).second.end(); entry++) {
- start = Sections[section->first].lower_bound(entry->first);
- end = Sections[section->first].upper_bound(entry->first);
- if (start != end) {
- if (((++start) != end)
- || ((++(addFrom.Sections[section->first].lower_bound(entry->first))) != addFrom.Sections[section->first].upper_bound(entry->first))) {
- for (--start; start != end; start++) {
- if (!strcmp(start->second.c_str(), entry->second.c_str()))
- break;
- }
- if (start == end)
- Sections[(*section).first].insert(ConfigEntMap::value_type((*entry).first, (*entry).second));
- }
- else Sections[section->first][entry->first.c_str()] = entry->second.c_str();
- }
- else Sections[section->first][entry->first.c_str()] = entry->second.c_str();
- }
- }
-}
-
-
-ConfigEntMap & SWConfig::operator [] (const char *section) {
- return Sections[section];
-}
-
-SWORD_NAMESPACE_END
Copied: branches/1.6/addons/ccure/pre9000/ilsccureconnector/swconfig.cpp (from rev 1457, trunk/addons/ccure/pre9000/ilsccureconnector/swconfig.cpp)
===================================================================
--- branches/1.6/addons/ccure/pre9000/ilsccureconnector/swconfig.cpp (rev 0)
+++ branches/1.6/addons/ccure/pre9000/ilsccureconnector/swconfig.cpp 2016-05-09 23:15:45 UTC (rev 1458)
@@ -0,0 +1,167 @@
+/******************************************************************************
+ * swconfig.cpp - implementation of Class SWConfig used for saving and
+ * retrieval of configuration information
+ *
+ * $Id: swconfig.cpp 2218 2008-12-23 09:33:38Z scribe $
+ *
+ * Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
+ * CrossWire Bible Society
+ * P. O. Box 2528
+ * Tempe, AZ 85280-2528
+ *
+ * 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 version 2.
+ *
+ * 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.
+ *
+ */
+
+#include "swconfig.h"
+#include "utilstr.h"
+#include "filemgr.h"
+#include <fcntl.h>
+
+
+SWORD_NAMESPACE_START
+
+SWConfig::SWConfig() {
+}
+
+SWConfig::SWConfig(const char * ifilename) {
+ filename = ifilename;
+ Load();
+}
+
+
+SWConfig::~SWConfig() {
+}
+
+void SWConfig::Load() {
+
+ if (!filename.size()) return; // assert we have a filename
+
+ FileDesc *cfile;
+ char *buf, *data;
+ SWBuf line;
+ ConfigEntMap cursect;
+ SWBuf sectname;
+ bool first = true;
+
+ Sections.erase(Sections.begin(), Sections.end());
+
+ cfile = FileMgr::getSystemFileMgr()->open(filename.c_str(), FileMgr::RDONLY);
+ if (cfile->getFd() > 0) {
+ bool goodLine = FileMgr::getLine(cfile, line);
+
+ // clean UTF encoding tags at start of file
+ while (goodLine && line.length() &&
+ ((((unsigned char)line[0]) == 0xEF) ||
+ (((unsigned char)line[0]) == 0xBB) ||
+ (((unsigned char)line[0]) == 0xBF))) {
+ line << 1;
+ }
+
+ while (goodLine) {
+ // ignore commented lines
+ if (!line.startsWith("#")) {
+ buf = new char [ line.length() + 1 ];
+ strcpy(buf, line.c_str());
+ if (*strstrip(buf) == '[') {
+ if (!first)
+ Sections.insert(SectionMap::value_type(sectname, cursect));
+ else first = false;
+
+ cursect.erase(cursect.begin(), cursect.end());
+
+ strtok(buf, "]");
+ sectname = buf+1;
+ }
+ else {
+ strtok(buf, "=");
+ if ((*buf) && (*buf != '=')) {
+ if ((data = strtok(NULL, "")))
+ cursect.insert(ConfigEntMap::value_type(buf, strstrip(data)));
+ else cursect.insert(ConfigEntMap::value_type(buf, ""));
+ }
+ }
+ delete [] buf;
+ }
+ goodLine = FileMgr::getLine(cfile, line);
+ }
+ if (!first)
+ Sections.insert(SectionMap::value_type(sectname, cursect));
+
+ FileMgr::getSystemFileMgr()->close(cfile);
+ }
+}
+
+
+void SWConfig::Save() {
+
+ if (!filename.size()) return; // assert we have a filename
+
+ FileDesc *cfile;
+ SWBuf buf;
+ SectionMap::iterator sit;
+ ConfigEntMap::iterator entry;
+ SWBuf sectname;
+
+ cfile = FileMgr::getSystemFileMgr()->open(filename.c_str(), FileMgr::RDWR|FileMgr::CREAT|FileMgr::TRUNC);
+ if (cfile->getFd() > 0) {
+
+ for (sit = Sections.begin(); sit != Sections.end(); sit++) {
+ buf = "\n[";
+ buf += (*sit).first.c_str();
+ buf += "]\n";
+ cfile->write(buf.c_str(), buf.length());
+ for (entry = (*sit).second.begin(); entry != (*sit).second.end(); entry++) {
+ buf = (*entry).first.c_str();
+ buf += "=";
+ buf += (*entry).second.c_str();
+ buf += "\n";
+ cfile->write(buf.c_str(), buf.length());
+ }
+ }
+ buf = "\n";
+ cfile->write(buf.c_str(), buf.length());
+ FileMgr::getSystemFileMgr()->close(cfile);
+ }
+}
+
+
+void SWConfig::augment(SWConfig &addFrom) {
+
+ SectionMap::iterator section;
+ ConfigEntMap::iterator entry, start, end;
+
+ for (section = addFrom.Sections.begin(); section != addFrom.Sections.end(); section++) {
+ for (entry = (*section).second.begin(); entry != (*section).second.end(); entry++) {
+ start = Sections[section->first].lower_bound(entry->first);
+ end = Sections[section->first].upper_bound(entry->first);
+ if (start != end) {
+ if (((++start) != end)
+ || ((++(addFrom.Sections[section->first].lower_bound(entry->first))) != addFrom.Sections[section->first].upper_bound(entry->first))) {
+ for (--start; start != end; start++) {
+ if (!strcmp(start->second.c_str(), entry->second.c_str()))
+ break;
+ }
+ if (start == end)
+ Sections[(*section).first].insert(ConfigEntMap::value_type((*entry).first, (*entry).second));
+ }
+ else Sections[section->first][entry->first.c_str()] = entry->second.c_str();
+ }
+ else Sections[section->first][entry->first.c_str()] = entry->second.c_str();
+ }
+ }
+}
+
+
+ConfigEntMap & SWConfig::operator [] (const char *section) {
+ return Sections[section];
+}
+
+SWORD_NAMESPACE_END
Deleted: branches/1.6/addons/ccure/pre9000/ilsccureconnector/swconfig.h
===================================================================
--- trunk/addons/ccure/pre9000/ilsccureconnector/swconfig.h 2016-05-09 23:12:32 UTC (rev 1457)
+++ branches/1.6/addons/ccure/pre9000/ilsccureconnector/swconfig.h 2016-05-09 23:15:45 UTC (rev 1458)
@@ -1,88 +0,0 @@
-/******************************************************************************
- * swconfig.h - definition of Class SWConfig used for saving and retrieval
- * of configuration information
- *
- * $Id: swconfig.h 2180 2008-07-13 20:29:25Z scribe $
- *
- * Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
- * CrossWire Bible Society
- * P. O. Box 2528
- * Tempe, AZ 85280-2528
- *
- * 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 version 2.
- *
- * 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.
- *
- */
-
-#ifndef SWCONFIG_H
-#define SWCONFIG_H
-
-#include <map>
-
-#include "defs.h"
-#include "multimapwdef.h"
-#include "swbuf.h"
-
-SWORD_NAMESPACE_START
-
-typedef multimapwithdefault < SWBuf, SWBuf, std::less < SWBuf > >ConfigEntMap;
-typedef std::map < SWBuf, ConfigEntMap, std::less < SWBuf > >SectionMap;
-
-/** The class to read and save settings using a file on disk.
-*
-*/
-class SWDLLEXPORT SWConfig {
-private:
- char getline(int fd, SWBuf &line);
-public:
- /** The filename used by this SWConfig object
- *
- */
- SWBuf filename;
- /** Map of available sections
- * The map of available sections.
- */
- SectionMap Sections;
-
- /** Constructor of SWConfig
- * @param ifilename The file, which should be used for this config.
- */
- SWConfig(const char *ifilename);
- SWConfig();
- virtual ~SWConfig();
-
- /** Load from disk
- * Load the content from disk.
- */
- virtual void Load();
-
- /** Save to disk
- * Save the content of this config object to disk.
- */
- virtual void Save();
-
- /** Merges the values of addFrom
- * @param addFrom The config which values should be merged to this config object. Already existing values will be overwritten.
- */
- virtual void augment(SWConfig &addFrom);
- virtual SWConfig & operator +=(SWConfig &addFrom) { augment(addFrom); return *this; }
-
- /** Get a section
- * This is an easy way to get and store config values.
- * The following will work:\n
- *
- * @code
- * SWConfig config("/home/user/.setttings");
- * config["Colors"]["Background"] = "red";
- * @endcode
- */
- virtual ConfigEntMap & operator [](const char *section);
- };
-SWORD_NAMESPACE_END
-#endif
Copied: branches/1.6/addons/ccure/pre9000/ilsccureconnector/swconfig.h (from rev 1457, trunk/addons/ccure/pre9000/ilsccureconnector/swconfig.h)
===================================================================
--- branches/1.6/addons/ccure/pre9000/ilsccureconnector/swconfig.h (rev 0)
+++ branches/1.6/addons/ccure/pre9000/ilsccureconnector/swconfig.h 2016-05-09 23:15:45 UTC (rev 1458)
@@ -0,0 +1,88 @@
+/******************************************************************************
+ * swconfig.h - definition of Class SWConfig used for saving and retrieval
+ * of configuration information
+ *
+ * $Id: swconfig.h 2180 2008-07-13 20:29:25Z scribe $
+ *
+ * Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
+ * CrossWire Bible Society
+ * P. O. Box 2528
+ * Tempe, AZ 85280-2528
+ *
+ * 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 version 2.
+ *
+ * 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.
+ *
+ */
+
+#ifndef SWCONFIG_H
+#define SWCONFIG_H
+
+#include <map>
+
+#include "defs.h"
+#include "multimapwdef.h"
+#include "swbuf.h"
+
+SWORD_NAMESPACE_START
+
+typedef multimapwithdefault < SWBuf, SWBuf, std::less < SWBuf > >ConfigEntMap;
+typedef std::map < SWBuf, ConfigEntMap, std::less < SWBuf > >SectionMap;
+
+/** The class to read and save settings using a file on disk.
+*
+*/
+class SWDLLEXPORT SWConfig {
+private:
+ char getline(int fd, SWBuf &line);
+public:
+ /** The filename used by this SWConfig object
+ *
+ */
+ SWBuf filename;
+ /** Map of available sections
+ * The map of available sections.
+ */
+ SectionMap Sections;
+
+ /** Constructor of SWConfig
+ * @param ifilename The file, which should be used for this config.
+ */
+ SWConfig(const char *ifilename);
+ SWConfig();
+ virtual ~SWConfig();
+
+ /** Load from disk
+ * Load the content from disk.
+ */
+ virtual void Load();
+
+ /** Save to disk
+ * Save the content of this config object to disk.
+ */
+ virtual void Save();
+
+ /** Merges the values of addFrom
+ * @param addFrom The config which values should be merged to this config object. Already existing values will be overwritten.
+ */
+ virtual void augment(SWConfig &addFrom);
+ virtual SWConfig & operator +=(SWConfig &addFrom) { augment(addFrom); return *this; }
+
+ /** Get a section
+ * This is an easy way to get and store config values.
+ * The following will work:\n
+ *
+ * @code
+ * SWConfig config("/home/user/.setttings");
+ * config["Colors"]["Background"] = "red";
+ * @endcode
+ */
+ virtual ConfigEntMap & operator [](const char *section);
+ };
+SWORD_NAMESPACE_END
+#endif
Deleted: branches/1.6/addons/ccure/pre9000/ilsccureconnector/swlog.h
===================================================================
--- trunk/addons/ccure/pre9000/ilsccureconnector/swlog.h 2016-05-09 23:12:32 UTC (rev 1457)
+++ branches/1.6/addons/ccure/pre9000/ilsccureconnector/swlog.h 2016-05-09 23:15:45 UTC (rev 1458)
@@ -1,63 +0,0 @@
-/******************************************************************************
- * swlog.h - definition of class SWLog used for logging messages
- *
- * $Id: swlog.h 2080 2007-09-17 06:21:29Z scribe $
- *
- * Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
- * CrossWire Bible Society
- * P. O. Box 2528
- * Tempe, AZ 85280-2528
- *
- * 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 version 2.
- *
- * 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.
- *
- */
-
-//---------------------------------------------------------------------------
-#ifndef swlogH
-#define swlogH
-//---------------------------------------------------------------------------
-
-#include "defs.h"
-
-SWORD_NAMESPACE_START
-
-class SWDLLEXPORT SWLog {
-protected:
- char logLevel;
- static SWLog *systemLog;
-
-public:
-
- static const int LOG_ERROR;
- static const int LOG_WARN;
- static const int LOG_INFO;
- static const int LOG_TIMEDINFO;
- static const int LOG_DEBUG;
-
- static SWLog *getSystemLog();
- static void setSystemLog(SWLog *newLogger);
-
- SWLog() { logLevel = 1; /*default to show only errors*/}
- virtual ~SWLog() {};
-
- void setLogLevel(char level) { logLevel = level; }
- char getLogLevel() const { return logLevel; }
- void logWarning(const char *fmt, ...) const;
- void logError(const char *fmt, ...) const;
- void logInformation(const char *fmt, ...) const;
- virtual void logTimedInformation(const char *fmt, ...) const;
- void logDebug(const char *fmt, ...) const;
-
- // Override this method if you want to have a custom logger
- virtual void logMessage(const char *message, int level) const;
-};
-
-SWORD_NAMESPACE_END
-#endif
Copied: branches/1.6/addons/ccure/pre9000/ilsccureconnector/swlog.h (from rev 1457, trunk/addons/ccure/pre9000/ilsccureconnector/swlog.h)
===================================================================
--- branches/1.6/addons/ccure/pre9000/ilsccureconnector/swlog.h (rev 0)
+++ branches/1.6/addons/ccure/pre9000/ilsccureconnector/swlog.h 2016-05-09 23:15:45 UTC (rev 1458)
@@ -0,0 +1,63 @@
+/******************************************************************************
+ * swlog.h - definition of class SWLog used for logging messages
+ *
+ * $Id: swlog.h 2080 2007-09-17 06:21:29Z scribe $
+ *
+ * Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
+ * CrossWire Bible Society
+ * P. O. Box 2528
+ * Tempe, AZ 85280-2528
+ *
+ * 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 version 2.
+ *
+ * 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.
+ *
+ */
+
+//---------------------------------------------------------------------------
+#ifndef swlogH
+#define swlogH
+//---------------------------------------------------------------------------
+
+#include "defs.h"
+
+SWORD_NAMESPACE_START
+
+class SWDLLEXPORT SWLog {
+protected:
+ char logLevel;
+ static SWLog *systemLog;
+
+public:
+
+ static const int LOG_ERROR;
+ static const int LOG_WARN;
+ static const int LOG_INFO;
+ static const int LOG_TIMEDINFO;
+ static const int LOG_DEBUG;
+
+ static SWLog *getSystemLog();
+ static void setSystemLog(SWLog *newLogger);
+
+ SWLog() { logLevel = 1; /*default to show only errors*/}
+ virtual ~SWLog() {};
+
+ void setLogLevel(char level) { logLevel = level; }
+ char getLogLevel() const { return logLevel; }
+ void logWarning(const char *fmt, ...) const;
+ void logError(const char *fmt, ...) const;
+ void logInformation(const char *fmt, ...) const;
+ virtual void logTimedInformation(const char *fmt, ...) const;
+ void logDebug(const char *fmt, ...) const;
+
+ // Override this method if you want to have a custom logger
+ virtual void logMessage(const char *message, int level) const;
+};
+
+SWORD_NAMESPACE_END
+#endif
Deleted: branches/1.6/addons/ccure/pre9000/ilsccureconnector/sysdata.h
===================================================================
--- trunk/addons/ccure/pre9000/ilsccureconnector/sysdata.h 2016-05-09 23:12:32 UTC (rev 1457)
+++ branches/1.6/addons/ccure/pre9000/ilsccureconnector/sysdata.h 2016-05-09 23:15:45 UTC (rev 1458)
@@ -1,80 +0,0 @@
-#ifndef SIZEDTYPES_H
-#define SIZEDTYPES_H
-/*
- * __xx is ok: it doesn't pollute the POSIX namespace. Use these in the
- * header files exported to user space
- */
-#ifdef USE_AUTOTOOLS
-#include "config.h"
-#endif
-
-
-typedef signed char __s8;
-typedef unsigned char __u8;
-
-typedef signed short __s16;
-typedef unsigned short __u16;
-
-typedef signed int __s32;
-typedef unsigned int __u32;
-
-#if defined(__GNUC__) && !defined(__STRICT_ANSI__)
-//typedef __signed__ long long __s64;
-//typedef unsigned long long __u64;
-#endif
-
-#undef __swswap16
-#undef __swswap32
-#undef __swswap64
-
-#define __swswap16(x) \
- ((__u16)( \
- (((__u16)(x) & (__u16)0x00ffU) << 8) | \
- (((__u16)(x) & (__u16)0xff00U) >> 8) ))
-
-
-#define __swswap32(x) \
- ((__u32)( \
- (((__u32)(x) & (__u32)0x000000ffUL) << 24) | \
- (((__u32)(x) & (__u32)0x0000ff00UL) << 8) | \
- (((__u32)(x) & (__u32)0x00ff0000UL) >> 8) | \
- (((__u32)(x) & (__u32)0xff000000UL) >> 24) ))
-
-
-#define __swswap64(x) \
- ((__u64)( \
- (__u64)(((__u64)(x) & (__u64)0x00000000000000ffULL) << 56) | \
- (__u64)(((__u64)(x) & (__u64)0x000000000000ff00ULL) << 40) | \
- (__u64)(((__u64)(x) & (__u64)0x0000000000ff0000ULL) << 24) | \
- (__u64)(((__u64)(x) & (__u64)0x00000000ff000000ULL) << 8) | \
- (__u64)(((__u64)(x) & (__u64)0x000000ff00000000ULL) >> 8) | \
- (__u64)(((__u64)(x) & (__u64)0x0000ff0000000000ULL) >> 24) | \
- (__u64)(((__u64)(x) & (__u64)0x00ff000000000000ULL) >> 40) | \
- (__u64)(((__u64)(x) & (__u64)0xff00000000000000ULL) >> 56) ))
-
-
-
-
-#ifndef WORDS_BIGENDIAN
-
-#define swordtoarch16(x) (x)
-#define swordtoarch32(x) (x)
-#define swordtoarch64(x) (x)
-#define archtosword16(x) (x)
-#define archtosword32(x) (x)
-#define archtosword64(x) (x)
-
-#else
-
-#define swordtoarch16(x) __swswap16(x)
-#define swordtoarch32(x) __swswap32(x)
-#define swordtoarch64(x) __swswap64(x)
-#define archtosword16(x) __swswap16(x)
-#define archtosword32(x) __swswap32(x)
-#define archtosword64(x) __swswap64(x)
-
-
-#endif
-
-
-#endif
Copied: branches/1.6/addons/ccure/pre9000/ilsccureconnector/sysdata.h (from rev 1457, trunk/addons/ccure/pre9000/ilsccureconnector/sysdata.h)
===================================================================
--- branches/1.6/addons/ccure/pre9000/ilsccureconnector/sysdata.h (rev 0)
+++ branches/1.6/addons/ccure/pre9000/ilsccureconnector/sysdata.h 2016-05-09 23:15:45 UTC (rev 1458)
@@ -0,0 +1,80 @@
+#ifndef SIZEDTYPES_H
+#define SIZEDTYPES_H
+/*
+ * __xx is ok: it doesn't pollute the POSIX namespace. Use these in the
+ * header files exported to user space
+ */
+#ifdef USE_AUTOTOOLS
+#include "config.h"
+#endif
+
+
+typedef signed char __s8;
+typedef unsigned char __u8;
+
+typedef signed short __s16;
+typedef unsigned short __u16;
+
+typedef signed int __s32;
+typedef unsigned int __u32;
+
+#if defined(__GNUC__) && !defined(__STRICT_ANSI__)
+//typedef __signed__ long long __s64;
+//typedef unsigned long long __u64;
+#endif
+
+#undef __swswap16
+#undef __swswap32
+#undef __swswap64
+
+#define __swswap16(x) \
+ ((__u16)( \
+ (((__u16)(x) & (__u16)0x00ffU) << 8) | \
+ (((__u16)(x) & (__u16)0xff00U) >> 8) ))
+
+
+#define __swswap32(x) \
+ ((__u32)( \
+ (((__u32)(x) & (__u32)0x000000ffUL) << 24) | \
+ (((__u32)(x) & (__u32)0x0000ff00UL) << 8) | \
+ (((__u32)(x) & (__u32)0x00ff0000UL) >> 8) | \
+ (((__u32)(x) & (__u32)0xff000000UL) >> 24) ))
+
+
+#define __swswap64(x) \
+ ((__u64)( \
+ (__u64)(((__u64)(x) & (__u64)0x00000000000000ffULL) << 56) | \
+ (__u64)(((__u64)(x) & (__u64)0x000000000000ff00ULL) << 40) | \
+ (__u64)(((__u64)(x) & (__u64)0x0000000000ff0000ULL) << 24) | \
+ (__u64)(((__u64)(x) & (__u64)0x00000000ff000000ULL) << 8) | \
+ (__u64)(((__u64)(x) & (__u64)0x000000ff00000000ULL) >> 8) | \
+ (__u64)(((__u64)(x) & (__u64)0x0000ff0000000000ULL) >> 24) | \
+ (__u64)(((__u64)(x) & (__u64)0x00ff000000000000ULL) >> 40) | \
+ (__u64)(((__u64)(x) & (__u64)0xff00000000000000ULL) >> 56) ))
+
+
+
+
+#ifndef WORDS_BIGENDIAN
+
+#define swordtoarch16(x) (x)
+#define swordtoarch32(x) (x)
+#define swordtoarch64(x) (x)
+#define archtosword16(x) (x)
+#define archtosword32(x) (x)
+#define archtosword64(x) (x)
+
+#else
+
+#define swordtoarch16(x) __swswap16(x)
+#define swordtoarch32(x) __swswap32(x)
+#define swordtoarch64(x) __swswap64(x)
+#define archtosword16(x) __swswap16(x)
+#define archtosword32(x) __swswap32(x)
+#define archtosword64(x) __swswap64(x)
+
+
+#endif
+
+
+#endif
Deleted: branches/1.6/addons/ccure/pre9000/ilsccureconnector/utilstr.cpp
===================================================================
--- trunk/addons/ccure/pre9000/ilsccureconnector/utilstr.cpp 2016-05-09 23:12:32 UTC (rev 1457)
+++ branches/1.6/addons/ccure/pre9000/ilsccureconnector/utilstr.cpp 2016-05-09 23:15:45 UTC (rev 1458)
@@ -1,272 +0,0 @@
-/*
- * Copyright 2009 CrossWire Bible Society (http://www.crosswire.org)
- * CrossWire Bible Society
- * P. O. Box 2528
- * Tempe, AZ 85280-2528
- *
- * 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 version 2.
- *
- * 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.
- *
- */
-
-#include "utilstr.h"
-#include <ctype.h>
-#include <string.h>
-
-#include "sysdata.h"
-#include "swlog.h"
-#include "swbuf.h"
-
-
-SWORD_NAMESPACE_START
-
-const unsigned char SW_toupper_array[256] =
- {
- 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
- 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
- 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
- 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f,
- 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27,
- 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f,
- 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37,
- 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f,
- 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47,
- 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f,
- 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57,
- 0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f,
- 0x60, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47,
- 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f,
- 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57,
- 0x58, 0x59, 0x5a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f,
- 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87,
- 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f,
- 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97,
- 0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f,
- 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7,
- 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf,
- 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7,
- 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf,
- 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7,
- 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf,
- 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7,
- 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf,
- 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7,
- 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf,
- 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xf7,
- 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xff
- };
-
-
-
-/******************************************************************************
- * stdstr - clones a string
- *
- * ENT: ipstr - pointer to a string pointer to set if necessary
- * istr - string to set to *ipstr
- * 0 - only get
- *
- * RET: *ipstr
- */
-
-char *stdstr(char **ipstr, const char *istr, unsigned int memPadFactor) {
- if (*ipstr)
- delete [] *ipstr;
- if (istr) {
- int len = strlen(istr) + 1;
- *ipstr = new char [ len * memPadFactor ];
- memcpy(*ipstr, istr, len);
- }
- else *ipstr = 0;
- return *ipstr;
-}
-
-
-/******************************************************************************
- * strstrip - Removes leading and trailing spaces from a string
- *
- * ENT: istr - string pointer to strip
- *
- * RET: *istr
- */
-
-char *strstrip(char *istr) {
- char *tmp = istr;
- char *rtmp;
-
- int len = strlen(istr);
- if (len < 1)
- return istr;
- rtmp = istr + (len - 1);
-
- while ((rtmp > istr)&&((*rtmp == ' ')||(*rtmp == '\t')||(*rtmp == 10)||(*rtmp == 13))) *(rtmp--) = 0;
- while ((*tmp == ' ')||(*tmp == '\t')||(*tmp == 10)||(*tmp == 13)) tmp++;
- memmove(istr, tmp, (rtmp - tmp) + 1);
- istr[(rtmp - tmp) + 1] = 0;
-
- return istr;
-}
-
-
-/******************************************************************************
- * stristr - Scans a string for the occurrence of a given substring, no case
- *
- * ENT: scans s1 for the first occurrence of the substring s2, ingnoring case
- *
- * RET: a pointer to the element in s1, where s2 begins (points to s2 in s1).
- * If s2 does not occur in s1, returns null.
- */
-
-const char *stristr(const char *s1, const char *s2) {
- int tLen = strlen(s2);
- int cLen = strlen(s1);
- char *target = new char [ tLen + 1 ];
- int i, j;
- const char *retVal = 0;
-
- strcpy(target, s2);
- for (i = 0; i < tLen; i++)
- target[i] = SW_toupper(target[i]);
-
- for (i = 0; i < (cLen - tLen)+1; i++) {
- if (SW_toupper(s1[i]) == (unsigned char)*target) {
- for (j = 1; j < tLen; j++) {
- if (SW_toupper(s1[i+j]) != (unsigned char)target[j])
- break;
- }
- if (j == tLen) {
- retVal = s1+i;
- break;
- }
- }
- }
- delete [] target;
- return retVal;
-}
-
-/******************************************************************************
- * strnicmp - compares the first n bytes of 2 strings ignoring case
- *
- * ENT: compares s1 to s2 comparing the first n byte ingnoring case
- *
- * RET: same as strcmp
- */
-
-int strnicmp(const char *s1, const char *s2, int len) {
- int tLen = strlen(s2);
- int cLen = strlen(s1);
- char diff;
- int i;
- for (i = 0; ((i < len) && (i < tLen) && (i < cLen)); i++) {
- if ((diff = SW_toupper(*s1) - SW_toupper(*s2)))
- return diff;
- s1++;
- s2++;
- }
- return (i < len) ? cLen - tLen : 0;
-}
-
-int stricmp(const char *s1, const char *s2) {
-#if defined(__GNUC__)
- return ::strcasecmp(s1, s2);
-#else
- #if defined(_WIN32_WCE)
- return ::_stricmp(s1, s2);
- #else
- return ::stricmp(s1, s2);
- #endif
-#endif
-}
-
-
-/******************************************************************************
- * getUniCharFromUTF8 - retrieves the next Unicode codepoint from a UTF8 string
- * and increments buf to start of next codepoint
- *
- * ENT: buf - address of a utf8 buffer
- *
- * RET: buf - incremented past last byte used in computing the current codepoint
- * unicode codepoint value (0 with buf incremented is invalid UTF8 byte
- */
-
-__u32 getUniCharFromUTF8(const unsigned char **buf) {
- __u32 ch = 0;
- unsigned char multibuf[7];
-
- //case: We're at the end
- if (!(**buf)) {
- return ch;
- }
-
- //case: ANSI
- if (!(**buf & 128)) {
- ch = **buf;
- (*buf)++;
- return ch;
- }
-
- //case: Invalid UTF-8 (illegal continuing byte in initial position)
- if ((**buf & 128) && (!(**buf & 64))) {
- (*buf)++;
- return ch;
- }
-
- //case: 2+ byte codepoint
- multibuf[0] = **buf;
- multibuf[0] <<= 1;
- int subsequent;
- for (subsequent = 1; (multibuf[0] & 128) && (subsequent < 7); subsequent++) {
- multibuf[0] <<= 1;
- multibuf[subsequent] = (*buf)[subsequent];
- multibuf[subsequent] &= 63;
- // subsequent byte did not begin with 10XXXXXX
- // move our buffer to here and error out
- if (((*buf)[subsequent] - multibuf[subsequent]) != 128) {
- *buf += subsequent;
- return 0;
- }
- ch <<= 6;
- ch |= multibuf[subsequent];
- }
- subsequent--;
- multibuf[0] <<= 1;
- char significantFirstBits = 8 - (2+subsequent);
-
- ch |= (((__s16)multibuf[0]) << (((6*subsequent)+significantFirstBits)-8));
- *buf += (subsequent+1);
- return ch;
-}
-
-
-
-SWBuf assureValidUTF8(const char *buf) {
-
- SWBuf myCopy = buf;
- const unsigned char *b = (const unsigned char *)myCopy.c_str();
- const unsigned char *q = 0;
- bool invalidChar = false;
- while (*b) {
- q = b;
- if (!getUniCharFromUTF8(&b)) {
- long len = b - q;
- if (len) {
- invalidChar = true;
- for (long start = q - (const unsigned char *)myCopy.c_str(); len; len--) {
- myCopy[start+len-1] = 0x1a; // unicode replacement character
- }
-
- }
- }
- }
- if (invalidChar) {
-// SWLog::getSystemLog()->logWarning("Changing invalid UTF-8 string (%s) to (%s)\n", buf, myCopy.c_str());
- }
- return myCopy;
-}
-
-SWORD_NAMESPACE_END
Copied: branches/1.6/addons/ccure/pre9000/ilsccureconnector/utilstr.cpp (from rev 1457, trunk/addons/ccure/pre9000/ilsccureconnector/utilstr.cpp)
===================================================================
--- branches/1.6/addons/ccure/pre9000/ilsccureconnector/utilstr.cpp (rev 0)
+++ branches/1.6/addons/ccure/pre9000/ilsccureconnector/utilstr.cpp 2016-05-09 23:15:45 UTC (rev 1458)
@@ -0,0 +1,272 @@
+/*
+ * Copyright 2009 CrossWire Bible Society (http://www.crosswire.org)
+ * CrossWire Bible Society
+ * P. O. Box 2528
+ * Tempe, AZ 85280-2528
+ *
+ * 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 version 2.
+ *
+ * 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.
+ *
+ */
+
+#include "utilstr.h"
+#include <ctype.h>
+#include <string.h>
+
+#include "sysdata.h"
+#include "swlog.h"
+#include "swbuf.h"
+
+
+SWORD_NAMESPACE_START
+
+const unsigned char SW_toupper_array[256] =
+ {
+ 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
+ 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
+ 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
+ 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f,
+ 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27,
+ 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f,
+ 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37,
+ 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f,
+ 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47,
+ 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f,
+ 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57,
+ 0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f,
+ 0x60, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47,
+ 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f,
+ 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57,
+ 0x58, 0x59, 0x5a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f,
+ 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87,
+ 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f,
+ 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97,
+ 0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f,
+ 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7,
+ 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf,
+ 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7,
+ 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf,
+ 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7,
+ 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf,
+ 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7,
+ 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf,
+ 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7,
+ 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf,
+ 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xf7,
+ 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xff
+ };
+
+
+
+/******************************************************************************
+ * stdstr - clones a string
+ *
+ * ENT: ipstr - pointer to a string pointer to set if necessary
+ * istr - string to set to *ipstr
+ * 0 - only get
+ *
+ * RET: *ipstr
+ */
+
+char *stdstr(char **ipstr, const char *istr, unsigned int memPadFactor) {
+ if (*ipstr)
+ delete [] *ipstr;
+ if (istr) {
+ int len = strlen(istr) + 1;
+ *ipstr = new char [ len * memPadFactor ];
+ memcpy(*ipstr, istr, len);
+ }
+ else *ipstr = 0;
+ return *ipstr;
+}
+
+
+/******************************************************************************
+ * strstrip - Removes leading and trailing spaces from a string
+ *
+ * ENT: istr - string pointer to strip
+ *
+ * RET: *istr
+ */
+
+char *strstrip(char *istr) {
+ char *tmp = istr;
+ char *rtmp;
+
+ int len = strlen(istr);
+ if (len < 1)
+ return istr;
+ rtmp = istr + (len - 1);
+
+ while ((rtmp > istr)&&((*rtmp == ' ')||(*rtmp == '\t')||(*rtmp == 10)||(*rtmp == 13))) *(rtmp--) = 0;
+ while ((*tmp == ' ')||(*tmp == '\t')||(*tmp == 10)||(*tmp == 13)) tmp++;
+ memmove(istr, tmp, (rtmp - tmp) + 1);
+ istr[(rtmp - tmp) + 1] = 0;
+
+ return istr;
+}
+
+
+/******************************************************************************
+ * stristr - Scans a string for the occurrence of a given substring, no case
+ *
+ * ENT: scans s1 for the first occurrence of the substring s2, ingnoring case
+ *
+ * RET: a pointer to the element in s1, where s2 begins (points to s2 in s1).
+ * If s2 does not occur in s1, returns null.
+ */
+
+const char *stristr(const char *s1, const char *s2) {
+ int tLen = strlen(s2);
+ int cLen = strlen(s1);
+ char *target = new char [ tLen + 1 ];
+ int i, j;
+ const char *retVal = 0;
+
+ strcpy(target, s2);
+ for (i = 0; i < tLen; i++)
+ target[i] = SW_toupper(target[i]);
+
+ for (i = 0; i < (cLen - tLen)+1; i++) {
+ if (SW_toupper(s1[i]) == (unsigned char)*target) {
+ for (j = 1; j < tLen; j++) {
+ if (SW_toupper(s1[i+j]) != (unsigned char)target[j])
+ break;
+ }
+ if (j == tLen) {
+ retVal = s1+i;
+ break;
+ }
+ }
+ }
+ delete [] target;
+ return retVal;
+}
+
+/******************************************************************************
+ * strnicmp - compares the first n bytes of 2 strings ignoring case
+ *
+ * ENT: compares s1 to s2 comparing the first n byte ingnoring case
+ *
+ * RET: same as strcmp
+ */
+
+int strnicmp(const char *s1, const char *s2, int len) {
+ int tLen = strlen(s2);
+ int cLen = strlen(s1);
+ char diff;
+ int i;
+ for (i = 0; ((i < len) && (i < tLen) && (i < cLen)); i++) {
+ if ((diff = SW_toupper(*s1) - SW_toupper(*s2)))
+ return diff;
+ s1++;
+ s2++;
+ }
+ return (i < len) ? cLen - tLen : 0;
+}
+
+int stricmp(const char *s1, const char *s2) {
+#if defined(__GNUC__)
+ return ::strcasecmp(s1, s2);
+#else
+ #if defined(_WIN32_WCE)
+ return ::_stricmp(s1, s2);
+ #else
+ return ::stricmp(s1, s2);
+ #endif
+#endif
+}
+
+
+/******************************************************************************
+ * getUniCharFromUTF8 - retrieves the next Unicode codepoint from a UTF8 string
+ * and increments buf to start of next codepoint
+ *
+ * ENT: buf - address of a utf8 buffer
+ *
+ * RET: buf - incremented past last byte used in computing the current codepoint
+ * unicode codepoint value (0 with buf incremented is invalid UTF8 byte
+ */
+
+__u32 getUniCharFromUTF8(const unsigned char **buf) {
+ __u32 ch = 0;
+ unsigned char multibuf[7];
+
+ //case: We're at the end
+ if (!(**buf)) {
+ return ch;
+ }
+
+ //case: ANSI
+ if (!(**buf & 128)) {
+ ch = **buf;
+ (*buf)++;
+ return ch;
+ }
+
+ //case: Invalid UTF-8 (illegal continuing byte in initial position)
+ if ((**buf & 128) && (!(**buf & 64))) {
+ (*buf)++;
+ return ch;
+ }
+
+ //case: 2+ byte codepoint
+ multibuf[0] = **buf;
+ multibuf[0] <<= 1;
+ int subsequent;
+ for (subsequent = 1; (multibuf[0] & 128) && (subsequent < 7); subsequent++) {
+ multibuf[0] <<= 1;
+ multibuf[subsequent] = (*buf)[subsequent];
+ multibuf[subsequent] &= 63;
+ // subsequent byte did not begin with 10XXXXXX
+ // move our buffer to here and error out
+ if (((*buf)[subsequent] - multibuf[subsequent]) != 128) {
+ *buf += subsequent;
+ return 0;
+ }
+ ch <<= 6;
+ ch |= multibuf[subsequent];
+ }
+ subsequent--;
+ multibuf[0] <<= 1;
+ char significantFirstBits = 8 - (2+subsequent);
+
+ ch |= (((__s16)multibuf[0]) << (((6*subsequent)+significantFirstBits)-8));
+ *buf += (subsequent+1);
+ return ch;
+}
+
+
+
+SWBuf assureValidUTF8(const char *buf) {
+
+ SWBuf myCopy = buf;
+ const unsigned char *b = (const unsigned char *)myCopy.c_str();
+ const unsigned char *q = 0;
+ bool invalidChar = false;
+ while (*b) {
+ q = b;
+ if (!getUniCharFromUTF8(&b)) {
+ long len = b - q;
+ if (len) {
+ invalidChar = true;
+ for (long start = q - (const unsigned char *)myCopy.c_str(); len; len--) {
+ myCopy[start+len-1] = 0x1a; // unicode replacement character
+ }
+
+ }
+ }
+ }
+ if (invalidChar) {
+// SWLog::getSystemLog()->logWarning("Changing invalid UTF-8 string (%s) to (%s)\n", buf, myCopy.c_str());
+ }
+ return myCopy;
+}
+
+SWORD_NAMESPACE_END
Deleted: branches/1.6/addons/ccure/pre9000/ilsccureconnector/utilstr.h
===================================================================
--- trunk/addons/ccure/pre9000/ilsccureconnector/utilstr.h 2016-05-09 23:12:32 UTC (rev 1457)
+++ branches/1.6/addons/ccure/pre9000/ilsccureconnector/utilstr.h 2016-05-09 23:15:45 UTC (rev 1458)
@@ -1,75 +0,0 @@
-/******************************************************************************
- * utilstr.h - prototypes for string utility functions
- *
- * $Id: utilstr.h 2446 2009-08-24 00:43:27Z scribe $
- *
- * Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
- * CrossWire Bible Society
- * P. O. Box 2528
- * Tempe, AZ 85280-2528
- *
- * 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 version 2.
- *
- * 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.
- *
- */
-
-#ifndef UTILSTR_H
-#define UTILSTR_H
-
-#include "defs.h"
-#include "sysdata.h"
-#include "swbuf.h"
-
-SWORD_NAMESPACE_START
-
-/** stdstr - clone a string
-*/
-SWDLLEXPORT char *stdstr (char **iistr, const char *istr, unsigned int memPadFactor = 1);
-SWDLLEXPORT char *strstrip (char *istr);
-SWDLLEXPORT const char *stristr (const char *s1, const char *s2);
-SWDLLEXPORT int strnicmp(const char *s1, const char *s2, int len);
-SWDLLEXPORT int stricmp(const char *s1, const char *s2);
-
-/******************************************************************************
- * SW_toupper - array of uppercase values for any given Latin-1 value
- *
- * use this instead of toupper() for fast lookups on accented characters
- */
-extern const unsigned char SW_toupper_array[256];
-#define SW_toupper(c) SW_toupper_array[(unsigned char)c]
-
-/******************************************************************************
- * getUniCharFromUTF8 - retrieves the next Unicode codepoint from a UTF8 string
- * and increments buf to start of next codepoint
- *
- * ENT: buf - address of a utf8 buffer
- *
- * RET: buf - incremented past last byte used in computing the current codepoint
- * unicode codepoint value (0 with buf incremented is invalid UTF8 byte
- */
-
-__u32 getUniCharFromUTF8(const unsigned char **buf);
-
-
-/******************************************************************************
- * assureValidUTF8 - iterates the supplied UTF-8 buffer and checks for validity
- * replacing invalid bytes if necessary and returning a
- * verified UTF8 buffer, leaving the original input
- * unchanged.
- *
- * ENT: buf - a utf8 buffer
- *
- * RET: input buffer validated and any problems fixed by substituting a
- * replacement character for bytes not valid.
- */
-SWBuf assureValidUTF8(const char *buf);
-
-
-SWORD_NAMESPACE_END
-#endif
Copied: branches/1.6/addons/ccure/pre9000/ilsccureconnector/utilstr.h (from rev 1457, trunk/addons/ccure/pre9000/ilsccureconnector/utilstr.h)
===================================================================
--- branches/1.6/addons/ccure/pre9000/ilsccureconnector/utilstr.h (rev 0)
+++ branches/1.6/addons/ccure/pre9000/ilsccureconnector/utilstr.h 2016-05-09 23:15:45 UTC (rev 1458)
@@ -0,0 +1,75 @@
+/******************************************************************************
+ * utilstr.h - prototypes for string utility functions
+ *
+ * $Id: utilstr.h 2446 2009-08-24 00:43:27Z scribe $
+ *
+ * Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
+ * CrossWire Bible Society
+ * P. O. Box 2528
+ * Tempe, AZ 85280-2528
+ *
+ * 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 version 2.
+ *
+ * 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.
+ *
+ */
+
+#ifndef UTILSTR_H
+#define UTILSTR_H
+
+#include "defs.h"
+#include "sysdata.h"
+#include "swbuf.h"
+
+SWORD_NAMESPACE_START
+
+/** stdstr - clone a string
+*/
+SWDLLEXPORT char *stdstr (char **iistr, const char *istr, unsigned int memPadFactor = 1);
+SWDLLEXPORT char *strstrip (char *istr);
+SWDLLEXPORT const char *stristr (const char *s1, const char *s2);
+SWDLLEXPORT int strnicmp(const char *s1, const char *s2, int len);
+SWDLLEXPORT int stricmp(const char *s1, const char *s2);
+
+/******************************************************************************
+ * SW_toupper - array of uppercase values for any given Latin-1 value
+ *
+ * use this instead of toupper() for fast lookups on accented characters
+ */
+extern const unsigned char SW_toupper_array[256];
+#define SW_toupper(c) SW_toupper_array[(unsigned char)c]
+
+/******************************************************************************
+ * getUniCharFromUTF8 - retrieves the next Unicode codepoint from a UTF8 string
+ * and increments buf to start of next codepoint
+ *
+ * ENT: buf - address of a utf8 buffer
+ *
+ * RET: buf - incremented past last byte used in computing the current codepoint
+ * unicode codepoint value (0 with buf incremented is invalid UTF8 byte
+ */
+
+__u32 getUniCharFromUTF8(const unsigned char **buf);
+
+
+/******************************************************************************
+ * assureValidUTF8 - iterates the supplied UTF-8 buffer and checks for validity
+ * replacing invalid bytes if necessary and returning a
+ * verified UTF8 buffer, leaving the original input
+ * unchanged.
+ *
+ * ENT: buf - a utf8 buffer
+ *
+ * RET: input buffer validated and any problems fixed by substituting a
+ * replacement character for bytes not valid.
+ */
+SWBuf assureValidUTF8(const char *buf);
+
+
+SWORD_NAMESPACE_END
+#endif
Deleted: branches/1.6/addons/ccure/pre9000/ilsccureconnector.exe
===================================================================
(Binary files differ)
Copied: branches/1.6/addons/ccure/pre9000/ilsccureconnector.exe (from rev 1457, trunk/addons/ccure/pre9000/ilsccureconnector.exe)
===================================================================
(Binary files differ)
Deleted: branches/1.6/addons/ccure/pre9000/ilsccurehook.dll
===================================================================
(Binary files differ)
Copied: branches/1.6/addons/ccure/pre9000/ilsccurehook.dll (from rev 1457, trunk/addons/ccure/pre9000/ilsccurehook.dll)
===================================================================
(Binary files differ)
Deleted: branches/1.6/addons/ccure/vws/README.txt
===================================================================
--- trunk/addons/ccure/vws/README.txt 2016-05-09 23:12:32 UTC (rev 1457)
+++ branches/1.6/addons/ccure/vws/README.txt 2016-05-09 23:15:45 UTC (rev 1458)
@@ -1,66 +0,0 @@
-This addon is for connecting a CCURE system which includes Victor Web Services
-to the iLS.
-
-I. Adding users from CCURE into the iLS:
-
-1) Configure an event in CCURE to output to a filesystem folder an XML file for a
-user when their personel record is created in the CCURE system. The XML file
-should look similar to:
-
-<?xml version="1.0" encoding="utf-8" standalone="yes"?>
-<CrossFire culture-info="en-US" platform-version="2.40.8" product-version="2.40.8">
- <SoftwareHouse.NextGen.Common.SecurityObjects.Personnel ImportMode="Default">
- <Name>DRAIN, KENNETH LIAM</Name>
- <GUID>37fa8d94-6103-438b-8a02-f032a3ef2d8b</GUID>
- <ObjectID>58931</ObjectID>
- <PartitionKey>$$Default$$</PartitionKey>
- <UDF__JIA_ROLE_>Unlocked</UDF__JIA_ROLE_>
- <SoftwareHouse.NextGen.Common.SecurityObjects.Credential ImportMode="Default">
- <UDF__COMPANY_1_>JOHNSON CONTROLS</UDF__COMPANY_1_>
- </SoftwareHouse.NextGen.Common.SecurityObjects.Credential>
- </SoftwareHouse.NextGen.Common.SecurityObjects.Personnel>
-</CrossFire>
-
-2) Install the SimpleMessageQueue windows service using the installer in this
-folder onto the machine where the filesystem folder exists.
-
-3) Configure the SimpleMessageQueue service (from the Windows Control Panel)
- a) to monitor the folder where CCURE will output XML files for new users.
- b) to point to the iLS webservice to create a new user, e.g.,
- https://www.mytrainingportal.net/airportXYZ/api/ccure/user/put/
- c) in the Extra Param 1 field Parameter Name enter: ILSUSER
- d) in the Extra Param 1 field Parameter Value enter your API user name
- e) in the Extra Param 2 field Parameter Name enter: ILSPASSWD
- f) in the Extra Param 2 field Parameter Value enter your API user password
- g) in the Data Parameter Parameter Name enter: data
- h) In the Remove Message From Queue Upon Successful Processing Determined By,
- choose Service Response Starts With and enter: <success
-
-
-II. Returning test results back to CCURE from the iLS
-
-1) In the CCURE system, configure UDF field sets to receive the data:
- a) UDF__TRAINING_COURSE_1_ - to receive the course name
- b) UDF__TRAINING_DATE_1_ - to receive the course completion date
- c) UDF__TRAINING_SCORE_1_ - to receive the user's score
- d) UDF__TRAINING_RESULT_1_ - to receive PASSED or FAILED
-
- e) repeat these fields using _2_ ... _n_ for n number of courses to be
- returned to CCURE from the iLS.
-
-1) In the iLS System Management Panel
- a) enable Web Service API
- b) enter the URL to the iLS CCURE updatescore.vws webservice in the
- Callback URL - Course Complete field, e.g.,
- http://www.mytrainingportal.net/airportXYZ/api/ccure/updatescore.vws/
-2) In the iLS sysconfig.<companynumber>.properties file enter the Victor Web Services
- configuration information
- a) CCUREVWSRoot=https\://ccure.airportXYZ.com/victorwebservices/api
- b) CCUREUser=Worgroup\\ccuremgr
- c) CCUREPassword=xyzzy
-
-3) In the iLS database COURSE table, for each course which should report data
- to CCURE, enter into the USERDATA column for that course
- an integer which corresponds to the UDF fieldset number which should
- receive the data for that course (fieldsets created in step II.1)
-
Copied: branches/1.6/addons/ccure/vws/README.txt (from rev 1457, trunk/addons/ccure/vws/README.txt)
===================================================================
--- branches/1.6/addons/ccure/vws/README.txt (rev 0)
+++ branches/1.6/addons/ccure/vws/README.txt 2016-05-09 23:15:45 UTC (rev 1458)
@@ -0,0 +1,66 @@
+This addon is for connecting a CCURE system which includes Victor Web Services
+to the iLS.
+
+I. Adding users from CCURE into the iLS:
+
+1) Configure an event in CCURE to output to a filesystem folder an XML file for a
+user when their personel record is created in the CCURE system. The XML file
+should look similar to:
+
+<?xml version="1.0" encoding="utf-8" standalone="yes"?>
+<CrossFire culture-info="en-US" platform-version="2.40.8" product-version="2.40.8">
+ <SoftwareHouse.NextGen.Common.SecurityObjects.Personnel ImportMode="Default">
+ <Name>DRAIN, KENNETH LIAM</Name>
+ <GUID>37fa8d94-6103-438b-8a02-f032a3ef2d8b</GUID>
+ <ObjectID>58931</ObjectID>
+ <PartitionKey>$$Default$$</PartitionKey>
+ <UDF__JIA_ROLE_>Unlocked</UDF__JIA_ROLE_>
+ <SoftwareHouse.NextGen.Common.SecurityObjects.Credential ImportMode="Default">
+ <UDF__COMPANY_1_>JOHNSON CONTROLS</UDF__COMPANY_1_>
+ </SoftwareHouse.NextGen.Common.SecurityObjects.Credential>
+ </SoftwareHouse.NextGen.Common.SecurityObjects.Personnel>
+</CrossFire>
+
+2) Install the SimpleMessageQueue windows service using the installer in this
+folder onto the machine where the filesystem folder exists.
+
+3) Configure the SimpleMessageQueue service (from the Windows Control Panel)
+ a) to monitor the folder where CCURE will output XML files for new users.
+ b) to point to the iLS webservice to create a new user, e.g.,
+ https://www.mytrainingportal.net/airportXYZ/api/ccure/user/put/
+ c) in the Extra Param 1 field Parameter Name enter: ILSUSER
+ d) in the Extra Param 1 field Parameter Value enter your API user name
+ e) in the Extra Param 2 field Parameter Name enter: ILSPASSWD
+ f) in the Extra Param 2 field Parameter Value enter your API user password
+ g) in the Data Parameter Parameter Name enter: data
+ h) In the Remove Message From Queue Upon Successful Processing Determined By,
+ choose Service Response Starts With and enter: <success
+
+
+II. Returning test results back to CCURE from the iLS
+
+1) In the CCURE system, configure UDF field sets to receive the data:
+ a) UDF__TRAINING_COURSE_1_ - to receive the course name
+ b) UDF__TRAINING_DATE_1_ - to receive the course completion date
+ c) UDF__TRAINING_SCORE_1_ - to receive the user's score
+ d) UDF__TRAINING_RESULT_1_ - to receive PASSED or FAILED
+
+ e) repeat these fields using _2_ ... _n_ for n number of courses to be
+ returned to CCURE from the iLS.
+
+1) In the iLS System Management Panel
+ a) enable Web Service API
+ b) enter the URL to the iLS CCURE updatescore.vws webservice in the
+ Callback URL - Course Complete field, e.g.,
+ http://www.mytrainingportal.net/airportXYZ/api/ccure/updatescore.vws/
+2) In the iLS sysconfig.<companynumber>.properties file enter the Victor Web Services
+ configuration information
+ a) CCUREVWSRoot=https\://ccure.airportXYZ.com/victorwebservices/api
+ b) CCUREUser=Worgroup\\ccuremgr
+ c) CCUREPassword=xyzzy
+
+3) In the iLS database COURSE table, for each course which should report data
+ to CCURE, enter into the USERDATA column for that course
+ an integer which corresponds to the UDF fieldset number which should
+ receive the data for that course (fieldsets created in step II.1)
+
Deleted: branches/1.6/addons/ccure/vws/SimpleMessageQueue-installer.exe
===================================================================
(Binary files differ)
Copied: branches/1.6/addons/ccure/vws/SimpleMessageQueue-installer.exe (from rev 1457, trunk/addons/ccure/vws/SimpleMessageQueue-installer.exe)
===================================================================
(Binary files differ)
Modified: branches/1.6/webapp/api/ccure/user/put/index.jsp
===================================================================
--- branches/1.6/webapp/api/ccure/user/put/index.jsp 2016-05-09 23:12:32 UTC (rev 1457)
+++ branches/1.6/webapp/api/ccure/user/put/index.jsp 2016-05-09 23:15:45 UTC (rev 1458)
@@ -253,12 +253,27 @@
++errCode;
val = record.getValue("UDF__COMPANY_");
+
+
+ // again, code to look in multiple places for workgroup information
if (val == null || val.length() == 0) val = record.getValue("UDF__COMPANY_1_");
if (val == null || val.length() == 0) val = record.getValue("UDF__VQQ_CO_");
if (val == null || val.length() == 0) val = record.getValue("UDF__CRG_CO_");
if (val == null || val.length() == 0) val = record.getValue("UDF__JIA_COMPANY_");
if (val == null || val.length() == 0) val = record.getValue("UDF__CECIL_COMPANY_");
if (val == null || val.length() == 0) val = record.getValue("UDF__JAXEX_COMPANY_");
+ if (val == null || val.length() == 0) {
+ XMLBlock credentials = record.getBlock("SoftwareHouse.NextGen.Common.SecurityObjects.Credential");
+ if (credentials != null) {
+ val = credentials.getValue("UDF__COMPANY_");
+ if (val == null || val.length() == 0) val = credentials.getValue("UDF__COMPANY_1_");
+ if (val == null || val.length() == 0) val = credentials.getValue("UDF__VQQ_CO_");
+ if (val == null || val.length() == 0) val = credentials.getValue("UDF__CRG_CO_");
+ if (val == null || val.length() == 0) val = credentials.getValue("UDF__JIA_COMPANY_");
+ if (val == null || val.length() == 0) val = credentials.getValue("UDF__CECIL_COMPANY_");
+ if (val == null || val.length() == 0) val = credentials.getValue("UDF__JAXEX_COMPANY_");
+ }
+ }
val2 = request.getParameter("locationUserData");
int requestedLocation = -1;
if ((val != null && val.trim().length() > 0) || (val2 != null && val2.trim().length() > 0)) {
More information about the Ils-source
mailing list