Files
harbour-core/harbour/tests/testhtml.prg
Viktor Szakats 2e33010e8a 2009-03-25 11:35 UTC+0100 Viktor Szakats (harbour.01 syenar hu)
* tests/testhtml.prg
    * Update by Vailton Renato applied.

  * INSTALL
    * Minor formatting.

  * bin/postinst.bat
    + Minor cleanup to creation of hbrun/hbtest dll versions.
      (now it's more difficult to mislead it by already existing
      foreign .dlls)

  * contrib/hbqt/Makefile
  * contrib/hbapollo/Makefile
    - Disabled for mingw64.

  * contrib/rddads/rddads.h
    + Added workaround to compile under mingw64.

  * contrib/gtwvg/gtwvg.h
  * contrib/gtwvg/wvggui.h
    ! Fixed to _not_ override _WIN32_IE. Overriding these version
      numbers is generally a very bad idea. Instead the code should
      adapt to whatever values are defined by system headers.
      This fixes most mingw64 errors. Please test other compilers.

  * contrib/xhb/hbxml.c
  * contrib/hbfimage/fi_winfu.c
  * contrib/hbwin/wapi_commctrl.c
    ! Pointer/handle to integer conversion.

  * contrib/gtwvg/wvgcuig.c
  * contrib/gtwvg/wvgwin.c
    ! Fixed NULL used instead of 0.
    ! Fixed ISNIL() usage. GTWVG code is full of ISNIL() macros,
      which makes the code prone to GPFs and other unexpected
      behaviour when wrong type is passed. The solution is to
      change all these to type specific IS*() macros.

  ; TOFIX: (core and all contribs)

    C:/DOCUME~1/vszakats/LOCALS~1/Temp/ccVcE53g.s: Assembler messages:
    C:/DOCUME~1/vszakats/LOCALS~1/Temp/ccVcE53g.s:20: Error: `0x0e10(%rax,%ecx,4)' is not a valid base/index expression

    In these files:
    x86_64-pc-mingw32-gcc -I. -I../../../../../include -Wall -W -O3 -fomit-frame-pointer  -DHB_MT_VM  -c ../../../hvm.c -ohvm.o
    x86_64-pc-mingw32-gcc -I. -I../../../../../include -Wall -W -O3 -fomit-frame-pointer  -DHB_MT_VM  -c ../../../arrays.c -oarrays.o
    x86_64-pc-mingw32-gcc -I. -I../../../../../include -Wall -W -O3 -fomit-frame-pointer  -DHB_MT_VM  -c ../../../asort.c -oasort.o
    x86_64-pc-mingw32-gcc -I. -I../../../../../include -Wall -W -O3 -fomit-frame-pointer  -DHB_MT_VM  -c ../../../classes.c -oclasses.o
    x86_64-pc-mingw32-gcc -I. -I../../../../../include -Wall -W -O3 -fomit-frame-pointer  -DHB_MT_VM  -c ../../../cmdarg.c -ocmdarg.o
    x86_64-pc-mingw32-gcc -I. -I../../../../../include -Wall -W -O3 -fomit-frame-pointer  -DHB_MT_VM  -c ../../../debug.c -odebug.o
    x86_64-pc-mingw32-gcc -I. -I../../../../../include -Wall -W -O3 -fomit-frame-pointer  -DHB_MT_VM  -c ../../../dynlibhb.c -odynlibhb.o
    x86_64-pc-mingw32-gcc -I. -I../../../../../include -Wall -W -O3 -fomit-frame-pointer  -DHB_MT_VM  -c ../../../dynsym.c -odynsym.o
    x86_64-pc-mingw32-gcc -I. -I../../../../../include -Wall -W -O3 -fomit-frame-pointer  -DHB_MT_VM  -c ../../../codebloc.c -ocodebloc.o
    x86_64-pc-mingw32-gcc -I. -I../../../../../include -Wall -W -O3 -fomit-frame-pointer  -DHB_MT_VM  -c ../../../estack.c -oestack.o
    x86_64-pc-mingw32-gcc -I. -I../../../../../include -Wall -W -O3 -fomit-frame-pointer  -DHB_MT_VM  -c ../../../eval.c -oeval.o
    x86_64-pc-mingw32-gcc -I. -I../../../../../include -Wall -W -O3 -fomit-frame-pointer  -DHB_MT_VM  -c ../../../evalhb.c -oevalhb.o
    x86_64-pc-mingw32-gcc -I. -I../../../../../include -Wall -W -O3 -fomit-frame-pointer  -DHB_MT_VM  -c ../../../extend.c -oextend.o
    x86_64-pc-mingw32-gcc -I. -I../../../../../include -Wall -W -O3 -fomit-frame-pointer  -DHB_MT_VM  -c ../../../fm.c -ofm.o
    x86_64-pc-mingw32-gcc -I. -I../../../../../include -Wall -W -O3 -fomit-frame-pointer  -DHB_MT_VM  -c ../../../garbage.c -ogarbage.o
    x86_64-pc-mingw32-gcc -I. -I../../../../../include -Wall -W -O3 -fomit-frame-pointer  -DHB_MT_VM  -c ../../../hashes.c -ohashes.o
    x86_64-pc-mingw32-gcc -I. -I../../../../../include -Wall -W -O3 -fomit-frame-pointer  -DHB_MT_VM  -c ../../../hashfunc.c -ohashfunc.o
    x86_64-pc-mingw32-gcc -I. -I../../../../../include -Wall -W -O3 -fomit-frame-pointer  -DHB_MT_VM  -c ../../../itemapi.c -oitemapi.o
    x86_64-pc-mingw32-gcc -I. -I../../../../../include -Wall -W -O3 -fomit-frame-pointer  -DHB_MT_VM  -c ../../../macro.c -omacro.o
    x86_64-pc-mingw32-gcc -I. -I../../../../../include -Wall -W -O3 -fomit-frame-pointer  -DHB_MT_VM  -c ../../../memvars.c -omemvars.o
    x86_64-pc-mingw32-gcc -I. -I../../../../../include -Wall -W -O3 -fomit-frame-pointer  -DHB_MT_VM  -c ../../../pcount.c -opcount.o
    x86_64-pc-mingw32-gcc -I. -I../../../../../include -Wall -W -O3 -fomit-frame-pointer  -DHB_MT_VM  -c ../../../proc.c -oproc.o
    x86_64-pc-mingw32-gcc -I. -I../../../../../include -Wall -W -O3 -fomit-frame-pointer  -DHB_MT_VM  -c ../../../pvalue.c -opvalue.o
    x86_64-pc-mingw32-gcc -I. -I../../../../../include -Wall -W -O3 -fomit-frame-pointer  -DHB_MT_VM  -c ../../../runner.c -orunner.o
    x86_64-pc-mingw32-gcc -I. -I../../../../../include -Wall -W -O3 -fomit-frame-pointer  -DHB_MT_VM  -c ../../../set.c -oset.o
    x86_64-pc-mingw32-gcc -I. -I../../../../../include -Wall -W -O3 -fomit-frame-pointer  -DHB_MT_VM  -c ../../../thread.c -othread.o
    x86_64-pc-mingw32-gcc -I. -I../../../../../include -Wall -W -O3 -fomit-frame-pointer   -DHB_FM_STATISTICS -DHB_MT_VM  -c ../../../fm.c -ofm.o

    ../../dbfntx1.c: In function 'hb_ntxTagHeaderCheck':
    ../../dbfntx1.c:1054: warning: dereferencing type-punned pointer will break strict-aliasing rules
    ../../dbfntx1.c:1054: warning: dereferencing type-punned pointer will break strict-aliasing rules
    ../../dbfntx1.c:1055: warning: dereferencing type-punned pointer will break strict-aliasing rules
    ../../dbfntx1.c:1055: warning: dereferencing type-punned pointer will break strict-aliasing rules
    ../../dbfntx1.c:1055: warning: dereferencing type-punned pointer will break strict-aliasing rules
    ../../dbfntx1.c:1055: warning: dereferencing type-punned pointer will break strict-aliasing rules
    ../../dbfnsx1.c: In function 'hb_nsxTagHeaderCheck':
    ../../dbfnsx1.c:1282: warning: dereferencing type-punned pointer will break strict-aliasing rules
    ../../dbfnsx1.c:1284: warning: dereferencing type-punned pointer will break strict-aliasing rules
    ../../dbfnsx1.c:1285: warning: dereferencing type-punned pointer will break strict-aliasing rules
    ../../dbfnsx1.c:1285: warning: dereferencing type-punned pointer will break strict-aliasing rules
    ../../dbfnsx1.c:1285: warning: dereferencing type-punned pointer will break strict-aliasing rules
    ../../dbfnsx1.c:1285: warning: dereferencing type-punned pointer will break strict-aliasing rules
    ../../dbfnsx1.c: In function 'hb_nsxPageFree':
    ../../dbfnsx1.c:1573: warning: dereferencing type-punned pointer will break strict-aliasing rules
    ../../dbfnsx1.c:1573: warning: dereferencing type-punned pointer will break strict-aliasing rules
    ../../dbfnsx1.c:1573: warning: dereferencing type-punned pointer will break strict-aliasing rules
    ../../dbfnsx1.c:1573: warning: dereferencing type-punned pointer will break strict-aliasing rules
    ../../dbfnsx1.c: In function 'hb_nsxPageNew':
    ../../dbfnsx1.c:1622: warning: dereferencing type-punned pointer will break strict-aliasing rules
    ../../dbfnsx1.c:1622: warning: dereferencing type-punned pointer will break strict-aliasing rules
    ../../dbfnsx1.c:1622: warning: dereferencing type-punned pointer will break strict-aliasing rules
    ../../dbfnsx1.c:1622: warning: dereferencing type-punned pointer will break strict-aliasing rules

    ../../hb_btree.c: In function 'StackSkip':
    ../../hb_btree.c:643: warning: cast from pointer to integer of different size
    ../../hb_btree.c: In function 'Grow':
    ../../hb_btree.c:739: warning: cast from pointer to integer of different size

    ../../getenvrn.c: In function 'HB_FUN_FT_GETE':
    ../../getenvrn.c:178: warning: implicit declaration of function 'GetEnvironmentStrings'
    ../../getenvrn.c:178: warning: initialization makes pointer from integer without a cast

    ../../win_dll.c: In function 'DllExec':
    ../../win_dll.c:509: warning: cast from pointer to integer of different size
    ../../win_dll.c:603: warning: cast to pointer from integer of different size
    ../../win_dll.c:672: warning: cast to pointer from integer of different size
    ../../win_dll.c:689: warning: cast to pointer from integer of different size

    ../../hbserv.c: In function 's_serviceSetHBSig':
    ../../hbserv.c:638: warning: passing argument 1 of 'SetUnhandledExceptionFilter' from incompatible pointer type

    ../../firebird.c: In function 'HB_FUN_FBCREATEDB':
    ../../firebird.c:87: warning: initialization makes integer from pointer without a cast
    ../../firebird.c:88: warning: initialization makes integer from pointer without a cast
    ../../firebird.c: In function 'HB_FUN_FBCONNECT':
    ../../firebird.c:115: warning: initialization makes integer from pointer without a cast
    ../../firebird.c:143: warning: cast to pointer from integer of different size
    ../../firebird.c: In function 'HB_FUN_FBCLOSE':
    ../../firebird.c:149: warning: cast from pointer to integer of different size
    ../../firebird.c: In function 'HB_FUN_FBSTARTTRANSACTION':
    ../../firebird.c:172: warning: cast from pointer to integer of different size
    ../../firebird.c:173: warning: initialization makes integer from pointer without a cast
    ../../firebird.c:179: warning: cast to pointer from integer of different size
    ../../firebird.c: In function 'HB_FUN_FBCOMMIT':
    ../../firebird.c:184: warning: cast from pointer to integer of different size
    ../../firebird.c: In function 'HB_FUN_FBROLLBACK':
    ../../firebird.c:195: warning: cast from pointer to integer of different size
    ../../firebird.c: In function 'HB_FUN_FBEXECUTE':
    ../../firebird.c:206: warning: cast from pointer to integer of different size
    ../../firebird.c:207: warning: initialization makes integer from pointer without a cast
    ../../firebird.c:215: warning: cast from pointer to integer of different size
    ../../firebird.c: In function 'HB_FUN_FBQUERY':
    ../../firebird.c:249: warning: cast from pointer to integer of different size
    ../../firebird.c:250: warning: initialization makes integer from pointer without a cast
    ../../firebird.c:253: warning: initialization makes integer from pointer without a cast
    ../../firebird.c:270: warning: cast from pointer to integer of different size
    ../../firebird.c:375: warning: cast to pointer from integer of different size
    ../../firebird.c:379: warning: cast to pointer from integer of different size
    ../../firebird.c: In function 'HB_FUN_FBFETCH':
    ../../firebird.c:395: warning: cast from pointer to integer of different size
    ../../firebird.c: In function 'HB_FUN_FBFREE':
    ../../firebird.c:419: warning: cast from pointer to integer of different size
    ../../firebird.c:421: warning: cast from pointer to integer of different size
    ../../firebird.c: In function 'HB_FUN_FBGETBLOB':
    ../../firebird.c:613: warning: cast from pointer to integer of different size
    ../../firebird.c:614: warning: initialization makes integer from pointer without a cast
    ../../firebird.c:615: warning: initialization makes integer from pointer without a cast
    ../../firebird.c:624: warning: cast from pointer to integer of different size

    ../../fbirddd.c: In function 'fbConnect':
    ../../fbirddd.c:164: warning: initialization makes integer from pointer without a cast
    ../../fbirddd.c:192: warning: cast to pointer from integer of different size
    ../../fbirddd.c: In function 'fbOpen':
    ../../fbirddd.c:217: warning: initialization makes integer from pointer without a cast
    ../../fbirddd.c:218: warning: initialization makes integer from pointer without a cast
    ../../fbirddd.c:409: warning: assignment makes pointer from integer without a cast
    ../../fbirddd.c:410: warning: assignment makes pointer from integer without a cast
    ../../fbirddd.c: In function 'fbClose':
    ../../fbirddd.c:446: warning: passing argument 2 of 'isc_dsql_free_statement' from incompatible pointer type
    c:/devl/Firebird-2.1.1/include/ibase.h:629: note: expected 'isc_stmt_handle *' but argument is of type 'void **'
    ../../fbirddd.c:451: warning: passing argument 2 of 'isc_rollback_transaction' from incompatible pointer type
    c:/devl/Firebird-2.1.1/include/ibase.h:780: note: expected 'isc_tr_handle *' but argument is of type 'void **'
    ../../fbirddd.c: In function 'fbGoTo':
    ../../fbirddd.c:469: warning: passing argument 2 of 'isc_dsql_fetch' from incompatible pointer type
    c:/devl/Firebird-2.1.1/include/ibase.h:622: note: expected 'isc_stmt_handle *' but argument is of type 'void **'
    ../../fbirddd.c:531: warning: passing argument 2 of 'isc_dsql_free_statement' from incompatible pointer type
    c:/devl/Firebird-2.1.1/include/ibase.h:629: note: expected 'isc_stmt_handle *' but argument is of type 'void **'
    ../../fbirddd.c:538: warning: passing argument 2 of 'isc_commit_transaction' from incompatible pointer type
    c:/devl/Firebird-2.1.1/include/ibase.h:524: note: expected 'isc_tr_handle *' but argument is of type 'void **'
2009-03-25 10:49:21 +00:00

165 lines
4.3 KiB
Plaintext

//
// $Id$
//
/*
*
* testhtml.prg
* Harbour Test of a HTML-Generator class.
*
* 1999/05/30 First implementation.
*
* Tips: - Use ShowResults to make dynamic html (to test dynamic
* results, put the exe file on CGI-BIN dir or equivalent);
* - Use SaveToFile to make static html page
*
**/
STATIC s_cNewLine
FUNCTION Main()
LOCAL oHTML := THTML():New()
s_cNewLine := HB_OSNewLine()
oHTML:SetTitle( "Harbour Power Demonstration" )
oHTML:AddHead( "Harbour Project" )
oHTML:AddPara( "<B>Harbour</B> is xBase at its best. Have a taste today!", "LEFT" )
oHTML:AddPara( "<B>L i n k s</B>", "CENTER" )
oHTML:AddLink( "http://www.harbour-project.org", "Meet the harbour power!" )
oHTML:Generate()
// Uncomment the following if you don't have a Web Server to test
// this sample
// oHTML:SaveToFile( "test.htm" )
// If the above is uncommented, you may comment this line:
oHTML:ShowResult()
RETURN( NIL )
/*---------------------------------------------------------------------------*/
FUNCTION THTML
STATIC oClass
IF oClass == NIL
oClass := HBClass():New( "THTML" )
oClass:AddData( "cTitle" ) // Page Title
oClass:AddData( "cBody" ) // HTML Body Handler
oClass:AddData( "cBGColor" ) // Background Color
oClass:AddData( "cLinkColor" ) // Link Color
oClass:AddData( "cvLinkColor" ) // Visited Link Color
oClass:AddData( "cContent" ) // Page Content Handler
oClass:AddMethod( "New", @New() ) // New Method
oClass:AddMethod( "SetTitle", @SetTitle() ) // Set Page Title
oClass:AddMethod( "AddHead", @AddHead() ) // Add <H1> Header
oClass:AddMethod( "AddLink", @AddLink() ) // Add Hyperlink
oClass:AddMethod( "AddPara", @AddPara() ) // Add Paragraph
oClass:AddMethod( "Generate", @Generate() ) // Generate HTML
oClass:AddMethod( "SaveToFile", @SaveToFile() ) // Saves Content to File
oClass:AddMethod( "ShowResult", @ShowResult() ) // Show Result - SEE Fcn
oClass:Create()
ENDIF
RETURN( oClass:Instance() )
STATIC FUNCTION New()
LOCAL Self := QSelf()
::cTitle := "Untitled"
::cBGColor := "#FFFFFF"
::cLinkColor := "#0000FF"
::cvLinkColor := "#FF0000"
::cContent := ""
::cBody := ""
RETURN Self
STATIC FUNCTION SetTitle( cTitle )
LOCAL Self := QSelf()
::cTitle := cTitle
RETURN Self
STATIC FUNCTION AddLink( cLinkTo, cLinkName )
LOCAL Self := QSelf()
::cBody := ::cBody + ;
"<A HREF='" + cLinkTo + "'>" + cLinkName + "</A>"
RETURN Self
STATIC FUNCTION AddHead( cDescr )
LOCAL Self := QSelf()
// Why this doesn't work?
// ::cBody += ...
// ???
::cBody := ::cBody + ;
"<H1>" + cDescr + "</H1>"
RETURN( NIL )
STATIC FUNCTION AddPara( cPara, cAlign )
LOCAL Self := QSelf()
//Default( cAlign, "Left" ) // removed Patrick Mast 2000-06-07
cAlign:=iif(cAlign==NIL,"Left",cAlign) //Added Patrick Mast 2000-06-17
::cBody := ::cBody + ;
"<P ALIGN='" + cAlign + "'>" + s_cNewLine + ;
cPara + s_cNewLine + ;
"</P>"
RETURN Self
STATIC FUNCTION Generate()
LOCAL Self := QSelf()
::cContent := ;
"<HTML><HEAD>" + s_cNewLine + ;
"<TITLE>" + ::cTitle + "</TITLE>" + s_cNewLine + ;
"<BODY link='" + ::cLinkColor + "' " + ;
"vlink='" + ::cvLinkColor + "'>" + + s_cNewLine + ;
::cBody + s_cNewLine + ;
"</BODY></HTML>"
RETURN Self
STATIC FUNCTION ShowResult()
LOCAL Self := QSelf()
OutStd( ;
;// "HTTP/1.0 200 OK" + s_cNewLine + ;
"CONTENT-TYPE: TEXT/HTML" + s_cNewLine + s_cNewLine + ;
::cContent )
RETURN Self
STATIC FUNCTION SaveToFile( cFile )
LOCAL Self := QSelf()
LOCAL hFile := FCreate( cFile )
FWrite( hFile, ::cContent )
FClose( hFile )
RETURN Self