pyfcstm 0.0.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- pyfcstm/__init__.py +0 -0
- pyfcstm/__main__.py +4 -0
- pyfcstm/config/__init__.py +0 -0
- pyfcstm/config/meta.py +20 -0
- pyfcstm/dsl/__init__.py +6 -0
- pyfcstm/dsl/error.py +226 -0
- pyfcstm/dsl/grammar/Grammar.g4 +190 -0
- pyfcstm/dsl/grammar/Grammar.interp +168 -0
- pyfcstm/dsl/grammar/Grammar.tokens +118 -0
- pyfcstm/dsl/grammar/GrammarLexer.interp +214 -0
- pyfcstm/dsl/grammar/GrammarLexer.py +523 -0
- pyfcstm/dsl/grammar/GrammarLexer.tokens +118 -0
- pyfcstm/dsl/grammar/GrammarListener.py +521 -0
- pyfcstm/dsl/grammar/GrammarParser.py +4373 -0
- pyfcstm/dsl/grammar/__init__.py +3 -0
- pyfcstm/dsl/listener.py +440 -0
- pyfcstm/dsl/node.py +1581 -0
- pyfcstm/dsl/parse.py +155 -0
- pyfcstm/entry/__init__.py +1 -0
- pyfcstm/entry/base.py +126 -0
- pyfcstm/entry/cli.py +12 -0
- pyfcstm/entry/dispatch.py +46 -0
- pyfcstm/entry/generate.py +83 -0
- pyfcstm/entry/plantuml.py +67 -0
- pyfcstm/model/__init__.py +3 -0
- pyfcstm/model/base.py +51 -0
- pyfcstm/model/expr.py +764 -0
- pyfcstm/model/model.py +1392 -0
- pyfcstm/render/__init__.py +3 -0
- pyfcstm/render/env.py +36 -0
- pyfcstm/render/expr.py +180 -0
- pyfcstm/render/func.py +77 -0
- pyfcstm/render/render.py +279 -0
- pyfcstm/utils/__init__.py +6 -0
- pyfcstm/utils/binary.py +38 -0
- pyfcstm/utils/doc.py +64 -0
- pyfcstm/utils/jinja2.py +121 -0
- pyfcstm/utils/json.py +125 -0
- pyfcstm/utils/text.py +91 -0
- pyfcstm/utils/validate.py +102 -0
- pyfcstm-0.0.1.dist-info/LICENSE +165 -0
- pyfcstm-0.0.1.dist-info/METADATA +205 -0
- pyfcstm-0.0.1.dist-info/RECORD +46 -0
- pyfcstm-0.0.1.dist-info/WHEEL +5 -0
- pyfcstm-0.0.1.dist-info/entry_points.txt +2 -0
- pyfcstm-0.0.1.dist-info/top_level.txt +1 -0
pyfcstm/utils/jinja2.py
ADDED
@@ -0,0 +1,121 @@
|
|
1
|
+
"""
|
2
|
+
This module provides utilities for enhancing Jinja2 environments with Python builtins and additional settings.
|
3
|
+
|
4
|
+
It includes functions to add Python built-in functions to Jinja2 environments as filters, tests, and globals,
|
5
|
+
as well as adding environment variables and custom text processing functions.
|
6
|
+
"""
|
7
|
+
|
8
|
+
import builtins
|
9
|
+
import inspect
|
10
|
+
import os
|
11
|
+
import textwrap
|
12
|
+
|
13
|
+
import jinja2
|
14
|
+
|
15
|
+
from .text import normalize, to_identifier
|
16
|
+
|
17
|
+
|
18
|
+
def add_builtins_to_env(env: jinja2.Environment) -> jinja2.Environment:
|
19
|
+
"""
|
20
|
+
Mount Python built-in functions to a Jinja2 environment.
|
21
|
+
|
22
|
+
This function adds Python's built-in functions to the specified Jinja2 environment
|
23
|
+
as filters, tests, or global functions based on their characteristics.
|
24
|
+
|
25
|
+
:param env: A Jinja2 Environment instance
|
26
|
+
:type env: jinja2.Environment
|
27
|
+
|
28
|
+
:return: The Jinja2 Environment with Python builtins mounted
|
29
|
+
:rtype: jinja2.Environment
|
30
|
+
|
31
|
+
Example::
|
32
|
+
|
33
|
+
>>> env = jinja2.Environment()
|
34
|
+
>>> env = add_builtins_to_env(env)
|
35
|
+
>>> # Now Python builtins like len, str, etc. are available in templates
|
36
|
+
"""
|
37
|
+
# Existing built-in filters, tests and global functions in Jinja2
|
38
|
+
existing_filters = set(env.filters.keys())
|
39
|
+
existing_tests = set(env.tests.keys())
|
40
|
+
existing_globals = set(env.globals.keys())
|
41
|
+
|
42
|
+
# Get all Python built-in functions
|
43
|
+
builtin_items = [(name, obj) for name, obj in inspect.getmembers(builtins)
|
44
|
+
if not name.startswith('_')] # Exclude internal functions starting with underscore
|
45
|
+
|
46
|
+
# Categorize functions for appropriate mounting positions
|
47
|
+
for name, func in builtin_items:
|
48
|
+
# Skip non-function objects
|
49
|
+
if not callable(func):
|
50
|
+
continue
|
51
|
+
|
52
|
+
# Determine if the function is suitable as a filter
|
53
|
+
is_filter_candidate = (
|
54
|
+
# Filters typically accept one main argument and may have other optional parameters
|
55
|
+
inspect.isfunction(func) or inspect.isbuiltin(func)
|
56
|
+
)
|
57
|
+
|
58
|
+
# Determine if the function is suitable as a tester
|
59
|
+
is_test_candidate = (
|
60
|
+
# Test functions typically return boolean values, like isinstance, issubclass, etc.
|
61
|
+
name.startswith('is') or
|
62
|
+
name in ('all', 'any', 'callable', 'hasattr')
|
63
|
+
)
|
64
|
+
|
65
|
+
# Mount as a filter (if suitable and no conflict)
|
66
|
+
filter_name = name
|
67
|
+
if is_filter_candidate and filter_name not in existing_filters:
|
68
|
+
env.filters[filter_name] = func
|
69
|
+
env.filters['str'] = str
|
70
|
+
env.filters['set'] = set
|
71
|
+
env.filters['dict'] = dict
|
72
|
+
env.filters['keys'] = lambda x: x.keys()
|
73
|
+
env.filters['values'] = lambda x: x.values()
|
74
|
+
env.filters['enumerate'] = enumerate
|
75
|
+
env.filters['reversed'] = reversed
|
76
|
+
env.filters['filter'] = lambda x, y: filter(y, x)
|
77
|
+
|
78
|
+
# Mount as a tester (if suitable and no conflict)
|
79
|
+
test_name = name
|
80
|
+
if name.startswith('is'):
|
81
|
+
# For functions starting with 'is', the prefix can be removed as the tester name
|
82
|
+
test_name = name[2:].lower()
|
83
|
+
if is_test_candidate and test_name not in existing_tests:
|
84
|
+
env.tests[test_name] = func
|
85
|
+
|
86
|
+
# Mount as a global function (if no conflict)
|
87
|
+
if name not in existing_globals:
|
88
|
+
env.globals[name] = func
|
89
|
+
|
90
|
+
return env
|
91
|
+
|
92
|
+
|
93
|
+
def add_settings_for_env(env: jinja2.Environment) -> jinja2.Environment:
|
94
|
+
"""
|
95
|
+
Add additional settings and functions to a Jinja2 environment.
|
96
|
+
|
97
|
+
This function enhances a Jinja2 environment by:
|
98
|
+
1. Adding Python built-in functions
|
99
|
+
2. Adding custom text processing filters
|
100
|
+
3. Adding environment variables as global variables
|
101
|
+
|
102
|
+
:param env: The Jinja2 environment to enhance
|
103
|
+
:type env: jinja2.Environment
|
104
|
+
|
105
|
+
:return: The enhanced Jinja2 environment
|
106
|
+
:rtype: jinja2.Environment
|
107
|
+
|
108
|
+
Example::
|
109
|
+
|
110
|
+
>>> env = jinja2.Environment()
|
111
|
+
>>> env = add_settings_for_env(env)
|
112
|
+
>>> # Now the environment has additional filters and globals
|
113
|
+
"""
|
114
|
+
env = add_builtins_to_env(env)
|
115
|
+
env.filters['normalize'] = normalize
|
116
|
+
env.filters['to_identifier'] = to_identifier
|
117
|
+
env.globals['indent'] = textwrap.indent
|
118
|
+
for key, value in os.environ.items():
|
119
|
+
if key not in env.globals:
|
120
|
+
env.globals[key] = value
|
121
|
+
return env
|
pyfcstm/utils/json.py
ADDED
@@ -0,0 +1,125 @@
|
|
1
|
+
"""
|
2
|
+
This module provides a base interface for JSON serialization and deserialization operations.
|
3
|
+
It defines an abstract base class IJsonOp that implements common JSON/YAML file I/O operations
|
4
|
+
and requires concrete classes to implement the actual serialization logic.
|
5
|
+
|
6
|
+
The module supports both JSON and YAML formats for data persistence, with methods for reading
|
7
|
+
from and writing to files in either format.
|
8
|
+
"""
|
9
|
+
|
10
|
+
import json
|
11
|
+
from pprint import pformat
|
12
|
+
|
13
|
+
import yaml
|
14
|
+
|
15
|
+
|
16
|
+
class IJsonOp:
|
17
|
+
"""
|
18
|
+
An interface class that provides JSON serialization/deserialization capabilities.
|
19
|
+
|
20
|
+
This class defines a common interface for objects that need to be serialized to
|
21
|
+
and deserialized from JSON/YAML formats. Concrete classes must implement the
|
22
|
+
_to_json() and _from_json() methods.
|
23
|
+
|
24
|
+
Example:
|
25
|
+
>>> class MyData(IJsonOp):
|
26
|
+
... def _to_json(self):
|
27
|
+
... return {"data": self.data}
|
28
|
+
...
|
29
|
+
... @classmethod
|
30
|
+
... def _from_json(cls, data):
|
31
|
+
... return cls(data["data"])
|
32
|
+
"""
|
33
|
+
|
34
|
+
def _to_json(self):
|
35
|
+
"""
|
36
|
+
Convert the object to a JSON-serializable format.
|
37
|
+
|
38
|
+
:raises NotImplementedError: This method must be implemented by concrete classes.
|
39
|
+
"""
|
40
|
+
raise NotImplementedError
|
41
|
+
|
42
|
+
@classmethod
|
43
|
+
def _from_json(cls, data):
|
44
|
+
"""
|
45
|
+
Create an instance of the class from JSON-formatted data.
|
46
|
+
|
47
|
+
:param data: The JSON data to deserialize
|
48
|
+
:raises NotImplementedError: This method must be implemented by concrete classes.
|
49
|
+
"""
|
50
|
+
raise NotImplementedError
|
51
|
+
|
52
|
+
@property
|
53
|
+
def json(self):
|
54
|
+
"""
|
55
|
+
Get the JSON representation of the object.
|
56
|
+
|
57
|
+
:return: JSON-serializable representation of the object
|
58
|
+
:rtype: dict
|
59
|
+
"""
|
60
|
+
return self._to_json()
|
61
|
+
|
62
|
+
def to_json(self, json_file):
|
63
|
+
"""
|
64
|
+
Save the object to a JSON file.
|
65
|
+
|
66
|
+
:param json_file: Path to the output JSON file
|
67
|
+
:type json_file: str
|
68
|
+
"""
|
69
|
+
data = self._to_json()
|
70
|
+
with open(json_file, 'w') as f:
|
71
|
+
json.dump(data, f, indent=4, ensure_ascii=False)
|
72
|
+
|
73
|
+
def to_yaml(self, yaml_file):
|
74
|
+
"""
|
75
|
+
Save the object to a YAML file.
|
76
|
+
|
77
|
+
:param yaml_file: Path to the output YAML file
|
78
|
+
:type yaml_file: str
|
79
|
+
"""
|
80
|
+
data = self._to_json()
|
81
|
+
with open(yaml_file, 'w') as f:
|
82
|
+
yaml.safe_dump(data, f)
|
83
|
+
|
84
|
+
@classmethod
|
85
|
+
def from_json(cls, data):
|
86
|
+
"""
|
87
|
+
Create an instance from JSON data.
|
88
|
+
|
89
|
+
:param data: JSON-formatted data
|
90
|
+
:type data: dict
|
91
|
+
:return: An instance of the class
|
92
|
+
:rtype: IJsonOp
|
93
|
+
:raises TypeError: If the created object is not an instance of the class
|
94
|
+
"""
|
95
|
+
obj = cls._from_json(data)
|
96
|
+
if not isinstance(obj, cls):
|
97
|
+
raise TypeError(f'{cls!r} type expected, but {type(obj)!r} found in data:\n'
|
98
|
+
f'{pformat(data)}')
|
99
|
+
return obj
|
100
|
+
|
101
|
+
@classmethod
|
102
|
+
def read_json(cls, json_file):
|
103
|
+
"""
|
104
|
+
Create an instance by reading from a JSON file.
|
105
|
+
|
106
|
+
:param json_file: Path to the input JSON file
|
107
|
+
:type json_file: str
|
108
|
+
:return: An instance of the class
|
109
|
+
:rtype: IJsonOp
|
110
|
+
"""
|
111
|
+
with open(json_file, 'r') as f:
|
112
|
+
return cls.from_json(json.load(f))
|
113
|
+
|
114
|
+
@classmethod
|
115
|
+
def read_yaml(cls, yaml_file):
|
116
|
+
"""
|
117
|
+
Create an instance by reading from a YAML file.
|
118
|
+
|
119
|
+
:param yaml_file: Path to the input YAML file
|
120
|
+
:type yaml_file: str
|
121
|
+
:return: An instance of the class
|
122
|
+
:rtype: IJsonOp
|
123
|
+
"""
|
124
|
+
with open(yaml_file, 'r') as f:
|
125
|
+
return cls.from_json(yaml.safe_load(f))
|
pyfcstm/utils/text.py
ADDED
@@ -0,0 +1,91 @@
|
|
1
|
+
"""
|
2
|
+
String normalization utilities for converting arbitrary strings to valid identifiers.
|
3
|
+
|
4
|
+
This module provides functions to normalize strings into valid identifier formats
|
5
|
+
that can be used in programming contexts. It handles special characters, spaces,
|
6
|
+
and ensures compliance with identifier naming rules.
|
7
|
+
"""
|
8
|
+
|
9
|
+
from unidecode import unidecode
|
10
|
+
|
11
|
+
|
12
|
+
def normalize(input_string):
|
13
|
+
"""
|
14
|
+
Normalize a string to a valid identifier format.
|
15
|
+
|
16
|
+
This is a convenience wrapper around to_identifier() with strict_mode set to False.
|
17
|
+
|
18
|
+
:param input_string: The string to be normalized
|
19
|
+
:type input_string: str
|
20
|
+
|
21
|
+
:return: A normalized identifier string
|
22
|
+
:rtype: str
|
23
|
+
|
24
|
+
Example::
|
25
|
+
|
26
|
+
>>> normalize("Hello World!")
|
27
|
+
'Hello_World'
|
28
|
+
>>> normalize("123 Test")
|
29
|
+
'123_Test'
|
30
|
+
"""
|
31
|
+
return to_identifier(input_string, strict_mode=False)
|
32
|
+
|
33
|
+
|
34
|
+
def to_identifier(input_string, strict_mode: bool = True):
|
35
|
+
"""
|
36
|
+
Convert any string to a valid identifier format [0-9a-zA-Z_]+
|
37
|
+
|
38
|
+
Rules:
|
39
|
+
1. Preserve all letters and numbers
|
40
|
+
2. Convert spaces and special characters to underscores
|
41
|
+
3. If strict_mode is True, ensure the first character is not a number (as identifiers typically cannot start with a number)
|
42
|
+
4. If strict_mode is True, handle empty strings and None inputs
|
43
|
+
5. Handle consecutive special characters to avoid multiple consecutive underscores
|
44
|
+
|
45
|
+
:param input_string: The string to be converted
|
46
|
+
:type input_string: str
|
47
|
+
:param strict_mode: When True, applies additional rules to ensure identifier validity across most languages.
|
48
|
+
When False, allows empty strings and identifiers starting with numbers
|
49
|
+
:type strict_mode: bool, optional
|
50
|
+
|
51
|
+
:return: A valid identifier string
|
52
|
+
:rtype: str
|
53
|
+
|
54
|
+
Example::
|
55
|
+
|
56
|
+
>>> to_identifier("Hello World!", strict_mode=True)
|
57
|
+
'Hello_World'
|
58
|
+
>>> to_identifier("123 Test", strict_mode=True)
|
59
|
+
'_123_Test'
|
60
|
+
>>> to_identifier("", strict_mode=True)
|
61
|
+
'_empty'
|
62
|
+
"""
|
63
|
+
input_string = unidecode(input_string)
|
64
|
+
# Initialize result string
|
65
|
+
result = ""
|
66
|
+
|
67
|
+
# Process each character
|
68
|
+
prev_is_underscore = False
|
69
|
+
for char in input_string:
|
70
|
+
if char.isalnum(): # If it's a letter or number
|
71
|
+
result += char
|
72
|
+
prev_is_underscore = False
|
73
|
+
else: # If it's another character
|
74
|
+
if not prev_is_underscore: # Avoid consecutive underscores
|
75
|
+
result += "_"
|
76
|
+
prev_is_underscore = True
|
77
|
+
|
78
|
+
# Remove trailing underscore if present
|
79
|
+
result = result.rstrip("_")
|
80
|
+
|
81
|
+
# Apply strict mode rules if enabled
|
82
|
+
if strict_mode:
|
83
|
+
# Ensure it's not an empty string
|
84
|
+
if not result:
|
85
|
+
return "_empty"
|
86
|
+
|
87
|
+
# Ensure the first character is not a digit
|
88
|
+
if result and result[0].isdigit():
|
89
|
+
result = "_" + result
|
90
|
+
|
91
|
+
return result
|
@@ -0,0 +1,102 @@
|
|
1
|
+
"""
|
2
|
+
This module provides a validation framework for model validation in Python.
|
3
|
+
It includes base classes and exceptions for implementing validation rules and handling validation errors.
|
4
|
+
The framework supports collecting multiple validation errors and provides a clean interface for validation.
|
5
|
+
|
6
|
+
Usage:
|
7
|
+
>>> class MyModel(IValidatable):
|
8
|
+
... def _my_validator_function(self):
|
9
|
+
... ...
|
10
|
+
...
|
11
|
+
... __validators__ = [my_validator_function]
|
12
|
+
...
|
13
|
+
... def __init__(self, data):
|
14
|
+
... self.data = data
|
15
|
+
"""
|
16
|
+
|
17
|
+
import os
|
18
|
+
from typing import List
|
19
|
+
|
20
|
+
from hbutils.string import plural_word
|
21
|
+
|
22
|
+
|
23
|
+
class ValidationError(Exception):
|
24
|
+
"""
|
25
|
+
Base exception class for validation errors.
|
26
|
+
|
27
|
+
This exception should be raised when a single validation rule fails.
|
28
|
+
"""
|
29
|
+
pass
|
30
|
+
|
31
|
+
|
32
|
+
class ModelValidationError(Exception):
|
33
|
+
"""
|
34
|
+
Exception class for aggregating multiple validation errors.
|
35
|
+
|
36
|
+
This exception contains a list of ValidationError instances and formats them
|
37
|
+
into a readable error message.
|
38
|
+
|
39
|
+
:param errors: List of validation errors that occurred
|
40
|
+
:type errors: List[ValidationError]
|
41
|
+
|
42
|
+
:ivar errors: Stored validation errors
|
43
|
+
:type errors: List[ValidationError]
|
44
|
+
"""
|
45
|
+
|
46
|
+
def __init__(self, errors: List[ValidationError]):
|
47
|
+
super().__init__(
|
48
|
+
f"Model validation error, {plural_word(len(errors), 'error')} in total:{os.linesep}"
|
49
|
+
f"{os.linesep.join(map(lambda x: f'{x[0]}. {x[1]}', enumerate(map(repr, errors), start=1)))}",
|
50
|
+
)
|
51
|
+
self.errors = errors
|
52
|
+
|
53
|
+
|
54
|
+
class IValidatable:
|
55
|
+
"""
|
56
|
+
Interface class for implementing validatable objects.
|
57
|
+
|
58
|
+
Classes inheriting from IValidatable should define their validation rules
|
59
|
+
in the __validators__ class variable as a list of validator functions.
|
60
|
+
Each validator function should take the instance as parameter and raise
|
61
|
+
ValidationError if validation fails.
|
62
|
+
|
63
|
+
:cvar __validators__: List of validator functions to be applied
|
64
|
+
:type __validators__: List[callable]
|
65
|
+
|
66
|
+
Usage:
|
67
|
+
>>> class MyModel(IValidatable):
|
68
|
+
... def _my_validator_function(self):
|
69
|
+
... ...
|
70
|
+
...
|
71
|
+
... __validators__ = [my_validator_function]
|
72
|
+
...
|
73
|
+
>>> model = MyModel()
|
74
|
+
>>> model.validate() # Raises ModelValidationError if validation fails
|
75
|
+
"""
|
76
|
+
|
77
|
+
__validators__ = []
|
78
|
+
|
79
|
+
def _validate_for_errors(self) -> List[ValidationError]:
|
80
|
+
"""
|
81
|
+
Execute all validators and collect validation errors.
|
82
|
+
|
83
|
+
:return: List of validation errors that occurred
|
84
|
+
:rtype: List[ValidationError]
|
85
|
+
"""
|
86
|
+
errors = []
|
87
|
+
for validator in self.__validators__:
|
88
|
+
try:
|
89
|
+
validator(self)
|
90
|
+
except ValidationError as err:
|
91
|
+
errors.append(err)
|
92
|
+
return errors
|
93
|
+
|
94
|
+
def validate(self):
|
95
|
+
"""
|
96
|
+
Validate the object using all registered validators.
|
97
|
+
|
98
|
+
:raises ModelValidationError: If any validation errors occur
|
99
|
+
"""
|
100
|
+
errors = self._validate_for_errors()
|
101
|
+
if errors:
|
102
|
+
raise ModelValidationError(errors)
|
@@ -0,0 +1,165 @@
|
|
1
|
+
GNU LESSER GENERAL PUBLIC LICENSE
|
2
|
+
Version 3, 29 June 2007
|
3
|
+
|
4
|
+
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
5
|
+
Everyone is permitted to copy and distribute verbatim copies
|
6
|
+
of this license document, but changing it is not allowed.
|
7
|
+
|
8
|
+
|
9
|
+
This version of the GNU Lesser General Public License incorporates
|
10
|
+
the terms and conditions of version 3 of the GNU General Public
|
11
|
+
License, supplemented by the additional permissions listed below.
|
12
|
+
|
13
|
+
0. Additional Definitions.
|
14
|
+
|
15
|
+
As used herein, "this License" refers to version 3 of the GNU Lesser
|
16
|
+
General Public License, and the "GNU GPL" refers to version 3 of the GNU
|
17
|
+
General Public License.
|
18
|
+
|
19
|
+
"The Library" refers to a covered work governed by this License,
|
20
|
+
other than an Application or a Combined Work as defined below.
|
21
|
+
|
22
|
+
An "Application" is any work that makes use of an interface provided
|
23
|
+
by the Library, but which is not otherwise based on the Library.
|
24
|
+
Defining a subclass of a class defined by the Library is deemed a mode
|
25
|
+
of using an interface provided by the Library.
|
26
|
+
|
27
|
+
A "Combined Work" is a work produced by combining or linking an
|
28
|
+
Application with the Library. The particular version of the Library
|
29
|
+
with which the Combined Work was made is also called the "Linked
|
30
|
+
Version".
|
31
|
+
|
32
|
+
The "Minimal Corresponding Source" for a Combined Work means the
|
33
|
+
Corresponding Source for the Combined Work, excluding any source code
|
34
|
+
for portions of the Combined Work that, considered in isolation, are
|
35
|
+
based on the Application, and not on the Linked Version.
|
36
|
+
|
37
|
+
The "Corresponding Application Code" for a Combined Work means the
|
38
|
+
object code and/or source code for the Application, including any data
|
39
|
+
and utility programs needed for reproducing the Combined Work from the
|
40
|
+
Application, but excluding the System Libraries of the Combined Work.
|
41
|
+
|
42
|
+
1. Exception to Section 3 of the GNU GPL.
|
43
|
+
|
44
|
+
You may convey a covered work under sections 3 and 4 of this License
|
45
|
+
without being bound by section 3 of the GNU GPL.
|
46
|
+
|
47
|
+
2. Conveying Modified Versions.
|
48
|
+
|
49
|
+
If you modify a copy of the Library, and, in your modifications, a
|
50
|
+
facility refers to a function or data to be supplied by an Application
|
51
|
+
that uses the facility (other than as an argument passed when the
|
52
|
+
facility is invoked), then you may convey a copy of the modified
|
53
|
+
version:
|
54
|
+
|
55
|
+
a) under this License, provided that you make a good faith effort to
|
56
|
+
ensure that, in the event an Application does not supply the
|
57
|
+
function or data, the facility still operates, and performs
|
58
|
+
whatever part of its purpose remains meaningful, or
|
59
|
+
|
60
|
+
b) under the GNU GPL, with none of the additional permissions of
|
61
|
+
this License applicable to that copy.
|
62
|
+
|
63
|
+
3. Object Code Incorporating Material from Library Header Files.
|
64
|
+
|
65
|
+
The object code form of an Application may incorporate material from
|
66
|
+
a header file that is part of the Library. You may convey such object
|
67
|
+
code under terms of your choice, provided that, if the incorporated
|
68
|
+
material is not limited to numerical parameters, data structure
|
69
|
+
layouts and accessors, or small macros, inline functions and templates
|
70
|
+
(ten or fewer lines in length), you do both of the following:
|
71
|
+
|
72
|
+
a) Give prominent notice with each copy of the object code that the
|
73
|
+
Library is used in it and that the Library and its use are
|
74
|
+
covered by this License.
|
75
|
+
|
76
|
+
b) Accompany the object code with a copy of the GNU GPL and this license
|
77
|
+
document.
|
78
|
+
|
79
|
+
4. Combined Works.
|
80
|
+
|
81
|
+
You may convey a Combined Work under terms of your choice that,
|
82
|
+
taken together, effectively do not restrict modification of the
|
83
|
+
portions of the Library contained in the Combined Work and reverse
|
84
|
+
engineering for debugging such modifications, if you also do each of
|
85
|
+
the following:
|
86
|
+
|
87
|
+
a) Give prominent notice with each copy of the Combined Work that
|
88
|
+
the Library is used in it and that the Library and its use are
|
89
|
+
covered by this License.
|
90
|
+
|
91
|
+
b) Accompany the Combined Work with a copy of the GNU GPL and this license
|
92
|
+
document.
|
93
|
+
|
94
|
+
c) For a Combined Work that displays copyright notices during
|
95
|
+
execution, include the copyright notice for the Library among
|
96
|
+
these notices, as well as a reference directing the user to the
|
97
|
+
copies of the GNU GPL and this license document.
|
98
|
+
|
99
|
+
d) Do one of the following:
|
100
|
+
|
101
|
+
0) Convey the Minimal Corresponding Source under the terms of this
|
102
|
+
License, and the Corresponding Application Code in a form
|
103
|
+
suitable for, and under terms that permit, the user to
|
104
|
+
recombine or relink the Application with a modified version of
|
105
|
+
the Linked Version to produce a modified Combined Work, in the
|
106
|
+
manner specified by section 6 of the GNU GPL for conveying
|
107
|
+
Corresponding Source.
|
108
|
+
|
109
|
+
1) Use a suitable shared library mechanism for linking with the
|
110
|
+
Library. A suitable mechanism is one that (a) uses at run time
|
111
|
+
a copy of the Library already present on the user's computer
|
112
|
+
system, and (b) will operate properly with a modified version
|
113
|
+
of the Library that is interface-compatible with the Linked
|
114
|
+
Version.
|
115
|
+
|
116
|
+
e) Provide Installation Information, but only if you would otherwise
|
117
|
+
be required to provide such information under section 6 of the
|
118
|
+
GNU GPL, and only to the extent that such information is
|
119
|
+
necessary to install and execute a modified version of the
|
120
|
+
Combined Work produced by recombining or relinking the
|
121
|
+
Application with a modified version of the Linked Version. (If
|
122
|
+
you use option 4d0, the Installation Information must accompany
|
123
|
+
the Minimal Corresponding Source and Corresponding Application
|
124
|
+
Code. If you use option 4d1, you must provide the Installation
|
125
|
+
Information in the manner specified by section 6 of the GNU GPL
|
126
|
+
for conveying Corresponding Source.)
|
127
|
+
|
128
|
+
5. Combined Libraries.
|
129
|
+
|
130
|
+
You may place library facilities that are a work based on the
|
131
|
+
Library side by side in a single library together with other library
|
132
|
+
facilities that are not Applications and are not covered by this
|
133
|
+
License, and convey such a combined library under terms of your
|
134
|
+
choice, if you do both of the following:
|
135
|
+
|
136
|
+
a) Accompany the combined library with a copy of the same work based
|
137
|
+
on the Library, uncombined with any other library facilities,
|
138
|
+
conveyed under the terms of this License.
|
139
|
+
|
140
|
+
b) Give prominent notice with the combined library that part of it
|
141
|
+
is a work based on the Library, and explaining where to find the
|
142
|
+
accompanying uncombined form of the same work.
|
143
|
+
|
144
|
+
6. Revised Versions of the GNU Lesser General Public License.
|
145
|
+
|
146
|
+
The Free Software Foundation may publish revised and/or new versions
|
147
|
+
of the GNU Lesser General Public License from time to time. Such new
|
148
|
+
versions will be similar in spirit to the present version, but may
|
149
|
+
differ in detail to address new problems or concerns.
|
150
|
+
|
151
|
+
Each version is given a distinguishing version number. If the
|
152
|
+
Library as you received it specifies that a certain numbered version
|
153
|
+
of the GNU Lesser General Public License "or any later version"
|
154
|
+
applies to it, you have the option of following the terms and
|
155
|
+
conditions either of that published version or of any later version
|
156
|
+
published by the Free Software Foundation. If the Library as you
|
157
|
+
received it does not specify a version number of the GNU Lesser
|
158
|
+
General Public License, you may choose any version of the GNU Lesser
|
159
|
+
General Public License ever published by the Free Software Foundation.
|
160
|
+
|
161
|
+
If the Library as you received it specifies that a proxy can decide
|
162
|
+
whether future versions of the GNU Lesser General Public License shall
|
163
|
+
apply, that proxy's public statement of acceptance of any version is
|
164
|
+
permanent authorization for you to choose that version for the
|
165
|
+
Library.
|