fix a nasty bug in extgraft

fix a nasty bug in extgraft

-- Modeling Opetopes
-- here is Eric's editor: http://sma.epfl.ch/~finster/opetope/opetope.html
--
-- Note: Kock et al. use a similar scheme, where
--          - dots    <-->   lines
--          - spheres <-->   dots
--          - lines disappear
--          -                spheres appear

-- Note: In Eric's new work (at IAS) there are no
--       dots any more, instead he uses 'output cards', so
--          - (output) cards   <-->  lines
--          - space between stacked cards <--> output cards
--          - lines disappear
--          -                (regular) cards appear

import "../tests/Nat.prg"

kind Trees = NoTree | Pre (Tree d) Trees deriving syntax (ts) List(NoTree, Pre)

data ZoomCompley :: Tree e ~> Tree f ~> * where
  Nily :: ZoomCompley a a
  Consy :: Stack a b -> ZoomCompley b c -> ZoomCompley a c
 deriving List(cply)

data ZoomComplex :: Trees ~> * where
  Nilx :: ZoomComplex [()tr]ts
  Endx :: Stack a b -> ZoomComplex [a, b]ts
  Consx :: Stack a b -> ZoomComplex [b; c]ts -> ZoomComplex [a, b; c]ts
 deriving syntax (cplx) List(Nilx, Consx) Item(Endx)

data Dir :: *2 where
  Hor :: Dir
  Ver :: Dir

-- define the Tree kind, a rose tree
-- note: we may need a two-level kind, since we need to track disjointness
--       of subtrees
-- todo: later we may want to have a label kind parameter too

data Tree :: Dir ~> *1 where
  Unit :: Tree Ver
  Ni :: Tree Hor
  Fork :: Tree d ~> Tree Hor ~> Tree Hor
 deriving syntax (tr) List(Ni, Fork) Unit(Unit)

-- make it singleton

data Tree' :: Tree d ~> * where
  In :: Tree' ()tr
  Fork :: Tree' head -> Tree' tail -> Tree' [head; tail]tr
  Done :: Tree' []tr
 deriving syntax (ar) List(Done, Fork) Unit(In) -- "arbre"
-- http://www.papoulipoesique.com/wp-content/uploads/2013/06/arbre.jpg

-- define a proposition for subtrees
-- to be checked: TakeHead must ensure that all the node is consumed

prop Subtree :: Tree d ~> Tree e ~> * where
  UnitSub :: Subtree ()tr tr
  BothNil :: Subtree []tr []tr
  TakeHead :: Subtree head head' -> Subtree tail tail' -> Subtree [head; tail]tr [head'; tail']tr

-- TODO: separate the notions of Niche / Frame / Cell
kind Volume = Framed | Cell
kind Diagram = Closed Volume | OpenNiche
-- should be a parameter to Stack

-- now we can stack cards (these are zooms in Kock et al. parlance)

data Stack :: Tree d ~> Tree e ~> * where
  Corolla :: Corolla tr => Tree' tr -> Stack tr ()tr

  -- needed?
  Encompass :: Subtree consumed tr => Stack consumed prod -> Stack tr prod

  -- put a frame around a niche
  Frame :: (Equal {nodes tr} {nodeValence out}) => Stack tr out -> Stack tr out

  -- the following three grab a node (and possibly its offsprings) and incorporate it into a single card
  NodeDone :: Stack []tr [()tr]tr
  Pick :: {- EntireNode => -} Stack head prodhead -> Stack tail prodtail -> Stack [head; tail]tr [prodhead; prodtail]tr
  Exclude :: {- EntireNode => -} Stack tail prod -> Stack [()tr; tail]tr prod
  -- TODO: maybe just specify a subtree (Tree') and that's it

  On :: (Subtree tr' tr, Pointers 1t at out) => Stack tr' out' -> Stack tr out -> Tree' at -> Stack tr {graft out' at out}

  -- building niches
  NicheDone :: Stack ()tr []tr
  Niche :: Stack tr out -> Stack tr [out]tr
  Also :: Pointers 1t at tr
       => Tree' at -> Stack tr' out' -> Stack tr out -> Stack {extgraft tr' at tr} [out'; out]tr

 deriving syntax(z) Record(NicheDone, Also) Item(Frame)

subDone = ({}z)z

subCont :: Stack ()tr tr -> Stack ()tr [tr]tr
subCont inner = ({()ar=inner}z)z

-- it remains to define corollas

prop Corolla :: Tree d ~> * where
  None' :: Corolla []tr
  One' :: Corolla tail -> Corolla [()tr; tail]tr

--  o   --->  |
--  |         |

lolliCell :: Stack []tr ()tr
lolliCell = Corolla Done

--  |         |
--  o   --->  |
--  |         |

dolliCell :: Stack [()tr]tr ()tr
dolliCell = Corolla $ Fork In Done

--              |
--  [o]   --->  o
--   |          |

lolliFrame :: Stack []tr [()tr]tr
lolliFrame = Encompass NodeDone

--   |          |
--  [o]   --->  o
--   |          |

dolliFrame :: Stack [()tr]tr [()tr]tr
dolliFrame = Encompass (Exclude NodeDone)

--   |          |
--   |          o
-- [[o]]  --->  |
--   |          o
--   |          |

stacked :: Stack [()tr]tr [[()tr]tr]tr
stacked = (dolliFrame `On` dolliFrame) (In `Fork` Done)

--   |
--  [|]   --->  o
--   |          |

crossed :: Stack ()tr []tr
crossed = subDone

-- we can now join things
--
dolliForever = [dolliFrame; dolliForever]cply
nopetope = [crossed, lolliFrame; dolliForever]cply

-- back to unit as fast as possible...
--
stopetope = [crossed, lolliFrame, dolliCell]cply
neverstopetope = [crossed, lolliFrame, dolliCell; neverstopetope]cply
stopetope' = [crossed, lolliFrame; (dolliCell)cplx]cplx
stopetope'' = [crossed, lolliFrame, dolliCell]cplx

--   |          o
-- [[|]]  --->  |
--   |          o
--   |          |

drossed :: Stack ()tr [[]tr]tr
drossed = subCont subDone

-- ################################
-- ############  Niches ###########
-- ################################

--  |          +
--  |          |

-- this is a niche, but assume to be a frame
niche0 :: Stack ()tr []tr
niche0 = {}z

--  |           |
-- [|]          +
--  |           |

-- this is a niche, but assume to be a frame
niche1 :: Stack ()tr [[]tr]tr
niche1 = {()ar=subDone; {}z}z

--  |         o   o
-- [|]  --->   \ /
-- [|]          +
--  |           |

-- this is a niche, but assume to be a frame
niche2 :: Stack ()tr [[]tr, []tr]tr
niche2 = {()ar=subDone; niche1}z

--                |
--  |         o   o
-- [o]  --->   \ /
-- [|]          +
--  |           |

niche10 :: Stack [()tr]tr [[()tr]tr, []tr]tr
niche10 = {()ar=Exclude NodeDone; Niche subDone}z

-- ################################
-- ############  Frames ###########
-- ################################

--   |              |
--  /|\         o   o
-- |[o]|  --->   \ /
-- |[|]|          o
--  \|/           |
--   |

cyclops :: Stack [()tr]tr [[()tr]tr, []tr]tr
cyclops = (niche10)z

-- Stacking, Valence, Affine subtree, Substitute at an affine position

-- counting Units in a tree

valence :: Tree d ~> Nat
{valence []tr} = 0t
{valence [head; tail]tr} = {plus {valence head} {valence tail}}
{valence ()tr} = 1t

-- counting siblings of a tree

nodeValence :: Tree d ~> Nat
{nodeValence []tr} = 0t
{nodeValence [head; tail]tr} = (1+{nodeValence tail})t

-- counting nodes in a tree

nodes :: Tree d ~> Nat
{nodes ()tr} = t
{nodes []tr} = 1t
{nodes [head; tail]tr} = {plus {nodes head} {nodes tail}}

-- nodeValenceAt: given a (multi)pointer, determine the node valences at those positions
--               WHERE     IN
nodeValenceAt :: Tree d ~> Tree e ~> Nat
{nodeValenceAt ()tr tree} = {nodeValence tree}
{nodeValenceAt []tr []tr} = 0t
{nodeValenceAt [head'; tail']tr [head; tail]tr} = {plus {nodeValenceAt head' head} {nodeValenceAt tail' tail}}

-- a pointer is a valence-1 subtree of a tree
-- it is used to mark a unit in a tree where substitution will occur
--
prop Pointers :: Nat ~> Tree d ~> Tree e ~> * where
  Finger :: Pointers 1t ()tr ()tr
  Finished :: Pointers 0t []tr []tr
  ThisWay :: Pointers 1t head' head -> Pointers n tail' tail -> Pointers (1+n)t [head'; tail']tr [head; tail]tr
  ElseWhere :: Pointers n tail' tail -> Pointers n [[]tr; tail']tr [head; tail]tr

-- http://en.wikipedia.org/wiki/Grafting
--
-- graft WHAT      WHERE     IN
graft :: Tree d ~> Tree e ~> Tree f ~> Tree f
{graft what ()tr ()tr} = what
{graft what []tr tr} = tr
{graft what [head'; tail']tr [head; tail]tr} = [{graft what head' head}; {graft what tail' tail}]tr

-- extgraft: extend and graft
--
extgraft :: Tree what ~> Tree wher ~> Tree tree ~> Tree tree'
{extgraft what ()tr ()tr} = what
{extgraft what []tr ()tr} = ()tr
{extgraft what [head; tail]tr ()tr} = {extgrafthor what [head; tail]tr}
{extgraft what []tr []tr} = []tr
{extgraft what []tr [head; tail]tr} = [head; tail]tr
{extgraft what [head'; tail']tr [head; tail]tr} = [{extgraft what head' head}; {extgraft what tail' tail}]tr

-- helper:
extgrafthor :: Tree what ~> Tree Hor ~> Tree Hor
{extgrafthor what []tr} = []tr
{extgrafthor what [head; tail]tr} = [{extgraft what head ()tr}; {extgrafthor what tail}]tr

{- NOTE: we have an Omega bug here:

prompt> :norm {graft []tr ()tr ()tr}
Normalizes to:
  []tr

prompt> :kind []tr
[]tr :: Tree Hor  = []tr

prompt> :kind {graft []tr ()tr ()tr}
{graft []tr ()tr ()tr} :: Tree Ver  = {graft []tr ()tr ()tr}

... BUT: Hor /= Ver :-(
-}

-- substitution: replace a pointed node (of valence n) in a tree with an
-- other tree of (valence n) -- TODO

-- HERE IS A NICE RESEARCH QUESTION:
-- is it possible to "proof search" a Zoom?
-- i.e.
{-

class ZoomLike (int :: Tree) (out :: Tree) where
  zoom :: (Nodes int ~ Valence out) => Zoom int out

-}

-- Modeling Opetopes
-- here is Eric's editor: http://sma.epfl.ch/~finster/opetope/opetope.html
--
-- Note: Kock et al. use a similar scheme, where
--          - dots    <-->   lines
--          - spheres <-->   dots
--          - lines disappear
--          -                spheres appear

-- Note: In Eric's new work (at IAS) there are no
--       dots any more, instead he uses 'output cards', so
--          - (output) cards   <-->  lines
--          - space between stacked cards <--> output cards
--          - lines disappear
--          -                (regular) cards appear

import "../tests/Nat.prg"

kind Trees = NoTree | Pre (Tree d) Trees deriving syntax (ts) List(NoTree, Pre)

data ZoomCompley :: Tree e ~> Tree f ~> * where
  Nily :: ZoomCompley a a
  Consy :: Stack a b -> ZoomCompley b c -> ZoomCompley a c
 deriving List(cply)

data ZoomComplex :: Trees ~> * where
  Nilx :: ZoomComplex [()tr]ts
  Endx :: Stack a b -> ZoomComplex [a, b]ts
  Consx :: Stack a b -> ZoomComplex [b; c]ts -> ZoomComplex [a, b; c]ts
 deriving syntax (cplx) List(Nilx, Consx) Item(Endx)

data Dir :: *2 where
  Hor :: Dir
  Ver :: Dir

-- define the Tree kind, a rose tree
-- note: we may need a two-level kind, since we need to track disjointness
--       of subtrees
-- todo: later we may want to have a label kind parameter too

data Tree :: Dir ~> *1 where
  Unit :: Tree Ver
  Ni :: Tree Hor
  Fork :: Tree d ~> Tree Hor ~> Tree Hor
 deriving syntax (tr) List(Ni, Fork) Unit(Unit)

-- make it singleton

data Tree' :: Tree d ~> * where
  In :: Tree' ()tr
  Fork :: Tree' head -> Tree' tail -> Tree' [head; tail]tr
  Done :: Tree' []tr
 deriving syntax (ar) List(Done, Fork) Unit(In) -- "arbre"
-- http://www.papoulipoesique.com/wp-content/uploads/2013/06/arbre.jpg

-- define a proposition for subtrees
-- to be checked: TakeHead must ensure that all the node is consumed

prop Subtree :: Tree d ~> Tree e ~> * where
  UnitSub :: Subtree ()tr tr
  BothNil :: Subtree []tr []tr
  TakeHead :: Subtree head head' -> Subtree tail tail' -> Subtree [head; tail]tr [head'; tail']tr

-- TODO: separate the notions of Niche / Frame / Cell
kind Volume = Framed | Cell
kind Diagram = Closed Volume | OpenNiche
-- should be a parameter to Stack

-- now we can stack cards (these are zooms in Kock et al. parlance)

data Stack :: Tree d ~> Tree e ~> * where
  Corolla :: Corolla tr => Tree' tr -> Stack tr ()tr

  -- needed?
  Encompass :: Subtree consumed tr => Stack consumed prod -> Stack tr prod

  -- put a frame around a niche
  Frame :: (Equal {nodes tr} {nodeValence out}) => Stack tr out -> Stack tr out

  -- the following three grab a node (and possibly its offsprings) and incorporate it into a single card
  NodeDone :: Stack []tr [()tr]tr
  Pick :: {- EntireNode => -} Stack head prodhead -> Stack tail prodtail -> Stack [head; tail]tr [prodhead; prodtail]tr
  Exclude :: {- EntireNode => -} Stack tail prod -> Stack [()tr; tail]tr prod
  -- TODO: maybe just specify a subtree (Tree') and that's it

  On :: (Subtree tr' tr, Pointers 1t at out) => Stack tr' out' -> Stack tr out -> Tree' at -> Stack tr {graft out' at out}

  -- building niches
  NicheDone :: Stack ()tr []tr
  Niche :: Stack tr out -> Stack tr [out]tr
  Also :: () -- (Pointers 1t at tr)
         => Tree' at -> Stack tr' out' -> Stack tr out -> Stack {extgraft tr' at tr} [out'; out]tr

 deriving syntax(z) Record(NicheDone, Also) Item(Frame)

subDone = ({}z)z

subCont :: Stack ()tr tr -> Stack ()tr [tr]tr
subCont inner = ({()ar=inner}z)z

-- it remains to define corollas

prop Corolla :: Tree d ~> * where
  None' :: Corolla []tr
  One' :: Corolla tail -> Corolla [()tr; tail]tr

--  o   --->  |
--  |         |

lolliCell :: Stack []tr ()tr
lolliCell = Corolla Done

--  |         |
--  o   --->  |
--  |         |

dolliCell :: Stack [()tr]tr ()tr
dolliCell = Corolla $ Fork In Done

--              |
--  [o]   --->  o
--   |          |

lolliFrame :: Stack []tr [()tr]tr
lolliFrame = Encompass NodeDone

--   |          |
--  [o]   --->  o
--   |          |

dolliFrame :: Stack [()tr]tr [()tr]tr
dolliFrame = Encompass (Exclude NodeDone)

--   |          |
--   |          o
-- [[o]]  --->  |
--   |          o
--   |          |

stacked :: Stack [()tr]tr [[()tr]tr]tr
stacked = (dolliFrame `On` dolliFrame) (In `Fork` Done)

--   |
--  [|]   --->  o
--   |          |

crossed :: Stack ()tr []tr
crossed = subDone

-- we can now join things
--
dolliForever = [dolliFrame; dolliForever]cply
nopetope = [crossed, lolliFrame; dolliForever]cply

-- back to unit as fast as possible...
--
stopetope = [crossed, lolliFrame, dolliCell]cply
neverstopetope = [crossed, lolliFrame, dolliCell; neverstopetope]cply
stopetope' = [crossed, lolliFrame; (dolliCell)cplx]cplx
stopetope'' = [crossed, lolliFrame, dolliCell]cplx

--   |          o
-- [[|]]  --->  |
--   |          o
--   |          |

drossed :: Stack ()tr [[]tr]tr
drossed = subCont subDone

-- ################################
-- ############  Niches ###########
-- ################################

--  |          +
--  |          |

-- this is a niche, but assume to be a frame
niche0 :: Stack ()tr []tr
niche0 = {}z

--  |           |
-- [|]          +
--  |           |

-- this is a niche, but assume to be a frame
niche1 :: Stack ()tr [[]tr]tr
niche1 = {()ar=subDone; {}z}z

--  |         o   o
-- [|]  --->   \ /
-- [|]          +
--  |           |

-- this is a niche, but assume to be a frame
niche2 :: Stack ()tr [[]tr, []tr]tr
niche2 = {()ar=subDone; niche1}z

--                |
--  |         o   o
-- [o]  --->   \ /
-- [|]          +
--  |           |

niche10 :: Stack [()tr]tr [[()tr]tr, []tr]tr
niche10 = {()ar=Exclude NodeDone; Niche subDone}z

-- ################################
-- ############  Frames ###########
-- ################################

--   |              |
--  /|\         o   o
-- |[o]|  --->   \ /
-- |[|]|          o
--  \|/           |
--   |

cyclops :: Stack [()tr]tr [[()tr]tr, []tr]tr
cyclops = (niche10)z

-- Stacking, Valence, Affine subtree, Substitute at an affine position

-- counting Units in a tree

valence :: Tree d ~> Nat
{valence []tr} = 0t
{valence [head; tail]tr} = {plus {valence head} {valence tail}}
{valence ()tr} = 1t

-- counting siblings of a tree

nodeValence :: Tree d ~> Nat
{nodeValence []tr} = 0t
{nodeValence [head; tail]tr} = (1+{nodeValence tail})t

-- counting nodes in a tree

nodes :: Tree d ~> Nat
{nodes ()tr} = t
{nodes []tr} = 1t
{nodes [head; tail]tr} = {plus {nodes head} {nodes tail}}

-- nodeValenceAt: given a (multi)pointer, determine the node valences at those positions
--               WHERE     IN
nodeValenceAt :: Tree d ~> Tree e ~> Nat
{nodeValenceAt ()tr tree} = {nodeValence tree}
{nodeValenceAt []tr []tr} = 0t
{nodeValenceAt [head'; tail']tr [head; tail]tr} = {plus {nodeValenceAt head' head} {nodeValenceAt tail' tail}}

-- a pointer is a valence-1 subtree of a tree
-- it is used to mark a unit in a tree where substitution will occur
--
prop Pointers :: Nat ~> Tree d ~> Tree e ~> * where
  Finger :: Pointers 1t ()tr ()tr
  Finished :: Pointers 0t []tr []tr
  ThisWay :: Pointers 1t head' head -> Pointers n tail' tail -> Pointers (1+n)t [head'; tail']tr [head; tail]tr
  ElseWhere :: Pointers n tail' tail -> Pointers n [[]tr; tail']tr [head; tail]tr

-- http://en.wikipedia.org/wiki/Grafting
--
-- graft WHAT      WHERE     IN
graft :: Tree d ~> Tree e ~> Tree f ~> Tree f
{graft what ()tr ()tr} = what
{graft what []tr tr} = tr
{graft what [head'; tail']tr [head; tail]tr} = [{graft what head' head}; {graft what tail' tail}]tr

extgraft :: Tree what ~> Tree wher ~> Tree tree ~> Tree tree'
{extgraft what ()tr ()tr} = what
{extgraft what []tr ()tr} = ()tr
{extgraft what [head; tail]tr ()tr} = [{extgraft what head ()tr}; {extgraft what tail ()tr}]tr
{extgraft what []tr []tr} = []tr
{extgraft what []tr [head; tail]tr} = [head; tail]tr
{extgraft what [head'; tail']tr [head; tail]tr} = [{extgraft what head' head}; {extgraft what tail' tail}]tr

{- TODO? multiGraft :: Treelist -> where -> in -}

{- NOTE: we have an Omega bug here:

prompt> :norm {graft []tr ()tr ()tr}
Normalizes to:
  []tr

prompt> :kind []tr
[]tr :: Tree Hor  = []tr

prompt> :kind {graft []tr ()tr ()tr}
{graft []tr ()tr ()tr} :: Tree Ver  = {graft []tr ()tr ()tr}

... BUT: Hor /= Ver :-(
-}

-- substitution: replace a pointed node (of valence n) in a tree with an
-- other tree of (valence n) -- TODO

-- HERE IS A NICE RESEARCH QUESTION:
-- is it possible to "proof search" a Zoom?
-- i.e.
{-

class ZoomLike (int :: Tree) (out :: Tree) where
  zoom :: (Nodes int ~ Valence out) => Zoom int out

-}


codegen/QtUiTools: updated

codegen/QtUiTools: updated

Modified:
codegen/QtUiTools/QUiLoader.prg

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

$project=Qt4xHb
$module=QtUiTools

$header

#include "hbclass.ch"

$addRequests

$beginClassFrom=QObject

$addMethods

$endClass

$destructor

#pragma BEGINDUMP

$includes

#include <QtCore/QStringList>
#include <QtCore/QDir>
#include <QtGui/QAction>
#include <QtGui/QLayout>

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

$deleteMethod

$prototype=void addPluginPath ( const QString & path )
$method=|void|addPluginPath|const QString &

$prototype=QStringList availableLayouts () const
$method=|QStringList|availableLayouts|

$prototype=QStringList availableWidgets () const
$method=|QStringList|availableWidgets|

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

$prototype=virtual QAction * createAction ( QObject * parent = 0, const QString & name = QString() )
$virtualMethod=|QAction *|createAction|QObject *=0,const QString &=QString()

$prototype=virtual QActionGroup * createActionGroup ( QObject * parent = 0, const QString & name = QString() )
$virtualMethod=|QActionGroup *|createActionGroup|QObject *=0,const QString &=QString()

$prototype=virtual QLayout * createLayout ( const QString & className, QObject * parent = 0, const QString & name = QString() )
$virtualMethod=|QLayout *|createLayout|const QString &,QObject *=0,const QString &=QString()

$prototype=virtual QWidget * createWidget ( const QString & className, QWidget * parent = 0, const QString & name = QString() )
$virtualMethod=|QWidget *|createWidget|const QString &,QWidget *=0,const QString &=QString()

$prototypeV2=bool isLanguageChangeEnabled() const

$prototype=QWidget * load ( QIODevice * device, QWidget * parentWidget = 0 )
$method=|QWidget *|load|QIODevice *,QWidget *=0

$prototype=QStringList pluginPaths () const
$method=|QStringList|pluginPaths|

$prototype=void setLanguageChangeEnabled ( bool enabled )
$method=|void|setLanguageChangeEnabled|bool

$prototype=void setWorkingDirectory ( const QDir & dir )
$method=|void|setWorkingDirectory|const QDir &

$prototype=QDir workingDirectory () const
$method=|QDir|workingDirectory|

#pragma ENDDUMP

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

$project=Qt4xHb
$module=QtUiTools

$header

#include "hbclass.ch"

$addRequests

$beginClassFrom=QObject

$addMethods

$endClass

$destructor

#pragma BEGINDUMP

$includes

#include <QtCore/QStringList>
#include <QtCore/QDir>
#include <QtGui/QAction>
#include <QtGui/QLayout>

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

$deleteMethod

$prototype=void addPluginPath ( const QString & path )
$method=|void|addPluginPath|const QString &

$prototype=QStringList availableLayouts () const
$method=|QStringList|availableLayouts|

$prototype=QStringList availableWidgets () const
$method=|QStringList|availableWidgets|

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

$prototype=virtual QAction * createAction ( QObject * parent = 0, const QString & name = QString() )
$virtualMethod=|QAction *|createAction|QObject *=0,const QString &=QString()

$prototype=virtual QActionGroup * createActionGroup ( QObject * parent = 0, const QString & name = QString() )
$virtualMethod=|QActionGroup *|createActionGroup|QObject *=0,const QString &=QString()

$prototype=virtual QLayout * createLayout ( const QString & className, QObject * parent = 0, const QString & name = QString() )
$virtualMethod=|QLayout *|createLayout|const QString &,QObject *=0,const QString &=QString()

$prototype=virtual QWidget * createWidget ( const QString & className, QWidget * parent = 0, const QString & name = QString() )
$virtualMethod=|QWidget *|createWidget|const QString &,QWidget *=0,const QString &=QString()

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

$prototype=QWidget * load ( QIODevice * device, QWidget * parentWidget = 0 )
$method=|QWidget *|load|QIODevice *,QWidget *=0

$prototype=QStringList pluginPaths () const
$method=|QStringList|pluginPaths|

$prototype=void setLanguageChangeEnabled ( bool enabled )
$method=|void|setLanguageChangeEnabled|bool

$prototype=void setWorkingDirectory ( const QDir & dir )
$method=|void|setWorkingDirectory|const QDir &

$prototype=QDir workingDirectory () const
$method=|QDir|workingDirectory|

#pragma ENDDUMP


[Runtime} Added some more VFP tests for At() and AtC()

//
// 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

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

	CLASS StringTests

		[Fact, Trait("Category", "String")];
		METHOD JustFunctionTests() AS VOID
            Assert.Equal("C:", JustDrive("C:\Folder\test.txt") )
            Assert.Equal("txt", JustExt("C:\Folder\test.txt") )
            Assert.Equal("C:\Folder", JustPath("C:\Folder\test.txt") )
            Assert.Equal("test.txt", JustFName("C:\Folder\test.txt") )
            Assert.Equal("test", JustStem("C:\Folder\test.txt") )
            Assert.Equal("C:\",Addbs("C:"))
            Assert.Equal("C:\test\",Addbs("C:\test"))

		[Fact, Trait("Category", "String")];
        METHOD RatFunctionTests() AS VOID

        Assert.Equal( RAt( NULL , NULL ,1) , 0 )
        Assert.Equal( RAt( NULL , "eeee" ,1) , 0)
        Assert.Equal( RAt( "" , NULL ,1) , 0 )
        Assert.Equal( RAt( "" , "eeee" ,1) , 0 )
        Assert.Equal( RAt( "ee" , "" , 1) , 0 )
        Assert.Equal( RAt( "" , "" , )   , 0 )
        Assert.Equal( RAt( "gg" , "ggeegggege" , 2) , 5 )
        Assert.Equal( RAt( "gg" , "ggeegggege" , 3) , 1)
        Assert.Equal( RAt( "ag" , "ageegggege" , 6) , 0)
        Assert.Equal( RAt( "g" , "eegggege" , 2) , 5)
        Assert.Equal( RAt( "g" , "eegggege" , 3 ) , 4)
        Assert.Equal( RAt( "gg" , "eegggege" , 2 ) , 3)
        Assert.Equal( RAt( "gg" , "eegggege" , 1 ) , 4)
        Assert.Equal( RAt( "gg" , "eegggege" ,1) , 4)
        Assert.Equal( RAt( "eeee" , "eeee",1 ) , 1)
        Assert.Equal( RAt( "ee" , "eeee" , 1) , 3)
        Assert.Equal( RAt( "ee" , "eeee" , 2) , 2)
        Assert.Equal( RAt( "ee" , "eeee" , 3) , 1)
        Assert.Equal( RAt( "ee" , "eeee" , 4) , 0)
        Assert.Equal( RAt( "ee" , "eeee",1) , 3)
        Assert.Equal( RAt( "ee" , "eeaeeaa" ,1) , 4)
        Assert.Equal( RAt( "ee" , "eeaeeaa" , 2 ) , 1)
        Assert.Equal( RAt( "e" , "eeee" , 1) , 4)
        Assert.Equal( RAt( "e" , "eeee" , 2) , 3)
        Assert.Equal( RAt( "e" , "eeee" , 3) , 2)
        Assert.Equal( RAt( "e" , "eeee" , 4) , 1)
        Assert.Equal( RAt( "e" , "eeee" ,1) , 4)
        Assert.Equal( RAt( "jkh" , "jkhjkhejkaaajkh" , 2 ) , 4)
        Assert.Equal( RAt( "jkh" , "jkhjkhejkaaajkh" ,1)	, 13)
        Assert.Equal( RAt("bb", "abbcabbcbba" , 1  ) , 9)
        Assert.Equal( RAt("bb", "abbcabbcbba" , 2  ) , 6)
        Assert.Equal( RAt("bb", "abbcabbcbba" , 3  ) , 2)
        Assert.Equal( RAt("bb", "abbcabbcbba" , 4  ) , 0)
        Assert.Equal( RAt("bb", "abbcabbcbba" ,1) , 9 )
        Assert.Equal( RAt("e", "abbcabbcbba"  ,1)  , 0)
        Assert.Equal( RAt("b", "abbcabbcbba" , 5 ) , 3)
        Assert.Equal( RAt("a","abracadabra",1)  ,  11)
        Assert.Equal( RAt("a","abracadabra",3)  ,  6)
        Assert.Equal( RAt("a","abracadabra",43)  ,  0)
        Assert.Equal( RAt("a","abracadabra",1)  ,  11)
        Assert.Equal( RAt("a" , "AaaA", 2  ) , 2)
        Assert.Equal( RAt("hj" , "eeagfeehjkhjkhje" ,3 )  , 8)
        Assert.Equal( RAt("e" , "eeagfeehjkhjkhje" , 3 ) , 6)
        Assert.Equal( RAt("ee" , "eeagfeehjkhjkhje" , 2 ) , 1)

		[Fact, Trait("Category", "String")];
        METHOD ChrTranFunctionTests() AS VOID
        VAR cAllowedCharacters := "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
        VAR cExpressionSearched := "123!EB5466677eggtz123%&Y"

        Assert.Equal(ChrTran( cExpressionSearched, ChrTran(cExpressionSearched, cAllowedCharacters, ""), "") , "EBeggtzY")

        Assert.Equal(ChrTran("ABCDEFGHABCDEFGH", "AE", "ae") , "aBCDeFGHaBCDeFGH" )
        Assert.Equal(ChrTran("ABCDEFGHIJK","DEF","") , "ABCGHIJK")
        Assert.Equal(ChrTran("ABCabc2468", "1234567890", "" ) , "ABCabc" )
        Assert.Equal(ChrTran("ABCDEF", "ACE", "XYZ")  , "XBYDZF"  )
        Assert.Equal(ChrTran("ABCDEF", "", "XYZ") , "ABCDEF")
        Assert.Equal(ChrTran("ABCDEF", "ACE", "") , "BDF")
        Assert.Equal(ChrTran("ABCD", "ABC", "YZ")  , "YZD")
        Assert.Equal(ChrTran("ABCDEF", "ACE", "XYZQRST") ,  "XBYDZF" )
        Assert.Equal(ChrTran("", "ABC", "YZ") , "" )
        Assert.Equal(ChrTran("ABCDEF", "", "ACE")  , "ABCDEF")
        Assert.Equal(ChrTran("ABCDEF", "", "")  , "ABCDEF" )
        Assert.Equal(ChrTran("abcDeF","ADF" , "xYZ1TZ" ) , "abcYeZ")
        Assert.Equal(ChrTran("","" , "" ) , "" )
        Assert.Equal(ChrTran(NULL,NULL , "" ) , "")

        VAR x := Replicate ( "A", 200000 )
        VAR y := Replicate ( "I", 200000 )

        VAR g := ChrTran( x ,"A" , "IE" )

		[Fact, Trait("Category", "String")];
		METHOD AtFuctionTests() AS VOID
            Assert.Equal(9u , At("b", "abucabucbba", 3 )  )
            Assert.Equal(6u , At("bu", "abucabucbba", 2 ) )
            Assert.Equal(2u , At("bu", "abucabucbba", 1 ) )
            Assert.Equal(0u , At("bu", "abucabucbba", 12 ))

            Assert.Equal(9u , AtC("B", "abucabucbba", 3 )  )
            Assert.Equal(6u , AtC("Bu", "abucabucbba", 2 ) )
            Assert.Equal(2u , AtC("Bu", "abucabucbba", 1 ) )
            Assert.Equal(0u , AtC("Bu", "abucabucbba", 12 ))

            Assert.Equal(0u , At("B", "abucabucbba", 2 ) )
            Assert.Equal(0u , At("Bu", "abucabucbba", 2 ) )
            Assert.Equal(0u , At("Bu", "abucabucbba", 1 ) )
            Assert.Equal(0u , At("Bu", "abucabucbba", 12 ))

            Assert.Equal(0u, At( NULL , NULL ) )
            Assert.Equal(0u, At( NULL , "eeee" ) )
            Assert.Equal(0u, At( "" , NULL ) )
            Assert.Equal(0u, At( "" , "eeee" ) )
            Assert.Equal(0u, At( "ee" , "" , ) )
            Assert.Equal(0u, At( "" , "" , )   )
            Assert.Equal(6u, At( "gg" , "ggeegggege" , 3) )
            Assert.Equal(1u, At( "gg" , "ggeegggege" , 1) )
            Assert.Equal(0u, At( "ag" , "ageegggege" , 6) )
            Assert.Equal(4u, At( "g" , "eegggege" , 2) )
            Assert.Equal(7u, At( "g" , "eegggege" , 4 ) )
            Assert.Equal(9u, At( "gg" , "eegggegegg" , 3 ) )
            Assert.Equal(3u, At( "gg" , "eegggege" , 1 ) )
            Assert.Equal(3u, At( "gg" , "eegggege" ) )
            Assert.Equal(1u, At( "eeee" , "eeee" ) )
            Assert.Equal(1u, At( "ee" , "eeee" , 1) )
            Assert.Equal(2u, At( "ee" , "eeee" , 2) )
            Assert.Equal(3u, At( "ee" , "eeee" , 3) )
            Assert.Equal(0u, At( "ee" , "eeee" , 4) )
            Assert.Equal(1u, At( "ee" , "eeee" ) )
            Assert.Equal(1u, At( "ee" , "eeaeeaa" ) )
            Assert.Equal(4u, At( "ee" , "eeaeeaa" , 2 ) )
            Assert.Equal(1u, At( "e" , "eeee" , 1) )
            Assert.Equal(2u, At( "e" , "eeee" , 2) )
            Assert.Equal(3u, At( "e" , "eeee" , 3) )
            Assert.Equal(4u, At( "e" , "eeee" , 4) )
            Assert.Equal(1u, At( "e" , "eeee" ) )
            Assert.Equal(1u, At( "jkh" , "jkhjkhejkaaajkh" ) )
            Assert.Equal(4u, At( "jkh" , "jkhjkhejkaaajkh" , 2 ) )
            Assert.Equal(13u, At( "jkh" , "jkhjkhejkaaajkh" , 3 ) )
            Assert.Equal(2u, At("bb", "abbcabbcbba" , 1  ) )
            Assert.Equal(6u, At("bb", "abbcabbcbba" , 2  ) )
            Assert.Equal(9u, At("bb", "abbcabbcbba" , 3  ) )
            Assert.Equal(0u, At("bb", "abbcabbcbba" , 4  ) )
            Assert.Equal(0u, At("e", "abbcabbcbba"  )  )
            Assert.Equal(9u, At("b", "abbcabbcbba" , 5 ) )
            Assert.Equal(0u, At("a","abracadabra",43)  )
            Assert.Equal(4u, At("a","abracadabra",2)  )
            Assert.Equal(3u, At("a" , "AaaA", 2  ) )
            Assert.Equal(2u, At("a" , "AaaA" ) )
            Assert.Equal(14u, At("hj" , "eeagfeehjkhjkhje" ,3 )  )
            Assert.Equal(16u, At("e" , "eeagfeehjkhjkhje" , 5 ) )
            Assert.Equal(8u, At("ee" , "eeeeagfeehjkhjkhje" , 4 ) )

            Assert.Equal(1u, AtC ("a" , "AaaA" ) )
            Assert.Equal(2u, AtC ("aa" , "AaaA" , 2 ) )
            Assert.Equal(2u, AtC ("aA" , "AaaA", 2 ) )
            Assert.Equal(3u, AtC ("aA" , "AaaA", 3 ) )
            Assert.Equal(0u, AtC ("aA" , "AaaA", 12 ) )
            Assert.Equal(0u, AtC ("aA" , "AaaA", 4 ) )

	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

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

	CLASS StringTests

		[Fact, Trait("Category", "String")];
		METHOD JustFunctionTests() AS VOID
            Assert.Equal("C:", JustDrive("C:\Folder\test.txt") )
            Assert.Equal("txt", JustExt("C:\Folder\test.txt") )
            Assert.Equal("C:\Folder", JustPath("C:\Folder\test.txt") )
            Assert.Equal("test.txt", JustFName("C:\Folder\test.txt") )
            Assert.Equal("test", JustStem("C:\Folder\test.txt") )
            Assert.Equal("C:\",Addbs("C:"))
            Assert.Equal("C:\test\",Addbs("C:\test"))

		[Fact, Trait("Category", "String")];
        METHOD RatFunctionTests() AS VOID

        Assert.Equal( RAt( NULL , NULL ,1) , 0 )
        Assert.Equal( RAt( NULL , "eeee" ,1) , 0)
        Assert.Equal( RAt( "" , NULL ,1) , 0 )
        Assert.Equal( RAt( "" , "eeee" ,1) , 0 )
        Assert.Equal( RAt( "ee" , "" , 1) , 0 )
        Assert.Equal( RAt( "" , "" , )   , 0 )
        Assert.Equal( RAt( "gg" , "ggeegggege" , 2) , 5 )
        Assert.Equal( RAt( "gg" , "ggeegggege" , 3) , 1)
        Assert.Equal( RAt( "ag" , "ageegggege" , 6) , 0)
        Assert.Equal( RAt( "g" , "eegggege" , 2) , 5)
        Assert.Equal( RAt( "g" , "eegggege" , 3 ) , 4)
        Assert.Equal( RAt( "gg" , "eegggege" , 2 ) , 3)
        Assert.Equal( RAt( "gg" , "eegggege" , 1 ) , 4)
        Assert.Equal( RAt( "gg" , "eegggege" ,1) , 4)
        Assert.Equal( RAt( "eeee" , "eeee",1 ) , 1)
        Assert.Equal( RAt( "ee" , "eeee" , 1) , 3)
        Assert.Equal( RAt( "ee" , "eeee" , 2) , 2)
        Assert.Equal( RAt( "ee" , "eeee" , 3) , 1)
        Assert.Equal( RAt( "ee" , "eeee" , 4) , 0)
        Assert.Equal( RAt( "ee" , "eeee",1) , 3)
        Assert.Equal( RAt( "ee" , "eeaeeaa" ,1) , 4)
        Assert.Equal( RAt( "ee" , "eeaeeaa" , 2 ) , 1)
        Assert.Equal( RAt( "e" , "eeee" , 1) , 4)
        Assert.Equal( RAt( "e" , "eeee" , 2) , 3)
        Assert.Equal( RAt( "e" , "eeee" , 3) , 2)
        Assert.Equal( RAt( "e" , "eeee" , 4) , 1)
        Assert.Equal( RAt( "e" , "eeee" ,1) , 4)
        Assert.Equal( RAt( "jkh" , "jkhjkhejkaaajkh" , 2 ) , 4)
        Assert.Equal( RAt( "jkh" , "jkhjkhejkaaajkh" ,1)	, 13)
        Assert.Equal( RAt("bb", "abbcabbcbba" , 1  ) , 9)
        Assert.Equal( RAt("bb", "abbcabbcbba" , 2  ) , 6)
        Assert.Equal( RAt("bb", "abbcabbcbba" , 3  ) , 2)
        Assert.Equal( RAt("bb", "abbcabbcbba" , 4  ) , 0)
        Assert.Equal( RAt("bb", "abbcabbcbba" ,1) , 9 )
        Assert.Equal( RAt("e", "abbcabbcbba"  ,1)  , 0)
        Assert.Equal( RAt("b", "abbcabbcbba" , 5 ) , 3)
        Assert.Equal( RAt("a","abracadabra",1)  ,  11)
        Assert.Equal( RAt("a","abracadabra",3)  ,  6)
        Assert.Equal( RAt("a","abracadabra",43)  ,  0)
        Assert.Equal( RAt("a","abracadabra",1)  ,  11)
        Assert.Equal( RAt("a" , "AaaA", 2  ) , 2)
        Assert.Equal( RAt("hj" , "eeagfeehjkhjkhje" ,3 )  , 8)
        Assert.Equal( RAt("e" , "eeagfeehjkhjkhje" , 3 ) , 6)
        Assert.Equal( RAt("ee" , "eeagfeehjkhjkhje" , 2 ) , 1)

		[Fact, Trait("Category", "String")];
        METHOD ChrTranFunctionTests() AS VOID
        VAR cAllowedCharacters := "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
        VAR cExpressionSearched := "123!EB5466677eggtz123%&Y"

        Assert.Equal(ChrTran( cExpressionSearched, ChrTran(cExpressionSearched, cAllowedCharacters, ""), "") , "EBeggtzY")

        Assert.Equal(ChrTran("ABCDEFGHABCDEFGH", "AE", "ae") , "aBCDeFGHaBCDeFGH" )
        Assert.Equal(ChrTran("ABCDEFGHIJK","DEF","") , "ABCGHIJK")
        Assert.Equal(ChrTran("ABCabc2468", "1234567890", "" ) , "ABCabc" )
        Assert.Equal(ChrTran("ABCDEF", "ACE", "XYZ")  , "XBYDZF"  )
        Assert.Equal(ChrTran("ABCDEF", "", "XYZ") , "ABCDEF")
        Assert.Equal(ChrTran("ABCDEF", "ACE", "") , "BDF")
        Assert.Equal(ChrTran("ABCD", "ABC", "YZ")  , "YZD")
        Assert.Equal(ChrTran("ABCDEF", "ACE", "XYZQRST") ,  "XBYDZF" )
        Assert.Equal(ChrTran("", "ABC", "YZ") , "" )
        Assert.Equal(ChrTran("ABCDEF", "", "ACE")  , "ABCDEF")
        Assert.Equal(ChrTran("ABCDEF", "", "")  , "ABCDEF" )
        Assert.Equal(ChrTran("abcDeF","ADF" , "xYZ1TZ" ) , "abcYeZ")
        Assert.Equal(ChrTran("","" , "" ) , "" )
        Assert.Equal(ChrTran(NULL,NULL , "" ) , "")

        VAR x := Replicate ( "A", 200000 )
        VAR y := Replicate ( "I", 200000 )

        VAR g := ChrTran( x ,"A" , "IE" )

		[Fact, Trait("Category", "String")];
		METHOD At_Tests() AS VOID
            Assert.Equal(9u , At("b", "abucabucbba", 3 )  )
            Assert.Equal(6u , At("bu", "abucabucbba", 2 ) )
            Assert.Equal(2u , At("bu", "abucabucbba", 1 ) )
            Assert.Equal(0u , At("bu", "abucabucbba", 12 ))

            Assert.Equal(9u , AtC("B", "abucabucbba", 3 )  )
            Assert.Equal(6u , AtC("Bu", "abucabucbba", 2 ) )
            Assert.Equal(2u , AtC("Bu", "abucabucbba", 1 ) )
            Assert.Equal(0u , AtC("Bu", "abucabucbba", 12 ))

            Assert.Equal(0u , At("B", "abucabucbba", 2 ) )
            Assert.Equal(0u , At("Bu", "abucabucbba", 2 ) )
            Assert.Equal(0u , At("Bu", "abucabucbba", 1 ) )
            Assert.Equal(0u , At("Bu", "abucabucbba", 12 ))

	END CLASS

END NAMESPACE