This is mostly mako related stuff. --- src/mapi/glapi/gen/helpers.py | 33 +++++++++++++++++++++ src/mapi/glapi/gen/templates/copyright.mako | 25 ++++++++++++++++ src/mapi/glapi/gen/templates/helpers.mako | 29 ++++++++++++++++++ 3 files changed, 87 insertions(+) create mode 100644 src/mapi/glapi/gen/helpers.py create mode 100644 src/mapi/glapi/gen/templates/copyright.mako create mode 100644 src/mapi/glapi/gen/templates/helpers.mako
diff --git a/src/mapi/glapi/gen/helpers.py b/src/mapi/glapi/gen/helpers.py new file mode 100644 index 00000000000..deb2c783855 --- /dev/null +++ b/src/mapi/glapi/gen/helpers.py @@ -0,0 +1,33 @@ +# encoding=utf-8 +# Copyright © 2018 Intel Corporation + +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: + +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. + +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + +"""Shared python helpers for generators.""" + + +def backslash_preprocessor(template): + """Replace literal backslashes with mako escaped sequences. + + This is one of those stupid mako things, plain backslashes are interpreted + as being part of the template, to be part of the output they need to be + escaped. + """ + template = template.replace('\\\\', "${'\\\\'}") + return template diff --git a/src/mapi/glapi/gen/templates/copyright.mako b/src/mapi/glapi/gen/templates/copyright.mako new file mode 100644 index 00000000000..71f9c94f410 --- /dev/null +++ b/src/mapi/glapi/gen/templates/copyright.mako @@ -0,0 +1,25 @@ +/* + * Do NOT edit. Autogenerated by ${script} + * +% for copyright in copyrights: + * ${copyright} +% endfor + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ diff --git a/src/mapi/glapi/gen/templates/helpers.mako b/src/mapi/glapi/gen/templates/helpers.mako new file mode 100644 index 00000000000..1862cac66f4 --- /dev/null +++ b/src/mapi/glapi/gen/templates/helpers.mako @@ -0,0 +1,29 @@ +## encoding=utf-8 +## Copyright © 2018 Intel Corporation +## +## Permission is hereby granted, free of charge, to any person obtaining a copy +## of this software and associated documentation files (the "Software"), to deal +## in the Software without restriction, including without limitation the rights +## to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +## copies of the Software, and to permit persons to whom the Software is +## furnished to do so, subject to the following conditions: +## +## The above copyright notice and this permission notice shall be included in +## all copies or substantial portions of the Software. +## +## THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +## IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +## FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +## AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +## LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +## OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +## SOFTWARE. + +<%def name="start_guard(name)"> +#ifndef _${name}_H_ +#define _${name}_H_ +</%def> + +<%def name="end_guard(name)"> +#endif /* _${name}_H_ */ +</%def> -- 2.19.2 _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev