Mailinglist Archive: yast-devel (85 mails)

< Previous Next >
Re: [yast-devel] Changeset 39159 adds XML representation to YCP
  • From: Klaus Kaempf <kkaempf@xxxxxxx>
  • Date: Wed, 4 Jul 2007 13:37:36 +0200
  • Message-id: <20070704113736.GA29407@xxxxxxxxxxxxx>
* Lukas Ocilka <lukas.ocilka@xxxxxxx> [Jul 04. 2007 11:59]:
> Klaus Kaempf wrote:
> > As part of hackweek project
> > http://idea.opensuse.org/content/ideas/ycp-to-ruby-translator
> > I just committed changeset #39159 to yast-core on svn trunk.
> > 
> > This changeset adds toXml() methods to all YCP and YCode classes,
> > giving all ycp code and data structures a representation as XML.
> 
> Klaus, does it also support toYCP :)? See the attached file.
> 
> During the HackWeek I met with Benji and we've decided to use his XML
> format for 'some other' Installation/Repository handling. It would be
> nice to have both toXml and toYCP.

I fail to see the relation between a metapackage/repository description
and YCP.

The toXml() code 'just' converts, i.e.
{
    integer i = 0;
    repeat
    {
        i = i + 1;
        if( i < 5 ) continue;
        break;
    }
    until( i > 10 );
    return i == 5;
}

to

<?xml version="1.0" encoding="UTF-8"?>
<ycp>
  <block kind="file">
    <symbols>
      <entry global category="filename" type="<unspec>">../../../libycp/testsuite/tests/statements/Repeat-Until-Continue.ycp</entry>
      <entry category="variable" type="integer">i</entry>
    </symbols>
    <point>000</point>
    <statements>
      <assign><entry>i</entry><expr><const><int>0</int></const></expr></assign>
      <repeat>
        <do>
          <block kind="unspec">
            <point>000</point>
            <statements>
              <assign><entry>i</entry><expr><yebinary><static name="+"><type kind="integer (integer, integer)"/></static><entry>i</entry><const><int>1</int></const></yebinary></expr></assign>
              <if><compare op="<"><entry>i</entry><const><int>5</int></const></compare><then><continue/></then></if>
              <break/>
            </statements>
          </block>
        </do>
        <until><compare op=">"><entry>i</entry><const><int>10</int></const></compare></until>
      </repeat>
      <return><compare op="=="><entry>i</entry><const><int>5</int></const></compare></return>
    </statements>
  </block>
</ycp>


Klaus
---
SUSE LINUX Products GmbH, GF: Markus Rex, HRB 16746 (AG N├╝rnberg)

-- 
To unsubscribe, e-mail: yast-devel+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: yast-devel+help@xxxxxxxxxxxx

< Previous Next >
Follow Ups