Commit 9d6a68b6 authored by Simon Boyé's avatar Simon Boyé

Vitelotte: Added missing license header to Vitelotte + a utility to check license headers.

parent e3867e5f
/*
This Source Code Form is subject to the terms of the Mozilla Public
License, v. 2.0. If a copy of the MPL was not distributed with this
file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
#ifndef _VITELOTTE_ELEMENT_BUILDER_BASE_
#define _VITELOTTE_ELEMENT_BUILDER_BASE_
......
/*
This Source Code Form is subject to the terms of the Mozilla Public
License, v. 2.0. If a copy of the MPL was not distributed with this
file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
#ifndef _VITELOTTE_FEM_SOLVER_
#define _VITELOTTE_FEM_SOLVER_
......
/*
This Source Code Form is subject to the terms of the Mozilla Public
License, v. 2.0. If a copy of the MPL was not distributed with this
file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
#include "femSolver.h"
......
/*
This Source Code Form is subject to the terms of the Mozilla Public
License, v. 2.0. If a copy of the MPL was not distributed with this
file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
#ifndef _VITELOTTE_FEM_UTILS_
#define _VITELOTTE_FEM_UTILS_
......
/*
This Source Code Form is subject to the terms of the Mozilla Public
License, v. 2.0. If a copy of the MPL was not distributed with this
file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
#include "femUtils.h"
......
/*
This Source Code Form is subject to the terms of the Mozilla Public
License, v. 2.0. If a copy of the MPL was not distributed with this
file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
#ifndef _VITELOTTE_FV_ELEMENT_BUILDER_
#define _VITELOTTE_FV_ELEMENT_BUILDER_
......
/*
This Source Code Form is subject to the terms of the Mozilla Public
License, v. 2.0. If a copy of the MPL was not distributed with this
file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
#include "fvElementBuilder.h"
......
/*
This Source Code Form is subject to the terms of the Mozilla Public
License, v. 2.0. If a copy of the MPL was not distributed with this
file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
#ifndef _VITELOTTE_LINEAR_ELEMENT_BUILDER_
#define _VITELOTTE_LINEAR_ELEMENT_BUILDER_
......
/*
This Source Code Form is subject to the terms of the Mozilla Public
License, v. 2.0. If a copy of the MPL was not distributed with this
file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
#include "linearElementBuilder.h"
......
/*
This Source Code Form is subject to the terms of the Mozilla Public
License, v. 2.0. If a copy of the MPL was not distributed with this
file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
#ifndef _VITELOTTE_MORLEY_ELEMENT_BUILDER_
#define _VITELOTTE_MORLEY_ELEMENT_BUILDER_
......
/*
This Source Code Form is subject to the terms of the Mozilla Public
License, v. 2.0. If a copy of the MPL was not distributed with this
file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
#include <Eigen/Dense>
#include "morleyElementBuilder.h"
......
/*
This Source Code Form is subject to the terms of the Mozilla Public
License, v. 2.0. If a copy of the MPL was not distributed with this
file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
#ifndef _VITELOTTE_QUADRATIC_ELEMENT_BUILDER_
#define _VITELOTTE_QUADRATIC_ELEMENT_BUILDER_
......
/*
This Source Code Form is subject to the terms of the Mozilla Public
License, v. 2.0. If a copy of the MPL was not distributed with this
file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
#include "quadraticElementBuilder.h"
......
/*
This Source Code Form is subject to the terms of the Mozilla Public
License, v. 2.0. If a copy of the MPL was not distributed with this
file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
#ifndef _VITELOTTE_SINGULAR_ELEMENT_DECORATOR_
#define _VITELOTTE_SINGULAR_ELEMENT_DECORATOR_
......
/*
This Source Code Form is subject to the terms of the Mozilla Public
License, v. 2.0. If a copy of the MPL was not distributed with this
file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
#include "singularElementDecorator.h"
......
/*
This Source Code Form is subject to the terms of the Mozilla Public
License, v. 2.0. If a copy of the MPL was not distributed with this
file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
#ifndef _VITELOTTE_VG_MESH_
#define _VITELOTTE_VG_MESH_
......
/*
This Source Code Form is subject to the terms of the Mozilla Public
License, v. 2.0. If a copy of the MPL was not distributed with this
file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
#include "vgMesh.h"
......
/*
This Source Code Form is subject to the terms of the Mozilla Public
License, v. 2.0. If a copy of the MPL was not distributed with this
file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
#version 410 core
uniform float zoom;
......
/*
This Source Code Form is subject to the terms of the Mozilla Public
License, v. 2.0. If a copy of the MPL was not distributed with this
file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
#version 410 core
uniform float zoom;
......
/*
This Source Code Form is subject to the terms of the Mozilla Public
License, v. 2.0. If a copy of the MPL was not distributed with this
file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
#version 410 core
uniform samplerBuffer nodes;
......
/*
This Source Code Form is subject to the terms of the Mozilla Public
License, v. 2.0. If a copy of the MPL was not distributed with this
file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
uniform sampler2D nodes;
uniform int baseNodeIndex;
uniform bool singularTriangles;
......
/*
This Source Code Form is subject to the terms of the Mozilla Public
License, v. 2.0. If a copy of the MPL was not distributed with this
file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
#version 410 core
uniform samplerBuffer nodes;
......
/*
This Source Code Form is subject to the terms of the Mozilla Public
License, v. 2.0. If a copy of the MPL was not distributed with this
file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
uniform highp float lineWidth;
uniform lowp vec4 wireframeColor;
uniform highp float zoom;
......
/*
This Source Code Form is subject to the terms of the Mozilla Public
License, v. 2.0. If a copy of the MPL was not distributed with this
file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
#version 410 core
uniform samplerBuffer nodes;
......
/*
This Source Code Form is subject to the terms of the Mozilla Public
License, v. 2.0. If a copy of the MPL was not distributed with this
file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
#version 410 core
layout(triangles) in;
......
/*
This Source Code Form is subject to the terms of the Mozilla Public
License, v. 2.0. If a copy of the MPL was not distributed with this
file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
uniform mat4 viewMatrix;
attribute highp vec4 vx_position;
......
/*
This Source Code Form is subject to the terms of the Mozilla Public
License, v. 2.0. If a copy of the MPL was not distributed with this
file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
#version 410 core
uniform mat4 viewMatrix;
......
/*
This Source Code Form is subject to the terms of the Mozilla Public
License, v. 2.0. If a copy of the MPL was not distributed with this
file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
#ifndef _VITELOTTE_MVG_READER_
#define _VITELOTTE_MVG_READER_
......
/*
This Source Code Form is subject to the terms of the Mozilla Public
License, v. 2.0. If a copy of the MPL was not distributed with this
file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
#include "mvgReader.h"
......
/*
This Source Code Form is subject to the terms of the Mozilla Public
License, v. 2.0. If a copy of the MPL was not distributed with this
file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
#ifndef _VITELOTTE_MVG_WRITER_
#define _VITELOTTE_MVG_WRITER_
......
/*
This Source Code Form is subject to the terms of the Mozilla Public
License, v. 2.0. If a copy of the MPL was not distributed with this
file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
#include "mvgWriter.h"
......
/*
This Source Code Form is subject to the terms of the Mozilla Public
License, v. 2.0. If a copy of the MPL was not distributed with this
file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
// Generated by shader2cpp.
// 2015-01-09T14:26:21.853483
// 2015-01-14T14:57:30.576014
#ifndef PATATE_VITELOTTE_UTILS_SHADER_H
......@@ -12,6 +17,12 @@ namespace shader
{
static const char* frag_common_gl2_glsl =
"/*\n"
" This Source Code Form is subject to the terms of the Mozilla Public\n"
" License, v. 2.0. If a copy of the MPL was not distributed with this\n"
" file, You can obtain one at http://mozilla.org/MPL/2.0/.\n"
"*/\n"
"\n"
"#version 410 core\n"
"\n"
"uniform float zoom;\n"
......@@ -101,6 +112,12 @@ static const char* frag_common_gl2_glsl =
"";
static const char* frag_common_glsl =
"/*\n"
" This Source Code Form is subject to the terms of the Mozilla Public\n"
" License, v. 2.0. If a copy of the MPL was not distributed with this\n"
" file, You can obtain one at http://mozilla.org/MPL/2.0/.\n"
"*/\n"
"\n"
"#version 410 core\n"
"\n"
"uniform float zoom;\n"
......@@ -190,6 +207,12 @@ static const char* frag_common_glsl =
"";
static const char* frag_linear_glsl =
"/*\n"
" This Source Code Form is subject to the terms of the Mozilla Public\n"
" License, v. 2.0. If a copy of the MPL was not distributed with this\n"
" file, You can obtain one at http://mozilla.org/MPL/2.0/.\n"
"*/\n"
"\n"
"#version 410 core\n"
"\n"
"uniform samplerBuffer nodes;\n"
......@@ -237,6 +260,12 @@ static const char* frag_linear_glsl =
"";
static const char* frag_quadratic_gl2_glsl =
"/*\n"
" This Source Code Form is subject to the terms of the Mozilla Public\n"
" License, v. 2.0. If a copy of the MPL was not distributed with this\n"
" file, You can obtain one at http://mozilla.org/MPL/2.0/.\n"
"*/\n"
"\n"
"uniform sampler2D nodes;\n"
"uniform int baseNodeIndex;\n"
"uniform bool singularTriangles;\n"
......@@ -292,6 +321,12 @@ static const char* frag_quadratic_gl2_glsl =
"";
static const char* frag_quadratic_glsl =
"/*\n"
" This Source Code Form is subject to the terms of the Mozilla Public\n"
" License, v. 2.0. If a copy of the MPL was not distributed with this\n"
" file, You can obtain one at http://mozilla.org/MPL/2.0/.\n"
"*/\n"
"\n"
"#version 410 core\n"
"\n"
"uniform samplerBuffer nodes;\n"
......@@ -335,6 +370,12 @@ static const char* frag_quadratic_glsl =
"";
static const char* frag_wireframe_gl2_glsl =
"/*\n"
" This Source Code Form is subject to the terms of the Mozilla Public\n"
" License, v. 2.0. If a copy of the MPL was not distributed with this\n"
" file, You can obtain one at http://mozilla.org/MPL/2.0/.\n"
"*/\n"
"\n"
"uniform highp float lineWidth;\n"
"uniform lowp vec4 wireframeColor;\n"
"uniform highp float zoom;\n"
......@@ -375,6 +416,12 @@ static const char* frag_wireframe_gl2_glsl =
"";
static const char* frag_wireframe_glsl =
"/*\n"
" This Source Code Form is subject to the terms of the Mozilla Public\n"
" License, v. 2.0. If a copy of the MPL was not distributed with this\n"
" file, You can obtain one at http://mozilla.org/MPL/2.0/.\n"
"*/\n"
"\n"
"#version 410 core\n"
"\n"
"uniform samplerBuffer nodes;\n"
......@@ -405,6 +452,12 @@ static const char* frag_wireframe_glsl =
"";
static const char* geom_common_glsl =
"/*\n"
" This Source Code Form is subject to the terms of the Mozilla Public\n"
" License, v. 2.0. If a copy of the MPL was not distributed with this\n"
" file, You can obtain one at http://mozilla.org/MPL/2.0/.\n"
"*/\n"
"\n"
"#version 410 core\n"
"\n"
"layout(triangles) in;\n"
......@@ -443,6 +496,12 @@ static const char* geom_common_glsl =
"";
static const char* vert_common_gl2_glsl =
"/*\n"
" This Source Code Form is subject to the terms of the Mozilla Public\n"
" License, v. 2.0. If a copy of the MPL was not distributed with this\n"
" file, You can obtain one at http://mozilla.org/MPL/2.0/.\n"
"*/\n"
"\n"
"uniform mat4 viewMatrix;\n"
"\n"
"attribute highp vec4 vx_position;\n"
......@@ -464,6 +523,12 @@ static const char* vert_common_gl2_glsl =
"";
static const char* vert_common_glsl =
"/*\n"
" This Source Code Form is subject to the terms of the Mozilla Public\n"
" License, v. 2.0. If a copy of the MPL was not distributed with this\n"
" file, You can obtain one at http://mozilla.org/MPL/2.0/.\n"
"*/\n"
"\n"
"#version 410 core\n"
"\n"
"uniform mat4 viewMatrix;\n"
......
/*
This Source Code Form is subject to the terms of the Mozilla Public
License, v. 2.0. If a copy of the MPL was not distributed with this
file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
#ifndef _VITELOTTE_VG_MESH_GL2_RENDERER_
#define _VITELOTTE_VG_MESH_GL2_RENDERER_
......
/*
This Source Code Form is subject to the terms of the Mozilla Public
License, v. 2.0. If a copy of the MPL was not distributed with this
file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
#include "vgMeshGL2Renderer.h"
......
/*
This Source Code Form is subject to the terms of the Mozilla Public
License, v. 2.0. If a copy of the MPL was not distributed with this
file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
#ifndef _VITELOTTE_VG_MESH_RENDERER_
#define _VITELOTTE_VG_MESH_RENDERER_
......
/*
This Source Code Form is subject to the terms of the Mozilla Public
License, v. 2.0. If a copy of the MPL was not distributed with this
file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
#include "vgMeshRenderer.h"
......
/*
This Source Code Form is subject to the terms of the Mozilla Public
License, v. 2.0. If a copy of the MPL was not distributed with this
file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
/**
* \brief This module provides tools to generate and manipulate mesh-based
* vector gradients.
......
/*
This Source Code Form is subject to the terms of the Mozilla Public
License, v. 2.0. If a copy of the MPL was not distributed with this
file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
#ifndef _PATATE_COMMON_GL_UTILS_COLOR_
#define _PATATE_COMMON_GL_UTILS_COLOR_
......
/*
This Source Code Form is subject to the terms of the Mozilla Public
License, v. 2.0. If a copy of the MPL was not distributed with this
file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
#ifndef _PATATE_COMMON_GL_UTILS_MACROS_
#define _PATATE_COMMON_GL_UTILS_MACROS_
......
/*
This Source Code Form is subject to the terms of the Mozilla Public
License, v. 2.0. If a copy of the MPL was not distributed with this
file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
#ifndef _PATATE_COMMON_GL_UTILS_SHADER_
#define _PATATE_COMMON_GL_UTILS_SHADER_
......
/*
This Source Code Form is subject to the terms of the Mozilla Public
License, v. 2.0. If a copy of the MPL was not distributed with this
file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
#include "shader.h"
......
#!/usr/bin/python3
from sys import argv
from re import compile
from io import StringIO
license_begin_re = compile(r'\s*/\*[* \t]*')
license_end_re = compile(r'[* \t]*\*/\s*')
license_line_re = compile(r'[* \t]*(.*)')
copyright_re = compile(r'Copyright \(C\)\s+(\d+)\s+(.*)')
copyright_mail_re = compile(r'^(.*)<(.*)>$')
def extract_license_info(filename):
f = open(filename)
it = iter(f)
try:
begin_line = 1
while not license_begin_re.match(next(it)):
begin_line += 1
except StopIteration:
return None, None, None
license_text = StringIO()
end_line = begin_line
for line in it:
end_line += 1
if license_end_re.match(line):
break
license_text.write(license_line_re.match(line).group(1).rstrip())
license_text.write('\n')
return license_text.getvalue()[:-1], begin_line, end_line
def split_copyright_license(bloc):
lines = bloc.splitlines()
m = copyright_re.match(lines[0])
if not m:
return bloc, None, None
year = int(m.group(1))
name_mail = m.group(2).rstrip()
first_line = 2
for line in lines[first_line:]:
if line != '':
break
first_line += 1
return '\n'.join(lines[first_line:]), year, name_mail
def print_indented(text, indent=' '):
for line in text.splitlines():
print(indent, line, sep='')
mpl2 = '''This Source Code Form is subject to the terms of the Mozilla Public
License, v. 2.0. If a copy of the MPL was not distributed with this
file, You can obtain one at http://mozilla.org/MPL/2.0/.'''
filename = argv[1]
license_bloc, first_line, last_line = extract_license_info(filename)
if license_bloc:
license_text, c_year, c_names = split_copyright_license(license_bloc)
else:
license_text, c_year, c_names = None, None, None
on_first_line = first_line == 1
license_ok = license_text == mpl2
if on_first_line and license_ok:
print('\033[32m{}\033[0m: Copyright: {} {}'.format(argv[1], c_year, c_names))
# print_indented(license_text)
else:
print('\033[31m{}\033[0m: Copyright: {} {}'.format(argv[1], c_year, c_names))
if license_bloc:
if not on_first_line:
print(' License bloc does not start on first line.')
# do not print license if not first line because chances are it
# is some random comment (likely doc).
elif not license_ok:
print(' License seems wrong:')
print_indented(license_text, ' ')
else:
print(' License not found.')
#!/bin/sh
./bin/shader2cpp \
-l \
-n Vitelotte::shader \
-g PATATE_VITELOTTE_UTILS_SHADER_H \
-o Patate/Vitelotte/Utils/shaders.hpp \
......
......@@ -6,6 +6,12 @@ from argparse import ArgumentParser
from re import sub, ASCII
from datetime import datetime
license_text = '''/*
This Source Code Form is subject to the terms of the Mozilla Public
License, v. 2.0. If a copy of the MPL was not distributed with this
file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/'''
argparser = ArgumentParser(description='Convert a set of shaders into cpp source code')
argparser.add_argument('-e', '--extern', default=False, action='store_true',
......@@ -14,6 +20,8 @@ argparser.add_argument('-g', '--include-guard', default='',
help="Protect the file against multiple inclusion.")
argparser.add_argument('-o', '--output', default='-',
help="Write the output to the file output, or stdout if omitted or output is '-'.")
argparser.add_argument('-l', '--license', default=False, action='store_true',
help="Add license header.")
argparser.add_argument('-n', '--namespace', default='',
help="Put the output code inside NAMESPACE.")
argparser.add_argument('shaders', nargs='+')
......@@ -23,6 +31,10 @@ options = argparser.parse_args()
namespaces = options.namespace.split('::')
out = open(options.output, 'w') if options.output != '-' else stdout
if options.license:
print(license_text, file=out)
print("// Generated by shader2cpp.", file=out)
print("// {}".format(datetime.utcnow().isoformat()), file=out)
print(file=out)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment