kf6-ktexteditor: vendor as full-fork recipe (path=source, patches baked)

This commit is contained in:
2026-08-01 04:44:26 +03:00
parent d630d9e253
commit 2ae89f10e0
2616 changed files with 1071202 additions and 2 deletions
@@ -4,8 +4,13 @@ version = "6.28"
#TODO: KTextEditor — KDE text editor component (KParts-based). Wraps katepart.
[source]
tar = "https://download.kde.org/stable/frameworks/6.28/ktexteditor-6.28.0.tar.xz"
blake3 = "02213a950e80a6ae0b11b9fd40c0109617ced4772eee95ac106bf20c39d3277a"
# Vendored local fork (full-fork model): builds from the committed source/
# tree (offline, reproducible). source/ = pristine upstream + the patches below
# BAKED IN. .patch files kept tracked so a version bump can re-apply them via
# sync-recipe-source.sh.
# upstream: https://download.kde.org/stable/frameworks/6.28/ktexteditor-6.28.0.tar.xz
# blake3: 02213a950e80a6ae0b11b9fd40c0109617ced4772eee95ac106bf20c39d3277a
path = "source"
[build]
template = "custom"
Binary file not shown.
@@ -0,0 +1,13 @@
# clang-format/tidy
77f4552c61efde3f9a77ec5cd9ea051152584054
564e503fec4c2aebe6cf80598e3a2b8a262d08f1
0ad27d2f234f618067709682b838df80ec138cc0
500024827b8d1dbdc4f0b901784c3537f8ddb15d
c4a419233b39530857442a65f89c12b35e33609d
b24ee34a2b9cce72b744c9f3af902b7317c44ee9
84bcfe67060ca950908480fa7e218f3e825098f4
f439d8008812e869ee22c7f70e8fc550871b939d
af631ae0b98a4fc6ac4dc4f9b9fa949009e3b480
c74db883a7538fe07fa7e95a028dea6c50a9b092
5506f7ced614646fef02684ced3f0f311960d73a
353beb5d2a42ae5d3584881ce7073fd1c21884d0
@@ -0,0 +1,29 @@
# Ignore the following files
*~
*.[oa]
.clangd
*.diff
*.kate-swp
*.kdev4
.kdev_include_paths
*.kdevelop.pcs
*.moc
*.moc.cpp
*.orig
*.user
.*.swp
.swp.*
Doxyfile
Makefile
avail
random_seed
/build*/
CMakeLists.txt.user*
*.unc-backup*
/.clang-format
.cmake/
/compile_commands.json
/.cache
cmake-build-debug*
.idea
.kateproject.build
@@ -0,0 +1,12 @@
# SPDX-FileCopyrightText: 2020 Volker Krause <vkrause@kde.org>
# SPDX-License-Identifier: CC0-1.0
include:
- project: sysadmin/ci-utilities
file:
- /gitlab-templates/linux-qt6.yml
- /gitlab-templates/linux-qt6-next.yml
- /gitlab-templates/freebsd-qt6.yml
- /gitlab-templates/windows-qt6.yml
- /gitlab-templates/xml-lint.yml
- /gitlab-templates/yaml-lint.yml
@@ -0,0 +1 @@
kate: indent-mode cstyle; indent-width 4; replace-tabs on;
@@ -0,0 +1,5 @@
{
"name": "KTextEditor Framework"
, "files": [ { "git": 1 } ]
}
@@ -0,0 +1,27 @@
Dependencies:
- 'on': ['Linux', 'FreeBSD', 'Windows', 'macOS']
'require':
'frameworks/breeze-icons': '@same'
'frameworks/extra-cmake-modules': '@same'
'frameworks/karchive': '@same'
'frameworks/kconfig': '@same'
'frameworks/kguiaddons': '@same'
'frameworks/ki18n': '@same'
'frameworks/kjobwidgets': '@same'
'frameworks/kio': '@same'
'frameworks/kparts': '@same'
'frameworks/sonnet': '@same'
'frameworks/kxmlgui': '@same'
'frameworks/kcolorscheme': '@same'
'frameworks/syntax-highlighting': '@same'
- 'on': ['Linux', 'FreeBSD', 'macOS']
'require':
'frameworks/kauth': '@same'
Options:
test-before-installing: True
require-passing-tests-on: ['Linux', 'FreeBSD', 'Windows']
cppcheck-ignore-files: ['templates/']
cmake-options: '-DWARNINGS_AS_ERRORS=ON'
enable-lsan: True
@@ -0,0 +1 @@
ktexteditor-6.28.0.tar.xz
@@ -0,0 +1,139 @@
cmake_minimum_required(VERSION 3.29)
set(KF_VERSION "6.28.0") # handled by release scripts
set(KF_DEP_VERSION "6.28.0") # handled by release scripts
project(KTextEditor VERSION ${KF_VERSION})
# ECM setup
include(FeatureSummary)
find_package(ECM 6.28.0 NO_MODULE)
set_package_properties(ECM PROPERTIES TYPE REQUIRED DESCRIPTION "Extra CMake Modules." URL "https://commits.kde.org/extra-cmake-modules")
feature_summary(WHAT REQUIRED_PACKAGES_NOT_FOUND FATAL_ON_MISSING_REQUIRED_PACKAGES)
# add own modules to search path, too
set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
include(KDEInstallDirs)
include(KDECMakeSettings)
include(KDEFrameworkCompilerSettings NO_POLICY_SCOPE)
include(KDEGitCommitHooks)
include(ECMSetupVersion)
include(ECMGenerateHeaders)
include(ECMGenerateExportHeader)
include(ECMGenerateQDoc)
include(CMakePackageConfigHelpers)
include(CheckFunctionExists)
include(CheckSymbolExists)
include(KDEPackageAppTemplates)
include(GenerateExportHeader)
include(ECMQtDeclareLoggingCategory)
include(ECMDeprecationSettings)
option(ENABLE_PCH "Enable Precompiled Headers support" ON)
option(WARNINGS_AS_ERRORS "Warnings are errors -Werror" OFF)
if (NOT WIN32 AND NOT HAIKU)
set(ENABLE_KAUTH_DEFAULT ON)
else()
set(ENABLE_KAUTH_DEFAULT OFF)
endif()
option(ENABLE_KAUTH "Enable KAuth integration" ${ENABLE_KAUTH_DEFAULT})
add_feature_info(KAUTH ${ENABLE_KAUTH} "KAuth integration for editing system files")
set(ktexteditor_version_header "${CMAKE_CURRENT_BINARY_DIR}/src/ktexteditor_version.h")
ecm_setup_version(
PROJECT
VARIABLE_PREFIX KTEXTEDITOR
VERSION_HEADER "${ktexteditor_version_header}"
PACKAGE_VERSION_FILE "${CMAKE_CURRENT_BINARY_DIR}/KF6TextEditorConfigVersion.cmake"
SOVERSION 6
)
# Dependencies
set(REQUIRED_QT_VERSION 6.9.0)
# Required Qt components to build this framework
find_package(Qt6 ${REQUIRED_QT_VERSION} NO_MODULE REQUIRED Core Widgets Qml PrintSupport TextToSpeech)
# Required Frameworks
find_package(KF6Archive ${KF_DEP_VERSION} REQUIRED)
find_package(KF6Config ${KF_DEP_VERSION} REQUIRED)
find_package(KF6GuiAddons ${KF_DEP_VERSION} REQUIRED)
find_package(KF6I18n ${KF_DEP_VERSION} REQUIRED)
find_package(KF6KIO ${KF_DEP_VERSION} REQUIRED)
find_package(KF6Parts ${KF_DEP_VERSION} REQUIRED)
find_package(KF6Sonnet ${KF_DEP_VERSION} REQUIRED)
find_package(KF6SyntaxHighlighting ${KF_DEP_VERSION} REQUIRED)
find_package(KF6ColorScheme ${KF_DEP_VERSION} REQUIRED)
if (ENABLE_KAUTH)
find_package(KF6Auth ${KF_DEP_VERSION} REQUIRED)
set(HAVE_KAUTH ${KF6Auth_FOUND})
else()
set(HAVE_KAUTH FALSE)
endif()
# EditorConfig integration
find_package(EditorConfig)
# forbid some old things
set(EXCLUDE_DEPRECATED_BEFORE_AND_AT 0 CACHE STRING "Control the range of deprecated API excluded from the build [default=0].")
ecm_set_disabled_deprecation_versions(
QT 6.3
KF 6.27
)
# define which offscreen platform plugin to use for tests
set(OFFSCREEN_QPA "-platform" "offscreen")
# Subdirectories
add_definitions(-DTRANSLATION_DOMAIN=\"ktexteditor6\")
ki18n_install(po)
add_subdirectory(src)
if (BUILD_TESTING)
add_subdirectory(autotests)
endif()
add_subdirectory(templates)
# Create a Config.cmake and a ConfigVersion.cmake file and install them
set(CMAKECONFIG_INSTALL_DIR "${KDE_INSTALL_CMAKEPACKAGEDIR}/KF6TextEditor")
configure_package_config_file(
"${CMAKE_CURRENT_SOURCE_DIR}/KF6TextEditorConfig.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/KF6TextEditorConfig.cmake"
INSTALL_DESTINATION "${CMAKECONFIG_INSTALL_DIR}"
)
install(FILES
"${CMAKE_CURRENT_BINARY_DIR}/KF6TextEditorConfig.cmake"
"${CMAKE_CURRENT_BINARY_DIR}/KF6TextEditorConfigVersion.cmake"
DESTINATION "${CMAKECONFIG_INSTALL_DIR}"
COMPONENT Devel
)
install(EXPORT
KF6TextEditorTargets
DESTINATION "${CMAKECONFIG_INSTALL_DIR}"
FILE KF6TextEditorTargets.cmake
NAMESPACE KF6::
)
install(FILES
"${ktexteditor_version_header}"
DESTINATION "${KDE_INSTALL_INCLUDEDIR_KF}/KTextEditor"
COMPONENT Devel
)
# config.h
check_symbol_exists (fdatasync unistd.h HAVE_FDATASYNC)
configure_file (config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config.h)
# let our config.h be found first in any case
include_directories (BEFORE ${CMAKE_CURRENT_BINARY_DIR})
include(ECMFeatureSummary)
ecm_feature_summary(WHAT ALL FATAL_ON_MISSING_REQUIRED_PACKAGES)
kde_configure_git_pre_commit_hook(CHECKS CLANG_FORMAT)
@@ -0,0 +1,4 @@
#! /bin/sh
#This file outputs in a separate line each file with a .desktop syntax
#that needs to be translated but has a non .desktop extension
find -name \*.kdevtemplate -print
@@ -0,0 +1,8 @@
@PACKAGE_INIT@
# KF6 Deps
include(CMakeFindDependencyMacro)
find_dependency(KF6Parts "@KF_DEP_VERSION@")
find_dependency(KF6SyntaxHighlighting "@KF_DEP_VERSION@")
include("${CMAKE_CURRENT_LIST_DIR}/KF6TextEditorTargets.cmake")
@@ -0,0 +1,22 @@
Copyright (c) <year> <owner>. All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
@@ -0,0 +1,121 @@
Creative Commons Legal Code
CC0 1.0 Universal
CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE
LEGAL SERVICES. DISTRIBUTION OF THIS DOCUMENT DOES NOT CREATE AN
ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS
INFORMATION ON AN "AS-IS" BASIS. CREATIVE COMMONS MAKES NO WARRANTIES
REGARDING THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS
PROVIDED HEREUNDER, AND DISCLAIMS LIABILITY FOR DAMAGES RESULTING FROM
THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS PROVIDED
HEREUNDER.
Statement of Purpose
The laws of most jurisdictions throughout the world automatically confer
exclusive Copyright and Related Rights (defined below) upon the creator
and subsequent owner(s) (each and all, an "owner") of an original work of
authorship and/or a database (each, a "Work").
Certain owners wish to permanently relinquish those rights to a Work for
the purpose of contributing to a commons of creative, cultural and
scientific works ("Commons") that the public can reliably and without fear
of later claims of infringement build upon, modify, incorporate in other
works, reuse and redistribute as freely as possible in any form whatsoever
and for any purposes, including without limitation commercial purposes.
These owners may contribute to the Commons to promote the ideal of a free
culture and the further production of creative, cultural and scientific
works, or to gain reputation or greater distribution for their Work in
part through the use and efforts of others.
For these and/or other purposes and motivations, and without any
expectation of additional consideration or compensation, the person
associating CC0 with a Work (the "Affirmer"), to the extent that he or she
is an owner of Copyright and Related Rights in the Work, voluntarily
elects to apply CC0 to the Work and publicly distribute the Work under its
terms, with knowledge of his or her Copyright and Related Rights in the
Work and the meaning and intended legal effect of CC0 on those rights.
1. Copyright and Related Rights. A Work made available under CC0 may be
protected by copyright and related or neighboring rights ("Copyright and
Related Rights"). Copyright and Related Rights include, but are not
limited to, the following:
i. the right to reproduce, adapt, distribute, perform, display,
communicate, and translate a Work;
ii. moral rights retained by the original author(s) and/or performer(s);
iii. publicity and privacy rights pertaining to a person's image or
likeness depicted in a Work;
iv. rights protecting against unfair competition in regards to a Work,
subject to the limitations in paragraph 4(a), below;
v. rights protecting the extraction, dissemination, use and reuse of data
in a Work;
vi. database rights (such as those arising under Directive 96/9/EC of the
European Parliament and of the Council of 11 March 1996 on the legal
protection of databases, and under any national implementation
thereof, including any amended or successor version of such
directive); and
vii. other similar, equivalent or corresponding rights throughout the
world based on applicable law or treaty, and any national
implementations thereof.
2. Waiver. To the greatest extent permitted by, but not in contravention
of, applicable law, Affirmer hereby overtly, fully, permanently,
irrevocably and unconditionally waives, abandons, and surrenders all of
Affirmer's Copyright and Related Rights and associated claims and causes
of action, whether now known or unknown (including existing as well as
future claims and causes of action), in the Work (i) in all territories
worldwide, (ii) for the maximum duration provided by applicable law or
treaty (including future time extensions), (iii) in any current or future
medium and for any number of copies, and (iv) for any purpose whatsoever,
including without limitation commercial, advertising or promotional
purposes (the "Waiver"). Affirmer makes the Waiver for the benefit of each
member of the public at large and to the detriment of Affirmer's heirs and
successors, fully intending that such Waiver shall not be subject to
revocation, rescission, cancellation, termination, or any other legal or
equitable action to disrupt the quiet enjoyment of the Work by the public
as contemplated by Affirmer's express Statement of Purpose.
3. Public License Fallback. Should any part of the Waiver for any reason
be judged legally invalid or ineffective under applicable law, then the
Waiver shall be preserved to the maximum extent permitted taking into
account Affirmer's express Statement of Purpose. In addition, to the
extent the Waiver is so judged Affirmer hereby grants to each affected
person a royalty-free, non transferable, non sublicensable, non exclusive,
irrevocable and unconditional license to exercise Affirmer's Copyright and
Related Rights in the Work (i) in all territories worldwide, (ii) for the
maximum duration provided by applicable law or treaty (including future
time extensions), (iii) in any current or future medium and for any number
of copies, and (iv) for any purpose whatsoever, including without
limitation commercial, advertising or promotional purposes (the
"License"). The License shall be deemed effective as of the date CC0 was
applied by Affirmer to the Work. Should any part of the License for any
reason be judged legally invalid or ineffective under applicable law, such
partial invalidity or ineffectiveness shall not invalidate the remainder
of the License, and in such case Affirmer hereby affirms that he or she
will not (i) exercise any of his or her remaining Copyright and Related
Rights in the Work or (ii) assert any associated claims and causes of
action with respect to the Work, in either case contrary to Affirmer's
express Statement of Purpose.
4. Limitations and Disclaimers.
a. No trademark or patent rights held by Affirmer are waived, abandoned,
surrendered, licensed or otherwise affected by this document.
b. Affirmer offers the Work as-is and makes no representations or
warranties of any kind concerning the Work, express, implied,
statutory or otherwise, including without limitation warranties of
title, merchantability, fitness for a particular purpose, non
infringement, or the absence of latent or other defects, accuracy, or
the present or absence of errors, whether or not discoverable, all to
the greatest extent permissible under applicable law.
c. Affirmer disclaims responsibility for clearing rights of other persons
that may apply to the Work or any use thereof, including without
limitation any person's Copyright and Related Rights in the Work.
Further, Affirmer disclaims responsibility for obtaining any necessary
consents, permissions or other rights required for any use of the
Work.
d. Affirmer understands and acknowledges that Creative Commons is not a
party to this document and has no duty or obligation with respect to
this CC0 or use of the Work.
@@ -0,0 +1,446 @@
GNU LIBRARY GENERAL PUBLIC LICENSE
Version 2, June 1991 Copyright (C) 1991 Free Software Foundation, Inc.
51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
Everyone is permitted to copy and distribute verbatim copies of this license
document, but changing it is not allowed.
[This is the first released version of the library GPL. It is numbered 2 because
it goes with version 2 of the ordinary GPL.]
Preamble
The licenses for most software are designed to take away your freedom to share
and change it. By contrast, the GNU General Public Licenses are intended to
guarantee your freedom to share and change free software--to make sure the
software is free for all its users.
This license, the Library General Public License, applies to some specially
designated Free Software Foundation software, and to any other libraries whose
authors decide to use it. You can use it for your libraries, too.
When we speak of free software, we are referring to freedom, not price. Our
General Public Licenses are designed to make sure that you have the freedom
to distribute copies of free software (and charge for this service if you
wish), that you receive source code or can get it if you want it, that you
can change the software or use pieces of it in new free programs; and that
you know you can do these things.
To protect your rights, we need to make restrictions that forbid anyone to
deny you these rights or to ask you to surrender the rights. These restrictions
translate to certain responsibilities for you if you distribute copies of
the library, or if you modify it.
For example, if you distribute copies of the library, whether gratis or for
a fee, you must give the recipients all the rights that we gave you. You must
make sure that they, too, receive or can get the source code. If you link
a program with the library, you must provide complete object files to the
recipients so that they can relink them with the library, after making changes
to the library and recompiling it. And you must show them these terms so they
know their rights.
Our method of protecting your rights has two steps: (1) copyright the library,
and (2) offer you this license which gives you legal permission to copy, distribute
and/or modify the library.
Also, for each distributor's protection, we want to make certain that everyone
understands that there is no warranty for this free library. If the library
is modified by someone else and passed on, we want its recipients to know
that what they have is not the original version, so that any problems introduced
by others will not reflect on the original authors' reputations.
Finally, any free program is threatened constantly by software patents. We
wish to avoid the danger that companies distributing free software will individually
obtain patent licenses, thus in effect transforming the program into proprietary
software. To prevent this, we have made it clear that any patent must be licensed
for everyone's free use or not licensed at all.
Most GNU software, including some libraries, is covered by the ordinary GNU
General Public License, which was designed for utility programs. This license,
the GNU Library General Public License, applies to certain designated libraries.
This license is quite different from the ordinary one; be sure to read it
in full, and don't assume that anything in it is the same as in the ordinary
license.
The reason we have a separate public license for some libraries is that they
blur the distinction we usually make between modifying or adding to a program
and simply using it. Linking a program with a library, without changing the
library, is in some sense simply using the library, and is analogous to running
a utility program or application program. However, in a textual and legal
sense, the linked executable is a combined work, a derivative of the original
library, and the ordinary General Public License treats it as such.
Because of this blurred distinction, using the ordinary General Public License
for libraries did not effectively promote software sharing, because most developers
did not use the libraries. We concluded that weaker conditions might promote
sharing better.
However, unrestricted linking of non-free programs would deprive the users
of those programs of all benefit from the free status of the libraries themselves.
This Library General Public License is intended to permit developers of non-free
programs to use free libraries, while preserving your freedom as a user of
such programs to change the free libraries that are incorporated in them.
(We have not seen how to achieve this as regards changes in header files,
but we have achieved it as regards changes in the actual functions of the
Library.) The hope is that this will lead to faster development of free libraries.
The precise terms and conditions for copying, distribution and modification
follow. Pay close attention to the difference between a "work based on the
library" and a "work that uses the library". The former contains code derived
from the library, while the latter only works together with the library.
Note that it is possible for a library to be covered by the ordinary General
Public License rather than by this special one.
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License Agreement applies to any software library which contains a
notice placed by the copyright holder or other authorized party saying it
may be distributed under the terms of this Library General Public License
(also called "this License"). Each licensee is addressed as "you".
A "library" means a collection of software functions and/or data prepared
so as to be conveniently linked with application programs (which use some
of those functions and data) to form executables.
The "Library", below, refers to any such software library or work which has
been distributed under these terms. A "work based on the Library" means either
the Library or any derivative work under copyright law: that is to say, a
work containing the Library or a portion of it, either verbatim or with modifications
and/or translated straightforwardly into another language. (Hereinafter, translation
is included without limitation in the term "modification".)
"Source code" for a work means the preferred form of the work for making modifications
to it. For a library, complete source code means all the source code for all
modules it contains, plus any associated interface definition files, plus
the scripts used to control compilation and installation of the library.
Activities other than copying, distribution and modification are not covered
by this License; they are outside its scope. The act of running a program
using the Library is not restricted, and output from such a program is covered
only if its contents constitute a work based on the Library (independent of
the use of the Library in a tool for writing it). Whether that is true depends
on what the Library does and what the program that uses the Library does.
1. You may copy and distribute verbatim copies of the Library's complete source
code as you receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice and disclaimer
of warranty; keep intact all the notices that refer to this License and to
the absence of any warranty; and distribute a copy of this License along with
the Library.
You may charge a fee for the physical act of transferring a copy, and you
may at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Library or any portion of it,
thus forming a work based on the Library, and copy and distribute such modifications
or work under the terms of Section 1 above, provided that you also meet all
of these conditions:
a) The modified work must itself be a software library.
b) You must cause the files modified to carry prominent notices stating that
you changed the files and the date of any change.
c) You must cause the whole of the work to be licensed at no charge to all
third parties under the terms of this License.
d) If a facility in the modified Library refers to a function or a table of
data to be supplied by an application program that uses the facility, other
than as an argument passed when the facility is invoked, then you must make
a good faith effort to ensure that, in the event an application does not supply
such function or table, the facility still operates, and performs whatever
part of its purpose remains meaningful.
(For example, a function in a library to compute square roots has a purpose
that is entirely well-defined independent of the application. Therefore, Subsection
2d requires that any application-supplied function or table used by this function
must be optional: if the application does not supply it, the square root function
must still compute square roots.)
These requirements apply to the modified work as a whole. If identifiable
sections of that work are not derived from the Library, and can be reasonably
considered independent and separate works in themselves, then this License,
and its terms, do not apply to those sections when you distribute them as
separate works. But when you distribute the same sections as part of a whole
which is a work based on the Library, the distribution of the whole must be
on the terms of this License, whose permissions for other licensees extend
to the entire whole, and thus to each and every part regardless of who wrote
it.
Thus, it is not the intent of this section to claim rights or contest your
rights to work written entirely by you; rather, the intent is to exercise
the right to control the distribution of derivative or collective works based
on the Library.
In addition, mere aggregation of another work not based on the Library with
the Library (or with a work based on the Library) on a volume of a storage
or distribution medium does not bring the other work under the scope of this
License.
3. You may opt to apply the terms of the ordinary GNU General Public License
instead of this License to a given copy of the Library. To do this, you must
alter all the notices that refer to this License, so that they refer to the
ordinary GNU General Public License, version 2, instead of to this License.
(If a newer version than version 2 of the ordinary GNU General Public License
has appeared, then you can specify that version instead if you wish.) Do not
make any other change in these notices.
Once this change is made in a given copy, it is irreversible for that copy,
so the ordinary GNU General Public License applies to all subsequent copies
and derivative works made from that copy.
This option is useful when you wish to copy part of the code of the Library
into a program that is not a library.
4. You may copy and distribute the Library (or a portion or derivative of
it, under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you accompany it with the complete corresponding
machine-readable source code, which must be distributed under the terms of
Sections 1 and 2 above on a medium customarily used for software interchange.
If distribution of object code is made by offering access to copy from a designated
place, then offering equivalent access to copy the source code from the same
place satisfies the requirement to distribute the source code, even though
third parties are not compelled to copy the source along with the object code.
5. A program that contains no derivative of any portion of the Library, but
is designed to work with the Library by being compiled or linked with it,
is called a "work that uses the Library". Such a work, in isolation, is not
a derivative work of the Library, and therefore falls outside the scope of
this License.
However, linking a "work that uses the Library" with the Library creates an
executable that is a derivative of the Library (because it contains portions
of the Library), rather than a "work that uses the library". The executable
is therefore covered by this License. Section 6 states terms for distribution
of such executables.
When a "work that uses the Library" uses material from a header file that
is part of the Library, the object code for the work may be a derivative work
of the Library even though the source code is not. Whether this is true is
especially significant if the work can be linked without the Library, or if
the work is itself a library. The threshold for this to be true is not precisely
defined by law.
If such an object file uses only numerical parameters, data structure layouts
and accessors, and small macros and small inline functions (ten lines or less
in length), then the use of the object file is unrestricted, regardless of
whether it is legally a derivative work. (Executables containing this object
code plus portions of the Library will still fall under Section 6.)
Otherwise, if the work is a derivative of the Library, you may distribute
the object code for the work under the terms of Section 6. Any executables
containing that work also fall under Section 6, whether or not they are linked
directly with the Library itself.
6. As an exception to the Sections above, you may also compile or link a "work
that uses the Library" with the Library to produce a work containing portions
of the Library, and distribute that work under terms of your choice, provided
that the terms permit modification of the work for the customer's own use
and reverse engineering for debugging such modifications.
You must give prominent notice with each copy of the work that the Library
is used in it and that the Library and its use are covered by this License.
You must supply a copy of this License. If the work during execution displays
copyright notices, you must include the copyright notice for the Library among
them, as well as a reference directing the user to the copy of this License.
Also, you must do one of these things:
a) Accompany the work with the complete corresponding machine-readable source
code for the Library including whatever changes were used in the work (which
must be distributed under Sections 1 and 2 above); and, if the work is an
executable linked with the Library, with the complete machine-readable "work
that uses the Library", as object code and/or source code, so that the user
can modify the Library and then relink to produce a modified executable containing
the modified Library. (It is understood that the user who changes the contents
of definitions files in the Library will not necessarily be able to recompile
the application to use the modified definitions.)
b) Accompany the work with a written offer, valid for at least three years,
to give the same user the materials specified in Subsection 6a, above, for
a charge no more than the cost of performing this distribution.
c) If distribution of the work is made by offering access to copy from a designated
place, offer equivalent access to copy the above specified materials from
the same place.
d) Verify that the user has already received a copy of these materials or
that you have already sent this user a copy.
For an executable, the required form of the "work that uses the Library" must
include any data and utility programs needed for reproducing the executable
from it. However, as a special exception, the source code distributed need
not include anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the operating
system on which the executable runs, unless that component itself accompanies
the executable.
It may happen that this requirement contradicts the license restrictions of
other proprietary libraries that do not normally accompany the operating system.
Such a contradiction means you cannot use both them and the Library together
in an executable that you distribute.
7. You may place library facilities that are a work based on the Library side-by-side
in a single library together with other library facilities not covered by
this License, and distribute such a combined library, provided that the separate
distribution of the work based on the Library and of the other library facilities
is otherwise permitted, and provided that you do these two things:
a) Accompany the combined library with a copy of the same work based on the
Library, uncombined with any other library facilities. This must be distributed
under the terms of the Sections above.
b) Give prominent notice with the combined library of the fact that part of
it is a work based on the Library, and explaining where to find the accompanying
uncombined form of the same work.
8. You may not copy, modify, sublicense, link with, or distribute the Library
except as expressly provided under this License. Any attempt otherwise to
copy, modify, sublicense, link with, or distribute the Library is void, and
will automatically terminate your rights under this License. However, parties
who have received copies, or rights, from you under this License will not
have their licenses terminated so long as such parties remain in full compliance.
9. You are not required to accept this License, since you have not signed
it. However, nothing else grants you permission to modify or distribute the
Library or its derivative works. These actions are prohibited by law if you
do not accept this License. Therefore, by modifying or distributing the Library
(or any work based on the Library), you indicate your acceptance of this License
to do so, and all its terms and conditions for copying, distributing or modifying
the Library or works based on it.
10. Each time you redistribute the Library (or any work based on the Library),
the recipient automatically receives a license from the original licensor
to copy, distribute, link with or modify the Library subject to these terms
and conditions. You may not impose any further restrictions on the recipients'
exercise of the rights granted herein. You are not responsible for enforcing
compliance by third parties to this License.
11. If, as a consequence of a court judgment or allegation of patent infringement
or for any other reason (not limited to patent issues), conditions are imposed
on you (whether by court order, agreement or otherwise) that contradict the
conditions of this License, they do not excuse you from the conditions of
this License. If you cannot distribute so as to satisfy simultaneously your
obligations under this License and any other pertinent obligations, then as
a consequence you may not distribute the Library at all. For example, if a
patent license would not permit royalty-free redistribution of the Library
by all those who receive copies directly or indirectly through you, then the
only way you could satisfy both it and this License would be to refrain entirely
from distribution of the Library.
If any portion of this section is held invalid or unenforceable under any
particular circumstance, the balance of the section is intended to apply,
and the section as a whole is intended to apply in other circumstances.
It is not the purpose of this section to induce you to infringe any patents
or other property right claims or to contest validity of any such claims;
this section has the sole purpose of protecting the integrity of the free
software distribution system which is implemented by public license practices.
Many people have made generous contributions to the wide range of software
distributed through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing to
distribute software through any other system and a licensee cannot impose
that choice.
This section is intended to make thoroughly clear what is believed to be a
consequence of the rest of this License.
12. If the distribution and/or use of the Library is restricted in certain
countries either by patents or by copyrighted interfaces, the original copyright
holder who places the Library under this License may add an explicit geographical
distribution limitation excluding those countries, so that distribution is
permitted only in or among countries not thus excluded. In such case, this
License incorporates the limitation as if written in the body of this License.
13. The Free Software Foundation may publish revised and/or new versions of
the Library General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to address
new problems or concerns.
Each version is given a distinguishing version number. If the Library specifies
a version number of this License which applies to it and "any later version",
you have the option of following the terms and conditions either of that version
or of any later version published by the Free Software Foundation. If the
Library does not specify a license version number, you may choose any version
ever published by the Free Software Foundation.
14. If you wish to incorporate parts of the Library into other free programs
whose distribution conditions are incompatible with these, write to the author
to ask for permission. For software which is copyrighted by the Free Software
Foundation, write to the Free Software Foundation; we sometimes make exceptions
for this. Our decision will be guided by the two goals of preserving the free
status of all derivatives of our free software and of promoting the sharing
and reuse of software generally.
NO WARRANTY
15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR
THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE
STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE LIBRARY
"AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE
OF THE LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE
THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE
OR INABILITY TO USE THE LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA
OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES
OR A FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH
HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Libraries
If you develop a new library, and you want it to be of the greatest possible
use to the public, we recommend making it free software that everyone can
redistribute and change. You can do so by permitting redistribution under
these terms (or, alternatively, under the terms of the ordinary General Public
License).
To apply these terms, attach the following notices to the library. It is safest
to attach them to the start of each source file to most effectively convey
the exclusion of warranty; and each file should have at least the "copyright"
line and a pointer to where the full notice is found.
one line to give the library's name and an idea of what it does.
Copyright (C) year name of author
This library is free software; you can redistribute it and/or modify it under
the terms of the GNU Library General Public License as published by the Free
Software Foundation; either version 2 of the License, or (at your option)
any later version.
This library is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more
details.
You should have received a copy of the GNU Library General Public License
along with this library; if not, write to the Free Software Foundation, Inc.,
51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
Also add information on how to contact you by electronic and paper mail.
You should also get your employer (if you work as a programmer) or your school,
if any, to sign a "copyright disclaimer" for the library, if necessary. Here
is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in
the library `Frob' (a library for tweaking knobs) written
by James Random Hacker.
signature of Ty Coon, 1 April 1990
Ty Coon, President of Vice
That's all there is to it!
@@ -0,0 +1,446 @@
GNU LIBRARY GENERAL PUBLIC LICENSE
Version 2, June 1991 Copyright (C) 1991 Free Software Foundation, Inc.
51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
Everyone is permitted to copy and distribute verbatim copies of this license
document, but changing it is not allowed.
[This is the first released version of the library GPL. It is numbered 2 because
it goes with version 2 of the ordinary GPL.]
Preamble
The licenses for most software are designed to take away your freedom to share
and change it. By contrast, the GNU General Public Licenses are intended to
guarantee your freedom to share and change free software--to make sure the
software is free for all its users.
This license, the Library General Public License, applies to some specially
designated Free Software Foundation software, and to any other libraries whose
authors decide to use it. You can use it for your libraries, too.
When we speak of free software, we are referring to freedom, not price. Our
General Public Licenses are designed to make sure that you have the freedom
to distribute copies of free software (and charge for this service if you
wish), that you receive source code or can get it if you want it, that you
can change the software or use pieces of it in new free programs; and that
you know you can do these things.
To protect your rights, we need to make restrictions that forbid anyone to
deny you these rights or to ask you to surrender the rights. These restrictions
translate to certain responsibilities for you if you distribute copies of
the library, or if you modify it.
For example, if you distribute copies of the library, whether gratis or for
a fee, you must give the recipients all the rights that we gave you. You must
make sure that they, too, receive or can get the source code. If you link
a program with the library, you must provide complete object files to the
recipients so that they can relink them with the library, after making changes
to the library and recompiling it. And you must show them these terms so they
know their rights.
Our method of protecting your rights has two steps: (1) copyright the library,
and (2) offer you this license which gives you legal permission to copy, distribute
and/or modify the library.
Also, for each distributor's protection, we want to make certain that everyone
understands that there is no warranty for this free library. If the library
is modified by someone else and passed on, we want its recipients to know
that what they have is not the original version, so that any problems introduced
by others will not reflect on the original authors' reputations.
Finally, any free program is threatened constantly by software patents. We
wish to avoid the danger that companies distributing free software will individually
obtain patent licenses, thus in effect transforming the program into proprietary
software. To prevent this, we have made it clear that any patent must be licensed
for everyone's free use or not licensed at all.
Most GNU software, including some libraries, is covered by the ordinary GNU
General Public License, which was designed for utility programs. This license,
the GNU Library General Public License, applies to certain designated libraries.
This license is quite different from the ordinary one; be sure to read it
in full, and don't assume that anything in it is the same as in the ordinary
license.
The reason we have a separate public license for some libraries is that they
blur the distinction we usually make between modifying or adding to a program
and simply using it. Linking a program with a library, without changing the
library, is in some sense simply using the library, and is analogous to running
a utility program or application program. However, in a textual and legal
sense, the linked executable is a combined work, a derivative of the original
library, and the ordinary General Public License treats it as such.
Because of this blurred distinction, using the ordinary General Public License
for libraries did not effectively promote software sharing, because most developers
did not use the libraries. We concluded that weaker conditions might promote
sharing better.
However, unrestricted linking of non-free programs would deprive the users
of those programs of all benefit from the free status of the libraries themselves.
This Library General Public License is intended to permit developers of non-free
programs to use free libraries, while preserving your freedom as a user of
such programs to change the free libraries that are incorporated in them.
(We have not seen how to achieve this as regards changes in header files,
but we have achieved it as regards changes in the actual functions of the
Library.) The hope is that this will lead to faster development of free libraries.
The precise terms and conditions for copying, distribution and modification
follow. Pay close attention to the difference between a "work based on the
library" and a "work that uses the library". The former contains code derived
from the library, while the latter only works together with the library.
Note that it is possible for a library to be covered by the ordinary General
Public License rather than by this special one.
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License Agreement applies to any software library which contains a
notice placed by the copyright holder or other authorized party saying it
may be distributed under the terms of this Library General Public License
(also called "this License"). Each licensee is addressed as "you".
A "library" means a collection of software functions and/or data prepared
so as to be conveniently linked with application programs (which use some
of those functions and data) to form executables.
The "Library", below, refers to any such software library or work which has
been distributed under these terms. A "work based on the Library" means either
the Library or any derivative work under copyright law: that is to say, a
work containing the Library or a portion of it, either verbatim or with modifications
and/or translated straightforwardly into another language. (Hereinafter, translation
is included without limitation in the term "modification".)
"Source code" for a work means the preferred form of the work for making modifications
to it. For a library, complete source code means all the source code for all
modules it contains, plus any associated interface definition files, plus
the scripts used to control compilation and installation of the library.
Activities other than copying, distribution and modification are not covered
by this License; they are outside its scope. The act of running a program
using the Library is not restricted, and output from such a program is covered
only if its contents constitute a work based on the Library (independent of
the use of the Library in a tool for writing it). Whether that is true depends
on what the Library does and what the program that uses the Library does.
1. You may copy and distribute verbatim copies of the Library's complete source
code as you receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice and disclaimer
of warranty; keep intact all the notices that refer to this License and to
the absence of any warranty; and distribute a copy of this License along with
the Library.
You may charge a fee for the physical act of transferring a copy, and you
may at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Library or any portion of it,
thus forming a work based on the Library, and copy and distribute such modifications
or work under the terms of Section 1 above, provided that you also meet all
of these conditions:
a) The modified work must itself be a software library.
b) You must cause the files modified to carry prominent notices stating that
you changed the files and the date of any change.
c) You must cause the whole of the work to be licensed at no charge to all
third parties under the terms of this License.
d) If a facility in the modified Library refers to a function or a table of
data to be supplied by an application program that uses the facility, other
than as an argument passed when the facility is invoked, then you must make
a good faith effort to ensure that, in the event an application does not supply
such function or table, the facility still operates, and performs whatever
part of its purpose remains meaningful.
(For example, a function in a library to compute square roots has a purpose
that is entirely well-defined independent of the application. Therefore, Subsection
2d requires that any application-supplied function or table used by this function
must be optional: if the application does not supply it, the square root function
must still compute square roots.)
These requirements apply to the modified work as a whole. If identifiable
sections of that work are not derived from the Library, and can be reasonably
considered independent and separate works in themselves, then this License,
and its terms, do not apply to those sections when you distribute them as
separate works. But when you distribute the same sections as part of a whole
which is a work based on the Library, the distribution of the whole must be
on the terms of this License, whose permissions for other licensees extend
to the entire whole, and thus to each and every part regardless of who wrote
it.
Thus, it is not the intent of this section to claim rights or contest your
rights to work written entirely by you; rather, the intent is to exercise
the right to control the distribution of derivative or collective works based
on the Library.
In addition, mere aggregation of another work not based on the Library with
the Library (or with a work based on the Library) on a volume of a storage
or distribution medium does not bring the other work under the scope of this
License.
3. You may opt to apply the terms of the ordinary GNU General Public License
instead of this License to a given copy of the Library. To do this, you must
alter all the notices that refer to this License, so that they refer to the
ordinary GNU General Public License, version 2, instead of to this License.
(If a newer version than version 2 of the ordinary GNU General Public License
has appeared, then you can specify that version instead if you wish.) Do not
make any other change in these notices.
Once this change is made in a given copy, it is irreversible for that copy,
so the ordinary GNU General Public License applies to all subsequent copies
and derivative works made from that copy.
This option is useful when you wish to copy part of the code of the Library
into a program that is not a library.
4. You may copy and distribute the Library (or a portion or derivative of
it, under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you accompany it with the complete corresponding
machine-readable source code, which must be distributed under the terms of
Sections 1 and 2 above on a medium customarily used for software interchange.
If distribution of object code is made by offering access to copy from a designated
place, then offering equivalent access to copy the source code from the same
place satisfies the requirement to distribute the source code, even though
third parties are not compelled to copy the source along with the object code.
5. A program that contains no derivative of any portion of the Library, but
is designed to work with the Library by being compiled or linked with it,
is called a "work that uses the Library". Such a work, in isolation, is not
a derivative work of the Library, and therefore falls outside the scope of
this License.
However, linking a "work that uses the Library" with the Library creates an
executable that is a derivative of the Library (because it contains portions
of the Library), rather than a "work that uses the library". The executable
is therefore covered by this License. Section 6 states terms for distribution
of such executables.
When a "work that uses the Library" uses material from a header file that
is part of the Library, the object code for the work may be a derivative work
of the Library even though the source code is not. Whether this is true is
especially significant if the work can be linked without the Library, or if
the work is itself a library. The threshold for this to be true is not precisely
defined by law.
If such an object file uses only numerical parameters, data structure layouts
and accessors, and small macros and small inline functions (ten lines or less
in length), then the use of the object file is unrestricted, regardless of
whether it is legally a derivative work. (Executables containing this object
code plus portions of the Library will still fall under Section 6.)
Otherwise, if the work is a derivative of the Library, you may distribute
the object code for the work under the terms of Section 6. Any executables
containing that work also fall under Section 6, whether or not they are linked
directly with the Library itself.
6. As an exception to the Sections above, you may also compile or link a "work
that uses the Library" with the Library to produce a work containing portions
of the Library, and distribute that work under terms of your choice, provided
that the terms permit modification of the work for the customer's own use
and reverse engineering for debugging such modifications.
You must give prominent notice with each copy of the work that the Library
is used in it and that the Library and its use are covered by this License.
You must supply a copy of this License. If the work during execution displays
copyright notices, you must include the copyright notice for the Library among
them, as well as a reference directing the user to the copy of this License.
Also, you must do one of these things:
a) Accompany the work with the complete corresponding machine-readable source
code for the Library including whatever changes were used in the work (which
must be distributed under Sections 1 and 2 above); and, if the work is an
executable linked with the Library, with the complete machine-readable "work
that uses the Library", as object code and/or source code, so that the user
can modify the Library and then relink to produce a modified executable containing
the modified Library. (It is understood that the user who changes the contents
of definitions files in the Library will not necessarily be able to recompile
the application to use the modified definitions.)
b) Accompany the work with a written offer, valid for at least three years,
to give the same user the materials specified in Subsection 6a, above, for
a charge no more than the cost of performing this distribution.
c) If distribution of the work is made by offering access to copy from a designated
place, offer equivalent access to copy the above specified materials from
the same place.
d) Verify that the user has already received a copy of these materials or
that you have already sent this user a copy.
For an executable, the required form of the "work that uses the Library" must
include any data and utility programs needed for reproducing the executable
from it. However, as a special exception, the source code distributed need
not include anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the operating
system on which the executable runs, unless that component itself accompanies
the executable.
It may happen that this requirement contradicts the license restrictions of
other proprietary libraries that do not normally accompany the operating system.
Such a contradiction means you cannot use both them and the Library together
in an executable that you distribute.
7. You may place library facilities that are a work based on the Library side-by-side
in a single library together with other library facilities not covered by
this License, and distribute such a combined library, provided that the separate
distribution of the work based on the Library and of the other library facilities
is otherwise permitted, and provided that you do these two things:
a) Accompany the combined library with a copy of the same work based on the
Library, uncombined with any other library facilities. This must be distributed
under the terms of the Sections above.
b) Give prominent notice with the combined library of the fact that part of
it is a work based on the Library, and explaining where to find the accompanying
uncombined form of the same work.
8. You may not copy, modify, sublicense, link with, or distribute the Library
except as expressly provided under this License. Any attempt otherwise to
copy, modify, sublicense, link with, or distribute the Library is void, and
will automatically terminate your rights under this License. However, parties
who have received copies, or rights, from you under this License will not
have their licenses terminated so long as such parties remain in full compliance.
9. You are not required to accept this License, since you have not signed
it. However, nothing else grants you permission to modify or distribute the
Library or its derivative works. These actions are prohibited by law if you
do not accept this License. Therefore, by modifying or distributing the Library
(or any work based on the Library), you indicate your acceptance of this License
to do so, and all its terms and conditions for copying, distributing or modifying
the Library or works based on it.
10. Each time you redistribute the Library (or any work based on the Library),
the recipient automatically receives a license from the original licensor
to copy, distribute, link with or modify the Library subject to these terms
and conditions. You may not impose any further restrictions on the recipients'
exercise of the rights granted herein. You are not responsible for enforcing
compliance by third parties to this License.
11. If, as a consequence of a court judgment or allegation of patent infringement
or for any other reason (not limited to patent issues), conditions are imposed
on you (whether by court order, agreement or otherwise) that contradict the
conditions of this License, they do not excuse you from the conditions of
this License. If you cannot distribute so as to satisfy simultaneously your
obligations under this License and any other pertinent obligations, then as
a consequence you may not distribute the Library at all. For example, if a
patent license would not permit royalty-free redistribution of the Library
by all those who receive copies directly or indirectly through you, then the
only way you could satisfy both it and this License would be to refrain entirely
from distribution of the Library.
If any portion of this section is held invalid or unenforceable under any
particular circumstance, the balance of the section is intended to apply,
and the section as a whole is intended to apply in other circumstances.
It is not the purpose of this section to induce you to infringe any patents
or other property right claims or to contest validity of any such claims;
this section has the sole purpose of protecting the integrity of the free
software distribution system which is implemented by public license practices.
Many people have made generous contributions to the wide range of software
distributed through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing to
distribute software through any other system and a licensee cannot impose
that choice.
This section is intended to make thoroughly clear what is believed to be a
consequence of the rest of this License.
12. If the distribution and/or use of the Library is restricted in certain
countries either by patents or by copyrighted interfaces, the original copyright
holder who places the Library under this License may add an explicit geographical
distribution limitation excluding those countries, so that distribution is
permitted only in or among countries not thus excluded. In such case, this
License incorporates the limitation as if written in the body of this License.
13. The Free Software Foundation may publish revised and/or new versions of
the Library General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to address
new problems or concerns.
Each version is given a distinguishing version number. If the Library specifies
a version number of this License which applies to it and "any later version",
you have the option of following the terms and conditions either of that version
or of any later version published by the Free Software Foundation. If the
Library does not specify a license version number, you may choose any version
ever published by the Free Software Foundation.
14. If you wish to incorporate parts of the Library into other free programs
whose distribution conditions are incompatible with these, write to the author
to ask for permission. For software which is copyrighted by the Free Software
Foundation, write to the Free Software Foundation; we sometimes make exceptions
for this. Our decision will be guided by the two goals of preserving the free
status of all derivatives of our free software and of promoting the sharing
and reuse of software generally.
NO WARRANTY
15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR
THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE
STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE LIBRARY
"AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE
OF THE LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE
THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE
OR INABILITY TO USE THE LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA
OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES
OR A FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH
HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Libraries
If you develop a new library, and you want it to be of the greatest possible
use to the public, we recommend making it free software that everyone can
redistribute and change. You can do so by permitting redistribution under
these terms (or, alternatively, under the terms of the ordinary General Public
License).
To apply these terms, attach the following notices to the library. It is safest
to attach them to the start of each source file to most effectively convey
the exclusion of warranty; and each file should have at least the "copyright"
line and a pointer to where the full notice is found.
one line to give the library's name and an idea of what it does.
Copyright (C) year name of author
This library is free software; you can redistribute it and/or modify it under
the terms of the GNU Library General Public License as published by the Free
Software Foundation; either version 2 of the License, or (at your option)
any later version.
This library is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more
details.
You should have received a copy of the GNU Library General Public License
along with this library; if not, write to the Free Software Foundation, Inc.,
51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
Also add information on how to contact you by electronic and paper mail.
You should also get your employer (if you work as a programmer) or your school,
if any, to sign a "copyright disclaimer" for the library, if necessary. Here
is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in
the library `Frob' (a library for tweaking knobs) written
by James Random Hacker.
signature of Ty Coon, 1 April 1990
Ty Coon, President of Vice
That's all there is to it!
@@ -0,0 +1,19 @@
MIT License Copyright (c) <year> <copyright holders>
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 (including the next
paragraph) 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.
@@ -0,0 +1,65 @@
# KTextEditor
Full text editor component
## Introduction
KTextEditor provides a powerful text editor component that you can embed in your
application, either as a KPart or using the KF6::TextEditor library (if you need
more control).
The text editor component contains many useful features, from syntax
highlighting and automatic indentation to advanced scripting support, making it
suitable for everything from a simple embedded text-file editor to an advanced
IDE.
## Usage
If you are using CMake, you need to have
```cmake
find_package(KF6TextEditor)
```
(or similar) in your CMakeLists.txt file, and you need to link to KF6::TextEditor.
After that, you can use KTextEditor::Editor to create an editor instance, and
use that to manage KTextEditor::Document instances.
```cpp
#include <KTextEditor/Document>
#include <KTextEditor/Editor>
#include <KTextEditor/View>
// get access to the global editor singleton
auto editor = KTextEditor::Editor::instance();
// create a new document
auto doc = editor->createDocument(this);
// create a widget to display the document
auto view = doc->createView(yourWidgetParent);
```
See the documentation for these classes for more information.
## Licensing
Contributions to KTextEditor shall be licensed under [LGPLv2+](LICENSES/LGPL-2.0-or-later.txt).
All files shall contain a proper "SPDX-License-Identifier: LGPL-2.0-or-later" identifier inside a header like:
```cpp
/*
SPDX-FileCopyrightText: 2021 Christoph Cullmann <cullmann@kde.org>
SPDX-License-Identifier: LGPL-2.0-or-later
*/
```
## Further Documentation
- @ref kte_design
- @ref kte_port_to_5
- @ref kte_guidelines
@@ -0,0 +1,204 @@
find_package(Qt6 ${REQUIRED_QT_VERSION} CONFIG REQUIRED Test)
add_definitions(-DQT_FORCE_ASSERTS=1)
include(ECMMarkAsTest)
include(ECMAddTests)
set( EXECUTABLE_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR} )
include_directories(
# for config.h
${CMAKE_BINARY_DIR}
# for generated ktexteditor headers
${CMAKE_BINARY_DIR}/src/include
# for normal sources
${CMAKE_SOURCE_DIR}/src
${CMAKE_SOURCE_DIR}/src/include
${CMAKE_SOURCE_DIR}/src/buffer
${CMAKE_SOURCE_DIR}/src/completion
${CMAKE_SOURCE_DIR}/src/dialogs
${CMAKE_SOURCE_DIR}/src/document
${CMAKE_SOURCE_DIR}/src/script
${CMAKE_SOURCE_DIR}/src/mode
${CMAKE_SOURCE_DIR}/src/render
${CMAKE_SOURCE_DIR}/src/search
${CMAKE_SOURCE_DIR}/src/syntax
${CMAKE_SOURCE_DIR}/src/undo
${CMAKE_SOURCE_DIR}/src/utils
${CMAKE_SOURCE_DIR}/src/view
)
add_definitions(-DTEST_DATA_DIR=\"${CMAKE_SOURCE_DIR}/autotests/input/\")
add_definitions(-DJS_DATA_DIR=\"${CMAKE_SOURCE_DIR}/src/script/data/\")
add_definitions(-DJS_SCRIPTTESTER_DATA_DIR=\"${CMAKE_SOURCE_DIR}/src/scripttester/\")
set (KTEXTEDITOR_TEST_LINK_LIBS KF6TextEditor
KF6::I18n
KF6::GuiAddons
KF6::SyntaxHighlighting
KF6::Codecs
KF6::Completion
Qt6::Qml
)
if(ENABLE_PCH)
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/pch.cpp "/*empty file*/")
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/pch.h
"#pragma once\n"
"#include <QObject>\n"
"#include <QTest>\n"
"#include <QString>\n"
)
add_library(kte_test_pch STATIC ${CMAKE_CURRENT_BINARY_DIR}/pch.cpp)
target_link_libraries(kte_test_pch ${KTEXTEDITOR_TEST_LINK_LIBS} Qt6::Test)
target_precompile_headers(kte_test_pch PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/pch.h)
endif()
include(ECMMarkAsTest)
# test executable for encoding
add_executable(kateencodingtest src/kateencodingtest.cpp)
target_link_libraries(kateencodingtest ${KTEXTEDITOR_TEST_LINK_LIBS})
ecm_mark_as_test(kateencodingtest)
# test macro for encoding tests
MACRO(KTEXTEDITOR_ENCODING_TEST _encoding _testname)
ADD_TEST (NAME encoding_${_testname}_create COMMAND kateencodingtest ${_encoding} ${CMAKE_SOURCE_DIR}/autotests/input/encoding/${_testname} ${CMAKE_CURRENT_BINARY_DIR}/${_testname} )
ADD_TEST (NAME encoding_${_testname}_diff COMMAND ${CMAKE_COMMAND} -E compare_files ${CMAKE_SOURCE_DIR}/autotests/input/encoding/${_testname} ${CMAKE_CURRENT_BINARY_DIR}/${_testname} )
ENDMACRO(KTEXTEDITOR_ENCODING_TEST)
# add tests
# this file is utf-8, simple
KTEXTEDITOR_ENCODING_TEST ("utf-8" "utf8.txt")
# this file is latin15, but fallback should work!
KTEXTEDITOR_ENCODING_TEST ("utf-8" "latin15.txt")
# this file is utf32, little endian, but fallback should work!
KTEXTEDITOR_ENCODING_TEST ("utf-8" "utf32.txt")
# this file is utf16, little endian, but fallback should work!
KTEXTEDITOR_ENCODING_TEST ("utf-8" "utf16.txt")
# this file is utf32, big endian, but fallback should work!
KTEXTEDITOR_ENCODING_TEST ("utf-8" "utf32be.txt")
# this file is utf16, big endian, but fallback should work!
KTEXTEDITOR_ENCODING_TEST ("utf-8" "utf16be.txt")
# cyrillic utf-8
KTEXTEDITOR_ENCODING_TEST ("utf-8" "cyrillic_utf8.txt")
# cyrillic cp1251
KTEXTEDITOR_ENCODING_TEST ("utf-8" "cp1251.txt")
# cyrillic koi8-r
KTEXTEDITOR_ENCODING_TEST ("utf-8" "koi8-r.txt")
# one character latin-15 test, segfaulted
KTEXTEDITOR_ENCODING_TEST ("utf-8" "one-char-latin-15.txt")
# utf8 bom only, shouldn't produce error
KTEXTEDITOR_ENCODING_TEST ("utf-8" "utf8-bom-only.txt")
# latin15, but coincidentally contains utf8 bom. The "bom" should be treated as normal text
KTEXTEDITOR_ENCODING_TEST ("ISO 8859-15" "latin15-with-utf8-bom.txt")
# test executable for indentation
add_executable(kateindenttest src/indenttest.cpp src/script_test_base.cpp src/testutils.cpp)
target_link_libraries(kateindenttest ${KTEXTEDITOR_TEST_LINK_LIBS} Qt6::Test)
ecm_mark_as_test(kateindenttest)
if(ENABLE_PCH)
target_precompile_headers(kateindenttest REUSE_FROM kte_test_pch)
endif()
# test macro for indentation tests
MACRO(KTEXTEDITOR_INDENT_TEST _testname)
ADD_TEST (NAME kateindenttest_${_testname} COMMAND kateindenttest ${OFFSCREEN_QPA} ${_testname})
ENDMACRO(KTEXTEDITOR_INDENT_TEST)
# test different indenters separately to have smaller test chunks, that takes LONG
KTEXTEDITOR_INDENT_TEST ("testPython")
KTEXTEDITOR_INDENT_TEST ("testJulia")
KTEXTEDITOR_INDENT_TEST ("testCstyle")
KTEXTEDITOR_INDENT_TEST ("testCppstyle")
KTEXTEDITOR_INDENT_TEST ("testCMake")
KTEXTEDITOR_INDENT_TEST ("testRuby")
KTEXTEDITOR_INDENT_TEST ("testHaskell")
KTEXTEDITOR_INDENT_TEST ("testLatex")
KTEXTEDITOR_INDENT_TEST ("testPascal")
KTEXTEDITOR_INDENT_TEST ("testAda")
KTEXTEDITOR_INDENT_TEST ("testXml")
KTEXTEDITOR_INDENT_TEST ("testNormal")
KTEXTEDITOR_INDENT_TEST ("testReplicode")
add_test(
NAME scripts_test
COMMAND ktexteditor_script_tester
${CMAKE_CURRENT_SOURCE_DIR}/input/commands/
${CMAKE_CURRENT_SOURCE_DIR}/input/scripting/
)
macro(ktexteditor_unit_test_offscreen testname)
add_executable(${testname} src/${testname}.cpp ${ARGN})
target_link_libraries(${testname} ${KTEXTEDITOR_TEST_LINK_LIBS} Qt6::Test)
ecm_mark_as_test(${testname})
if(ENABLE_PCH)
target_precompile_headers(${testname} REUSE_FROM kte_test_pch)
endif()
ADD_TEST (NAME ${testname} COMMAND ${testname} ${OFFSCREEN_QPA})
endmacro()
ktexteditor_unit_test_offscreen(katetextbuffertest)
ktexteditor_unit_test_offscreen(range_test)
ktexteditor_unit_test_offscreen(cursorwords_test)
ktexteditor_unit_test_offscreen(undomanager_test)
ktexteditor_unit_test_offscreen(plaintextsearch_test)
ktexteditor_unit_test_offscreen(regexpsearch_test)
ktexteditor_unit_test_offscreen(scriptdocument_test)
ktexteditor_unit_test_offscreen(scripttester_test ../src/scripttester/scripttester.cpp)
ktexteditor_unit_test_offscreen(wordcompletiontest)
ktexteditor_unit_test_offscreen(searchbar_test)
ktexteditor_unit_test_offscreen(movingcursor_test)
ktexteditor_unit_test_offscreen(configinterface_test)
ktexteditor_unit_test_offscreen(kte_documentcursor)
ktexteditor_unit_test_offscreen(katedocument_test)
ktexteditor_unit_test_offscreen(movingrange_test)
ktexteditor_unit_test_offscreen(revision_test)
ktexteditor_unit_test_offscreen(modificationsystem_test)
ktexteditor_unit_test_offscreen(variable_test)
ktexteditor_unit_test_offscreen(templatehandler_test)
ktexteditor_unit_test_offscreen(evaluate_script_test)
ktexteditor_unit_test_offscreen(camelcursortest)
ktexteditor_unit_test_offscreen(encodingtest)
ktexteditor_unit_test_offscreen(indentdetect_test)
ktexteditor_unit_test_offscreen(multicursortest)
ktexteditor_unit_test_offscreen(katemodemanager_test src/katemodemanager_test_base.cpp)
ktexteditor_unit_test_offscreen(kateview_test)
ktexteditor_unit_test_offscreen(inlinenote_test)
ktexteditor_unit_test_offscreen(completion_test src/codecompletiontestmodel.cpp src/codecompletiontestmodels.cpp)
ktexteditor_unit_test_offscreen(bugs_test src/testutils.cpp)
ktexteditor_unit_test_offscreen(katefoldingtest)
ktexteditor_unit_test_offscreen(messagetest)
ktexteditor_unit_test_offscreen(swapfiletest)
add_subdirectory(src/vimode)
#
# benchmarks, don't execute during normal testing
# they don't test additional stuff but only hang the CI
#
add_executable(katemodemanager_benchmark src/katemodemanager_test_base.cpp src/katemodemanager_benchmark.cpp)
ecm_mark_nongui_executable(katemodemanager_benchmark)
add_test(NAME katemodemanager_benchmark COMMAND katemodemanager_benchmark CONFIGURATIONS BENCHMARK)
target_link_libraries(katemodemanager_benchmark ${KTEXTEDITOR_TEST_LINK_LIBS} Qt6::Test)
add_executable(bench_search src/benchmarks/bench_search.cpp)
target_link_libraries(bench_search PRIVATE ${KTEXTEDITOR_TEST_LINK_LIBS})
add_executable(example src/example.cpp)
target_link_libraries(example PRIVATE ${KTEXTEDITOR_TEST_LINK_LIBS})
@@ -0,0 +1,2 @@
DisableFormat: true
SortIncludes: false
@@ -0,0 +1 @@
actual
@@ -0,0 +1 @@
𝐽 a 𝐽a 𝐽𝐽 a𝐽 aa a𝐽a 𝐽a𝐽
@@ -0,0 +1,6 @@
int main()
{
int this_line_is_safe=1;
int that_line_will_cause_havoc=1;
}
@@ -0,0 +1,10 @@
view.setCursorPosition(0, 0);
var count = document.lines() - 3;
for (var i = 0; i < count; ++i)
moveLinesDown();
for (var i = 0; i < count; ++i)
moveLinesUp();
for (var i = 0; i < count; ++i)
moveLinesDown();
//for (var i = 0; i < count; ++i)
// moveLinesUp();
@@ -0,0 +1,503 @@
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXxx
@@ -0,0 +1,74 @@
/* This file is part of the KDE libraries
SPDX-FileCopyrightText: 1999 Jochen Wilhelmy <digisnap@cs.tu-berlin.de>
*/
//BEGIN includes
#include "kateview.h"
#include "kateview.moc"
//#define VIEW_RANGE_DEBUG
//END includes
void KateView::blockFix(KTextEditor::Range& range)
{
if (range.start().column() > range.end().column())
{
int tmp = range.start().column();
range.start().setColumn(range.end().column());
range.end().setColumn(tmp);
}
}
KateView::KateView( KateDocument *doc, QWidget *parent )
{
setComponentData ( KateGlobal::self()->componentData () );
// selection if for this view only and will invalidate if becoming empty
m_selection.setView (this);
// use z depth defined in moving ranges interface
m_selection.setZDepth (-100000.0);
KateGlobal::self()->registerView( this );
KTextEditor::ViewBarContainer *viewBarContainer=qobject_cast<KTextEditor::ViewBarContainer*>( KateGlobal::self()->container() );
QWidget *bottomBarParent=viewBarContainer?viewBarContainer->getViewBarParent(this,KTextEditor::ViewBarContainer::BottomBar):0;
QWidget *topBarParent=viewBarContainer?viewBarContainer->getViewBarParent(this,KTextEditor::ViewBarContainer::TopBar):0;
m_bottomViewBar=new KateViewBar (bottomBarParent!=0,KTextEditor::ViewBarContainer::BottomBar,bottomBarParent?bottomBarParent:this,this);
m_topViewBar=new KateViewBar (topBarParent!=0,KTextEditor::ViewBarContainer::TopBar,topBarParent?topBarParent:this,this);
// ugly workaround:
// Force the layout to be left-to-right even on RTL desktop, as discussed
// on the mailing list. This will cause the lines and icons panel to be on
// the left, even for Arabic/Hebrew/Farsi/whatever users.
setLayoutDirection ( Qt::LeftToRight );
// layouting ;)
m_vBox = new QVBoxLayout (this);
m_vBox->setContentsMargins(0, 0, 0, 0);
m_vBox->setSpacing (0);
// add top viewbar...
if (topBarParent)
viewBarContainer->addViewBarToLayout(this,m_topViewBar,KTextEditor::ViewBarContainer::TopBar);
else
m_vBox->addWidget(m_topViewBar);
m_bottomViewBar->installEventFilter(m_viewInternal);
// add KateMessageWidget for KTE::MessageInterface immediately above view
m_topMessageWidget = new KateMessageWidget(this);
m_vBox->addWidget(m_topMessageWidget);
m_topMessageWidget->hide();
// add hbox: KateIconBorder | KateViewInternal | KateScrollBar
QHBoxLayout *hbox = new QHBoxLayout ();
m_vBox->addLayout (hbox, 100);
hbox->setContentsMargins(0, 0, 0, 0);
hbox->setSpacing (0);
QStyleOption option;
option.initFrom(this);
if (style()->styleHint(QStyle::SH_ScrollView_FrameOnlyAroundContents, &option, this)) {
@@ -0,0 +1,190 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mime-info [
<!ELEMENT mime-info (mime-type)+>
<!ATTLIST mime-info xmlns CDATA #FIXED "http://www.freedesktop.org/standards/shared-mime-info">
<!ELEMENT mime-type (comment+, (acronym,expanded-acronym)? , (icon? | generic-icon? | glob | magic | treemagic | root-XML | alias | sub-class-of)*)>
<!ATTLIST mime-type type CDATA #REQUIRED>
<!-- a comment describing a document with the respective MIME type. Example: "WMV video" -->
<!ELEMENT comment (#PCDATA)>
<!ATTLIST comment xml:lang CDATA #IMPLIED>
<!-- a comment describing the respective unexpanded MIME type acronym. Example: "WMV" -->
<!ELEMENT acronym (#PCDATA)>
<!ATTLIST acronym xml:lang CDATA #IMPLIED>
<!-- a comment describing the respective expanded MIME type acronym. Example: "Windows Media Video" -->
<!ELEMENT expanded-acronym (#PCDATA)>
<!ATTLIST expanded-acronym xml:lang CDATA #IMPLIED>
<!ELEMENT icon EMPTY>
<!ATTLIST icon name CDATA #REQUIRED>
<!-- a generic icon name as per the Icon Naming Specification, only required if computing
it from the mime-type would not work, See "generic-icon" in the Shared Mime Specification -->
<!ELEMENT generic-icon EMPTY>
<!ATTLIST generic-icon name (application-x-executable|audio-x-generic|folder|font-x-generic|image-x-generic|package-x-generic|text-html|text-x-generic|text-x-generic-template|text-x-script|video-x-generic|x-office-address-book|x-office-calendar|x-office-document|x-office-presentation|x-office-spreadsheet) #REQUIRED>
<!ELEMENT glob EMPTY>
<!ATTLIST glob pattern CDATA #REQUIRED>
<!ATTLIST glob weight CDATA "50">
<!ATTLIST glob case-sensitive CDATA #IMPLIED>
<!ELEMENT magic (match)+>
<!ATTLIST magic priority CDATA "50">
<!ELEMENT match (match)*>
<!ATTLIST match offset CDATA #REQUIRED>
<!ATTLIST match type (string|big16|big32|little16|little32|host16|host32|byte) #REQUIRED>
<!ATTLIST match value CDATA #REQUIRED>
<!ATTLIST match mask CDATA #IMPLIED>
<!ELEMENT treemagic (treematch)+>
<!ATTLIST treemagic priority CDATA "50">
<!ELEMENT treematch (treematch)*>
<!ATTLIST treematch path CDATA #REQUIRED>
<!ATTLIST treematch type (file|directory|link) #IMPLIED>
<!ATTLIST treematch match-case (true|false) #IMPLIED>
<!ATTLIST treematch executable (true|false) #IMPLIED>
<!ATTLIST treematch non-empty (true|false) #IMPLIED>
<!ATTLIST treematch mimetype CDATA #IMPLIED>
<!ELEMENT root-XML EMPTY>
<!ATTLIST root-XML namespaceURI CDATA #REQUIRED>
<!ATTLIST root-XML localName CDATA #REQUIRED>
<!ELEMENT alias EMPTY>
<!ATTLIST alias type CDATA #REQUIRED>
<!ELEMENT sub-class-of EMPTY>
<!ATTLIST sub-class-of type CDATA #REQUIRED>
]>
<mime-info xmlns="http://www.freedesktop.org/standards/shared-mime-info">
<mime-type type="application/x-atari-2600-rom">
<comment>Atari 2600</comment>
<generic-icon name="application-x-executable"/>
<glob pattern="*.a26"/>
</mime-type>
<mime-type type="application/x-atari-7800-rom">
<comment>Atari 7800</comment>
<generic-icon name="application-x-executable"/>
<glob pattern="*.a78"/>
<magic>
<match value="ATARI7800" type="string" offset="1"/>
</magic>
</mime-type>
<mime-type type="application/andrew-inset">
<comment>ATK inset</comment><!-- bug 404713 - next line is double height and either overpaint the next one or is overpainted -->
<comment xml:lang="ar">شكل ATK</comment>
<comment xml:lang="be@latin">Ustaŭka ATK</comment>
<comment xml:lang="bg">Сбор — ATK</comment>
<comment xml:lang="ca">ATK inset</comment>
<comment xml:lang="cs">vložka ATK</comment>
<comment xml:lang="da">ATK-indsættelse</comment>
<comment xml:lang="de">ATK-Inset</comment>
<comment xml:lang="el">Ένθετο ATK</comment>
<comment xml:lang="en_GB">ATK inset</comment>
<comment xml:lang="es">inserción ATK</comment>
<comment xml:lang="eu">ATK sartzapena</comment>
<comment xml:lang="fi">ATK-osio</comment>
<comment xml:lang="fo">ATK innskot</comment>
<comment xml:lang="fr">encart ATK</comment>
<comment xml:lang="ga">intlis ATK</comment>
<comment xml:lang="gl">conxunto ATK</comment>
<comment xml:lang="he">תוספת ATK</comment>
<comment xml:lang="hr">ATK umetak</comment>
<comment xml:lang="hu">ATK betét</comment>
<comment xml:lang="ia">Folio intercalari ATK</comment>
<comment xml:lang="id">Inset ATK</comment>
<comment xml:lang="it">Inset ATK</comment>
<comment xml:lang="ja">ATK インセット</comment>
<comment xml:lang="kk">ATK беті</comment>
<comment xml:lang="ko">ATK inset</comment>
<comment xml:lang="lt">ATK inset</comment>
<comment xml:lang="lv">ATK ielaidums</comment>
<comment xml:lang="nb">ATK-innsats</comment>
<comment xml:lang="nl">ATK-invoegsel</comment>
<comment xml:lang="nn">ATK-innskot</comment>
<comment xml:lang="oc">encart ATK</comment>
<comment xml:lang="pl">Wstawka ATK</comment>
<comment xml:lang="pt">Suplemento ATK</comment>
<comment xml:lang="pt_BR">Conjunto de entrada do ATK</comment>
<comment xml:lang="ro">Inset ATK</comment>
<comment xml:lang="ru">вкладка ATK</comment>
<comment xml:lang="sk">Vložka ATK</comment>
<comment xml:lang="sl">Vložka ATK</comment>
<comment xml:lang="sq">Inset ATK</comment>
<comment xml:lang="sr">АТК уметак</comment>
<comment xml:lang="sv">ATK-inlägg</comment>
<comment xml:lang="tr">ATK iç metni</comment>
<comment xml:lang="uk">вкладка ATK</comment>
<comment xml:lang="vi">Bộ dát ATK</comment>
<comment xml:lang="zh_CN">ATK 嵌入对象</comment>
<comment xml:lang="zh_TW">ATK 內嵌</comment>
<acronym>ATK</acronym>
<expanded-acronym>Andrew Toolkit</expanded-acronym>
<generic-icon name="x-office-document"/>
<glob pattern="*.ez"/>
</mime-type>
<mime-type type="application/epub+zip">
<comment>electronic book document</comment><!-- bug 404713 - next line is double height and either overpaint the next one or is overpainted -->
<comment xml:lang="ar">مستند كتاب إلكتروني</comment>
<comment xml:lang="be@latin">elektronnaja kniha</comment>
<comment xml:lang="bg">Документ — електронна книга</comment>
<comment xml:lang="ca">document de llibre electrònic</comment>
<comment xml:lang="cs">dokument elektronické knihy</comment>
<comment xml:lang="da">elektronisk bogdokument</comment>
<comment xml:lang="de">Elektronisches Buch</comment>
<comment xml:lang="el">Έγγραφο ηλεκτρονικού βιβλίου</comment>
<comment xml:lang="en_GB">electronic book document</comment>
<comment xml:lang="es">documento de libro electrónico</comment>
<comment xml:lang="eu">liburu elektronikoaren dokumentua</comment>
<comment xml:lang="fi">elektroninen kirja</comment>
<comment xml:lang="fo">elektroniskbóka skjal</comment>
<comment xml:lang="fr">document livre électronique</comment>
<comment xml:lang="ga">leabhar leictreonach</comment>
<comment xml:lang="gl">documento de libro electrónico</comment>
<comment xml:lang="he">מסמך מסוג ספר אלקטרוני</comment>
<comment xml:lang="hr">dokument elektroničke knjige</comment>
<comment xml:lang="hu">elektronikus könyvdokumentum</comment>
<comment xml:lang="ia">Documento de libro electronic</comment>
<comment xml:lang="id">dokumen buku elektronik</comment>
<comment xml:lang="it">Documento libro elettronico</comment>
<comment xml:lang="ja">電子ブックドキュメント</comment>
<comment xml:lang="kk">электронды кітабы</comment>
<comment xml:lang="ko">전자책 문서</comment>
<comment xml:lang="lt">elektroninės knygos dokumentas</comment>
<comment xml:lang="lv">elektroniskās grāmatas dokuments</comment>
<comment xml:lang="nl">elektronisch boek</comment>
<comment xml:lang="nn">elektronisk bok-dokument</comment>
<comment xml:lang="oc">document libre electronic</comment>
<comment xml:lang="pl">Dokument książki elektronicznej</comment>
<comment xml:lang="pt">documento de livro eletrónico</comment>
<comment xml:lang="pt_BR">Documento de livro eletrônico</comment>
<comment xml:lang="ro">document carte electronică</comment>
<comment xml:lang="ru">электронная книга</comment>
<comment xml:lang="sk">Dokument elektronickej knihy</comment>
<comment xml:lang="sl">dokument elektronske knjige</comment>
<comment xml:lang="sq">Dokument libri elektronik</comment>
<comment xml:lang="sr">документ електронске књиге</comment>
<comment xml:lang="sv">elektroniskt bokdokument</comment>
<comment xml:lang="tr">elektronik kitap belgesi</comment>
<comment xml:lang="uk">документ електронної книги</comment>
<comment xml:lang="vi">tài liệu cuốn sách điện tử</comment>
<comment xml:lang="zh_CN">电子书文档</comment>
<comment xml:lang="zh_TW">電子書文件</comment>
<sub-class-of type="application/zip"/>
<generic-icon name="x-office-document"/>
<magic priority="70">
<match value="PK\003\004" type="string" offset="0">
<match value="mimetype" type="string" offset="30">
<match value="application/epub+zip" type="string" offset="38"/>
<match value="application/epub+zip" type="string" offset="43"/>
</match>
</match>
</magic>
<glob pattern="*.epub"/>
</mime-type>
</mime-info>
@@ -0,0 +1,336 @@
loadScript(":/ktexteditor/script/commands/utils.js");
testCase("alignon", () => {
withInput( ' - foobar: lala, lili, lolo, lulu\n'
+ '- baz: a, b, c, d\n'
+ ' - quux: this, is, an, automated test\n'
+ 'x - hello: world!', () => {
cmd(fn(view.alignOn, fn(document.documentRange))
, ' - foobar: lala, lili, lolo, lulu\n'
+ ' - baz: a, b, c, d\n'
+ ' - quux: this, is, an, automated test\n'
+ ' x - hello: world!');
cmd(fn(view.alignOn, fn(document.documentRange), '-')
, ' - foobar: lala, lili, lolo, lulu\n'
+ ' - baz: a, b, c, d\n'
+ ' - quux: this, is, an, automated test\n'
+ 'x - hello: world!');
});
sequence(REUSE_LAST_EXPECTED_OUTPUT, () => {
cmd(fn(view.alignOn, fn(document.documentRange), ':\\s(.)')
, ' - foobar: lala, lili, lolo, lulu\n'
+ ' - baz: a, b, c, d\n'
+ ' - quux: this, is, an, automated test\n'
+ 'x - hello: world!');
config({blockSelection: true});
cmd(fn(view.alignOn, new Range(1, 14, 2, 30), ',\\s(.)')
, ' - foobar: lala, lili, lolo, lulu\n'
+ ' - baz: a, b, c, d\n'
+ ' - quux: this, is, an, automated test\n'
+ 'x - hello: world!');
cmd(fn(view.alignOn, new Range(1, 19, 2, 30), ',\\s(.)')
, ' - foobar: lala, lili, lolo, lulu\n'
+ ' - baz: a, b, c, d\n'
+ ' - quux: this, is, an, automated test\n'
+ 'x - hello: world!');
cmd(fn(view.alignOn, new Range(1, 24, 2, 30), ',\\s(.)')
, ' - foobar: lala, lili, lolo, lulu\n'
+ ' - baz: a, b, c, d\n'
+ ' - quux: this, is, an, automated test\n'
+ 'x - hello: world!');
})
});
testCase("block_selection", () => {
config({blockSelection: true});
sequence( 'abc[defghijklm\n'
+ 'nopqrs]tuvwxyz\n', () => {
cmd(view.removeSelectedText
, 'abc|[ghijklm\n'
+ 'nop]tuvwxyz\n');
type("PASS"
, 'abcPASS|[ghijklm\n'
+ 'nopPASS]tuvwxyz\n');
})
});
testCase("moveLinesDown", () => {
config({blockSelection: false});
sequence( '1|\n2\n3', () => {
cmd(moveLinesDown, '2\n1|\n3');
// bug_309977
cmd(moveLinesDown, '2\n3\n1|', "Tests if it is possible to move a line to the last line of the document (if the last line is empty).");
cmd(moveLinesDown, '2\n3\n1|');
});
sequence( '1|\n2\n3\n', () => {
cmd(moveLinesDown, '2\n1|\n3\n');
cmd(moveLinesDown, '2\n3\n1|\n');
cmd(moveLinesDown, '2\n3\n\n1|');
cmd(moveLinesDown, '2\n3\n\n1|');
});
sequence( '|1\n2\n3\n', () => {
cmd(moveLinesDown, '2\n|1\n3\n');
cmd(moveLinesDown, '2\n3\n|1\n');
// bug_309977
cmd(moveLinesDown, '2\n3\n\n|1');
cmd(moveLinesDown, '2\n3\n\n|1');
});
sequence( '[1]\n2\n3', () => {
cmd(moveLinesDown, '2\n[1]\n3');
cmd(moveLinesDown, '2\n3\n[1]');
cmd(moveLinesDown, '2\n3\n[1]');
});
// bug_309978
sequence( '[1]\n2\n3\n', () => {
cmd(moveLinesDown, '2\n[1]\n3\n');
cmd(moveLinesDown, '2\n3\n[1]\n');
cmd(moveLinesDown, '2\n3\n\n[1]');
cmd(moveLinesDown, '2\n3\n\n[1]');
});
sequence( '[1\n]2\n3', () => {
cmd(moveLinesDown, '2\n[1\n]3');
cmd(moveLinesDown, '2\n3\n[1]');
cmd(moveLinesDown, '2\n3\n[1]');
});
sequence( '[1\n]2\n3\n', () => {
cmd(moveLinesDown, '2\n[1\n]3\n');
cmd(moveLinesDown, '2\n3\n[1\n]');
cmd(moveLinesDown, '2\n3\n\n[1]');
cmd(moveLinesDown, '2\n3\n\n[1]');
});
sequence( '1[\n]2\n3', () => {
cmd(moveLinesDown, '2\n1[\n]3');
cmd(moveLinesDown, '2\n3\n1[]'); // TODO empty selection !
cmd(moveLinesDown, '2\n3\n1|'); // empty selection is ignored in input...
cmd(moveLinesDown, '2\n3\n1|');
});
xcmd(moveLinesDown, '2\n1[\n]3', '2\n3\n1|'); // see above
sequence( '1[\n]2\n3\n', () => {
cmd(moveLinesDown, '2\n1[\n]3\n');
cmd(moveLinesDown, '2\n3\n1[\n]');
cmd(moveLinesDown, '2\n3\n\n1[]'); // TODO empty selection !
cmd(moveLinesDown, '2\n3\n\n1|'); // empty selection is ignored in input...
cmd(moveLinesDown, '2\n3\n\n1|');
});
xcmd(moveLinesDown, '2\n3\n1[\n]', '2\n3\n\n1|'); // see above
sequence( '[1\n2]\n3\n', () => {
cmd(moveLinesDown, '3\n[1\n2]\n');
cmd(moveLinesDown, '3\n\n[1\n2]');
cmd(moveLinesDown, '3\n\n[1\n2]');
});
sequence( '1[S]\n2\n3\n', () => {
cmd(moveLinesDown, '2\n1[S]\n3\n');
cmd(moveLinesDown, '2\n3\n1[S]\n');
cmd(moveLinesDown, '2\n3\n\n1[S]');
cmd(moveLinesDown, '2\n3\n\n1[S]');
});
});
testCase("moveLinesUp", () => {
config({blockSelection: false});
sequence( '2\n3\n1|', () => {
cmd(moveLinesUp, '2\n1|\n3');
cmd(moveLinesUp, '1|\n2\n3');
cmd(moveLinesUp, '1|\n2\n3');
});
sequence( '2\n3\n1|\n', () => {
cmd(moveLinesUp, '2\n1|\n3\n');
cmd(moveLinesUp, '1|\n2\n3\n');
cmd(moveLinesUp, '1|\n2\n3\n');
});
sequence( '2\n3\n|1', () => {
cmd(moveLinesUp, '2\n|1\n3');
cmd(moveLinesUp, '|1\n2\n3');
cmd(moveLinesUp, '|1\n2\n3');
});
sequence( '2\n3\n|1\n', () => {
cmd(moveLinesUp, '2\n|1\n3\n');
cmd(moveLinesUp, '|1\n2\n3\n');
cmd(moveLinesUp, '|1\n2\n3\n');
});
sequence( '2\n3\n[1]', () => {
cmd(moveLinesUp, '2\n[1]\n3');
cmd(moveLinesUp, '[1]\n2\n3');
cmd(moveLinesUp, '[1]\n2\n3');
});
sequence( '2\n3\n[1]\n', () => {
cmd(moveLinesUp, '2\n[1]\n3\n');
cmd(moveLinesUp, '[1]\n2\n3\n');
cmd(moveLinesUp, '[1]\n2\n3\n');
});
sequence( '2\n3[\n1]', () => {
cmd(moveLinesUp, '3[\n1]\n2');
cmd(moveLinesUp, '3[\n1]\n2');
});
sequence( '2\n3[\n1]\n', () => {
cmd(moveLinesUp, '3[\n1]\n2\n');
cmd(moveLinesUp, '3[\n1]\n2\n');
});
sequence( '2\n3\n[1\n]', () => {
cmd(moveLinesUp, '2\n[1\n]3\n');
cmd(moveLinesUp, '[1\n]2\n3\n');
cmd(moveLinesUp, '[1\n]2\n3\n');
});
sequence( '2\n1[\n]3', () => {
cmd(moveLinesUp, '1[\n]2\n3');
cmd(moveLinesUp, '1[\n]2\n3');
});
sequence( '2\n1\n3[\n]', () => {
cmd(moveLinesUp, '2\n3[\n]1\n');
cmd(moveLinesUp, '3[\n]2\n1\n');
cmd(moveLinesUp, '3[\n]2\n1\n');
});
sequence( '3\n\n[1\n2]', () => {
cmd(moveLinesUp, '3\n[1\n2]\n');
cmd(moveLinesUp, '[1\n2]\n3\n');
cmd(moveLinesUp, '[1\n2]\n3\n');
});
sequence( '2\n3\n\n1[S]', () => {
cmd(moveLinesUp, '2\n3\n1[S]\n');
cmd(moveLinesUp, '2\n1[S]\n3\n');
cmd(moveLinesUp, '1[S]\n2\n3\n');
cmd(moveLinesUp, '1[S]\n2\n3\n');
});
});
testCase("duplicateLinesDown", () => {
for (const [input, expectedOutput] of [
['|[1]\n2', '1\n|[1]\n2'],
['|[1]\n2\n', '1\n|[1]\n2\n'],
['|[1]\n2\n3', '1\n|[1]\n2\n3'],
['[1]|\n2', '1\n[1]|\n2'],
['[1]|\n2\n', '1\n[1]|\n2\n'],
['[1]|\n2\n3', '1\n[1]|\n2\n3'],
['1\n|[2]', '1\n2\n|[2]'],
['1\n|[2]\n', '1\n2\n|[2]\n'],
['1\n|[2]\n3', '1\n2\n|[2]\n3'],
['1\n[2]|', '1\n2\n[2]|'],
['1\n[2]|\n', '1\n2\n[2]|\n'],
['1\n[2]|S', '1\n2S\n[2]|S'],
['1\n[2]|S\n', '1\n2S\n[2]|S\n'],
['1\n[2]|S\n3', '1\n2S\n[2]|S\n3'],
['1\n2|[S]', '1\n2S\n2|[S]'],
['1\n2|[S]\n', '1\n2S\n2|[S]\n'],
['1\n2|[S]\n3', '1\n2S\n2|[S]\n3'],
]) {
cmd(duplicateLinesDown, input, expectedOutput);
cmd(duplicateLinesDown,
input.replace('[', '').replace(']', ''),
expectedOutput.replace('[', '').replace(']', ''));
}
cmd(duplicateLinesDown, '[1\n]\n2', '1\n[1\n]\n2');
cmd(duplicateLinesDown, '[1\n\n]2', '1\n\n[1\n\n]2');
cmd(duplicateLinesDown, '[1\n\n2]', '1\n\n2\n[1\n\n2]');
cmd(duplicateLinesDown, '[1\n]\n2\n', '1\n[1\n]\n2\n');
cmd(duplicateLinesDown, '[1\n\n]2\n', '1\n\n[1\n\n]2\n');
cmd(duplicateLinesDown, '[1\n\n2]\n', '1\n\n2\n[1\n\n2]\n');
cmd(duplicateLinesDown, '[1\n\n2\n]', '1\n\n2\n[1\n\n2\n]');
cmd(duplicateLinesDown, '1\n[2\n]3\n', '1\n2\n[2\n]3\n');
cmd(duplicateLinesDown, '1[\n]\n2', '1\n1[\n]\n2');
cmd(duplicateLinesDown, '1[\n\n]2', '1\n\n1[\n\n]2');
cmd(duplicateLinesDown, '1[\n\n2]', '1\n\n2\n1[\n\n2]');
cmd(duplicateLinesDown, '1[\n]\n2\n', '1\n1[\n]\n2\n');
cmd(duplicateLinesDown, '1[\n\n]2\n', '1\n\n1[\n\n]2\n');
cmd(duplicateLinesDown, '1[\n\n2]\n', '1\n\n2\n1[\n\n2]\n');
cmd(duplicateLinesDown, '1[\n\n2\n]', '1\n\n2\n1[\n\n2\n]');
cmd(duplicateLinesDown, '1[\n2]\n3\n', '1\n2\n1[\n2]\n3\n');
cmd(duplicateLinesDown, '[1\n2\n3]\n4\n', '1\n2\n3\n[1\n2\n3]\n4\n');
cmd(duplicateLinesDown, '[1\n2\n3\n]4\n', '1\n2\n3\n[1\n2\n3\n]4\n');
});
testCase("duplicateLinesUp", () => {
for (const [input, expectedOutput] of [
['|[1]\n2', '|[1]\n1\n2'],
['|[1]\n2\n', '|[1]\n1\n2\n'],
['|[1]\n2\n3', '|[1]\n1\n2\n3'],
['[1]|\n2', '[1]|\n1\n2'],
['[1]|\n2\n', '[1]|\n1\n2\n'],
['[1]|\n2\n3', '[1]|\n1\n2\n3'],
['1\n|[2]', '1\n|[2]\n2'],
['1\n|[2]\n', '1\n|[2]\n2\n'],
['1\n|[2]\n3', '1\n|[2]\n2\n3'],
['1\n[2]|', '1\n[2]|\n2'],
['1\n[2]|\n', '1\n[2]|\n2\n'],
['1\n[2]|S', '1\n[2]|S\n2S'],
['1\n[2]|S\n', '1\n[2]|S\n2S\n'],
['1\n[2]|S\n3', '1\n[2]|S\n2S\n3'],
['1\n2|[S]', '1\n2|[S]\n2S'],
['1\n2|[S]\n', '1\n2|[S]\n2S\n'],
['1\n2|[S]\n3', '1\n2|[S]\n2S\n3'],
]) {
cmd(duplicateLinesUp, input, expectedOutput);
cmd(duplicateLinesUp,
input.replace('[', '').replace(']', ''),
expectedOutput.replace('[', '').replace(']', ''));
}
cmd(duplicateLinesUp, '[1\n]\n2', '[1\n]1\n\n2');
cmd(duplicateLinesUp, '[1\n\n]2', '[1\n\n]1\n\n2');
cmd(duplicateLinesUp, '[1\n\n2]', '[1\n\n2]\n1\n\n2');
cmd(duplicateLinesUp, '[1\n]\n2\n', '[1\n]1\n\n2\n');
cmd(duplicateLinesUp, '[1\n\n]2\n', '[1\n\n]1\n\n2\n');
cmd(duplicateLinesUp, '[1\n\n2]\n', '[1\n\n2]\n1\n\n2\n');
cmd(duplicateLinesUp, '[1\n\n2\n]', '[1\n\n2\n]1\n\n2\n');
cmd(duplicateLinesUp, '1\n[2\n]3\n', '1\n[2\n]2\n3\n');
cmd(duplicateLinesUp, '1[\n]\n2', '1[\n]1\n\n2');
cmd(duplicateLinesUp, '1[\n\n]2', '1[\n\n]1\n\n2');
cmd(duplicateLinesUp, '1[\n\n2]', '1[\n\n2]\n1\n\n2');
cmd(duplicateLinesUp, '1[\n]\n2\n', '1[\n]1\n\n2\n');
cmd(duplicateLinesUp, '1[\n\n]2\n', '1[\n\n]1\n\n2\n');
cmd(duplicateLinesUp, '1[\n\n2]\n', '1[\n\n2]\n1\n\n2\n');
cmd(duplicateLinesUp, '1[\n\n2\n]', '1[\n\n2\n]1\n\n2\n');
cmd(duplicateLinesUp, '1[\n2]\n3\n', '1[\n2]\n1\n2\n3\n');
cmd(duplicateLinesUp, '[1\n2\n3]\n4\n', '[1\n2\n3]\n1\n2\n3\n4\n');
cmd(duplicateLinesUp, '[1\n2\n3\n]4\n', '[1\n2\n3\n]1\n2\n3\n4\n');
});
@@ -0,0 +1,2 @@
Testing
Òåñòîâûé òåêñò ðàç äâà òðè
@@ -0,0 +1,2 @@
Testing
Тестовый текст раз два три
@@ -0,0 +1,2 @@
Testing
τΕΣΤΟΧΩΚ ΤΕΛΣΤ ΑΪ ΔΧΑ ΤΙ
@@ -0,0 +1,7 @@
Test
Straße
Christoph
Äußerung
Überall
Köhler
$perlvar
@@ -0,0 +1,7 @@
Test
Straße
Christoph
Äußerung
Überall
Köhler
$perlvar
@@ -0,0 +1 @@
kate: indent-mode r; replace-tabs true; indent-width 4; dynamic-word-wrap off; hl R Script; remove-trailing-spaces off;
@@ -0,0 +1,3 @@
v.setCursorPosition(0,5);
v.enter();
v.type("text");
@@ -0,0 +1,3 @@
v.setCursorPosition(1,8);
v.enter();
v.type(")");
@@ -0,0 +1,5 @@
tmp <-
Thisisaverylongvariablename
test <- NA
test <- 'String'
@@ -0,0 +1,8 @@
v.setCursorPosition(0,6);
v.enter();
v.type("Thisisaverylongvariablename");
v.enter();
v.type("test <- NA");
v.enter();
v.type("test <- 'String'");
v.enter();
@@ -0,0 +1,3 @@
plot(y ~ x,
data = data)
somevariable
@@ -0,0 +1,6 @@
v.setCursorPosition(0,11);
v.enter();
v.type("data = data");
v.setCursorPosition(1,17);
v.enter();
v.type("somevariable");
@@ -0,0 +1,4 @@
lm(Response ~ Var1 +
Var2 +
Var3,
anotherargument
@@ -0,0 +1,7 @@
v.setCursorPosition(0,20);
v.enter();
v.type("Var2 +")
v.enter();
v.type("Var3,")
v.enter();
v.type("anotherargument")
@@ -0,0 +1 @@
lm(Response ~ Var1 +
@@ -0,0 +1,4 @@
ggplot(data = data) +
geom_line(aes(x = something, y = otherstuff)) +
coord_flip()
@@ -0,0 +1,6 @@
v.setCursorPosition(0,21);
v.enter();
v.type("geom_line(aes(x = something, y = otherstuff)) +");
v.enter();
v.type("coord_flip()");
v.enter();
@@ -0,0 +1 @@
ggplot(data = data) +
@@ -0,0 +1,5 @@
if(1) {
ggplot(data = data) +
geom_line(aes(x = something, y = otherstuff)) +
coord_flip()
}
@@ -0,0 +1,2 @@
v.setCursorPosition(1, 4);
v.paste("ggplot(data = data) +\n geom_line(aes(x = something, y = otherstuff)) +\n coord_flip()");
@@ -0,0 +1,6 @@
if(1) {
mult <- function(a,b) {
a*b
}
}
@@ -0,0 +1,2 @@
v.setCursorPosition(1, 4);
v.paste("mult <- function(a,b) {\n a*b\n\n}");
@@ -0,0 +1,6 @@
data %>%
select(-Column) %>%
#filter(ID == "id2") %>%
gather() %>%
drop_na()
@@ -0,0 +1,4 @@
v.setCursorPosition(3,16);
v.enter();
v.type("drop_na()");
v.enter();
@@ -0,0 +1,4 @@
data %>%
select(-Column) %>%
#filter(ID == "id2") %>%
gather() %>%
@@ -0,0 +1,2 @@
kate: replace-tabs on; remove-trailing-spaces all;
kate: hl ada; indent-mode ada; indent-width 3;
@@ -0,0 +1,4 @@
begin
f(
arg1
)
@@ -0,0 +1,5 @@
v.setCursorPosition(2,d.lineLength(2));
v.enter();
v.type(")");
@@ -0,0 +1,3 @@
begin
f(
arg1
@@ -0,0 +1,628 @@
--
--
--
with text_io;
use text_io;
with Ada.Integer_Text_IO;
use Ada.Integer_Text_IO;
package Package_With_Private is
type Private_Type is private;
private
type Private_Type is array (1 .. 10) of Integer;
end Package_With_Private;
procedure Range_1( i : integer ); -- forward declaration
Block_Name : -- CHECK: block labels are handled sensibly
declare
A_Variable : The_Type;
begin
Use A_Variable
end Block_Name;
generic
Max: Positive;
type Element_T is private;
package Generic_Stack is
procedure Push (E: Element_T);
function Pop return Element_T;
end Generic_Stack;
procedure Generic_Swap is
generic
type Item is private;
procedure Exchange(X, Y: in out Item);
procedure Exchange(X, Y: in out Item) is
Temp: Item;
begin
Temp := X;
Result.Elements (i, Result.Elements'Last (2))
:= 3 + Right.Elements (i);
a := long_expression
+ another_long_expression; -- CHECK: this should be indented
func
( a,
b
);
Y := func
( a,
b
);
Y :=
func
( a,
b
);
end;
A, B : Integer;
procedure Swap is new Exchange(integer);
begin
A := 1;
B := 2;
Swap(A,B);
Ada.Float_Text_IO.put -- Float literal
(Item => gamma(i), Fore => 1, Aft => 1, Exp => 0);
new_line;
Ada.Float_Text_IO.put( -- Float literal
Item => gamma(i), Fore => 1, Aft => 1, Exp => 0);
new_line;
return( a+b );
return(
a+b );
return
( a
+b);
end Generic_Swap;
function SUBSTRING (DSTR: DYN_STRING; -- this is a forward reference
START : natural;
LENGTH : natural := 0)
return DYN_STRING;
function SUBSTRING (DSTR: DYN_STRING;
LENGTH : natural := 0)
return DYN_STRING is
DS: DYN_STRING;
L : natural := LENGTH;
type Degrees is new Float range -273.15 .. Float'Last;
Temperature : Degrees;
type Car is record
Identity : Long_Long_Integer;
Number_Wheels : Positive range 1 .. 10;
Paint : Color;
Horse_Power_kW : Float range 0.0 .. 2_000.0;
Consumption : Float range 0.0 .. 100.0;
end record;
BMW : Car :=
(Identity => 2007_752_83992434,
Number_Wheels => 5,
Horse_Power_kW => 190.0,
Consumption => 10.1,
Paint => Blue);
type Directions is (North, South, East, West);
Heading : Directions;
begin
put_line("It works!");
case long_expression
+ Another_long_expression is
when 89 ==>
s1;
s2;
<<lab>> -- CHECK: label should be aligned with begin
#
when 1 =>
Walk_The_Dog;
when 16#5# ==>
a := 5;
a := 9;
f(18);
s1;
#include "fred"
when 5 =>
case Heading is
when North =>
Y := Y + 1;
when South =>
Y := Y - 1;
when East =>
X := X + 1;
when West =>
X := X - 1;
end case;
when 8 | 10 =>
Sell_All_Stock;
when others =>
if Temperature >= 40.0 then
Put_Line ("Wow!");
Put_Line ("It's extremely hot");
elsif Temperature >= 30.0 then
Put_Line ("It's hot");
elsif Temperature >= 20.0 then
Put_Line ("It's warm");
elsif Temperature >= 10.0 then
Put_Line ("It's cool");
elsif Temperature >= 0.0 then
Put_Line ("It's cold");
else
Put_Line ("It's freezing");
end if;
end case;
DS3.DATA(1..DS3.SIZE):= DS1.DATA(1..DS1.SIZE)
& DS2.DATA(1..DS2.SIZE);
return DS3; -- CHECK: should align with DS3 above
end main;
procedure Quadratic_Equation
(A, B, C : Float; -- By default it is "in".
R1, R2 : out Float;
Valid : out Boolean)
is
Z : Float;
type Discriminated_Record (Size : Natural) is
record
A : String (1 .. Size);
B : Integer;
end record;
begin
Z := B**2 - 4.0 * A * C;
if At_Location > In_Text'Last
or else At_Location + Pattern'Length - 1 >
In_Text'Last
or else Slided_Text_T (In_Text (
At_Location .. At_Location + Pattern'Length - 1)) /=
Slided_Pattern
then
Valid := False; -- Being out parameter, it should be modified at least once.
R1 := 0.0;
R2 := 0.0;
<<lab>>
else
Valid := True;
R1 := (-B + Sqrt (Z)) / (2.0 * A);
R2 := (-B - Sqrt (Z)) / (2.0 * A);
end if;
end Quadratic_Equation;
procedure Error_Handling_4 is
Float_Error : exception;
type DEVICE is (PRINTER, DISK, DRUM);
type STATE is (OPEN, CLOSED);
type PERIPHERAL(UNIT : DEVICE := DISK) is
record
STATUS : STATE;
case UNIT is
when PRINTER =>
LINE_COUNT : INTEGER range 1 .. PAGE_SIZE;
when others =>
CYLINDER : CYLINDER_INDEX;
TRACK : TRACK_NUMBER;
end case;
end record;
function Square_Root (X : in Float) return Float is
use Ada.Numerics.Elementary_Functions;
begin
if (X < 0.0) then
raise Float_Error;
else
return Sqrt (X);
end if;
end Square_Root;
begin
begin
C := Square_Root (A ** 2 + B ** 2);
T_IO.Put ("C is ");
F_IO.Put
(Item => C,
Fore => (F_IO.Default_Fore +
1 ),
Aft => F_IO.Default_Aft,
Exp => F_IO.Default_Exp);
exception
when Constraint_Error =>
T_IO.Put ("C cannot be calculated!");
end;
return;
end Error_Handling_4;
procedure Range_1 is
type Range_Type is range -5 .. 10;
Default_String : constant String := "This is the long string returned by" &
" default. It is broken into multiple" &
" Ada source lines for convenience.";
Another_Default_String : constant String :=
"This is the long string returned by" &
" default. It is broken into multiple" &
" Ada source lines for convenience.";
type Op_Codes_In_Column is
( Push,
Pop,
Add );
package T_IO renames Ada.Text_IO;
package I_IO is
new Ada.Text_IO.Integer_IO (Range_Type);
a: real;
begin
for A in Range_Type loop
I_IO.Put (Item => A,
Width => 3, -- CHECK: params should line up
Base => 10);
if A < Range_Type'Last then
Process_Each_Page:
loop
declare
package Float_100_Stack is new Generic_Stack (100, Float);
use Float_100_Stack;
begin
Push (45.8);
end;
Process_All_The_Lines_On_This_Page:
loop
s1;
exit Process_All_The_Lines_On_This_Page when Line_Number = Max_Lines_On_Page;
s2;
Look_For_Sentinel_Value:
loop
s3;
exit Look_For_Sentinel_Value when Current_Symbol = Sentinel;
s4;
end loop Look_For_Sentinel_Value;
s5;
end loop Process_All_The_Lines_On_This_Page;
s6;
exit Process_Each_Page when Page_Number = Maximum_Pages;
s7;
end loop Process_Each_Page;
else
T_IO.New_Line;
-- comment below scans back to here !!??
for I in A'Range (1) loop
for J in A'Range (2) loop
Sum := 0.0;
for R in A'Range (2) loop
Sum := Sum + A.all (I, R) * B.all (R, J);
end loop;
C.all (I, J) := Sum +
second_part_of_long_expression +
third_part_of_long_expression;
if Input_Found then
Count_Characters;
else --not Input_Found
Reset_State;
Character_Total :=
First_Part_Total * First_Part_Scale_Factor +
Second_Part_Total * Second_Part_Scale_Factor +
Default_String'Length + Delimiter_Size;
end if;
end loop;
end loop;
end if;
end loop;
end Range_1;
-- generic instantiation -- TODO: wrong, ...
-- ... statementIndent() scans back to for R in A'Range ... ??? ...
-- ... because it skips over the ends
package Day_Of_Month_IO is -- TODO: scans back to beginning of file: generic? should have stopped at 'procedure'
new Ada.Text_IO.Integer_IO (Day_Of_Month);
procedure f;
-- CHECK: these should be recognised as forward procedures ...
procedure Day_Of (Day, Month, Year : in Integer;
Result : out Integer);
procedure x;
procedure x1;
procedure TRAVERSE_TREE;
procedure INCREMENT(X : in out INTEGER);
procedure RIGHT_INDENT(MARGIN : out LINE_SIZE); -- see 3.5.4
procedure SWITCH(FROM, TO : in out LINK); -- see 3.8.1
function RANDOM return PROBABILITY; -- see 3.5.7
function MIN_CELL(X : LINK) return CELL; -- see 3.8.1
function NEXT_FRAME(K : POSITIVE) return FRAME; -- see 3.8
function DOT_PRODUCT(LEFT,RIGHT: VECTOR) return REAL; -- see 3.6
function "*"(LEFT,RIGHT : MATRIX) return MATRIX; -- see 3.6
procedure Nesting is
procedure Triple is
procedure Second_Layer(Persistence : in out Persistence_View;
Stream : not null access Root_Stream_Type'Class)
is
procedure Bottom_Layer is
begin
Put_Line("This is the Bottom Layer talking.");
Do_Something;
if Test then
goto Exit_Use_Goto;
end if;
Do_Something_Else;
<<Label>>
<<Exit_Use_Goto>> -- CHECK: should align with 'begin'
return;
end Bottom_Layer;
begin -- Second_Layer
Put_Line("This is the Second Layer talking.");
Bottom_Layer;
<<Exit_Use_Goto>> -- CHECK: should align with 'begin'
Put_Line("We are back up to the Second Layer.");
end Second_Layer;
begin -- Triple
Put_Line("This is procedure Triple talking to you.");
Second_Layer;
Put_Line("We are back up to the procedure named Triple.");
end Triple;
begin -- Nesting
Put_Line("Start the triple nesting here.");
Triple;
Put_Line("Finished, and back to the top level.");
end Nesting;
procedure Proced3 is
Dogs, Cats, Animals : INTEGER;
-- This is a procedure specification
procedure Total_Number_Of_Animals(Variety1 : in INTEGER;
Variety2 : in INTEGER;
Total : out INTEGER);
-- This is a procedure body
procedure Total_Number_Of_Animals(Variety1 : in INTEGER;
Variety2 : in INTEGER;
Total : out INTEGER) is
begin
Total := Variety1 + Variety2;
end Total_Number_Of_Animals;
begin
Dogs := 3;
Cats := 4;
if some_condition
or some_other_condition
or yet_another_condition
then
action( a,
b+c,
c + d
+ e +f +g, -- would be nice if this was indented
);
end if;
Total_Number_Of_Animals(Dogs, Cats, Animals);
Put("The total number of animals is");
Put(Animals, 3);
if cond then
while c loop
for i in integer -- multiline for loop
range 1..1000
loop
a := long_expression
+ long_expression
+ long_expression;
a(i) := 10;
end loop;
a := long_expression
+ long_expression
+ long_expression;
while x > 0
and x <= 100
loop -- CHECK: not indented
loop -- CHECK: indented
a := q1 +
q2 +
q3;
end loop;
end loop;
while x > 0 loop
loop -- forever loop
aaaaaaa :=
q1 +
q2 +
q3;
end loop;
end loop;
end loop;
end loop;
fredzarmplezzzzzzzzzzzz( arg1,
arg1,
arg2,
arg3
);
x := f(a) + f(b);
fffffffffffff( func0( func1( func2( f3( arg1,
arg2,
arg3,
arg4
),
a1, -- should be aligned with arg f3, not '('
a2,
a3,
a4
),
aa2,
aa3,
aa4,
aa5
),
bb1,
bb2,
bb3,
bb4
),
cc1,
cc2,
cc3,
cc4
);
s1;
end if;
New_Line;
end Proced3;
procedure Main is
task Sub is
entry Wake_Up(I: Integer);
end Sub;
task body Sub is
Stop: Boolean := False;
begin
while not Stop loop
Put("Sub: Wait"); New_Line(1);
accept Wake_Up(I: Integer) do
Put("Sub: "); Put(I); New_Line(1);
if I = 0 then
Stop := True;
end if;
end Wake_Up;
end loop;
Put("Sub: Stop"); New_Line(1);
end Sub;
begin
Extract_Publisher:
for Index in Base_11_Digits (Item.Country + 1) ..
Base_11_Digits (Item.Publisher) loop
declare
Digit : constant Natural range 0 .. 9
:= Natural (Item.Number (Index));
Power : constant Natural range 0 .. 9
:= Item.Publisher - Natural (Index);
begin
Publisher := Publisher + Digit * (10 ** Power);
end;
end loop Extract_Publisher; -- CHECK: matches 'for' above
Put("Main: Stop"); New_Line(1);
declare
begin
end;
if c
and c2
then
s1;
for i in a'range
loop
loop
s12;
s13;
end lop;
end loop;
elsif c05
or c06
then
s12;
elsif c1 then
s2;
else
s3;
a12 :=
f(13);
end if;
end;
end;
package Utilities is
generic
type Item is private;
procedure Swap(L, R : in out Item);
-- A handy package at the project-specific level
-- A constrained generic formal parameter
generic
type Item is (<>);
function Next (Data : Item) return Item;
-- A discrete type generic formal parameter
generic
type Item is (<>);
-- A discrete type generic formal parameter
function Prev (Data : Item) return Item;
-- more generic subprograms as appropriate to your particular project needs
end Utilities;
// kate: line-numbers true; indent-width 3; replace-tabs on
// kate: debugMode off
@@ -0,0 +1,8 @@
v.setCursorPosition(0,0);
v.selectAll();
var r = v.selection();
if( r.isValid() ) {
v.align( r );
}
@@ -0,0 +1,628 @@
--
--
--
with text_io;
use text_io;
with Ada.Integer_Text_IO;
use Ada.Integer_Text_IO;
package Package_With_Private is
type Private_Type is private;
private
type Private_Type is array (1 .. 10) of Integer;
end Package_With_Private;
procedure Range_1( i : integer ); -- forward declaration
Block_Name : -- CHECK: block labels are handled sensibly
declare
A_Variable : The_Type;
begin
Use A_Variable
end Block_Name;
generic
Max: Positive;
type Element_T is private;
package Generic_Stack is
procedure Push (E: Element_T);
function Pop return Element_T;
end Generic_Stack;
procedure Generic_Swap is
generic
type Item is private;
procedure Exchange(X, Y: in out Item);
procedure Exchange(X, Y: in out Item) is
Temp: Item;
begin
Temp := X;
Result.Elements (i, Result.Elements'Last (2))
:= 3 + Right.Elements (i);
a := long_expression
+ another_long_expression; -- CHECK: this should be indented
func
( a,
b
);
Y := func
( a,
b
);
Y :=
func
( a,
b
);
end;
A, B : Integer;
procedure Swap is new Exchange(integer);
begin
A := 1;
B := 2;
Swap(A,B);
Ada.Float_Text_IO.put -- Float literal
(Item => gamma(i), Fore => 1, Aft => 1, Exp => 0);
new_line;
Ada.Float_Text_IO.put( -- Float literal
Item => gamma(i), Fore => 1, Aft => 1, Exp => 0);
new_line;
return( a+b );
return(
a+b );
return
( a
+b);
end Generic_Swap;
function SUBSTRING (DSTR: DYN_STRING; -- this is a forward reference
START : natural;
LENGTH : natural := 0)
return DYN_STRING;
function SUBSTRING (DSTR: DYN_STRING;
LENGTH : natural := 0)
return DYN_STRING is
DS: DYN_STRING;
L : natural := LENGTH;
type Degrees is new Float range -273.15 .. Float'Last;
Temperature : Degrees;
type Car is record
Identity : Long_Long_Integer;
Number_Wheels : Positive range 1 .. 10;
Paint : Color;
Horse_Power_kW : Float range 0.0 .. 2_000.0;
Consumption : Float range 0.0 .. 100.0;
end record;
BMW : Car :=
(Identity => 2007_752_83992434,
Number_Wheels => 5,
Horse_Power_kW => 190.0,
Consumption => 10.1,
Paint => Blue);
type Directions is (North, South, East, West);
Heading : Directions;
begin
put_line("It works!");
case long_expression
+ Another_long_expression is
when 89 ==>
s1;
s2;
<<lab>> -- CHECK: label should be aligned with begin
#
when 1 =>
Walk_The_Dog;
when 16#5# ==>
a := 5;
a := 9;
f(18);
s1;
#include "fred"
when 5 =>
case Heading is
when North =>
Y := Y + 1;
when South =>
Y := Y - 1;
when East =>
X := X + 1;
when West =>
X := X - 1;
end case;
when 8 | 10 =>
Sell_All_Stock;
when others =>
if Temperature >= 40.0 then
Put_Line ("Wow!");
Put_Line ("It's extremely hot");
elsif Temperature >= 30.0 then
Put_Line ("It's hot");
elsif Temperature >= 20.0 then
Put_Line ("It's warm");
elsif Temperature >= 10.0 then
Put_Line ("It's cool");
elsif Temperature >= 0.0 then
Put_Line ("It's cold");
else
Put_Line ("It's freezing");
end if;
end case;
DS3.DATA(1..DS3.SIZE):= DS1.DATA(1..DS1.SIZE)
& DS2.DATA(1..DS2.SIZE);
return DS3; -- CHECK: should align with DS3 above
end main;
procedure Quadratic_Equation
(A, B, C : Float; -- By default it is "in".
R1, R2 : out Float;
Valid : out Boolean)
is
Z : Float;
type Discriminated_Record (Size : Natural) is
record
A : String (1 .. Size);
B : Integer;
end record;
begin
Z := B**2 - 4.0 * A * C;
if At_Location > In_Text'Last
or else At_Location + Pattern'Length - 1 >
In_Text'Last
or else Slided_Text_T (In_Text (
At_Location .. At_Location + Pattern'Length - 1)) /=
Slided_Pattern
then
Valid := False; -- Being out parameter, it should be modified at least once.
R1 := 0.0;
R2 := 0.0;
<<lab>>
else
Valid := True;
R1 := (-B + Sqrt (Z)) / (2.0 * A);
R2 := (-B - Sqrt (Z)) / (2.0 * A);
end if;
end Quadratic_Equation;
procedure Error_Handling_4 is
Float_Error : exception;
type DEVICE is (PRINTER, DISK, DRUM);
type STATE is (OPEN, CLOSED);
type PERIPHERAL(UNIT : DEVICE := DISK) is
record
STATUS : STATE;
case UNIT is
when PRINTER =>
LINE_COUNT : INTEGER range 1 .. PAGE_SIZE;
when others =>
CYLINDER : CYLINDER_INDEX;
TRACK : TRACK_NUMBER;
end case;
end record;
function Square_Root (X : in Float) return Float is
use Ada.Numerics.Elementary_Functions;
begin
if (X < 0.0) then
raise Float_Error;
else
return Sqrt (X);
end if;
end Square_Root;
begin
begin
C := Square_Root (A ** 2 + B ** 2);
T_IO.Put ("C is ");
F_IO.Put
(Item => C,
Fore => (F_IO.Default_Fore +
1 ),
Aft => F_IO.Default_Aft,
Exp => F_IO.Default_Exp);
exception
when Constraint_Error =>
T_IO.Put ("C cannot be calculated!");
end;
return;
end Error_Handling_4;
procedure Range_1 is
type Range_Type is range -5 .. 10;
Default_String : constant String := "This is the long string returned by" &
" default. It is broken into multiple" &
" Ada source lines for convenience.";
Another_Default_String : constant String :=
"This is the long string returned by" &
" default. It is broken into multiple" &
" Ada source lines for convenience.";
type Op_Codes_In_Column is
( Push,
Pop,
Add );
package T_IO renames Ada.Text_IO;
package I_IO is
new Ada.Text_IO.Integer_IO (Range_Type);
a: real;
begin
for A in Range_Type loop
I_IO.Put (Item => A,
Width => 3, -- CHECK: params should line up
Base => 10);
if A < Range_Type'Last then
Process_Each_Page:
loop
declare
package Float_100_Stack is new Generic_Stack (100, Float);
use Float_100_Stack;
begin
Push (45.8);
end;
Process_All_The_Lines_On_This_Page:
loop
s1;
exit Process_All_The_Lines_On_This_Page when Line_Number = Max_Lines_On_Page;
s2;
Look_For_Sentinel_Value:
loop
s3;
exit Look_For_Sentinel_Value when Current_Symbol = Sentinel;
s4;
end loop Look_For_Sentinel_Value;
s5;
end loop Process_All_The_Lines_On_This_Page;
s6;
exit Process_Each_Page when Page_Number = Maximum_Pages;
s7;
end loop Process_Each_Page;
else
T_IO.New_Line;
-- comment below scans back to here !!??
for I in A'Range (1) loop
for J in A'Range (2) loop
Sum := 0.0;
for R in A'Range (2) loop
Sum := Sum + A.all (I, R) * B.all (R, J);
end loop;
C.all (I, J) := Sum +
second_part_of_long_expression +
third_part_of_long_expression;
if Input_Found then
Count_Characters;
else --not Input_Found
Reset_State;
Character_Total :=
First_Part_Total * First_Part_Scale_Factor +
Second_Part_Total * Second_Part_Scale_Factor +
Default_String'Length + Delimiter_Size;
end if;
end loop;
end loop;
end if;
end loop;
end Range_1;
-- generic instantiation -- TODO: wrong, ...
-- ... statementIndent() scans back to for R in A'Range ... ??? ...
-- ... because it skips over the ends
package Day_Of_Month_IO is -- TODO: scans back to beginning of file: generic? should have stopped at 'procedure'
new Ada.Text_IO.Integer_IO (Day_Of_Month);
procedure f;
-- CHECK: these should be recognised as forward procedures ...
procedure Day_Of (Day, Month, Year : in Integer;
Result : out Integer);
procedure x;
procedure x1;
procedure TRAVERSE_TREE;
procedure INCREMENT(X : in out INTEGER);
procedure RIGHT_INDENT(MARGIN : out LINE_SIZE); -- see 3.5.4
procedure SWITCH(FROM, TO : in out LINK); -- see 3.8.1
function RANDOM return PROBABILITY; -- see 3.5.7
function MIN_CELL(X : LINK) return CELL; -- see 3.8.1
function NEXT_FRAME(K : POSITIVE) return FRAME; -- see 3.8
function DOT_PRODUCT(LEFT,RIGHT: VECTOR) return REAL; -- see 3.6
function "*"(LEFT,RIGHT : MATRIX) return MATRIX; -- see 3.6
procedure Nesting is
procedure Triple is
procedure Second_Layer(Persistence : in out Persistence_View;
Stream : not null access Root_Stream_Type'Class)
is
procedure Bottom_Layer is
begin
Put_Line("This is the Bottom Layer talking.");
Do_Something;
if Test then
goto Exit_Use_Goto;
end if;
Do_Something_Else;
<<Label>>
<<Exit_Use_Goto>> -- CHECK: should align with 'begin'
return;
end Bottom_Layer;
begin -- Second_Layer
Put_Line("This is the Second Layer talking.");
Bottom_Layer;
<<Exit_Use_Goto>> -- CHECK: should align with 'begin'
Put_Line("We are back up to the Second Layer.");
end Second_Layer;
begin -- Triple
Put_Line("This is procedure Triple talking to you.");
Second_Layer;
Put_Line("We are back up to the procedure named Triple.");
end Triple;
begin -- Nesting
Put_Line("Start the triple nesting here.");
Triple;
Put_Line("Finished, and back to the top level.");
end Nesting;
procedure Proced3 is
Dogs, Cats, Animals : INTEGER;
-- This is a procedure specification
procedure Total_Number_Of_Animals(Variety1 : in INTEGER;
Variety2 : in INTEGER;
Total : out INTEGER);
-- This is a procedure body
procedure Total_Number_Of_Animals(Variety1 : in INTEGER;
Variety2 : in INTEGER;
Total : out INTEGER) is
begin
Total := Variety1 + Variety2;
end Total_Number_Of_Animals;
begin
Dogs := 3;
Cats := 4;
if some_condition
or some_other_condition
or yet_another_condition
then
action( a,
b+c,
c + d
+ e +f +g, -- would be nice if this was indented
);
end if;
Total_Number_Of_Animals(Dogs, Cats, Animals);
Put("The total number of animals is");
Put(Animals, 3);
if cond then
while c loop
for i in integer -- multiline for loop
range 1..1000
loop
a := long_expression
+ long_expression
+ long_expression;
a(i) := 10;
end loop;
a := long_expression
+ long_expression
+ long_expression;
while x > 0
and x <= 100
loop -- CHECK: not indented
loop -- CHECK: indented
a := q1 +
q2 +
q3;
end loop;
end loop;
while x > 0 loop
loop -- forever loop
aaaaaaa :=
q1 +
q2 +
q3;
end loop;
end loop;
end loop;
end loop;
fredzarmplezzzzzzzzzzzz( arg1,
arg1,
arg2,
arg3
);
x := f(a) + f(b);
fffffffffffff( func0( func1( func2( f3( arg1,
arg2,
arg3,
arg4
),
a1, -- should be aligned with arg f3, not '('
a2,
a3,
a4
),
aa2,
aa3,
aa4,
aa5
),
bb1,
bb2,
bb3,
bb4
),
cc1,
cc2,
cc3,
cc4
);
s1;
end if;
New_Line;
end Proced3;
procedure Main is
task Sub is
entry Wake_Up(I: Integer);
end Sub;
task body Sub is
Stop: Boolean := False;
begin
while not Stop loop
Put("Sub: Wait"); New_Line(1);
accept Wake_Up(I: Integer) do
Put("Sub: "); Put(I); New_Line(1);
if I = 0 then
Stop := True;
end if;
end Wake_Up;
end loop;
Put("Sub: Stop"); New_Line(1);
end Sub;
begin
Extract_Publisher:
for Index in Base_11_Digits (Item.Country + 1) ..
Base_11_Digits (Item.Publisher) loop
declare
Digit : constant Natural range 0 .. 9
:= Natural (Item.Number (Index));
Power : constant Natural range 0 .. 9
:= Item.Publisher - Natural (Index);
begin
Publisher := Publisher + Digit * (10 ** Power);
end;
end loop Extract_Publisher; -- CHECK: matches 'for' above
Put("Main: Stop"); New_Line(1);
declare
begin
end;
if c
and c2
then
s1;
for i in a'range
loop
loop
s12;
s13;
end lop;
end loop;
elsif c05
or c06
then
s12;
elsif c1 then
s2;
else
s3;
a12 :=
f(13);
end if;
end;
end;
package Utilities is
generic
type Item is private;
procedure Swap(L, R : in out Item);
-- A handy package at the project-specific level
-- A constrained generic formal parameter
generic
type Item is (<>);
function Next (Data : Item) return Item;
-- A discrete type generic formal parameter
generic
type Item is (<>);
-- A discrete type generic formal parameter
function Prev (Data : Item) return Item;
-- more generic subprograms as appropriate to your particular project needs
end Utilities;
// kate: line-numbers true; indent-width 3; replace-tabs on
// kate: debugMode off
@@ -0,0 +1,3 @@
begin
if e then
ok;
@@ -0,0 +1,5 @@
v.setCursorPosition(1,d.lineLength(1));
v.enter();
v.type("ok;");
@@ -0,0 +1,2 @@
begin
if e then
@@ -0,0 +1,4 @@
begin
f(
ok
)
@@ -0,0 +1,5 @@
v.setCursorPosition(1,d.lineLength(1)-1);
v.enter();
v.type("ok");
@@ -0,0 +1,3 @@
begin
s1;
#
@@ -0,0 +1,7 @@
v.setCursorPosition(0,d.lineLength(0));
v.enter();
v.type("s1;");
v.enter();
v.type("#");
@@ -0,0 +1,4 @@
begin
loop
ok
end loop;
@@ -0,0 +1,8 @@
v.setCursorPosition(1,d.lineLength(1));
v.enter();
v.type("ok");
v.enter();
v.type("end");
v.type(" ");
v.type("loop;");
@@ -0,0 +1,2 @@
begin
loop
@@ -0,0 +1 @@
kate: hl CMake; indent-mode cmake; replace-tabs true; indent-width 4; dynamic-word-wrap off; remove-trailing-spaces off;
@@ -0,0 +1,7 @@
some(
ok
)
some(
ok
)
@@ -0,0 +1,7 @@
v.setCursorPosition(2,9);
v.enter();
v.type("ok");
v.setCursorPosition(0,5);
v.enter();
v.type("ok");
@@ -0,0 +1,3 @@
some()
some()
@@ -0,0 +1,2 @@
some(
ok SOME TEXT HERE)
@@ -0,0 +1,3 @@
v.setCursorPosition(0,5);
v.enter();
v.type("ok ");
@@ -0,0 +1 @@
some(SOME TEXT HERE)
@@ -0,0 +1,20 @@
function(some)
ok()
if(smth)
ok()
elseif(other)
ok()
else()
ok()
foreach(foo)
ok()
while(bar)
ok()
endwhile()
ok()
endforeach()
ok()
endif()
ok()
endfunction()
ok()
@@ -0,0 +1,39 @@
v.setCursorPosition(9,13);
v.enter();
v.type("ok()");
v.setCursorPosition(8,11);
v.enter();
v.type("ok()");
v.setCursorPosition(7,20);
v.enter();
v.type("ok()");
v.setCursorPosition(6,22);
v.enter();
v.type("ok()");
v.setCursorPosition(5,22);
v.enter();
v.type("ok()");
v.setCursorPosition(4,20);
v.enter();
v.type("ok()");
v.setCursorPosition(3,10);
v.enter();
v.type("ok()");
v.setCursorPosition(2,17);
v.enter();
v.type("ok()");
v.setCursorPosition(1,12);
v.enter();
v.type("ok()");
v.setCursorPosition(0,14);
v.enter();
v.type("ok()");
@@ -0,0 +1,10 @@
function(some)
if(smth)
elseif(other)
else()
foreach(foo)
while(bar)
endwhile()
endforeach()
endif()
endfunction()
@@ -0,0 +1,8 @@
function(some)
if(smth)
if(some_other)
set(foo)
endif()ok
endif()ok
endfunction(ok
// The last line is failed for some reason ;-(
@@ -0,0 +1,11 @@
v.setCursorPosition(6,23);
v.type("(");
v.type("ok");
v.setCursorPosition(5,17);
v.type("(");
v.type("ok");
v.setCursorPosition(4,17);
v.type("(");
v.type("ok");
@@ -0,0 +1,8 @@
function(some)
if(smth)
if(some_other)
set(foo)
endif
endif
endfunction
// The last line is failed for some reason ;-(

Some files were not shown because too many files have changed in this diff Show More