[Runtime tests] Added file tests for https://github.com/X-Sharp/XSharpPublic/issues/688

//
// Copyright (c) XSharp B.V.  All Rights Reserved.
// Licensed under the Apache License, Version 2.0.
// See License.txt in the project root for license information.
//
USING System
USING System.Collections.Generic
USING System.Linq
USING System.Text
USING XUnit

#pragma warnings(165, off)  // unassigned variables
#pragma warnings(618, off)  // obsolete function SplitPath

// Array tests are not working correctly yet with the current build
BEGIN NAMESPACE XSharp.VO.Tests

	CLASS MiscTests

		[Fact, Trait("Category", "Misc")];
		METHOD IntLiteralTest() AS VOID
			LOCAL dec AS DWORD
			LOCAL thou AS DWORD

			dec := SetDecimalSep(Asc(","))
			thou := SetThousandSep(Asc("."))
			Assert.Equal(" 12.345,00" , Transform(12345.0, "999,999.99"))
			// this fails:
			Assert.Equal(" 12.345,00" , Transform(12345, "999,999.99"))

			SetDecimalSep(Asc("."))
			SetThousandSep(Asc(","))
			Assert.Equal(" 12,345.00" , Transform(12345.0, "999,999.99"))
			Assert.Equal(" 12,345.00" , Transform(12345, "999,999.99"))

			SetDecimalSep(dec)
			SetThousandSep(thou)
		RETURN

		[Fact, Trait("Category", "SplitPath")];
		METHOD SplitPathTests() AS VOID
			LOCAL cDrive := "",cDir := "",cFile := "",cExt := "" AS STRING
			SplitPath("C:\folder\file.ext" ,  REF cDrive , REF cDir , REF cFile , REF cExt)

			Assert.Equal("C:" , cDrive)
			Assert.Equal("\folder\" , cDir)

			Assert.Equal("file" , cFile)
			Assert.Equal(".ext" , cExt)
		RETURN

		[Fact, Trait("Category", "SplitPathVO")];
		METHOD SplitPathVO() AS VOID
			LOCAL cPath ,cDrive ,cDir ,cFile ,cExt AS STRING
			LOCAL pszDrive, pszDir AS PSZ
			LOCAL pszFile, pszExt AS PSZ

			cPath := "C:\testfolder\testfile.prg"

			pszDrive := MemAlloc(2+1)
			pszDir   := MemAlloc(255+1)
			pszFile  := MemAlloc(255+1)
			pszExt   := MemAlloc(7+1)

			SplitPath( String2Psz(cPath), pszDrive, pszDir, pszFile, pszExt)

			cDrive := Psz2String(pszDrive)
			cDir   := Psz2String(pszDir)
			cFile  := Psz2String(pszFile)
			cExt   := Psz2String(pszExt)

			MemFree(pszDrive)
			MemFree(pszDir)
			MemFree(pszFile)
			MemFree(pszExt)

            Assert.Equal("C:" , cDrive)
			Assert.Equal("\testfolder\" , cDir)
			Assert.Equal("\testfolder\" , cDir)
			Assert.Equal("testfile" , cFile)
			Assert.Equal(".prg" , cExt)
		RETURN

		[Fact, Trait("Category", "Directory")];
		METHOD DirectoryTests() AS VOID
			Assert.Equal(0u , ALen(Directory("K:\drive does not exist")))
			Assert.Equal(0u , ALen(Directory("K:\drive does not exist","V")))
			Assert.Equal(0u , ALen(Directory("C:\invalid:path")))
			Assert.Equal(1u , ALen(Directory("C:\invalid:path","V")))
			Assert.Equal(0u , ALen(Directory("C:invalid:path")))
			Assert.Equal(1u , ALen(Directory("C:invalid:path","V")))
			Assert.Equal(0u , ALen(Directory("N:")))
			Assert.Equal(0u , ALen(Directory("N:","V")))

		[Fact, Trait("Category", "Empty")];
		METHOD EmptyFuncTests() AS VOID
			Assert.True(Empty(0))
			Assert.True(Empty(FALSE))
			Assert.True(Empty(""))
			Assert.True(Empty(Chr(10) + Chr(9) + Chr(13)))
			Assert.True(Empty(NULL_SYMBOL))
			Assert.True(Empty(0000.00.00))
			Assert.True(Empty({}))

			Assert.True(Empty(NULL_PTR))
			LOCAL p AS PTR
			p := NULL_PTR
			Assert.True(Empty(p))

			Assert.True(Empty(NULL_PSZ))
			LOCAL z AS PSZ
			z := NULL_PSZ
			Assert.True(Empty(z))

			Assert.False(Empty(1))
			Assert.False(Empty(TRUE))
			Assert.False(Empty("a"))
			Assert.False(Empty(Chr(1)))
			Assert.False(Empty(#abc))
			Assert.False(Empty(2000.01.01))
			Assert.False(Empty({{}}))

			p := @p
			Assert.False(Empty(p))
			z := String2Psz("test")
			Assert.False(Empty(z))

		[Fact, Trait("Category", "Empty")];
		METHOD W2String_tests() AS VOID
			LOCAL cText := "The brown fox does the funny stuff that we all know" AS STRING
			Assert.Equal(cText , W2String(String2W(cText)))

        [Fact, Trait("Category", "IsObject")];
		METHOD IsObject_Tests() AS VOID
			LOCAL u AS USUAL
            Assert.False(IsObject(u))
            Assert.False(IsObject(NIL))
            u := NULL
            Assert.True(IsObject(u))
            LOCAL o AS OBJECT
            Assert.True(IsObject(o))
            o := NULL
            Assert.True(IsObject(o))
            LOCAL t AS System.Collections.ArrayList
            Assert.True(IsObject(t))
            t := NULL
            Assert.True(IsObject(t))
            t := System.Collections.ArrayList{}
            Assert.True(IsObject(t))

        [Fact, Trait("Category", "EmptyUsual")];
		METHOD EmptyUsual_Tests() AS VOID
			LOCAL u AS USUAL
			EnforceType(REF u, STRING)
			Assert.True(u == "")
			Assert.True(UsualType(u) == STRING)

			u := 123
			EnforceType(REF u, STRING)
			Assert.True(u == "")
			Assert.True(UsualType(u) == STRING)
			EnforceType(u, STRING)

			Assert.True(EmptyUsual(STRING) == "")

#pragma options ("lb", ON)
        [Fact, Trait("Category", "EmptyUsual")];
		METHOD SysObject_Test() AS VOID
			LOCAL o AS OBJECT
			o := SysObjectTestClass{}

			SysObject(o)

			Assert.Equal("test", (STRING) SysObject(o):Something )
			SysObject(o):Something := "abc"
			Assert.Equal(TRUE, (LOGIC)SysObject(o):SomeMethod())

			Assert.Equal("abc", (STRING) o:Something )
			Assert.Equal(TRUE, (LOGIC)SysObject():SomeMethod())

			Assert.Equal("abc", (STRING) SysObject():Something )

			LOCAL u AS USUAL
			u := SysObjectTestClass{}

			SysObject(o)

			Assert.Equal("test", (STRING) SysObject(u):Something )
			SysObject(u):Something := "abc"
			Assert.Equal(TRUE, (LOGIC)SysObject(u):SomeMethod())

			Assert.Equal("abc", (STRING) u:Something )
			Assert.Equal(TRUE, (LOGIC)SysObject():SomeMethod())

			Assert.Equal("abc", (STRING) SysObject():Something )
#pragma options ("lb", OFF)

        [Fact, Trait("Category", "EmptyUsual")];
		METHOD OClone_Tests() AS VOID
			LOCAL o1,o2 AS CloneTest
			o1 := CloneTest{123}
			o1:nExport := 456

			o2 := (CloneTest) OClone(o1)
			Assert.Equal(123 , o2:GetPrivate())
			Assert.Equal("123" , o2:cExport)
			Assert.Equal(456 , o2:nExport)

        [Fact, Trait("Category", "EmptyUsual")];
		METHOD File_Tests() AS VOID
			LOCAL hFile AS PTR
			LOCAL cFileName AS STRING
			LOCAL nResult AS DWORD
			LOCAL cBuffer AS STRING

			cFileName := "test.txt"
			hFile := FCreate(cFileName , FC_NORMAL)
			Assert.True(FEof(hFile))
			FWrite(hFile , "ABCDE" , 5)
			Assert.True(FEof(hFile))

			FSeek3(hFile, 1, FS_SET)
			Assert.False(FEof(hFile))
			nResult := FRead(hFile , REF cBuffer , 4)
			Assert.Equal(4U , nResult)
			Assert.Equal("BCDE" , cBuffer)
			Assert.True(FEof(hFile))

			FSeek3(hFile, 1, FS_SET)
			Assert.False(FEof(hFile))
			nResult := FRead(hFile , REF cBuffer , 3)
			Assert.Equal(3U , nResult)
			Assert.Equal("BCD" , cBuffer)
			Assert.False(FEof(hFile))

			FSeek3(hFile, 2, FS_SET)
			Assert.False(FEof(hFile))
			nResult := FRead(hFile , REF cBuffer , 100)
			Assert.Equal(3U , nResult)
			Assert.Equal(3 , cBuffer:Length)
			Assert.Equal("CDE" , cBuffer)
			Assert.True(FEof(hFile))

			Assert.True( FClose(hFile) )

			hFile := FOpen(cFileName , FC_NORMAL)

			nResult := FRead(hFile , REF cBuffer , 3)
			Assert.Equal(3U , nResult)
			Assert.Equal("ABC" , cBuffer)
			Assert.False(FEof(hFile))

			nResult := FRead(hFile , REF cBuffer , 3)
			Assert.Equal(2U , nResult)
			Assert.Equal("DE" , cBuffer)
			Assert.True(FEof(hFile))

			FSeek3(hFile, 1, FS_SET)
			Assert.False(FEof(hFile))
			nResult := FRead(hFile , REF cBuffer , 4)
			Assert.Equal(4U , nResult)
			Assert.Equal("BCDE" , cBuffer)
			Assert.True(FEof(hFile))

			FSeek3(hFile, 1, FS_SET)
			Assert.False(FEof(hFile))
			nResult := FRead(hFile , REF cBuffer , 3)
			Assert.Equal(3U , nResult)
			Assert.Equal("BCD" , cBuffer)
			Assert.False(FEof(hFile))

			FSeek3(hFile, 2, FS_SET)
			Assert.False(FEof(hFile))
			nResult := FRead(hFile , REF cBuffer , 100)
			Assert.Equal(3U , nResult)
			Assert.Equal(3 , cBuffer:Length)
			Assert.Equal("CDE" , cBuffer)
			Assert.True(FEof(hFile))

			Assert.True( FClose(hFile) )

			hFile := FOpen(cFileName , FO_EXCLUSIVE)

			nResult := FRead(hFile , REF cBuffer , 3)
			Assert.Equal(3U , nResult)
			Assert.Equal("ABC" , cBuffer)
			Assert.False(FEof(hFile))

			nResult := FRead(hFile , REF cBuffer , 3)
			Assert.Equal(2U , nResult)
			Assert.Equal("DE" , cBuffer)
			Assert.True(FEof(hFile))

			FSeek3(hFile, 1, FS_SET)
			Assert.False(FEof(hFile))
			nResult := FRead(hFile , REF cBuffer , 4)
			Assert.Equal(4U , nResult)
			Assert.Equal("BCDE" , cBuffer)
			Assert.True(FEof(hFile))

			FSeek3(hFile, 1, FS_SET)
			Assert.False(FEof(hFile))
			nResult := FRead(hFile , REF cBuffer , 3)
			Assert.Equal(3U , nResult)
			Assert.Equal("BCD" , cBuffer)
			Assert.False(FEof(hFile))

			FSeek3(hFile, 2, FS_SET)
			Assert.False(FEof(hFile))
			nResult := FRead(hFile , REF cBuffer , 100)
			Assert.Equal(3U , nResult)
			Assert.Equal(3 , cBuffer:Length)
			Assert.Equal("CDE" , cBuffer)
			Assert.True(FEof(hFile))

			Assert.True( FClose(hFile) )

	END CLASS

	CLASS SysObjectTestClass
		EXPORT Something := "test"
		METHOD SomeMethod()
		RETURN TRUE
	END CLASS

	CLASS CloneTest
		EXPORT nExport AS INT
		EXPORT cExport AS STRING
		PRIVATE nPrivate AS INT
		CONSTRUCTOR(n AS INT)
			SELF:nPrivate := n
			SELF:cExport := n:ToString()

		METHOD GetPrivate() AS INT
		RETURN SELF:nPrivate
	END CLASS
END NAMESPACE

//
// Copyright (c) XSharp B.V.  All Rights Reserved.
// Licensed under the Apache License, Version 2.0.
// See License.txt in the project root for license information.
//
USING System
USING System.Collections.Generic
USING System.Linq
USING System.Text
USING XUnit

#pragma warnings(165, off)  // unassigned variables
#pragma warnings(618, off)  // obsolete function SplitPath

// Array tests are not working correctly yet with the current build
BEGIN NAMESPACE XSharp.VO.Tests

	CLASS MiscTests

		[Fact, Trait("Category", "Misc")];
		METHOD IntLiteralTest() AS VOID
			LOCAL dec AS DWORD
			LOCAL thou AS DWORD

			dec := SetDecimalSep(Asc(","))
			thou := SetThousandSep(Asc("."))
			Assert.Equal(" 12.345,00" , Transform(12345.0, "999,999.99"))
			// this fails:
			Assert.Equal(" 12.345,00" , Transform(12345, "999,999.99"))

			SetDecimalSep(Asc("."))
			SetThousandSep(Asc(","))
			Assert.Equal(" 12,345.00" , Transform(12345.0, "999,999.99"))
			Assert.Equal(" 12,345.00" , Transform(12345, "999,999.99"))

			SetDecimalSep(dec)
			SetThousandSep(thou)
		RETURN

		[Fact, Trait("Category", "SplitPath")];
		METHOD SplitPathTests() AS VOID
			LOCAL cDrive := "",cDir := "",cFile := "",cExt := "" AS STRING
			SplitPath("C:\folder\file.ext" ,  REF cDrive , REF cDir , REF cFile , REF cExt)

			Assert.Equal("C:" , cDrive)
			Assert.Equal("\folder\" , cDir)

			Assert.Equal("file" , cFile)
			Assert.Equal(".ext" , cExt)
		RETURN

		[Fact, Trait("Category", "SplitPathVO")];
		METHOD SplitPathVO() AS VOID
			LOCAL cPath ,cDrive ,cDir ,cFile ,cExt AS STRING
			LOCAL pszDrive, pszDir AS PSZ
			LOCAL pszFile, pszExt AS PSZ

			cPath := "C:\testfolder\testfile.prg"

			pszDrive := MemAlloc(2+1)
			pszDir   := MemAlloc(255+1)
			pszFile  := MemAlloc(255+1)
			pszExt   := MemAlloc(7+1)

			SplitPath( String2Psz(cPath), pszDrive, pszDir, pszFile, pszExt)

			cDrive := Psz2String(pszDrive)
			cDir   := Psz2String(pszDir)
			cFile  := Psz2String(pszFile)
			cExt   := Psz2String(pszExt)

			MemFree(pszDrive)
			MemFree(pszDir)
			MemFree(pszFile)
			MemFree(pszExt)

            Assert.Equal("C:" , cDrive)
			Assert.Equal("\testfolder\" , cDir)
			Assert.Equal("\testfolder\" , cDir)
			Assert.Equal("testfile" , cFile)
			Assert.Equal(".prg" , cExt)
		RETURN

		[Fact, Trait("Category", "Directory")];
		METHOD DirectoryTests() AS VOID
			Assert.Equal(0u , ALen(Directory("K:\drive does not exist")))
			Assert.Equal(0u , ALen(Directory("K:\drive does not exist","V")))
			Assert.Equal(0u , ALen(Directory("C:\invalid:path")))
			Assert.Equal(1u , ALen(Directory("C:\invalid:path","V")))
			Assert.Equal(0u , ALen(Directory("C:invalid:path")))
			Assert.Equal(1u , ALen(Directory("C:invalid:path","V")))
			Assert.Equal(0u , ALen(Directory("N:")))
			Assert.Equal(0u , ALen(Directory("N:","V")))

		[Fact, Trait("Category", "Empty")];
		METHOD EmptyFuncTests() AS VOID
			Assert.True(Empty(0))
			Assert.True(Empty(FALSE))
			Assert.True(Empty(""))
			Assert.True(Empty(Chr(10) + Chr(9) + Chr(13)))
			Assert.True(Empty(NULL_SYMBOL))
			Assert.True(Empty(0000.00.00))
			Assert.True(Empty({}))

			Assert.True(Empty(NULL_PTR))
			LOCAL p AS PTR
			p := NULL_PTR
			Assert.True(Empty(p))

			Assert.True(Empty(NULL_PSZ))
			LOCAL z AS PSZ
			z := NULL_PSZ
			Assert.True(Empty(z))

			Assert.False(Empty(1))
			Assert.False(Empty(TRUE))
			Assert.False(Empty("a"))
			Assert.False(Empty(Chr(1)))
			Assert.False(Empty(#abc))
			Assert.False(Empty(2000.01.01))
			Assert.False(Empty({{}}))

			p := @p
			Assert.False(Empty(p))
			z := String2Psz("test")
			Assert.False(Empty(z))

		[Fact, Trait("Category", "Empty")];
		METHOD W2String_tests() AS VOID
			LOCAL cText := "The brown fox does the funny stuff that we all know" AS STRING
			Assert.Equal(cText , W2String(String2W(cText)))

        [Fact, Trait("Category", "IsObject")];
		METHOD IsObject_Tests() AS VOID
			LOCAL u AS USUAL
            Assert.False(IsObject(u))
            Assert.False(IsObject(NIL))
            u := NULL
            Assert.True(IsObject(u))
            LOCAL o AS OBJECT
            Assert.True(IsObject(o))
            o := NULL
            Assert.True(IsObject(o))
            LOCAL t AS System.Collections.ArrayList
            Assert.True(IsObject(t))
            t := NULL
            Assert.True(IsObject(t))
            t := System.Collections.ArrayList{}
            Assert.True(IsObject(t))

        [Fact, Trait("Category", "EmptyUsual")];
		METHOD EmptyUsual_Tests() AS VOID
			LOCAL u AS USUAL
			EnforceType(REF u, STRING)
			Assert.True(u == "")
			Assert.True(UsualType(u) == STRING)

			u := 123
			EnforceType(REF u, STRING)
			Assert.True(u == "")
			Assert.True(UsualType(u) == STRING)
			EnforceType(u, STRING)

			Assert.True(EmptyUsual(STRING) == "")

#pragma options ("lb", ON)
        [Fact, Trait("Category", "EmptyUsual")];
		METHOD SysObject_Test() AS VOID
			LOCAL o AS OBJECT
			o := SysObjectTestClass{}

			SysObject(o)

			Assert.Equal("test", (STRING) SysObject(o):Something )
			SysObject(o):Something := "abc"
			Assert.Equal(TRUE, (LOGIC)SysObject(o):SomeMethod())

			Assert.Equal("abc", (STRING) o:Something )
			Assert.Equal(TRUE, (LOGIC)SysObject():SomeMethod())

			Assert.Equal("abc", (STRING) SysObject():Something )

			LOCAL u AS USUAL
			u := SysObjectTestClass{}

			SysObject(o)

			Assert.Equal("test", (STRING) SysObject(u):Something )
			SysObject(u):Something := "abc"
			Assert.Equal(TRUE, (LOGIC)SysObject(u):SomeMethod())

			Assert.Equal("abc", (STRING) u:Something )
			Assert.Equal(TRUE, (LOGIC)SysObject():SomeMethod())

			Assert.Equal("abc", (STRING) SysObject():Something )
#pragma options ("lb", OFF)

        [Fact, Trait("Category", "EmptyUsual")];
		METHOD OClone_Tests() AS VOID
			LOCAL o1,o2 AS CloneTest
			o1 := CloneTest{123}
			o1:nExport := 456

			o2 := (CloneTest) OClone(o1)
			Assert.Equal(123 , o2:GetPrivate())
			Assert.Equal("123" , o2:cExport)
			Assert.Equal(456 , o2:nExport)

	END CLASS

	CLASS SysObjectTestClass
		EXPORT Something := "test"
		METHOD SomeMethod()
		RETURN TRUE
	END CLASS

	CLASS CloneTest
		EXPORT nExport AS INT
		EXPORT cExport AS STRING
		PRIVATE nPrivate AS INT
		CONSTRUCTOR(n AS INT)
			SELF:nPrivate := n
			SELF:cExport := n:ToString()

		METHOD GetPrivate() AS INT
		RETURN SELF:nPrivate
	END CLASS
END NAMESPACE


QtXmlPatterns: updated to use the macro PINT

/*

  Qt5xHb - bibliotecas de ligao entre Harbour/xHarbour e Qt Framework 5

  Copyright (C) 2012-2017 Marcos Antonio Gambeta <marcosgambeta@uol.com.br>

*/

#include "hbclass.ch"

CLASS QXmlFormatter INHERIT QXmlSerializer

   DATA class_flags INIT 0
   DATA self_destruction INIT .F.

   METHOD new
   METHOD delete
   METHOD indentationDepth
   METHOD setIndentationDepth
   METHOD atomicValue
   METHOD attribute
   METHOD characters
   METHOD comment
   METHOD endDocument
   METHOD endElement
   METHOD endOfSequence
   METHOD processingInstruction
   METHOD startDocument
   METHOD startElement
   METHOD startOfSequence

   DESTRUCTOR destroyObject

END CLASS

PROCEDURE destroyObject () CLASS QXmlFormatter
   IF ::self_destruction
      ::delete()
   ENDIF
RETURN

#pragma BEGINDUMP

#include <Qt>

#ifndef __XHARBOUR__
#include <QXmlFormatter>
#endif

#include "qt5xhb_common.h"
#include "qt5xhb_clsid.h"
#include "qt5xhb_utils.h"

#ifdef __XHARBOUR__
#include <QXmlFormatter>
#endif

/*
QXmlFormatter ( const QXmlQuery & query, QIODevice * outputDevice
*/
HB_FUNC_STATIC( QXMLFORMATTER_NEW )
{
  QXmlQuery * par1 = (QXmlQuery *) _qt5xhb_itemGetPtr(1);
  QIODevice * par2 = (QIODevice *) _qt5xhb_itemGetPtr(2);
  QXmlFormatter * o = new QXmlFormatter ( *par1, par2 );
  _qt5xhb_storePointerAndFlag( o, true );
}

HB_FUNC_STATIC( QXMLFORMATTER_DELETE )
{
  QXmlFormatter * obj = (QXmlFormatter *) hb_itemGetPtr( hb_objSendMsg( hb_stackSelfItem(), "POINTER", 0 ) );
  if( obj )
  {
    delete obj;
    obj = NULL;
    PHB_ITEM self = hb_stackSelfItem();
    PHB_ITEM ptr = hb_itemPutPtr( NULL, NULL );
    hb_objSendMsg( self, "_pointer", 1, ptr );
    hb_itemRelease( ptr );
  }
  hb_itemReturn( hb_stackSelfItem() );
}

/*
int indentationDepth () const
*/
HB_FUNC_STATIC( QXMLFORMATTER_INDENTATIONDEPTH )
{
  QXmlFormatter * obj = (QXmlFormatter *) _qt5xhb_itemGetPtrStackSelfItem();
  if( obj )
  {
    hb_retni( obj->indentationDepth (  ) );
  }
}

/*
void setIndentationDepth ( int depth )
*/
HB_FUNC_STATIC( QXMLFORMATTER_SETINDENTATIONDEPTH )
{
  QXmlFormatter * obj = (QXmlFormatter *) _qt5xhb_itemGetPtrStackSelfItem();
  if( obj )
  {
    obj->setIndentationDepth ( PINT(1) );
  }
  hb_itemReturn( hb_stackSelfItem() );
}

/*
virtual void atomicValue ( const QVariant & value )
*/
HB_FUNC_STATIC( QXMLFORMATTER_ATOMICVALUE )
{
  QXmlFormatter * obj = (QXmlFormatter *) _qt5xhb_itemGetPtrStackSelfItem();
  if( obj )
  {
    QVariant * par1 = (QVariant *) _qt5xhb_itemGetPtr(1);
    obj->atomicValue ( *par1 );
  }
  hb_itemReturn( hb_stackSelfItem() );
}

/*
virtual void attribute ( const QXmlName & name, const QStringRef & value )
*/
HB_FUNC_STATIC( QXMLFORMATTER_ATTRIBUTE )
{
  QXmlFormatter * obj = (QXmlFormatter *) _qt5xhb_itemGetPtrStackSelfItem();
  if( obj )
  {
    QXmlName * par1 = (QXmlName *) _qt5xhb_itemGetPtr(1);
    QStringRef * par2 = (QStringRef *) _qt5xhb_itemGetPtr(2);
    obj->attribute ( *par1, *par2 );
  }
  hb_itemReturn( hb_stackSelfItem() );
}

/*
virtual void characters ( const QStringRef & value )
*/
HB_FUNC_STATIC( QXMLFORMATTER_CHARACTERS )
{
  QXmlFormatter * obj = (QXmlFormatter *) _qt5xhb_itemGetPtrStackSelfItem();
  if( obj )
  {
    QStringRef * par1 = (QStringRef *) _qt5xhb_itemGetPtr(1);
    obj->characters ( *par1 );
  }
  hb_itemReturn( hb_stackSelfItem() );
}

/*
virtual void comment ( const QString & value )
*/
HB_FUNC_STATIC( QXMLFORMATTER_COMMENT )
{
  QXmlFormatter * obj = (QXmlFormatter *) _qt5xhb_itemGetPtrStackSelfItem();
  if( obj )
  {
    obj->comment ( PQSTRING(1) );
  }
  hb_itemReturn( hb_stackSelfItem() );
}

/*
virtual void endDocument ()
*/
HB_FUNC_STATIC( QXMLFORMATTER_ENDDOCUMENT )
{
  QXmlFormatter * obj = (QXmlFormatter *) _qt5xhb_itemGetPtrStackSelfItem();
  if( obj )
  {
    obj->endDocument (  );
  }
  hb_itemReturn( hb_stackSelfItem() );
}

/*
virtual void endElement ()
*/
HB_FUNC_STATIC( QXMLFORMATTER_ENDELEMENT )
{
  QXmlFormatter * obj = (QXmlFormatter *) _qt5xhb_itemGetPtrStackSelfItem();
  if( obj )
  {
    obj->endElement (  );
  }
  hb_itemReturn( hb_stackSelfItem() );
}

/*
virtual void endOfSequence ()
*/
HB_FUNC_STATIC( QXMLFORMATTER_ENDOFSEQUENCE )
{
  QXmlFormatter * obj = (QXmlFormatter *) _qt5xhb_itemGetPtrStackSelfItem();
  if( obj )
  {
    obj->endOfSequence (  );
  }
  hb_itemReturn( hb_stackSelfItem() );
}

/*
virtual void processingInstruction ( const QXmlName & name, const QString & value )
*/
HB_FUNC_STATIC( QXMLFORMATTER_PROCESSINGINSTRUCTION )
{
  QXmlFormatter * obj = (QXmlFormatter *) _qt5xhb_itemGetPtrStackSelfItem();
  if( obj )
  {
    QXmlName * par1 = (QXmlName *) _qt5xhb_itemGetPtr(1);
    obj->processingInstruction ( *par1, PQSTRING(2) );
  }
  hb_itemReturn( hb_stackSelfItem() );
}

/*
virtual void startDocument ()
*/
HB_FUNC_STATIC( QXMLFORMATTER_STARTDOCUMENT )
{
  QXmlFormatter * obj = (QXmlFormatter *) _qt5xhb_itemGetPtrStackSelfItem();
  if( obj )
  {
    obj->startDocument (  );
  }
  hb_itemReturn( hb_stackSelfItem() );
}

/*
virtual void startElement ( const QXmlName & name )
*/
HB_FUNC_STATIC( QXMLFORMATTER_STARTELEMENT )
{
  QXmlFormatter * obj = (QXmlFormatter *) _qt5xhb_itemGetPtrStackSelfItem();
  if( obj )
  {
    QXmlName * par1 = (QXmlName *) _qt5xhb_itemGetPtr(1);
    obj->startElement ( *par1 );
  }
  hb_itemReturn( hb_stackSelfItem() );
}

/*
virtual void startOfSequence ()
*/
HB_FUNC_STATIC( QXMLFORMATTER_STARTOFSEQUENCE )
{
  QXmlFormatter * obj = (QXmlFormatter *) _qt5xhb_itemGetPtrStackSelfItem();
  if( obj )
  {
    obj->startOfSequence (  );
  }
  hb_itemReturn( hb_stackSelfItem() );
}

#pragma ENDDUMP

/*

  Qt5xHb - bibliotecas de ligao entre Harbour/xHarbour e Qt Framework 5

  Copyright (C) 2012-2017 Marcos Antonio Gambeta <marcosgambeta@uol.com.br>

*/

#include "hbclass.ch"

CLASS QXmlFormatter INHERIT QXmlSerializer

   DATA class_flags INIT 0
   DATA self_destruction INIT .F.

   METHOD new
   METHOD delete
   METHOD indentationDepth
   METHOD setIndentationDepth
   METHOD atomicValue
   METHOD attribute
   METHOD characters
   METHOD comment
   METHOD endDocument
   METHOD endElement
   METHOD endOfSequence
   METHOD processingInstruction
   METHOD startDocument
   METHOD startElement
   METHOD startOfSequence

   DESTRUCTOR destroyObject

END CLASS

PROCEDURE destroyObject () CLASS QXmlFormatter
   IF ::self_destruction
      ::delete()
   ENDIF
RETURN

#pragma BEGINDUMP

#include <Qt>

#ifndef __XHARBOUR__
#include <QXmlFormatter>
#endif

#include "qt5xhb_common.h"
#include "qt5xhb_clsid.h"
#include "qt5xhb_utils.h"

#ifdef __XHARBOUR__
#include <QXmlFormatter>
#endif

/*
QXmlFormatter ( const QXmlQuery & query, QIODevice * outputDevice
*/
HB_FUNC_STATIC( QXMLFORMATTER_NEW )
{
  QXmlQuery * par1 = (QXmlQuery *) _qt5xhb_itemGetPtr(1);
  QIODevice * par2 = (QIODevice *) _qt5xhb_itemGetPtr(2);
  QXmlFormatter * o = new QXmlFormatter ( *par1, par2 );
  _qt5xhb_storePointerAndFlag( o, true );
}

HB_FUNC_STATIC( QXMLFORMATTER_DELETE )
{
  QXmlFormatter * obj = (QXmlFormatter *) hb_itemGetPtr( hb_objSendMsg( hb_stackSelfItem(), "POINTER", 0 ) );
  if( obj )
  {
    delete obj;
    obj = NULL;
    PHB_ITEM self = hb_stackSelfItem();
    PHB_ITEM ptr = hb_itemPutPtr( NULL, NULL );
    hb_objSendMsg( self, "_pointer", 1, ptr );
    hb_itemRelease( ptr );
  }
  hb_itemReturn( hb_stackSelfItem() );
}

/*
int indentationDepth () const
*/
HB_FUNC_STATIC( QXMLFORMATTER_INDENTATIONDEPTH )
{
  QXmlFormatter * obj = (QXmlFormatter *) _qt5xhb_itemGetPtrStackSelfItem();
  if( obj )
  {
    hb_retni( obj->indentationDepth (  ) );
  }
}

/*
void setIndentationDepth ( int depth )
*/
HB_FUNC_STATIC( QXMLFORMATTER_SETINDENTATIONDEPTH )
{
  QXmlFormatter * obj = (QXmlFormatter *) _qt5xhb_itemGetPtrStackSelfItem();
  if( obj )
  {
    obj->setIndentationDepth ( (int) hb_parni(1) );
  }
  hb_itemReturn( hb_stackSelfItem() );
}

/*
virtual void atomicValue ( const QVariant & value )
*/
HB_FUNC_STATIC( QXMLFORMATTER_ATOMICVALUE )
{
  QXmlFormatter * obj = (QXmlFormatter *) _qt5xhb_itemGetPtrStackSelfItem();
  if( obj )
  {
    QVariant * par1 = (QVariant *) _qt5xhb_itemGetPtr(1);
    obj->atomicValue ( *par1 );
  }
  hb_itemReturn( hb_stackSelfItem() );
}

/*
virtual void attribute ( const QXmlName & name, const QStringRef & value )
*/
HB_FUNC_STATIC( QXMLFORMATTER_ATTRIBUTE )
{
  QXmlFormatter * obj = (QXmlFormatter *) _qt5xhb_itemGetPtrStackSelfItem();
  if( obj )
  {
    QXmlName * par1 = (QXmlName *) _qt5xhb_itemGetPtr(1);
    QStringRef * par2 = (QStringRef *) _qt5xhb_itemGetPtr(2);
    obj->attribute ( *par1, *par2 );
  }
  hb_itemReturn( hb_stackSelfItem() );
}

/*
virtual void characters ( const QStringRef & value )
*/
HB_FUNC_STATIC( QXMLFORMATTER_CHARACTERS )
{
  QXmlFormatter * obj = (QXmlFormatter *) _qt5xhb_itemGetPtrStackSelfItem();
  if( obj )
  {
    QStringRef * par1 = (QStringRef *) _qt5xhb_itemGetPtr(1);
    obj->characters ( *par1 );
  }
  hb_itemReturn( hb_stackSelfItem() );
}

/*
virtual void comment ( const QString & value )
*/
HB_FUNC_STATIC( QXMLFORMATTER_COMMENT )
{
  QXmlFormatter * obj = (QXmlFormatter *) _qt5xhb_itemGetPtrStackSelfItem();
  if( obj )
  {
    obj->comment ( PQSTRING(1) );
  }
  hb_itemReturn( hb_stackSelfItem() );
}

/*
virtual void endDocument ()
*/
HB_FUNC_STATIC( QXMLFORMATTER_ENDDOCUMENT )
{
  QXmlFormatter * obj = (QXmlFormatter *) _qt5xhb_itemGetPtrStackSelfItem();
  if( obj )
  {
    obj->endDocument (  );
  }
  hb_itemReturn( hb_stackSelfItem() );
}

/*
virtual void endElement ()
*/
HB_FUNC_STATIC( QXMLFORMATTER_ENDELEMENT )
{
  QXmlFormatter * obj = (QXmlFormatter *) _qt5xhb_itemGetPtrStackSelfItem();
  if( obj )
  {
    obj->endElement (  );
  }
  hb_itemReturn( hb_stackSelfItem() );
}

/*
virtual void endOfSequence ()
*/
HB_FUNC_STATIC( QXMLFORMATTER_ENDOFSEQUENCE )
{
  QXmlFormatter * obj = (QXmlFormatter *) _qt5xhb_itemGetPtrStackSelfItem();
  if( obj )
  {
    obj->endOfSequence (  );
  }
  hb_itemReturn( hb_stackSelfItem() );
}

/*
virtual void processingInstruction ( const QXmlName & name, const QString & value )
*/
HB_FUNC_STATIC( QXMLFORMATTER_PROCESSINGINSTRUCTION )
{
  QXmlFormatter * obj = (QXmlFormatter *) _qt5xhb_itemGetPtrStackSelfItem();
  if( obj )
  {
    QXmlName * par1 = (QXmlName *) _qt5xhb_itemGetPtr(1);
    obj->processingInstruction ( *par1, PQSTRING(2) );
  }
  hb_itemReturn( hb_stackSelfItem() );
}

/*
virtual void startDocument ()
*/
HB_FUNC_STATIC( QXMLFORMATTER_STARTDOCUMENT )
{
  QXmlFormatter * obj = (QXmlFormatter *) _qt5xhb_itemGetPtrStackSelfItem();
  if( obj )
  {
    obj->startDocument (  );
  }
  hb_itemReturn( hb_stackSelfItem() );
}

/*
virtual void startElement ( const QXmlName & name )
*/
HB_FUNC_STATIC( QXMLFORMATTER_STARTELEMENT )
{
  QXmlFormatter * obj = (QXmlFormatter *) _qt5xhb_itemGetPtrStackSelfItem();
  if( obj )
  {
    QXmlName * par1 = (QXmlName *) _qt5xhb_itemGetPtr(1);
    obj->startElement ( *par1 );
  }
  hb_itemReturn( hb_stackSelfItem() );
}

/*
virtual void startOfSequence ()
*/
HB_FUNC_STATIC( QXMLFORMATTER_STARTOFSEQUENCE )
{
  QXmlFormatter * obj = (QXmlFormatter *) _qt5xhb_itemGetPtrStackSelfItem();
  if( obj )
  {
    obj->startOfSequence (  );
  }
  hb_itemReturn( hb_stackSelfItem() );
}

#pragma ENDDUMP


QtSvg: data for code generation updated

QtSvg: data for code generation updated

Modified:
codegen/QtSvg/QSvgRenderer.prg

%%
%% Qt4xHb - Bindings libraries for Harbour/xHarbour and Qt Framework 4
%%
%% Copyright (C) 2018 Marcos Antonio Gambeta <marcosgambeta AT outlook DOT com>
%%

$header

#include "hbclass.ch"

#ifndef QT4XHB_NO_REQUESTS
REQUEST QRECTF
REQUEST QSIZE
REQUEST QMATRIX
REQUEST QRECT
#endif

CLASS QSvgRenderer INHERIT QObject

   METHOD new
   METHOD delete
   METHOD animated
   METHOD boundsOnElement
   METHOD defaultSize
   METHOD elementExists
   METHOD framesPerSecond
   METHOD isValid
   METHOD matrixForElement
   METHOD setFramesPerSecond
   METHOD setViewBox
   METHOD viewBox
   METHOD viewBoxF
   METHOD load
   METHOD render

   METHOD onRepaintNeeded

   DESTRUCTOR destroyObject

END CLASS

$destructor

#pragma BEGINDUMP

$includes

$prototype=QSvgRenderer ( QObject * parent = 0 )
$internalConstructor=|new1|QObject *=0

$prototype=QSvgRenderer ( const QString & filename, QObject * parent = 0 )
$internalConstructor=|new2|const QString &,QObject *=0

$prototype=QSvgRenderer ( const QByteArray & contents, QObject * parent = 0 )
$internalConstructor=|new3|const QByteArray &,QObject *=0

$prototype=QSvgRenderer ( QXmlStreamReader * contents, QObject * parent = 0 )
$internalConstructor=|new4|QXmlStreamReader *,QObject *=0

//[1]QSvgRenderer ( QObject * parent = 0 )
//[2]QSvgRenderer ( const QString & filename, QObject * parent = 0 )
//[3]QSvgRenderer ( const QByteArray & contents, QObject * parent = 0 )
//[4]QSvgRenderer ( QXmlStreamReader * contents, QObject * parent = 0 )

HB_FUNC_STATIC( QSVGRENDERER_NEW )
{
  if( ISBETWEEN(0,1) && (ISQOBJECT(1)||ISNIL(1)) )
  {
    QSvgRenderer_new1();
  }
  else if( ISBETWEEN(1,2) && ISCHAR(1) && (ISQOBJECT(2)||ISNIL(2)) )
  {
    QSvgRenderer_new2();
  }
  else if( ISBETWEEN(1,2) && ISQBYTEARRAY(1) && (ISQOBJECT(2)||ISNIL(2)) )
  {
    QSvgRenderer_new3();
  }
  else if( ISBETWEEN(1,2) && ISQXMLSTREAMREADER(1) && (ISQOBJECT(2)||ISNIL(2)) )
  {
    QSvgRenderer_new4();
  }
  else
  {
    hb_errRT_BASE( EG_ARG, 3012, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS );
  }
}

$deleteMethod

$prototype=bool animated () const
$method=|bool|animated|

$prototype=QRectF boundsOnElement ( const QString & id ) const
$method=|QRectF|boundsOnElement|const QString &

$prototype=QSize defaultSize () const
$method=|QSize|defaultSize|

$prototype=bool elementExists ( const QString & id ) const
$method=|bool|elementExists|const QString &

$prototype=int framesPerSecond () const
$method=|int|framesPerSecond|

$prototype=bool isValid () const
$method=|bool|isValid|

$prototype=QMatrix matrixForElement ( const QString & id ) const
$method=|QMatrix|matrixForElement|const QString &

$prototype=void setFramesPerSecond ( int num )
$method=|void|setFramesPerSecond|int

$prototype=void setViewBox ( const QRect & viewbox )
$internalMethod=|void|setViewBox,setViewBox1|const QRect &

$prototype=void setViewBox ( const QRectF & viewbox )
$internalMethod=|void|setViewBox,setViewBox2|const QRectF &

//[1]void setViewBox ( const QRect & viewbox )
//[2]void setViewBox ( const QRectF & viewbox )

HB_FUNC_STATIC( QSVGRENDERER_SETVIEWBOX )
{
  if( ISNUMPAR(1) && ISQRECT(1) )
  {
    QSvgRenderer_setViewBox1();
  }
  else if( ISNUMPAR(1) && ISQRECTF(1) )
  {
    QSvgRenderer_setViewBox2();
  }
  else
  {
    hb_errRT_BASE( EG_ARG, 3012, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS );
  }
}

$prototype=QRect viewBox () const
$method=|QRect|viewBox|

$prototype=QRectF viewBoxF () const
$method=|QRectF|viewBoxF|

$prototype=bool load ( const QString & filename )
$internalMethod=|bool|load,load1|const QString &

$prototype=bool load ( const QByteArray & contents )
$internalMethod=|bool|load,load2|const QByteArray &

$prototype=bool load ( QXmlStreamReader * contents )
$internalMethod=|bool|load,load3|QXmlStreamReader *

//[1]bool load ( const QString & filename )
//[2]bool load ( const QByteArray & contents )
//[3]bool load ( QXmlStreamReader * contents )

HB_FUNC_STATIC( QSVGRENDERER_LOAD )
{
  if( ISNUMPAR(1) && ISCHAR(1) )
  {
    QSvgRenderer_load1();
  }
  else if( ISNUMPAR(1) && ISQBYTEARRAY(1) )
  {
    QSvgRenderer_load2();
  }
  else if( ISNUMPAR(1) && ISQXMLSTREAMREADER(1) )
  {
    QSvgRenderer_load3();
  }
  else
  {
    hb_errRT_BASE( EG_ARG, 3012, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS );
  }
}

$prototype=void render ( QPainter * painter )
$internalMethod=|void|render,render1|QPainter *

$prototype=void render ( QPainter * painter, const QRectF & bounds )
$internalMethod=|void|render,render2|QPainter *,const QRectF &

$prototype=void render ( QPainter * painter, const QString & elementId, const QRectF & bounds = QRectF() )
$internalMethod=|void|render,render3|QPainter *,const QString &,const QRectF &=QRectF()

//[1]void render ( QPainter * painter )
//[2]void render ( QPainter * painter, const QRectF & bounds )
//[3]void render ( QPainter * painter, const QString & elementId, const QRectF & bounds = QRectF() )

HB_FUNC_STATIC( QSVGRENDERER_RENDER )
{
  if( ISNUMPAR(1) && ISQPAINTER(1) )
  {
    QSvgRenderer_render1();
  }
  else if( ISNUMPAR(2) && ISQPAINTER(1) && ISQRECTF(2) )
  {
    QSvgRenderer_render2();
  }
  else if( ISBETWEEN(2,3) && ISQPAINTER(1) && ISCHAR(2) && (ISQRECTF(3)||ISNIL(3)) )
  {
    QSvgRenderer_render3();
  }
  else
  {
    hb_errRT_BASE( EG_ARG, 3012, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS );
  }
}

$beginSignals
$signal=|repaintNeeded()
$endSignals

#pragma ENDDUMP

%%
%% Qt4xHb - Bindings libraries for Harbour/xHarbour and Qt Framework 4
%%
%% Copyright (C) 2018 Marcos Antonio Gambeta <marcosgambeta AT outlook DOT com>
%%

$header

#include "hbclass.ch"

#ifndef QT4XHB_NO_REQUESTS
REQUEST QRECTF
REQUEST QSIZE
REQUEST QMATRIX
REQUEST QRECT
#endif

CLASS QSvgRenderer INHERIT QObject

   METHOD new
   METHOD delete
   METHOD animated
   METHOD boundsOnElement
   METHOD defaultSize
   METHOD elementExists
   METHOD framesPerSecond
   METHOD isValid
   METHOD matrixForElement
   METHOD setFramesPerSecond
   METHOD setViewBox
   METHOD viewBox
   METHOD viewBoxF
   METHOD load
   METHOD render

   METHOD onRepaintNeeded

   DESTRUCTOR destroyObject

END CLASS

$destructor

#pragma BEGINDUMP

$includes

$prototype=QSvgRenderer ( QObject * parent = 0 )
$internalConstructor=|new1|QObject *=0

$prototype=QSvgRenderer ( const QString & filename, QObject * parent = 0 )
$internalConstructor=|new2|const QString &,QObject *=0

$prototype=QSvgRenderer ( const QByteArray & contents, QObject * parent = 0 )
$internalConstructor=|new3|const QByteArray &,QObject *=0

$prototype=QSvgRenderer ( QXmlStreamReader * contents, QObject * parent = 0 )
$internalConstructor=|new4|QXmlStreamReader *,QObject *=0

//[1]QSvgRenderer ( QObject * parent = 0 )
//[2]QSvgRenderer ( const QString & filename, QObject * parent = 0 )
//[3]QSvgRenderer ( const QByteArray & contents, QObject * parent = 0 )
//[4]QSvgRenderer ( QXmlStreamReader * contents, QObject * parent = 0 )

HB_FUNC_STATIC( QSVGRENDERER_NEW )
{
  if( ISBETWEEN(0,1) && (ISQOBJECT(1)||ISNIL(1)) )
  {
    QSvgRenderer_new1();
  }
  else if( ISBETWEEN(1,2) && ISCHAR(1) && (ISQOBJECT(2)||ISNIL(2)) )
  {
    QSvgRenderer_new2();
  }
  else if( ISBETWEEN(1,2) && ISQBYTEARRAY(1) && (ISQOBJECT(2)||ISNIL(2)) )
  {
    QSvgRenderer_new3();
  }
  else if( ISBETWEEN(1,2) && ISQXMLSTREAMREADER(1) && (ISQOBJECT(2)||ISNIL(2)) )
  {
    QSvgRenderer_new4();
  }
  else
  {
    hb_errRT_BASE( EG_ARG, 3012, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS );
  }
}

$deleteMethod

$prototype=bool animated () const
$method=|bool|animated|

$prototype=QRectF boundsOnElement ( const QString & id ) const
$method=|QRectF|boundsOnElement|const QString &

$prototype=QSize defaultSize () const
$method=|QSize|defaultSize|

$prototype=bool elementExists ( const QString & id ) const
$method=|bool|elementExists|const QString &

$prototype=int framesPerSecond () const
$method=|int|framesPerSecond|

$prototype=bool isValid () const
$method=|bool|isValid|

$prototype=QMatrix matrixForElement ( const QString & id ) const
$method=|QMatrix|matrixForElement|const QString &

$prototype=void setFramesPerSecond ( int num )
$method=|void|setFramesPerSecond|int

$prototype=void setViewBox ( const QRect & viewbox )
$internalMethod=|void|setViewBox,setViewBox1|const QRect &

$prototype=void setViewBox ( const QRectF & viewbox )
$internalMethod=|void|setViewBox,setViewBox2|const QRectF &

//[1]void setViewBox ( const QRect & viewbox )
//[2]void setViewBox ( const QRectF & viewbox )

HB_FUNC_STATIC( QSVGRENDERER_SETVIEWBOX )
{
  if( ISNUMPAR(1) && ISQRECT(1) )
  {
    QSvgRenderer_setViewBox1();
  }
  else if( ISNUMPAR(1) && ISQRECTF(1) )
  {
    QSvgRenderer_setViewBox2();
  }
  else
  {
    hb_errRT_BASE( EG_ARG, 3012, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS );
  }
}

$prototype=QRect viewBox () const
$method=|QRect|viewBox|

$prototype=QRectF viewBoxF () const
$method=|QRectF|viewBoxF|

$prototype=bool load ( const QString & filename )
$internalMethod=|bool|load,load1|const QString &

$prototype=bool load ( const QByteArray & contents )
$internalMethod=|bool|load,load2|const QByteArray &

$prototype=bool load ( QXmlStreamReader * contents )
$internalMethod=|bool|load,load3|QXmlStreamReader *

//[1]bool load ( const QString & filename )
//[2]bool load ( const QByteArray & contents )
//[3]bool load ( QXmlStreamReader * contents )

HB_FUNC_STATIC( QSVGRENDERER_LOAD )
{
  if( ISNUMPAR(1) && ISCHAR(1) )
  {
    QSvgRenderer_load1();
  }
  else if( ISNUMPAR(1) && ISQBYTEARRAY(1) )
  {
    QSvgRenderer_load2();
  }
  else if( ISNUMPAR(1) && ISQXMLSTREAMREADER(1) )
  {
    QSvgRenderer_load3();
  }
  else
  {
    hb_errRT_BASE( EG_ARG, 3012, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS );
  }
}

$prototype=void render ( QPainter * painter )
$internalMethod=|void|render,render1|QPainter *

$prototype=void render ( QPainter * painter, const QRectF & bounds )
$internalMethod=|void|render,render2|QPainter *,const QRectF &

$prototype=void render ( QPainter * painter, const QString & elementId, const QRectF & bounds = QRectF() )
$internalMethod=|void|render,render3|QPainter *,const QString &,const QRectF &=QRectF()

//[1]void render ( QPainter * painter )
//[2]void render ( QPainter * painter, const QRectF & bounds )
//[3]void render ( QPainter * painter, const QString & elementId, const QRectF & bounds = QRectF() )

HB_FUNC_STATIC( QSVGRENDERER_RENDER )
{
  if( ISNUMPAR(1) && ISQPAINTER(1) )
  {
    QSvgRenderer_render1();
  }
  else if( ISNUMPAR(2) && ISQPAINTER(1) && ISQRECTF(2) )
  {
    QSvgRenderer_render2();
  }
  else if( ISBETWEEN(2,3) && ISQPAINTER(1) && ISCHAR(2) && (ISQRECTF(3)||ISNIL(3)) )
  {
    QSvgRenderer_render3();
  }
  else
  {
    hb_errRT_BASE( EG_ARG, 3012, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS );
  }
}

$beginSignals
$signalMethod=|repaintNeeded()
$endSignals

#pragma ENDDUMP


other link (Tim's paper)

other link (Tim's paper)

-- See: http://en.wikipedia.org/wiki/Normalisation_by_evaluation
-- and also http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.39.2361
--
import "../src/LangPrelude.prg" (listM,Monad,compose,const)

monad listM

-- abstract syntax -------------------------------------------------------------

data Ty :: *0 ~> *0 where
   Bool :: Ty Bool
   Arr :: Ty a -> Ty b -> Ty (a -> b)

data Var :: *0 ~> *0 ~> *0 where
   ZVar :: Var (h,t) t
   SVar :: Var h t -> Var (h,s) t

data Exp :: *0 ~> *0 ~> *0 where
   Var :: Var g t -> Exp g t
   Lam :: Ty a -> Exp (g,a) b -> Exp g (a -> b)
   App :: Exp g (s -> t) -> Exp g s -> Exp g t
   If :: Exp g Bool -> Exp g t -> Exp g t -> Exp g t
   ETrue :: Exp g Bool
   EFalse :: Exp g Bool

-- smart constructors ----------------------------------------------------------
lamE :: Ty s -> (Exp (g,s) s -> Exp (g,s) t) -> Exp g (s -> t)
lamE s f = Lam s (f (Var ZVar))

ifE :: Exp g Bool -> Exp g t -> Exp g t -> Exp g t
ifE t ETrue EFalse = t
ifE t e e' = if eqE e e' then e else If t e e'

-- boring equality tests -------------------------------------------------------
eqB :: BoxExp t -> BoxExp s -> Bool
eqB (Box e) (Box e') = eqE e e'

eqE :: Exp g t -> Exp h s -> Bool
eqE (Var x) (Var y) = eqV x y
eqE (Lam s e) (Lam s' e') = eqT s s' && eqE e e'
eqE (App e1 e2) (App e1' e2') = eqE e1 e1' && eqE e2 e2'
eqE (If e1 e2 e3) (If e1' e2' e3') = eqE e1 e1' && (eqE e2 e2' && eqE e3 e3')
eqE ETrue ETrue = True
eqE EFalse EFalse = True
eqE _ _ = False

eqT :: Ty t -> Ty s -> Bool
eqT (Arr s t) (Arr s' t') = eqT s s' && eqT t t'
eqT Bool Bool = True
eqT _ _ = False

eqV :: Var g t -> Var h s -> Bool
eqV (SVar x) (SVar y) = eqV x y
eqV ZVar ZVar = True
eqV _ _ = False

-- evaluation ------------------------------------------------------------------
var :: Var g t -> g -> t
var ZVar     (_,t) = t
var (SVar x) (h,s) = var x h

exp :: Exp g t -> g -> t
exp (Var x)    g = var x g
exp (Lam _ e)  g = \a -> exp e (g,a)
exp (App e e') g = exp e g (exp e' g)
exp ETrue      g = True
exp EFalse     g = False
exp (If c t e) g = if exp c g then exp t g else exp e g

-- type inference --------------------------------------------------------------

data TyEnv :: *0 ~> *0 where
   Cons :: Ty t -> TyEnv h -> TyEnv (h,t)
   Nil :: TyEnv g

infer :: TyEnv g -> Exp g t -> Ty t
infer g (Var x)         = inferVar g x
infer g (Lam t e)       = Arr t (infer (Cons t g) e)
infer g (App e e')      = case infer g e of Arr _ t -> t
infer g ETrue           = Bool
infer g EFalse          = Bool
infer g (If _ e _)      = infer g e

inferVar :: TyEnv g -> Var g t -> Ty t
inferVar (Cons t h) (SVar x) = inferVar h x
inferVar (Cons t h) (ZVar)   = t

-- tree monad ------------------------------------------------------------------

data Tree a = Val a | Choice (Tree a) (Tree a)
-- doesn't yet force trees to be fully balanced:
--      Val :: a -> Tree a Z
--      Choice :: Tree a n -> Tree a n -> Tree a (S n)

treeM = Monad Val bind error
  where bind (Val a) f = f a
        bind (Choice l r) f = Choice (bind l f) (bind r f)

tmap f x = do a <- x; return (f a)
  where monad treeM

flatten t = fl t []
 where
   fl (Val a)      k = a:k
   fl (Choice l r) k = fl l (fl r k)

-- quote & friends -------------------------------------------------------------

-- for values --------------------------
enumV           :: Ty t -> Tree t
questionsV      :: Ty t -> [t -> Bool]

enumV Bool      = Choice (Val True) (Val False)
enumV (Arr s t) = mkEnum (questionsV s) (enumV t)
 where
   monad treeM
   mkEnum [] t = tmap const t
   mkEnum (q:qs) es = do
                   f1 <- mkEnum qs es
                   f2 <- mkEnum qs es
                   return (\d -> if q d then f1 d else f2 d)

questionsV Bool         = return (\x -> x)
questionsV (Arr s t)    = do
                          d <- flatten (enumV s)
                          q <- questionsV t
                          return (\f -> q (f d))

-- for expressions ---------------------
enumE           :: Ty t -> Tree (Exp g t)
questionsE      :: Ty t -> [Exp g t -> Exp g Bool]

enumE Bool      = Choice (Val ETrue) (Val EFalse)
enumE (Arr s t) = tmap (lamE s) (mkEnumE (questionsE s) (enumE t))
 where
   monad treeM
   mkEnumE [] t = tmap const t
   mkEnumE (q:qs) es = do
                        f1 <- mkEnumE qs es
                        f2 <- mkEnumE qs es
                        return (\d -> ifE (q d) (f1 d) (f2 d))

questionsE Bool         = return (\x -> x)
questionsE (Arr s t)    = do
                          d <- flatten (enumE s)
                          q <- questionsE t
                          return (\f -> q (App f d))

-- should be
--      find (List (Exp g Bool) n) -> Tree (Exp g a) n -> Exp g a
find :: [Exp g Bool] -> Tree (Exp g a) -> Exp g a
find []         (Val a)         = a
find (b:bs)     (Choice l r)    = ifE b (find bs l) (find bs r)
find _          _               = error "bad arguments to find"

quote :: Ty t -> t -> Exp g t
quote Bool      t = case t of True -> ETrue; False -> EFalse
quote (Arr s t) f = lamE s (\e -> find (do q <- questionsE s; return (q e))
                                        (tmap (quote t . f) (enumV s)))

-- normalization (by evaluation) -----------------------------------------------
data BoxExp t = Box (forall g. Exp g t)

normalize :: Ty t -> BoxExp t -> BoxExp t
normalize s (Box e) = Box (quote s (exp e ()))

-- examples --------------------------------------------------------------------
b2b = Arr Bool Bool
b22b = Arr b2b b2b
zero = Var ZVar
one = Var (SVar ZVar)
once   = Box (Lam b2b (Lam Bool (App one zero)))
twice  = Box (Lam b2b (Lam Bool (App one (App one zero))))
thrice = Box (Lam b2b (Lam Bool (App one (App one (App one zero)))))

test = [ eqB (nf b22b thrice) (nf b22b once)
       , eqB (nf b22b twice)  (nf b22b once)]
  where nf = normalize

-- See: http://en.wikipedia.org/wiki/Normalisation_by_evaluation
--
import "../src/LangPrelude.prg" (listM,Monad,compose,const)

monad listM

-- abstract syntax -------------------------------------------------------------

data Ty :: *0 ~> *0 where
   Bool :: Ty Bool
   Arr :: Ty a -> Ty b -> Ty (a -> b)

data Var :: *0 ~> *0 ~> *0 where
   ZVar :: Var (h,t) t
   SVar :: Var h t -> Var (h,s) t

data Exp :: *0 ~> *0 ~> *0 where
   Var :: Var g t -> Exp g t
   Lam :: Ty a -> Exp (g,a) b -> Exp g (a -> b)
   App :: Exp g (s -> t) -> Exp g s -> Exp g t
   If :: Exp g Bool -> Exp g t -> Exp g t -> Exp g t
   ETrue :: Exp g Bool
   EFalse :: Exp g Bool

-- smart constructors ----------------------------------------------------------
lamE :: Ty s -> (Exp (g,s) s -> Exp (g,s) t) -> Exp g (s -> t)
lamE s f = Lam s (f (Var ZVar))

ifE :: Exp g Bool -> Exp g t -> Exp g t -> Exp g t
ifE t ETrue EFalse = t
ifE t e e' = if eqE e e' then e else If t e e'

-- boring equality tests -------------------------------------------------------
eqB :: BoxExp t -> BoxExp s -> Bool
eqB (Box e) (Box e') = eqE e e'

eqE :: Exp g t -> Exp h s -> Bool
eqE (Var x) (Var y) = eqV x y
eqE (Lam s e) (Lam s' e') = eqT s s' && eqE e e'
eqE (App e1 e2) (App e1' e2') = eqE e1 e1' && eqE e2 e2'
eqE (If e1 e2 e3) (If e1' e2' e3') = eqE e1 e1' && (eqE e2 e2' && eqE e3 e3')
eqE ETrue ETrue = True
eqE EFalse EFalse = True
eqE _ _ = False

eqT :: Ty t -> Ty s -> Bool
eqT (Arr s t) (Arr s' t') = eqT s s' && eqT t t'
eqT Bool Bool = True
eqT _ _ = False

eqV :: Var g t -> Var h s -> Bool
eqV (SVar x) (SVar y) = eqV x y
eqV ZVar ZVar = True
eqV _ _ = False

-- evaluation ------------------------------------------------------------------
var :: Var g t -> g -> t
var ZVar     (_,t) = t
var (SVar x) (h,s) = var x h

exp :: Exp g t -> g -> t
exp (Var x)    g = var x g
exp (Lam _ e)  g = \a -> exp e (g,a)
exp (App e e') g = exp e g (exp e' g)
exp ETrue      g = True
exp EFalse     g = False
exp (If c t e) g = if exp c g then exp t g else exp e g

-- type inference --------------------------------------------------------------

data TyEnv :: *0 ~> *0 where
   Cons :: Ty t -> TyEnv h -> TyEnv (h,t)
   Nil :: TyEnv g

infer :: TyEnv g -> Exp g t -> Ty t
infer g (Var x)         = inferVar g x
infer g (Lam t e)       = Arr t (infer (Cons t g) e)
infer g (App e e')      = case infer g e of Arr _ t -> t
infer g (ETrue)         = Bool
infer g (EFalse)        = Bool
infer g (If _ e _)      = infer g e

inferVar :: TyEnv g -> Var g t -> Ty t
inferVar (Cons t h) (SVar x) = inferVar h x
inferVar (Cons t h) (ZVar)   = t

-- tree monad ------------------------------------------------------------------

data Tree a = Val a | Choice (Tree a) (Tree a)
-- doesn't yet force trees to be fully balanced:
--      Val :: a -> Tree a Z
--      Choice :: Tree a n -> Tree a n -> Tree a (S n)

treeM = Monad Val bind error
  where bind (Val a) f = f a
        bind (Choice l r) f = Choice (bind l f) (bind r f)

tmap f x = do a <- x; return (f a)
  where monad treeM

flatten t = fl t []
 where
   fl (Val a)      k = a:k
   fl (Choice l r) k = fl l (fl r k)

-- quote & friends -------------------------------------------------------------

-- for values --------------------------
enumV           :: Ty t -> Tree t
questionsV      :: Ty t -> [t -> Bool]

enumV Bool      = Choice (Val True) (Val False)
enumV (Arr s t) = mkEnum (questionsV s) (enumV t)
 where
   monad treeM
   mkEnum [] t = tmap const t
   mkEnum (q:qs) es = do
                   f1 <- mkEnum qs es
                   f2 <- mkEnum qs es
                   return (\d -> if q d then f1 d else f2 d)

questionsV Bool         = return (\x -> x)
questionsV (Arr s t)    = do
                          d <- flatten (enumV s)
                          q <- questionsV t
                          return (\f -> q (f d))

-- for expressions ---------------------
enumE           :: Ty t -> Tree (Exp g t)
questionsE      :: Ty t -> [Exp g t -> Exp g Bool]

enumE Bool      = Choice (Val ETrue) (Val EFalse)
enumE (Arr s t) = tmap (lamE s) (mkEnumE (questionsE s) (enumE t))
 where
   monad treeM
   mkEnumE [] t = tmap const t
   mkEnumE (q:qs) es = do
                        f1 <- mkEnumE qs es
                        f2 <- mkEnumE qs es
                        return (\d -> ifE (q d) (f1 d) (f2 d))

questionsE Bool         = return (\x -> x)
questionsE (Arr s t)    = do
                          d <- flatten (enumE s)
                          q <- questionsE t
                          return (\f -> q (App f d))

-- should be
--      find (List (Exp g Bool) n) -> Tree (Exp g a) n -> Exp g a
find :: [Exp g Bool] -> Tree (Exp g a) -> Exp g a
find []         (Val a)         = a
find (b:bs)     (Choice l r)    = ifE b (find bs l) (find bs r)
find _          _               = error "bad arguments to find"

quote :: Ty t -> t -> Exp g t
quote Bool      t = case t of True -> ETrue; False -> EFalse
quote (Arr s t) f = lamE s (\e -> find (do q <- questionsE s; return (q e))
                                        (tmap (quote t . f) (enumV s)))

-- normalization (by evaluation) -----------------------------------------------
data BoxExp t = Box (forall g. Exp g t)

normalize :: Ty t -> BoxExp t -> BoxExp t
normalize s (Box e) = Box (quote s (exp e ()))

-- examples --------------------------------------------------------------------
b2b = Arr Bool Bool
b22b = Arr b2b b2b
zero = Var ZVar
one = Var (SVar ZVar)
once   = Box (Lam b2b (Lam Bool (App one zero)))
twice  = Box (Lam b2b (Lam Bool (App one (App one zero))))
thrice = Box (Lam b2b (Lam Bool (App one (App one (App one zero)))))

test = [ eqB (nf b22b thrice) (nf b22b once)
       , eqB (nf b22b twice)  (nf b22b once)]
  where nf = normalize


QtScriptTools: data for code generation updated

Modified:
codegen/QtScriptTools/QScriptEngineDebugger.prg

%%
%% Qt5xHb - Bindings libraries for Harbour/xHarbour and Qt Framework 5
%%
%% Copyright (C) 2018 Marcos Antonio Gambeta <marcosgambeta AT outlook DOT com>
%%

$header

#include "hbclass.ch"

#ifndef QT5XHB_NO_REQUESTS
REQUEST QACTION
REQUEST QMENU
REQUEST QTOOLBAR
REQUEST QMAINWINDOW
REQUEST QWIDGET
#endif

$beginClassFrom=QObject

   METHOD new
   METHOD delete
   METHOD action
   METHOD attachTo
   METHOD autoShowStandardWindow
   METHOD createStandardMenu
   METHOD createStandardToolBar
   METHOD detach
   METHOD setAutoShowStandardWindow
   METHOD standardWindow
   METHOD state
   METHOD widget

   METHOD onEvaluationResumed
   METHOD onEvaluationSuspended

$endClass

$destructor

#pragma BEGINDUMP

$includes

#include <QAction>
#include <QMenu>
#include <QToolBar>
#include <QMainWindow>

$prototype=QScriptEngineDebugger(QObject * parent = 0)
$constructor=|new|QObject *=0

$deleteMethod

$prototype=QAction * action(DebuggerAction action) const
$method=|QAction *|action|QScriptEngineDebugger::DebuggerAction

$prototype=void attachTo(QScriptEngine * engine)
$method=|void|attachTo|QScriptEngine *

$prototype=bool autoShowStandardWindow() const
$method=|bool|autoShowStandardWindow|

$prototype=QMenu * createStandardMenu(QWidget * parent = 0)
$method=|QMenu *|createStandardMenu|QWidget *=0

$prototype=QToolBar * createStandardToolBar(QWidget * parent = 0)
$method=|QToolBar *|createStandardToolBar|QWidget *=0

$prototype=void detach()
$method=|void|detach|

$prototype=void setAutoShowStandardWindow(bool autoShow)
$method=|void|setAutoShowStandardWindow|bool

$prototype=QMainWindow * standardWindow() const
$method=|QMainWindow *|standardWindow|

$prototype=DebuggerState state() const
$method=|QScriptEngineDebugger::DebuggerState|state|

$prototype=QWidget * widget(DebuggerWidget widget) const
$method=|QWidget *|widget|QScriptEngineDebugger::DebuggerWidget

$beginSignals
$signal=|evaluationResumed()
$signal=|evaluationSuspended()
$endSignals

#pragma ENDDUMP

%%
%% Qt5xHb - Bindings libraries for Harbour/xHarbour and Qt Framework 5
%%
%% Copyright (C) 2018 Marcos Antonio Gambeta <marcosgambeta AT outlook DOT com>
%%

$header

#include "hbclass.ch"

#ifndef QT5XHB_NO_REQUESTS
REQUEST QACTION
REQUEST QMENU
REQUEST QTOOLBAR
REQUEST QMAINWINDOW
REQUEST QWIDGET
#endif

CLASS QScriptEngineDebugger INHERIT QObject

   METHOD new
   METHOD delete
   METHOD action
   METHOD attachTo
   METHOD autoShowStandardWindow
   METHOD createStandardMenu
   METHOD createStandardToolBar
   METHOD detach
   METHOD setAutoShowStandardWindow
   METHOD standardWindow
   METHOD state
   METHOD widget

   METHOD onEvaluationResumed
   METHOD onEvaluationSuspended

   DESTRUCTOR destroyObject

END CLASS

$destructor

#pragma BEGINDUMP

$includes

#include <QAction>
#include <QMenu>
#include <QToolBar>
#include <QMainWindow>

$prototype=QScriptEngineDebugger(QObject * parent = 0)
$constructor=|new|QObject *=0

$deleteMethod

$prototype=QAction * action(DebuggerAction action) const
$method=|QAction *|action|QScriptEngineDebugger::DebuggerAction

$prototype=void attachTo(QScriptEngine * engine)
$method=|void|attachTo|QScriptEngine *

$prototype=bool autoShowStandardWindow() const
$method=|bool|autoShowStandardWindow|

$prototype=QMenu * createStandardMenu(QWidget * parent = 0)
$method=|QMenu *|createStandardMenu|QWidget *=0

$prototype=QToolBar * createStandardToolBar(QWidget * parent = 0)
$method=|QToolBar *|createStandardToolBar|QWidget *=0

$prototype=void detach()
$method=|void|detach|

$prototype=void setAutoShowStandardWindow(bool autoShow)
$method=|void|setAutoShowStandardWindow|bool

$prototype=QMainWindow * standardWindow() const
$method=|QMainWindow *|standardWindow|

$prototype=DebuggerState state() const
$method=|QScriptEngineDebugger::DebuggerState|state|

$prototype=QWidget * widget(DebuggerWidget widget) const
$method=|QWidget *|widget|QScriptEngineDebugger::DebuggerWidget

$beginSignals
$signal=|evaluationResumed()
$signal=|evaluationSuspended()
$endSignals

#pragma ENDDUMP


%%
%% Qt4xHb - Bindings libraries for Harbour/xHarbour and Qt Framework 4
%%
%% Copyright (C) 2018 Marcos Antonio Gambeta <marcosgambeta AT outlook DOT com>
%%

$header

#include "hbclass.ch"

#ifndef QT4XHB_NO_REQUESTS
REQUEST QACTION
REQUEST QMENU
REQUEST QTOOLBAR
REQUEST QMAINWINDOW
REQUEST QWIDGET
#endif

CLASS QScriptEngineDebugger INHERIT QObject

   METHOD new
   METHOD delete
   METHOD action
   METHOD attachTo
   METHOD autoShowStandardWindow
   METHOD createStandardMenu
   METHOD createStandardToolBar
   METHOD detach
   METHOD setAutoShowStandardWindow
   METHOD standardWindow
   METHOD state
   METHOD widget

   METHOD onEvaluationResumed
   METHOD onEvaluationSuspended

   DESTRUCTOR destroyObject

END CLASS

$destructor

#pragma BEGINDUMP

$includes

#include <QAction>
#include <QMenu>
#include <QToolBar>
#include <QMainWindow>

$prototype=QScriptEngineDebugger ( QObject * parent = 0 )
$constructor=|new|QObject *=0

$deleteMethod

$prototype=QAction * action ( DebuggerAction action ) const
$method=|QAction *|action|QScriptEngineDebugger::DebuggerAction

$prototype=void attachTo ( QScriptEngine * engine )
$method=|void|attachTo|QScriptEngine *

$prototype=bool autoShowStandardWindow () const
$method=|bool|autoShowStandardWindow|

$prototype=QMenu * createStandardMenu ( QWidget * parent = 0 )
$method=|QMenu *|createStandardMenu|QWidget *=0

$prototype=QToolBar * createStandardToolBar ( QWidget * parent = 0 )
$method=|QToolBar *|createStandardToolBar|QWidget *=0

$prototype=void detach ()
$method=|void|detach|

$prototype=void setAutoShowStandardWindow ( bool autoShow )
$method=|void|setAutoShowStandardWindow|bool

$prototype=QMainWindow * standardWindow () const
$method=|QMainWindow *|standardWindow|

$prototype=DebuggerState state () const
$method=|QScriptEngineDebugger::DebuggerState|state|

$prototype=QWidget * widget ( DebuggerWidget widget ) const
$method=|QWidget *|widget|QScriptEngineDebugger::DebuggerWidget

$beginSignals
$signal=|evaluationResumed()
$signal=|evaluationSuspended()
$endSignals

#pragma ENDDUMP

%%
%% Qt4xHb - Bindings libraries for Harbour/xHarbour and Qt Framework 4
%%
%% Copyright (C) 2018 Marcos Antonio Gambeta <marcosgambeta AT outlook DOT com>
%%

$header

#include "hbclass.ch"

#ifndef QT4XHB_NO_REQUESTS
REQUEST QACTION
REQUEST QMENU
REQUEST QTOOLBAR
REQUEST QMAINWINDOW
REQUEST QWIDGET
#endif

CLASS QScriptEngineDebugger INHERIT QObject

   METHOD new
   METHOD delete
   METHOD action
   METHOD attachTo
   METHOD autoShowStandardWindow
   METHOD createStandardMenu
   METHOD createStandardToolBar
   METHOD detach
   METHOD setAutoShowStandardWindow
   METHOD standardWindow
   METHOD state
   METHOD widget

   METHOD onEvaluationResumed
   METHOD onEvaluationSuspended

   DESTRUCTOR destroyObject

END CLASS

$destructor

#pragma BEGINDUMP

$includes

#include <QAction>
#include <QMenu>
#include <QToolBar>
#include <QMainWindow>

$prototype=QScriptEngineDebugger ( QObject * parent = 0 )
$constructor=|new|QObject *=0

$deleteMethod

$prototype=QAction * action ( DebuggerAction action ) const
$method=|QAction *|action|QScriptEngineDebugger::DebuggerAction

$prototype=void attachTo ( QScriptEngine * engine )
$method=|void|attachTo|QScriptEngine *

$prototype=bool autoShowStandardWindow () const
$method=|bool|autoShowStandardWindow|

$prototype=QMenu * createStandardMenu ( QWidget * parent = 0 )
$method=|QMenu *|createStandardMenu|QWidget *=0

$prototype=QToolBar * createStandardToolBar ( QWidget * parent = 0 )
$method=|QToolBar *|createStandardToolBar|QWidget *=0

$prototype=void detach ()
$method=|void|detach|

$prototype=void setAutoShowStandardWindow ( bool autoShow )
$method=|void|setAutoShowStandardWindow|bool

$prototype=QMainWindow * standardWindow () const
$method=|QMainWindow *|standardWindow|

$prototype=DebuggerState state () const
$method=|QScriptEngineDebugger::DebuggerState|state|

$prototype=QWidget * widget ( DebuggerWidget widget ) const
$method=|QWidget *|widget|QScriptEngineDebugger::DebuggerWidget

$beginSignals
$signalMethod=|evaluationResumed()
$signalMethod=|evaluationSuspended()
$endSignals

#pragma ENDDUMP


ProjectNode was not assigned resulting in an exception

//
// Copyright (c) XSharp B.V.  All Rights Reserved.
// Licensed under the Apache License, Version 2.0.
// See License.txt in the project root for license information.
//

USING System.Collections.Generic
USING System.Xml
DEFINE EXTENSION := "xsproj"  AS STRING

CLASS ProjectConverter
	PROTECT oDoc 	AS XmlDocument
	PROTECT nGroup  AS LONG
	PROTECT cSchema AS STRING
	PROTECT cGuid   AS STRING
	PROTECT cPath	AS STRING
	PROTECT oProgress AS IProgress
	PROTECT lVulcanRtWritten AS LOGIC
	PROTECT oProjectNode as XmlElement
	PROTECT lHasProjectExtensions as LOGIC
	PROPERTY Guid AS STRING GET cGuid
	CONSTRUCTOR(oProg AS IProgress)
		cSchema := "http://schemas.microsoft.com/developer/msbuild/2003"
		nGroup  := 0
        cGuid   := System.Guid.NewGuid().ToString("B"):ToUpper()
        lVulcanRtWritten := FALSE
        SELF:oProgress := oProg

METHOD ConvertProjectFile(cSource AS STRING, cTarget AS STRING) AS LOGIC
	oProgress:WriteLine("Creating ... "+System.IO.Path.GetFileName(cTarget))
	cPath := System.IO.Path.GetDirectoryName(cSource)+"\"
	IF ! SELF:LoadFile(cSource)
		RETURN FALSE
	ENDIF
	SELF:WalkNode(oDoc)
	if (!lHasProjectExtensions ) .and. oProjectNode != NULL_OBJECT
		VAR oExt := oDoc:CreateElement("ProjectExtensions",cSchema)
		VAR oCap := oDoc:CreateElement("ProjectCapabilities",cSchema)
		oExt:AppendChild(oCap)
		oCap:AppendChild(oDoc:CreateElement("ProjectConfigurationsDeclaredAsItems",cSchema))
		oProjectNode:AppendChild(oExt)
	ENDIF
	SELF:SaveFile(cTarget)
	RETURN TRUE

  METHOD Save2String() AS STRING STRICT
      LOCAL cString         AS STRING
      LOCAL oWriter             AS System.Xml.XmlTextWriter
      LOCAL oStringWriter       AS System.IO.StringWriter
      cString := oDoc:OuterXml
      oStringWriter := System.IO.StringWriter{}
      oWriter     := System.Xml.XmlTextWriter{oStringWriter}
      oWriter:Formatting := System.Xml.Formatting.Indented
      oDoc:WriteTo(oWriter)
      cString := oStringWriter:ToString()
      RETURN cString

   METHOD SaveFile(strFileName AS STRING) AS LOGIC STRICT
      LOCAL lRet        AS LOGIC
      LOCAL oTargetFile  AS System.IO.StreamWriter
      lRet := FALSE
      IF oDoc:HasChildNodes
         oTargetFile := System.IO.StreamWriter{strFileName, FALSE}
         oTargetFile:Write( SELF:Save2String() )
         oTargetFile:Close()
         lRet := TRUE
      ENDIF
      RETURN lRet

METHOD CloneNode(oNode AS XmlNode) AS XmlNode
	LOCAL oResult AS XmlNode
	oResult := oNode:CloneNode(FALSE)
	oResult:InnerText := oNode:InnerText
	RETURN oResult

METHOD UpdateNode(oParent AS XmlNode, oElement AS XmlElement) AS VOID
	LOCAL oChild AS XmlElement
	LOCAL oAttribute AS XmlAttribute
	IF aDelete:Contains(oElement:Name:ToLower())
		// remove the node
		oParent:RemoveChild(oElement)
	ELSEIF aRename:ContainsKey(oElement:Name)
		// Renaming Nodes is not supported. Create a new node and
		// Copy its attributes and children
		// and then replace the existing node
		oChild := oDoc:CreateElement(aRename[oElement:Name],cSchema)
		DO WHILE oElement:HasAttributes
			oChild:SetAttributeNode(oElement:RemoveAttributeNode(oElement:Attributes[0]))
		ENDDO
		DO WHILE oElement:HasChildNodes
			oChild:AppendChild(oElement:FirstChild)
		ENDDO
		oParent:ReplaceChild(oChild, oElement)
	ELSE
		// Some nodes that require special processing
		SWITCH oElement:Name:ToLower()
		CASE "compile"
		CASE "none"
		CASE "vobinary"
		CASE "nativeresource"
			VAR cItem := oElement:GetAttribute("Include")
			cItem := cPath+cItem
			VAR oChild1 := oElement:FirstChild
			IF oChild1 != NULL .and. oChild1:Name:ToLowerInvariant() == "dependentupon"
				VAR  cInnerText := oChild1:InnerText
				IF cInnerText:Contains("\")
					// check to see if parent node is in the same folder as the child node.
					if System.IO.File.Exists(cItem) .and. System.IO.File.Exists(cPath+cInnerText)
						if System.IO.Path.GetFullPath(cItem) == System.IO.Path.GetFullPath(cPath+cInnerText)
							// paths are equal, only write filename
							cInnerText := System.IO.Path.GetFileName(cInnerText)
							oChild1:InnerText := cInnerText
						ENDIF
					endif
				ENDIF
			ENDIF

		CASE "import"
			// change import
			oAttribute := (XmlAttribute) oElement:Attributes:GetNamedItem("Project")
			IF oAttribute:Value:ToLower():Contains("vulcan.net")
				oAttribute:Value := "$(MSBuildExtensionsPath)\XSharp\XSharp.targets"
			ENDIF
		CASE "project"
			// Only for main project node, not for project node inside projectreference
			if (oParent is XMLDocument)
				// Import the schema
				SELF:oProjectNode := oElement
			ENDIF

		CASE "projectguid"
			// new guid
			oElement:InnerText := cGuid
		CASE "projecttypeguids"
			// WPF project
			// our WPF ProjectFactory
			// Generic WPF project
			// Our project factory
			oElement:InnerText := "{5ADB76EC-7017-476A-A8E0-25D4202FFCF0};{60DC8134-EBA5-43B8-BCC9-BB4BC16C2548};{AA6C8D78-22FF-423A-9C7C-5F2393824E04}"
		CASE "projectreference"
			// update extension in project references
			oAttribute := (XmlAttribute) oElement:Attributes:GetNamedItem("Include")
			IF oAttribute != NULL
				oAttribute:Value := oAttribute:Value:Replace(".vnproj", "."+EXTENSION)
			ENDIF
		CASE "propertygroup"
			// Only insert code inside the first propertygroup
			IF ++nGroup == 1
				LOCAL oImport AS XmlNode
				// Add Import
				oImport := oDoc:CreateElement("Import",cSchema)
				oAttribute := oDoc:CreateAttribute("Project")
				oAttribute:Value := "$(MSBuildExtensionsPath)\XSharp\XSharp.Default.props"
				oImport:Attributes:Append(oAttribute)
				oParent:InsertBefore(oImport, oElement)
				// Add propertygroup before Import with Label="Globals" and child <XSharpProjectExtensionsPath>
				oChild := oDoc:CreateElement( "PlatformTarget", cSchema)
				oChild:InnerText := "x86"
				oElement:InsertBefore(oChild,oElement:FirstChild)
				oChild := oDoc:CreateElement( "Dialect", cSchema)
				oChild:InnerText := "Vulcan"
				oElement:InsertBefore(oChild,oElement:FirstChild)
			ELSE
				// ALl other project groups.
				// Adjust the condition when needed
				VAR oCondition := (XMLAttribute) oElement:Attributes:GetNamedItem("Condition")
				// <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|AnyCPU'" Label="Configuration">
				IF oCondition != NULL
					VAR  cInnerText := oCondition:InnerText
					if ! cInnerText:ToLower():Contains("platform")
						if cInnerText:ToLower():Contains("release")
							oCondition:InnerText := "'$(Configuration)|$(Platform)' == 'Release|AnyCPU'"
						else
							oCondition:InnerText := "'$(Configuration)|$(Platform)' == 'Debug|AnyCPU'"
						endif
					ENDIF
				ENDIF
			ENDIF
		CASE "projectextensions"
			// add <ProjectCapabilities><ProjectConfigurationsDeclaredAsItems /></ProjectCapabilities>
			oChild := oDoc:CreateElement("ProjectCapabilities",cSchema)
			oChild:AppendChild(oDoc:CreateElement("ProjectConfigurationsDeclaredAsItems",cSchema))
			oElement:AppendChild(oChild)
			lHasProjectExtensions := TRUE
		CASE "reference"
			// Add VulcanRT assemblies after 1st reference
			IF !SELF:lVulcanRtWritten
				oChild := oDoc:CreateElement("Reference",cSchema)
				oAttribute := oDoc:CreateAttribute("Include")
				oAttribute:Value := "VulcanRT"
				oChild:Attributes:Append(oAttribute)
				VAR oSub := oDoc:CreateElement("Name",cSchema)
				oSub:InnerText := "VulcanRT"
				oChild:AppendChild(oSub)
				oSub := oDoc:CreateElement("AssemblyName",cSchema)
				oSub:InnerText := "VulcanRT.DLL"
				oChild:AppendChild(oSub)
				oElement:ParentNode:AppendChild(oChild)
				oChild := oDoc:CreateElement("Reference",cSchema)
				oAttribute := oDoc:CreateAttribute("Include")
				oAttribute:Value := "VulcanRTFuncs"
				oChild:Attributes:Append(oAttribute)
				oSub := oDoc:CreateElement("Name",cSchema)
				oSub:InnerText := "VulcanRTFuncs"
				oChild:AppendChild(oSub)
				oSub := oDoc:CreateElement("AssemblyName",cSchema)
				oSub:InnerText := "VulcanRTFuncs.DLL"
				oChild:AppendChild(oSub)
				oElement:ParentNode:AppendChild(oChild)
				SELF:lVulcanRtWritten := TRUE
			ENDIF
		OTHERWISE
			// All other elements should not be changed
			NOP
		END SWITCH
	ENDIF
	RETURN

METHOD WalkNode(oNode AS XmlNode) AS VOID
	LOCAL aChildren AS List<XmlNode>
	aChildren := List<XmlNode>{}
	FOREACH oChild AS XmlNode IN oNode:ChildNodes
		aChildren:Add(oChild)
	NEXT
	FOREACH oChild AS XmlNode IN aChildren
		IF oChild IS XmlElement
			SELF:UpdateNode(oNode, (XmlElement) oChild)
		ENDIF
		SELF:WalkNode((XMlNode) oChild)
	NEXT
	RETURN

    PROTECT METHOD _LoadFileFromReader(oReader AS System.IO.TextReader) AS LOGIC STRICT
        LOCAL lOk AS LOGIC
        TRY
            oDoc := System.Xml.XmlDocument{}
            oDoc:Load(oReader)
            lOk := TRUE
        CATCH
            lOk := FALSE
        END TRY
        RETURN lOk

   METHOD LoadFile(strFileName AS STRING) AS LOGIC STRICT
        LOCAL lResult := FALSE AS LOGIC
        IF System.IO.File.Exists(strFileName)
            LOCAL oReader AS System.IO.TextReader
            oReader := System.IO.StreamReader{strFileName,TRUE}
            lResult := SELF:_LoadFileFromReader(oReader)
            oReader:Close()
        ENDIF
        RETURN lResult

   METHOD LoadFileFromString(strXMLString AS STRING) AS LOGIC STRICT
        LOCAL lResult AS LOGIC
        LOCAL oReader AS System.IO.StringReader
        oReader := System.IO.StringReader{strXMLString}
        lResult := SELF:_LoadFileFromReader(oReader)
        oReader:Close()
        RETURN lResult

	STATIC PROTECT aRename AS Dictionary<STRING, STRING>
	STATIC PROTECT aDelete AS List<STRING>
	STATIC CONSTRUCTOR()
		aRename := Dictionary<STRING, STRING> {StringComparer.CurrentCultureIgnoreCase}
		aRename:Add("ZeroBasedArrays","AZ")
		aRename:Add("CaseSensitiveIdentifiers","CS")
		aRename:Add("CheckFloatOverflows","FOVF")
		aRename:Add("ImplicitNamespaceLookup","INS")
		aRename:Add("AllowLateBinding","LB")
		aRename:Add("UseDefaultNamespace","NS")
		aRename:Add("CheckForOverflowUnderflow","OVF")
		aRename:Add("GeneratePreprocessorOutput","PPO")
		aRename:Add("AllowUnsafeCode","UnSafe")
		aRename:Add("VOCompatibleStringInit","VO2")
		aRename:Add("AllMethodsVirtual","VO3")
		aRename:Add("ImplicitSignConversions","VO4")
		aRename:Add("VOCompatibleCallingConventions","VO5")
		aRename:Add("VOResolveFunctionPointers","VO6")
		aRename:Add("VOCompatibleImplicitConversions","VO7")
		aRename:Add("VOCompatiblePreprocessor","VO8")
		aRename:Add("VOCompatibleImplicitRetvals","VO9")
		aRename:Add("VOCompatibleIIF","VO10")
		aRename:Add("VOCompatibleArithmeticConversions","VO11")
		aRename:Add("IntegerDivisionsReturnFloat","VO12")
		aRename:Add("VOCompatibleStringComparisons","VO13")
		aRename:Add("VOFloatLiterals","VO14")
		aRename:Add("AdditionalOptions","CommandLineOption")
		// Items to delete

		VAR aTemp := List<STRING>{}
		aTemp:Add("DisabledWarnings")
		aTemp:Add("ProjectName")
		aTemp:Add("ProjectExt")
		aTemp:Add("ProjectDir")
		aTemp:Add("ProjectFileName")
		aTemp:Add("ProjectPath")
		aTemp:Add("ProjectView")
		aTemp:Add("SchemaVersion")
		aDelete := List<STRING>{}
		FOREACH s AS STRING IN aTemp
			aDelete:Add(s:ToLower())
		NEXT

	RETURN

STATIC METHOD Convert(cFile AS STRING, oProgress AS IProgress) AS VOID
	LOCAL oConverter AS ProjectConverter
	LOCAL cSource AS STRING
	LOCAL cTarget AS STRING
	oConverter := ProjectConverter{oProgress}
	cSource := cFile
	cTarget := System.IO.Path.ChangeExtension(cSource, EXTENSION)
	IF oConverter:ConvertProjectFile(cSource, cTarget)
		oProgress:WriteLine( "Converted "+System.IO.Path.GetFileName(cSource)+" to " +System.IO.Path.GetFileName(cTarget))
	ELSE
		oProgress:WriteLine( "An error occurred")
	ENDIF
	RETURN

END CLASS

//
// Copyright (c) XSharp B.V.  All Rights Reserved.
// Licensed under the Apache License, Version 2.0.
// See License.txt in the project root for license information.
//

USING System.Collections.Generic
USING System.Xml
DEFINE EXTENSION := "xsproj"  AS STRING

CLASS ProjectConverter
	PROTECT oDoc 	AS XmlDocument
	PROTECT nGroup  AS LONG
	PROTECT cSchema AS STRING
	PROTECT cGuid   AS STRING
	PROTECT cPath	AS STRING
	PROTECT oProgress AS IProgress
	PROTECT lVulcanRtWritten AS LOGIC
	PROTECT oProjectNode as XmlElement
	PROTECT lHasProjectExtensions as LOGIC
	PROPERTY Guid AS STRING GET cGuid
	CONSTRUCTOR(oProg AS IProgress)
		cSchema := "http://schemas.microsoft.com/developer/msbuild/2003"
		nGroup  := 0
        cGuid   := System.Guid.NewGuid().ToString("B"):ToUpper()
        lVulcanRtWritten := FALSE
        SELF:oProgress := oProg

METHOD ConvertProjectFile(cSource AS STRING, cTarget AS STRING) AS LOGIC
	oProgress:WriteLine("Creating ... "+System.IO.Path.GetFileName(cTarget))
	cPath := System.IO.Path.GetDirectoryName(cSource)+"\"
	IF ! SELF:LoadFile(cSource)
		RETURN FALSE
	ENDIF
	SELF:WalkNode(oDoc)
	if (!lHasProjectExtensions )
		VAR oExt := oDoc:CreateElement("ProjectExtensions",cSchema)
		VAR oCap := oDoc:CreateElement("ProjectCapabilities",cSchema)
		oExt:AppendChild(oCap)
		oCap:AppendChild(oDoc:CreateElement("ProjectConfigurationsDeclaredAsItems",cSchema))
		oProjectNode:AppendChild(oExt)
	ENDIF
	SELF:SaveFile(cTarget)
	RETURN TRUE

  METHOD Save2String() AS STRING STRICT
      LOCAL cString         AS STRING
      LOCAL oWriter             AS System.Xml.XmlTextWriter
      LOCAL oStringWriter       AS System.IO.StringWriter
      cString := oDoc:OuterXml
      oStringWriter := System.IO.StringWriter{}
      oWriter     := System.Xml.XmlTextWriter{oStringWriter}
      oWriter:Formatting := System.Xml.Formatting.Indented
      oDoc:WriteTo(oWriter)
      cString := oStringWriter:ToString()
      RETURN cString

   METHOD SaveFile(strFileName AS STRING) AS LOGIC STRICT
      LOCAL lRet        AS LOGIC
      LOCAL oTargetFile  AS System.IO.StreamWriter
      lRet := FALSE
      IF oDoc:HasChildNodes
         oTargetFile := System.IO.StreamWriter{strFileName, FALSE}
         oTargetFile:Write( SELF:Save2String() )
         oTargetFile:Close()
         lRet := TRUE
      ENDIF
      RETURN lRet

METHOD CloneNode(oNode AS XmlNode) AS XmlNode
	LOCAL oResult AS XmlNode
	oResult := oNode:CloneNode(FALSE)
	oResult:InnerText := oNode:InnerText
	RETURN oResult

METHOD UpdateNode(oParent AS XmlNode, oElement AS XmlElement) AS VOID
	LOCAL oChild AS XmlElement
	LOCAL oAttribute AS XmlAttribute
	IF aDelete:Contains(oElement:Name:ToLower())
		// remove the node
		oParent:RemoveChild(oElement)
	ELSEIF aRename:ContainsKey(oElement:Name)
		// Renaming Nodes is not supported. Create a new node and
		// Copy its attributes and children
		// and then replace the existing node
		oChild := oDoc:CreateElement(aRename[oElement:Name],cSchema)
		DO WHILE oElement:HasAttributes
			oChild:SetAttributeNode(oElement:RemoveAttributeNode(oElement:Attributes[0]))
		ENDDO
		DO WHILE oElement:HasChildNodes
			oChild:AppendChild(oElement:FirstChild)
		ENDDO
		oParent:ReplaceChild(oChild, oElement)
	ELSE
		// Some nodes that require special processing
		SWITCH oElement:Name:ToLower()
		CASE "compile"
		CASE "none"
		CASE "vobinary"
		CASE "nativeresource"
			VAR cItem := oElement:GetAttribute("Include")
			cItem := cPath+cItem
			VAR oChild1 := oElement:FirstChild
			IF oChild1 != NULL .and. oChild1:Name:ToLowerInvariant() == "dependentupon"
				VAR  cInnerText := oChild1:InnerText
				IF cInnerText:Contains("\")
					// check to see if parent node is in the same folder as the child node.
					if System.IO.File.Exists(cItem) .and. System.IO.File.Exists(cPath+cInnerText)
						if System.IO.Path.GetFullPath(cItem) == System.IO.Path.GetFullPath(cPath+cInnerText)
							// paths are equal, only write filename
							cInnerText := System.IO.Path.GetFileName(cInnerText)
							oChild1:InnerText := cInnerText
						ENDIF
					endif
				ENDIF
			ENDIF

		CASE "import"
			// change import
			oAttribute := (XmlAttribute) oElement:Attributes:GetNamedItem("Project")
			IF oAttribute:Value:ToLower():Contains("vulcan.net")
				oAttribute:Value := "$(MSBuildExtensionsPath)\XSharp\XSharp.targets"
			ENDIF
		CASE "projectguid"
			// new guid
			oElement:InnerText := cGuid
		CASE "projecttypeguids"
			// WPF project
			// our WPF ProjectFactory
			// Generic WPF project
			// Our project factory
			oElement:InnerText := "{5ADB76EC-7017-476A-A8E0-25D4202FFCF0};{60DC8134-EBA5-43B8-BCC9-BB4BC16C2548};{AA6C8D78-22FF-423A-9C7C-5F2393824E04}"
		CASE "projectreference"
			// update extension in project references
			oAttribute := (XmlAttribute) oElement:Attributes:GetNamedItem("Include")
			IF oAttribute != NULL
				oAttribute:Value := oAttribute:Value:Replace(".vnproj", "."+EXTENSION)
			ENDIF
		CASE "propertygroup"
			// Only insert code inside the first propertygroup
			IF ++nGroup == 1
				LOCAL oImport AS XmlNode
				// Add Import
				oImport := oDoc:CreateElement("Import",cSchema)
				oAttribute := oDoc:CreateAttribute("Project")
				oAttribute:Value := "$(MSBuildExtensionsPath)\XSharp\XSharp.Default.props"
				oImport:Attributes:Append(oAttribute)
				oParent:InsertBefore(oImport, oElement)
				// Add propertygroup before Import with Label="Globals" and child <XSharpProjectExtensionsPath>
				oChild := oDoc:CreateElement( "PlatformTarget", cSchema)
				oChild:InnerText := "x86"
				oElement:InsertBefore(oChild,oElement:FirstChild)
				oChild := oDoc:CreateElement( "Dialect", cSchema)
				oChild:InnerText := "Vulcan"
				oElement:InsertBefore(oChild,oElement:FirstChild)
			ELSE
				// ALl other project groups.
				// Adjust the condition when needed
				VAR oCondition := (XMLAttribute) oElement:Attributes:GetNamedItem("Condition")
				// <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|AnyCPU'" Label="Configuration">
				IF oCondition != NULL
					VAR  cInnerText := oCondition:InnerText
					if ! cInnerText:ToLower():Contains("platform")
						if cInnerText:ToLower():Contains("release")
							oCondition:InnerText := "'$(Configuration)|$(Platform)' == 'Release|AnyCPU'"
						else
							oCondition:InnerText := "'$(Configuration)|$(Platform)' == 'Debug|AnyCPU'"
						endif
					ENDIF
				ENDIF
			ENDIF
		CASE "projectextensions"
			// add <ProjectCapabilities><ProjectConfigurationsDeclaredAsItems /></ProjectCapabilities>
			oChild := oDoc:CreateElement("ProjectCapabilities",cSchema)
			oChild:AppendChild(oDoc:CreateElement("ProjectConfigurationsDeclaredAsItems",cSchema))
			oElement:AppendChild(oChild)
			lHasProjectExtensions := TRUE
		CASE "reference"
			// Add VulcanRT assemblies after 1st reference
			IF !SELF:lVulcanRtWritten
				oChild := oDoc:CreateElement("Reference",cSchema)
				oAttribute := oDoc:CreateAttribute("Include")
				oAttribute:Value := "VulcanRT"
				oChild:Attributes:Append(oAttribute)
				VAR oSub := oDoc:CreateElement("Name",cSchema)
				oSub:InnerText := "VulcanRT"
				oChild:AppendChild(oSub)
				oSub := oDoc:CreateElement("AssemblyName",cSchema)
				oSub:InnerText := "VulcanRT.DLL"
				oChild:AppendChild(oSub)
				oElement:ParentNode:AppendChild(oChild)
				oChild := oDoc:CreateElement("Reference",cSchema)
				oAttribute := oDoc:CreateAttribute("Include")
				oAttribute:Value := "VulcanRTFuncs"
				oChild:Attributes:Append(oAttribute)
				oSub := oDoc:CreateElement("Name",cSchema)
				oSub:InnerText := "VulcanRTFuncs"
				oChild:AppendChild(oSub)
				oSub := oDoc:CreateElement("AssemblyName",cSchema)
				oSub:InnerText := "VulcanRTFuncs.DLL"
				oChild:AppendChild(oSub)
				oElement:ParentNode:AppendChild(oChild)
				SELF:lVulcanRtWritten := TRUE
			ENDIF
		OTHERWISE
			// All other elements should not be changed
			NOP
		END SWITCH
	ENDIF
	RETURN

METHOD WalkNode(oNode AS XmlNode) AS VOID
	LOCAL aChildren AS List<XmlNode>
	aChildren := List<XmlNode>{}
	FOREACH oChild AS XmlNode IN oNode:ChildNodes
		aChildren:Add(oChild)
	NEXT
	FOREACH oChild AS XmlNode IN aChildren
		IF oChild IS XmlElement
			SELF:UpdateNode(oNode, (XmlElement) oChild)
		ENDIF
		SELF:WalkNode((XMlNode) oChild)
	NEXT
	RETURN

    PROTECT METHOD _LoadFileFromReader(oReader AS System.IO.TextReader) AS LOGIC STRICT
        LOCAL lOk AS LOGIC
        TRY
            oDoc := System.Xml.XmlDocument{}
            oDoc:Load(oReader)
            lOk := TRUE
        CATCH
            lOk := FALSE
        END TRY
        RETURN lOk

   METHOD LoadFile(strFileName AS STRING) AS LOGIC STRICT
        LOCAL lResult := FALSE AS LOGIC
        IF System.IO.File.Exists(strFileName)
            LOCAL oReader AS System.IO.TextReader
            oReader := System.IO.StreamReader{strFileName,TRUE}
            lResult := SELF:_LoadFileFromReader(oReader)
            oReader:Close()
        ENDIF
        RETURN lResult

   METHOD LoadFileFromString(strXMLString AS STRING) AS LOGIC STRICT
        LOCAL lResult AS LOGIC
        LOCAL oReader AS System.IO.StringReader
        oReader := System.IO.StringReader{strXMLString}
        lResult := SELF:_LoadFileFromReader(oReader)
        oReader:Close()
        RETURN lResult

	STATIC PROTECT aRename AS Dictionary<STRING, STRING>
	STATIC PROTECT aDelete AS List<STRING>
	STATIC CONSTRUCTOR()
		aRename := Dictionary<STRING, STRING> {StringComparer.CurrentCultureIgnoreCase}
		aRename:Add("ZeroBasedArrays","AZ")
		aRename:Add("CaseSensitiveIdentifiers","CS")
		aRename:Add("CheckFloatOverflows","FOVF")
		aRename:Add("ImplicitNamespaceLookup","INS")
		aRename:Add("AllowLateBinding","LB")
		aRename:Add("UseDefaultNamespace","NS")
		aRename:Add("CheckForOverflowUnderflow","OVF")
		aRename:Add("GeneratePreprocessorOutput","PPO")
		aRename:Add("AllowUnsafeCode","UnSafe")
		aRename:Add("VOCompatibleStringInit","VO2")
		aRename:Add("AllMethodsVirtual","VO3")
		aRename:Add("ImplicitSignConversions","VO4")
		aRename:Add("VOCompatibleCallingConventions","VO5")
		aRename:Add("VOResolveFunctionPointers","VO6")
		aRename:Add("VOCompatibleImplicitConversions","VO7")
		aRename:Add("VOCompatiblePreprocessor","VO8")
		aRename:Add("VOCompatibleImplicitRetvals","VO9")
		aRename:Add("VOCompatibleIIF","VO10")
		aRename:Add("VOCompatibleArithmeticConversions","VO11")
		aRename:Add("IntegerDivisionsReturnFloat","VO12")
		aRename:Add("VOCompatibleStringComparisons","VO13")
		aRename:Add("VOFloatLiterals","VO14")
		aRename:Add("AdditionalOptions","CommandLineOption")
		// Items to delete

		VAR aTemp := List<STRING>{}
		aTemp:Add("DisabledWarnings")
		aTemp:Add("ProjectName")
		aTemp:Add("ProjectExt")
		aTemp:Add("ProjectDir")
		aTemp:Add("ProjectFileName")
		aTemp:Add("ProjectPath")
		aTemp:Add("ProjectView")
		aTemp:Add("SchemaVersion")
		aDelete := List<STRING>{}
		FOREACH s AS STRING IN aTemp
			aDelete:Add(s:ToLower())
		NEXT

	RETURN

STATIC METHOD Convert(cFile AS STRING, oProgress AS IProgress) AS VOID
	LOCAL oConverter AS ProjectConverter
	LOCAL cSource AS STRING
	LOCAL cTarget AS STRING
	oConverter := ProjectConverter{oProgress}
	cSource := cFile
	cTarget := System.IO.Path.ChangeExtension(cSource, EXTENSION)
	IF oConverter:ConvertProjectFile(cSource, cTarget)
		oProgress:WriteLine( "Converted "+System.IO.Path.GetFileName(cSource)+" to " +System.IO.Path.GetFileName(cTarget))
	ELSE
		oProgress:WriteLine( "An error occurred")
	ENDIF
	RETURN

END CLASS


[Runtime] Improved error message from the AssemblyLoader

//
// Copyright (c) XSharp B.V.  All Rights Reserved.
// Licensed under the Apache License, Version 2.0.
// See License.txt in the project root for license information.
//

// Code to load assemblies such as the Macro compiler and RDD system
USING System.Reflection
/// <exclude />
STATIC CLASS XSharp.AssemblyHelper
    /// <exclude />
    STATIC METHOD Load(cName AS STRING) AS Assembly
        LOCAL cLowerName := cName:ToLower() AS STRING
        // first locate the assembly that has the macro compiler in the list of loaded assemblies
        FOREACH oAsm AS Assembly IN AppDomain.CurrentDomain:GetAssemblies()
            IF oAsm:GetName():Name:ToLower() == cLowerName
                RETURN oAsm
            ENDIF
        NEXT
        VAR oCore := typeof(Error):Assembly
        // locate the dll in the GAC
        VAR oName := oCore:GetName()
        VAR cFullName := oName:FullName:Replace("XSharp.Core", cName)
        TRY
            VAR oAsm := Assembly.Load(cFullName)
            RETURN oAsm
        CATCH AS Exception
            NOP
        END TRY
        // locate in the same folder as X# Core
        VAR cFileName := oCore:Location:ToLower()
        cFileName := cFileName:Replace("xsharp.core", cName)
        IF System.IO.File.Exists(cFileName)
            TRY
                VAR oAsm  := Assembly.LoadFrom(cFileName)
                RETURN oAsm
            CATCH  AS Exception
                THROW Error{EG_OPEN, "", "Could not load "+cName+ " from the file "+cFileName} {Filename := cFileName,FuncSym := "AssemblyLoader"}
            END TRY
        ENDIF
        // locate from the X# paths
        cFileName := System.IO.Path.GetFileName(cFileName)
        IF File(cFileName)
            TRY
                cFilename := FPathName()
                VAR oAsm  := Assembly.LoadFrom(cFileName)
                RETURN oAsm
            CATCH  AS Exception
                THROW Error{EG_OPEN, "", "Could not load "+cName+ " from the file "+cFileName} {Filename := cFileName,FuncSym := "AssemblyLoader"}
            END TRY
        ENDIF
        THROW Error{EG_OPEN, "", "Could not load "+cName} {Filename := cFileName,FuncSym := "AssemblyLoader"}
END CLASS

//
// Copyright (c) XSharp B.V.  All Rights Reserved.
// Licensed under the Apache License, Version 2.0.
// See License.txt in the project root for license information.
//

// Code to load assemblies such as the Macro compiler and RDD system
USING System.Reflection
/// <exclude />
STATIC CLASS XSharp.AssemblyHelper
    /// <exclude />
    STATIC METHOD Load(cName AS STRING) AS Assembly
        LOCAL cLowerName := cName:ToLower() AS STRING
        // first locate the assembly that has the macro compiler in the list of loaded assemblies
        FOREACH oAsm AS Assembly IN AppDomain.CurrentDomain:GetAssemblies()
            IF oAsm:GetName():Name:ToLower() == cLowerName
                RETURN oAsm
            ENDIF
        NEXT
        VAR oCore := typeof(Error):Assembly
        // locate the dll in the GAC
        VAR oName := oCore:GetName()
        VAR cFullName := oName:FullName:Replace("XSharp.Core", cName)
        TRY
            VAR oAsm := Assembly.Load(cFullName)
            RETURN oAsm
        CATCH AS Exception
            NOP
        END TRY
        // locate in the same folder as X# Core
        VAR cFileName := oCore:Location:ToLower()
        cFileName := cFileName:Replace("xsharp.core", cName)
        IF System.IO.File.Exists(cFileName)
            TRY
                VAR oAsm  := Assembly.LoadFrom(cFileName)
                RETURN oAsm
            CATCH  AS Exception
                THROW Error{EG_CORRUPTION, "", "Could not load "+cName+ " from the file "+cFileName}
            END TRY
        ENDIF
        // locate from the X# paths
        cFileName := System.IO.Path.GetFileName(cFileName)
        IF File(cFileName)
            TRY
                cFilename := FPathName()
                VAR oAsm  := Assembly.LoadFrom(cFileName)
                RETURN oAsm
            CATCH  AS Exception
                THROW Error{EG_CORRUPTION, "", "Could not load "+cName+ " from the file "+cFileName}
            END TRY
        ENDIF
        THROW Error{EG_CORRUPTION, "", "Could not load "+cName}
END CLASS


bring Monad and Monad' together peacefully

import "../src/LangPrelude.prg"

-- simulate classes as propositions first

prop Functor :: (* ~> *) ~> * ~> * where
  Lfunctor :: Functor [] a
  Tfunctor :: Functor Tree a
  Mfunctor :: Functor Maybe a
  Pairfunctor :: Functor ((,) a) b

prop Monad' :: (* ~> *) ~> * ~> * where
  M :: Functor a b -> Monad' a b

data Tree a = Node a | Fork (Tree a) (Tree a)

data Test :: * where
  Test :: Monad' a t => Monad a -> a t -> Test

-- simulate classes as propositions first

prop Functor :: (* ~> *) ~> * ~> * where
  Lfunctor :: Functor [] a
  Tfunctor :: Functor Tree a
  Pairfunctor :: Functor ((,) a) b

prop Monad' :: (* ~> *) ~> * ~> * where
  M :: Functor a b -> Monad' a b

data Tree a = Node a | Fork (Tree a) (Tree a)

data Test :: * where
  Test :: Monad' a t => a t -> Test