# HG changeset patch
# User Hartmut Goebel <h.goebel@crazy-compilers.com>
# Date 1584437198 -3600
# Node ID fb35b9db9ca11264965b28f1f84d0490108468e5
# Parent  700f4d003349dfd83922354b9b23802e1ef004fa
Move data files into the Python package.

The packe directory is now always searched for include files, after
all other directoreis given in $YML_PATH.

diff -r 700f4d003349 -r fb35b9db9ca1 manpage.yml2
--- a/manpage.yml2	Thu Oct 27 12:51:47 2016 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-decl manpage(xmlns="http://docbook.org/ns/docbook", version="5.0", *title) alias article { title *title; content; };
diff -r 700f4d003349 -r fb35b9db9ca1 standardlib.ysl2
--- a/standardlib.ysl2	Thu Oct 27 12:51:47 2016 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,68 +0,0 @@
-// YML2 standardlib version 2.5.8
-
-function "yml:hex2dec" {
-    param "hex";
-    param "_result", 0;
-    
-    const "hd", "substring($hex, 1, 1)";
-    const "a", """translate($hd, 'ABCDEFabcdef123456789',
-        '123456123456000000000')""";
-
-    const "d" choose {
-        when "$a>0" value "$a + 9";
-        otherwise value "$hd";
-    }
-
-    choose {
-        when "string-length($hex) = 1"
-            value "$_result * 16 + $d";
-        otherwise call "yml:hex2dec"
-            with "hex", "substring($hex, 2, 8)", 
-            with "_result", "$_result * 16 + $d";
-    }
-}
-
-function "yml:dec2hex" {
-    param "dec";
-    param "bits", !16**7!;
-
-    const "v", "floor($dec div $bits)";
-    value "substring('0123456789abcdef', $v + 1, 1)";
-
-    if "$bits > 1" call "yml:dec2hex"
-        with "dec", "$dec - $bits * $v",
-        with "bits", "$bits div 16";
-}
-
-def "yml:dec2hex" {
-    param "dec";
-    param "digits", 8;
-        
-    result call "yml:dec2hex" with "dec", "$dec", with "bits", "math:power(16, $digits - 1)";
-}
-
-def "yml:hex2dec" {
-    param "hex";
-    result call "yml:hex2dec" with "hex", "$hex";
-}
-
-def "yml:lcase" {
-    param "text", "''";
-    result "translate($text, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz')";
-}
-
-def "yml:ucase" {
-    param "text", "''";
-    result "translate($text, 'abcdefghijklmnopqrstuvwxyz', 'ABCDEFGHIJKLMNOPQRSTUVWXYZ')";
-}
-
-def "yml:mixedCase" {
-    param "text", "''";
-    result "concat(yml:lcase(substring($text,1,1)),substring($text,2))";
-}
-
-def "yml:capit" {
-    param "text", "''";
-    result "concat(yml:ucase(substring($text,1,1)),substring($text,2))";
-}
-
diff -r 700f4d003349 -r fb35b9db9ca1 xml2yml.ysl2
--- a/xml2yml.ysl2	Thu Oct 27 12:51:47 2016 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,87 +0,0 @@
-// xml2yml2.ysl2 version 2.4.4
-
-include yslt.yml2
-
-decl textstylesheet is estylesheet(*output="text") {
-    output *output;
-    const "space", !"'" + " " * 200 + "'"!;
-    param "autoindent", 4;
-    content;
-}, tstylesheet is textstylesheet;
-
-define operator "†" as call "convert" with "tag", "name()";
-
-tstylesheet {
-    function "printNS"
-        for "*/namespace::*[local-name()!='xml']" {
-            > xmlns
-            if "not(local-name()='')"
-                > :«local-name()»
-            > ="«.»"
-            if "position()<last()" > , 
-        }
-    
-    template "/" {
-        if "count(*/namespace::*)>1" {
-            | decl «name(*)»(`call "printNS"`);
-            |
-        }
-        apply "*", 0;
-    }
-
-    template "text()" {
-        param "text", "normalize-space()";
-
-        if "string-length($text)>0" choose {
-            when "contains($text,'\\n')" choose {
-                when "string-length(substring-before($text,'\\n'))<string-length($text)-1" choose {
-                    when "substring($text,string-length($text),1)='\\n'"
-                        > \n||\n«$text»||\n\n
-                    otherwise > > «str:replace($text,'\\n','\\\\n')»\n
-                }
-                otherwise > | «$text»\n
-            }
-            otherwise > > `copy "."`\n
-        }
-    }
-
-    template "*" {
-        0>
-        call "convert" with "tag", "name()";
-        apply "@*";
-
-        choose {
-            when "count(*)=0 and string-length(normalize-space())=0"
-                > ;\n
-            when "count(*)=1 and string-length(normalize-space())=0" {
-                > \n
-                apply "*";
-            }
-            when "count(*)=0 and string-length(normalize-space())>0" {
-                >  
-                apply "text()";
-            }
-            otherwise {
-                >  {\n
-                for "*|text()" {
-                    if "local-name()=''"
-                        if "string-length(normalize-space())>0"
-                            1>
-                    apply ".";
-                }
-                | }
-            }
-        }
-    }
-
-    template "@*" {
-        >  «name()»="«.»"
-        if "position()<last()" > ,
-    }
-
-    function "convert" {
-        param "tag";
-
-        > «translate($tag, '-', '_')»
-    }
-}
diff -r 700f4d003349 -r fb35b9db9ca1 yml2/manpage.yml2
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/yml2/manpage.yml2	Tue Mar 17 10:26:38 2020 +0100
@@ -0,0 +1,1 @@
+decl manpage(xmlns="http://docbook.org/ns/docbook", version="5.0", *title) alias article { title *title; content; };
diff -r 700f4d003349 -r fb35b9db9ca1 yml2/standardlib.ysl2
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/yml2/standardlib.ysl2	Tue Mar 17 10:26:38 2020 +0100
@@ -0,0 +1,68 @@
+// YML2 standardlib version 2.5.8
+
+function "yml:hex2dec" {
+    param "hex";
+    param "_result", 0;
+    
+    const "hd", "substring($hex, 1, 1)";
+    const "a", """translate($hd, 'ABCDEFabcdef123456789',
+        '123456123456000000000')""";
+
+    const "d" choose {
+        when "$a>0" value "$a + 9";
+        otherwise value "$hd";
+    }
+
+    choose {
+        when "string-length($hex) = 1"
+            value "$_result * 16 + $d";
+        otherwise call "yml:hex2dec"
+            with "hex", "substring($hex, 2, 8)", 
+            with "_result", "$_result * 16 + $d";
+    }
+}
+
+function "yml:dec2hex" {
+    param "dec";
+    param "bits", !16**7!;
+
+    const "v", "floor($dec div $bits)";
+    value "substring('0123456789abcdef', $v + 1, 1)";
+
+    if "$bits > 1" call "yml:dec2hex"
+        with "dec", "$dec - $bits * $v",
+        with "bits", "$bits div 16";
+}
+
+def "yml:dec2hex" {
+    param "dec";
+    param "digits", 8;
+        
+    result call "yml:dec2hex" with "dec", "$dec", with "bits", "math:power(16, $digits - 1)";
+}
+
+def "yml:hex2dec" {
+    param "hex";
+    result call "yml:hex2dec" with "hex", "$hex";
+}
+
+def "yml:lcase" {
+    param "text", "''";
+    result "translate($text, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz')";
+}
+
+def "yml:ucase" {
+    param "text", "''";
+    result "translate($text, 'abcdefghijklmnopqrstuvwxyz', 'ABCDEFGHIJKLMNOPQRSTUVWXYZ')";
+}
+
+def "yml:mixedCase" {
+    param "text", "''";
+    result "concat(yml:lcase(substring($text,1,1)),substring($text,2))";
+}
+
+def "yml:capit" {
+    param "text", "''";
+    result "concat(yml:ucase(substring($text,1,1)),substring($text,2))";
+}
+
diff -r 700f4d003349 -r fb35b9db9ca1 yml2/xml2yml.ysl2
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/yml2/xml2yml.ysl2	Tue Mar 17 10:26:38 2020 +0100
@@ -0,0 +1,87 @@
+// xml2yml2.ysl2 version 2.4.4
+
+include yslt.yml2
+
+decl textstylesheet is estylesheet(*output="text") {
+    output *output;
+    const "space", !"'" + " " * 200 + "'"!;
+    param "autoindent", 4;
+    content;
+}, tstylesheet is textstylesheet;
+
+define operator "†" as call "convert" with "tag", "name()";
+
+tstylesheet {
+    function "printNS"
+        for "*/namespace::*[local-name()!='xml']" {
+            > xmlns
+            if "not(local-name()='')"
+                > :«local-name()»
+            > ="«.»"
+            if "position()<last()" > , 
+        }
+    
+    template "/" {
+        if "count(*/namespace::*)>1" {
+            | decl «name(*)»(`call "printNS"`);
+            |
+        }
+        apply "*", 0;
+    }
+
+    template "text()" {
+        param "text", "normalize-space()";
+
+        if "string-length($text)>0" choose {
+            when "contains($text,'\\n')" choose {
+                when "string-length(substring-before($text,'\\n'))<string-length($text)-1" choose {
+                    when "substring($text,string-length($text),1)='\\n'"
+                        > \n||\n«$text»||\n\n
+                    otherwise > > «str:replace($text,'\\n','\\\\n')»\n
+                }
+                otherwise > | «$text»\n
+            }
+            otherwise > > `copy "."`\n
+        }
+    }
+
+    template "*" {
+        0>
+        call "convert" with "tag", "name()";
+        apply "@*";
+
+        choose {
+            when "count(*)=0 and string-length(normalize-space())=0"
+                > ;\n
+            when "count(*)=1 and string-length(normalize-space())=0" {
+                > \n
+                apply "*";
+            }
+            when "count(*)=0 and string-length(normalize-space())>0" {
+                >  
+                apply "text()";
+            }
+            otherwise {
+                >  {\n
+                for "*|text()" {
+                    if "local-name()=''"
+                        if "string-length(normalize-space())>0"
+                            1>
+                    apply ".";
+                }
+                | }
+            }
+        }
+    }
+
+    template "@*" {
+        >  «name()»="«.»"
+        if "position()<last()" > ,
+    }
+
+    function "convert" {
+        param "tag";
+
+        > «translate($tag, '-', '_')»
+    }
+}
diff -r 700f4d003349 -r fb35b9db9ca1 yml2/yslt.yml2
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/yml2/yslt.yml2	Tue Mar 17 10:26:38 2020 +0100
@@ -0,0 +1,101 @@
+// YSLT version 2.6.2
+
+!!
+def indent(level):
+    return "value 'substring($space, 1, $_indent+" + str(level) + "*$autoindent)';"
+!!
+
+in exsl decl document(href, method) alias document;
+in func decl def(name) alias function, result(select);
+
+decl debug_off(exclude-result-prefixes="yml");
+
+in xsl {
+    decl _trace_param(%text, name="yml:trace", select='yml:debug("* %text")') alias param;
+    decl _trace_with is _trace_param alias with-param;
+
+    decl param(name, select);
+    decl const(name, select) alias variable, variable is const;
+    decl output(method), key(name, match, use);
+    decl value(select) alias value-of, copy(select) alias copy-of;
+
+    decl indent is value(%level, select='substring($space, 1, $_indent + (%level) * $autoindent)');
+
+    decl stylesheet(
+        *output="xml",
+        version="1.0",
+        xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+    ) {
+        output *output;
+        const "space", !"'" + " " * 200 + "'"!;
+        param "autoindent", 4;
+        content;
+    };
+
+    decl estylesheet is stylesheet (
+        xmlns:exsl='http://exslt.org/common',
+        xmlns:math='http://exslt.org/math',
+        xmlns:func='http://exslt.org/functions',
+        xmlns:str='http://exslt.org/strings',
+        xmlns:dyn='http://exslt.org/dynamic',
+        xmlns:set='http://exslt.org/sets',
+        xmlns:sets='http://exslt.org/sets',
+        xmlns:date='http://exslt.org/dates-and-times',
+        xmlns:yml='http://fdik.org/yml',
+        extension-element-prefixes='exsl func str dyn set sets math date yml'
+    );
+
+    decl textstylesheet is estylesheet(*output="text") {
+        output *output;
+        const "space", !"'" + " " * 200 + "'"!;
+        param "autoindent", 4;
+        xsl:template match="text()";
+        content;
+    }, tstylesheet is textstylesheet;
+
+    decl template(match) {
+        _trace_param *_trace_info;
+        param "_indent", 0;
+        content;
+    };
+
+    decl function(name) alias template {
+        _trace_param *_trace_info;
+        param "_indent", 0;
+        content;
+    };
+   
+    decl call(name) alias call-template {
+        _trace_with *_trace_info;
+        content;
+    };
+
+    decl namespace_alias(stylesheet-prefix, result-prefix);
+    decl text, raw(disable-output-escaping='yes') alias text;
+
+    decl with(name, select) alias with-param;
+    decl withIndent(%level, name="_indent", select='$_indent + (%level) * $autoindent') alias with-param;
+
+    decl apply(select, *indent=1) alias apply-templates {
+        _trace_with *_trace_info;
+        withIndent *indent;
+        content;
+    };
+
+    decl choose, when(test), otherwise;
+    decl if(test);
+    decl for(select) alias for-each, foreach is for;
+    decl element(name, namespace);
+    decl attrib(name, namespace) alias attribute, attrib_set(name) alias attribute-set;
+    decl processing(name) alias processing-instruction;
+    decl comment;
+    decl number(value), sort(select), decimal_format(name, decimal-separator=".", grouping-separator=",");
+    decl import(href), fallback;
+    decl message, error is message(terminate='yes'), warning is message(terminate='no');
+
+    decl debug(%text, select='yml:debug(%text)') alias value-of;
+    decl assert(%test, %msg="''", select='yml:assert(%test,%msg)') alias value-of;
+}
+
+define operator "«(.*?)»" as value "%1";
+
diff -r 700f4d003349 -r fb35b9db9ca1 yml2c
--- a/yml2c	Thu Oct 27 12:51:47 2016 +0200
+++ b/yml2c	Tue Mar 17 10:26:38 2020 +0100
@@ -15,6 +15,8 @@
 from yml2 import ymlCStyle, comment, oldSyntax
 import yml2.backend as backend
 
+YML_DEFAULT_PATH = [os.path.dirname(backend.__file__)]
+
 def printInfo(option, opt_str, value, parser):
     sys.stdout.write(__doc__)
     sys.exit(0)
@@ -58,7 +60,7 @@
     if options.includePathText:
         backend.includePath = options.includePathText.split(':')
 
-    dirs = os.environ.get('YML_PATH', '.').split(':')
+    dirs = os.environ.get('YML_PATH', '.').split(':') + YML_DEFAULT_PATH
     backend.includePath.extend(dirs)
 
     files = fileinput.input(args, mode="rU", openhook=fileinput.hook_encoded(options.encoding))
diff -r 700f4d003349 -r fb35b9db9ca1 yml2proc
--- a/yml2proc	Thu Oct 27 12:51:47 2016 +0200
+++ b/yml2proc	Tue Mar 17 10:26:38 2020 +0100
@@ -21,6 +21,8 @@
 from yml2.pyPEG import parse, u
 import yml2.backend as backend
 
+YML_DEFAULT_PATH = [os.path.dirname(backend.__file__)]
+
 def printInfo(option, opt_str, value, parser):
     sys.stdout.write(__doc__)
     sys.exit(0)
@@ -89,7 +91,7 @@
 
 backend.encoding = options.encoding
 
-dirs = os.environ.get('YML_PATH', '.').split(':')
+dirs = os.environ.get('YML_PATH', '.').split(':') + YML_DEFAULT_PATH
 backend.includePath.extend(dirs)
 
 if options.xml2yml:
diff -r 700f4d003349 -r fb35b9db9ca1 yslt.yml2
--- a/yslt.yml2	Thu Oct 27 12:51:47 2016 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,101 +0,0 @@
-// YSLT version 2.6.2
-
-!!
-def indent(level):
-    return "value 'substring($space, 1, $_indent+" + str(level) + "*$autoindent)';"
-!!
-
-in exsl decl document(href, method) alias document;
-in func decl def(name) alias function, result(select);
-
-decl debug_off(exclude-result-prefixes="yml");
-
-in xsl {
-    decl _trace_param(%text, name="yml:trace", select='yml:debug("* %text")') alias param;
-    decl _trace_with is _trace_param alias with-param;
-
-    decl param(name, select);
-    decl const(name, select) alias variable, variable is const;
-    decl output(method), key(name, match, use);
-    decl value(select) alias value-of, copy(select) alias copy-of;
-
-    decl indent is value(%level, select='substring($space, 1, $_indent + (%level) * $autoindent)');
-
-    decl stylesheet(
-        *output="xml",
-        version="1.0",
-        xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
-    ) {
-        output *output;
-        const "space", !"'" + " " * 200 + "'"!;
-        param "autoindent", 4;
-        content;
-    };
-
-    decl estylesheet is stylesheet (
-        xmlns:exsl='http://exslt.org/common',
-        xmlns:math='http://exslt.org/math',
-        xmlns:func='http://exslt.org/functions',
-        xmlns:str='http://exslt.org/strings',
-        xmlns:dyn='http://exslt.org/dynamic',
-        xmlns:set='http://exslt.org/sets',
-        xmlns:sets='http://exslt.org/sets',
-        xmlns:date='http://exslt.org/dates-and-times',
-        xmlns:yml='http://fdik.org/yml',
-        extension-element-prefixes='exsl func str dyn set sets math date yml'
-    );
-
-    decl textstylesheet is estylesheet(*output="text") {
-        output *output;
-        const "space", !"'" + " " * 200 + "'"!;
-        param "autoindent", 4;
-        xsl:template match="text()";
-        content;
-    }, tstylesheet is textstylesheet;
-
-    decl template(match) {
-        _trace_param *_trace_info;
-        param "_indent", 0;
-        content;
-    };
-
-    decl function(name) alias template {
-        _trace_param *_trace_info;
-        param "_indent", 0;
-        content;
-    };
-   
-    decl call(name) alias call-template {
-        _trace_with *_trace_info;
-        content;
-    };
-
-    decl namespace_alias(stylesheet-prefix, result-prefix);
-    decl text, raw(disable-output-escaping='yes') alias text;
-
-    decl with(name, select) alias with-param;
-    decl withIndent(%level, name="_indent", select='$_indent + (%level) * $autoindent') alias with-param;
-
-    decl apply(select, *indent=1) alias apply-templates {
-        _trace_with *_trace_info;
-        withIndent *indent;
-        content;
-    };
-
-    decl choose, when(test), otherwise;
-    decl if(test);
-    decl for(select) alias for-each, foreach is for;
-    decl element(name, namespace);
-    decl attrib(name, namespace) alias attribute, attrib_set(name) alias attribute-set;
-    decl processing(name) alias processing-instruction;
-    decl comment;
-    decl number(value), sort(select), decimal_format(name, decimal-separator=".", grouping-separator=",");
-    decl import(href), fallback;
-    decl message, error is message(terminate='yes'), warning is message(terminate='no');
-
-    decl debug(%text, select='yml:debug(%text)') alias value-of;
-    decl assert(%test, %msg="''", select='yml:assert(%test,%msg)') alias value-of;
-}
-
-define operator "«(.*?)»" as value "%1";
-