You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@netbeans.apache.org by jl...@apache.org on 2020/07/20 19:44:23 UTC
[netbeans] branch master updated: Temporary lightweight C/C++
support
This is an automated email from the ASF dual-hosted git repository.
jlahoda pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/netbeans.git
The following commit(s) were added to refs/heads/master by this push:
new d50cf8f Temporary lightweight C/C++ support
d50cf8f is described below
commit d50cf8f526554dd8cae2003b57ffa0783467da02
Author: Jan Lahoda <jl...@netbeans.org>
AuthorDate: Mon Jul 20 21:44:12 2020 +0200
Temporary lightweight C/C++ support
---
cpplite/README.md | 34 +
cpplite/cpplite.debugger/build.xml | 28 +
.../cpplite.debugger/external/binaries-list | 29 +-
.../external/cpplite-mi-1.0-SNAPSHOT-license.txt | 389 +
cpplite/cpplite.debugger/manifest.mf | 7 +
.../cpplite.debugger/nbproject/project.properties | 31 +-
cpplite/cpplite.debugger/nbproject/project.xml | 198 +
.../org.netbeans.spi.viewmodel.NodeModel | 1 +
.../org.netbeans.spi.viewmodel.NodeActionsProvider | 1 +
.../org.netbeans.spi.viewmodel.NodeModel | 1 +
.../org.netbeans.spi.viewmodel.TableModel | 1 +
.../org.netbeans.spi.viewmodel.TreeModel | 1 +
.../org.netbeans.spi.viewmodel.ColumnModel | 2 +
.../org.netbeans.spi.viewmodel.NodeModel | 1 +
.../org.netbeans.spi.viewmodel.TableModel | 1 +
.../org.netbeans.spi.viewmodel.TreeModel | 1 +
.../org.netbeans.spi.viewmodel.ColumnModel | 2 +
.../org.netbeans.spi.viewmodel.NodeModelFilter | 1 +
.../org.netbeans.spi.viewmodel.TableModel | 1 +
...tbeans.modules.cpplite.debugger.CPPLiteDebugger | 1 +
.../org.netbeans.spi.debugger.ActionsProvider | 2 +
...rg.netbeans.spi.debugger.DebuggerEngineProvider | 1 +
...tbeans.api.debugger.LazyDebuggerManagerListener | 2 +
.../org.netbeans.api.debugger.Properties$Reader | 1 +
.../modules/cpplite/debugger/Bundle.properties | 47 +
.../modules/cpplite/debugger/CPPLiteDebugger.java | 662 +
.../cpplite/debugger/CPPLiteDebuggerConfig.java | 28 +-
.../debugger/CPPLiteDebuggerEngineProvider.java | 37 +-
.../modules/cpplite/debugger/CallStackModel.java | 335 +
.../cpplite/debugger/DebuggerAnnotation.java | 75 +
.../debugger/DebuggerBreakpointAnnotation.java | 86 +
.../cpplite/debugger/SessionsTableModelFilter.java | 169 +
.../cpplite/debugger/ToolTipAnnotation.java | 159 +
.../netbeans/modules/cpplite/debugger/Utils.java | 475 +
.../modules/cpplite/debugger/VariablesModel.java | 274 +
.../cpplite/debugger/VerticalGridLayout.java | 163 +
.../modules/cpplite/debugger/WatchesModel.java | 223 +
.../modules/cpplite/debugger/api/Debugger.java | 18 +-
.../breakpoints/BreakpointAnnotationListener.java | 112 +
.../debugger/breakpoints/BreakpointModel.java | 155 +
.../debugger/breakpoints/BreakpointsReader.java | 124 +
.../cpplite/debugger/breakpoints/Bundle.properties | 28 +-
.../debugger/breakpoints/CPPLiteBreakpoint.java | 206 +
.../CPPLiteBreakpointActionProvider.java | 127 +
.../debugger/breakpoints/LoadBreakpoints.java | 22 +-
.../debugger/breakpoints/PersistenceManager.java | 147 +
.../cpplite/debugger/resources/Bundle.properties | 34 +-
.../cpplite/debugger/resources/CurrentPC2.xml | 31 +
.../debugger/resources/CurrentPC2LinePart.xml | 31 +
.../cpplite/debugger/resources/CurrentPC2_BP.xml | 39 +
.../cpplite/debugger/resources/CurrentPC2_DBP.xml | 39 +
.../debugger/resources/CurrentPCLinePart.xml | 32 +
.../cpplite/debugger/resources/mf-layer.xml | 129 +
.../test/unit/data/step-test/build.sh | 1 +
.../cpplite.debugger/test/unit/data/step-test/main | Bin 0 -> 28928 bytes
.../test/unit/data/step-test/main.cpp | 13 +
.../modules/cpplite/debugger/StepTest.java | 137 +
cpplite/cpplite.editor/build.xml | 28 +
cpplite/cpplite.editor/licenseinfo.xml | 39 +
cpplite/cpplite.editor/manifest.mf | 7 +
.../cpplite.editor/nbproject/project.properties | 29 +-
cpplite/cpplite.editor/nbproject/project.xml | 203 +
.../modules/cpplite/editor/Bundle.properties | 30 +-
.../modules/cpplite/editor/UnconfiguredHint.java | 117 +
.../org/netbeans/modules/cpplite/editor/Utils.java | 15 +-
.../modules/cpplite/editor/file/CDataObject.java | 114 +
.../modules/cpplite/editor/file/CPPDataObject.java | 114 +
.../modules/cpplite/editor/file/CPPTemplate.cpp | 24 +
.../modules/cpplite/editor/file/CTemplate.c | 24 +
.../modules/cpplite/editor/file/HDataObject.java | 113 +
.../modules/cpplite/editor/file/HPPDataObject.java | 113 +
.../modules/cpplite/editor/file/HPPTemplate.hpp | 24 +
.../modules/cpplite/editor/file/HTemplate.h | 24 +
.../modules/cpplite/editor/file/MIMETypes.java | 13 +-
.../modules/cpplite/editor/file/package-info.java | 55 +
.../cpplite/editor/file/resources/CCSrcIcon.gif | Bin 0 -> 667 bytes
.../cpplite/editor/file/resources/CSrcIcon.gif | Bin 0 -> 682 bytes
.../cpplite/editor/file/resources/HDataIcon.gif | Bin 0 -> 650 bytes
.../editor/file/resources/c.tmLanguage.json | 3348 +++
.../editor/file/resources/cpp.tmLanguage.json | 20778 +++++++++++++++++++
.../org/netbeans/modules/cpplite/editor/layer.xml | 30 +
.../cpplite/editor/lsp/LanguageServerImpl.java | 177 +
.../cpplite/editor/lsp/options/Bundle.properties | 30 +-
.../lsp/options/CPPLiteOptionsPanelController.java | 101 +
.../cpplite/editor/lsp/options/CPPLitePanel.form | 82 +
.../cpplite/editor/lsp/options/CPPLitePanel.java | 105 +
.../modules/cpplite/editor/lsp/options/cnd_32.png | Bin 0 -> 2219 bytes
.../cpplite/editor/lsp/options/package-info.java | 17 +-
.../editor/spi/CProjectConfigurationProvider.java | 29 +-
cpplite/cpplite.kit/build.xml | 25 +
cpplite/cpplite.kit/manifest.mf | 6 +
.../cpplite.kit/nbproject/project.properties | 29 +-
cpplite/cpplite.kit/nbproject/project.xml | 50 +
.../netbeans/modules/cpplite/kit/Bundle.properties | 33 +-
cpplite/cpplite.project/build.xml | 28 +
cpplite/cpplite.project/licenseinfo.xml | 31 +
cpplite/cpplite.project/manifest.mf | 7 +
.../cpplite.project/nbproject/project.properties | 29 +-
cpplite/cpplite.project/nbproject/project.xml | 164 +
.../cpplite/project/ActionProviderImpl.java | 84 +
.../cpplite/project/BuildConfiguration.java | 73 +
.../modules/cpplite/project/Bundle.properties | 30 +-
.../CPPLiteCProjectConfigurationProvider.java | 49 +
.../modules/cpplite/project/CPPLiteProject.java | 190 +
.../cpplite/project/LogicalViewProviderImpl.java | 81 +
.../netbeans/modules/cpplite/project/Utils.java | 54 +
.../org/netbeans/modules/cpplite/project/layer.xml | 135 +
.../modules/cpplite/project/resources/project.gif | Bin 0 -> 718 bytes
.../cpplite/project/resources/projectOpen.gif | Bin 0 -> 728 bytes
.../modules/cpplite/project/runner/Runner.java | 22 +-
.../netbeans/modules/cpplite/project/ui/Build.form | 167 +
.../netbeans/modules/cpplite/project/ui/Build.java | 194 +
.../modules/cpplite/project/ui/Bundle.properties | 35 +-
.../modules/cpplite/project/ui/Editor.form | 85 +
.../modules/cpplite/project/ui/Editor.java | 132 +
.../ui/customizer/CustomizerProviderImpl.java | 52 +
.../cpplite/project/ui/wizard/Bundle.properties | 30 +-
.../ui/wizard/CPPLiteProjectDescription.html | 27 +
.../project/ui/wizard/CPPLiteProjectPathPanel.form | 85 +
.../project/ui/wizard/CPPLiteProjectPathPanel.java | 195 +
.../ui/wizard/CPPLiteProjectWizardIterator.java | 300 +
.../ide.ergonomics/cpplite.properties | 28 +-
.../modules/ide/ergonomics/DynamicVerifyTest.java | 1 +
ide/dlight.nativeexecution/nbproject/project.xml | 1 +
ide/lsp.client/apichanges.xml | 72 +
ide/lsp.client/nbproject/project.properties | 2 +-
.../netbeans/modules/lsp/client/LSPBindings.java | 2 +-
.../lsp/client/options/GenericLanguageServer.java | 1 +
.../client/{options => spi}/ServerRestarter.java | 13 +-
nb/ide.launcher/netbeans.clusters | 1 +
nbbuild/cluster.properties | 19 +
nbbuild/licenses/MIT-cpp-textmate-grammars | 21 +
132 files changed, 32848 insertions(+), 413 deletions(-)
diff --git a/cpplite/README.md b/cpplite/README.md
new file mode 100644
index 0000000..654769c
--- /dev/null
+++ b/cpplite/README.md
@@ -0,0 +1,34 @@
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+
+-->
+
+# CPPLite
+
+A lightweight C/C++ support for NetBeans.
+
+This project currently adds a simple C/C++ project, C/C++ syntax highlighting and support for [the _ccls_ language server protocol server](https://github.com/MaskRay/ccls) to get editing features like code completion.
+
+## Opening a C/C++ project
+
+When opening a C/C++ project for the first time, one needs to choose C/C++ category, Lightweight C/C++ Project. Then select the directory where project exist, on the next wizard page, provide the location of
+[compile_commands.json](https://sarcasm.github.io/notes/dev/compilation-database.html), and on the next wizard page, it is possible to specify commands to build the project.
+
+The ccls location needs to be specified in Tools/Options, C/C++ tab.
+
diff --git a/cpplite/cpplite.debugger/build.xml b/cpplite/cpplite.debugger/build.xml
new file mode 100644
index 0000000..2cf73ba
--- /dev/null
+++ b/cpplite/cpplite.debugger/build.xml
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+
+-->
+<!-- You may freely edit this file. See harness/README in the NetBeans platform -->
+<!-- for some information on what you could do (e.g. targets to override). -->
+<!-- If you delete this file and reopen the project it will be recreated. -->
+<project name="cpplite/cpplite.debugger" default="netbeans" basedir=".">
+ <description>Builds, tests, and runs the project org.netbeans.modules.cpplite.debugger.</description>
+ <import file="../../nbbuild/templates/projectized.xml"/>
+</project>
diff --git a/nb/ide.launcher/netbeans.clusters b/cpplite/cpplite.debugger/external/binaries-list
similarity index 73%
copy from nb/ide.launcher/netbeans.clusters
copy to cpplite/cpplite.debugger/external/binaries-list
index 2ea6c1c..9b72b03 100644
--- a/nb/ide.launcher/netbeans.clusters
+++ b/cpplite/cpplite.debugger/external/binaries-list
@@ -14,31 +14,4 @@
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
-
-# platform cluster first
-platform
-# application cluster second
-nb
-# ergonomics cluster if present
-ergonomics
-# and now the rest
-ide
-extide
-java
-apisupport
-webcommon
-websvccommon
-enterprise
-mobility
-profiler
-python
-php
-identity
-harness
-cnd
-cndext
-dlight
-groovy
-extra
-javacard
-javafx
+7E2B3E2AB5EBCABF3971F118A4D288A7E5DAC1DF cpplite-mi-1.0-SNAPSHOT.jar
diff --git a/cpplite/cpplite.debugger/external/cpplite-mi-1.0-SNAPSHOT-license.txt b/cpplite/cpplite.debugger/external/cpplite-mi-1.0-SNAPSHOT-license.txt
new file mode 100644
index 0000000..ae4715c
--- /dev/null
+++ b/cpplite/cpplite.debugger/external/cpplite-mi-1.0-SNAPSHOT-license.txt
@@ -0,0 +1,389 @@
+Name: CND Debugger parts
+Description: CND Debugger parts that didn't go through the Apache IP Clearance yet
+Version: 1.0-SNAPSHOT
+License: CDDL-1.0
+Origin: NetBeans
+
+COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0
+
+
+ 1. Definitions.
+
+ 1.1. "Contributor" means each individual or entity that
+ creates or contributes to the creation of Modifications.
+
+ 1.2. "Contributor Version" means the combination of the
+ Original Software, prior Modifications used by a
+ Contributor (if any), and the Modifications made by that
+ particular Contributor.
+
+ 1.3. "Covered Software" means (a) the Original Software, or
+ (b) Modifications, or (c) the combination of files
+ containing Original Software with files containing
+ Modifications, in each case including portions thereof.
+
+ 1.4. "Executable" means the Covered Software in any form
+ other than Source Code.
+
+ 1.5. "Initial Developer" means the individual or entity
+ that first makes Original Software available under this
+ License.
+
+ 1.6. "Larger Work" means a work which combines Covered
+ Software or portions thereof with code not governed by the
+ terms of this License.
+
+ 1.7. "License" means this document.
+
+ 1.8. "Licensable" means having the right to grant, to the
+ maximum extent possible, whether at the time of the initial
+ grant or subsequently acquired, any and all of the rights
+ conveyed herein.
+
+ 1.9. "Modifications" means the Source Code and Executable
+ form of any of the following:
+
+ A. Any file that results from an addition to,
+ deletion from or modification of the contents of a
+ file containing Original Software or previous
+ Modifications;
+
+ B. Any new file that contains any part of the
+ Original Software or previous Modification; or
+
+ C. Any new file that is contributed or otherwise made
+ available under the terms of this License.
+
+ 1.10. "Original Software" means the Source Code and
+ Executable form of computer software code that is
+ originally released under this License.
+
+ 1.11. "Patent Claims" means any patent claim(s), now owned
+ or hereafter acquired, including without limitation,
+ method, process, and apparatus claims, in any patent
+ Licensable by grantor.
+
+ 1.12. "Source Code" means (a) the common form of computer
+ software code in which modifications are made and (b)
+ associated documentation included in or with such code.
+
+ 1.13. "You" (or "Your") means an individual or a legal
+ entity exercising rights under, and complying with all of
+ the terms of, this License. For legal entities, "You"
+ includes any entity which controls, is controlled by, or is
+ under common control with You. For purposes of this
+ definition, "control" means (a) the power, direct or
+ indirect, to cause the direction or management of such
+ entity, whether by contract or otherwise, or (b) ownership
+ of more than fifty percent (50%) of the outstanding shares
+ or beneficial ownership of such entity.
+
+ 2. License Grants.
+
+ 2.1. The Initial Developer Grant.
+
+ Conditioned upon Your compliance with Section 3.1 below and
+ subject to third party intellectual property claims, the
+ Initial Developer hereby grants You a world-wide,
+ royalty-free, non-exclusive license:
+
+ (a) under intellectual property rights (other than
+ patent or trademark) Licensable by Initial Developer,
+ to use, reproduce, modify, display, perform,
+ sublicense and distribute the Original Software (or
+ portions thereof), with or without Modifications,
+ and/or as part of a Larger Work; and
+
+ (b) under Patent Claims infringed by the making,
+ using or selling of Original Software, to make, have
+ made, use, practice, sell, and offer for sale, and/or
+ otherwise dispose of the Original Software (or
+ portions thereof).
+
+ (c) The licenses granted in Sections 2.1(a) and (b)
+ are effective on the date Initial Developer first
+ distributes or otherwise makes the Original Software
+ available to a third party under the terms of this
+ License.
+
+ (d) Notwithstanding Section 2.1(b) above, no patent
+ license is granted: (1) for code that You delete from
+ the Original Software, or (2) for infringements
+ caused by: (i) the modification of the Original
+ Software, or (ii) the combination of the Original
+ Software with other software or devices.
+
+ 2.2. Contributor Grant.
+
+ Conditioned upon Your compliance with Section 3.1 below and
+ subject to third party intellectual property claims, each
+ Contributor hereby grants You a world-wide, royalty-free,
+ non-exclusive license:
+
+ (a) under intellectual property rights (other than
+ patent or trademark) Licensable by Contributor to
+ use, reproduce, modify, display, perform, sublicense
+ and distribute the Modifications created by such
+ Contributor (or portions thereof), either on an
+ unmodified basis, with other Modifications, as
+ Covered Software and/or as part of a Larger Work; and
+
+
+ (b) under Patent Claims infringed by the making,
+ using, or selling of Modifications made by that
+ Contributor either alone and/or in combination with
+ its Contributor Version (or portions of such
+ combination), to make, use, sell, offer for sale,
+ have made, and/or otherwise dispose of: (1)
+ Modifications made by that Contributor (or portions
+ thereof); and (2) the combination of Modifications
+ made by that Contributor with its Contributor Version
+ (or portions of such combination).
+
+ (c) The licenses granted in Sections 2.2(a) and
+ 2.2(b) are effective on the date Contributor first
+ distributes or otherwise makes the Modifications
+ available to a third party.
+
+ (d) Notwithstanding Section 2.2(b) above, no patent
+ license is granted: (1) for any code that Contributor
+ has deleted from the Contributor Version; (2) for
+ infringements caused by: (i) third party
+ modifications of Contributor Version, or (ii) the
+ combination of Modifications made by that Contributor
+ with other software (except as part of the
+ Contributor Version) or other devices; or (3) under
+ Patent Claims infringed by Covered Software in the
+ absence of Modifications made by that Contributor.
+
+ 3. Distribution Obligations.
+
+ 3.1. Availability of Source Code.
+
+ Any Covered Software that You distribute or otherwise make
+ available in Executable form must also be made available in
+ Source Code form and that Source Code form must be
+ distributed only under the terms of this License. You must
+ include a copy of this License with every copy of the
+ Source Code form of the Covered Software You distribute or
+ otherwise make available. You must inform recipients of any
+ such Covered Software in Executable form as to how they can
+ obtain such Covered Software in Source Code form in a
+ reasonable manner on or through a medium customarily used
+ for software exchange.
+
+ 3.2. Modifications.
+
+ The Modifications that You create or to which You
+ contribute are governed by the terms of this License. You
+ represent that You believe Your Modifications are Your
+ original creation(s) and/or You have sufficient rights to
+ grant the rights conveyed by this License.
+
+ 3.3. Required Notices.
+
+ You must include a notice in each of Your Modifications
+ that identifies You as the Contributor of the Modification.
+ You may not remove or alter any copyright, patent or
+ trademark notices contained within the Covered Software, or
+ any notices of licensing or any descriptive text giving
+ attribution to any Contributor or the Initial Developer.
+
+ 3.4. Application of Additional Terms.
+
+ You may not offer or impose any terms on any Covered
+ Software in Source Code form that alters or restricts the
+ applicable version of this License or the recipients'
+ rights hereunder. You may choose to offer, and to charge a
+ fee for, warranty, support, indemnity or liability
+ obligations to one or more recipients of Covered Software.
+ However, you may do so only on Your own behalf, and not on
+ behalf of the Initial Developer or any Contributor. You
+ must make it absolutely clear that any such warranty,
+ support, indemnity or liability obligation is offered by
+ You alone, and You hereby agree to indemnify the Initial
+ Developer and every Contributor for any liability incurred
+ by the Initial Developer or such Contributor as a result of
+ warranty, support, indemnity or liability terms You offer.
+
+
+ 3.5. Distribution of Executable Versions.
+
+ You may distribute the Executable form of the Covered
+ Software under the terms of this License or under the terms
+ of a license of Your choice, which may contain terms
+ different from this License, provided that You are in
+ compliance with the terms of this License and that the
+ license for the Executable form does not attempt to limit
+ or alter the recipient's rights in the Source Code form
+ from the rights set forth in this License. If You
+ distribute the Covered Software in Executable form under a
+ different license, You must make it absolutely clear that
+ any terms which differ from this License are offered by You
+ alone, not by the Initial Developer or Contributor. You
+ hereby agree to indemnify the Initial Developer and every
+ Contributor for any liability incurred by the Initial
+ Developer or such Contributor as a result of any such terms
+ You offer.
+
+ 3.6. Larger Works.
+
+ You may create a Larger Work by combining Covered Software
+ with other code not governed by the terms of this License
+ and distribute the Larger Work as a single product. In such
+ a case, You must make sure the requirements of this License
+ are fulfilled for the Covered Software.
+
+ 4. Versions of the License.
+
+ 4.1. New Versions.
+
+ Sun Microsystems, Inc. is the initial license steward and
+ may publish revised and/or new versions of this License
+ from time to time. Each version will be given a
+ distinguishing version number. Except as provided in
+ Section 4.3, no one other than the license steward has the
+ right to modify this License.
+
+ 4.2. Effect of New Versions.
+
+ You may always continue to use, distribute or otherwise
+ make the Covered Software available under the terms of the
+ version of the License under which You originally received
+ the Covered Software. If the Initial Developer includes a
+ notice in the Original Software prohibiting it from being
+ distributed or otherwise made available under any
+ subsequent version of the License, You must distribute and
+ make the Covered Software available under the terms of the
+ version of the License under which You originally received
+ the Covered Software. Otherwise, You may also choose to
+ use, distribute or otherwise make the Covered Software
+ available under the terms of any subsequent version of the
+ License published by the license steward.
+
+ 4.3. Modified Versions.
+
+ When You are an Initial Developer and You want to create a
+ new license for Your Original Software, You may create and
+ use a modified version of this License if You: (a) rename
+ the license and remove any references to the name of the
+ license steward (except to note that the license differs
+ from this License); and (b) otherwise make it clear that
+ the license contains terms which differ from this License.
+
+ 5. DISCLAIMER OF WARRANTY.
+
+ COVERED SOFTWARE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS"
+ BASIS, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED,
+ INCLUDING, WITHOUT LIMITATION, WARRANTIES THAT THE COVERED
+ SOFTWARE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR
+ PURPOSE OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND
+ PERFORMANCE OF THE COVERED SOFTWARE IS WITH YOU. SHOULD ANY
+ COVERED SOFTWARE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT THE
+ INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF
+ ANY NECESSARY SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF
+ WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS LICENSE. NO USE OF
+ ANY COVERED SOFTWARE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS
+ DISCLAIMER.
+
+ 6. TERMINATION.
+
+ 6.1. This License and the rights granted hereunder will
+ terminate automatically if You fail to comply with terms
+ herein and fail to cure such breach within 30 days of
+ becoming aware of the breach. Provisions which, by their
+ nature, must remain in effect beyond the termination of
+ this License shall survive.
+
+ 6.2. If You assert a patent infringement claim (excluding
+ declaratory judgment actions) against Initial Developer or
+ a Contributor (the Initial Developer or Contributor against
+ whom You assert such claim is referred to as "Participant")
+ alleging that the Participant Software (meaning the
+ Contributor Version where the Participant is a Contributor
+ or the Original Software where the Participant is the
+ Initial Developer) directly or indirectly infringes any
+ patent, then any and all rights granted directly or
+ indirectly to You by such Participant, the Initial
+ Developer (if the Initial Developer is not the Participant)
+ and all Contributors under Sections 2.1 and/or 2.2 of this
+ License shall, upon 60 days notice from Participant
+ terminate prospectively and automatically at the expiration
+ of such 60 day notice period, unless if within such 60 day
+ period You withdraw Your claim with respect to the
+ Participant Software against such Participant either
+ unilaterally or pursuant to a written agreement with
+ Participant.
+
+ 6.3. In the event of termination under Sections 6.1 or 6.2
+ above, all end user licenses that have been validly granted
+ by You or any distributor hereunder prior to termination
+ (excluding licenses granted to You by any distributor)
+ shall survive termination.
+
+ 7. LIMITATION OF LIABILITY.
+
+ UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT
+ (INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE
+ INITIAL DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF
+ COVERED SOFTWARE, OR ANY SUPPLIER OF ANY OF SUCH PARTIES, BE
+ LIABLE TO ANY PERSON FOR ANY INDIRECT, SPECIAL, INCIDENTAL, OR
+ CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, WITHOUT
+ LIMITATION, DAMAGES FOR LOST PROFITS, LOSS OF GOODWILL, WORK
+ STOPPAGE, COMPUTER FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER
+ COMMERCIAL DAMAGES OR LOSSES, EVEN IF SUCH PARTY SHALL HAVE BEEN
+ INFORMED OF THE POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF
+ LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH OR PERSONAL
+ INJURY RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT
+ APPLICABLE LAW PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO
+ NOT ALLOW THE EXCLUSION OR LIMITATION OF INCIDENTAL OR
+ CONSEQUENTIAL DAMAGES, SO THIS EXCLUSION AND LIMITATION MAY NOT
+ APPLY TO YOU.
+
+ 8. U.S. GOVERNMENT END USERS.
+
+ The Covered Software is a "commercial item," as that term is
+ defined in 48 C.F.R. 2.101 (Oct. 1995), consisting of "commercial
+ computer software" (as that term is defined at 48 C.F.R.
+ 252.227-7014(a)(1)) and "commercial computer software
+ documentation" as such terms are used in 48 C.F.R. 12.212 (Sept.
+ 1995). Consistent with 48 C.F.R. 12.212 and 48 C.F.R. 227.7202-1
+ through 227.7202-4 (June 1995), all U.S. Government End Users
+ acquire Covered Software with only those rights set forth herein.
+ This U.S. Government Rights clause is in lieu of, and supersedes,
+ any other FAR, DFAR, or other clause or provision that addresses
+ Government rights in computer software under this License.
+
+ 9. MISCELLANEOUS.
+
+ This License represents the complete agreement concerning subject
+ matter hereof. If any provision of this License is held to be
+ unenforceable, such provision shall be reformed only to the
+ extent necessary to make it enforceable. This License shall be
+ governed by the law of the jurisdiction specified in a notice
+ contained within the Original Software (except to the extent
+ applicable law, if any, provides otherwise), excluding such
+ jurisdiction's conflict-of-law provisions. Any litigation
+ relating to this License shall be subject to the jurisdiction of
+ the courts located in the jurisdiction and venue specified in a
+ notice contained within the Original Software, with the losing
+ party responsible for costs, including, without limitation, court
+ costs and reasonable attorneys' fees and expenses. The
+ application of the United Nations Convention on Contracts for the
+ International Sale of Goods is expressly excluded. Any law or
+ regulation which provides that the language of a contract shall
+ be construed against the drafter shall not apply to this License.
+ You agree that You alone are responsible for compliance with the
+ United States export administration regulations (and the export
+ control laws and regulation of any other countries) when You use,
+ distribute or otherwise make available any Covered Software.
+
+ 10. RESPONSIBILITY FOR CLAIMS.
+
+ As between Initial Developer and the Contributors, each party is
+ responsible for claims and damages arising, directly or
+ indirectly, out of its utilization of rights under this License
+ and You agree to work with Initial Developer and Contributors to
+ distribute such responsibility on an equitable basis. Nothing
+ herein is intended or shall be deemed to constitute any admission
+ of liability.
diff --git a/cpplite/cpplite.debugger/manifest.mf b/cpplite/cpplite.debugger/manifest.mf
new file mode 100644
index 0000000..7b98adf
--- /dev/null
+++ b/cpplite/cpplite.debugger/manifest.mf
@@ -0,0 +1,7 @@
+Manifest-Version: 1.0
+AutoUpdate-Show-In-Client: false
+OpenIDE-Module: org.netbeans.modules.cpplite.debugger
+OpenIDE-Module-Layer: org/netbeans/modules/cpplite/debugger/resources/mf-layer.xml
+OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/cpplite/debugger/Bundle.properties
+OpenIDE-Module-Specification-Version: 1.0
+
diff --git a/nb/ide.launcher/netbeans.clusters b/cpplite/cpplite.debugger/nbproject/project.properties
similarity index 73%
copy from nb/ide.launcher/netbeans.clusters
copy to cpplite/cpplite.debugger/nbproject/project.properties
index 2ea6c1c..f10d97b 100644
--- a/nb/ide.launcher/netbeans.clusters
+++ b/cpplite/cpplite.debugger/nbproject/project.properties
@@ -15,30 +15,7 @@
# specific language governing permissions and limitations
# under the License.
-# platform cluster first
-platform
-# application cluster second
-nb
-# ergonomics cluster if present
-ergonomics
-# and now the rest
-ide
-extide
-java
-apisupport
-webcommon
-websvccommon
-enterprise
-mobility
-profiler
-python
-php
-identity
-harness
-cnd
-cndext
-dlight
-groovy
-extra
-javacard
-javafx
+release.external/cpplite-mi-1.0-SNAPSHOT.jar=modules/ext/cpplite-mi-1.0-SNAPSHOT.jar
+file.reference.cpplite-mi-1.0-SNAPSHOT.jar=release/modules/ext/cpplite-mi-1.0-SNAPSHOT.jar
+javac.source=1.8
+javac.compilerargs=-Xlint -Xlint:-serial
diff --git a/cpplite/cpplite.debugger/nbproject/project.xml b/cpplite/cpplite.debugger/nbproject/project.xml
new file mode 100644
index 0000000..dd714fd
--- /dev/null
+++ b/cpplite/cpplite.debugger/nbproject/project.xml
@@ -0,0 +1,198 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+
+-->
+<project xmlns="http://www.netbeans.org/ns/project/1">
+ <type>org.netbeans.modules.apisupport.project</type>
+ <configuration>
+ <data xmlns="http://www.netbeans.org/ns/nb-module-project/3">
+ <code-name-base>org.netbeans.modules.cpplite.debugger</code-name-base>
+ <module-dependencies>
+ <dependency>
+ <code-name-base>org.netbeans.api.annotations.common</code-name-base>
+ <build-prerequisite/>
+ <compile-dependency/>
+ <run-dependency>
+ <release-version>1</release-version>
+ <specification-version>1.35</specification-version>
+ </run-dependency>
+ </dependency>
+ <dependency>
+ <code-name-base>org.netbeans.api.debugger</code-name-base>
+ <build-prerequisite/>
+ <compile-dependency/>
+ <run-dependency>
+ <release-version>1</release-version>
+ <specification-version>1.63</specification-version>
+ </run-dependency>
+ </dependency>
+ <dependency>
+ <code-name-base>org.netbeans.modules.dlight.nativeexecution</code-name-base>
+ <build-prerequisite/>
+ <compile-dependency/>
+ <run-dependency>
+ <specification-version>1.48</specification-version>
+ </run-dependency>
+ </dependency>
+ <dependency>
+ <code-name-base>org.netbeans.modules.projectapi</code-name-base>
+ <build-prerequisite/>
+ <compile-dependency/>
+ <run-dependency>
+ <release-version>1</release-version>
+ <specification-version>1.75</specification-version>
+ </run-dependency>
+ </dependency>
+ <dependency>
+ <code-name-base>org.netbeans.spi.debugger.ui</code-name-base>
+ <build-prerequisite/>
+ <compile-dependency/>
+ <run-dependency>
+ <release-version>1</release-version>
+ <specification-version>2.62</specification-version>
+ </run-dependency>
+ </dependency>
+ <dependency>
+ <code-name-base>org.netbeans.spi.viewmodel</code-name-base>
+ <build-prerequisite/>
+ <compile-dependency/>
+ <run-dependency>
+ <release-version>2</release-version>
+ <specification-version>1.59</specification-version>
+ </run-dependency>
+ </dependency>
+ <dependency>
+ <code-name-base>org.openide.awt</code-name-base>
+ <build-prerequisite/>
+ <compile-dependency/>
+ <run-dependency>
+ <specification-version>7.76</specification-version>
+ </run-dependency>
+ </dependency>
+ <dependency>
+ <code-name-base>org.openide.filesystems</code-name-base>
+ <build-prerequisite/>
+ <compile-dependency/>
+ <run-dependency>
+ <specification-version>9.18</specification-version>
+ </run-dependency>
+ </dependency>
+ <dependency>
+ <code-name-base>org.openide.loaders</code-name-base>
+ <build-prerequisite/>
+ <compile-dependency/>
+ <run-dependency>
+ <specification-version>7.76</specification-version>
+ </run-dependency>
+ </dependency>
+ <dependency>
+ <code-name-base>org.openide.modules</code-name-base>
+ <build-prerequisite/>
+ <compile-dependency/>
+ <run-dependency>
+ <specification-version>7.56</specification-version>
+ </run-dependency>
+ </dependency>
+ <dependency>
+ <code-name-base>org.openide.nodes</code-name-base>
+ <build-prerequisite/>
+ <compile-dependency/>
+ <run-dependency>
+ <specification-version>7.53</specification-version>
+ </run-dependency>
+ </dependency>
+ <dependency>
+ <code-name-base>org.openide.text</code-name-base>
+ <build-prerequisite/>
+ <compile-dependency/>
+ <run-dependency>
+ <specification-version>6.75</specification-version>
+ </run-dependency>
+ </dependency>
+ <dependency>
+ <code-name-base>org.openide.util</code-name-base>
+ <build-prerequisite/>
+ <compile-dependency/>
+ <run-dependency>
+ <specification-version>9.15</specification-version>
+ </run-dependency>
+ </dependency>
+ <dependency>
+ <code-name-base>org.openide.util.lookup</code-name-base>
+ <build-prerequisite/>
+ <compile-dependency/>
+ <run-dependency>
+ <specification-version>8.41</specification-version>
+ </run-dependency>
+ </dependency>
+ <dependency>
+ <code-name-base>org.openide.util.ui</code-name-base>
+ <build-prerequisite/>
+ <compile-dependency/>
+ <run-dependency>
+ <specification-version>9.16</specification-version>
+ </run-dependency>
+ </dependency>
+ <dependency>
+ <code-name-base>org.openide.windows</code-name-base>
+ <build-prerequisite/>
+ <compile-dependency/>
+ <run-dependency>
+ <specification-version>6.85</specification-version>
+ </run-dependency>
+ </dependency>
+ </module-dependencies>
+ <test-dependencies>
+ <test-type>
+ <name>unit</name>
+ <test-dependency>
+ <code-name-base>org.netbeans.libs.junit4</code-name-base>
+ <compile-dependency/>
+ </test-dependency>
+ <test-dependency>
+ <code-name-base>org.netbeans.modules.cpplite.editor</code-name-base>
+ <compile-dependency/>
+ </test-dependency>
+ <test-dependency>
+ <code-name-base>org.netbeans.modules.masterfs</code-name-base>
+ <compile-dependency/>
+ </test-dependency>
+ <test-dependency>
+ <code-name-base>org.netbeans.modules.nbjunit</code-name-base>
+ <recursive/>
+ <compile-dependency/>
+ </test-dependency>
+ <test-dependency>
+ <code-name-base>org.openide.util.ui</code-name-base>
+ <compile-dependency/>
+ </test-dependency>
+ </test-type>
+ </test-dependencies>
+ <friend-packages>
+ <friend>org.netbeans.modules.cpplite.project</friend>
+ <package>org.netbeans.modules.cpplite.debugger.api</package>
+ </friend-packages>
+ <class-path-extension>
+ <runtime-relative-path>ext/cpplite-mi-1.0-SNAPSHOT.jar</runtime-relative-path>
+ <binary-origin>external/cpplite-mi-1.0-SNAPSHOT.jar</binary-origin>
+ </class-path-extension>
+ </data>
+ </configuration>
+</project>
diff --git a/cpplite/cpplite.debugger/src/META-INF/debugger/BreakpointsView/org.netbeans.spi.viewmodel.NodeModel b/cpplite/cpplite.debugger/src/META-INF/debugger/BreakpointsView/org.netbeans.spi.viewmodel.NodeModel
new file mode 100644
index 0000000..b2ec1a2
--- /dev/null
+++ b/cpplite/cpplite.debugger/src/META-INF/debugger/BreakpointsView/org.netbeans.spi.viewmodel.NodeModel
@@ -0,0 +1 @@
+org.netbeans.modules.cpplite.debugger.breakpoints.BreakpointModel
\ No newline at end of file
diff --git a/cpplite/cpplite.debugger/src/META-INF/debugger/CPPLiteSession/CallStackView/org.netbeans.spi.viewmodel.NodeActionsProvider b/cpplite/cpplite.debugger/src/META-INF/debugger/CPPLiteSession/CallStackView/org.netbeans.spi.viewmodel.NodeActionsProvider
new file mode 100644
index 0000000..058c75e
--- /dev/null
+++ b/cpplite/cpplite.debugger/src/META-INF/debugger/CPPLiteSession/CallStackView/org.netbeans.spi.viewmodel.NodeActionsProvider
@@ -0,0 +1 @@
+org.netbeans.modules.cpplite.debugger.CallStackModel
\ No newline at end of file
diff --git a/cpplite/cpplite.debugger/src/META-INF/debugger/CPPLiteSession/CallStackView/org.netbeans.spi.viewmodel.NodeModel b/cpplite/cpplite.debugger/src/META-INF/debugger/CPPLiteSession/CallStackView/org.netbeans.spi.viewmodel.NodeModel
new file mode 100644
index 0000000..058c75e
--- /dev/null
+++ b/cpplite/cpplite.debugger/src/META-INF/debugger/CPPLiteSession/CallStackView/org.netbeans.spi.viewmodel.NodeModel
@@ -0,0 +1 @@
+org.netbeans.modules.cpplite.debugger.CallStackModel
\ No newline at end of file
diff --git a/cpplite/cpplite.debugger/src/META-INF/debugger/CPPLiteSession/CallStackView/org.netbeans.spi.viewmodel.TableModel b/cpplite/cpplite.debugger/src/META-INF/debugger/CPPLiteSession/CallStackView/org.netbeans.spi.viewmodel.TableModel
new file mode 100644
index 0000000..058c75e
--- /dev/null
+++ b/cpplite/cpplite.debugger/src/META-INF/debugger/CPPLiteSession/CallStackView/org.netbeans.spi.viewmodel.TableModel
@@ -0,0 +1 @@
+org.netbeans.modules.cpplite.debugger.CallStackModel
\ No newline at end of file
diff --git a/cpplite/cpplite.debugger/src/META-INF/debugger/CPPLiteSession/CallStackView/org.netbeans.spi.viewmodel.TreeModel b/cpplite/cpplite.debugger/src/META-INF/debugger/CPPLiteSession/CallStackView/org.netbeans.spi.viewmodel.TreeModel
new file mode 100644
index 0000000..058c75e
--- /dev/null
+++ b/cpplite/cpplite.debugger/src/META-INF/debugger/CPPLiteSession/CallStackView/org.netbeans.spi.viewmodel.TreeModel
@@ -0,0 +1 @@
+org.netbeans.modules.cpplite.debugger.CallStackModel
\ No newline at end of file
diff --git a/cpplite/cpplite.debugger/src/META-INF/debugger/CPPLiteSession/LocalsView/org.netbeans.spi.viewmodel.ColumnModel b/cpplite/cpplite.debugger/src/META-INF/debugger/CPPLiteSession/LocalsView/org.netbeans.spi.viewmodel.ColumnModel
new file mode 100644
index 0000000..795316d
--- /dev/null
+++ b/cpplite/cpplite.debugger/src/META-INF/debugger/CPPLiteSession/LocalsView/org.netbeans.spi.viewmodel.ColumnModel
@@ -0,0 +1,2 @@
+org.netbeans.modules.debugger.ui.models.ColumnModels.createLocalsTypeColumn()-hidden
+org.netbeans.modules.debugger.ui.models.ColumnModels.createLocalsToStringColumn()-hidden
diff --git a/cpplite/cpplite.debugger/src/META-INF/debugger/CPPLiteSession/LocalsView/org.netbeans.spi.viewmodel.NodeModel b/cpplite/cpplite.debugger/src/META-INF/debugger/CPPLiteSession/LocalsView/org.netbeans.spi.viewmodel.NodeModel
new file mode 100644
index 0000000..25b5bfd
--- /dev/null
+++ b/cpplite/cpplite.debugger/src/META-INF/debugger/CPPLiteSession/LocalsView/org.netbeans.spi.viewmodel.NodeModel
@@ -0,0 +1 @@
+org.netbeans.modules.cpplite.debugger.VariablesModel
\ No newline at end of file
diff --git a/cpplite/cpplite.debugger/src/META-INF/debugger/CPPLiteSession/LocalsView/org.netbeans.spi.viewmodel.TableModel b/cpplite/cpplite.debugger/src/META-INF/debugger/CPPLiteSession/LocalsView/org.netbeans.spi.viewmodel.TableModel
new file mode 100644
index 0000000..25b5bfd
--- /dev/null
+++ b/cpplite/cpplite.debugger/src/META-INF/debugger/CPPLiteSession/LocalsView/org.netbeans.spi.viewmodel.TableModel
@@ -0,0 +1 @@
+org.netbeans.modules.cpplite.debugger.VariablesModel
\ No newline at end of file
diff --git a/cpplite/cpplite.debugger/src/META-INF/debugger/CPPLiteSession/LocalsView/org.netbeans.spi.viewmodel.TreeModel b/cpplite/cpplite.debugger/src/META-INF/debugger/CPPLiteSession/LocalsView/org.netbeans.spi.viewmodel.TreeModel
new file mode 100644
index 0000000..25b5bfd
--- /dev/null
+++ b/cpplite/cpplite.debugger/src/META-INF/debugger/CPPLiteSession/LocalsView/org.netbeans.spi.viewmodel.TreeModel
@@ -0,0 +1 @@
+org.netbeans.modules.cpplite.debugger.VariablesModel
\ No newline at end of file
diff --git a/cpplite/cpplite.debugger/src/META-INF/debugger/CPPLiteSession/WatchesView/org.netbeans.spi.viewmodel.ColumnModel b/cpplite/cpplite.debugger/src/META-INF/debugger/CPPLiteSession/WatchesView/org.netbeans.spi.viewmodel.ColumnModel
new file mode 100644
index 0000000..613db91
--- /dev/null
+++ b/cpplite/cpplite.debugger/src/META-INF/debugger/CPPLiteSession/WatchesView/org.netbeans.spi.viewmodel.ColumnModel
@@ -0,0 +1,2 @@
+org.netbeans.modules.debugger.ui.models.ColumnModels.createWatchTypeColumn()-hidden
+org.netbeans.modules.debugger.ui.models.ColumnModels.createWatchToStringColumn()-hidden
diff --git a/cpplite/cpplite.debugger/src/META-INF/debugger/CPPLiteSession/WatchesView/org.netbeans.spi.viewmodel.NodeModelFilter b/cpplite/cpplite.debugger/src/META-INF/debugger/CPPLiteSession/WatchesView/org.netbeans.spi.viewmodel.NodeModelFilter
new file mode 100644
index 0000000..2e52a3c
--- /dev/null
+++ b/cpplite/cpplite.debugger/src/META-INF/debugger/CPPLiteSession/WatchesView/org.netbeans.spi.viewmodel.NodeModelFilter
@@ -0,0 +1 @@
+org.netbeans.modules.cpplite.debugger.WatchesModel
\ No newline at end of file
diff --git a/cpplite/cpplite.debugger/src/META-INF/debugger/CPPLiteSession/WatchesView/org.netbeans.spi.viewmodel.TableModel b/cpplite/cpplite.debugger/src/META-INF/debugger/CPPLiteSession/WatchesView/org.netbeans.spi.viewmodel.TableModel
new file mode 100644
index 0000000..2e52a3c
--- /dev/null
+++ b/cpplite/cpplite.debugger/src/META-INF/debugger/CPPLiteSession/WatchesView/org.netbeans.spi.viewmodel.TableModel
@@ -0,0 +1 @@
+org.netbeans.modules.cpplite.debugger.WatchesModel
\ No newline at end of file
diff --git a/cpplite/cpplite.debugger/src/META-INF/debugger/CPPLiteSession/org.netbeans.modules.cpplite.debugger.CPPLiteDebugger b/cpplite/cpplite.debugger/src/META-INF/debugger/CPPLiteSession/org.netbeans.modules.cpplite.debugger.CPPLiteDebugger
new file mode 100644
index 0000000..1de2450
--- /dev/null
+++ b/cpplite/cpplite.debugger/src/META-INF/debugger/CPPLiteSession/org.netbeans.modules.cpplite.debugger.CPPLiteDebugger
@@ -0,0 +1 @@
+org.netbeans.modules.cpplite.debugger.CPPLiteDebugger
\ No newline at end of file
diff --git a/cpplite/cpplite.debugger/src/META-INF/debugger/CPPLiteSession/org.netbeans.spi.debugger.ActionsProvider b/cpplite/cpplite.debugger/src/META-INF/debugger/CPPLiteSession/org.netbeans.spi.debugger.ActionsProvider
new file mode 100644
index 0000000..948c17a
--- /dev/null
+++ b/cpplite/cpplite.debugger/src/META-INF/debugger/CPPLiteSession/org.netbeans.spi.debugger.ActionsProvider
@@ -0,0 +1,2 @@
+org.netbeans.modules.cpplite.debugger.CPPLiteDebugger
+org.netbeans.modules.cpplite.debugger.breakpoints.CPPLiteBreakpointActionProvider
\ No newline at end of file
diff --git a/cpplite/cpplite.debugger/src/META-INF/debugger/CPPLiteSession/org.netbeans.spi.debugger.DebuggerEngineProvider b/cpplite/cpplite.debugger/src/META-INF/debugger/CPPLiteSession/org.netbeans.spi.debugger.DebuggerEngineProvider
new file mode 100644
index 0000000..6d7c713
--- /dev/null
+++ b/cpplite/cpplite.debugger/src/META-INF/debugger/CPPLiteSession/org.netbeans.spi.debugger.DebuggerEngineProvider
@@ -0,0 +1 @@
+org.netbeans.modules.cpplite.debugger.CPPLiteDebuggerEngineProvider
\ No newline at end of file
diff --git a/cpplite/cpplite.debugger/src/META-INF/debugger/org.netbeans.api.debugger.LazyDebuggerManagerListener b/cpplite/cpplite.debugger/src/META-INF/debugger/org.netbeans.api.debugger.LazyDebuggerManagerListener
new file mode 100644
index 0000000..b7903e7
--- /dev/null
+++ b/cpplite/cpplite.debugger/src/META-INF/debugger/org.netbeans.api.debugger.LazyDebuggerManagerListener
@@ -0,0 +1,2 @@
+org.netbeans.modules.cpplite.debugger.breakpoints.BreakpointAnnotationListener
+org.netbeans.modules.cpplite.debugger.breakpoints.PersistenceManager
\ No newline at end of file
diff --git a/cpplite/cpplite.debugger/src/META-INF/debugger/org.netbeans.api.debugger.Properties$Reader b/cpplite/cpplite.debugger/src/META-INF/debugger/org.netbeans.api.debugger.Properties$Reader
new file mode 100644
index 0000000..4ce300b
--- /dev/null
+++ b/cpplite/cpplite.debugger/src/META-INF/debugger/org.netbeans.api.debugger.Properties$Reader
@@ -0,0 +1 @@
+org.netbeans.modules.cpplite.debugger.breakpoints.BreakpointsReader
\ No newline at end of file
diff --git a/cpplite/cpplite.debugger/src/org/netbeans/modules/cpplite/debugger/Bundle.properties b/cpplite/cpplite.debugger/src/org/netbeans/modules/cpplite/debugger/Bundle.properties
new file mode 100644
index 0000000..fa230e4
--- /dev/null
+++ b/cpplite/cpplite.debugger/src/org/netbeans/modules/cpplite/debugger/Bundle.properties
@@ -0,0 +1,47 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+OpenIDE-Module-Display-Category=C/C++
+OpenIDE-Module-Name=CPPLite Debugger
+
+# RunTargetsAction
+LBL_run_other_targets=Other Targets
+LBL_run_advanced=Advanced...
+TITLE_run_advanced=Debug Ant Target
+LBL_run_advanced_run=Debug
+LBL_run_advanced_cancel=Cancel
+
+# AdvancedActionsPanel
+AdvancedActionsPanel.targetLabel.text=Select &target(s) to debug\:
+AdvancedActionsPanel.targetDescriptionLabel.text=Target description\:
+AdvancedActionsPanel.propertiesLabel.text=Special Ant &properties\:
+AdvancedActionsPanel.verbosityLabel.text=&Verbosity level\:
+LBL_verbosity_warn=Quiet
+LBL_verbosity_info=Normal
+LBL_verbosity_verbose=Verbose
+LBL_verbosity_debug=Debug
+
+#org.netbeans.modules.debugger.jpda.ui.DebuggerAnnotation
+TOOLTIP_DISABLED_CONDITIONAL_BREAKPOINT=Disabled Conditional Breakpoint
+TOOLTIP_DISABLED_BREAKPOINT=Disabled Breakpoint
+TOOLTIP_CALLSITE=Call Stack Line
+TOOLTIP_BREAKPOINT=Breakpoint
+TOOLTIP_CONDITIONAL_BREAKPOINT=Conditional Breakpoint
+TOOLTIP_CURRENT_PC=Current Program Counter
+TOOLTIP_CURRENT_PC_2=Current Target
+
+CTL_WatchDisabled=>disabled<
diff --git a/cpplite/cpplite.debugger/src/org/netbeans/modules/cpplite/debugger/CPPLiteDebugger.java b/cpplite/cpplite.debugger/src/org/netbeans/modules/cpplite/debugger/CPPLiteDebugger.java
new file mode 100644
index 0000000..9b20282
--- /dev/null
+++ b/cpplite/cpplite.debugger/src/org/netbeans/modules/cpplite/debugger/CPPLiteDebugger.java
@@ -0,0 +1,662 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.netbeans.modules.cpplite.debugger;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.OutputStream;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.HashSet;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Set;
+import java.util.concurrent.CopyOnWriteArrayList;
+import java.util.concurrent.CountDownLatch;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+import org.netbeans.api.annotations.common.CheckForNull;
+import org.netbeans.api.annotations.common.NonNull;
+import org.netbeans.api.debugger.ActionsManager;
+import org.netbeans.api.debugger.Breakpoint;
+import org.netbeans.api.debugger.DebuggerEngine;
+import org.netbeans.api.debugger.DebuggerInfo;
+import org.netbeans.api.debugger.DebuggerManager;
+import org.netbeans.modules.cnd.debugger.gdb2.mi.MICommand;
+import org.netbeans.modules.cnd.debugger.gdb2.mi.MICommandInjector;
+import org.netbeans.modules.cnd.debugger.gdb2.mi.MIProxy;
+import org.netbeans.modules.cnd.debugger.gdb2.mi.MIRecord;
+import org.netbeans.modules.cnd.debugger.gdb2.mi.MIResult;
+import org.netbeans.modules.cnd.debugger.gdb2.mi.MITList;
+import org.netbeans.modules.cnd.debugger.gdb2.mi.MITListItem;
+import org.netbeans.modules.cnd.debugger.gdb2.mi.MIUserInteraction;
+import org.netbeans.modules.cpplite.debugger.breakpoints.CPPLiteBreakpoint;
+import org.netbeans.modules.cpplite.debugger.breakpoints.BreakpointModel;
+import org.netbeans.modules.nativeexecution.api.ExecutionEnvironmentFactory;
+import org.netbeans.modules.nativeexecution.api.pty.Pty;
+import org.netbeans.modules.nativeexecution.api.pty.PtySupport;
+import org.netbeans.spi.debugger.ActionsProviderSupport;
+import org.netbeans.spi.debugger.ContextProvider;
+import org.netbeans.spi.debugger.DebuggerEngineProvider;
+import org.netbeans.spi.debugger.SessionProvider;
+import org.netbeans.spi.viewmodel.NodeModel;
+import org.netbeans.spi.viewmodel.TreeModel;
+import org.openide.cookies.LineCookie;
+import org.openide.filesystems.FileObject;
+import org.openide.filesystems.FileUtil;
+import org.openide.text.Line;
+import org.openide.util.Exceptions;
+import org.openide.util.Pair;
+import org.openide.util.RequestProcessor;
+
+/**
+ * Ant debugger.
+ *
+ * @author Honza
+ */
+public class CPPLiteDebugger extends ActionsProviderSupport {
+
+ private static final Logger logger = Logger.getLogger(CPPLiteDebugger.class.getName());
+
+ /** The ReqeustProcessor used by action performers. */
+ private static RequestProcessor actionsRequestProcessor;
+ private static RequestProcessor killRequestProcessor;
+
+ private CPPLiteDebuggerConfig configuration;
+ private CPPLiteDebuggerEngineProvider engineProvider;
+ private ContextProvider contextProvider;
+ private Process debuggee;
+ private MIProxy proxy;
+ private Object currentLine;
+ private LinkedList callStackList = new LinkedList();
+ private volatile boolean suspended = false;
+ private final List<StateListener> stateListeners = new CopyOnWriteArrayList<StateListener>();
+
+ private VariablesModel variablesModel;
+ private WatchesModel watchesModel;
+ private BreakpointModel breakpointModel;
+
+ public CPPLiteDebugger (
+ ContextProvider contextProvider
+ ) {
+
+ this.contextProvider = contextProvider;
+
+ // init antCookie
+ configuration = contextProvider.lookupFirst(null, CPPLiteDebuggerConfig.class);
+
+ // init engineProvider
+ engineProvider = (CPPLiteDebuggerEngineProvider) contextProvider.lookupFirst
+ (null, DebuggerEngineProvider.class);
+
+ // init actions
+ for (Iterator it = actions.iterator(); it.hasNext(); ) {
+ setEnabled (it.next(), true);
+ }
+ }
+
+ void setDebuggee(Process debuggee) {
+ this.debuggee = debuggee;
+
+ //XXX: asynchronous?
+ CPPLiteInjector injector = new CPPLiteInjector(debuggee.getOutputStream());
+
+ CountDownLatch waitStarted = new CountDownLatch(1);
+
+ this.proxy = new MIProxy(injector, "(gdb)", "UTF-8") {
+ @Override
+ protected void prompt() {
+ waitStarted.countDown();
+ }
+
+ @Override
+ protected void execAsyncOutput(MIRecord record) {
+ if (record.token() == 0) {
+ switch (record.cls()) {
+ case "stopped":
+ String reason = record.results().getConstValue("reason", "");
+ switch (reason) {
+ case "exited-normally":
+ finish();
+ break;
+ default:
+ Frame frame = new Frame((MITList) record.results().valueOf("frame")); //XXX: frame may be missing
+ Line currentLine = frame.location();
+ Utils.markCurrent(new Line[] {currentLine});
+ Utils.showLine(new Line[] {currentLine});
+ setSuspended(true);
+ suspended();
+ break;
+ }
+ break;
+ case "running":
+ setSuspended(false);
+ Utils.unmarkCurrent();
+ running();
+ break;
+ default:
+ //unknown class, ignore
+ System.err.println("Unknown class:" + record.cls());
+ break;
+ }
+ return;
+ }
+ super.execAsyncOutput(record);
+ }
+
+ };
+
+ new Thread(() -> {
+ try (BufferedReader r = new BufferedReader(new InputStreamReader(debuggee.getInputStream()))) {
+ String line;
+
+ while ((line = r.readLine()) != null) {
+ proxy.processLine(line);
+ }
+ } catch (IOException ex) {
+ Exceptions.printStackTrace(ex);
+ }
+ }).start();
+
+ try {
+ waitStarted.await();
+ } catch (InterruptedException ex) {
+ Exceptions.printStackTrace(ex);
+ }
+
+ for (Breakpoint b : DebuggerManager.getDebuggerManager ().getBreakpoints ()) {
+ if (b instanceof CPPLiteBreakpoint) {
+ CPPLiteBreakpoint cpplineBreakpoint = (CPPLiteBreakpoint) b;
+ Line l = cpplineBreakpoint.getLine();
+ FileObject source = l.getLookup().lookup(FileObject.class);
+ File sourceFile = source != null ? FileUtil.toFile(source) : null;
+ if (sourceFile != null) {
+ proxy.send(new SimpleCommand("-break-insert " + sourceFile.getAbsolutePath() + ":" + (l.getLineNumber() + 1)));
+ }
+ }
+ }
+
+ proxy.send(new SimpleCommand("-exec-run"));
+ }
+
+ // ActionsProvider .........................................................
+
+ private static final Set<Object> actions = new HashSet<>();
+ private static final Set<Object> actionsToDisable = new HashSet<>();
+ static {
+ actions.add (ActionsManager.ACTION_KILL);
+ actions.add (ActionsManager.ACTION_CONTINUE);
+ actions.add (ActionsManager.ACTION_START);
+ actions.add (ActionsManager.ACTION_STEP_INTO);
+ actions.add (ActionsManager.ACTION_STEP_OVER);
+ actions.add (ActionsManager.ACTION_STEP_OUT);
+ actionsToDisable.addAll(actions);
+ // Ignore the KILL action
+ actionsToDisable.remove(ActionsManager.ACTION_KILL);
+ }
+
+ @Override
+ public Set getActions () {
+ return actions;
+ }
+
+ @Override
+ public void doAction (Object action) {
+ logger.log(Level.FINE, "CPPLiteDebugger.doAction({0}), is kill = {1}", new Object[]{action, action == ActionsManager.ACTION_KILL});
+ if (action == ActionsManager.ACTION_KILL) {
+ finish ();
+ } else
+ if (action == ActionsManager.ACTION_CONTINUE) {
+ proxy.send(new SimpleCommand("-exec-continue"));
+ } else
+ if (action == ActionsManager.ACTION_START) {
+ return ;
+ } else
+ if ( action == ActionsManager.ACTION_STEP_INTO ||
+ action == ActionsManager.ACTION_STEP_OUT ||
+ action == ActionsManager.ACTION_STEP_OVER
+ ) {
+ doStep (action);
+ }
+ }
+
+ private static class CPPLiteInjector implements MICommandInjector {
+
+ private final OutputStream out;
+
+ public CPPLiteInjector(OutputStream out) {
+ this.out = out;
+ }
+
+ @Override
+ public void inject(String data) {
+ try {
+ out.write(data.getBytes());
+ out.flush();
+ } catch (IOException ex) {
+ throw new IllegalStateException(ex);
+ }
+ }
+
+ @Override
+ public void log(String data) {
+ System.err.println(data);
+ }
+
+ }
+
+ @Override
+ public void postAction(final Object action, final Runnable actionPerformedNotifier) {
+ if (action == ActionsManager.ACTION_KILL) {
+ synchronized (CPPLiteDebugger.class) {
+ if (killRequestProcessor == null) {
+ killRequestProcessor = new RequestProcessor("CPPLite debugger finish RP", 1);
+ }
+ }
+ killRequestProcessor.post(new Runnable() {
+ @Override
+ public void run() {
+ try {
+ doAction(action);
+ } finally {
+ actionPerformedNotifier.run();
+ }
+ }
+ });
+ return ;
+ }
+ setDebugActionsEnabled(false);
+ synchronized (CPPLiteDebugger.class) {
+ if (actionsRequestProcessor == null) {
+ actionsRequestProcessor = new RequestProcessor("CPPLite debugger actions RP", 1);
+ }
+ }
+ actionsRequestProcessor.post(new Runnable() {
+ @Override
+ public void run() {
+ try {
+ doAction(action);
+ } finally {
+ actionPerformedNotifier.run();
+ setDebugActionsEnabled(true);
+ }
+ }
+ });
+ }
+
+ private void setDebugActionsEnabled(boolean enabled) {
+ for (Object action : actionsToDisable) {
+ setEnabled(action, enabled);
+ }
+ }
+
+
+ // other methods ...........................................................
+
+ public boolean isSuspended() {
+ return suspended;
+ }
+
+ private void setSuspended(boolean suspended) {
+ this.suspended = suspended;
+ fireStateChanged(suspended);
+ }
+
+ private void fireStateChanged(boolean suspended) {
+ for (StateListener sl : stateListeners) {
+ sl.suspended(suspended);
+ }
+ }
+
+ private void fireFinished() {
+ for (StateListener sl : stateListeners) {
+ sl.finished();
+ }
+ }
+
+ public void addStateListener(StateListener sl) {
+ stateListeners.add(sl);
+ }
+
+ public void removeStateListener(StateListener sl) {
+ stateListeners.remove(sl);
+ }
+
+ private void suspended() {
+ proxy.send(new SimpleCommand("-stack-list-frames") {
+ @Override
+ protected void onDone(MIRecord record) {
+ callStackList.clear();
+ for (MITListItem frame : record.results().valueOf("stack").asList()) {
+ callStackList.add(new Frame((MITList) ((MIResult) frame).value()));
+ }
+ getCallStackModel().fireChanges();
+ }
+ });
+ fireWatches();
+ fireBreakpoints();
+ }
+
+ private void running() {
+ callStackList.clear();
+ getCallStackModel().fireChanges();
+ }
+ public Object getCurrentLine () {
+ return currentLine;
+ }
+
+ private volatile boolean finished = false; // When the debugger has finished.
+
+ public boolean isFinished() {
+ return finished;
+ }
+
+ /**
+ * should define callStack based on callStackInternal & action.
+ */
+ private void doStep (Object action) {
+ if (action == ActionsManager.ACTION_STEP_OVER) {
+ proxy.send(new SimpleCommand("-exec-next"));
+ } else if (action == ActionsManager.ACTION_STEP_INTO) {
+ proxy.send(new SimpleCommand("-exec-step"));
+ }
+ }
+
+ private void finish () {
+ logger.fine("CPPLiteDebugger.finish()");
+ if (finished) {
+ logger.fine("finish(): already finished.");
+ return ;
+ }
+ proxy.send(new SimpleCommand("-gdb-exit"));
+ Utils.unmarkCurrent ();
+ engineProvider.getDestructor().killEngine();
+ finished = true;
+ fireFinished();
+ logger.fine("finish() done, build finished.");
+ }
+
+
+ // support for call stack ..................................................
+
+ private CallStackModel callStackModel;
+
+ private CallStackModel getCallStackModel () {
+ if (callStackModel == null) {
+ callStackModel = (CallStackModel) contextProvider.lookupFirst
+ ("CallStackView", TreeModel.class);
+ }
+ return callStackModel;
+ }
+
+
+ Object[] getCallStack () {
+ Object[] callStack;
+ callStack = callStackList.toArray();
+ return callStack;
+ }
+
+ // support for variables ...................................................
+
+ synchronized void setVariablesModel(VariablesModel variablesModel) {
+ this.variablesModel = variablesModel;
+ }
+
+ synchronized void setWatchesModel(WatchesModel watchesModel) {
+ this.watchesModel = watchesModel;
+ }
+
+ private void fireVariables () {
+ synchronized(this) {
+ if (variablesModel == null) {
+ return ;
+ }
+ }
+ variablesModel.fireChanges();
+ }
+
+ private void fireWatches () {
+ synchronized(this) {
+ if (watchesModel == null) {
+ return ;
+ }
+ }
+ watchesModel.fireChanges();
+ }
+
+ private void fireBreakpoints () {
+ synchronized(this) {
+ if (breakpointModel == null) {
+ List<? extends NodeModel> bpNodeModels = DebuggerManager.getDebuggerManager().lookup("BreakpointsView", NodeModel.class);
+ for (NodeModel model : bpNodeModels) {
+ if (model instanceof BreakpointModel) {
+ breakpointModel = (BreakpointModel) model;
+ break;
+ }
+ }
+ }
+ }
+ breakpointModel.fireChanges();
+ }
+
+ String evaluate (String expression) {
+ String value = getVariableValue (expression);
+ if (value != null) {
+ return value;
+ }
+ CountDownLatch done = new CountDownLatch(1);
+ String[] varName = new String[1];
+ String[] resultValue = new String[1];
+ proxy.send(new SimpleCommand("-var-create - * " + expression) {
+ @Override
+ protected void onDone(MIRecord record) {
+ MITList results = record.results();
+ varName[0] = results.valueOf("name").asConst().value();
+ resultValue[0] = results.valueOf("value").asConst().value();
+ done.countDown();
+ }
+ @Override
+ protected void onError(MIRecord record) {
+ resultValue[0] = record.toString();
+ done.countDown();
+ }
+ });
+ try {
+ done.await();
+ } catch (InterruptedException ex) {
+ return resultValue[0];
+ }
+ if (varName[0] != null) {
+ proxy.send(new SimpleCommand("-var-delete " + varName[0]));
+ }
+ return resultValue[0];
+ }
+
+ private String[] variables = new String [0];
+
+ String[] getVariables () {
+ return variables;
+ }
+
+ String getVariableValue (String variableName) {
+ synchronized (this) {
+ return null;
+ }
+ }
+
+ public interface StateListener {
+
+ void suspended(boolean suspended);
+
+ void finished();
+
+ }
+
+ private static class SimpleCommand extends MICommand {
+
+ public SimpleCommand(String command) {
+ super(0, command);
+ }
+
+ @Override
+ protected void onDone(MIRecord record) {}
+
+ @Override
+ protected void onRunning(MIRecord record) {}
+
+ @Override
+ protected void onError(MIRecord record) {}
+
+ @Override
+ protected void onExit(MIRecord record) {}
+
+ @Override
+ protected void onStopped(MIRecord record) {}
+
+ @Override
+ protected void onOther(MIRecord record) {}
+
+ @Override
+ protected void onUserInteraction(MIUserInteraction ui) {}
+ }
+
+ public static class Frame {
+ public final String shortFileName;
+ public final String fullFileName;
+ public final String functionName;
+ public final int line;
+ public final int level;
+
+ public Frame(MITList frame) {
+ if (frame == null || frame.valueOf("file") == null || frame.valueOf("file").asConst() == null) {
+ System.err.println("!!!");
+ }
+ this.shortFileName = frame.valueOf("file").asConst().value();
+ this.functionName = frame.valueOf("func").asConst().value();
+ this.fullFileName = frame.valueOf("fullname").asConst().value();
+ this.line = Integer.parseInt(frame.valueOf("line").asConst().value());
+ if (frame.valueOf("level") != null) {
+ this.level = Integer.parseInt(frame.valueOf("level").asConst().value());
+ } else {
+ this.level = -1;
+ }
+ }
+
+ public @CheckForNull Line location() {
+ FileObject file = FileUtil.toFileObject(FileUtil.normalizeFile(new File(fullFileName)));
+ if (file == null) return null;
+ LineCookie lc = file.getLookup().lookup(LineCookie.class);
+ return lc.getLineSet().getOriginal(line - 1);
+ }
+ }
+
+ public static @NonNull Pair<CPPLiteDebugger, Process> startDebugging (CPPLiteDebuggerConfig configuration) throws IOException {
+ DebuggerInfo di = DebuggerInfo.create (
+ "CPPLiteDebuggerInfo",
+ new Object[] {
+ new SessionProvider () {
+ @Override
+ public String getSessionName () {
+ return configuration.getDisplayName ();
+ }
+
+ @Override
+ public String getLocationName () {
+ return "localhost";
+ }
+
+ @Override
+ public String getTypeID () {
+ return "CPPLiteSession";
+ }
+
+ @Override
+ public Object[] getServices () {
+ return new Object[] {};
+ }
+ },
+ configuration
+ }
+ );
+ DebuggerEngine[] es = DebuggerManager.getDebuggerManager ().
+ startDebugging (di);
+ Pty pty = PtySupport.allocate(ExecutionEnvironmentFactory.getLocal());
+ CPPLiteDebugger debugger = es[0].lookupFirst(null, CPPLiteDebugger.class);
+ List<String> executable = new ArrayList<>();
+ executable.add("gdb");
+ executable.add("--interpreter=mi");
+ executable.add("--tty=" + pty.getSlaveName());
+ executable.addAll(configuration.getExecutable());
+ Process debuggee = new ProcessBuilder(executable).start();
+ new RequestProcessor(configuration.getDisplayName() + " (pty deallocator)").post(() -> {
+ try {
+ while (debuggee.isAlive()) {
+ try {
+ debuggee.waitFor();
+ } catch (InterruptedException ex) {
+ //ignore...
+ }
+ }
+ } finally {
+ try {
+ PtySupport.deallocate(pty);
+ } catch (IOException ex) {
+ Exceptions.printStackTrace(ex);
+ }
+ }
+ });
+ debugger.setDebuggee(debuggee);
+
+ return Pair.of(debugger, new Process() {
+ @Override
+ public OutputStream getOutputStream() {
+ return pty.getOutputStream();
+ }
+
+ @Override
+ public InputStream getInputStream() {
+ return pty.getInputStream();
+ }
+
+ @Override
+ public InputStream getErrorStream() {
+ return pty.getErrorStream();
+ }
+
+ @Override
+ public int waitFor() throws InterruptedException {
+ return debuggee.waitFor();
+ }
+
+ @Override
+ public int exitValue() {
+ return debuggee.exitValue();
+ }
+
+ @Override
+ public void destroy() {
+ debuggee.destroy();
+ }
+ });
+ }
+}
diff --git a/ide/lsp.client/src/org/netbeans/modules/lsp/client/options/ServerRestarter.java b/cpplite/cpplite.debugger/src/org/netbeans/modules/cpplite/debugger/CPPLiteDebuggerConfig.java
similarity index 60%
copy from ide/lsp.client/src/org/netbeans/modules/lsp/client/options/ServerRestarter.java
copy to cpplite/cpplite.debugger/src/org/netbeans/modules/cpplite/debugger/CPPLiteDebuggerConfig.java
index feacb87..37f7681 100644
--- a/ide/lsp.client/src/org/netbeans/modules/lsp/client/options/ServerRestarter.java
+++ b/cpplite/cpplite.debugger/src/org/netbeans/modules/cpplite/debugger/CPPLiteDebuggerConfig.java
@@ -16,10 +16,32 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.netbeans.modules.lsp.client.options;
-public interface ServerRestarter {
+package org.netbeans.modules.cpplite.debugger;
- public void restart();
+import java.util.List;
+/**
+ *
+ * @author lahvac
+ */
+public class CPPLiteDebuggerConfig {
+
+ private final List<String> executable;
+
+ public CPPLiteDebuggerConfig(List<String> executable) {
+ this.executable = executable;
+ }
+
+ public String getDisplayName() {
+ return "XXX: displayName";
+ }
+
+ public String getDebuggingName() {
+ return "XXX: debugging name (debug)";
+ }
+
+ public List<String> getExecutable() {
+ return executable;
+ }
}
diff --git a/ide/lsp.client/src/org/netbeans/modules/lsp/client/options/ServerRestarter.java b/cpplite/cpplite.debugger/src/org/netbeans/modules/cpplite/debugger/CPPLiteDebuggerEngineProvider.java
similarity index 50%
copy from ide/lsp.client/src/org/netbeans/modules/lsp/client/options/ServerRestarter.java
copy to cpplite/cpplite.debugger/src/org/netbeans/modules/cpplite/debugger/CPPLiteDebuggerEngineProvider.java
index feacb87..7ce9ad3 100644
--- a/ide/lsp.client/src/org/netbeans/modules/lsp/client/options/ServerRestarter.java
+++ b/cpplite/cpplite.debugger/src/org/netbeans/modules/cpplite/debugger/CPPLiteDebuggerEngineProvider.java
@@ -16,10 +16,41 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.netbeans.modules.lsp.client.options;
-public interface ServerRestarter {
+package org.netbeans.modules.cpplite.debugger;
- public void restart();
+import org.netbeans.api.debugger.DebuggerEngine;
+import org.netbeans.spi.debugger.DebuggerEngineProvider;
+
+public class CPPLiteDebuggerEngineProvider extends DebuggerEngineProvider {
+
+ private DebuggerEngine.Destructor desctuctor;
+
+
+ @Override
+ public String[] getLanguages () {
+ return new String[] {"c"};
+ }
+
+ @Override
+ public String getEngineTypeID () {
+ return "CPPLiteDebuggerEngine";
+ }
+
+ @Override
+ public Object[] getServices () {
+ return new Object[] {};
+ }
+
+ @Override
+ public void setDestructor (DebuggerEngine.Destructor desctuctor) {
+ this.desctuctor = desctuctor;
+ }
+
+ public DebuggerEngine.Destructor getDestructor () {
+ return desctuctor;
+ }
}
+
+
diff --git a/cpplite/cpplite.debugger/src/org/netbeans/modules/cpplite/debugger/CallStackModel.java b/cpplite/cpplite.debugger/src/org/netbeans/modules/cpplite/debugger/CallStackModel.java
new file mode 100644
index 0000000..e55eb9d
--- /dev/null
+++ b/cpplite/cpplite.debugger/src/org/netbeans/modules/cpplite/debugger/CallStackModel.java
@@ -0,0 +1,335 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.netbeans.modules.cpplite.debugger;
+
+import java.util.Vector;
+import javax.swing.Action;
+import org.netbeans.modules.cpplite.debugger.CPPLiteDebugger.Frame;
+
+import org.netbeans.spi.debugger.ContextProvider;
+import org.netbeans.spi.viewmodel.ModelEvent;
+import org.netbeans.spi.viewmodel.NodeActionsProvider;
+import org.netbeans.spi.viewmodel.NodeModel;
+import org.netbeans.spi.viewmodel.TableModel;
+import org.netbeans.spi.viewmodel.TreeModel;
+import org.netbeans.spi.viewmodel.ModelListener;
+import org.netbeans.spi.viewmodel.UnknownTypeException;
+import org.netbeans.spi.debugger.ui.Constants;
+import org.openide.text.Line;
+
+/**
+ *
+ * @author Jan Jancura
+ */
+public class CallStackModel implements TreeModel, NodeModel,
+NodeActionsProvider, TableModel {
+
+ public static final String CALL_STACK =
+ "org/netbeans/modules/debugger/resources/callStackView/NonCurrentFrame";
+ public static final String CURRENT_CALL_STACK =
+ "org/netbeans/modules/debugger/resources/callStackView/CurrentFrame";
+
+ private CPPLiteDebugger debugger;
+ private Vector listeners = new Vector ();
+
+
+ public CallStackModel (ContextProvider contextProvider) {
+ debugger = contextProvider.lookupFirst(null, CPPLiteDebugger.class);
+ }
+
+
+ // TreeModel implementation ................................................
+
+ /**
+ * Returns the root node of the tree or null, if the tree is empty.
+ *
+ * @return the root node of the tree or null
+ */
+ @Override
+ public Object getRoot () {
+ return ROOT;
+ }
+
+ /**
+ * Returns children for given parent on given indexes.
+ *
+ * @param parent a parent of returned nodes
+ * @param from a start index
+ * @param to a end index
+ *
+ * @throws NoInformationException if the set of children can not be
+ * resolved
+ * @throws ComputingException if the children resolving process
+ * is time consuming, and will be performed off-line
+ * @throws UnknownTypeException if this TreeModel implementation is not
+ * able to resolve children for given node type
+ *
+ * @return children for given parent on given indexes
+ */
+ @Override
+ public Object[] getChildren (Object parent, int from, int to)
+ throws UnknownTypeException {
+ if (parent == ROOT)
+ return debugger.getCallStack ();
+ throw new UnknownTypeException (parent);
+ }
+
+ /**
+ * Returns true if node is leaf.
+ *
+ * @throws UnknownTypeException if this TreeModel implementation is not
+ * able to resolve dchildren for given node type
+ * @return true if node is leaf
+ */
+ @Override
+ public boolean isLeaf (Object node) throws UnknownTypeException {
+ if (node == ROOT)
+ return false;
+ if (node instanceof CPPLiteDebugger.Frame) {
+ return true;
+ }
+ throw new UnknownTypeException (node);
+ }
+
+ /**
+ * Returns number of children for given node.
+ *
+ * @param node the parent node
+ * @throws NoInformationException if the set of children can not be
+ * resolved
+ * @throws ComputingException if the children resolving process
+ * is time consuming, and will be performed off-line
+ * @throws UnknownTypeException if this TreeModel implementation is not
+ * able to resolve children for given node type
+ *
+ * @return true if node is leaf
+ * @since 1.1
+ */
+ @Override
+ public int getChildrenCount (Object node) throws UnknownTypeException {
+ if (node == ROOT)
+ return debugger.getCallStack ().length;
+ throw new UnknownTypeException (node);
+ }
+
+ /**
+ * Registers given listener.
+ *
+ * @param l the listener to add
+ */
+ @Override
+ public void addModelListener (ModelListener l) {
+ listeners.add (l);
+ }
+
+ /**
+ * Unregisters given listener.
+ *
+ * @param l the listener to remove
+ */
+ @Override
+ public void removeModelListener (ModelListener l) {
+ listeners.remove (l);
+ }
+
+
+ // NodeModel implementation ................................................
+
+ /**
+ * Returns display name for given node.
+ *
+ * @throws ComputingException if the display name resolving process
+ * is time consuming, and the value will be updated later
+ * @throws UnknownTypeException if this NodeModel implementation is not
+ * able to resolve display name for given node type
+ * @return display name for given node
+ */
+ @Override
+ public String getDisplayName (Object node) throws UnknownTypeException {
+ if (node instanceof Frame) {
+ Frame frame = (Frame) node;
+ return frame.functionName + "; " + frame.shortFileName + ":" + frame.line;
+ }
+ if (node == ROOT) {
+ return ROOT;
+ }
+ throw new UnknownTypeException (node);
+ }
+
+ /**
+ * Returns icon for given node.
+ *
+ * @throws ComputingException if the icon resolving process
+ * is time consuming, and the value will be updated later
+ * @throws UnknownTypeException if this NodeModel implementation is not
+ * able to resolve icon for given node type
+ * @return icon for given node
+ */
+ @Override
+ public String getIconBase (Object node) throws UnknownTypeException {
+ if (node instanceof Frame) {
+ Frame frame = (Frame) node;
+
+ return frame.level == 0 ? CURRENT_CALL_STACK : CALL_STACK;
+ }
+ if (node == ROOT) {
+ return null;
+ }
+ throw new UnknownTypeException (node);
+ }
+
+ /**
+ * Returns tooltip for given node.
+ *
+ * @throws ComputingException if the tooltip resolving process
+ * is time consuming, and the value will be updated later
+ * @throws UnknownTypeException if this NodeModel implementation is not
+ * able to resolve tooltip for given node type
+ * @return tooltip for given node
+ */
+ @Override
+ public String getShortDescription (Object node)
+ throws UnknownTypeException {
+ if (node instanceof Frame)
+ return null;
+ throw new UnknownTypeException (node);
+ }
+
+
+ // NodeActionsProvider implementation ......................................
+
+ /**
+ * Performs default action for given node.
+ *
+ * @throws UnknownTypeException if this NodeActionsProvider implementation
+ * is not able to resolve actions for given node type
+ * @return display name for given node
+ */
+ @Override
+ public void performDefaultAction (Object node)
+ throws UnknownTypeException {
+ if (node instanceof Frame) {
+ Line line = ((Frame) node).location();
+ if (line != null) {
+ Utils.showLine(new Line[] {line});
+ }
+ return;
+ }
+ throw new UnknownTypeException (node);
+ }
+
+ /**
+ * Returns set of actions for given node.
+ *
+ * @throws UnknownTypeException if this NodeActionsProvider implementation
+ * is not able to resolve actions for given node type
+ * @return display name for given node
+ */
+ @Override
+ public Action[] getActions (Object node)
+ throws UnknownTypeException {
+ return new Action [] {};
+ }
+
+
+ // TableModel implementation ...............................................
+
+ /**
+ * Returns value to be displayed in column <code>columnID</code>
+ * and row identified by <code>node</code>. Column ID is defined in by
+ * {@link ColumnModel#getID}, and rows are defined by values returned from
+ * {@link org.netbeans.spi.viewmodel.TreeModel#getChildren}.
+ *
+ * @param node a object returned from
+ * {@link org.netbeans.spi.viewmodel.TreeModel#getChildren} for this row
+ * @param columnID a id of column defined by {@link ColumnModel#getID}
+ * @throws ComputingException if the value is not known yet and will
+ * be computed later
+ * @throws UnknownTypeException if there is no TableModel defined for given
+ * parameter type
+ *
+ * @return value of variable representing given position in tree table.
+ */
+ @Override
+ public Object getValueAt (Object node, String columnID) throws
+ UnknownTypeException {
+ if (columnID == Constants.CALL_STACK_FRAME_LOCATION_COLUMN_ID) {
+ if (node instanceof Frame) {
+ Frame frame = (Frame) node;
+ return frame.fullFileName + ":" + frame.line;
+ }
+ }
+ throw new UnknownTypeException (node);
+ }
+
+ /**
+ * Returns true if value displayed in column <code>columnID</code>
+ * and row <code>node</code> is read only. Column ID is defined in by
+ * {@link ColumnModel#getID}, and rows are defined by values returned from
+ * {@link TreeModel#getChildren}.
+ *
+ * @param node a object returned from {@link TreeModel#getChildren} for this row
+ * @param columnID a id of column defined by {@link ColumnModel#getID}
+ * @throws UnknownTypeException if there is no TableModel defined for given
+ * parameter type
+ *
+ * @return true if variable on given position is read only
+ */
+ @Override
+ public boolean isReadOnly (Object node, String columnID) throws
+ UnknownTypeException {
+ if (columnID == Constants.CALL_STACK_FRAME_LOCATION_COLUMN_ID) {
+ if (node instanceof Frame) {
+ return true;
+ }
+ }
+ throw new UnknownTypeException (node);
+ }
+
+ /**
+ * Changes a value displayed in column <code>columnID</code>
+ * and row <code>node</code>. Column ID is defined in by
+ * {@link ColumnModel#getID}, and rows are defined by values returned from
+ * {@link TreeModel#getChildren}.
+ *
+ * @param node a object returned from {@link TreeModel#getChildren} for this row
+ * @param columnID a id of column defined by {@link ColumnModel#getID}
+ * @param value a new value of variable on given position
+ * @throws UnknownTypeException if there is no TableModel defined for given
+ * parameter type
+ */
+ @Override
+ public void setValueAt (Object node, String columnID, Object value)
+ throws UnknownTypeException {
+ throw new UnknownTypeException (node);
+ }
+
+
+ // other mothods ...........................................................
+
+ void fireChanges () {
+ Vector v = (Vector) listeners.clone ();
+ int i, k = v.size ();
+ for (i = 0; i < k; i++)
+ ((ModelListener) v.get (i)).modelChanged (
+ new ModelEvent.TreeChanged (this)
+ );
+ }
+}
diff --git a/cpplite/cpplite.debugger/src/org/netbeans/modules/cpplite/debugger/DebuggerAnnotation.java b/cpplite/cpplite.debugger/src/org/netbeans/modules/cpplite/debugger/DebuggerAnnotation.java
new file mode 100644
index 0000000..c792b0c
--- /dev/null
+++ b/cpplite/cpplite.debugger/src/org/netbeans/modules/cpplite/debugger/DebuggerAnnotation.java
@@ -0,0 +1,75 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.netbeans.modules.cpplite.debugger;
+
+import org.openide.text.Annotatable;
+import org.openide.text.Annotation;
+import org.openide.util.NbBundle;
+
+
+/**
+ * Debugger Annotation class.
+ *
+ * @author Jan Jancura
+ */
+public class DebuggerAnnotation extends Annotation {
+
+ /** Annotation type constant. */
+ public static final String CURRENT_LINE_ANNOTATION_TYPE = "CurrentPC";
+ /** Annotation type constant. */
+ public static final String CURRENT_LINE_ANNOTATION_TYPE2 = "CurrentPC2";
+ /** Annotation type constant. */
+ public static final String CURRENT_LINE_PART_ANNOTATION_TYPE = "CurrentPCLinePart";
+ /** Annotation type constant. */
+ public static final String CURRENT_LINE_PART_ANNOTATION_TYPE2 = "CurrentPC2LinePart";
+ /** Annotation type constant. */
+ public static final String CALL_STACK_FRAME_ANNOTATION_TYPE = "CallSite";
+
+ private Annotatable annotatable;
+ private String type;
+
+
+ public DebuggerAnnotation (String type, Annotatable annotatable) {
+ this.type = type;
+ this.annotatable = annotatable;
+ attach (annotatable);
+ }
+
+ @Override
+ public String getAnnotationType () {
+ return type;
+ }
+
+ @Override
+ public String getShortDescription () {
+ if (type == CURRENT_LINE_ANNOTATION_TYPE)
+ return NbBundle.getMessage(DebuggerAnnotation.class, "TOOLTIP_CURRENT_PC");
+ else
+ if (type == CURRENT_LINE_ANNOTATION_TYPE2)
+ return NbBundle.getMessage(DebuggerAnnotation.class, "TOOLTIP_CURRENT_PC_2");
+ else
+ if (type == CURRENT_LINE_PART_ANNOTATION_TYPE)
+ return NbBundle.getMessage(DebuggerAnnotation.class, "TOOLTIP_CURRENT_PC");
+ else
+ if (type == CALL_STACK_FRAME_ANNOTATION_TYPE)
+ return NbBundle.getMessage(DebuggerAnnotation.class, "TOOLTIP_CALLSITE");
+ return null;
+ }
+}
diff --git a/cpplite/cpplite.debugger/src/org/netbeans/modules/cpplite/debugger/DebuggerBreakpointAnnotation.java b/cpplite/cpplite.debugger/src/org/netbeans/modules/cpplite/debugger/DebuggerBreakpointAnnotation.java
new file mode 100644
index 0000000..bb51639
--- /dev/null
+++ b/cpplite/cpplite.debugger/src/org/netbeans/modules/cpplite/debugger/DebuggerBreakpointAnnotation.java
@@ -0,0 +1,86 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.netbeans.modules.cpplite.debugger;
+
+import org.netbeans.api.debugger.Breakpoint;
+import org.netbeans.modules.cpplite.debugger.breakpoints.CPPLiteBreakpoint;
+import org.netbeans.spi.debugger.ui.BreakpointAnnotation;
+import org.openide.text.Annotatable;
+import org.openide.util.NbBundle;
+
+
+/**
+ * Debugger Annotation class.
+ *
+ * @author Jan Jancura
+ */
+public class DebuggerBreakpointAnnotation extends BreakpointAnnotation {
+
+ /** Annotation type constant. */
+ public static final String BREAKPOINT_ANNOTATION_TYPE = "Breakpoint"; // NOI18N
+ /** Annotation type constant. */
+ public static final String DISABLED_BREAKPOINT_ANNOTATION_TYPE = "DisabledBreakpoint"; // NOI18N
+ /** Annotation type constant. */
+ public static final String CONDITIONAL_BREAKPOINT_ANNOTATION_TYPE = "CondBreakpoint"; // NOI18N
+ /** Annotation type constant. */
+ public static final String DISABLED_CONDITIONAL_BREAKPOINT_ANNOTATION_TYPE = "DisabledCondBreakpoint"; // NOI18N
+
+ private Annotatable annotatable;
+ private String type;
+ private CPPLiteBreakpoint breakpoint;
+
+
+ public DebuggerBreakpointAnnotation (String type, CPPLiteBreakpoint b) {
+ this.type = type;
+ this.annotatable = b.getLine ();
+ this.breakpoint = b;
+ attach (annotatable);
+ }
+
+ @Override
+ public String getAnnotationType () {
+ return type;
+ }
+
+ @Override
+ public String getShortDescription () {
+ if (type == BREAKPOINT_ANNOTATION_TYPE)
+ return NbBundle.getMessage
+ (DebuggerBreakpointAnnotation.class, "TOOLTIP_BREAKPOINT");
+ else
+ if (type == DISABLED_BREAKPOINT_ANNOTATION_TYPE)
+ return NbBundle.getMessage
+ (DebuggerBreakpointAnnotation.class, "TOOLTIP_DISABLED_BREAKPOINT");
+ else
+ if (type == CONDITIONAL_BREAKPOINT_ANNOTATION_TYPE)
+ return NbBundle.getMessage
+ (DebuggerBreakpointAnnotation.class, "TOOLTIP_CONDITIONAL_BREAKPOINT");
+ else
+ if (type == DISABLED_CONDITIONAL_BREAKPOINT_ANNOTATION_TYPE)
+ return NbBundle.getMessage
+ (DebuggerBreakpointAnnotation.class, "TOOLTIP_DISABLED_CONDITIONAL_BREAKPOINT");
+ return null;
+ }
+
+ @Override
+ public Breakpoint getBreakpoint() {
+ return breakpoint;
+ }
+}
diff --git a/cpplite/cpplite.debugger/src/org/netbeans/modules/cpplite/debugger/SessionsTableModelFilter.java b/cpplite/cpplite.debugger/src/org/netbeans/modules/cpplite/debugger/SessionsTableModelFilter.java
new file mode 100644
index 0000000..9248a44
--- /dev/null
+++ b/cpplite/cpplite.debugger/src/org/netbeans/modules/cpplite/debugger/SessionsTableModelFilter.java
@@ -0,0 +1,169 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.cpplite.debugger;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.CopyOnWriteArrayList;
+import org.netbeans.api.debugger.DebuggerEngine;
+import org.netbeans.api.debugger.Session;
+import org.netbeans.spi.debugger.DebuggerServiceRegistration;
+import org.netbeans.spi.debugger.ui.Constants;
+import org.netbeans.spi.viewmodel.ModelEvent;
+import org.netbeans.spi.viewmodel.ModelListener;
+import org.netbeans.spi.viewmodel.TableModel;
+import org.netbeans.spi.viewmodel.TableModelFilter;
+import org.netbeans.spi.viewmodel.UnknownTypeException;
+import org.openide.util.NbBundle;
+
+/**
+ *
+ * @author Martin Entlicher
+ */
+@DebuggerServiceRegistration(path="SessionsView", types=TableModelFilter.class)
+public class SessionsTableModelFilter implements TableModelFilter, Constants {
+
+ private final List<Session> sessionListeners = new ArrayList<Session>();
+ private final List<ModelListener> modelListeners = new CopyOnWriteArrayList<ModelListener>();
+
+ public SessionsTableModelFilter() {}
+
+ @Override
+ public Object getValueAt(TableModel original, Object node, String columnID) throws UnknownTypeException {
+ if (node instanceof Session && isANTSession((Session) node)) {
+ if (SESSION_STATE_COLUMN_ID.equals (columnID)) {
+ return getSessionState ((Session) node);
+ } else
+ if (SESSION_LANGUAGE_COLUMN_ID.equals (columnID)) {
+ return node;
+ } else
+ if (SESSION_HOST_NAME_COLUMN_ID.equals (columnID)) {
+ return ((Session) node).getLocationName ();
+ } else {
+ throw new UnknownTypeException (node);
+ }
+ }
+ return original.getValueAt(node, columnID);
+ }
+
+ @Override
+ public boolean isReadOnly(TableModel original, Object node, String columnID) throws UnknownTypeException {
+ if (node instanceof Session && isANTSession((Session) node)) {
+ if (SESSION_STATE_COLUMN_ID.equals (columnID)) {
+ return true;
+ } else
+ if (SESSION_LANGUAGE_COLUMN_ID.equals (columnID)) {
+ return true;
+ } else
+ if (SESSION_HOST_NAME_COLUMN_ID.equals (columnID)) {
+ return true;
+ } else {
+ throw new UnknownTypeException (node);
+ }
+ }
+ return original.isReadOnly(node, columnID);
+ }
+
+ @Override
+ public void setValueAt(TableModel original, Object node, String columnID, Object value) throws UnknownTypeException {
+ original.setValueAt(node, columnID, value);
+ }
+
+ private static boolean isANTSession(Session s) {
+ DebuggerEngine e = s.getCurrentEngine ();
+ if (e == null) {
+ return false;
+ }
+ CPPLiteDebugger d = e.lookupFirst(null, CPPLiteDebugger.class);
+ return d != null;
+ }
+
+ @NbBundle.Messages({"MSG_Session_State_Starting=Starting",
+ "MSG_Session_State_Finished=Finished",
+ "MSG_Session_State_Running=Running",
+ "MSG_Session_State_Stopped=Stopped"})
+ private String getSessionState (Session s) {
+ DebuggerEngine e = s.getCurrentEngine ();
+ if (e == null) {
+ return Bundle.MSG_Session_State_Starting();
+ }
+ CPPLiteDebugger d = e.lookupFirst(null, CPPLiteDebugger.class);
+ if (d.isFinished()) {
+ return Bundle.MSG_Session_State_Finished();
+ }
+ synchronized (sessionListeners) {
+ if (!sessionListeners.contains(s)) {
+ CPPLiteDebugger.StateListener asl = new ANTSessionStateListener(s, d);
+ d.addStateListener(asl);
+ sessionListeners.add(s);
+ }
+ }
+ if (d.isSuspended()) {
+ return Bundle.MSG_Session_State_Stopped();
+ } else {
+ return Bundle.MSG_Session_State_Running();
+ }
+ }
+
+ private void fireModelChanged(Object node) {
+ ModelEvent me = new ModelEvent.TableValueChanged(this, node, SESSION_STATE_COLUMN_ID);
+ for (ModelListener ml : modelListeners) {
+ ml.modelChanged(me);
+ }
+ }
+
+ @Override
+ public void addModelListener(ModelListener l) {
+ modelListeners.add(l);
+ }
+
+ @Override
+ public void removeModelListener(ModelListener l) {
+ modelListeners.remove(l);
+ }
+
+ private class ANTSessionStateListener implements CPPLiteDebugger.StateListener {
+
+ private final Session s;
+ private final CPPLiteDebugger d;
+
+ ANTSessionStateListener(Session s, CPPLiteDebugger d) {
+ this.s = s;
+ this.d = d;
+ }
+
+ @Override
+ public void suspended(boolean suspended) {
+ fireModelChanged(s);
+ }
+
+ @Override
+ public void finished() {
+ fireModelChanged(s);
+ d.removeStateListener(this);
+ synchronized (sessionListeners) {
+ sessionListeners.remove(s);
+ }
+ }
+
+ }
+
+}
diff --git a/cpplite/cpplite.debugger/src/org/netbeans/modules/cpplite/debugger/ToolTipAnnotation.java b/cpplite/cpplite.debugger/src/org/netbeans/modules/cpplite/debugger/ToolTipAnnotation.java
new file mode 100644
index 0000000..8ea8786
--- /dev/null
+++ b/cpplite/cpplite.debugger/src/org/netbeans/modules/cpplite/debugger/ToolTipAnnotation.java
@@ -0,0 +1,159 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.netbeans.modules.cpplite.debugger;
+
+import java.io.IOException;
+import javax.swing.JEditorPane;
+import javax.swing.text.BadLocationException;
+import javax.swing.text.Element;
+import javax.swing.text.StyledDocument;
+import org.netbeans.api.debugger.DebuggerEngine;
+
+import org.openide.cookies.EditorCookie;
+import org.openide.loaders.DataObject;
+import org.openide.text.Annotation;
+import org.openide.text.DataEditorSupport;
+import org.openide.text.Line;
+import org.openide.text.NbDocument;
+import org.openide.text.Line.Part;
+import org.openide.util.RequestProcessor;
+import org.netbeans.api.debugger.DebuggerManager;
+
+import org.netbeans.spi.debugger.ui.EditorContextDispatcher;
+
+
+public class ToolTipAnnotation extends Annotation implements Runnable {
+
+ private Part lp;
+ private EditorCookie ec;
+
+ @Override
+ public String getShortDescription () {
+ DebuggerEngine currentEngine = DebuggerManager.getDebuggerManager ().
+ getCurrentEngine ();
+ if (currentEngine == null) return null;
+ CPPLiteDebugger d = currentEngine.lookupFirst(null, CPPLiteDebugger.class);
+ if (d == null) return null;
+
+ Part lp = (Part)
+ getAttachedAnnotatable();
+ if (lp == null) return null;
+ Line line = lp.getLine ();
+ DataObject dob = DataEditorSupport.findDataObject (line);
+ if (dob == null) return null;
+ EditorCookie ec = dob.getLookup().lookup(EditorCookie.class);
+
+ if (ec == null) return null;
+ this.lp = lp;
+ this.ec = ec;
+ RequestProcessor.getDefault ().post (this);
+ return null;
+ }
+
+ @Override
+ public void run () {
+ //if (expression == null) return;
+ if (lp == null || ec == null) return ;
+ StyledDocument doc;
+ try {
+ doc = ec.openDocument();
+ } catch (IOException ex) {
+ return ;
+ }
+ JEditorPane ep = EditorContextDispatcher.getDefault().getCurrentEditor();
+ if (ep == null) return ;
+ String expression = getIdentifier (
+ doc,
+ ep,
+ NbDocument.findLineOffset (
+ doc,
+ lp.getLine ().getLineNumber ()
+ ) + lp.getColumn ()
+ );
+ if (expression == null) return ;
+ DebuggerEngine currentEngine = DebuggerManager.getDebuggerManager ().
+ getCurrentEngine ();
+ if (currentEngine == null) return;
+ CPPLiteDebugger d = currentEngine.lookupFirst(null, CPPLiteDebugger.class);
+ if (d == null) return;
+ String value = d.evaluate (expression);
+ if ( value == null ||
+ value.equals (expression)
+ ) return;
+ String toolTipText = expression + " = " + value;
+ firePropertyChange (PROP_SHORT_DESCRIPTION, null, toolTipText);
+ }
+
+ @Override
+ public String getAnnotationType () {
+ return null; // Currently return null annotation type
+ }
+
+ private static String getIdentifier (
+ StyledDocument doc,
+ JEditorPane ep,
+ int offset
+ ) {
+ String t = null;
+ if ( (ep.getSelectionStart () <= offset) &&
+ (offset <= ep.getSelectionEnd ())
+ ) t = ep.getSelectedText ();
+ if (t != null) return t;
+
+ int line = NbDocument.findLineNumber (
+ doc,
+ offset
+ );
+ int col = NbDocument.findLineColumn (
+ doc,
+ offset
+ );
+ try {
+ Element lineElem =
+ NbDocument.findLineRootElement (doc).
+ getElement (line);
+
+ if (lineElem == null) return null;
+ int lineStartOffset = lineElem.getStartOffset ();
+ int lineLen = lineElem.getEndOffset() - lineStartOffset;
+ t = doc.getText (lineStartOffset, lineLen);
+ lineLen = t.length ();
+ int identStart = col;
+ while ( (identStart > 0) &&
+ (t.charAt (identStart - 1) != '"')
+ ) {
+ identStart--;
+ }
+ int identEnd = Math.max (col, 1);
+ while ( (identEnd < lineLen) &&
+ (t.charAt (identEnd - 1) != '"')
+ ) {
+ identEnd++;
+ }
+
+ if (identStart == identEnd) return null;
+ return t.substring (identStart, identEnd - 1);
+ } catch (BadLocationException e) {
+ return null;
+ }
+ }
+
+}
+
diff --git a/cpplite/cpplite.debugger/src/org/netbeans/modules/cpplite/debugger/Utils.java b/cpplite/cpplite.debugger/src/org/netbeans/modules/cpplite/debugger/Utils.java
new file mode 100644
index 0000000..b40f575
--- /dev/null
+++ b/cpplite/cpplite.debugger/src/org/netbeans/modules/cpplite/debugger/Utils.java
@@ -0,0 +1,475 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.netbeans.modules.cpplite.debugger;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.StringReader;
+import java.io.StringWriter;
+import java.lang.reflect.InvocationTargetException;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+import javax.swing.JEditorPane;
+import javax.swing.SwingUtilities;
+import javax.swing.text.BadLocationException;
+import javax.swing.text.DefaultEditorKit;
+import javax.swing.text.EditorKit;
+import javax.swing.text.StyledDocument;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.parsers.SAXParser;
+import javax.xml.parsers.SAXParserFactory;
+import org.openide.ErrorManager;
+import org.openide.cookies.EditorCookie;
+import org.openide.cookies.LineCookie;
+import org.openide.filesystems.FileObject;
+import org.openide.filesystems.FileUtil;
+import org.openide.loaders.DataObject;
+import org.openide.loaders.DataObjectNotFoundException;
+import org.openide.text.Annotatable;
+import org.openide.text.Line;
+import org.openide.text.Line.ShowOpenType;
+import org.openide.text.Line.ShowVisibilityType;
+import org.xml.sax.Attributes;
+import org.xml.sax.InputSource;
+import org.xml.sax.Locator;
+import org.xml.sax.SAXException;
+import org.xml.sax.helpers.DefaultHandler;
+
+
+/*
+ * AntTest.java
+ *
+ * Created on 19. leden 2004, 20:03
+ */
+
+/**
+ *
+ * @author Honza
+ */
+public class Utils {
+
+ private static final Logger logger = Logger.getLogger(Utils.class.getName());
+
+ private static Object currentLine;
+
+ static synchronized void markCurrent (final Object line) {
+ unmarkCurrent ();
+
+ Annotatable[] annotatables = (Annotatable[]) line;
+ int i = 0, k = annotatables.length;
+
+ // first line with icon in gutter
+ DebuggerAnnotation[] annotations = new DebuggerAnnotation [k];
+ if (annotatables [i] instanceof Line.Part)
+ annotations [i] = new DebuggerAnnotation (
+ DebuggerAnnotation.CURRENT_LINE_PART_ANNOTATION_TYPE,
+ annotatables [i]
+ );
+ else
+ annotations [i] = new DebuggerAnnotation (
+ DebuggerAnnotation.CURRENT_LINE_ANNOTATION_TYPE,
+ annotatables [i]
+ );
+
+ // other lines
+ for (i = 1; i < k; i++)
+ if (annotatables [i] instanceof Line.Part)
+ annotations [i] = new DebuggerAnnotation (
+ DebuggerAnnotation.CURRENT_LINE_PART_ANNOTATION_TYPE2,
+ annotatables [i]
+ );
+ else
+ annotations [i] = new DebuggerAnnotation (
+ DebuggerAnnotation.CURRENT_LINE_ANNOTATION_TYPE2,
+ annotatables [i]
+ );
+ currentLine = annotations;
+
+ showLine (line);
+ }
+
+ static synchronized void unmarkCurrent () {
+ if (currentLine != null) {
+
+// ((DebuggerAnnotation) currentLine).detach ();
+ int i, k = ((DebuggerAnnotation[]) currentLine).length;
+ for (i = 0; i < k; i++)
+ ((DebuggerAnnotation[]) currentLine) [i].detach ();
+
+ currentLine = null;
+ }
+ }
+
+ static void showLine (final Object line) {
+// SwingUtilities.invokeLater (new Runnable () {
+// public void run () {
+// ((Line) line).show (Line.SHOW_GOTO);
+// }
+// });
+
+ final Annotatable[] a = (Annotatable[]) line;
+ SwingUtilities.invokeLater (new Runnable () {
+ @Override
+ public void run () {
+ if (a [0] instanceof Line)
+ ((Line) a [0]).show (ShowOpenType.OPEN, ShowVisibilityType.FOCUS);
+ else
+ if (a [0] instanceof Line.Part)
+ ((Line.Part) a [0]).getLine ().show (ShowOpenType.OPEN, ShowVisibilityType.FOCUS);
+ else
+ throw new InternalError ();
+ }
+ });
+ }
+
+ static int getLineNumber (Object line) {
+// return ((Line) line).getLineNumber ();
+
+ final Annotatable[] a = (Annotatable[]) line;
+ if (a [0] instanceof Line)
+ return ((Line) a [0]).getLineNumber ();
+ else
+ if (a [0] instanceof Line.Part)
+ return ((Line.Part) a [0]).getLine ().getLineNumber ();
+ else
+ throw new InternalError ();
+ }
+
+ public static boolean contains (Object currentLine, Line line) {
+ if (currentLine == null) return false;
+ final Annotatable[] a = (Annotatable[]) currentLine;
+ int i, k = a.length;
+ for (i = 0; i < k; i++) {
+ if (a [i].equals (line)) return true;
+ if ( a [i] instanceof Line.Part &&
+ ((Line.Part) a [i]).getLine ().equals (line)
+ ) return true;
+ }
+ return false;
+ }
+
+
+// static Object getLine (
+// final AntEvent event
+// ) {
+// File file = event.getScriptLocation ();
+// final int lineNumber = event.getLine ();
+// if (file == null) return null;
+// if (lineNumber < 0) return null;
+//
+// FileObject fileObject = FileUtil.toFileObject (file);
+// EditorCookie editor;
+// LineCookie lineCookie;
+// DataObject d;
+// try {
+// d = DataObject.find (fileObject);
+// } catch (DataObjectNotFoundException donfex) {
+// logger.log(Level.CONFIG, "No DataObject for "+fileObject, donfex);
+// return null;
+// }
+// editor = d.getLookup().lookup (EditorCookie.class);
+// lineCookie = d.getLookup().lookup (LineCookie.class);
+// assert editor != null;
+// assert lineCookie != null;
+//
+// InputSource in = null;
+// try {
+// StyledDocument doc = editor.openDocument ();
+// in = createInputSource (fileObject, editor, doc);
+// } catch (IOException ioex) {
+// logger.log(Level.CONFIG, "A problem while opening "+fileObject, ioex);
+// } catch (BadLocationException blex) {
+// logger.log(Level.CONFIG, "A problem while opening "+fileObject, blex);
+// }
+// if (in == null) {
+// return null;
+// }
+// final int[] line = new int [4];
+// SAXParserFactory factory = SAXParserFactory.newInstance ();
+// try {
+// SAXParser parser = factory.newSAXParser ();
+// class Handler extends DefaultHandler {
+// private Locator locator;
+// @Override
+// public void setDocumentLocator (Locator l) {
+// locator = l;
+// }
+// @Override
+// public void startElement (
+// String uri,
+// String localname,
+// String qname,
+// Attributes attr
+// ) throws SAXException {
+// if (line [0] == 0) {
+// if ( qname.equals (event.getTaskName ()) &&
+// locator.getLineNumber () == lineNumber
+// ) {
+// line[0] = locator.getLineNumber ();
+// line[1] = locator.getColumnNumber () - 1;
+// }
+// }
+// }
+// @Override
+// public void endElement (
+// String uri,
+// String localname,
+// String qname
+// ) throws SAXException {
+// if ( line [0] != 0 &&
+// line [2] == 0 &&
+// qname.equals (event.getTaskName ())
+// ) {
+// line[2] = locator.getLineNumber ();
+// line[3] = locator.getColumnNumber () - 1;
+// }
+// }
+// }
+// parser.parse (in, new Handler ());
+// } catch (IOException ioex) {
+// logger.log(Level.CONFIG, "A problem while reading "+fileObject, ioex);
+// return null;
+// } catch (ParserConfigurationException pcex) {
+// logger.log(Level.CONFIG, "A problem while parsing "+fileObject, pcex);
+// return null;
+// } catch (SAXException saxex) {
+// logger.log(Level.CONFIG, "A problem while parsing "+fileObject, saxex);
+// return null;
+// }
+// if (line [0] == 0) return null;
+// Annotatable[] annotatables = new Annotatable [
+// line [2] - line [0] + 1
+// ];
+// int i = 0;
+// for (int ln = line [0]; ln <= line [2]; ln ++) {
+// Line l = lineCookie.getLineSet ().getCurrent (ln - 1);
+// annotatables [i++] = l;
+// }
+// return annotatables;
+// }
+//
+// static Object getLine (
+// final TargetLister.Target target,
+// String nextTargetName
+// ) {
+// FileObject fileObject = target.getScript ().getFileObject ();
+// assert fileObject != null : "No build script for " + target.getName ();
+// EditorCookie editor;
+// LineCookie lineCookie;
+// DataObject d;
+// try {
+// d = DataObject.find (fileObject);
+// } catch (DataObjectNotFoundException donfex) {
+// logger.log(Level.CONFIG, "No DataObject for "+fileObject, donfex);
+// return null;
+// }
+// editor = d.getLookup().lookup (EditorCookie.class);
+// lineCookie = d.getLookup().lookup (LineCookie.class);
+// assert editor != null;
+// assert lineCookie != null;
+// InputSource in = null;
+// try {
+// StyledDocument doc = editor.openDocument ();
+// in = createInputSource (fileObject, editor, doc);
+// } catch (IOException ioex) {
+// logger.log(Level.CONFIG, "A problem while opening "+fileObject, ioex);
+// } catch (BadLocationException blex) {
+// logger.log(Level.CONFIG, "A problem while opening "+fileObject, blex);
+// }
+// if (in == null) {
+// return null;
+// }
+// final int[] line = new int [4];
+// SAXParserFactory factory = SAXParserFactory.newInstance ();
+// try {
+// SAXParser parser = factory.newSAXParser ();
+// class Handler extends DefaultHandler {
+// private Locator locator;
+// @Override
+// public void setDocumentLocator (Locator l) {
+// locator = l;
+// }
+// @Override
+// public void startElement (
+// String uri,
+// String localname,
+// String qname,
+// Attributes attr
+// ) throws SAXException {
+// if (line [0] == 0) {
+// if (qname.equals ("target") && // NOI18N
+// target.getName ().equals (attr.getValue ("name")) // NOI18N
+// ) {
+// line[0] = locator.getLineNumber ();
+// line[1] = locator.getColumnNumber ();
+// }
+// }
+// }
+// @Override
+// public void endElement (
+// String uri,
+// String localname,
+// String qname
+// ) throws SAXException {
+// if ( line [0] != 0 &&
+// line [2] == 0 &&
+// qname.equals ("target")
+// ) {
+// line[2] = locator.getLineNumber ();
+// line[3] = locator.getColumnNumber ();
+// }
+// }
+// }
+// parser.parse (in, new Handler ());
+// } catch (IOException ioex) {
+// logger.log(Level.CONFIG, "A problem while reading "+fileObject, ioex);
+// return null;
+// } catch (ParserConfigurationException pcex) {
+// logger.log(Level.CONFIG, "A problem while parsing "+fileObject, pcex);
+// return null;
+// } catch (SAXException saxex) {
+// logger.log(Level.CONFIG, "A problem while parsing "+fileObject, saxex);
+// return null;
+// }
+// if (line [0] == 0) return null;
+//
+// int ln = line [0] - 1;
+// List annotatables = new ArrayList ();
+// if (nextTargetName != null) {
+// Line fLine = lineCookie.getLineSet ().getCurrent (ln);
+// int inx = findIndexOf(fLine.getText (), nextTargetName);
+// if (inx >= 0) {
+// annotatables.add (fLine.createPart (
+// inx, nextTargetName.length ()
+// ));
+// ln ++;
+// }
+// }
+// if (annotatables.size () < 1)
+// for (; ln < line [2]; ln ++) {
+// Line l = lineCookie.getLineSet ().getCurrent (ln);
+// annotatables.add (l);
+// }
+// return annotatables.toArray (new Annotatable [annotatables.size ()]);
+// }
+
+ private static int findIndexOf(String text, String target) {
+ int index = 0;
+ while ((index = text.indexOf(target, index)) > 0) {
+ char c = text.charAt(index - 1);
+ if (!Character.isWhitespace(c) && c != ',' && c != '\"') {
+ // begins with some text => is not the target
+ index++;
+ continue;
+ }
+ if (text.length() > index + target.length()) {
+ c = text.charAt(index + target.length());
+ if (!Character.isWhitespace(c) && c != ',' && c != '\"') {
+ // ends with some text => is not the target
+ index++;
+ continue;
+ }
+ }
+ break;
+ }
+ return index;
+ }
+
+ /**
+ * Utility method to get a properly configured XML input source for a script.
+ */
+ private static InputSource createInputSource (
+ FileObject fo,
+ EditorCookie editor,
+ final StyledDocument document
+ ) throws IOException, BadLocationException {
+ final StringWriter w = new StringWriter (document.getLength ());
+ final EditorKit kit = findKit (editor);
+ if (kit == null) return null;
+ final IOException[] ioe = new IOException [1];
+ final BadLocationException[] ble = new BadLocationException [1];
+ document.render(new Runnable () {
+ @Override
+ public void run() {
+ try {
+ kit.write (w, document, 0, document.getLength ());
+ } catch (IOException e) {
+ ioe [0] = e;
+ } catch (BadLocationException e) {
+ ble [0] = e;
+ }
+ }
+ });
+ if (ioe[0] != null) {
+ throw ioe [0];
+ } else if (ble [0] != null) {
+ throw ble [0];
+ }
+ InputSource in = new InputSource (new StringReader (w.toString ()));
+ if (fo != null) { // #10348
+ in.setSystemId(fo.toURL().toExternalForm());
+ // [PENDING] Ant's ProjectHelper has an elaborate set of work-
+ // arounds for inconsistent parser behavior, e.g. file:foo.xml
+ // works in Ant but not with Xerces parser. You must use just foo.xml
+ // as the system ID. If necessary, Ant's algorithm could be copied
+ // here to make the behavior match perfectly, but it ought not be necessary.
+ }
+ return in;
+ }
+
+ private static EditorKit findKit(final EditorCookie editor) {
+ if (SwingUtilities.isEventDispatchThread()) {
+ return findKit_(editor);
+ } else {
+ final EditorKit[] ek = new EditorKit[1];
+ try {
+ SwingUtilities.invokeAndWait(new Runnable() {
+ @Override
+ public void run() {
+ ek[0] = findKit_(editor);
+ }
+ });
+ } catch (InvocationTargetException ex) {
+ ErrorManager.getDefault().notify(ex.getTargetException());
+ } catch (InterruptedException ex) {
+ Thread.currentThread().interrupt();
+ }
+ return ek[0];
+ }
+ }
+
+ private static EditorKit findKit_(EditorCookie editor) {
+ JEditorPane[] panes = editor.getOpenedPanes();
+ EditorKit kit;
+ if (panes != null) {
+ kit = panes[0].getEditorKit ();
+ } else {
+ kit = JEditorPane.createEditorKitForContentType ("text/xml"); // NOI18N
+ if (kit == null) {
+ // #39301: fallback; can happen if xml/text-edit is disabled
+ kit = new DefaultEditorKit ();
+ }
+ }
+ assert kit != null;
+ return kit;
+ }
+}
diff --git a/cpplite/cpplite.debugger/src/org/netbeans/modules/cpplite/debugger/VariablesModel.java b/cpplite/cpplite.debugger/src/org/netbeans/modules/cpplite/debugger/VariablesModel.java
new file mode 100644
index 0000000..44fe24e
--- /dev/null
+++ b/cpplite/cpplite.debugger/src/org/netbeans/modules/cpplite/debugger/VariablesModel.java
@@ -0,0 +1,274 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.netbeans.modules.cpplite.debugger;
+
+import java.util.Vector;
+import org.netbeans.spi.debugger.ContextProvider;
+import org.netbeans.spi.viewmodel.ModelEvent;
+import org.netbeans.spi.viewmodel.NodeModel;
+import org.netbeans.spi.viewmodel.TableModel;
+import org.netbeans.spi.viewmodel.TreeModel;
+import org.netbeans.spi.viewmodel.ModelListener;
+import org.netbeans.spi.viewmodel.UnknownTypeException;
+
+/**
+ *
+ * @author Jan Jancura
+ */
+public class VariablesModel implements TreeModel, NodeModel, TableModel {
+
+ public static final String LOCAL =
+ "org/netbeans/modules/debugger/resources/localsView/LocalVariable";
+
+ private CPPLiteDebugger debugger;
+ private Vector listeners = new Vector ();
+
+
+ public VariablesModel (ContextProvider contextProvider) {
+ debugger = contextProvider.lookupFirst(null, CPPLiteDebugger.class);
+ debugger.setVariablesModel(this);
+ }
+
+
+ // TreeModel implementation ................................................
+
+ /**
+ * Returns the root node of the tree or null, if the tree is empty.
+ *
+ * @return the root node of the tree or null
+ */
+ @Override
+ public Object getRoot () {
+ return ROOT;
+ }
+
+ /**
+ * Returns children for given parent on given indexes.
+ *
+ * @param parent a parent of returned nodes
+ * @param from a start index
+ * @param to a end index
+ *
+ * @throws NoInformationException if the set of children can not be
+ * resolved
+ * @throws ComputingException if the children resolving process
+ * is time consuming, and will be performed off-line
+ * @throws UnknownTypeException if this TreeModel implementation is not
+ * able to resolve children for given node type
+ *
+ * @return children for given parent on given indexes
+ */
+ @Override
+ public Object[] getChildren (Object parent, int from, int to)
+ throws UnknownTypeException {
+ if (parent == ROOT)
+ return debugger.getVariables ();
+ throw new UnknownTypeException (parent);
+ }
+
+ /**
+ * Returns true if node is leaf.
+ *
+ * @throws UnknownTypeException if this TreeModel implementation is not
+ * able to resolve dchildren for given node type
+ * @return true if node is leaf
+ */
+ @Override
+ public boolean isLeaf (Object node) throws UnknownTypeException {
+ if (node == ROOT)
+ return false;
+ if (node instanceof String)
+ return true;
+ throw new UnknownTypeException (node);
+ }
+
+ /**
+ * Returns number of children for given node.
+ *
+ * @param node the parent node
+ * @throws NoInformationException if the set of children can not be
+ * resolved
+ * @throws ComputingException if the children resolving process
+ * is time consuming, and will be performed off-line
+ * @throws UnknownTypeException if this TreeModel implementation is not
+ * able to resolve children for given node type
+ *
+ * @return true if node is leaf
+ * @since 1.1
+ */
+ @Override
+ public int getChildrenCount (Object node) throws UnknownTypeException {
+ if (node == ROOT)
+ return debugger.getVariables ().length;
+ throw new UnknownTypeException (node);
+ }
+
+ /**
+ * Registers given listener.
+ *
+ * @param l the listener to add
+ */
+ @Override
+ public void addModelListener (ModelListener l) {
+ listeners.add (l);
+ }
+
+ /**
+ * Unregisters given listener.
+ *
+ * @param l the listener to remove
+ */
+ @Override
+ public void removeModelListener (ModelListener l) {
+ listeners.remove (l);
+ }
+
+
+ // NodeModel implementation ................................................
+
+ /**
+ * Returns display name for given node.
+ *
+ * @throws ComputingException if the display name resolving process
+ * is time consuming, and the value will be updated later
+ * @throws UnknownTypeException if this NodeModel implementation is not
+ * able to resolve display name for given node type
+ * @return display name for given node
+ */
+ @Override
+ public String getDisplayName (Object node) throws UnknownTypeException {
+ if (node instanceof String)
+ return (String) node;
+ throw new UnknownTypeException (node);
+ }
+
+ /**
+ * Returns icon for given node.
+ *
+ * @throws ComputingException if the icon resolving process
+ * is time consuming, and the value will be updated later
+ * @throws UnknownTypeException if this NodeModel implementation is not
+ * able to resolve icon for given node type
+ * @return icon for given node
+ */
+ @Override
+ public String getIconBase (Object node) throws UnknownTypeException {
+ if (node instanceof String)
+ return LOCAL;
+ throw new UnknownTypeException (node);
+ }
+
+ /**
+ * Returns tooltip for given node.
+ *
+ * @throws ComputingException if the tooltip resolving process
+ * is time consuming, and the value will be updated later
+ * @throws UnknownTypeException if this NodeModel implementation is not
+ * able to resolve tooltip for given node type
+ * @return tooltip for given node
+ */
+ @Override
+ public String getShortDescription (Object node)
+ throws UnknownTypeException {
+ if (node instanceof String)
+ return null;
+ throw new UnknownTypeException (node);
+ }
+
+
+ // TableModel implementation ...............................................
+
+ /**
+ * Returns value to be displayed in column <code>columnID</code>
+ * and row identified by <code>node</code>. Column ID is defined in by
+ * {@link ColumnModel#getID}, and rows are defined by values returned from
+ * {@link org.netbeans.spi.viewmodel.TreeModel#getChildren}.
+ *
+ * @param node a object returned from
+ * {@link org.netbeans.spi.viewmodel.TreeModel#getChildren} for this row
+ * @param columnID a id of column defined by {@link ColumnModel#getID}
+ * @throws ComputingException if the value is not known yet and will
+ * be computed later
+ * @throws UnknownTypeException if there is no TableModel defined for given
+ * parameter type
+ *
+ * @return value of variable representing given position in tree table.
+ */
+ @Override
+ public Object getValueAt (Object node, String columnID) throws
+ UnknownTypeException {
+ if ( (node instanceof String) &&
+ (columnID.equals ("LocalsValue"))
+ ) return debugger.getVariableValue ((String) node);
+ throw new UnknownTypeException (node);
+ }
+
+ /**
+ * Returns true if value displayed in column <code>columnID</code>
+ * and row <code>node</code> is read only. Column ID is defined in by
+ * {@link ColumnModel#getID}, and rows are defined by values returned from
+ * {@link TreeModel#getChildren}.
+ *
+ * @param node a object returned from {@link TreeModel#getChildren} for this row
+ * @param columnID a id of column defined by {@link ColumnModel#getID}
+ * @throws UnknownTypeException if there is no TableModel defined for given
+ * parameter type
+ *
+ * @return true if variable on given position is read only
+ */
+ @Override
+ public boolean isReadOnly (Object node, String columnID) throws
+ UnknownTypeException {
+ if ( (node instanceof String) &&
+ (columnID.equals ("LocalsValue"))
+ ) return true;
+ throw new UnknownTypeException (node);
+ }
+
+ /**
+ * Changes a value displayed in column <code>columnID</code>
+ * and row <code>node</code>. Column ID is defined in by
+ * {@link ColumnModel#getID}, and rows are defined by values returned from
+ * {@link TreeModel#getChildren}.
+ *
+ * @param node a object returned from {@link TreeModel#getChildren} for this row
+ * @param columnID a id of column defined by {@link ColumnModel#getID}
+ * @param value a new value of variable on given position
+ * @throws UnknownTypeException if there is no TableModel defined for given
+ * parameter type
+ */
+ @Override
+ public void setValueAt (Object node, String columnID, Object value)
+ throws UnknownTypeException {
+ throw new UnknownTypeException (node);
+ }
+
+
+ // other mothods ...........................................................
+
+ void fireChanges () {
+ Vector v = (Vector) listeners.clone ();
+ int i, k = v.size ();
+ for (i = 0; i < k; i++)
+ ((ModelListener) v.get (i)).modelChanged (
+ new ModelEvent.TreeChanged (this)
+ );
+ }
+}
diff --git a/cpplite/cpplite.debugger/src/org/netbeans/modules/cpplite/debugger/VerticalGridLayout.java b/cpplite/cpplite.debugger/src/org/netbeans/modules/cpplite/debugger/VerticalGridLayout.java
new file mode 100644
index 0000000..4271f62
--- /dev/null
+++ b/cpplite/cpplite.debugger/src/org/netbeans/modules/cpplite/debugger/VerticalGridLayout.java
@@ -0,0 +1,163 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.cpplite.debugger;
+
+import java.awt.Component;
+import java.awt.Container;
+import java.awt.Dimension;
+import java.awt.LayoutManager2;
+import java.awt.Rectangle;
+import java.util.LinkedHashSet;
+import java.util.Set;
+import org.openide.util.Utilities;
+import org.openide.windows.TopComponent;
+import org.openide.windows.WindowManager;
+
+/**
+ *
+ * @author mkozeny
+ */
+public class VerticalGridLayout implements LayoutManager2 {
+
+ public VerticalGridLayout() {
+ super();
+ TopComponent activated = TopComponent.getRegistry().getActivated();
+ if (activated != null) {
+ Rectangle screenParams = Utilities.getUsableScreenBounds(activated.getGraphicsConfiguration());
+ //half of the size is used, b/c sometimes it is submenu not visible at the top
+ this.screenHeight = (int)(screenParams.height * 0.5);
+ } else {
+ this.screenHeight = (int)(WindowManager.getDefault().getMainWindow().getSize().height * 0.5);
+ }
+ }
+
+ private final int screenHeight;
+
+ final private Set<Component> components = new LinkedHashSet<Component>();
+
+ @Override
+ public void addLayoutComponent(Component comp, Object constraints) {
+ this.components.add(comp);
+ }
+
+ /* these 3 methods need to be overridden properly */
+ @Override
+ public float getLayoutAlignmentX(Container target) {
+ return 0;
+ }
+
+ @Override
+ public float getLayoutAlignmentY(Container target) {
+ return 0;
+ }
+
+ @Override
+ public void invalidateLayout(Container target) {
+
+ }
+
+ @Override
+ public void addLayoutComponent(String name, Component comp) {
+ this.components.add(comp);
+ }
+
+ @Override
+ public void layoutContainer(Container parent) {
+ int x = 0;
+ int y = 0;
+ int cellWidth = getMaxCellWidth();
+ for (Component c : this.components) {
+ if (c.isVisible()) {
+ Dimension d = c.getPreferredSize();
+ if (y + d.height > parent.getHeight()) {
+ x += cellWidth;
+ y = 0;
+ }
+ c.setBounds(x + 1, y + 1, cellWidth, d.height);
+ y += d.height;
+ }
+ }
+ }
+
+ /* these 3 methods need to be overridden properly */
+ @Override
+ public Dimension minimumLayoutSize(Container parent) {
+ return new Dimension(0, 0);
+ }
+
+ @Override
+ public Dimension preferredLayoutSize(Container parent) {
+ return layoutSize(parent);
+ }
+
+ @Override
+ public Dimension maximumLayoutSize(Container target) {
+ return layoutSize(target);
+ }
+
+ private Dimension layoutSize(Container target) {
+ int cols = 1;
+ int height;
+ int componentCount = this.components.size();
+ int itemsPerColumn = this.screenHeight / getMaxCellHeight();
+ if (componentCount > itemsPerColumn) {
+ cols = componentCount / itemsPerColumn;
+ if (componentCount % itemsPerColumn != 0) {
+ cols++;
+ }
+ height = itemsPerColumn * getMaxCellHeight();
+ } else {
+ height = getMenuItemsHeight();
+ }
+ return new Dimension(cols * getMaxCellWidth() + 2, height + 2);
+ }
+
+ @Override
+ public void removeLayoutComponent(Component comp) {
+ this.components.remove(comp);
+ }
+
+ private int getMaxCellHeight() {
+ int cellHeight = 0;
+ for (Component c : this.components) {
+ if (c.getPreferredSize().height > cellHeight) {
+ cellHeight = c.getPreferredSize().height;
+ }
+ }
+ return cellHeight;
+ }
+
+ private int getMaxCellWidth() {
+ int cellWidth = 0;
+ for (Component c : this.components) {
+ if (c.getPreferredSize().width > cellWidth) {
+ cellWidth = c.getPreferredSize().width;
+ }
+ }
+ return cellWidth;
+ }
+
+ private int getMenuItemsHeight() {
+ int height = 0;
+ for (Component c : this.components) {
+ height += c.getPreferredSize().height;
+ }
+ return height;
+ }
+ }
\ No newline at end of file
diff --git a/cpplite/cpplite.debugger/src/org/netbeans/modules/cpplite/debugger/WatchesModel.java b/cpplite/cpplite.debugger/src/org/netbeans/modules/cpplite/debugger/WatchesModel.java
new file mode 100644
index 0000000..41048d3
--- /dev/null
+++ b/cpplite/cpplite.debugger/src/org/netbeans/modules/cpplite/debugger/WatchesModel.java
@@ -0,0 +1,223 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.netbeans.modules.cpplite.debugger;
+
+import java.util.Vector;
+
+import org.netbeans.api.debugger.Watch;
+import org.netbeans.spi.debugger.ContextProvider;
+import org.netbeans.spi.viewmodel.ModelEvent;
+import org.netbeans.spi.viewmodel.NodeModel;
+import org.netbeans.spi.viewmodel.TableModel;
+import org.netbeans.spi.viewmodel.ModelListener;
+import org.netbeans.spi.viewmodel.UnknownTypeException;
+import org.netbeans.spi.debugger.ui.Constants;
+import org.netbeans.spi.viewmodel.NodeModelFilter;
+import org.openide.util.NbBundle;
+
+/**
+ *
+ * @author Jan Jancura
+ */
+public class WatchesModel implements NodeModelFilter, TableModel {
+
+ public static final String WATCH =
+ "org/netbeans/modules/debugger/resources/watchesView/Watch";
+
+ private CPPLiteDebugger debugger;
+ private Vector listeners = new Vector ();
+
+
+ public WatchesModel (ContextProvider contextProvider) {
+ debugger = contextProvider.lookupFirst
+ (null, CPPLiteDebugger.class);
+ debugger.setWatchesModel(this);
+ }
+
+
+ // NodeModelFilter implementation ................................................
+
+ /**
+ * Returns display name for given node.
+ *
+ * @throws ComputingException if the display name resolving process
+ * is time consuming, and the value will be updated later
+ * @throws UnknownTypeException if this NodeModel implementation is not
+ * able to resolve display name for given node type
+ * @return display name for given node
+ */
+ @Override
+ public String getDisplayName (NodeModel model, Object node) throws UnknownTypeException {
+ return model.getDisplayName(node);
+ }
+
+ /**
+ * Returns icon for given node.
+ *
+ * @throws ComputingException if the icon resolving process
+ * is time consuming, and the value will be updated later
+ * @throws UnknownTypeException if this NodeModel implementation is not
+ * able to resolve icon for given node type
+ * @return icon for given node
+ */
+ @Override
+ public String getIconBase (NodeModel model, Object node) throws UnknownTypeException {
+ return model.getIconBase(node);
+ }
+
+ /**
+ * Returns tooltip for given node.
+ *
+ * @throws ComputingException if the tooltip resolving process
+ * is time consuming, and the value will be updated later
+ * @throws UnknownTypeException if this NodeModel implementation is not
+ * able to resolve tooltip for given node type
+ * @return tooltip for given node
+ */
+ @Override
+ public String getShortDescription (NodeModel model, Object node) throws UnknownTypeException {
+ if (node instanceof Watch) {
+ if (!((Watch) node).isEnabled()) {
+ return NbBundle.getMessage(WatchesModel.class, "CTL_WatchDisabled");
+ }
+ String expression = ((Watch) node).getExpression ();
+ return debugger.evaluate(expression);
+ }
+ return model.getShortDescription(node);
+ }
+
+
+ // TableModel implementation ...............................................
+
+ /**
+ * Returns value to be displayed in column <code>columnID</code>
+ * and row identified by <code>node</code>. Column ID is defined in by
+ * {@link ColumnModel#getID}, and rows are defined by values returned from
+ * {@link org.netbeans.spi.viewmodel.TreeModel#getChildren}.
+ *
+ * @param node a object returned from
+ * {@link org.netbeans.spi.viewmodel.TreeModel#getChildren} for this row
+ * @param columnID a id of column defined by {@link ColumnModel#getID}
+ * @throws ComputingException if the value is not known yet and will
+ * be computed later
+ * @throws UnknownTypeException if there is no TableModel defined for given
+ * parameter type
+ *
+ * @return value of variable representing given position in tree table.
+ */
+ @Override
+ public Object getValueAt (Object node, String columnID) throws
+ UnknownTypeException {
+ if (columnID == Constants.WATCH_TO_STRING_COLUMN_ID ||
+ columnID == Constants.WATCH_VALUE_COLUMN_ID
+ ) {
+ if (node instanceof Watch) {
+ if (!((Watch) node).isEnabled()) {
+ return NbBundle.getMessage(WatchesModel.class, "CTL_WatchDisabled");
+ }
+ String expression = ((Watch) node).getExpression ();
+ return debugger.evaluate(expression);
+ }
+ }
+ if (columnID == Constants.WATCH_TYPE_COLUMN_ID &&
+ node instanceof Watch
+ )
+ return "";
+ throw new UnknownTypeException (node);
+ }
+
+ /**
+ * Returns true if value displayed in column <code>columnID</code>
+ * and row <code>node</code> is read only. Column ID is defined in by
+ * {@link ColumnModel#getID}, and rows are defined by values returned from
+ * {@link TreeModel#getChildren}.
+ *
+ * @param node a object returned from {@link TreeModel#getChildren} for this row
+ * @param columnID a id of column defined by {@link ColumnModel#getID}
+ * @throws UnknownTypeException if there is no TableModel defined for given
+ * parameter type
+ *
+ * @return true if variable on given position is read only
+ */
+ @Override
+ public boolean isReadOnly (Object node, String columnID) throws
+ UnknownTypeException {
+ if (columnID == Constants.WATCH_TO_STRING_COLUMN_ID ||
+ columnID == Constants.WATCH_VALUE_COLUMN_ID ||
+ columnID == Constants.WATCH_TYPE_COLUMN_ID
+ ) {
+ if (node instanceof Watch)
+ return true;
+ }
+ throw new UnknownTypeException (node);
+ }
+
+ /**
+ * Changes a value displayed in column <code>columnID</code>
+ * and row <code>node</code>. Column ID is defined in by
+ * {@link ColumnModel#getID}, and rows are defined by values returned from
+ * {@link TreeModel#getChildren}.
+ *
+ * @param node a object returned from {@link TreeModel#getChildren} for this row
+ * @param columnID a id of column defined by {@link ColumnModel#getID}
+ * @param value a new value of variable on given position
+ * @throws UnknownTypeException if there is no TableModel defined for given
+ * parameter type
+ */
+ @Override
+ public void setValueAt (Object node, String columnID, Object value)
+ throws UnknownTypeException {
+ throw new UnknownTypeException (node);
+ }
+
+
+ /**
+ * Registers given listener.
+ *
+ * @param l the listener to add
+ */
+ @Override
+ public void addModelListener (ModelListener l) {
+ listeners.add (l);
+ }
+
+ /**
+ * Unregisters given listener.
+ *
+ * @param l the listener to remove
+ */
+ @Override
+ public void removeModelListener (ModelListener l) {
+ listeners.remove (l);
+ }
+
+
+ // other mothods ...........................................................
+
+ void fireChanges () {
+ Vector v = (Vector) listeners.clone ();
+ int i, k = v.size ();
+ for (i = 0; i < k; i++)
+ ((ModelListener) v.get (i)).modelChanged (
+ new ModelEvent.TreeChanged (this)
+ );
+ }
+
+}
diff --git a/ide/lsp.client/src/org/netbeans/modules/lsp/client/options/ServerRestarter.java b/cpplite/cpplite.debugger/src/org/netbeans/modules/cpplite/debugger/api/Debugger.java
similarity index 63%
copy from ide/lsp.client/src/org/netbeans/modules/lsp/client/options/ServerRestarter.java
copy to cpplite/cpplite.debugger/src/org/netbeans/modules/cpplite/debugger/api/Debugger.java
index feacb87..5dab868 100644
--- a/ide/lsp.client/src/org/netbeans/modules/lsp/client/options/ServerRestarter.java
+++ b/cpplite/cpplite.debugger/src/org/netbeans/modules/cpplite/debugger/api/Debugger.java
@@ -16,10 +16,20 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.netbeans.modules.lsp.client.options;
+package org.netbeans.modules.cpplite.debugger.api;
-public interface ServerRestarter {
-
- public void restart();
+import java.io.IOException;
+import java.util.List;
+import org.netbeans.modules.cpplite.debugger.CPPLiteDebugger;
+import org.netbeans.modules.cpplite.debugger.CPPLiteDebuggerConfig;
+/**
+ *
+ * @author lahvac
+ */
+public class Debugger {
+
+ public static Process startInDebugger(List<String> command) throws IOException {
+ return CPPLiteDebugger.startDebugging(new CPPLiteDebuggerConfig(command)).second();
+ }
}
diff --git a/cpplite/cpplite.debugger/src/org/netbeans/modules/cpplite/debugger/breakpoints/BreakpointAnnotationListener.java b/cpplite/cpplite.debugger/src/org/netbeans/modules/cpplite/debugger/breakpoints/BreakpointAnnotationListener.java
new file mode 100644
index 0000000..e1791ee
--- /dev/null
+++ b/cpplite/cpplite.debugger/src/org/netbeans/modules/cpplite/debugger/breakpoints/BreakpointAnnotationListener.java
@@ -0,0 +1,112 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.netbeans.modules.cpplite.debugger.breakpoints;
+
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+import java.util.HashMap;
+import java.util.Map;
+import org.netbeans.api.debugger.Breakpoint;
+import org.netbeans.api.debugger.DebuggerManager;
+
+import org.netbeans.api.debugger.DebuggerManagerAdapter;
+import org.netbeans.modules.cpplite.debugger.DebuggerBreakpointAnnotation;
+
+
+/**
+ * Listens on {@org.netbeans.api.debugger.DebuggerManager} on
+ * {@link org.netbeans.api.debugger.DebuggerManager#PROP_BREAKPOINTS}
+ * property and annotates JPDA Debugger line breakpoints in NetBeans editor.
+ *
+ * @author Jan Jancura
+ */
+public class BreakpointAnnotationListener extends DebuggerManagerAdapter
+implements PropertyChangeListener {
+
+ private Map breakpointToAnnotation = new HashMap ();
+
+
+ @Override
+ public String[] getProperties () {
+ return new String[] {DebuggerManager.PROP_BREAKPOINTS};
+ }
+
+ /**
+ * Called when some breakpoint is added.
+ *
+ * @param b breakpoint
+ */
+ @Override
+ public void breakpointAdded (Breakpoint b) {
+ if (! (b instanceof CPPLiteBreakpoint)) return;
+ addAnnotation ((CPPLiteBreakpoint) b);
+ }
+
+ /**
+ * Called when some breakpoint is removed.
+ *
+ * @param breakpoint
+ */
+ @Override
+ public void breakpointRemoved (Breakpoint b) {
+ if (! (b instanceof CPPLiteBreakpoint)) return;
+ removeAnnotation (b);
+ }
+
+ /**
+ * This method gets called when a bound property is changed.
+ * @param evt A PropertyChangeEvent object describing the event source
+ * and the property that has changed.
+ */
+
+ @Override
+ public void propertyChange (PropertyChangeEvent evt) {
+ if (evt.getPropertyName () != Breakpoint.PROP_ENABLED) return;
+ removeAnnotation ((Breakpoint) evt.getSource ());
+ addAnnotation ((CPPLiteBreakpoint) evt.getSource ());
+ }
+
+ private void addAnnotation (CPPLiteBreakpoint b) {
+ breakpointToAnnotation.put (
+ b,
+ new DebuggerBreakpointAnnotation (
+ b.isEnabled () ?
+ DebuggerBreakpointAnnotation.BREAKPOINT_ANNOTATION_TYPE :
+ DebuggerBreakpointAnnotation.DISABLED_BREAKPOINT_ANNOTATION_TYPE,
+ b
+ )
+ );
+ b.addPropertyChangeListener (
+ Breakpoint.PROP_ENABLED,
+ this
+ );
+ }
+
+ private void removeAnnotation (Breakpoint b) {
+ DebuggerBreakpointAnnotation annotation = (DebuggerBreakpointAnnotation)
+ breakpointToAnnotation.remove (b);
+ if (annotation == null) return;
+ annotation.detach ();
+ b.removePropertyChangeListener (
+ Breakpoint.PROP_ENABLED,
+ this
+ );
+ }
+}
diff --git a/cpplite/cpplite.debugger/src/org/netbeans/modules/cpplite/debugger/breakpoints/BreakpointModel.java b/cpplite/cpplite.debugger/src/org/netbeans/modules/cpplite/debugger/breakpoints/BreakpointModel.java
new file mode 100644
index 0000000..e58eb67
--- /dev/null
+++ b/cpplite/cpplite.debugger/src/org/netbeans/modules/cpplite/debugger/breakpoints/BreakpointModel.java
@@ -0,0 +1,155 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.netbeans.modules.cpplite.debugger.breakpoints;
+
+import java.util.Vector;
+
+import org.netbeans.api.debugger.DebuggerEngine;
+import org.netbeans.api.debugger.DebuggerManager;
+import org.netbeans.modules.cpplite.debugger.CPPLiteDebugger;
+import org.netbeans.modules.cpplite.debugger.Utils;
+import org.netbeans.spi.viewmodel.ModelEvent;
+import org.netbeans.spi.viewmodel.NodeModel;
+import org.netbeans.spi.viewmodel.ModelListener;
+import org.netbeans.spi.viewmodel.UnknownTypeException;
+import org.openide.filesystems.FileObject;
+
+/**
+ *
+ * @author Jan Jancura
+ */
+public class BreakpointModel implements NodeModel {
+
+ public static final String LINE_BREAKPOINT =
+ "org/netbeans/modules/debugger/resources/editor/Breakpoint";
+ public static final String LINE_BREAKPOINT_PC =
+ "org/netbeans/modules/debugger/resources/editor/Breakpoint+PC";
+ public static final String DISABLED_LINE_BREAKPOINT =
+ "org/netbeans/modules/debugger/resources/editor/DisabledBreakpoint";
+
+ private Vector listeners = new Vector ();
+
+
+ // NodeModel implementation ................................................
+
+ /**
+ * Returns display name for given node.
+ *
+ * @throws ComputingException if the display name resolving process
+ * is time consuming, and the value will be updated later
+ * @throws UnknownTypeException if this NodeModel implementation is not
+ * able to resolve display name for given node type
+ * @return display name for given node
+ */
+ @Override
+ public String getDisplayName (Object node) throws UnknownTypeException {
+ if (node instanceof CPPLiteBreakpoint) {
+ CPPLiteBreakpoint breakpoint = (CPPLiteBreakpoint) node;
+ FileObject fileObject = breakpoint.getLine().getLookup().lookup(FileObject.class);
+ return fileObject.getNameExt () + ":" +
+ (breakpoint.getLine ().getLineNumber () + 1);
+ }
+ throw new UnknownTypeException (node);
+ }
+
+ /**
+ * Returns icon for given node.
+ *
+ * @throws ComputingException if the icon resolving process
+ * is time consuming, and the value will be updated later
+ * @throws UnknownTypeException if this NodeModel implementation is not
+ * able to resolve icon for given node type
+ * @return icon for given node
+ */
+ @Override
+ public String getIconBase (Object node) throws UnknownTypeException {
+ if (node instanceof CPPLiteBreakpoint) {
+ CPPLiteBreakpoint breakpoint = (CPPLiteBreakpoint) node;
+ if (!((CPPLiteBreakpoint) node).isEnabled ())
+ return DISABLED_LINE_BREAKPOINT;
+ CPPLiteDebugger debugger = getDebugger ();
+ if ( debugger != null &&
+ Utils.contains (
+ debugger.getCurrentLine (),
+ breakpoint.getLine ()
+ )
+ )
+ return LINE_BREAKPOINT_PC;
+ return LINE_BREAKPOINT;
+ }
+ throw new UnknownTypeException (node);
+ }
+
+ /**
+ * Returns tooltip for given node.
+ *
+ * @throws ComputingException if the tooltip resolving process
+ * is time consuming, and the value will be updated later
+ * @throws UnknownTypeException if this NodeModel implementation is not
+ * able to resolve tooltip for given node type
+ * @return tooltip for given node
+ */
+ @Override
+ public String getShortDescription (Object node)
+ throws UnknownTypeException {
+ if (node instanceof CPPLiteBreakpoint) {
+ CPPLiteBreakpoint breakpoint = (CPPLiteBreakpoint) node;
+ return breakpoint.getLine ().getDisplayName ();
+ }
+ throw new UnknownTypeException (node);
+ }
+
+ /**
+ * Registers given listener.
+ *
+ * @param l the listener to add
+ */
+ @Override
+ public void addModelListener (ModelListener l) {
+ listeners.add (l);
+ }
+
+ /**
+ * Unregisters given listener.
+ *
+ * @param l the listener to remove
+ */
+ @Override
+ public void removeModelListener (ModelListener l) {
+ listeners.remove (l);
+ }
+
+
+ public void fireChanges () {
+ Vector v = (Vector) listeners.clone ();
+ int i, k = v.size ();
+ for (i = 0; i < k; i++)
+ ((ModelListener) v.get (i)).modelChanged (
+ new ModelEvent.TreeChanged (this)
+ );
+ }
+
+ private static CPPLiteDebugger getDebugger () {
+ DebuggerEngine engine = DebuggerManager.getDebuggerManager ().
+ getCurrentEngine ();
+ if (engine == null) return null;
+ return engine.lookupFirst(null, CPPLiteDebugger.class);
+ }
+}
diff --git a/cpplite/cpplite.debugger/src/org/netbeans/modules/cpplite/debugger/breakpoints/BreakpointsReader.java b/cpplite/cpplite.debugger/src/org/netbeans/modules/cpplite/debugger/breakpoints/BreakpointsReader.java
new file mode 100644
index 0000000..79339f4
--- /dev/null
+++ b/cpplite/cpplite.debugger/src/org/netbeans/modules/cpplite/debugger/breakpoints/BreakpointsReader.java
@@ -0,0 +1,124 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.netbeans.modules.cpplite.debugger.breakpoints;
+
+import java.net.MalformedURLException;
+import java.net.URL;
+import org.netbeans.api.debugger.Breakpoint;
+import org.netbeans.api.debugger.Properties;
+import org.openide.cookies.LineCookie;
+import org.openide.filesystems.FileObject;
+import org.openide.filesystems.URLMapper;
+import org.openide.loaders.DataObject;
+import org.openide.loaders.DataObjectNotFoundException;
+import org.openide.text.Line;
+
+
+/**
+ *
+ * @author Jan Jancura
+ */
+public class BreakpointsReader implements Properties.Reader {
+
+
+ @Override
+ public String [] getSupportedClassNames () {
+ return new String[] {
+ CPPLiteBreakpoint.class.getName (),
+ };
+ }
+
+ @Override
+ public Object read (String typeID, Properties properties) {
+ if (!(typeID.equals (CPPLiteBreakpoint.class.getName ())))
+ return null;
+
+ Line line = getLine (
+ properties.getString ("url", null),
+ properties.getInt ("lineNumber", 1));
+ if (line == null) return null;
+ CPPLiteBreakpoint b = new CPPLiteBreakpoint (line);
+ b.setGroupName(
+ properties.getString (Breakpoint.PROP_GROUP_NAME, "")
+ );
+ int hitCountFilter = properties.getInt(Breakpoint.PROP_HIT_COUNT_FILTER, 0);
+ Breakpoint.HIT_COUNT_FILTERING_STYLE hitCountFilteringStyle;
+ if (hitCountFilter > 0) {
+ hitCountFilteringStyle = Breakpoint.HIT_COUNT_FILTERING_STYLE.values()
+ [properties.getInt(Breakpoint.PROP_HIT_COUNT_FILTER+"_style", 0)]; // NOI18N
+ } else {
+ hitCountFilteringStyle = null;
+ }
+ b.setHitCountFilter(hitCountFilter, hitCountFilteringStyle);
+ if (properties.getBoolean (Breakpoint.PROP_ENABLED, true))
+ b.enable ();
+ else
+ b.disable ();
+ return b;
+ }
+
+ @Override
+ public void write (Object object, Properties properties) {
+ CPPLiteBreakpoint b = (CPPLiteBreakpoint) object;
+ FileObject fo = (FileObject) b.getLine ().getLookup ().
+ lookup (FileObject.class);
+ properties.setString("url", fo.toURL().toString());
+ properties.setInt (
+ "lineNumber",
+ b.getLine ().getLineNumber ()
+ );
+ properties.setString (
+ Breakpoint.PROP_GROUP_NAME,
+ b.getGroupName ()
+ );
+ properties.setBoolean (Breakpoint.PROP_ENABLED, b.isEnabled ());
+ properties.setInt(Breakpoint.PROP_HIT_COUNT_FILTER, b.getHitCountFilter());
+ Breakpoint.HIT_COUNT_FILTERING_STYLE style = b.getHitCountFilteringStyle();
+ properties.setInt(Breakpoint.PROP_HIT_COUNT_FILTER+"_style", style != null ? style.ordinal() : 0); // NOI18N
+ }
+
+
+ private Line getLine (String url, int lineNumber) {
+ FileObject file;
+ try {
+ file = URLMapper.findFileObject (new URL (url));
+ } catch (MalformedURLException e) {
+ return null;
+ }
+ if (file == null) return null;
+ DataObject dataObject;
+ try {
+ dataObject = DataObject.find (file);
+ } catch (DataObjectNotFoundException ex) {
+ return null;
+ }
+ if (dataObject == null) return null;
+ LineCookie lineCookie = dataObject.getLookup().lookup(LineCookie.class);
+ if (lineCookie == null) return null;
+ Line.Set ls = lineCookie.getLineSet ();
+ if (ls == null) return null;
+ try {
+ return ls.getCurrent (lineNumber);
+ } catch (IndexOutOfBoundsException e) {
+ } catch (IllegalArgumentException e) {
+ }
+ return null;
+ }
+}
diff --git a/nb/ide.launcher/netbeans.clusters b/cpplite/cpplite.debugger/src/org/netbeans/modules/cpplite/debugger/breakpoints/Bundle.properties
similarity index 73%
copy from nb/ide.launcher/netbeans.clusters
copy to cpplite/cpplite.debugger/src/org/netbeans/modules/cpplite/debugger/breakpoints/Bundle.properties
index 2ea6c1c..438f33d 100644
--- a/nb/ide.launcher/netbeans.clusters
+++ b/cpplite/cpplite.debugger/src/org/netbeans/modules/cpplite/debugger/breakpoints/Bundle.properties
@@ -15,30 +15,4 @@
# specific language governing permissions and limitations
# under the License.
-# platform cluster first
-platform
-# application cluster second
-nb
-# ergonomics cluster if present
-ergonomics
-# and now the rest
-ide
-extide
-java
-apisupport
-webcommon
-websvccommon
-enterprise
-mobility
-profiler
-python
-php
-identity
-harness
-cnd
-cndext
-dlight
-groovy
-extra
-javacard
-javafx
+LineBrkp_Type=Line
diff --git a/cpplite/cpplite.debugger/src/org/netbeans/modules/cpplite/debugger/breakpoints/CPPLiteBreakpoint.java b/cpplite/cpplite.debugger/src/org/netbeans/modules/cpplite/debugger/breakpoints/CPPLiteBreakpoint.java
new file mode 100644
index 0000000..e340d84
--- /dev/null
+++ b/cpplite/cpplite.debugger/src/org/netbeans/modules/cpplite/debugger/breakpoints/CPPLiteBreakpoint.java
@@ -0,0 +1,206 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.netbeans.modules.cpplite.debugger.breakpoints;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+import org.netbeans.api.debugger.Breakpoint;
+import org.netbeans.api.debugger.DebuggerEngine;
+import org.netbeans.api.debugger.DebuggerManager;
+import org.netbeans.api.debugger.DebuggerManagerAdapter;
+import org.netbeans.api.debugger.DebuggerManagerListener;
+import org.netbeans.api.project.Project;
+import org.netbeans.api.project.ProjectManager;
+import org.netbeans.modules.cpplite.debugger.CPPLiteDebugger;
+import org.openide.filesystems.FileObject;
+import org.openide.text.Line;
+import org.openide.util.NbBundle;
+import org.openide.util.WeakListeners;
+
+
+
+/**
+ *
+ * @author Honza
+ */
+public class CPPLiteBreakpoint extends Breakpoint {
+
+ private boolean enabled = true;
+ private Line line;
+
+
+ /*test?*/public CPPLiteBreakpoint (Line line) {
+ this.line = line;
+ }
+
+ public Line getLine () {
+ return line;
+ }
+
+ /**
+ * Test whether the breakpoint is enabled.
+ *
+ * @return <code>true</code> if so
+ */
+ @Override
+ public boolean isEnabled () {
+ return enabled;
+ }
+
+ /**
+ * Disables the breakpoint.
+ */
+ @Override
+ public void disable () {
+ if (!enabled) return;
+ enabled = false;
+ firePropertyChange (PROP_ENABLED, Boolean.TRUE, Boolean.FALSE);
+ }
+
+ /**
+ * Enables the breakpoint.
+ */
+ @Override
+ public void enable () {
+ if (enabled) return;
+ enabled = true;
+ firePropertyChange (PROP_ENABLED, Boolean.FALSE, Boolean.TRUE);
+ }
+
+ @Override
+ public GroupProperties getGroupProperties() {
+ return new AntGroupProperties();
+ }
+
+ private final class AntGroupProperties extends GroupProperties {
+
+ private AntEngineListener engineListener;
+
+ @Override
+ public String getLanguage() {
+ return "ANT";
+ }
+
+ @Override
+ public String getType() {
+ return NbBundle.getMessage(CPPLiteBreakpoint.class, "LineBrkp_Type");
+ }
+
+ private FileObject getFile() {
+ return line.getLookup().lookup(FileObject.class);
+ }
+
+ @Override
+ public FileObject[] getFiles() {
+ FileObject fo = getFile();
+ if (fo != null) {
+ return new FileObject[] { fo };
+ } else {
+ return null;
+ }
+ }
+
+ @Override
+ public Project[] getProjects() {
+ FileObject f = getFile();
+ while (f != null) {
+ f = f.getParent();
+ if (f != null && ProjectManager.getDefault().isProject(f)) {
+ break;
+ }
+ }
+ if (f != null) {
+ try {
+ return new Project[] { ProjectManager.getDefault().findProject(f) };
+ } catch (IOException ex) {
+ } catch (IllegalArgumentException ex) {
+ }
+ }
+ return null;
+ }
+
+ @Override
+ public DebuggerEngine[] getEngines() {
+ if (engineListener == null) {
+ engineListener = new AntEngineListener();
+ DebuggerManager.getDebuggerManager().addDebuggerListener(
+ WeakListeners.create(DebuggerManagerListener.class,
+ engineListener,
+ DebuggerManager.getDebuggerManager()));
+ }
+ DebuggerEngine[] engines = DebuggerManager.getDebuggerManager().getDebuggerEngines();
+ if (engines.length == 0) {
+ return null;
+ }
+ if (engines.length == 1) {
+ if (isAntEngine(engines[0])) {
+ return engines;
+ } else {
+ return null;
+ }
+ }
+ // Several running sessions
+ List<DebuggerEngine> antEngines = null;
+ for (DebuggerEngine e : engines) {
+ if (isAntEngine(e)) {
+ if (antEngines == null) {
+ antEngines = new ArrayList<DebuggerEngine>();
+ }
+ antEngines.add(e);
+ }
+ }
+ if (antEngines == null) {
+ return null;
+ } else {
+ return antEngines.toArray(new DebuggerEngine[]{});
+ }
+ }
+
+ private boolean isAntEngine(DebuggerEngine e) {
+ return e.lookupFirst(null, CPPLiteDebugger.class) != null;
+ }
+
+ @Override
+ public boolean isHidden() {
+ return false;
+ }
+
+ private final class AntEngineListener extends DebuggerManagerAdapter {
+
+ @Override
+ public void engineAdded(DebuggerEngine engine) {
+ if (isAntEngine(engine)) {
+ firePropertyChange(PROP_GROUP_PROPERTIES, null, AntGroupProperties.this);
+ }
+ }
+
+ @Override
+ public void engineRemoved(DebuggerEngine engine) {
+ if (isAntEngine(engine)) {
+ firePropertyChange(PROP_GROUP_PROPERTIES, null, AntGroupProperties.this);
+ }
+ }
+
+ }
+
+ }
+
+}
diff --git a/cpplite/cpplite.debugger/src/org/netbeans/modules/cpplite/debugger/breakpoints/CPPLiteBreakpointActionProvider.java b/cpplite/cpplite.debugger/src/org/netbeans/modules/cpplite/debugger/breakpoints/CPPLiteBreakpointActionProvider.java
new file mode 100644
index 0000000..8ef0cc8
--- /dev/null
+++ b/cpplite/cpplite.debugger/src/org/netbeans/modules/cpplite/debugger/breakpoints/CPPLiteBreakpointActionProvider.java
@@ -0,0 +1,127 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.netbeans.modules.cpplite.debugger.breakpoints;
+
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Set;
+import org.netbeans.api.debugger.ActionsManager;
+import org.netbeans.api.debugger.Breakpoint;
+import org.netbeans.api.debugger.DebuggerManager;
+import org.netbeans.spi.debugger.ActionsProvider.Registration;
+import org.netbeans.spi.debugger.ActionsProvider.Registrations;
+import org.netbeans.spi.debugger.ActionsProviderSupport;
+import org.netbeans.spi.debugger.ui.EditorContextDispatcher;
+import org.openide.filesystems.FileObject;
+import org.openide.text.Line;
+import org.openide.util.WeakListeners;
+
+/**
+ *
+ * @author Honza
+ */
+@Registration(actions={"toggleBreakpoint"}, activateForMIMETypes={"text/X-c", "text/X-c++", "text/X-h", "text/X-h++"})
+public class CPPLiteBreakpointActionProvider extends ActionsProviderSupport
+ implements PropertyChangeListener {
+
+ private static final String[] C_MIME_TYPES = new String[] {"text/X-c", "text/X-c++", "text/X-h", "text/X-h++"}; // NOI18N
+ private static final Set<String> C_MIME_TYPES_SET = new HashSet<>(Arrays.asList(C_MIME_TYPES));
+
+ private static final Set actions = Collections.singleton (
+ ActionsManager.ACTION_TOGGLE_BREAKPOINT
+ );
+
+ EditorContextDispatcher context = EditorContextDispatcher.getDefault();
+
+ public CPPLiteBreakpointActionProvider () {
+ for (String mimeType : C_MIME_TYPES) {
+ context.addPropertyChangeListener(mimeType,
+ WeakListeners.propertyChange(this, context));
+ }
+ setEnabled (ActionsManager.ACTION_TOGGLE_BREAKPOINT, false);
+ }
+
+ /**
+ * Called when the action is called (action button is pressed).
+ *
+ * @param action an action which has been called
+ */
+ @Override
+ public void doAction (Object action) {
+ Line line = getCurrentLine ();
+ if (line == null) return ;
+ Breakpoint[] breakpoints = DebuggerManager.getDebuggerManager ().
+ getBreakpoints ();
+ int i, k = breakpoints.length;
+ for (i = 0; i < k; i++)
+ if ( breakpoints [i] instanceof CPPLiteBreakpoint &&
+ ((CPPLiteBreakpoint) breakpoints [i]).getLine ().equals (line)
+ ) {
+ DebuggerManager.getDebuggerManager ().removeBreakpoint
+ (breakpoints [i]);
+ break;
+ }
+ if (i == k)
+ DebuggerManager.getDebuggerManager ().addBreakpoint (
+ new CPPLiteBreakpoint (line)
+ );
+ //S ystem.out.println("toggle");
+ }
+
+ /**
+ * Returns set of actions supported by this ActionsProvider.
+ *
+ * @return set of actions supported by this ActionsProvider
+ */
+ @Override
+ public Set getActions () {
+ return actions;
+ }
+
+
+ private static Line getCurrentLine () {
+ FileObject fo = EditorContextDispatcher.getDefault().getCurrentFile();
+ //System.out.println("n = "+n+", FO = "+fo+" => is ANT = "+isAntFile(fo));
+ if (!isCFile(fo)) {
+ return null;
+ }
+ return EditorContextDispatcher.getDefault().getCurrentLine();
+ }
+
+
+ private static boolean isCFile(FileObject fo) {
+ if (fo == null) {
+ return false;
+ } else {
+ return C_MIME_TYPES_SET.contains(fo.getMIMEType());
+ }
+ }
+
+ @Override
+ public void propertyChange(PropertyChangeEvent evt) {
+ // We need to push the state there :-(( instead of wait for someone to be interested in...
+ boolean enabled = getCurrentLine() != null;
+ setEnabled (ActionsManager.ACTION_TOGGLE_BREAKPOINT, enabled);
+ }
+
+}
diff --git a/ide/lsp.client/src/org/netbeans/modules/lsp/client/options/ServerRestarter.java b/cpplite/cpplite.debugger/src/org/netbeans/modules/cpplite/debugger/breakpoints/LoadBreakpoints.java
similarity index 59%
copy from ide/lsp.client/src/org/netbeans/modules/lsp/client/options/ServerRestarter.java
copy to cpplite/cpplite.debugger/src/org/netbeans/modules/cpplite/debugger/breakpoints/LoadBreakpoints.java
index feacb87..78cde77 100644
--- a/ide/lsp.client/src/org/netbeans/modules/lsp/client/options/ServerRestarter.java
+++ b/cpplite/cpplite.debugger/src/org/netbeans/modules/cpplite/debugger/breakpoints/LoadBreakpoints.java
@@ -16,10 +16,26 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.netbeans.modules.lsp.client.options;
+package org.netbeans.modules.cpplite.debugger.breakpoints;
-public interface ServerRestarter {
+import org.netbeans.api.debugger.DebuggerManager;
+import org.openide.modules.OnStart;
+import org.openide.windows.WindowManager;
- public void restart();
+/**
+ *
+ * @author lahvac
+ */
+@OnStart
+public class LoadBreakpoints implements Runnable {
+ @Override
+ public void run() {
+ //to load and assign breakpoints
+ //XXX: there must be a better/cleaner way, right?
+ WindowManager.getDefault().invokeWhenUIReady(() ->
+ DebuggerManager.getDebuggerManager ().getBreakpoints ()
+ );
+ }
+
}
diff --git a/cpplite/cpplite.debugger/src/org/netbeans/modules/cpplite/debugger/breakpoints/PersistenceManager.java b/cpplite/cpplite.debugger/src/org/netbeans/modules/cpplite/debugger/breakpoints/PersistenceManager.java
new file mode 100644
index 0000000..c296967
--- /dev/null
+++ b/cpplite/cpplite.debugger/src/org/netbeans/modules/cpplite/debugger/breakpoints/PersistenceManager.java
@@ -0,0 +1,147 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.netbeans.modules.cpplite.debugger.breakpoints;
+
+import java.beans.PropertyChangeEvent;
+import java.util.List;
+import java.util.ArrayList;
+import org.netbeans.api.debugger.Breakpoint;
+import org.netbeans.api.debugger.DebuggerEngine;
+
+import org.netbeans.api.debugger.DebuggerManager;
+import org.netbeans.api.debugger.LazyDebuggerManagerListener;
+import org.netbeans.api.debugger.Properties;
+import org.netbeans.api.debugger.Session;
+import org.netbeans.api.debugger.Watch;
+
+/**
+ * Listens on DebuggerManager and:
+ * - loads all breakpoints & watches on startup
+ * - listens on all changes of breakpoints and watches (like breakoint / watch
+ * added / removed, or some property change) and saves a new values
+ *
+ * @author Jan Jancura
+ */
+public class PersistenceManager implements LazyDebuggerManagerListener {
+
+ @Override
+ public Breakpoint[] initBreakpoints () {
+ Properties p = Properties.getDefault ().getProperties ("debugger").
+ getProperties (DebuggerManager.PROP_BREAKPOINTS);
+ Breakpoint[] breakpoints = (Breakpoint[]) p.getArray (
+ "cpplite",
+ new Breakpoint [0]
+ );
+ for (int i = 0; i < breakpoints.length; i++) {
+ if (breakpoints[i] == null) {
+ Breakpoint[] b2 = new Breakpoint[breakpoints.length - 1];
+ System.arraycopy(breakpoints, 0, b2, 0, i);
+ if (i < breakpoints.length - 1) {
+ System.arraycopy(breakpoints, i + 1, b2, i, breakpoints.length - i - 1);
+ }
+ breakpoints = b2;
+ i--;
+ continue;
+ }
+ breakpoints[i].addPropertyChangeListener(this);
+ }
+ return breakpoints;
+ }
+
+ @Override
+ public void initWatches () {
+ }
+
+ @Override
+ public String[] getProperties () {
+ return new String [] {
+ DebuggerManager.PROP_BREAKPOINTS_INIT,
+ DebuggerManager.PROP_BREAKPOINTS,
+ };
+ }
+
+ @Override
+ public void breakpointAdded (Breakpoint breakpoint) {
+ if (breakpoint instanceof CPPLiteBreakpoint) {
+ Properties p = Properties.getDefault ().getProperties ("debugger").
+ getProperties (DebuggerManager.PROP_BREAKPOINTS);
+ p.setArray (
+ "cpplite",
+ getBreakpoints ()
+ );
+ breakpoint.addPropertyChangeListener(this);
+ }
+ }
+
+ @Override
+ public void breakpointRemoved (Breakpoint breakpoint) {
+ if (breakpoint instanceof CPPLiteBreakpoint) {
+ Properties p = Properties.getDefault ().getProperties ("debugger").
+ getProperties (DebuggerManager.PROP_BREAKPOINTS);
+ p.setArray (
+ "cpplite",
+ getBreakpoints ()
+ );
+ breakpoint.removePropertyChangeListener(this);
+ }
+ }
+ @Override
+ public void watchAdded (Watch watch) {
+ }
+
+ @Override
+ public void watchRemoved (Watch watch) {
+ }
+
+ @Override
+ public void propertyChange (PropertyChangeEvent evt) {
+ if (evt.getSource() instanceof Breakpoint) {
+ Properties.getDefault ().getProperties ("debugger").
+ getProperties (DebuggerManager.PROP_BREAKPOINTS).setArray (
+ "cpplite",
+ getBreakpoints ()
+ );
+ }
+ }
+
+ @Override
+ public void sessionAdded (Session session) {}
+ @Override
+ public void sessionRemoved (Session session) {}
+ @Override
+ public void engineAdded (DebuggerEngine engine) {}
+ @Override
+ public void engineRemoved (DebuggerEngine engine) {}
+
+
+ private static Breakpoint[] getBreakpoints () {
+ Breakpoint[] bs = DebuggerManager.getDebuggerManager ().
+ getBreakpoints ();
+ int i, k = bs.length;
+ List<Breakpoint> bb = new ArrayList<>();
+ for (i = 0; i < k; i++)
+ // Don't store hidden breakpoints
+ if (bs[i] instanceof CPPLiteBreakpoint)
+ bb.add (bs [i]);
+ bs = new Breakpoint [bb.size ()];
+ return (Breakpoint[]) bb.toArray (bs);
+ }
+}
+
diff --git a/nb/ide.launcher/netbeans.clusters b/cpplite/cpplite.debugger/src/org/netbeans/modules/cpplite/debugger/resources/Bundle.properties
similarity index 73%
copy from nb/ide.launcher/netbeans.clusters
copy to cpplite/cpplite.debugger/src/org/netbeans/modules/cpplite/debugger/resources/Bundle.properties
index 2ea6c1c..7d968cf 100644
--- a/nb/ide.launcher/netbeans.clusters
+++ b/cpplite/cpplite.debugger/src/org/netbeans/modules/cpplite/debugger/resources/Bundle.properties
@@ -15,30 +15,10 @@
# specific language governing permissions and limitations
# under the License.
-# platform cluster first
-platform
-# application cluster second
-nb
-# ergonomics cluster if present
-ergonomics
-# and now the rest
-ide
-extide
-java
-apisupport
-webcommon
-websvccommon
-enterprise
-mobility
-profiler
-python
-php
-identity
-harness
-cnd
-cndext
-dlight
-groovy
-extra
-javacard
-javafx
+
+#Annotations
+HINT_CURRENT_PC2=XXX Current Ant Target
+HINT_CURRENT_PCPart=XXX Next Ant Target
+HINT_CURRENT_PC2Part=XXX Ant Targets
+HINT_CURRENT_PC2_BP=XXX Current Ant Target + Breakpoint
+HINT_CURRENT_PC2_DBP=XXX Current Ant Target + Disabled Breakpoint
\ No newline at end of file
diff --git a/cpplite/cpplite.debugger/src/org/netbeans/modules/cpplite/debugger/resources/CurrentPC2.xml b/cpplite/cpplite.debugger/src/org/netbeans/modules/cpplite/debugger/resources/CurrentPC2.xml
new file mode 100644
index 0000000..1153d87
--- /dev/null
+++ b/cpplite/cpplite.debugger/src/org/netbeans/modules/cpplite/debugger/resources/CurrentPC2.xml
@@ -0,0 +1,31 @@
+<?xml version="1.0"?>
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+
+-->
+
+<!DOCTYPE type PUBLIC "-//NetBeans//DTD annotation type 1.0//EN" "http://www.netbeans.org/dtds/annotation-type-1_0.dtd">
+<type
+ name='CurrentPC2'
+ description_key='HINT_CURRENT_PC2'
+ localizing_bundle='org.netbeans.modules.cpplite.debugger.resources.Bundle'
+ visible='true'
+ highlight='0xBDE6AA'
+ type='line'
+/>
diff --git a/cpplite/cpplite.debugger/src/org/netbeans/modules/cpplite/debugger/resources/CurrentPC2LinePart.xml b/cpplite/cpplite.debugger/src/org/netbeans/modules/cpplite/debugger/resources/CurrentPC2LinePart.xml
new file mode 100644
index 0000000..a9fbfea
--- /dev/null
+++ b/cpplite/cpplite.debugger/src/org/netbeans/modules/cpplite/debugger/resources/CurrentPC2LinePart.xml
@@ -0,0 +1,31 @@
+<?xml version="1.0"?>
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+
+-->
+
+<!DOCTYPE type PUBLIC "-//NetBeans//DTD annotation type 1.0//EN" "http://www.netbeans.org/dtds/annotation-type-1_0.dtd">
+<type
+ name='CurrentPC2LinePart'
+ description_key='HINT_CURRENT_PC2Part'
+ localizing_bundle='org.netbeans.modules.cpplite.debugger.resources.Bundle'
+ visible='true'
+ highlight='0xBDE6AA'
+ type='linepart'
+/>
diff --git a/cpplite/cpplite.debugger/src/org/netbeans/modules/cpplite/debugger/resources/CurrentPC2_BP.xml b/cpplite/cpplite.debugger/src/org/netbeans/modules/cpplite/debugger/resources/CurrentPC2_BP.xml
new file mode 100644
index 0000000..df70dbf
--- /dev/null
+++ b/cpplite/cpplite.debugger/src/org/netbeans/modules/cpplite/debugger/resources/CurrentPC2_BP.xml
@@ -0,0 +1,39 @@
+<?xml version="1.0"?>
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+
+-->
+
+<!DOCTYPE type PUBLIC "-//NetBeans//DTD annotation type 1.0//EN" "http://www.netbeans.org/dtds/annotation-type-1_0.dtd">
+<type
+ name='CurrentPC2_BP'
+ description_key='HINT_CURRENT_PC2_BP'
+ localizing_bundle='org.netbeans.modules.cpplite.debugger.resources.Bundle'
+ visible='true'
+ glyph='nbresloc:/org/netbeans/modules/debugger/resources/editor/Breakpoint.png'
+ highlight='0xFC9D9F'
+ type='line'
+>
+<!-- highlight='0xD1FFBC' -->
+
+ <combination order='600'>
+ <combine annotationtype='Breakpoint'/>
+ <combine annotationtype='CurrentPC2'/>
+ </combination>
+</type>
diff --git a/cpplite/cpplite.debugger/src/org/netbeans/modules/cpplite/debugger/resources/CurrentPC2_DBP.xml b/cpplite/cpplite.debugger/src/org/netbeans/modules/cpplite/debugger/resources/CurrentPC2_DBP.xml
new file mode 100644
index 0000000..2fd5004
--- /dev/null
+++ b/cpplite/cpplite.debugger/src/org/netbeans/modules/cpplite/debugger/resources/CurrentPC2_DBP.xml
@@ -0,0 +1,39 @@
+<?xml version="1.0"?>
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+
+-->
+
+<!DOCTYPE type PUBLIC "-//NetBeans//DTD annotation type 1.0//EN" "http://www.netbeans.org/dtds/annotation-type-1_0.dtd">
+<type
+ name='CurrentPC2_DBP'
+ description_key='HINT_CURRENT_PC2_DBP'
+ localizing_bundle='org.netbeans.modules.cpplite.debugger.resources.Bundle'
+ visible='true'
+ glyph='nbresloc:/org/netbeans/modules/debugger/resources/editor/DisabledBreakpoint.png'
+ highlight='0xDCDCD8'
+ type='line'
+>
+<!-- highlight='0xD1FFBC' -->
+
+ <combination order='700'>
+ <combine annotationtype='DisabledBreakpoint'/>
+ <combine annotationtype='CurrentPC2'/>
+ </combination>
+</type>
diff --git a/cpplite/cpplite.debugger/src/org/netbeans/modules/cpplite/debugger/resources/CurrentPCLinePart.xml b/cpplite/cpplite.debugger/src/org/netbeans/modules/cpplite/debugger/resources/CurrentPCLinePart.xml
new file mode 100644
index 0000000..3ca6eaa
--- /dev/null
+++ b/cpplite/cpplite.debugger/src/org/netbeans/modules/cpplite/debugger/resources/CurrentPCLinePart.xml
@@ -0,0 +1,32 @@
+<?xml version="1.0"?>
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+
+-->
+
+<!DOCTYPE type PUBLIC "-//NetBeans//DTD annotation type 1.0//EN" "http://www.netbeans.org/dtds/annotation-type-1_0.dtd">
+<type
+ name='CurrentPCLinePart'
+ description_key='HINT_CURRENT_PCPart'
+ localizing_bundle='org.netbeans.modules.cpplite.debugger.resources.Bundle'
+ visible='true'
+ glyph='nbresloc:/org/netbeans/modules/debugger/resources/editor/PC.gif'
+ highlight='0xBDE6AA'
+ type='linepart'
+/>
diff --git a/cpplite/cpplite.debugger/src/org/netbeans/modules/cpplite/debugger/resources/mf-layer.xml b/cpplite/cpplite.debugger/src/org/netbeans/modules/cpplite/debugger/resources/mf-layer.xml
new file mode 100644
index 0000000..5fa3df0
--- /dev/null
+++ b/cpplite/cpplite.debugger/src/org/netbeans/modules/cpplite/debugger/resources/mf-layer.xml
@@ -0,0 +1,129 @@
+<?xml version="1.0"?>
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+
+-->
+<!DOCTYPE filesystem PUBLIC "-//NetBeans//DTD Filesystem 1.0//EN" "http://www.netbeans.org/dtds/filesystem-1_0.dtd">
+<filesystem>
+
+ <folder name="Editors">
+ <folder name="text">
+ <folder name="X-c">
+ <folder name="GlyphGutterActions">
+ <file name="org-netbeans-modules-debugger-ui-actions-ToggleBreakpointAction.shadow">
+ <attr name="originalFile" stringvalue="Actions/Debug/org-netbeans-modules-debugger-ui-actions-ToggleBreakpointAction.instance"/>
+ <attr name="position" intvalue="500"/>
+ </file>
+ </folder>
+ <folder name="ToolTips">
+ <file name="org-netbeans-modules-ant-debugger-ToolTipAnnotation.instance"/>
+ </folder>
+ <folder name="Popup">
+ <file name="AfterToolsSeparator.instance"><attr name="instanceClass" stringvalue="javax.swing.JSeparator"/> <attr name="position" intvalue="3333"/>
+ </file>
+ <file name="org-netbeans-modules-debugger-ui-actions-AddWatchAction.shadow">
+ <attr name="originalFile" stringvalue="Actions/Debug/org-netbeans-modules-debugger-ui-actions-AddWatchAction.instance"/>
+ <attr name="position" intvalue="3666"/>
+ </file>
+ <file name="org-netbeans-modules-debugger-ui-actions-ToggleBreakpointAction.shadow">
+ <attr name="originalFile" stringvalue="Actions/Debug/org-netbeans-modules-debugger-ui-actions-ToggleBreakpointAction.instance"/>
+ <attr name="position" intvalue="3800"/>
+ </file>
+ </folder>
+ </folder>
+ <folder name="X-c++">
+ <folder name="GlyphGutterActions">
+ <file name="org-netbeans-modules-debugger-ui-actions-ToggleBreakpointAction.shadow">
+ <attr name="originalFile" stringvalue="Actions/Debug/org-netbeans-modules-debugger-ui-actions-ToggleBreakpointAction.instance"/>
+ <attr name="position" intvalue="500"/>
+ </file>
+ </folder>
+ <folder name="ToolTips">
+ <file name="org-netbeans-modules-ant-debugger-ToolTipAnnotation.instance"/>
+ </folder>
+ <folder name="Popup">
+ <file name="AfterToolsSeparator.instance"><attr name="instanceClass" stringvalue="javax.swing.JSeparator"/> <attr name="position" intvalue="3333"/>
+ </file>
+ <file name="org-netbeans-modules-debugger-ui-actions-AddWatchAction.shadow">
+ <attr name="originalFile" stringvalue="Actions/Debug/org-netbeans-modules-debugger-ui-actions-AddWatchAction.instance"/>
+ <attr name="position" intvalue="3666"/>
+ </file>
+ <file name="org-netbeans-modules-debugger-ui-actions-ToggleBreakpointAction.shadow">
+ <attr name="originalFile" stringvalue="Actions/Debug/org-netbeans-modules-debugger-ui-actions-ToggleBreakpointAction.instance"/>
+ <attr name="position" intvalue="3800"/>
+ </file>
+ </folder>
+ </folder>
+ <folder name="X-h">
+ <folder name="GlyphGutterActions">
+ <file name="org-netbeans-modules-debugger-ui-actions-ToggleBreakpointAction.shadow">
+ <attr name="originalFile" stringvalue="Actions/Debug/org-netbeans-modules-debugger-ui-actions-ToggleBreakpointAction.instance"/>
+ <attr name="position" intvalue="500"/>
+ </file>
+ </folder>
+ <folder name="ToolTips">
+ <file name="org-netbeans-modules-ant-debugger-ToolTipAnnotation.instance"/>
+ </folder>
+ <folder name="Popup">
+ <file name="AfterToolsSeparator.instance"><attr name="instanceClass" stringvalue="javax.swing.JSeparator"/> <attr name="position" intvalue="3333"/>
+ </file>
+ <file name="org-netbeans-modules-debugger-ui-actions-AddWatchAction.shadow">
+ <attr name="originalFile" stringvalue="Actions/Debug/org-netbeans-modules-debugger-ui-actions-AddWatchAction.instance"/>
+ <attr name="position" intvalue="3666"/>
+ </file>
+ <file name="org-netbeans-modules-debugger-ui-actions-ToggleBreakpointAction.shadow">
+ <attr name="originalFile" stringvalue="Actions/Debug/org-netbeans-modules-debugger-ui-actions-ToggleBreakpointAction.instance"/>
+ <attr name="position" intvalue="3800"/>
+ </file>
+ </folder>
+ </folder>
+ <folder name="X-h++">
+ <folder name="GlyphGutterActions">
+ <file name="org-netbeans-modules-debugger-ui-actions-ToggleBreakpointAction.shadow">
+ <attr name="originalFile" stringvalue="Actions/Debug/org-netbeans-modules-debugger-ui-actions-ToggleBreakpointAction.instance"/>
+ <attr name="position" intvalue="500"/>
+ </file>
+ </folder>
+ <folder name="ToolTips">
+ <file name="org-netbeans-modules-ant-debugger-ToolTipAnnotation.instance"/>
+ </folder>
+ <folder name="Popup">
+ <file name="AfterToolsSeparator.instance"><attr name="instanceClass" stringvalue="javax.swing.JSeparator"/> <attr name="position" intvalue="3333"/>
+ </file>
+ <file name="org-netbeans-modules-debugger-ui-actions-AddWatchAction.shadow">
+ <attr name="originalFile" stringvalue="Actions/Debug/org-netbeans-modules-debugger-ui-actions-AddWatchAction.instance"/>
+ <attr name="position" intvalue="3666"/>
+ </file>
+ <file name="org-netbeans-modules-debugger-ui-actions-ToggleBreakpointAction.shadow">
+ <attr name="originalFile" stringvalue="Actions/Debug/org-netbeans-modules-debugger-ui-actions-ToggleBreakpointAction.instance"/>
+ <attr name="position" intvalue="3800"/>
+ </file>
+ </folder>
+ </folder>
+ </folder>
+ <folder name="AnnotationTypes">
+ <file name="CurrentPCLinePart.xml" url="CurrentPCLinePart.xml"/>
+ <file name="CurrentPC2.xml" url="CurrentPC2.xml"/>
+ <file name="CurrentPC2LinePart.xml" url="CurrentPC2LinePart.xml"/>
+ <file name="CurrentPC2_BP.xml" url="CurrentPC2_BP.xml"/>
+ <file name="CurrentPC2_DBP.xml" url="CurrentPC2_DBP.xml"/>
+ </folder>
+ </folder>
+
+</filesystem>
diff --git a/cpplite/cpplite.debugger/test/unit/data/step-test/build.sh b/cpplite/cpplite.debugger/test/unit/data/step-test/build.sh
new file mode 100755
index 0000000..6cee61b
--- /dev/null
+++ b/cpplite/cpplite.debugger/test/unit/data/step-test/build.sh
@@ -0,0 +1 @@
+g++ -o main -g main.cpp
diff --git a/cpplite/cpplite.debugger/test/unit/data/step-test/main b/cpplite/cpplite.debugger/test/unit/data/step-test/main
new file mode 100755
index 0000000..2d8f500
Binary files /dev/null and b/cpplite/cpplite.debugger/test/unit/data/step-test/main differ
diff --git a/cpplite/cpplite.debugger/test/unit/data/step-test/main.cpp b/cpplite/cpplite.debugger/test/unit/data/step-test/main.cpp
new file mode 100644
index 0000000..3341b97
--- /dev/null
+++ b/cpplite/cpplite.debugger/test/unit/data/step-test/main.cpp
@@ -0,0 +1,13 @@
+#include <iostream>
+
+void test(void) {
+ std::cerr << "Hello, from err!" << std:endl;
+ std::cout << "Hello, second time!" << std:endl;
+}
+
+int main(void) {
+ int i = 42;
+ std::cout << "Hello, world!" << std:endl;
+ test();
+ std::cout << "Hello, second time!" << std:endl;
+}
diff --git a/cpplite/cpplite.debugger/test/unit/src/org/netbeans/modules/cpplite/debugger/StepTest.java b/cpplite/cpplite.debugger/test/unit/src/org/netbeans/modules/cpplite/debugger/StepTest.java
new file mode 100644
index 0000000..65da447
--- /dev/null
+++ b/cpplite/cpplite.debugger/test/unit/src/org/netbeans/modules/cpplite/debugger/StepTest.java
@@ -0,0 +1,137 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.netbeans.modules.cpplite.debugger;
+
+import java.io.File;
+import java.io.OutputStream;
+import java.io.OutputStreamWriter;
+import java.io.Writer;
+import java.util.Arrays;
+import junit.framework.Test;
+import org.netbeans.api.debugger.ActionsManager;
+import org.netbeans.api.debugger.DebuggerManager;
+import org.netbeans.junit.NbModuleSuite;
+import org.netbeans.junit.NbTestCase;
+import org.netbeans.modules.cpplite.debugger.breakpoints.CPPLiteBreakpoint;
+import org.openide.cookies.LineCookie;
+import org.openide.filesystems.FileObject;
+import org.openide.filesystems.FileUtil;
+import org.openide.loaders.DataObject;
+
+/**
+ * Tests Ant debugger stepping actions: step in, step out and step over.
+ *
+ * @author Jan Jancura
+ */
+public class StepTest extends NbTestCase {
+
+ public StepTest (String s) {
+ super (s);
+ }
+
+ @Override
+ protected void setUp() throws Exception {
+ clearWorkDir();
+ }
+
+ public void testStepOver () throws Exception {
+ File wd = getWorkDir();
+ FileObject source = FileUtil.createData(FileUtil.toFileObject(wd), "main.cpp");
+ try (OutputStream os = source.getOutputStream();
+ Writer w = new OutputStreamWriter(os)) {
+ w.append("#include <iostream>\n" +
+ "\n" +
+ "void test(void) {\n" +
+ " std::cerr << \"Hello, from err!\" << std::endl;\n" +
+ " std::cout << \"Hello, second time!\" << std::endl;\n" +
+ "}\n" +
+ "\n" +
+ "int main(void) {\n" +
+ " int i = 42;\n" +
+ " std::cout << \"Hello, world!\" << std::endl;\n" +
+ " test();\n" +
+ " std::cout << \"Hello, second time!\" << std::endl;\n" +
+ "}");
+ }
+ Process compile = new ProcessBuilder("g++", "-o", "main", "-g", "main.cpp").directory(wd).start();
+ assertEquals(0, compile.waitFor());
+ LineCookie lc = DataObject.find(source).getLookup().lookup(LineCookie.class);
+ assertNotNull(lc);
+ DebuggerManager.getDebuggerManager().addBreakpoint(new CPPLiteBreakpoint(lc.getLineSet().getCurrent(4)));
+ CPPLiteDebugger d = CPPLiteDebugger.startDebugging(new CPPLiteDebuggerConfig(Arrays.asList(new File(wd, "main").getAbsolutePath()))).first();
+ int[] suspendCount = new int[1];
+ int[] resumeCount = new int[1];
+ d.addStateListener(new CPPLiteDebugger.StateListener() {
+ @Override
+ public void suspended(boolean suspended) {
+ int[] count;
+ if (suspended) {
+ count = suspendCount;
+ } else {
+ count = resumeCount;
+ }
+ synchronized (count) {
+ count[0]++;
+ count.notifyAll();
+ }
+ }
+
+ @Override
+ public void finished() {
+ }
+ });
+
+ synchronized (suspendCount) {
+ while (suspendCount[0] < 1) {
+ suspendCount.wait();
+ }
+ }
+
+ //on line 4, there is a breakpoint and the PC
+ assertEquals(2, lc.getLineSet().getCurrent(4).getAnnotationCount());
+
+ d.doAction(ActionsManager.ACTION_STEP_OVER);
+
+ synchronized (resumeCount) {
+ while (resumeCount[0] < 1) {
+ resumeCount.wait();
+ }
+ }
+
+ synchronized (suspendCount) {
+ while (suspendCount[0] < 2) {
+ suspendCount.wait();
+ }
+ }
+
+ //on line 4, there is a breakpoint
+ assertEquals(1, lc.getLineSet().getCurrent(4).getAnnotationCount());
+ //PC:
+ assertEquals(1, lc.getLineSet().getCurrent(5).getAnnotationCount());
+ }
+
+ public static Test suite() {
+ return NbModuleSuite.emptyConfiguration()
+ .addTest(StepTest.class)
+ .enableModules(".*", ".*")
+ .gui(false)
+ .suite();
+ }
+}
diff --git a/cpplite/cpplite.editor/build.xml b/cpplite/cpplite.editor/build.xml
new file mode 100644
index 0000000..39d93bf
--- /dev/null
+++ b/cpplite/cpplite.editor/build.xml
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+
+-->
+<!-- You may freely edit this file. See harness/README in the NetBeans platform -->
+<!-- for some information on what you could do (e.g. targets to override). -->
+<!-- If you delete this file and reopen the project it will be recreated. -->
+<project name="cpplite/cpplite.editor" default="netbeans" basedir=".">
+ <description>Builds, tests, and runs the project org.netbeans.modules.cpplite.editor.</description>
+ <import file="../../nbbuild/templates/projectized.xml"/>
+</project>
diff --git a/cpplite/cpplite.editor/licenseinfo.xml b/cpplite/cpplite.editor/licenseinfo.xml
new file mode 100644
index 0000000..bcf2b8a
--- /dev/null
+++ b/cpplite/cpplite.editor/licenseinfo.xml
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+
+-->
+
+<licenseinfo>
+ <fileset>
+ <file>src/org/netbeans/modules/cpplite/editor/file/resources/c.tmLanguage.json</file>
+ <file>src/org/netbeans/modules/cpplite/editor/file/resources/cpp.tmLanguage.json</file>
+ <license ref="MIT-cpp-textmate-grammars" />
+ <comment type="COMMENT_UNSUPPORTED">Source: https://github.com/jeff-hykin/cpp-textmate-grammar</comment>
+ </fileset>
+ <fileset>
+ <file>src/org/netbeans/modules/cpplite/editor/file/resources/CCSrcIcon.gif</file>
+ <file>src/org/netbeans/modules/cpplite/editor/file/resources/HDataIcon.gif</file>
+ <file>src/org/netbeans/modules/cpplite/editor/file/resources/CSrcIcon.gif</file>
+ <file>src/org/netbeans/modules/cpplite/editor/lsp/options/cnd_32.png</file>
+ <license ref="CDDL-1.0" />
+ <comment type="COMMENT_UNSUPPORTED">Original NetBeans icons, not gone through IP Clearance yet.</comment>
+ </fileset>
+</licenseinfo>
diff --git a/cpplite/cpplite.editor/manifest.mf b/cpplite/cpplite.editor/manifest.mf
new file mode 100644
index 0000000..72da959
--- /dev/null
+++ b/cpplite/cpplite.editor/manifest.mf
@@ -0,0 +1,7 @@
+Manifest-Version: 1.0
+AutoUpdate-Show-In-Client: false
+OpenIDE-Module: org.netbeans.modules.cpplite.editor
+OpenIDE-Module-Layer: org/netbeans/modules/cpplite/editor/layer.xml
+OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/cpplite/editor/Bundle.properties
+OpenIDE-Module-Specification-Version: 1.0
+
diff --git a/nb/ide.launcher/netbeans.clusters b/cpplite/cpplite.editor/nbproject/project.properties
similarity index 73%
copy from nb/ide.launcher/netbeans.clusters
copy to cpplite/cpplite.editor/nbproject/project.properties
index 2ea6c1c..5137752 100644
--- a/nb/ide.launcher/netbeans.clusters
+++ b/cpplite/cpplite.editor/nbproject/project.properties
@@ -15,30 +15,5 @@
# specific language governing permissions and limitations
# under the License.
-# platform cluster first
-platform
-# application cluster second
-nb
-# ergonomics cluster if present
-ergonomics
-# and now the rest
-ide
-extide
-java
-apisupport
-webcommon
-websvccommon
-enterprise
-mobility
-profiler
-python
-php
-identity
-harness
-cnd
-cndext
-dlight
-groovy
-extra
-javacard
-javafx
+javac.source=1.8
+javac.compilerargs=-Xlint -Xlint:-serial
diff --git a/cpplite/cpplite.editor/nbproject/project.xml b/cpplite/cpplite.editor/nbproject/project.xml
new file mode 100644
index 0000000..db43b93
--- /dev/null
+++ b/cpplite/cpplite.editor/nbproject/project.xml
@@ -0,0 +1,203 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+
+-->
+<project xmlns="http://www.netbeans.org/ns/project/1">
+ <type>org.netbeans.modules.apisupport.project</type>
+ <configuration>
+ <data xmlns="http://www.netbeans.org/ns/nb-module-project/3">
+ <code-name-base>org.netbeans.modules.cpplite.editor</code-name-base>
+ <module-dependencies>
+ <dependency>
+ <code-name-base>org.netbeans.api.templates</code-name-base>
+ <build-prerequisite/>
+ <compile-dependency/>
+ <run-dependency>
+ <specification-version>1.15</specification-version>
+ </run-dependency>
+ </dependency>
+ <dependency>
+ <code-name-base>org.netbeans.modules.editor</code-name-base>
+ <build-prerequisite/>
+ <compile-dependency/>
+ <run-dependency>
+ <release-version>3</release-version>
+ <specification-version>1.95.0.6.3.23.55</specification-version>
+ </run-dependency>
+ </dependency>
+ <dependency>
+ <code-name-base>org.netbeans.modules.editor.lib2</code-name-base>
+ <build-prerequisite/>
+ <compile-dependency/>
+ <run-dependency>
+ <release-version>1</release-version>
+ <specification-version>2.28.0.55.3</specification-version>
+ </run-dependency>
+ </dependency>
+ <dependency>
+ <code-name-base>org.netbeans.modules.editor.mimelookup</code-name-base>
+ <build-prerequisite/>
+ <compile-dependency/>
+ <run-dependency>
+ <release-version>1</release-version>
+ <specification-version>1.47</specification-version>
+ </run-dependency>
+ </dependency>
+ <dependency>
+ <code-name-base>org.netbeans.modules.lsp.client</code-name-base>
+ <build-prerequisite/>
+ <compile-dependency/>
+ <run-dependency>
+ <release-version>0</release-version>
+ <!--<implementation-version/>-->
+ </run-dependency>
+ </dependency>
+ <dependency>
+ <code-name-base>org.netbeans.modules.options.api</code-name-base>
+ <build-prerequisite/>
+ <compile-dependency/>
+ <run-dependency>
+ <release-version>1</release-version>
+ <specification-version>1.52</specification-version>
+ </run-dependency>
+ </dependency>
+ <dependency>
+ <code-name-base>org.netbeans.modules.projectapi</code-name-base>
+ <build-prerequisite/>
+ <compile-dependency/>
+ <run-dependency>
+ <release-version>1</release-version>
+ <specification-version>1.74</specification-version>
+ </run-dependency>
+ </dependency>
+ <dependency>
+ <code-name-base>org.netbeans.modules.textmate.lexer</code-name-base>
+ <build-prerequisite/>
+ <compile-dependency/>
+ <run-dependency>
+ <release-version>0</release-version>
+ <specification-version>1.5.1</specification-version>
+ </run-dependency>
+ </dependency>
+ <dependency>
+ <code-name-base>org.netbeans.spi.editor.hints</code-name-base>
+ <build-prerequisite/>
+ <compile-dependency/>
+ <run-dependency>
+ <release-version>0</release-version>
+ <specification-version>1.50.0.7.55</specification-version>
+ </run-dependency>
+ </dependency>
+ <dependency>
+ <code-name-base>org.openide.awt</code-name-base>
+ <build-prerequisite/>
+ <compile-dependency/>
+ <run-dependency>
+ <specification-version>7.75</specification-version>
+ </run-dependency>
+ </dependency>
+ <dependency>
+ <code-name-base>org.openide.dialogs</code-name-base>
+ <build-prerequisite/>
+ <compile-dependency/>
+ <run-dependency>
+ <specification-version>7.49</specification-version>
+ </run-dependency>
+ </dependency>
+ <dependency>
+ <code-name-base>org.openide.filesystems</code-name-base>
+ <build-prerequisite/>
+ <compile-dependency/>
+ <run-dependency>
+ <specification-version>9.17</specification-version>
+ </run-dependency>
+ </dependency>
+ <dependency>
+ <code-name-base>org.openide.loaders</code-name-base>
+ <build-prerequisite/>
+ <compile-dependency/>
+ <run-dependency>
+ <specification-version>7.74</specification-version>
+ </run-dependency>
+ </dependency>
+ <dependency>
+ <code-name-base>org.openide.modules</code-name-base>
+ <build-prerequisite/>
+ <compile-dependency/>
+ <run-dependency>
+ <specification-version>7.56</specification-version>
+ </run-dependency>
+ </dependency>
+ <dependency>
+ <code-name-base>org.openide.nodes</code-name-base>
+ <build-prerequisite/>
+ <compile-dependency/>
+ <run-dependency>
+ <specification-version>7.52</specification-version>
+ </run-dependency>
+ </dependency>
+ <dependency>
+ <code-name-base>org.openide.text</code-name-base>
+ <build-prerequisite/>
+ <compile-dependency/>
+ <run-dependency>
+ <specification-version>6.74</specification-version>
+ </run-dependency>
+ </dependency>
+ <dependency>
+ <code-name-base>org.openide.util</code-name-base>
+ <build-prerequisite/>
+ <compile-dependency/>
+ <run-dependency>
+ <specification-version>9.14</specification-version>
+ </run-dependency>
+ </dependency>
+ <dependency>
+ <code-name-base>org.openide.util.lookup</code-name-base>
+ <build-prerequisite/>
+ <compile-dependency/>
+ <run-dependency>
+ <specification-version>8.40</specification-version>
+ </run-dependency>
+ </dependency>
+ <dependency>
+ <code-name-base>org.openide.util.ui</code-name-base>
+ <build-prerequisite/>
+ <compile-dependency/>
+ <run-dependency>
+ <specification-version>9.15</specification-version>
+ </run-dependency>
+ </dependency>
+ <dependency>
+ <code-name-base>org.openide.windows</code-name-base>
+ <build-prerequisite/>
+ <compile-dependency/>
+ <run-dependency>
+ <specification-version>6.84</specification-version>
+ </run-dependency>
+ </dependency>
+ </module-dependencies>
+ <friend-packages>
+ <friend>org.netbeans.modules.cpplite.project</friend>
+ <package>org.netbeans.modules.cpplite.editor.spi</package>
+ </friend-packages>
+ </data>
+ </configuration>
+</project>
diff --git a/nb/ide.launcher/netbeans.clusters b/cpplite/cpplite.editor/src/org/netbeans/modules/cpplite/editor/Bundle.properties
similarity index 73%
copy from nb/ide.launcher/netbeans.clusters
copy to cpplite/cpplite.editor/src/org/netbeans/modules/cpplite/editor/Bundle.properties
index 2ea6c1c..178fe66 100644
--- a/nb/ide.launcher/netbeans.clusters
+++ b/cpplite/cpplite.editor/src/org/netbeans/modules/cpplite/editor/Bundle.properties
@@ -15,30 +15,6 @@
# specific language governing permissions and limitations
# under the License.
-# platform cluster first
-platform
-# application cluster second
-nb
-# ergonomics cluster if present
-ergonomics
-# and now the rest
-ide
-extide
-java
-apisupport
-webcommon
-websvccommon
-enterprise
-mobility
-profiler
-python
-php
-identity
-harness
-cnd
-cndext
-dlight
-groovy
-extra
-javacard
-javafx
+OpenIDE-Module-Display-Category=C/C++
+OpenIDE-Module-Name=CPPLite Editor
+Templates_cpplite=C/C++ Files
diff --git a/cpplite/cpplite.editor/src/org/netbeans/modules/cpplite/editor/UnconfiguredHint.java b/cpplite/cpplite.editor/src/org/netbeans/modules/cpplite/editor/UnconfiguredHint.java
new file mode 100644
index 0000000..76b1911
--- /dev/null
+++ b/cpplite/cpplite.editor/src/org/netbeans/modules/cpplite/editor/UnconfiguredHint.java
@@ -0,0 +1,117 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.cpplite.editor;
+
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+import java.io.File;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+import java.util.prefs.PreferenceChangeEvent;
+import java.util.prefs.PreferenceChangeListener;
+import javax.swing.text.Document;
+import javax.swing.text.JTextComponent;
+import org.netbeans.api.editor.EditorRegistry;
+import org.netbeans.api.options.OptionsDisplayer;
+import org.netbeans.api.project.FileOwnerQuery;
+import org.netbeans.api.project.Project;
+import org.netbeans.modules.cpplite.editor.file.MIMETypes;
+import org.netbeans.modules.cpplite.editor.lsp.LanguageServerImpl;
+import org.netbeans.modules.editor.NbEditorUtilities;
+import org.netbeans.spi.editor.hints.ChangeInfo;
+import org.netbeans.spi.editor.hints.ErrorDescription;
+import org.netbeans.spi.editor.hints.ErrorDescriptionFactory;
+import org.netbeans.spi.editor.hints.Fix;
+import org.netbeans.spi.editor.hints.HintsController;
+import org.netbeans.spi.editor.hints.Severity;
+import org.openide.filesystems.FileObject;
+import org.openide.filesystems.FileUtil;
+import org.openide.modules.OnStart;
+
+/**
+ *
+ * @author lahvac
+ */
+@OnStart
+public class UnconfiguredHint implements Runnable {
+
+ private static final Set<String> C_MIME_TYPES = new HashSet<>(Arrays.asList(MIMETypes.C, MIMETypes.CPP, MIMETypes.H, MIMETypes.HPP));
+
+ private JTextComponent selectedComponent;
+
+ @Override
+ public void run() {
+ EditorRegistry.addPropertyChangeListener(new PropertyChangeListener() {
+ @Override
+ public void propertyChange(PropertyChangeEvent evt) {
+ updateFocused();
+ }
+ });
+ Utils.settings().addPreferenceChangeListener(new PreferenceChangeListener() {
+ @Override
+ public void preferenceChange(PreferenceChangeEvent evt) {
+ updateFocused();
+ }
+ });
+ updateFocused();
+ }
+
+ private synchronized void updateFocused() {
+ selectedComponent = EditorRegistry.focusedComponent();
+ if (selectedComponent == null) {
+ return ;
+ }
+ Document doc = selectedComponent.getDocument();
+ FileObject file = NbEditorUtilities.getFileObject(doc);
+ if (file == null || !C_MIME_TYPES.contains(FileUtil.getMIMEType(file))) {
+ return ;
+ }
+ List<ErrorDescription> errors = new ArrayList<>();
+ String ccls = Utils.settings().get(Utils.KEY_CCLS_PATH, null);
+ if (ccls == null || !new File(ccls).canExecute() || !new File(ccls).isFile()) {
+ errors.add(ErrorDescriptionFactory.createErrorDescription(Severity.WARNING, "ccls not configured!", Collections.singletonList(new ConfigureCCLS()), doc, 0));
+ } else {
+ Project prj = FileOwnerQuery.getOwner(file);
+ if (LanguageServerImpl.getProjectSettings(prj) == null) {
+ errors.add(ErrorDescriptionFactory.createErrorDescription(Severity.WARNING, "compile commands not configured", doc, 0));
+ }
+ }
+ HintsController.setErrors(doc, UnconfiguredHint.class.getName(), errors);
+ }
+
+ private static final class ConfigureCCLS implements Fix {
+
+ @Override
+ public String getText() {
+ return "Configure ccls";
+ }
+
+ @Override
+ public ChangeInfo implement() throws Exception {
+ OptionsDisplayer.getDefault().open("CPlusPlus/cpplite");
+ return null;
+ }
+
+ }
+
+}
diff --git a/ide/lsp.client/src/org/netbeans/modules/lsp/client/options/ServerRestarter.java b/cpplite/cpplite.editor/src/org/netbeans/modules/cpplite/editor/Utils.java
similarity index 71%
copy from ide/lsp.client/src/org/netbeans/modules/lsp/client/options/ServerRestarter.java
copy to cpplite/cpplite.editor/src/org/netbeans/modules/cpplite/editor/Utils.java
index feacb87..0b3199d 100644
--- a/ide/lsp.client/src/org/netbeans/modules/lsp/client/options/ServerRestarter.java
+++ b/cpplite/cpplite.editor/src/org/netbeans/modules/cpplite/editor/Utils.java
@@ -16,10 +16,19 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.netbeans.modules.lsp.client.options;
+package org.netbeans.modules.cpplite.editor;
-public interface ServerRestarter {
+import java.util.prefs.Preferences;
+import org.openide.util.NbPreferences;
- public void restart();
+/**
+ *
+ * @author lahvac
+ */
+public class Utils {
+ public static final String KEY_CCLS_PATH = "ccls";
+ public static Preferences settings() {
+ return NbPreferences.forModule(Utils.class);
+ }
}
diff --git a/cpplite/cpplite.editor/src/org/netbeans/modules/cpplite/editor/file/CDataObject.java b/cpplite/cpplite.editor/src/org/netbeans/modules/cpplite/editor/file/CDataObject.java
new file mode 100644
index 0000000..6faf771
--- /dev/null
+++ b/cpplite/cpplite.editor/src/org/netbeans/modules/cpplite/editor/file/CDataObject.java
@@ -0,0 +1,114 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.cpplite.editor.file;
+
+import java.io.IOException;
+import org.netbeans.modules.textmate.lexer.api.GrammarRegistration;
+import org.openide.awt.ActionID;
+import org.openide.awt.ActionReference;
+import org.openide.awt.ActionReferences;
+import org.openide.filesystems.FileObject;
+import org.openide.filesystems.MIMEResolver;
+import org.openide.loaders.DataObject;
+import org.openide.loaders.DataObjectExistsException;
+import org.openide.loaders.MultiDataObject;
+import org.openide.loaders.MultiFileLoader;
+import org.openide.util.NbBundle.Messages;
+
+@Messages({
+ "LBL_C_LOADER=Files of C"
+})
+@MIMEResolver.ExtensionRegistration(
+ displayName = "#LBL_C_LOADER",
+ mimeType = MIMETypes.C,
+ extension = {"c"},
+ position = 1000000
+)
+@DataObject.Registration(
+ mimeType = MIMETypes.C,
+ iconBase = "org/netbeans/modules/cpplite/editor/file/resources/CSrcIcon.gif",
+ displayName = "#LBL_C_LOADER",
+ position = 300
+)
+@ActionReferences({
+ @ActionReference(
+ path = "Loaders/" + MIMETypes.C + "/Actions",
+ id = @ActionID(category = "System", id = "org.openide.actions.OpenAction"),
+ position = 100,
+ separatorAfter = 200
+ ),
+ @ActionReference(
+ path = "Loaders/" + MIMETypes.C + "/Actions",
+ id = @ActionID(category = "Edit", id = "org.openide.actions.CutAction"),
+ position = 300
+ ),
+ @ActionReference(
+ path = "Loaders/" + MIMETypes.C + "/Actions",
+ id = @ActionID(category = "Edit", id = "org.openide.actions.CopyAction"),
+ position = 400,
+ separatorAfter = 500
+ ),
+ @ActionReference(
+ path = "Loaders/" + MIMETypes.C + "/Actions",
+ id = @ActionID(category = "Edit", id = "org.openide.actions.DeleteAction"),
+ position = 600
+ ),
+ @ActionReference(
+ path = "Loaders/" + MIMETypes.C + "/Actions",
+ id = @ActionID(category = "System", id = "org.openide.actions.RenameAction"),
+ position = 700,
+ separatorAfter = 800
+ ),
+ @ActionReference(
+ path = "Loaders/" + MIMETypes.C + "/Actions",
+ id = @ActionID(category = "System", id = "org.openide.actions.SaveAsTemplateAction"),
+ position = 900,
+ separatorAfter = 1000
+ ),
+ @ActionReference(
+ path = "Loaders/" + MIMETypes.C + "/Actions",
+ id = @ActionID(category = "System", id = "org.openide.actions.FileSystemAction"),
+ position = 1100,
+ separatorAfter = 1200
+ ),
+ @ActionReference(
+ path = "Loaders/" + MIMETypes.C + "/Actions",
+ id = @ActionID(category = "System", id = "org.openide.actions.ToolsAction"),
+ position = 1300
+ ),
+ @ActionReference(
+ path = "Loaders/" + MIMETypes.C + "/Actions",
+ id = @ActionID(category = "System", id = "org.openide.actions.PropertiesAction"),
+ position = 1400
+ )
+})
+@GrammarRegistration(grammar="resources/c.tmLanguage.json", mimeType=MIMETypes.C)
+public class CDataObject extends MultiDataObject {
+
+ public CDataObject(FileObject pf, MultiFileLoader loader) throws DataObjectExistsException, IOException {
+ super(pf, loader);
+ registerEditor(MIMETypes.C, false);
+ }
+
+ @Override
+ protected int associateLookup() {
+ return 1;
+ }
+
+}
diff --git a/cpplite/cpplite.editor/src/org/netbeans/modules/cpplite/editor/file/CPPDataObject.java b/cpplite/cpplite.editor/src/org/netbeans/modules/cpplite/editor/file/CPPDataObject.java
new file mode 100644
index 0000000..a8aa828
--- /dev/null
+++ b/cpplite/cpplite.editor/src/org/netbeans/modules/cpplite/editor/file/CPPDataObject.java
@@ -0,0 +1,114 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.cpplite.editor.file;
+
+import java.io.IOException;
+import org.netbeans.modules.textmate.lexer.api.GrammarRegistration;
+import org.openide.awt.ActionID;
+import org.openide.awt.ActionReference;
+import org.openide.awt.ActionReferences;
+import org.openide.filesystems.FileObject;
+import org.openide.filesystems.MIMEResolver;
+import org.openide.loaders.DataObject;
+import org.openide.loaders.DataObjectExistsException;
+import org.openide.loaders.MultiDataObject;
+import org.openide.loaders.MultiFileLoader;
+import org.openide.util.NbBundle.Messages;
+
+@Messages({
+ "LBL_CPP_LOADER=Files of CPP"
+})
+@MIMEResolver.ExtensionRegistration(
+ displayName = "#LBL_CPP_LOADER",
+ mimeType = MIMETypes.CPP,
+ extension = {"cpp", "cc", "c++", "cxx"},
+ position = 1000000
+)
+@DataObject.Registration(
+ mimeType = MIMETypes.CPP,
+ iconBase = "org/netbeans/modules/cpplite/editor/file/resources/CCSrcIcon.gif",
+ displayName = "#LBL_CPP_LOADER",
+ position = 300
+)
+@ActionReferences({
+ @ActionReference(
+ path = "Loaders/" + MIMETypes.CPP + "/Actions",
+ id = @ActionID(category = "System", id = "org.openide.actions.OpenAction"),
+ position = 100,
+ separatorAfter = 200
+ ),
+ @ActionReference(
+ path = "Loaders/" + MIMETypes.CPP + "/Actions",
+ id = @ActionID(category = "Edit", id = "org.openide.actions.CutAction"),
+ position = 300
+ ),
+ @ActionReference(
+ path = "Loaders/" + MIMETypes.CPP + "/Actions",
+ id = @ActionID(category = "Edit", id = "org.openide.actions.CopyAction"),
+ position = 400,
+ separatorAfter = 500
+ ),
+ @ActionReference(
+ path = "Loaders/" + MIMETypes.CPP + "/Actions",
+ id = @ActionID(category = "Edit", id = "org.openide.actions.DeleteAction"),
+ position = 600
+ ),
+ @ActionReference(
+ path = "Loaders/" + MIMETypes.CPP + "/Actions",
+ id = @ActionID(category = "System", id = "org.openide.actions.RenameAction"),
+ position = 700,
+ separatorAfter = 800
+ ),
+ @ActionReference(
+ path = "Loaders/" + MIMETypes.CPP + "/Actions",
+ id = @ActionID(category = "System", id = "org.openide.actions.SaveAsTemplateAction"),
+ position = 900,
+ separatorAfter = 1000
+ ),
+ @ActionReference(
+ path = "Loaders/" + MIMETypes.CPP + "/Actions",
+ id = @ActionID(category = "System", id = "org.openide.actions.FileSystemAction"),
+ position = 1100,
+ separatorAfter = 1200
+ ),
+ @ActionReference(
+ path = "Loaders/" + MIMETypes.CPP + "/Actions",
+ id = @ActionID(category = "System", id = "org.openide.actions.ToolsAction"),
+ position = 1300
+ ),
+ @ActionReference(
+ path = "Loaders/" + MIMETypes.CPP + "/Actions",
+ id = @ActionID(category = "System", id = "org.openide.actions.PropertiesAction"),
+ position = 1400
+ )
+})
+@GrammarRegistration(grammar="resources/cpp.tmLanguage.json", mimeType=MIMETypes.CPP)
+public class CPPDataObject extends MultiDataObject {
+
+ public CPPDataObject(FileObject pf, MultiFileLoader loader) throws DataObjectExistsException, IOException {
+ super(pf, loader);
+ registerEditor(MIMETypes.CPP, false);
+ }
+
+ @Override
+ protected int associateLookup() {
+ return 1;
+ }
+
+}
diff --git a/cpplite/cpplite.editor/src/org/netbeans/modules/cpplite/editor/file/CPPTemplate.cpp b/cpplite/cpplite.editor/src/org/netbeans/modules/cpplite/editor/file/CPPTemplate.cpp
new file mode 100644
index 0000000..c7005cf
--- /dev/null
+++ b/cpplite/cpplite.editor/src/org/netbeans/modules/cpplite/editor/file/CPPTemplate.cpp
@@ -0,0 +1,24 @@
+<#--
+
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+
+-->
+<#assign licenseFirst = "/*">
+<#assign licensePrefix = " * ">
+<#assign licenseLast = " */">
+<#include "${project.licensePath}">
diff --git a/cpplite/cpplite.editor/src/org/netbeans/modules/cpplite/editor/file/CTemplate.c b/cpplite/cpplite.editor/src/org/netbeans/modules/cpplite/editor/file/CTemplate.c
new file mode 100644
index 0000000..c7005cf
--- /dev/null
+++ b/cpplite/cpplite.editor/src/org/netbeans/modules/cpplite/editor/file/CTemplate.c
@@ -0,0 +1,24 @@
+<#--
+
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+
+-->
+<#assign licenseFirst = "/*">
+<#assign licensePrefix = " * ">
+<#assign licenseLast = " */">
+<#include "${project.licensePath}">
diff --git a/cpplite/cpplite.editor/src/org/netbeans/modules/cpplite/editor/file/HDataObject.java b/cpplite/cpplite.editor/src/org/netbeans/modules/cpplite/editor/file/HDataObject.java
new file mode 100644
index 0000000..61c850c
--- /dev/null
+++ b/cpplite/cpplite.editor/src/org/netbeans/modules/cpplite/editor/file/HDataObject.java
@@ -0,0 +1,113 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.cpplite.editor.file;
+
+import java.io.IOException;
+import org.netbeans.modules.textmate.lexer.api.GrammarRegistration;
+import org.openide.awt.ActionID;
+import org.openide.awt.ActionReference;
+import org.openide.awt.ActionReferences;
+import org.openide.filesystems.FileObject;
+import org.openide.filesystems.MIMEResolver;
+import org.openide.loaders.DataObject;
+import org.openide.loaders.DataObjectExistsException;
+import org.openide.loaders.MultiDataObject;
+import org.openide.loaders.MultiFileLoader;
+import org.openide.util.NbBundle.Messages;
+
+@Messages({
+ "LBL_H_LOADER=Files of H"
+})
+@MIMEResolver.ExtensionRegistration(
+ displayName = "#LBL_H_LOADER",
+ mimeType = MIMETypes.H,
+ extension = {"h"}
+)
+@DataObject.Registration(
+ mimeType = MIMETypes.H,
+ iconBase = "org/netbeans/modules/cpplite/editor/file/resources/HDataIcon.gif",
+ displayName = "#LBL_H_LOADER",
+ position = 300
+)
+@ActionReferences({
+ @ActionReference(
+ path = "Loaders/" + MIMETypes.H + "/Actions",
+ id = @ActionID(category = "System", id = "org.openide.actions.OpenAction"),
+ position = 100,
+ separatorAfter = 200
+ ),
+ @ActionReference(
+ path = "Loaders/" + MIMETypes.H + "/Actions",
+ id = @ActionID(category = "Edit", id = "org.openide.actions.CutAction"),
+ position = 300
+ ),
+ @ActionReference(
+ path = "Loaders/" + MIMETypes.H + "/Actions",
+ id = @ActionID(category = "Edit", id = "org.openide.actions.CopyAction"),
+ position = 400,
+ separatorAfter = 500
+ ),
+ @ActionReference(
+ path = "Loaders/" + MIMETypes.H + "/Actions",
+ id = @ActionID(category = "Edit", id = "org.openide.actions.DeleteAction"),
+ position = 600
+ ),
+ @ActionReference(
+ path = "Loaders/" + MIMETypes.H + "/Actions",
+ id = @ActionID(category = "System", id = "org.openide.actions.RenameAction"),
+ position = 700,
+ separatorAfter = 800
+ ),
+ @ActionReference(
+ path = "Loaders/" + MIMETypes.H + "/Actions",
+ id = @ActionID(category = "System", id = "org.openide.actions.SaveAsTemplateAction"),
+ position = 900,
+ separatorAfter = 1000
+ ),
+ @ActionReference(
+ path = "Loaders/" + MIMETypes.H + "/Actions",
+ id = @ActionID(category = "System", id = "org.openide.actions.FileSystemAction"),
+ position = 1100,
+ separatorAfter = 1200
+ ),
+ @ActionReference(
+ path = "Loaders/" + MIMETypes.H + "/Actions",
+ id = @ActionID(category = "System", id = "org.openide.actions.ToolsAction"),
+ position = 1300
+ ),
+ @ActionReference(
+ path = "Loaders/" + MIMETypes.H + "/Actions",
+ id = @ActionID(category = "System", id = "org.openide.actions.PropertiesAction"),
+ position = 1400
+ )
+})
+@GrammarRegistration(grammar="resources/c.tmLanguage.json", mimeType=MIMETypes.H)
+public class HDataObject extends MultiDataObject {
+
+ public HDataObject(FileObject pf, MultiFileLoader loader) throws DataObjectExistsException, IOException {
+ super(pf, loader);
+ registerEditor(MIMETypes.H, false);
+ }
+
+ @Override
+ protected int associateLookup() {
+ return 1;
+ }
+
+}
diff --git a/cpplite/cpplite.editor/src/org/netbeans/modules/cpplite/editor/file/HPPDataObject.java b/cpplite/cpplite.editor/src/org/netbeans/modules/cpplite/editor/file/HPPDataObject.java
new file mode 100644
index 0000000..7ab6284
--- /dev/null
+++ b/cpplite/cpplite.editor/src/org/netbeans/modules/cpplite/editor/file/HPPDataObject.java
@@ -0,0 +1,113 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.cpplite.editor.file;
+
+import java.io.IOException;
+import org.netbeans.modules.textmate.lexer.api.GrammarRegistration;
+import org.openide.awt.ActionID;
+import org.openide.awt.ActionReference;
+import org.openide.awt.ActionReferences;
+import org.openide.filesystems.FileObject;
+import org.openide.filesystems.MIMEResolver;
+import org.openide.loaders.DataObject;
+import org.openide.loaders.DataObjectExistsException;
+import org.openide.loaders.MultiDataObject;
+import org.openide.loaders.MultiFileLoader;
+import org.openide.util.NbBundle.Messages;
+
+@Messages({
+ "LBL_HPP_LOADER=Files of HPP"
+})
+@MIMEResolver.ExtensionRegistration(
+ displayName = "#LBL_HPP_LOADER",
+ mimeType = MIMETypes.HPP,
+ extension = {"hpp", "hxx", "hh", "h++"}
+)
+@DataObject.Registration(
+ mimeType = MIMETypes.HPP,
+ iconBase = "org/netbeans/modules/cpplite/editor/file/resources/HDataIcon.gif",
+ displayName = "#LBL_HPP_LOADER",
+ position = 300
+)
+@ActionReferences({
+ @ActionReference(
+ path = "Loaders/" + MIMETypes.HPP + "/Actions",
+ id = @ActionID(category = "System", id = "org.openide.actions.OpenAction"),
+ position = 100,
+ separatorAfter = 200
+ ),
+ @ActionReference(
+ path = "Loaders/" + MIMETypes.HPP + "/Actions",
+ id = @ActionID(category = "Edit", id = "org.openide.actions.CutAction"),
+ position = 300
+ ),
+ @ActionReference(
+ path = "Loaders/" + MIMETypes.HPP + "/Actions",
+ id = @ActionID(category = "Edit", id = "org.openide.actions.CopyAction"),
+ position = 400,
+ separatorAfter = 500
+ ),
+ @ActionReference(
+ path = "Loaders/" + MIMETypes.HPP + "/Actions",
+ id = @ActionID(category = "Edit", id = "org.openide.actions.DeleteAction"),
+ position = 600
+ ),
+ @ActionReference(
+ path = "Loaders/" + MIMETypes.HPP + "/Actions",
+ id = @ActionID(category = "System", id = "org.openide.actions.RenameAction"),
+ position = 700,
+ separatorAfter = 800
+ ),
+ @ActionReference(
+ path = "Loaders/" + MIMETypes.HPP + "/Actions",
+ id = @ActionID(category = "System", id = "org.openide.actions.SaveAsTemplateAction"),
+ position = 900,
+ separatorAfter = 1000
+ ),
+ @ActionReference(
+ path = "Loaders/" + MIMETypes.HPP + "/Actions",
+ id = @ActionID(category = "System", id = "org.openide.actions.FileSystemAction"),
+ position = 1100,
+ separatorAfter = 1200
+ ),
+ @ActionReference(
+ path = "Loaders/" + MIMETypes.HPP + "/Actions",
+ id = @ActionID(category = "System", id = "org.openide.actions.ToolsAction"),
+ position = 1300
+ ),
+ @ActionReference(
+ path = "Loaders/" + MIMETypes.HPP + "/Actions",
+ id = @ActionID(category = "System", id = "org.openide.actions.PropertiesAction"),
+ position = 1400
+ )
+})
+@GrammarRegistration(grammar="resources/cpp.tmLanguage.json", mimeType=MIMETypes.HPP)
+public class HPPDataObject extends MultiDataObject {
+
+ public HPPDataObject(FileObject pf, MultiFileLoader loader) throws DataObjectExistsException, IOException {
+ super(pf, loader);
+ registerEditor(MIMETypes.HPP, false);
+ }
+
+ @Override
+ protected int associateLookup() {
+ return 1;
+ }
+
+}
diff --git a/cpplite/cpplite.editor/src/org/netbeans/modules/cpplite/editor/file/HPPTemplate.hpp b/cpplite/cpplite.editor/src/org/netbeans/modules/cpplite/editor/file/HPPTemplate.hpp
new file mode 100644
index 0000000..c7005cf
--- /dev/null
+++ b/cpplite/cpplite.editor/src/org/netbeans/modules/cpplite/editor/file/HPPTemplate.hpp
@@ -0,0 +1,24 @@
+<#--
+
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+
+-->
+<#assign licenseFirst = "/*">
+<#assign licensePrefix = " * ">
+<#assign licenseLast = " */">
+<#include "${project.licensePath}">
diff --git a/cpplite/cpplite.editor/src/org/netbeans/modules/cpplite/editor/file/HTemplate.h b/cpplite/cpplite.editor/src/org/netbeans/modules/cpplite/editor/file/HTemplate.h
new file mode 100644
index 0000000..c7005cf
--- /dev/null
+++ b/cpplite/cpplite.editor/src/org/netbeans/modules/cpplite/editor/file/HTemplate.h
@@ -0,0 +1,24 @@
+<#--
+
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+
+-->
+<#assign licenseFirst = "/*">
+<#assign licensePrefix = " * ">
+<#assign licenseLast = " */">
+<#include "${project.licensePath}">
diff --git a/ide/lsp.client/src/org/netbeans/modules/lsp/client/options/ServerRestarter.java b/cpplite/cpplite.editor/src/org/netbeans/modules/cpplite/editor/file/MIMETypes.java
similarity index 73%
copy from ide/lsp.client/src/org/netbeans/modules/lsp/client/options/ServerRestarter.java
copy to cpplite/cpplite.editor/src/org/netbeans/modules/cpplite/editor/file/MIMETypes.java
index feacb87..7796888 100644
--- a/ide/lsp.client/src/org/netbeans/modules/lsp/client/options/ServerRestarter.java
+++ b/cpplite/cpplite.editor/src/org/netbeans/modules/cpplite/editor/file/MIMETypes.java
@@ -16,10 +16,17 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.netbeans.modules.lsp.client.options;
+package org.netbeans.modules.cpplite.editor.file;
-public interface ServerRestarter {
+/**
+ *
+ * @author lahvac
+ */
+public class MIMETypes {
- public void restart();
+ public static final String C = "text/X-c";
+ public static final String H = "text/X-h";
+ public static final String CPP = "text/X-c++";
+ public static final String HPP = "text/X-h++";
}
diff --git a/cpplite/cpplite.editor/src/org/netbeans/modules/cpplite/editor/file/package-info.java b/cpplite/cpplite.editor/src/org/netbeans/modules/cpplite/editor/file/package-info.java
new file mode 100644
index 0000000..3c26ac2
--- /dev/null
+++ b/cpplite/cpplite.editor/src/org/netbeans/modules/cpplite/editor/file/package-info.java
@@ -0,0 +1,55 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+@TemplateRegistrations({
+ @TemplateRegistration(folder = "cpplite",
+ content = "CTemplate.c",
+ scriptEngine = "freemarker",
+ category = "cpplite",
+ displayName = "#CTemplate",
+ iconBase = "org/netbeans/modules/cpplite/editor/file/resources/CSrcIcon.gif"),
+ @TemplateRegistration(folder = "cpplite",
+ content = "CPPTemplate.cpp",
+ scriptEngine="freemarker",
+ category = "cpplite",
+ displayName = "#CPPTemplate",
+ iconBase = "org/netbeans/modules/cpplite/editor/file/resources/CCSrcIcon.gif"),
+ @TemplateRegistration(folder = "cpplite",
+ content = "HTemplate.h",
+ scriptEngine="freemarker",
+ category = "cpplite",
+ displayName = "#HTemplate",
+ iconBase = "org/netbeans/modules/cpplite/editor/file/resources/HDataIcon.gif"),
+ @TemplateRegistration(folder = "cpplite",
+ content = "HPPTemplate.hpp",
+ scriptEngine="freemarker",
+ category = "cpplite",
+ displayName = "#HPPTemplate",
+ iconBase = "org/netbeans/modules/cpplite/editor/file/resources/HDataIcon.gif")
+})
+@Messages({
+ "CTemplate=C file",
+ "CPPTemplate=C++ file",
+ "HTemplate=Header file",
+ "HPPTemplate=Header for C++ file",
+})
+package org.netbeans.modules.cpplite.editor.file;
+
+import org.netbeans.api.templates.TemplateRegistration;
+import org.netbeans.api.templates.TemplateRegistrations;
+import org.openide.util.NbBundle.Messages;
diff --git a/cpplite/cpplite.editor/src/org/netbeans/modules/cpplite/editor/file/resources/CCSrcIcon.gif b/cpplite/cpplite.editor/src/org/netbeans/modules/cpplite/editor/file/resources/CCSrcIcon.gif
new file mode 100644
index 0000000..8c227ce
Binary files /dev/null and b/cpplite/cpplite.editor/src/org/netbeans/modules/cpplite/editor/file/resources/CCSrcIcon.gif differ
diff --git a/cpplite/cpplite.editor/src/org/netbeans/modules/cpplite/editor/file/resources/CSrcIcon.gif b/cpplite/cpplite.editor/src/org/netbeans/modules/cpplite/editor/file/resources/CSrcIcon.gif
new file mode 100644
index 0000000..f081522
Binary files /dev/null and b/cpplite/cpplite.editor/src/org/netbeans/modules/cpplite/editor/file/resources/CSrcIcon.gif differ
diff --git a/cpplite/cpplite.editor/src/org/netbeans/modules/cpplite/editor/file/resources/HDataIcon.gif b/cpplite/cpplite.editor/src/org/netbeans/modules/cpplite/editor/file/resources/HDataIcon.gif
new file mode 100644
index 0000000..c7cdc52
Binary files /dev/null and b/cpplite/cpplite.editor/src/org/netbeans/modules/cpplite/editor/file/resources/HDataIcon.gif differ
diff --git a/cpplite/cpplite.editor/src/org/netbeans/modules/cpplite/editor/file/resources/c.tmLanguage.json b/cpplite/cpplite.editor/src/org/netbeans/modules/cpplite/editor/file/resources/c.tmLanguage.json
new file mode 100644
index 0000000..c753475
--- /dev/null
+++ b/cpplite/cpplite.editor/src/org/netbeans/modules/cpplite/editor/file/resources/c.tmLanguage.json
@@ -0,0 +1,3348 @@
+{
+ "scopeName": "source.c",
+ "fileTypes": [
+ "c"
+ ],
+ "version": "",
+ "information_for_contributors": [
+ "This code was auto generated by a much-more-readble ruby file",
+ "This file essentially an updated/improved fork of the atom syntax",
+ "see https://github.com/jeff-hykin/cpp-textmate-grammar/blob/master"
+ ],
+ "patterns": [
+ {
+ "include": "#preprocessor-rule-enabled"
+ },
+ {
+ "include": "#preprocessor-rule-disabled"
+ },
+ {
+ "include": "#preprocessor-rule-conditional"
+ },
+ {
+ "include": "#predefined_macros"
+ },
+ {
+ "include": "#comments"
+ },
+ {
+ "include": "#switch_statement"
+ },
+ {
+ "match": "\\b(break|continue|do|else|for|goto|if|_Pragma|return|while)\\b",
+ "name": "keyword.control.c"
+ },
+ {
+ "include": "#storage_types"
+ },
+ {
+ "match": "typedef",
+ "name": "keyword.other.typedef.c"
+ },
+ {
+ "match": "\\b(const|extern|register|restrict|static|volatile|inline)\\b",
+ "name": "storage.modifier.c"
+ },
+ {
+ "match": "\\bk[A-Z]\\w*\\b",
+ "name": "constant.other.variable.mac-classic.c"
+ },
+ {
+ "match": "\\bg[A-Z]\\w*\\b",
+ "name": "variable.other.readwrite.global.mac-classic.c"
+ },
+ {
+ "match": "\\bs[A-Z]\\w*\\b",
+ "name": "variable.other.readwrite.static.mac-classic.c"
+ },
+ {
+ "match": "\\b(NULL|true|false|TRUE|FALSE)\\b",
+ "name": "constant.language.c"
+ },
+ {
+ "include": "#operators"
+ },
+ {
+ "include": "#numbers"
+ },
+ {
+ "include": "#strings"
+ },
+ {
+ "name": "meta.preprocessor.macro.c",
+ "begin": "((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((#)\\s*define\\b)\\s+((?<!\\w)[a-zA-Z_]\\w*(?!\\w))(?:(\\()([^()\\\\]+)(\\)))?",
+ "beginCaptures": {
+ "1": {
+ "patterns": [
+ {
+ "include": "#inline_comment"
+ }
+ ]
+ },
+ "2": {
+ "name": "comment.block.c punctuation.definition.comment.begin.c"
+ },
+ "3": {
+ "name": "comment.block.c"
+ },
+ "4": {
+ "patterns": [
+ {
+ "match": "\\*\\/",
+ "name": "comment.block.c punctuation.definition.comment.end.c"
+ },
+ {
+ "match": "\\*",
+ "name": "comment.block.c"
+ }
+ ]
+ },
+ "5": {
+ "name": "keyword.control.directive.define.c"
+ },
+ "6": {
+ "name": "punctuation.definition.directive.c"
+ },
+ "7": {
+ "name": "entity.name.function.preprocessor.c"
+ },
+ "8": {
+ "name": "punctuation.definition.parameters.begin.c"
+ },
+ "9": {
+ "patterns": [
+ {
+ "match": "(?<=[(,])\\s*((?<!\\w)[a-zA-Z_]\\w*(?!\\w))\\s*",
+ "captures": {
+ "1": {
+ "name": "variable.parameter.preprocessor.c"
+ }
+ }
+ },
+ {
+ "match": ",",
+ "name": "punctuation.separator.parameters.c"
+ },
+ {
+ "match": "\\.\\.\\.",
+ "name": "ellipses.c punctuation.vararg-ellipses.variable.parameter.preprocessor.c"
+ }
+ ]
+ },
+ "10": {
+ "name": "punctuation.definition.parameters.end.c"
+ }
+ },
+ "end": "(?<!\\\\)(?=\\n)",
+ "patterns": [
+ {
+ "include": "#preprocessor-rule-define-line-contents"
+ }
+ ]
+ },
+ {
+ "begin": "^\\s*((#)\\s*(error|warning))\\b\\s*",
+ "beginCaptures": {
+ "1": {
+ "name": "keyword.control.directive.diagnostic.$3.c"
+ },
+ "2": {
+ "name": "punctuation.definition.directive.c"
+ }
+ },
+ "end": "(?<!\\\\)(?=\\n)",
+ "name": "meta.preprocessor.diagnostic.c",
+ "patterns": [
+ {
+ "begin": "\"",
+ "beginCaptures": {
+ "0": {
+ "name": "punctuation.definition.string.begin.c"
+ }
+ },
+ "end": "\"|(?<!\\\\)(?=\\s*\\n)",
+ "endCaptures": {
+ "0": {
+ "name": "punctuation.definition.string.end.c"
+ }
+ },
+ "name": "string.quoted.double.c",
+ "patterns": [
+ {
+ "include": "#line_continuation_character"
+ }
+ ]
+ },
+ {
+ "begin": "'",
+ "beginCaptures": {
+ "0": {
+ "name": "punctuation.definition.string.begin.c"
+ }
+ },
+ "end": "'|(?<!\\\\)(?=\\s*\\n)",
+ "endCaptures": {
+ "0": {
+ "name": "punctuation.definition.string.end.c"
+ }
+ },
+ "name": "string.quoted.single.c",
+ "patterns": [
+ {
+ "include": "#line_continuation_character"
+ }
+ ]
+ },
+ {
+ "begin": "[^'\"]",
+ "end": "(?<!\\\\)(?=\\s*\\n)",
+ "name": "string.unquoted.single.c",
+ "patterns": [
+ {
+ "include": "#line_continuation_character"
+ },
+ {
+ "include": "#comments"
+ }
+ ]
+ }
+ ]
+ },
+ {
+ "begin": "^\\s*((#)\\s*(include(?:_next)?|import))\\b\\s*",
+ "beginCaptures": {
+ "1": {
+ "name": "keyword.control.directive.$3.c"
+ },
+ "2": {
+ "name": "punctuation.definition.directive.c"
+ }
+ },
+ "end": "(?=(?://|/\\*))|(?<!\\\\)(?=\\n)",
+ "name": "meta.preprocessor.include.c",
+ "patterns": [
+ {
+ "include": "#line_continuation_character"
+ },
+ {
+ "begin": "\"",
+ "beginCaptures": {
+ "0": {
+ "name": "punctuation.definition.string.begin.c"
+ }
+ },
+ "end": "\"",
+ "endCaptures": {
+ "0": {
+ "name": "punctuation.definition.string.end.c"
+ }
+ },
+ "name": "string.quoted.double.include.c"
+ },
+ {
+ "begin": "<",
+ "beginCaptures": {
+ "0": {
+ "name": "punctuation.definition.string.begin.c"
+ }
+ },
+ "end": ">",
+ "endCaptures": {
+ "0": {
+ "name": "punctuation.definition.string.end.c"
+ }
+ },
+ "name": "string.quoted.other.lt-gt.include.c"
+ }
+ ]
+ },
+ {
+ "include": "#pragma-mark"
+ },
+ {
+ "begin": "^\\s*((#)\\s*line)\\b",
+ "beginCaptures": {
+ "1": {
+ "name": "keyword.control.directive.line.c"
+ },
+ "2": {
+ "name": "punctuation.definition.directive.c"
+ }
+ },
+ "end": "(?=(?://|/\\*))|(?<!\\\\)(?=\\n)",
+ "name": "meta.preprocessor.c",
+ "patterns": [
+ {
+ "include": "#strings"
+ },
+ {
+ "include": "#numbers"
+ },
+ {
+ "include": "#line_continuation_character"
+ }
+ ]
+ },
+ {
+ "begin": "^\\s*(?:((#)\\s*undef))\\b",
+ "beginCaptures": {
+ "1": {
+ "name": "keyword.control.directive.undef.c"
+ },
+ "2": {
+ "name": "punctuation.definition.directive.c"
+ }
+ },
+ "end": "(?=(?://|/\\*))|(?<!\\\\)(?=\\n)",
+ "name": "meta.preprocessor.c",
+ "patterns": [
+ {
+ "match": "[a-zA-Z_$][\\w$]*",
+ "name": "entity.name.function.preprocessor.c"
+ },
+ {
+ "include": "#line_continuation_character"
+ }
+ ]
+ },
+ {
+ "begin": "^\\s*(?:((#)\\s*pragma))\\b",
+ "beginCaptures": {
+ "1": {
+ "name": "keyword.control.directive.pragma.c"
+ },
+ "2": {
+ "name": "punctuation.definition.directive.c"
+ }
+ },
+ "end": "(?=(?://|/\\*))|(?<!\\\\)(?=\\n)",
+ "name": "meta.preprocessor.pragma.c",
+ "patterns": [
+ {
+ "include": "#strings"
+ },
+ {
+ "match": "[a-zA-Z_$][\\w\\-$]*",
+ "name": "entity.other.attribute-name.pragma.preprocessor.c"
+ },
+ {
+ "include": "#numbers"
+ },
+ {
+ "include": "#line_continuation_character"
+ }
+ ]
+ },
+ {
+ "match": "\\b(u_char|u_short|u_int|u_long|ushort|uint|u_quad_t|quad_t|qaddr_t|caddr_t|daddr_t|div_t|dev_t|fixpt_t|blkcnt_t|blksize_t|gid_t|in_addr_t|in_port_t|ino_t|key_t|mode_t|nlink_t|id_t|pid_t|off_t|segsz_t|swblk_t|uid_t|id_t|clock_t|size_t|ssize_t|time_t|useconds_t|suseconds_t)\\b",
+ "name": "support.type.sys-types.c"
+ },
+ {
+ "match": "\\b(pthread_attr_t|pthread_cond_t|pthread_condattr_t|pthread_mutex_t|pthread_mutexattr_t|pthread_once_t|pthread_rwlock_t|pthread_rwlockattr_t|pthread_t|pthread_key_t)\\b",
+ "name": "support.type.pthread.c"
+ },
+ {
+ "match": "(?x) \\b\n(int8_t|int16_t|int32_t|int64_t|uint8_t|uint16_t|uint32_t|uint64_t|int_least8_t\n|int_least16_t|int_least32_t|int_least64_t|uint_least8_t|uint_least16_t|uint_least32_t\n|uint_least64_t|int_fast8_t|int_fast16_t|int_fast32_t|int_fast64_t|uint_fast8_t\n|uint_fast16_t|uint_fast32_t|uint_fast64_t|intptr_t|uintptr_t|intmax_t|intmax_t\n|uintmax_t|uintmax_t)\n\\b",
+ "name": "support.type.stdint.c"
+ },
+ {
+ "match": "\\b(noErr|kNilOptions|kInvalidID|kVariableLengthArray)\\b",
+ "name": "support.constant.mac-classic.c"
+ },
+ {
+ "match": "(?x) \\b\n(AbsoluteTime|Boolean|Byte|ByteCount|ByteOffset|BytePtr|CompTimeValue|ConstLogicalAddress|ConstStrFileNameParam\n|ConstStringPtr|Duration|Fixed|FixedPtr|Float32|Float32Point|Float64|Float80|Float96|FourCharCode|Fract|FractPtr\n|Handle|ItemCount|LogicalAddress|OptionBits|OSErr|OSStatus|OSType|OSTypePtr|PhysicalAddress|ProcessSerialNumber\n|ProcessSerialNumberPtr|ProcHandle|Ptr|ResType|ResTypePtr|ShortFixed|ShortFixedPtr|SignedByte|SInt16|SInt32|SInt64\n|SInt8|Siz [...]
+ "name": "support.type.mac-classic.c"
+ },
+ {
+ "match": "\\b([A-Za-z0-9_]+_t)\\b",
+ "name": "support.type.posix-reserved.c"
+ },
+ {
+ "include": "#block"
+ },
+ {
+ "include": "#parens"
+ },
+ {
+ "name": "meta.function.c",
+ "begin": "(?<!\\w)(?!\\s*(?:atomic_uint_least64_t|atomic_uint_least16_t|atomic_uint_least32_t|atomic_uint_least8_t|atomic_int_least16_t|atomic_uint_fast64_t|atomic_uint_fast32_t|atomic_int_least64_t|atomic_int_least32_t|pthread_rwlockattr_t|atomic_uint_fast16_t|pthread_mutexattr_t|atomic_int_fast16_t|atomic_uint_fast8_t|atomic_int_fast64_t|atomic_int_least8_t|atomic_int_fast32_t|atomic_int_fast8_t|pthread_condattr_t|pthread_rwlock_t|atomic_uintptr_t|atomic_ptrdiff_t|atomic_uintmax_ [...]
+ "end": "(?<=\\))",
+ "patterns": [
+ {
+ "include": "#function-innards"
+ }
+ ]
+ },
+ {
+ "include": "#line_continuation_character"
+ },
+ {
+ "name": "meta.bracket.square.access.c",
+ "begin": "([a-zA-Z_][a-zA-Z_0-9]*|(?<=[\\]\\)]))?(\\[)(?!\\])",
+ "beginCaptures": {
+ "1": {
+ "name": "variable.object.c"
+ },
+ "2": {
+ "name": "punctuation.definition.begin.bracket.square.c"
+ }
+ },
+ "end": "\\]",
+ "endCaptures": {
+ "0": {
+ "name": "punctuation.definition.end.bracket.square.c"
+ }
+ },
+ "patterns": [
+ {
+ "include": "#function-call-innards"
+ }
+ ]
+ },
+ {
+ "name": "storage.modifier.array.bracket.square.c",
+ "match": "\\[\\s*\\]"
+ },
+ {
+ "match": ";",
+ "name": "punctuation.terminator.statement.c"
+ },
+ {
+ "match": ",",
+ "name": "punctuation.separator.delimiter.c"
+ }
+ ],
+ "repository": {
+ "access-method": {
+ "name": "meta.function-call.member.c",
+ "begin": "([a-zA-Z_][a-zA-Z_0-9]*|(?<=[\\]\\)]))\\s*(?:(\\.)|(->))((?:(?:[a-zA-Z_][a-zA-Z_0-9]*)\\s*(?:(?:\\.)|(?:->)))*)\\s*([a-zA-Z_][a-zA-Z_0-9]*)(\\()",
+ "beginCaptures": {
+ "1": {
+ "name": "variable.object.c"
+ },
+ "2": {
+ "name": "punctuation.separator.dot-access.c"
+ },
+ "3": {
+ "name": "punctuation.separator.pointer-access.c"
+ },
+ "4": {
+ "patterns": [
+ {
+ "match": "\\.",
+ "name": "punctuation.separator.dot-access.c"
+ },
+ {
+ "match": "->",
+ "name": "punctuation.separator.pointer-access.c"
+ },
+ {
+ "match": "[a-zA-Z_][a-zA-Z_0-9]*",
+ "name": "variable.object.c"
+ },
+ {
+ "name": "everything.else.c",
+ "match": ".+"
+ }
+ ]
+ },
+ "5": {
+ "name": "entity.name.function.member.c"
+ },
+ "6": {
+ "name": "punctuation.section.arguments.begin.bracket.round.function.member.c"
+ }
+ },
+ "end": "\\)",
+ "endCaptures": {
+ "0": {
+ "name": "punctuation.section.arguments.end.bracket.round.function.member.c"
+ }
+ },
+ "patterns": [
+ {
+ "include": "#function-call-innards"
+ }
+ ]
+ },
+ "backslash_escapes": {
+ "match": "(?x)\\\\ (\n\\\\\t\t\t |\n[abefnprtv'\"?] |\n[0-3][0-7]{,2}\t |\n[4-7]\\d?\t\t|\nx[a-fA-F0-9]{,2} |\nu[a-fA-F0-9]{,4} |\nU[a-fA-F0-9]{,8} )",
+ "name": "constant.character.escape.c"
+ },
+ "block": {
+ "patterns": [
+ {
+ "begin": "{",
+ "beginCaptures": {
+ "0": {
+ "name": "punctuation.section.block.begin.bracket.curly.c"
+ }
+ },
+ "end": "}|(?=\\s*#\\s*(?:elif|else|endif)\\b)",
+ "endCaptures": {
+ "0": {
+ "name": "punctuation.section.block.end.bracket.curly.c"
+ }
+ },
+ "name": "meta.block.c",
+ "patterns": [
+ {
+ "include": "#block_innards"
+ }
+ ]
+ }
+ ]
+ },
+ "block_innards": {
+ "patterns": [
+ {
+ "include": "#preprocessor-rule-enabled-block"
+ },
+ {
+ "include": "#preprocessor-rule-disabled-block"
+ },
+ {
+ "include": "#preprocessor-rule-conditional-block"
+ },
+ {
+ "include": "#method_access"
+ },
+ {
+ "include": "#member_access"
+ },
+ {
+ "include": "#c_function_call"
+ },
+ {
+ "name": "meta.initialization.c",
+ "begin": "(?x)\n(?:\n (?:\n\t(?=\\s)(?<!else|new|return)\n\t(?<=\\w) \\s+(and|and_eq|bitand|bitor|compl|not|not_eq|or|or_eq|typeid|xor|xor_eq|alignof|alignas) # or word + space before name\n )\n)\n(\n (?:[A-Za-z_][A-Za-z0-9_]*+ | :: )++ # actual name\n |\n (?:(?<=operator) (?:[-*&<>=+!]+ | \\(\\) | \\[\\]))\n)\n\\s*(\\() # opening bracket",
+ "beginCaptures": {
+ "1": {
+ "name": "variable.other.c"
+ },
+ "2": {
+ "name": "punctuation.section.parens.begin.bracket.round.initialization.c"
+ }
+ },
+ "end": "\\)",
+ "endCaptures": {
+ "0": {
+ "name": "punctuation.section.parens.end.bracket.round.initialization.c"
+ }
+ },
+ "patterns": [
+ {
+ "include": "#function-call-innards"
+ }
+ ]
+ },
+ {
+ "begin": "{",
+ "beginCaptures": {
+ "0": {
+ "name": "punctuation.section.block.begin.bracket.curly.c"
+ }
+ },
+ "end": "}|(?=\\s*#\\s*(?:elif|else|endif)\\b)",
+ "endCaptures": {
+ "0": {
+ "name": "punctuation.section.block.end.bracket.curly.c"
+ }
+ },
+ "patterns": [
+ {
+ "include": "#block_innards"
+ }
+ ]
+ },
+ {
+ "include": "#parens-block"
+ },
+ {
+ "include": "$base"
+ }
+ ]
+ },
+ "c_conditional_context": {
+ "patterns": [
+ {
+ "include": "$self"
+ },
+ {
+ "include": "#block_innards"
+ }
+ ]
+ },
+ "c_function_call": {
+ "begin": "(?x)\n(?!(?:while|for|do|if|else|switch|catch|enumerate|return|typeid|alignof|alignas|sizeof|[cr]?iterate|and|and_eq|bitand|bitor|compl|not|not_eq|or|or_eq|typeid|xor|xor_eq|alignof|alignas)\\s*\\()\n(?=\n(?:[A-Za-z_][A-Za-z0-9_]*+|::)++\\s*\\( # actual name\n|\n(?:(?<=operator)(?:[-*&<>=+!]+|\\(\\)|\\[\\]))\\s*\\(\n)",
+ "end": "(?<=\\))(?!\\w)",
+ "name": "meta.function-call.c",
+ "patterns": [
+ {
+ "include": "#function-call-innards"
+ }
+ ]
+ },
+ "case_statement": {
+ "name": "meta.conditional.case.c",
+ "begin": "((?>(?:(?:(?>(?<!\\s)\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))((?<!\\w)case(?!\\w))",
+ "beginCaptures": {
+ "1": {
+ "patterns": [
+ {
+ "include": "#inline_comment"
+ }
+ ]
+ },
+ "2": {
+ "name": "comment.block.c punctuation.definition.comment.begin.c"
+ },
+ "3": {
+ "name": "comment.block.c"
+ },
+ "4": {
+ "patterns": [
+ {
+ "match": "\\*\\/",
+ "name": "comment.block.c punctuation.definition.comment.end.c"
+ },
+ {
+ "match": "\\*",
+ "name": "comment.block.c"
+ }
+ ]
+ },
+ "5": {
+ "name": "keyword.control.case.c"
+ }
+ },
+ "end": "(:)",
+ "endCaptures": {
+ "1": {
+ "name": "punctuation.separator.colon.case.c"
+ }
+ },
+ "patterns": [
+ {
+ "include": "#evaluation_context"
+ },
+ {
+ "include": "#c_conditional_context"
+ }
+ ]
+ },
+ "comments": {
+ "patterns": [
+ {
+ "name": "comment.line.double-slash.documentation.c",
+ "begin": "(?:^)(?>\\s*)(\\/\\/[!\\/]+)",
+ "beginCaptures": {
+ "1": {
+ "name": "punctuation.definition.comment.documentation.c"
+ }
+ },
+ "end": "(?<=\\n)(?<!\\\\\\n)",
+ "patterns": [
+ {
+ "include": "#line_continuation_character"
+ },
+ {
+ "match": "(?<=[\\s*!\\/])[\\\\@](?:callergraph|callgraph|else|endif|f\\$|f\\[|f\\]|hidecallergraph|hidecallgraph|hiderefby|hiderefs|hideinitializer|htmlinclude|n|nosubgrouping|private|privatesection|protected|protectedsection|public|publicsection|pure|showinitializer|showrefby|showrefs|tableofcontents|\\$|\\#|<|>|%|\"|\\.|=|::|\\||\\-\\-|\\-\\-\\-)\\b(?:\\{[^}]*\\})?",
+ "name": "storage.type.class.doxygen.c"
+ },
+ {
+ "match": "((?<=[\\s*!\\/])[\\\\@](?:a|em|e))\\s+(\\S+)",
+ "captures": {
+ "1": {
+ "name": "storage.type.class.doxygen.c"
+ },
+ "2": {
+ "name": "markup.italic.doxygen.c"
+ }
+ }
+ },
+ {
+ "match": "((?<=[\\s*!\\/])[\\\\@]b)\\s+(\\S+)",
+ "captures": {
+ "1": {
+ "name": "storage.type.class.doxygen.c"
+ },
+ "2": {
+ "name": "markup.bold.doxygen.c"
+ }
+ }
+ },
+ {
+ "match": "((?<=[\\s*!\\/])[\\\\@](?:c|p))\\s+(\\S+)",
+ "captures": {
+ "1": {
+ "name": "storage.type.class.doxygen.c"
+ },
+ "2": {
+ "name": "markup.inline.raw.string.c"
+ }
+ }
+ },
+ {
+ "match": "(?<=[\\s*!\\/])[\\\\@](?:a|anchor|b|c|cite|copybrief|copydetail|copydoc|def|dir|dontinclude|e|em|emoji|enum|example|extends|file|idlexcept|implements|include|includedoc|includelineno|latexinclude|link|memberof|namespace|p|package|ref|refitem|related|relates|relatedalso|relatesalso|verbinclude)\\b(?:\\{[^}]*\\})?",
+ "name": "storage.type.class.doxygen.c"
+ },
+ {
+ "match": "(?<=[\\s*!\\/])[\\\\@](?:addindex|addtogroup|category|class|defgroup|diafile|dotfile|elseif|fn|headerfile|if|ifnot|image|ingroup|interface|line|mainpage|mscfile|name|overload|page|property|protocol|section|skip|skipline|snippet|snippetdoc|snippetlineno|struct|subpage|subsection|subsubsection|typedef|union|until|vhdlflow|weakgroup)\\b(?:\\{[^}]*\\})?",
+ "name": "storage.type.class.doxygen.c"
+ },
+ {
+ "match": "((?<=[\\s*!\\/])[\\\\@]param)(?:\\s*\\[((?:,?\\s*(?:in|out)\\s*)+)\\])?\\s+(\\b\\w+\\b)",
+ "captures": {
+ "1": {
+ "name": "storage.type.class.doxygen.c"
+ },
+ "2": {
+ "patterns": [
+ {
+ "match": "in|out",
+ "name": "keyword.other.parameter.direction.$0.c"
+ }
+ ]
+ },
+ "3": {
+ "name": "variable.parameter.c"
+ }
+ }
+ },
+ {
+ "match": "(?<=[\\s*!\\/])[\\\\@](?:arg|attention|author|authors|brief|bug|copyright|date|deprecated|details|exception|invariant|li|note|par|paragraph|param|post|pre|remark|remarks|result|return|returns|retval|sa|see|short|since|test|throw|todo|tparam|version|warning|xrefitem)\\b(?:\\{[^}]*\\})?",
+ "name": "storage.type.class.doxygen.c"
+ },
+ {
+ "match": "(?<=[\\s*!\\/])[\\\\@](?:code|cond|docbookonly|dot|htmlonly|internal|latexonly|link|manonly|msc|parblock|rtfonly|secreflist|uml|verbatim|xmlonly|endcode|endcond|enddocbookonly|enddot|endhtmlonly|endinternal|endlatexonly|endlink|endmanonly|endmsc|endparblock|endrtfonly|endsecreflist|enduml|endverbatim|endxmlonly)\\b(?:\\{[^}]*\\})?",
+ "name": "storage.type.class.doxygen.c"
+ },
+ {
+ "match": "(?:\\b[A-Z]+:|@[a-z_]+:)",
+ "name": "storage.type.class.gtkdoc"
+ }
+ ]
+ },
+ {
+ "match": "(\\/\\*[!*]+(?=\\s))(.+)([!*]*\\*\\/)",
+ "captures": {
+ "1": {
+ "name": "punctuation.definition.comment.begin.documentation.c"
+ },
+ "2": {
+ "patterns": [
+ {
+ "match": "(?<=[\\s*!\\/])[\\\\@](?:callergraph|callgraph|else|endif|f\\$|f\\[|f\\]|hidecallergraph|hidecallgraph|hiderefby|hiderefs|hideinitializer|htmlinclude|n|nosubgrouping|private|privatesection|protected|protectedsection|public|publicsection|pure|showinitializer|showrefby|showrefs|tableofcontents|\\$|\\#|<|>|%|\"|\\.|=|::|\\||\\-\\-|\\-\\-\\-)\\b(?:\\{[^}]*\\})?",
+ "name": "storage.type.class.doxygen.c"
+ },
+ {
+ "match": "((?<=[\\s*!\\/])[\\\\@](?:a|em|e))\\s+(\\S+)",
+ "captures": {
+ "1": {
+ "name": "storage.type.class.doxygen.c"
+ },
+ "2": {
+ "name": "markup.italic.doxygen.c"
+ }
+ }
+ },
+ {
+ "match": "((?<=[\\s*!\\/])[\\\\@]b)\\s+(\\S+)",
+ "captures": {
+ "1": {
+ "name": "storage.type.class.doxygen.c"
+ },
+ "2": {
+ "name": "markup.bold.doxygen.c"
+ }
+ }
+ },
+ {
+ "match": "((?<=[\\s*!\\/])[\\\\@](?:c|p))\\s+(\\S+)",
+ "captures": {
+ "1": {
+ "name": "storage.type.class.doxygen.c"
+ },
+ "2": {
+ "name": "markup.inline.raw.string.c"
+ }
+ }
+ },
+ {
+ "match": "(?<=[\\s*!\\/])[\\\\@](?:a|anchor|b|c|cite|copybrief|copydetail|copydoc|def|dir|dontinclude|e|em|emoji|enum|example|extends|file|idlexcept|implements|include|includedoc|includelineno|latexinclude|link|memberof|namespace|p|package|ref|refitem|related|relates|relatedalso|relatesalso|verbinclude)\\b(?:\\{[^}]*\\})?",
+ "name": "storage.type.class.doxygen.c"
+ },
+ {
+ "match": "(?<=[\\s*!\\/])[\\\\@](?:addindex|addtogroup|category|class|defgroup|diafile|dotfile|elseif|fn|headerfile|if|ifnot|image|ingroup|interface|line|mainpage|mscfile|name|overload|page|property|protocol|section|skip|skipline|snippet|snippetdoc|snippetlineno|struct|subpage|subsection|subsubsection|typedef|union|until|vhdlflow|weakgroup)\\b(?:\\{[^}]*\\})?",
+ "name": "storage.type.class.doxygen.c"
+ },
+ {
+ "match": "((?<=[\\s*!\\/])[\\\\@]param)(?:\\s*\\[((?:,?\\s*(?:in|out)\\s*)+)\\])?\\s+(\\b\\w+\\b)",
+ "captures": {
+ "1": {
+ "name": "storage.type.class.doxygen.c"
+ },
+ "2": {
+ "patterns": [
+ {
+ "match": "in|out",
+ "name": "keyword.other.parameter.direction.$0.c"
+ }
+ ]
+ },
+ "3": {
+ "name": "variable.parameter.c"
+ }
+ }
+ },
+ {
+ "match": "(?<=[\\s*!\\/])[\\\\@](?:arg|attention|author|authors|brief|bug|copyright|date|deprecated|details|exception|invariant|li|note|par|paragraph|param|post|pre|remark|remarks|result|return|returns|retval|sa|see|short|since|test|throw|todo|tparam|version|warning|xrefitem)\\b(?:\\{[^}]*\\})?",
+ "name": "storage.type.class.doxygen.c"
+ },
+ {
+ "match": "(?<=[\\s*!\\/])[\\\\@](?:code|cond|docbookonly|dot|htmlonly|internal|latexonly|link|manonly|msc|parblock|rtfonly|secreflist|uml|verbatim|xmlonly|endcode|endcond|enddocbookonly|enddot|endhtmlonly|endinternal|endlatexonly|endlink|endmanonly|endmsc|endparblock|endrtfonly|endsecreflist|enduml|endverbatim|endxmlonly)\\b(?:\\{[^}]*\\})?",
+ "name": "storage.type.class.doxygen.c"
+ },
+ {
+ "match": "(?:\\b[A-Z]+:|@[a-z_]+:)",
+ "name": "storage.type.class.gtkdoc"
+ }
+ ]
+ },
+ "3": {
+ "name": "punctuation.definition.comment.end.documentation.c"
+ }
+ },
+ "name": "comment.block.documentation.c"
+ },
+ {
+ "name": "comment.block.documentation.c",
+ "begin": "((?>\\s*)\\/\\*[!*]+(?:(?:\\n|$)|(?=\\s)))",
+ "beginCaptures": {
+ "1": {
+ "name": "punctuation.definition.comment.begin.documentation.c"
+ }
+ },
+ "end": "([!*]*\\*\\/)",
+ "endCaptures": {
+ "1": {
+ "name": "punctuation.definition.comment.end.documentation.c"
+ }
+ },
+ "patterns": [
+ {
+ "match": "(?<=[\\s*!\\/])[\\\\@](?:callergraph|callgraph|else|endif|f\\$|f\\[|f\\]|hidecallergraph|hidecallgraph|hiderefby|hiderefs|hideinitializer|htmlinclude|n|nosubgrouping|private|privatesection|protected|protectedsection|public|publicsection|pure|showinitializer|showrefby|showrefs|tableofcontents|\\$|\\#|<|>|%|\"|\\.|=|::|\\||\\-\\-|\\-\\-\\-)\\b(?:\\{[^}]*\\})?",
+ "name": "storage.type.class.doxygen.c"
+ },
+ {
+ "match": "((?<=[\\s*!\\/])[\\\\@](?:a|em|e))\\s+(\\S+)",
+ "captures": {
+ "1": {
+ "name": "storage.type.class.doxygen.c"
+ },
+ "2": {
+ "name": "markup.italic.doxygen.c"
+ }
+ }
+ },
+ {
+ "match": "((?<=[\\s*!\\/])[\\\\@]b)\\s+(\\S+)",
+ "captures": {
+ "1": {
+ "name": "storage.type.class.doxygen.c"
+ },
+ "2": {
+ "name": "markup.bold.doxygen.c"
+ }
+ }
+ },
+ {
+ "match": "((?<=[\\s*!\\/])[\\\\@](?:c|p))\\s+(\\S+)",
+ "captures": {
+ "1": {
+ "name": "storage.type.class.doxygen.c"
+ },
+ "2": {
+ "name": "markup.inline.raw.string.c"
+ }
+ }
+ },
+ {
+ "match": "(?<=[\\s*!\\/])[\\\\@](?:a|anchor|b|c|cite|copybrief|copydetail|copydoc|def|dir|dontinclude|e|em|emoji|enum|example|extends|file|idlexcept|implements|include|includedoc|includelineno|latexinclude|link|memberof|namespace|p|package|ref|refitem|related|relates|relatedalso|relatesalso|verbinclude)\\b(?:\\{[^}]*\\})?",
+ "name": "storage.type.class.doxygen.c"
+ },
+ {
+ "match": "(?<=[\\s*!\\/])[\\\\@](?:addindex|addtogroup|category|class|defgroup|diafile|dotfile|elseif|fn|headerfile|if|ifnot|image|ingroup|interface|line|mainpage|mscfile|name|overload|page|property|protocol|section|skip|skipline|snippet|snippetdoc|snippetlineno|struct|subpage|subsection|subsubsection|typedef|union|until|vhdlflow|weakgroup)\\b(?:\\{[^}]*\\})?",
+ "name": "storage.type.class.doxygen.c"
+ },
+ {
+ "match": "((?<=[\\s*!\\/])[\\\\@]param)(?:\\s*\\[((?:,?\\s*(?:in|out)\\s*)+)\\])?\\s+(\\b\\w+\\b)",
+ "captures": {
+ "1": {
+ "name": "storage.type.class.doxygen.c"
+ },
+ "2": {
+ "patterns": [
+ {
+ "match": "in|out",
+ "name": "keyword.other.parameter.direction.$0.c"
+ }
+ ]
+ },
+ "3": {
+ "name": "variable.parameter.c"
+ }
+ }
+ },
+ {
+ "match": "(?<=[\\s*!\\/])[\\\\@](?:arg|attention|author|authors|brief|bug|copyright|date|deprecated|details|exception|invariant|li|note|par|paragraph|param|post|pre|remark|remarks|result|return|returns|retval|sa|see|short|since|test|throw|todo|tparam|version|warning|xrefitem)\\b(?:\\{[^}]*\\})?",
+ "name": "storage.type.class.doxygen.c"
+ },
+ {
+ "match": "(?<=[\\s*!\\/])[\\\\@](?:code|cond|docbookonly|dot|htmlonly|internal|latexonly|link|manonly|msc|parblock|rtfonly|secreflist|uml|verbatim|xmlonly|endcode|endcond|enddocbookonly|enddot|endhtmlonly|endinternal|endlatexonly|endlink|endmanonly|endmsc|endparblock|endrtfonly|endsecreflist|enduml|endverbatim|endxmlonly)\\b(?:\\{[^}]*\\})?",
+ "name": "storage.type.class.doxygen.c"
+ },
+ {
+ "match": "(?:\\b[A-Z]+:|@[a-z_]+:)",
+ "name": "storage.type.class.gtkdoc"
+ }
+ ]
+ },
+ {
+ "match": "^\\/\\* =(\\s*.*?)\\s*= \\*\\/$\\n?",
+ "captures": {
+ "1": {
+ "name": "meta.toc-list.banner.block.c"
+ }
+ },
+ "name": "comment.block.banner.c"
+ },
+ {
+ "name": "comment.block.c",
+ "begin": "(\\/\\*)",
+ "beginCaptures": {
+ "1": {
+ "name": "punctuation.definition.comment.begin.c"
+ }
+ },
+ "end": "(\\*\\/)",
+ "endCaptures": {
+ "1": {
+ "name": "punctuation.definition.comment.end.c"
+ }
+ }
+ },
+ {
+ "match": "^\\/\\/ =(\\s*.*?)\\s*=$\\n?",
+ "captures": {
+ "1": {
+ "name": "meta.toc-list.banner.line.c"
+ }
+ },
+ "name": "comment.line.banner.c"
+ },
+ {
+ "begin": "((?:^[ \\t]+)?)(?=\\/\\/)",
+ "beginCaptures": {
+ "1": {
+ "name": "punctuation.whitespace.comment.leading.c"
+ }
+ },
+ "end": "(?!\\G)",
+ "patterns": [
+ {
+ "name": "comment.line.double-slash.c",
+ "begin": "(\\/\\/)",
+ "beginCaptures": {
+ "1": {
+ "name": "punctuation.definition.comment.c"
+ }
+ },
+ "end": "(?=\\n)",
+ "patterns": [
+ {
+ "include": "#line_continuation_character"
+ }
+ ]
+ }
+ ]
+ }
+ ]
+ },
+ "default_statement": {
+ "name": "meta.conditional.case.c",
+ "begin": "((?>(?:(?:(?>(?<!\\s)\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))((?<!\\w)default(?!\\w))",
+ "beginCaptures": {
+ "1": {
+ "patterns": [
+ {
+ "include": "#inline_comment"
+ }
+ ]
+ },
+ "2": {
+ "name": "comment.block.c punctuation.definition.comment.begin.c"
+ },
+ "3": {
+ "name": "comment.block.c"
+ },
+ "4": {
+ "patterns": [
+ {
+ "match": "\\*\\/",
+ "name": "comment.block.c punctuation.definition.comment.end.c"
+ },
+ {
+ "match": "\\*",
+ "name": "comment.block.c"
+ }
+ ]
+ },
+ "5": {
+ "name": "keyword.control.default.c"
+ }
+ },
+ "end": "(:)",
+ "endCaptures": {
+ "1": {
+ "name": "punctuation.separator.colon.case.default.c"
+ }
+ },
+ "patterns": [
+ {
+ "include": "#evaluation_context"
+ },
+ {
+ "include": "#c_conditional_context"
+ }
+ ]
+ },
+ "disabled": {
+ "begin": "^\\s*#\\s*if(n?def)?\\b.*$",
+ "end": "^\\s*#\\s*endif\\b",
+ "patterns": [
+ {
+ "include": "#disabled"
+ },
+ {
+ "include": "#pragma-mark"
+ }
+ ]
+ },
+ "evaluation_context": {
+ "patterns": [
+ {
+ "include": "#function-call-innards"
+ },
+ {
+ "include": "$base"
+ }
+ ]
+ },
+ "function-call-innards": {
+ "patterns": [
+ {
+ "include": "#comments"
+ },
+ {
+ "include": "#storage_types"
+ },
+ {
+ "include": "#method_access"
+ },
+ {
+ "include": "#member_access"
+ },
+ {
+ "include": "#operators"
+ },
+ {
+ "begin": "(?x)\n(?!(?:while|for|do|if|else|switch|catch|enumerate|return|typeid|alignof|alignas|sizeof|[cr]?iterate|and|and_eq|bitand|bitor|compl|not|not_eq|or|or_eq|typeid|xor|xor_eq|alignof|alignas)\\s*\\()\n(\n(?:[A-Za-z_][A-Za-z0-9_]*+|::)++ # actual name\n|\n(?:(?<=operator)(?:[-*&<>=+!]+|\\(\\)|\\[\\]))\n)\n\\s*(\\()",
+ "beginCaptures": {
+ "1": {
+ "name": "entity.name.function.c"
+ },
+ "2": {
+ "name": "punctuation.section.arguments.begin.bracket.round.c"
+ }
+ },
+ "end": "\\)",
+ "endCaptures": {
+ "0": {
+ "name": "punctuation.section.arguments.end.bracket.round.c"
+ }
+ },
+ "patterns": [
+ {
+ "include": "#function-call-innards"
+ }
+ ]
+ },
+ {
+ "begin": "\\(",
+ "beginCaptures": {
+ "0": {
+ "name": "punctuation.section.parens.begin.bracket.round.c"
+ }
+ },
+ "end": "\\)",
+ "endCaptures": {
+ "0": {
+ "name": "punctuation.section.parens.end.bracket.round.c"
+ }
+ },
+ "patterns": [
+ {
+ "include": "#function-call-innards"
+ }
+ ]
+ },
+ {
+ "include": "#block_innards"
+ }
+ ]
+ },
+ "function-innards": {
+ "patterns": [
+ {
+ "include": "#comments"
+ },
+ {
+ "include": "#storage_types"
+ },
+ {
+ "include": "#operators"
+ },
+ {
+ "include": "#vararg_ellipses"
+ },
+ {
+ "name": "meta.function.definition.parameters.c",
+ "begin": "(?x)\n(?!(?:while|for|do|if|else|switch|catch|enumerate|return|typeid|alignof|alignas|sizeof|[cr]?iterate|and|and_eq|bitand|bitor|compl|not|not_eq|or|or_eq|typeid|xor|xor_eq|alignof|alignas)\\s*\\()\n(\n(?:[A-Za-z_][A-Za-z0-9_]*+|::)++ # actual name\n|\n(?:(?<=operator)(?:[-*&<>=+!]+|\\(\\)|\\[\\]))\n)\n\\s*(\\()",
+ "beginCaptures": {
+ "1": {
+ "name": "entity.name.function.c"
+ },
+ "2": {
+ "name": "punctuation.section.parameters.begin.bracket.round.c"
+ }
+ },
+ "end": "\\)",
+ "endCaptures": {
+ "0": {
+ "name": "punctuation.section.parameters.end.bracket.round.c"
+ }
+ },
+ "patterns": [
+ {
+ "include": "#probably_a_parameter"
+ },
+ {
+ "include": "#function-innards"
+ }
+ ]
+ },
+ {
+ "begin": "\\(",
+ "beginCaptures": {
+ "0": {
+ "name": "punctuation.section.parens.begin.bracket.round.c"
+ }
+ },
+ "end": "\\)",
+ "endCaptures": {
+ "0": {
+ "name": "punctuation.section.parens.end.bracket.round.c"
+ }
+ },
+ "patterns": [
+ {
+ "include": "#function-innards"
+ }
+ ]
+ },
+ {
+ "include": "$base"
+ }
+ ]
+ },
+ "inline_comment": {
+ "match": "(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/))",
+ "captures": {
+ "1": {
+ "name": "comment.block.c punctuation.definition.comment.begin.c"
+ },
+ "2": {
+ "name": "comment.block.c"
+ },
+ "3": {
+ "patterns": [
+ {
+ "match": "\\*\\/",
+ "name": "comment.block.c punctuation.definition.comment.end.c"
+ },
+ {
+ "match": "\\*",
+ "name": "comment.block.c"
+ }
+ ]
+ }
+ }
+ },
+ "line_continuation_character": {
+ "patterns": [
+ {
+ "match": "(\\\\)\\n",
+ "captures": {
+ "1": {
+ "name": "constant.character.escape.line-continuation.c"
+ }
+ }
+ }
+ ]
+ },
+ "member_access": {
+ "match": "((?:[a-zA-Z_]\\w*|(?<=\\]|\\)))\\s*)(?:((?:\\.\\*|\\.))|((?:->\\*|->)))((?:[a-zA-Z_]\\w*\\s*(?:(?:(?:\\.\\*|\\.))|(?:(?:->\\*|->)))\\s*)*)\\s*(\\b(?!(?:atomic_uint_least64_t|atomic_uint_least16_t|atomic_uint_least32_t|atomic_uint_least8_t|atomic_int_least16_t|atomic_uint_fast64_t|atomic_uint_fast32_t|atomic_int_least64_t|atomic_int_least32_t|pthread_rwlockattr_t|atomic_uint_fast16_t|pthread_mutexattr_t|atomic_int_fast16_t|atomic_uint_fast8_t|atomic_int_fast64_t|atomic_int [...]
+ "captures": {
+ "1": {
+ "name": "variable.other.object.access.c"
+ },
+ "2": {
+ "name": "punctuation.separator.dot-access.c"
+ },
+ "3": {
+ "name": "punctuation.separator.pointer-access.c"
+ },
+ "4": {
+ "patterns": [
+ {
+ "include": "#member_access"
+ },
+ {
+ "include": "#method_access"
+ },
+ {
+ "match": "((?:[a-zA-Z_]\\w*|(?<=\\]|\\)))\\s*)(?:((?:\\.\\*|\\.))|((?:->\\*|->)))",
+ "captures": {
+ "1": {
+ "name": "variable.other.object.access.c"
+ },
+ "2": {
+ "name": "punctuation.separator.dot-access.c"
+ },
+ "3": {
+ "name": "punctuation.separator.pointer-access.c"
+ }
+ }
+ }
+ ]
+ },
+ "5": {
+ "name": "variable.other.member.c"
+ }
+ }
+ },
+ "method_access": {
+ "contentName": "meta.function-call.member.c",
+ "begin": "((?:[a-zA-Z_]\\w*|(?<=\\]|\\)))\\s*)(?:((?:\\.\\*|\\.))|((?:->\\*|->)))((?:[a-zA-Z_]\\w*\\s*(?:(?:(?:\\.\\*|\\.))|(?:(?:->\\*|->)))\\s*)*)\\s*([a-zA-Z_]\\w*)(\\()",
+ "beginCaptures": {
+ "1": {
+ "name": "variable.other.object.access.c"
+ },
+ "2": {
+ "name": "punctuation.separator.dot-access.c"
+ },
+ "3": {
+ "name": "punctuation.separator.pointer-access.c"
+ },
+ "4": {
+ "patterns": [
+ {
+ "include": "#member_access"
+ },
+ {
+ "include": "#method_access"
+ },
+ {
+ "match": "((?:[a-zA-Z_]\\w*|(?<=\\]|\\)))\\s*)(?:((?:\\.\\*|\\.))|((?:->\\*|->)))",
+ "captures": {
+ "1": {
+ "name": "variable.other.object.access.c"
+ },
+ "2": {
+ "name": "punctuation.separator.dot-access.c"
+ },
+ "3": {
+ "name": "punctuation.separator.pointer-access.c"
+ }
+ }
+ }
+ ]
+ },
+ "5": {
+ "name": "entity.name.function.member.c"
+ },
+ "6": {
+ "name": "punctuation.section.arguments.begin.bracket.round.function.member.c"
+ }
+ },
+ "end": "(\\))",
+ "endCaptures": {
+ "1": {
+ "name": "punctuation.section.arguments.end.bracket.round.function.member.c"
+ }
+ },
+ "patterns": [
+ {
+ "include": "#function-call-innards"
+ }
+ ]
+ },
+ "numbers": {
+ "match": "(?<!\\w)\\.?\\d(?:(?:[0-9a-zA-Z_\\.]|')|(?<=[eEpP])[+-])*",
+ "captures": {
+ "0": {
+ "patterns": [
+ {
+ "begin": "(?=.)",
+ "end": "$",
+ "patterns": [
+ {
+ "match": "(\\G0[xX])([0-9a-fA-F](?:[0-9a-fA-F]|((?<=[0-9a-fA-F])'(?=[0-9a-fA-F])))*)?((?:(?<=[0-9a-fA-F])\\.|\\.(?=[0-9a-fA-F])))([0-9a-fA-F](?:[0-9a-fA-F]|((?<=[0-9a-fA-F])'(?=[0-9a-fA-F])))*)?((?<!')([pP])(\\+?)(\\-?)((?:[0-9](?:[0-9]|(?:(?<=[0-9a-fA-F])'(?=[0-9a-fA-F])))*)))?([lLfF](?!\\w))?$",
+ "captures": {
+ "1": {
+ "name": "keyword.other.unit.hexadecimal.c"
+ },
+ "2": {
+ "name": "constant.numeric.hexadecimal.c",
+ "patterns": [
+ {
+ "match": "(?<=[0-9a-fA-F])'(?=[0-9a-fA-F])",
+ "name": "punctuation.separator.constant.numeric"
+ }
+ ]
+ },
+ "3": {
+ "name": "punctuation.separator.constant.numeric"
+ },
+ "4": {
+ "name": "constant.numeric.hexadecimal.c"
+ },
+ "5": {
+ "name": "constant.numeric.hexadecimal.c",
+ "patterns": [
+ {
+ "match": "(?<=[0-9a-fA-F])'(?=[0-9a-fA-F])",
+ "name": "punctuation.separator.constant.numeric"
+ }
+ ]
+ },
+ "6": {
+ "name": "punctuation.separator.constant.numeric"
+ },
+ "8": {
+ "name": "keyword.other.unit.exponent.hexadecimal.c"
+ },
+ "9": {
+ "name": "keyword.operator.plus.exponent.hexadecimal.c"
+ },
+ "10": {
+ "name": "keyword.operator.minus.exponent.hexadecimal.c"
+ },
+ "11": {
+ "name": "constant.numeric.exponent.hexadecimal.c",
+ "patterns": [
+ {
+ "match": "(?<=[0-9a-fA-F])'(?=[0-9a-fA-F])",
+ "name": "punctuation.separator.constant.numeric"
+ }
+ ]
+ },
+ "12": {
+ "name": "keyword.other.unit.suffix.floating-point.c"
+ }
+ }
+ },
+ {
+ "match": "(\\G(?=[0-9.])(?!0[xXbB]))([0-9](?:[0-9]|((?<=[0-9a-fA-F])'(?=[0-9a-fA-F])))*)?((?:(?<=[0-9])\\.|\\.(?=[0-9])))([0-9](?:[0-9]|((?<=[0-9a-fA-F])'(?=[0-9a-fA-F])))*)?((?<!')([eE])(\\+?)(\\-?)((?:[0-9](?:[0-9]|(?:(?<=[0-9a-fA-F])'(?=[0-9a-fA-F])))*)))?([lLfF](?!\\w))?$",
+ "captures": {
+ "2": {
+ "name": "constant.numeric.decimal.c",
+ "patterns": [
+ {
+ "match": "(?<=[0-9a-fA-F])'(?=[0-9a-fA-F])",
+ "name": "punctuation.separator.constant.numeric"
+ }
+ ]
+ },
+ "3": {
+ "name": "punctuation.separator.constant.numeric"
+ },
+ "4": {
+ "name": "constant.numeric.decimal.point.c"
+ },
+ "5": {
+ "name": "constant.numeric.decimal.c",
+ "patterns": [
+ {
+ "match": "(?<=[0-9a-fA-F])'(?=[0-9a-fA-F])",
+ "name": "punctuation.separator.constant.numeric"
+ }
+ ]
+ },
+ "6": {
+ "name": "punctuation.separator.constant.numeric"
+ },
+ "8": {
+ "name": "keyword.other.unit.exponent.decimal.c"
+ },
+ "9": {
+ "name": "keyword.operator.plus.exponent.decimal.c"
+ },
+ "10": {
+ "name": "keyword.operator.minus.exponent.decimal.c"
+ },
+ "11": {
+ "name": "constant.numeric.exponent.decimal.c",
+ "patterns": [
+ {
+ "match": "(?<=[0-9a-fA-F])'(?=[0-9a-fA-F])",
+ "name": "punctuation.separator.constant.numeric"
+ }
+ ]
+ },
+ "12": {
+ "name": "keyword.other.unit.suffix.floating-point.c"
+ }
+ }
+ },
+ {
+ "match": "(\\G0[bB])([01](?:[01]|((?<=[0-9a-fA-F])'(?=[0-9a-fA-F])))*)((?:(?:(?:(?:(?:[uU]|[uU]ll?)|[uU]LL?)|ll?[uU]?)|LL?[uU]?)|[fF])(?!\\w))?$",
+ "captures": {
+ "1": {
+ "name": "keyword.other.unit.binary.c"
+ },
+ "2": {
+ "name": "constant.numeric.binary.c",
+ "patterns": [
+ {
+ "match": "(?<=[0-9a-fA-F])'(?=[0-9a-fA-F])",
+ "name": "punctuation.separator.constant.numeric"
+ }
+ ]
+ },
+ "3": {
+ "name": "punctuation.separator.constant.numeric"
+ },
+ "4": {
+ "name": "keyword.other.unit.suffix.integer.c"
+ }
+ }
+ },
+ {
+ "match": "(\\G0)((?:[0-7]|((?<=[0-9a-fA-F])'(?=[0-9a-fA-F])))+)((?:(?:(?:(?:(?:[uU]|[uU]ll?)|[uU]LL?)|ll?[uU]?)|LL?[uU]?)|[fF])(?!\\w))?$",
+ "captures": {
+ "1": {
+ "name": "keyword.other.unit.octal.c"
+ },
+ "2": {
+ "name": "constant.numeric.octal.c",
+ "patterns": [
+ {
+ "match": "(?<=[0-9a-fA-F])'(?=[0-9a-fA-F])",
+ "name": "punctuation.separator.constant.numeric"
+ }
+ ]
+ },
+ "3": {
+ "name": "punctuation.separator.constant.numeric"
+ },
+ "4": {
+ "name": "keyword.other.unit.suffix.integer.c"
+ }
+ }
+ },
+ {
+ "match": "(\\G0[xX])([0-9a-fA-F](?:[0-9a-fA-F]|((?<=[0-9a-fA-F])'(?=[0-9a-fA-F])))*)((?<!')([pP])(\\+?)(\\-?)((?:[0-9](?:[0-9]|(?:(?<=[0-9a-fA-F])'(?=[0-9a-fA-F])))*)))?((?:(?:(?:(?:(?:[uU]|[uU]ll?)|[uU]LL?)|ll?[uU]?)|LL?[uU]?)|[fF])(?!\\w))?$",
+ "captures": {
+ "1": {
+ "name": "keyword.other.unit.hexadecimal.c"
+ },
+ "2": {
+ "name": "constant.numeric.hexadecimal.c",
+ "patterns": [
+ {
+ "match": "(?<=[0-9a-fA-F])'(?=[0-9a-fA-F])",
+ "name": "punctuation.separator.constant.numeric"
+ }
+ ]
+ },
+ "3": {
+ "name": "punctuation.separator.constant.numeric"
+ },
+ "5": {
+ "name": "keyword.other.unit.exponent.hexadecimal.c"
+ },
+ "6": {
+ "name": "keyword.operator.plus.exponent.hexadecimal.c"
+ },
+ "7": {
+ "name": "keyword.operator.minus.exponent.hexadecimal.c"
+ },
+ "8": {
+ "name": "constant.numeric.exponent.hexadecimal.c",
+ "patterns": [
+ {
+ "match": "(?<=[0-9a-fA-F])'(?=[0-9a-fA-F])",
+ "name": "punctuation.separator.constant.numeric"
+ }
+ ]
+ },
+ "9": {
+ "name": "keyword.other.unit.suffix.integer.c"
+ }
+ }
+ },
+ {
+ "match": "(\\G(?=[0-9.])(?!0[xXbB]))([0-9](?:[0-9]|((?<=[0-9a-fA-F])'(?=[0-9a-fA-F])))*)((?<!')([eE])(\\+?)(\\-?)((?:[0-9](?:[0-9]|(?:(?<=[0-9a-fA-F])'(?=[0-9a-fA-F])))*)))?((?:(?:(?:(?:(?:[uU]|[uU]ll?)|[uU]LL?)|ll?[uU]?)|LL?[uU]?)|[fF])(?!\\w))?$",
+ "captures": {
+ "2": {
+ "name": "constant.numeric.decimal.c",
+ "patterns": [
+ {
+ "match": "(?<=[0-9a-fA-F])'(?=[0-9a-fA-F])",
+ "name": "punctuation.separator.constant.numeric"
+ }
+ ]
+ },
+ "3": {
+ "name": "punctuation.separator.constant.numeric"
+ },
+ "5": {
+ "name": "keyword.other.unit.exponent.decimal.c"
+ },
+ "6": {
+ "name": "keyword.operator.plus.exponent.decimal.c"
+ },
+ "7": {
+ "name": "keyword.operator.minus.exponent.decimal.c"
+ },
+ "8": {
+ "name": "constant.numeric.exponent.decimal.c",
+ "patterns": [
+ {
+ "match": "(?<=[0-9a-fA-F])'(?=[0-9a-fA-F])",
+ "name": "punctuation.separator.constant.numeric"
+ }
+ ]
+ },
+ "9": {
+ "name": "keyword.other.unit.suffix.integer.c"
+ }
+ }
+ },
+ {
+ "match": "(?:(?:[0-9a-zA-Z_\\.]|')|(?<=[eEpP])[+-])+",
+ "name": "invalid.illegal.constant.numeric"
+ }
+ ]
+ }
+ ]
+ }
+ }
+ },
+ "operators": {
+ "patterns": [
+ {
+ "match": "(?<![\\w$])(sizeof)(?![\\w$])",
+ "name": "keyword.operator.sizeof.c"
+ },
+ {
+ "match": "--",
+ "name": "keyword.operator.decrement.c"
+ },
+ {
+ "match": "\\+\\+",
+ "name": "keyword.operator.increment.c"
+ },
+ {
+ "match": "%=|\\+=|-=|\\*=|(?<!\\()/=",
+ "name": "keyword.operator.assignment.compound.c"
+ },
+ {
+ "match": "&=|\\^=|<<=|>>=|\\|=",
+ "name": "keyword.operator.assignment.compound.bitwise.c"
+ },
+ {
+ "match": "<<|>>",
+ "name": "keyword.operator.bitwise.shift.c"
+ },
+ {
+ "match": "!=|<=|>=|==|<|>",
+ "name": "keyword.operator.comparison.c"
+ },
+ {
+ "match": "&&|!|\\|\\|",
+ "name": "keyword.operator.logical.c"
+ },
+ {
+ "match": "&|\\||\\^|~",
+ "name": "keyword.operator.c"
+ },
+ {
+ "match": "=",
+ "name": "keyword.operator.assignment.c"
+ },
+ {
+ "match": "%|\\*|/|-|\\+",
+ "name": "keyword.operator.c"
+ },
+ {
+ "begin": "(\\?)",
+ "beginCaptures": {
+ "1": {
+ "name": "keyword.operator.ternary.c"
+ }
+ },
+ "end": "(:)",
+ "endCaptures": {
+ "1": {
+ "name": "keyword.operator.ternary.c"
+ }
+ },
+ "patterns": [
+ {
+ "include": "#function-call-innards"
+ },
+ {
+ "include": "$base"
+ }
+ ]
+ }
+ ]
+ },
+ "parens": {
+ "name": "meta.parens.c",
+ "begin": "\\(",
+ "beginCaptures": {
+ "0": {
+ "name": "punctuation.section.parens.begin.bracket.round.c"
+ }
+ },
+ "end": "\\)",
+ "endCaptures": {
+ "0": {
+ "name": "punctuation.section.parens.end.bracket.round.c"
+ }
+ },
+ "patterns": [
+ {
+ "include": "$base"
+ }
+ ]
+ },
+ "parens-block": {
+ "name": "meta.parens.block.c",
+ "begin": "\\(",
+ "beginCaptures": {
+ "0": {
+ "name": "punctuation.section.parens.begin.bracket.round.c"
+ }
+ },
+ "end": "\\)",
+ "endCaptures": {
+ "0": {
+ "name": "punctuation.section.parens.end.bracket.round.c"
+ }
+ },
+ "patterns": [
+ {
+ "include": "#block_innards"
+ },
+ {
+ "match": "(?-mix:(?<!:):(?!:))",
+ "name": "punctuation.range-based.c"
+ }
+ ]
+ },
+ "pragma-mark": {
+ "captures": {
+ "1": {
+ "name": "meta.preprocessor.pragma.c"
+ },
+ "2": {
+ "name": "keyword.control.directive.pragma.pragma-mark.c"
+ },
+ "3": {
+ "name": "punctuation.definition.directive.c"
+ },
+ "4": {
+ "name": "entity.name.tag.pragma-mark.c"
+ }
+ },
+ "match": "^\\s*(((#)\\s*pragma\\s+mark)\\s+(.*))",
+ "name": "meta.section.c"
+ },
+ "predefined_macros": {
+ "patterns": [
+ {
+ "match": "\\b(__cplusplus|__DATE__|__FILE__|__LINE__|__STDC__|__STDC_HOSTED__|__STDC_NO_COMPLEX__|__STDC_VERSION__|__STDCPP_THREADS__|__TIME__|NDEBUG|__OBJC__|__ASSEMBLER__|__ATOM__|__AVX__|__AVX2__|_CHAR_UNSIGNED|__CLR_VER|_CONTROL_FLOW_GUARD|__COUNTER__|__cplusplus_cli|__cplusplus_winrt|_CPPRTTI|_CPPUNWIND|_DEBUG|_DLL|__FUNCDNAME__|__FUNCSIG__|__FUNCTION__|_INTEGRAL_MAX_BITS|__INTELLISENSE__|_ISO_VOLATILE|_KERNEL_MODE|_M_AMD64|_M_ARM|_M_ARM_ARMV7VE|_M_ARM_FP|_M_ARM64|_M_CEE|_ [...]
+ "captures": {
+ "1": {
+ "name": "entity.name.other.preprocessor.macro.predefined.$1.c"
+ }
+ }
+ },
+ {
+ "match": "\\b__([A-Z_]+)__\\b",
+ "name": "entity.name.other.preprocessor.macro.predefined.probably.$1.c"
+ }
+ ]
+ },
+ "preprocessor-rule-conditional": {
+ "patterns": [
+ {
+ "begin": "^\\s*((#)\\s*if(?:n?def)?\\b)",
+ "beginCaptures": {
+ "0": {
+ "name": "meta.preprocessor.c"
+ },
+ "1": {
+ "name": "keyword.control.directive.conditional.c"
+ },
+ "2": {
+ "name": "punctuation.definition.directive.c"
+ }
+ },
+ "end": "^\\s*((#)\\s*endif\\b)",
+ "endCaptures": {
+ "0": {
+ "name": "meta.preprocessor.c"
+ },
+ "1": {
+ "name": "keyword.control.directive.conditional.c"
+ },
+ "2": {
+ "name": "punctuation.definition.directive.c"
+ }
+ },
+ "patterns": [
+ {
+ "begin": "\\G(?=.)(?!//|/\\*(?!.*\\\\\\s*\\n))",
+ "end": "(?=//)|(?=/\\*(?!.*\\\\\\s*\\n))|(?<!\\\\)(?=\\n)",
+ "name": "meta.preprocessor.c",
+ "patterns": [
+ {
+ "include": "#preprocessor-rule-conditional-line"
+ }
+ ]
+ },
+ {
+ "include": "#preprocessor-rule-enabled-elif"
+ },
+ {
+ "include": "#preprocessor-rule-enabled-else"
+ },
+ {
+ "include": "#preprocessor-rule-disabled-elif"
+ },
+ {
+ "begin": "^\\s*((#)\\s*elif\\b)",
+ "beginCaptures": {
+ "1": {
+ "name": "keyword.control.directive.conditional.c"
+ },
+ "2": {
+ "name": "punctuation.definition.directive.c"
+ }
+ },
+ "end": "(?=//)|(?=/\\*(?!.*\\\\\\s*\\n))|(?<!\\\\)(?=\\n)",
+ "name": "meta.preprocessor.c",
+ "patterns": [
+ {
+ "include": "#preprocessor-rule-conditional-line"
+ }
+ ]
+ },
+ {
+ "include": "$base"
+ }
+ ]
+ },
+ {
+ "match": "^\\s*#\\s*(else|elif|endif)\\b",
+ "captures": {
+ "0": {
+ "name": "invalid.illegal.stray-$1.c"
+ }
+ }
+ }
+ ]
+ },
+ "preprocessor-rule-conditional-block": {
+ "patterns": [
+ {
+ "begin": "^\\s*((#)\\s*if(?:n?def)?\\b)",
+ "beginCaptures": {
+ "0": {
+ "name": "meta.preprocessor.c"
+ },
+ "1": {
+ "name": "keyword.control.directive.conditional.c"
+ },
+ "2": {
+ "name": "punctuation.definition.directive.c"
+ }
+ },
+ "end": "^\\s*((#)\\s*endif\\b)",
+ "endCaptures": {
+ "0": {
+ "name": "meta.preprocessor.c"
+ },
+ "1": {
+ "name": "keyword.control.directive.conditional.c"
+ },
+ "2": {
+ "name": "punctuation.definition.directive.c"
+ }
+ },
+ "patterns": [
+ {
+ "begin": "\\G(?=.)(?!//|/\\*(?!.*\\\\\\s*\\n))",
+ "end": "(?=//)|(?=/\\*(?!.*\\\\\\s*\\n))|(?<!\\\\)(?=\\n)",
+ "name": "meta.preprocessor.c",
+ "patterns": [
+ {
+ "include": "#preprocessor-rule-conditional-line"
+ }
+ ]
+ },
+ {
+ "include": "#preprocessor-rule-enabled-elif-block"
+ },
+ {
+ "include": "#preprocessor-rule-enabled-else-block"
+ },
+ {
+ "include": "#preprocessor-rule-disabled-elif"
+ },
+ {
+ "begin": "^\\s*((#)\\s*elif\\b)",
+ "beginCaptures": {
+ "1": {
+ "name": "keyword.control.directive.conditional.c"
+ },
+ "2": {
+ "name": "punctuation.definition.directive.c"
+ }
+ },
+ "end": "(?=//)|(?=/\\*(?!.*\\\\\\s*\\n))|(?<!\\\\)(?=\\n)",
+ "name": "meta.preprocessor.c",
+ "patterns": [
+ {
+ "include": "#preprocessor-rule-conditional-line"
+ }
+ ]
+ },
+ {
+ "include": "#block_innards"
+ }
+ ]
+ },
+ {
+ "match": "^\\s*#\\s*(else|elif|endif)\\b",
+ "captures": {
+ "0": {
+ "name": "invalid.illegal.stray-$1.c"
+ }
+ }
+ }
+ ]
+ },
+ "preprocessor-rule-conditional-line": {
+ "patterns": [
+ {
+ "match": "(?:\\bdefined\\b\\s*$)|(?:\\bdefined\\b(?=\\s*\\(*\\s*(?:(?!defined\\b)[a-zA-Z_$][\\w$]*\\b)\\s*\\)*\\s*(?:\\n|//|/\\*|\\?|\\:|&&|\\|\\||\\\\\\s*\\n)))",
+ "name": "keyword.control.directive.conditional.c"
+ },
+ {
+ "match": "\\bdefined\\b",
+ "name": "invalid.illegal.macro-name.c"
+ },
+ {
+ "include": "#comments"
+ },
+ {
+ "include": "#strings"
+ },
+ {
+ "include": "#numbers"
+ },
+ {
+ "begin": "\\?",
+ "beginCaptures": {
+ "0": {
+ "name": "keyword.operator.ternary.c"
+ }
+ },
+ "end": ":",
+ "endCaptures": {
+ "0": {
+ "name": "keyword.operator.ternary.c"
+ }
+ },
+ "patterns": [
+ {
+ "include": "#preprocessor-rule-conditional-line"
+ }
+ ]
+ },
+ {
+ "include": "#operators"
+ },
+ {
+ "match": "\\b(NULL|true|false|TRUE|FALSE)\\b",
+ "name": "constant.language.c"
+ },
+ {
+ "match": "[a-zA-Z_$][\\w$]*",
+ "name": "entity.name.function.preprocessor.c"
+ },
+ {
+ "include": "#line_continuation_character"
+ },
+ {
+ "begin": "\\(",
+ "beginCaptures": {
+ "0": {
+ "name": "punctuation.section.parens.begin.bracket.round.c"
+ }
+ },
+ "end": "\\)|(?=//)|(?=/\\*(?!.*\\\\\\s*\\n))|(?<!\\\\)(?=\\n)",
+ "endCaptures": {
+ "0": {
+ "name": "punctuation.section.parens.end.bracket.round.c"
+ }
+ },
+ "patterns": [
+ {
+ "include": "#preprocessor-rule-conditional-line"
+ }
+ ]
+ }
+ ]
+ },
+ "preprocessor-rule-define-line-blocks": {
+ "patterns": [
+ {
+ "begin": "{",
+ "beginCaptures": {
+ "0": {
+ "name": "punctuation.section.block.begin.bracket.curly.c"
+ }
+ },
+ "end": "}|(?=\\s*#\\s*(?:elif|else|endif)\\b)|(?<!\\\\)(?=\\s*\\n)",
+ "endCaptures": {
+ "0": {
+ "name": "punctuation.section.block.end.bracket.curly.c"
+ }
+ },
+ "patterns": [
+ {
+ "include": "#preprocessor-rule-define-line-blocks"
+ },
+ {
+ "include": "#preprocessor-rule-define-line-contents"
+ }
+ ]
+ },
+ {
+ "include": "#preprocessor-rule-define-line-contents"
+ }
+ ]
+ },
+ "preprocessor-rule-define-line-contents": {
+ "patterns": [
+ {
+ "include": "#vararg_ellipses"
+ },
+ {
+ "begin": "{",
+ "beginCaptures": {
+ "0": {
+ "name": "punctuation.section.block.begin.bracket.curly.c"
+ }
+ },
+ "end": "}|(?=\\s*#\\s*(?:elif|else|endif)\\b)|(?<!\\\\)(?=\\s*\\n)",
+ "endCaptures": {
+ "0": {
+ "name": "punctuation.section.block.end.bracket.curly.c"
+ }
+ },
+ "name": "meta.block.c",
+ "patterns": [
+ {
+ "include": "#preprocessor-rule-define-line-blocks"
+ }
+ ]
+ },
+ {
+ "match": "\\(",
+ "name": "punctuation.section.parens.begin.bracket.round.c"
+ },
+ {
+ "match": "\\)",
+ "name": "punctuation.section.parens.end.bracket.round.c"
+ },
+ {
+ "begin": "(?x)\n(?!(?:while|for|do|if|else|switch|catch|enumerate|return|typeid|alignof|alignas|sizeof|[cr]?iterate|and|and_eq|bitand|bitor|compl|not|not_eq|or|or_eq|typeid|xor|xor_eq|alignof|alignas|asm|__asm__|auto|bool|_Bool|char|_Complex|double|enum|float|_Imaginary|int|long|short|signed|struct|typedef|union|unsigned|void)\\s*\\()\n(?=\n (?:[A-Za-z_][A-Za-z0-9_]*+|::)++\\s*\\( # actual name\n |\n (?:(?<=operator)(?:[-*&<>=+!]+|\\(\\)|\\[\\]))\\s*\\(\n)",
+ "end": "(?<=\\))(?!\\w)|(?<!\\\\)(?=\\s*\\n)",
+ "name": "meta.function.c",
+ "patterns": [
+ {
+ "include": "#preprocessor-rule-define-line-functions"
+ }
+ ]
+ },
+ {
+ "begin": "\"",
+ "beginCaptures": {
+ "0": {
+ "name": "punctuation.definition.string.begin.c"
+ }
+ },
+ "end": "\"|(?<!\\\\)(?=\\s*\\n)",
+ "endCaptures": {
+ "0": {
+ "name": "punctuation.definition.string.end.c"
+ }
+ },
+ "name": "string.quoted.double.c",
+ "patterns": [
+ {
+ "include": "#string_escaped_char"
+ },
+ {
+ "include": "#string_placeholder"
+ },
+ {
+ "include": "#line_continuation_character"
+ }
+ ]
+ },
+ {
+ "begin": "'",
+ "beginCaptures": {
+ "0": {
+ "name": "punctuation.definition.string.begin.c"
+ }
+ },
+ "end": "'|(?<!\\\\)(?=\\s*\\n)",
+ "endCaptures": {
+ "0": {
+ "name": "punctuation.definition.string.end.c"
+ }
+ },
+ "name": "string.quoted.single.c",
+ "patterns": [
+ {
+ "include": "#string_escaped_char"
+ },
+ {
+ "include": "#line_continuation_character"
+ }
+ ]
+ },
+ {
+ "include": "#method_access"
+ },
+ {
+ "include": "#member_access"
+ },
+ {
+ "include": "$base"
+ }
+ ]
+ },
+ "preprocessor-rule-define-line-functions": {
+ "patterns": [
+ {
+ "include": "#comments"
+ },
+ {
+ "include": "#storage_types"
+ },
+ {
+ "include": "#vararg_ellipses"
+ },
+ {
+ "include": "#method_access"
+ },
+ {
+ "include": "#member_access"
+ },
+ {
+ "include": "#operators"
+ },
+ {
+ "begin": "(?x)\n(?!(?:while|for|do|if|else|switch|catch|enumerate|return|typeid|alignof|alignas|sizeof|[cr]?iterate|and|and_eq|bitand|bitor|compl|not|not_eq|or|or_eq|typeid|xor|xor_eq|alignof|alignas)\\s*\\()\n(\n(?:[A-Za-z_][A-Za-z0-9_]*+|::)++ # actual name\n|\n(?:(?<=operator)(?:[-*&<>=+!]+|\\(\\)|\\[\\]))\n)\n\\s*(\\()",
+ "beginCaptures": {
+ "1": {
+ "name": "entity.name.function.c"
+ },
+ "2": {
+ "name": "punctuation.section.arguments.begin.bracket.round.c"
+ }
+ },
+ "end": "(\\))|(?<!\\\\)(?=\\s*\\n)",
+ "endCaptures": {
+ "1": {
+ "name": "punctuation.section.arguments.end.bracket.round.c"
+ }
+ },
+ "patterns": [
+ {
+ "include": "#preprocessor-rule-define-line-functions"
+ }
+ ]
+ },
+ {
+ "begin": "\\(",
+ "beginCaptures": {
+ "0": {
+ "name": "punctuation.section.parens.begin.bracket.round.c"
+ }
+ },
+ "end": "(\\))|(?<!\\\\)(?=\\s*\\n)",
+ "endCaptures": {
+ "1": {
+ "name": "punctuation.section.parens.end.bracket.round.c"
+ }
+ },
+ "patterns": [
+ {
+ "include": "#preprocessor-rule-define-line-functions"
+ }
+ ]
+ },
+ {
+ "include": "#preprocessor-rule-define-line-contents"
+ }
+ ]
+ },
+ "preprocessor-rule-disabled": {
+ "patterns": [
+ {
+ "begin": "^\\s*((#)\\s*if\\b)(?=\\s*\\(*\\b0+\\b\\)*\\s*(?:$|//|/\\*))",
+ "beginCaptures": {
+ "0": {
+ "name": "meta.preprocessor.c"
+ },
+ "1": {
+ "name": "keyword.control.directive.conditional.c"
+ },
+ "2": {
+ "name": "punctuation.definition.directive.c"
+ }
+ },
+ "end": "^\\s*((#)\\s*endif\\b)",
+ "endCaptures": {
+ "0": {
+ "name": "meta.preprocessor.c"
+ },
+ "1": {
+ "name": "keyword.control.directive.conditional.c"
+ },
+ "2": {
+ "name": "punctuation.definition.directive.c"
+ }
+ },
+ "patterns": [
+ {
+ "begin": "\\G(?=.)(?!//|/\\*(?!.*\\\\\\s*\\n))",
+ "end": "(?=//)|(?=/\\*(?!.*\\\\\\s*\\n))|(?=\\n)",
+ "name": "meta.preprocessor.c",
+ "patterns": [
+ {
+ "include": "#preprocessor-rule-conditional-line"
+ }
+ ]
+ },
+ {
+ "include": "#comments"
+ },
+ {
+ "include": "#preprocessor-rule-enabled-elif"
+ },
+ {
+ "include": "#preprocessor-rule-enabled-else"
+ },
+ {
+ "include": "#preprocessor-rule-disabled-elif"
+ },
+ {
+ "begin": "^\\s*((#)\\s*elif\\b)",
+ "beginCaptures": {
+ "0": {
+ "name": "meta.preprocessor.c"
+ },
+ "1": {
+ "name": "keyword.control.directive.conditional.c"
+ },
+ "2": {
+ "name": "punctuation.definition.directive.c"
+ }
+ },
+ "end": "(?=^\\s*((#)\\s*(?:elif|else|endif)\\b))",
+ "patterns": [
+ {
+ "begin": "\\G(?=.)(?!//|/\\*(?!.*\\\\\\s*\\n))",
+ "end": "(?=//)|(?=/\\*(?!.*\\\\\\s*\\n))|(?<!\\\\)(?=\\n)",
+ "name": "meta.preprocessor.c",
+ "patterns": [
+ {
+ "include": "#preprocessor-rule-conditional-line"
+ }
+ ]
+ },
+ {
+ "include": "$base"
+ }
+ ]
+ },
+ {
+ "begin": "\\n",
+ "end": "(?=^\\s*((#)\\s*(?:else|elif|endif)\\b))",
+ "contentName": "comment.block.preprocessor.if-branch.c",
+ "patterns": [
+ {
+ "include": "#disabled"
+ },
+ {
+ "include": "#pragma-mark"
+ }
+ ]
+ }
+ ]
+ }
+ ]
+ },
+ "preprocessor-rule-disabled-block": {
+ "patterns": [
+ {
+ "begin": "^\\s*((#)\\s*if\\b)(?=\\s*\\(*\\b0+\\b\\)*\\s*(?:$|//|/\\*))",
+ "beginCaptures": {
+ "0": {
+ "name": "meta.preprocessor.c"
+ },
+ "1": {
+ "name": "keyword.control.directive.conditional.c"
+ },
+ "2": {
+ "name": "punctuation.definition.directive.c"
+ }
+ },
+ "end": "^\\s*((#)\\s*endif\\b)",
+ "endCaptures": {
+ "0": {
+ "name": "meta.preprocessor.c"
+ },
+ "1": {
+ "name": "keyword.control.directive.conditional.c"
+ },
+ "2": {
+ "name": "punctuation.definition.directive.c"
+ }
+ },
+ "patterns": [
+ {
+ "begin": "\\G(?=.)(?!//|/\\*(?!.*\\\\\\s*\\n))",
+ "end": "(?=//)|(?=/\\*(?!.*\\\\\\s*\\n))|(?=\\n)",
+ "name": "meta.preprocessor.c",
+ "patterns": [
+ {
+ "include": "#preprocessor-rule-conditional-line"
+ }
+ ]
+ },
+ {
+ "include": "#comments"
+ },
+ {
+ "include": "#preprocessor-rule-enabled-elif-block"
+ },
+ {
+ "include": "#preprocessor-rule-enabled-else-block"
+ },
+ {
+ "include": "#preprocessor-rule-disabled-elif"
+ },
+ {
+ "begin": "^\\s*((#)\\s*elif\\b)",
+ "beginCaptures": {
+ "0": {
+ "name": "meta.preprocessor.c"
+ },
+ "1": {
+ "name": "keyword.control.directive.conditional.c"
+ },
+ "2": {
+ "name": "punctuation.definition.directive.c"
+ }
+ },
+ "end": "(?=^\\s*((#)\\s*(?:elif|else|endif)\\b))",
+ "patterns": [
+ {
+ "begin": "\\G(?=.)(?!//|/\\*(?!.*\\\\\\s*\\n))",
+ "end": "(?=//)|(?=/\\*(?!.*\\\\\\s*\\n))|(?<!\\\\)(?=\\n)",
+ "name": "meta.preprocessor.c",
+ "patterns": [
+ {
+ "include": "#preprocessor-rule-conditional-line"
+ }
+ ]
+ },
+ {
+ "include": "#block_innards"
+ }
+ ]
+ },
+ {
+ "begin": "\\n",
+ "end": "(?=^\\s*((#)\\s*(?:else|elif|endif)\\b))",
+ "contentName": "comment.block.preprocessor.if-branch.in-block.c",
+ "patterns": [
+ {
+ "include": "#disabled"
+ },
+ {
+ "include": "#pragma-mark"
+ }
+ ]
+ }
+ ]
+ }
+ ]
+ },
+ "preprocessor-rule-disabled-elif": {
+ "begin": "^\\s*((#)\\s*elif\\b)(?=\\s*\\(*\\b0+\\b\\)*\\s*(?:$|//|/\\*))",
+ "beginCaptures": {
+ "0": {
+ "name": "meta.preprocessor.c"
+ },
+ "1": {
+ "name": "keyword.control.directive.conditional.c"
+ },
+ "2": {
+ "name": "punctuation.definition.directive.c"
+ }
+ },
+ "end": "(?=^\\s*((#)\\s*(?:elif|else|endif)\\b))",
+ "patterns": [
+ {
+ "begin": "\\G(?=.)(?!//|/\\*(?!.*\\\\\\s*\\n))",
+ "end": "(?=//)|(?=/\\*(?!.*\\\\\\s*\\n))|(?<!\\\\)(?=\\n)",
+ "name": "meta.preprocessor.c",
+ "patterns": [
+ {
+ "include": "#preprocessor-rule-conditional-line"
+ }
+ ]
+ },
+ {
+ "include": "#comments"
+ },
+ {
+ "begin": "\\n",
+ "end": "(?=^\\s*((#)\\s*(?:else|elif|endif)\\b))",
+ "contentName": "comment.block.preprocessor.elif-branch.c",
+ "patterns": [
+ {
+ "include": "#disabled"
+ },
+ {
+ "include": "#pragma-mark"
+ }
+ ]
+ }
+ ]
+ },
+ "preprocessor-rule-enabled": {
+ "patterns": [
+ {
+ "begin": "^\\s*((#)\\s*if\\b)(?=\\s*\\(*\\b0*1\\b\\)*\\s*(?:$|//|/\\*))",
+ "beginCaptures": {
+ "0": {
+ "name": "meta.preprocessor.c"
+ },
+ "1": {
+ "name": "keyword.control.directive.conditional.c"
+ },
+ "2": {
+ "name": "punctuation.definition.directive.c"
+ },
+ "3": {
+ "name": "constant.numeric.preprocessor.c"
+ }
+ },
+ "end": "^\\s*((#)\\s*endif\\b)",
+ "endCaptures": {
+ "0": {
+ "name": "meta.preprocessor.c"
+ },
+ "1": {
+ "name": "keyword.control.directive.conditional.c"
+ },
+ "2": {
+ "name": "punctuation.definition.directive.c"
+ }
+ },
+ "patterns": [
+ {
+ "begin": "\\G(?=.)(?!//|/\\*(?!.*\\\\\\s*\\n))",
+ "end": "(?=//)|(?=/\\*(?!.*\\\\\\s*\\n))|(?=\\n)",
+ "name": "meta.preprocessor.c",
+ "patterns": [
+ {
+ "include": "#preprocessor-rule-conditional-line"
+ }
+ ]
+ },
+ {
+ "include": "#comments"
+ },
+ {
+ "begin": "^\\s*((#)\\s*else\\b)",
+ "beginCaptures": {
+ "0": {
+ "name": "meta.preprocessor.c"
+ },
+ "1": {
+ "name": "keyword.control.directive.conditional.c"
+ },
+ "2": {
+ "name": "punctuation.definition.directive.c"
+ }
+ },
+ "end": "(?=^\\s*((#)\\s*endif\\b))",
+ "contentName": "comment.block.preprocessor.else-branch.c",
+ "patterns": [
+ {
+ "include": "#disabled"
+ },
+ {
+ "include": "#pragma-mark"
+ }
+ ]
+ },
+ {
+ "begin": "^\\s*((#)\\s*elif\\b)",
+ "beginCaptures": {
+ "0": {
+ "name": "meta.preprocessor.c"
+ },
+ "1": {
+ "name": "keyword.control.directive.conditional.c"
+ },
+ "2": {
+ "name": "punctuation.definition.directive.c"
+ }
+ },
+ "end": "(?=^\\s*((#)\\s*(?:else|elif|endif)\\b))",
+ "contentName": "comment.block.preprocessor.if-branch.c",
+ "patterns": [
+ {
+ "include": "#disabled"
+ },
+ {
+ "include": "#pragma-mark"
+ }
+ ]
+ },
+ {
+ "begin": "\\n",
+ "end": "(?=^\\s*((#)\\s*(?:else|elif|endif)\\b))",
+ "patterns": [
+ {
+ "include": "$base"
+ }
+ ]
+ }
+ ]
+ }
+ ]
+ },
+ "preprocessor-rule-enabled-block": {
+ "patterns": [
+ {
+ "begin": "^\\s*((#)\\s*if\\b)(?=\\s*\\(*\\b0*1\\b\\)*\\s*(?:$|//|/\\*))",
+ "beginCaptures": {
+ "0": {
+ "name": "meta.preprocessor.c"
+ },
+ "1": {
+ "name": "keyword.control.directive.conditional.c"
+ },
+ "2": {
+ "name": "punctuation.definition.directive.c"
+ }
+ },
+ "end": "^\\s*((#)\\s*endif\\b)",
+ "endCaptures": {
+ "0": {
+ "name": "meta.preprocessor.c"
+ },
+ "1": {
+ "name": "keyword.control.directive.conditional.c"
+ },
+ "2": {
+ "name": "punctuation.definition.directive.c"
+ }
+ },
+ "patterns": [
+ {
+ "begin": "\\G(?=.)(?!//|/\\*(?!.*\\\\\\s*\\n))",
+ "end": "(?=//)|(?=/\\*(?!.*\\\\\\s*\\n))|(?=\\n)",
+ "name": "meta.preprocessor.c",
+ "patterns": [
+ {
+ "include": "#preprocessor-rule-conditional-line"
+ }
+ ]
+ },
+ {
+ "include": "#comments"
+ },
+ {
+ "begin": "^\\s*((#)\\s*else\\b)",
+ "beginCaptures": {
+ "0": {
+ "name": "meta.preprocessor.c"
+ },
+ "1": {
+ "name": "keyword.control.directive.conditional.c"
+ },
+ "2": {
+ "name": "punctuation.definition.directive.c"
+ }
+ },
+ "end": "(?=^\\s*((#)\\s*endif\\b))",
+ "contentName": "comment.block.preprocessor.else-branch.in-block.c",
+ "patterns": [
+ {
+ "include": "#disabled"
+ },
+ {
+ "include": "#pragma-mark"
+ }
+ ]
+ },
+ {
+ "begin": "^\\s*((#)\\s*elif\\b)",
+ "beginCaptures": {
+ "0": {
+ "name": "meta.preprocessor.c"
+ },
+ "1": {
+ "name": "keyword.control.directive.conditional.c"
+ },
+ "2": {
+ "name": "punctuation.definition.directive.c"
+ }
+ },
+ "end": "(?=^\\s*((#)\\s*(?:else|elif|endif)\\b))",
+ "contentName": "comment.block.preprocessor.if-branch.in-block.c",
+ "patterns": [
+ {
+ "include": "#disabled"
+ },
+ {
+ "include": "#pragma-mark"
+ }
+ ]
+ },
+ {
+ "begin": "\\n",
+ "end": "(?=^\\s*((#)\\s*(?:else|elif|endif)\\b))",
+ "patterns": [
+ {
+ "include": "#block_innards"
+ }
+ ]
+ }
+ ]
+ }
+ ]
+ },
+ "preprocessor-rule-enabled-elif": {
+ "begin": "^\\s*((#)\\s*elif\\b)(?=\\s*\\(*\\b0*1\\b\\)*\\s*(?:$|//|/\\*))",
+ "beginCaptures": {
+ "0": {
+ "name": "meta.preprocessor.c"
+ },
+ "1": {
+ "name": "keyword.control.directive.conditional.c"
+ },
+ "2": {
+ "name": "punctuation.definition.directive.c"
+ }
+ },
+ "end": "(?=^\\s*((#)\\s*endif\\b))",
+ "patterns": [
+ {
+ "begin": "\\G(?=.)(?!//|/\\*(?!.*\\\\\\s*\\n))",
+ "end": "(?=//)|(?=/\\*(?!.*\\\\\\s*\\n))|(?<!\\\\)(?=\\n)",
+ "name": "meta.preprocessor.c",
+ "patterns": [
+ {
+ "include": "#preprocessor-rule-conditional-line"
+ }
+ ]
+ },
+ {
+ "include": "#comments"
+ },
+ {
+ "begin": "\\n",
+ "end": "(?=^\\s*((#)\\s*(?:endif)\\b))",
+ "patterns": [
+ {
+ "begin": "^\\s*((#)\\s*(else)\\b)",
+ "beginCaptures": {
+ "0": {
+ "name": "meta.preprocessor.c"
+ },
+ "1": {
+ "name": "keyword.control.directive.conditional.c"
+ },
+ "2": {
+ "name": "punctuation.definition.directive.c"
+ }
+ },
+ "end": "(?=^\\s*((#)\\s*endif\\b))",
+ "contentName": "comment.block.preprocessor.elif-branch.c",
+ "patterns": [
+ {
+ "include": "#disabled"
+ },
+ {
+ "include": "#pragma-mark"
+ }
+ ]
+ },
+ {
+ "begin": "^\\s*((#)\\s*(elif)\\b)",
+ "beginCaptures": {
+ "0": {
+ "name": "meta.preprocessor.c"
+ },
+ "1": {
+ "name": "keyword.control.directive.conditional.c"
+ },
+ "2": {
+ "name": "punctuation.definition.directive.c"
+ }
+ },
+ "end": "(?=^\\s*((#)\\s*(?:else|elif|endif)\\b))",
+ "contentName": "comment.block.preprocessor.elif-branch.c",
+ "patterns": [
+ {
+ "include": "#disabled"
+ },
+ {
+ "include": "#pragma-mark"
+ }
+ ]
+ },
+ {
+ "include": "$base"
+ }
+ ]
+ }
+ ]
+ },
+ "preprocessor-rule-enabled-elif-block": {
+ "begin": "^\\s*((#)\\s*elif\\b)(?=\\s*\\(*\\b0*1\\b\\)*\\s*(?:$|//|/\\*))",
+ "beginCaptures": {
+ "0": {
+ "name": "meta.preprocessor.c"
+ },
+ "1": {
+ "name": "keyword.control.directive.conditional.c"
+ },
+ "2": {
+ "name": "punctuation.definition.directive.c"
+ }
+ },
+ "end": "(?=^\\s*((#)\\s*endif\\b))",
+ "patterns": [
+ {
+ "begin": "\\G(?=.)(?!//|/\\*(?!.*\\\\\\s*\\n))",
+ "end": "(?=//)|(?=/\\*(?!.*\\\\\\s*\\n))|(?<!\\\\)(?=\\n)",
+ "name": "meta.preprocessor.c",
+ "patterns": [
+ {
+ "include": "#preprocessor-rule-conditional-line"
+ }
+ ]
+ },
+ {
+ "include": "#comments"
+ },
+ {
+ "begin": "\\n",
+ "end": "(?=^\\s*((#)\\s*(?:endif)\\b))",
+ "patterns": [
+ {
+ "begin": "^\\s*((#)\\s*(else)\\b)",
+ "beginCaptures": {
+ "0": {
+ "name": "meta.preprocessor.c"
+ },
+ "1": {
+ "name": "keyword.control.directive.conditional.c"
+ },
+ "2": {
+ "name": "punctuation.definition.directive.c"
+ }
+ },
+ "end": "(?=^\\s*((#)\\s*endif\\b))",
+ "contentName": "comment.block.preprocessor.elif-branch.in-block.c",
+ "patterns": [
+ {
+ "include": "#disabled"
+ },
+ {
+ "include": "#pragma-mark"
+ }
+ ]
+ },
+ {
+ "begin": "^\\s*((#)\\s*(elif)\\b)",
+ "beginCaptures": {
+ "0": {
+ "name": "meta.preprocessor.c"
+ },
+ "1": {
+ "name": "keyword.control.directive.conditional.c"
+ },
+ "2": {
+ "name": "punctuation.definition.directive.c"
+ }
+ },
+ "end": "(?=^\\s*((#)\\s*(?:else|elif|endif)\\b))",
+ "contentName": "comment.block.preprocessor.elif-branch.c",
+ "patterns": [
+ {
+ "include": "#disabled"
+ },
+ {
+ "include": "#pragma-mark"
+ }
+ ]
+ },
+ {
+ "include": "#block_innards"
+ }
+ ]
+ }
+ ]
+ },
+ "preprocessor-rule-enabled-else": {
+ "begin": "^\\s*((#)\\s*else\\b)",
+ "beginCaptures": {
+ "0": {
+ "name": "meta.preprocessor.c"
+ },
+ "1": {
+ "name": "keyword.control.directive.conditional.c"
+ },
+ "2": {
+ "name": "punctuation.definition.directive.c"
+ }
+ },
+ "end": "(?=^\\s*((#)\\s*endif\\b))",
+ "patterns": [
+ {
+ "include": "$base"
+ }
+ ]
+ },
+ "preprocessor-rule-enabled-else-block": {
+ "begin": "^\\s*((#)\\s*else\\b)",
+ "beginCaptures": {
+ "0": {
+ "name": "meta.preprocessor.c"
+ },
+ "1": {
+ "name": "keyword.control.directive.conditional.c"
+ },
+ "2": {
+ "name": "punctuation.definition.directive.c"
+ }
+ },
+ "end": "(?=^\\s*((#)\\s*endif\\b))",
+ "patterns": [
+ {
+ "include": "#block_innards"
+ }
+ ]
+ },
+ "probably_a_parameter": {
+ "match": "(?<=(?:[a-zA-Z_0-9] |[&*>\\]\\)]))\\s*([a-zA-Z_]\\w*)\\s*(?=(?:\\[\\]\\s*)?(?:,|\\)))",
+ "captures": {
+ "1": {
+ "name": "variable.parameter.probably.c"
+ }
+ }
+ },
+ "static_assert": {
+ "begin": "((?>(?:(?:(?>(?<!\\s)\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))((?<!\\w)static_assert|_Static_assert(?!\\w))((?>(?:(?:(?>(?<!\\s)\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))(\\()",
+ "beginCaptures": {
+ "1": {
+ "patterns": [
+ {
+ "include": "#inline_comment"
+ }
+ ]
+ },
+ "2": {
+ "name": "comment.block.c punctuation.definition.comment.begin.c"
+ },
+ "3": {
+ "name": "comment.block.c"
+ },
+ "4": {
+ "patterns": [
+ {
+ "match": "\\*\\/",
+ "name": "comment.block.c punctuation.definition.comment.end.c"
+ },
+ {
+ "match": "\\*",
+ "name": "comment.block.c"
+ }
+ ]
+ },
+ "5": {
+ "name": "keyword.other.static_assert.c"
+ },
+ "6": {
+ "patterns": [
+ {
+ "include": "#inline_comment"
+ }
+ ]
+ },
+ "7": {
+ "name": "comment.block.c punctuation.definition.comment.begin.c"
+ },
+ "8": {
+ "name": "comment.block.c"
+ },
+ "9": {
+ "patterns": [
+ {
+ "match": "\\*\\/",
+ "name": "comment.block.c punctuation.definition.comment.end.c"
+ },
+ {
+ "match": "\\*",
+ "name": "comment.block.c"
+ }
+ ]
+ },
+ "10": {
+ "name": "punctuation.section.arguments.begin.bracket.round.static_assert.c"
+ }
+ },
+ "end": "(\\))",
+ "endCaptures": {
+ "1": {
+ "name": "punctuation.section.arguments.end.bracket.round.static_assert.c"
+ }
+ },
+ "patterns": [
+ {
+ "name": "meta.static_assert.message.c",
+ "begin": "(,)\\s*(?=(?:L|u8|u|U\\s*\\\")?)",
+ "beginCaptures": {
+ "1": {
+ "name": "punctuation.separator.delimiter.comma.c"
+ }
+ },
+ "end": "(?=\\))",
+ "patterns": [
+ {
+ "include": "#string_context"
+ }
+ ]
+ },
+ {
+ "include": "#evaluation_context"
+ }
+ ]
+ },
+ "storage_types": {
+ "patterns": [
+ {
+ "match": "(?-mix:(?<!\\w)(?:unsigned|signed|double|_Bool|short|float|long|void|char|bool|int)(?!\\w))",
+ "name": "storage.type.built-in.primitive.c"
+ },
+ {
+ "match": "(?-mix:(?<!\\w)(?:atomic_uint_least64_t|atomic_uint_least16_t|atomic_uint_least32_t|pthread_rwlockattr_t|atomic_uint_fast64_t|atomic_uint_fast32_t|atomic_uint_fast16_t|atomic_int_least64_t|atomic_int_least32_t|atomic_int_least16_t|atomic_uint_least8_t|atomic_uint_fast8_t|atomic_int_least8_t|atomic_int_fast16_t|pthread_mutexattr_t|atomic_int_fast32_t|atomic_int_fast64_t|atomic_int_fast8_t|pthread_condattr_t|atomic_ptrdiff_t|pthread_rwlock_t|atomic_uintptr_t|atomic_uint [...]
+ "name": "storage.type.built-in.c"
+ },
+ {
+ "match": "(?-mix:\\b(enum|struct|union)\\b)",
+ "name": "storage.type.$1.c"
+ },
+ {
+ "name": "meta.asm.c",
+ "begin": "(\\b(?:__asm__|asm)\\b)\\s*((?:volatile)?)",
+ "beginCaptures": {
+ "1": {
+ "name": "storage.type.asm.c"
+ },
+ "2": {
+ "name": "storage.modifier.c"
+ }
+ },
+ "end": "(?!\\G)",
+ "patterns": [
+ {
+ "match": "(?:^)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?:\\n|$)",
+ "captures": {
+ "1": {
+ "patterns": [
+ {
+ "include": "#inline_comment"
+ }
+ ]
+ },
+ "2": {
+ "name": "comment.block.c punctuation.definition.comment.begin.c"
+ },
+ "3": {
+ "name": "comment.block.c"
+ },
+ "4": {
+ "patterns": [
+ {
+ "match": "\\*\\/",
+ "name": "comment.block.c punctuation.definition.comment.end.c"
+ },
+ {
+ "match": "\\*",
+ "name": "comment.block.c"
+ }
+ ]
+ }
+ }
+ },
+ {
+ "include": "#comments_context"
+ },
+ {
+ "include": "#comments"
+ },
+ {
+ "begin": "(((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))\\()",
+ "beginCaptures": {
+ "1": {
+ "name": "punctuation.section.parens.begin.bracket.round.assembly.c"
+ },
+ "2": {
+ "patterns": [
+ {
+ "include": "#inline_comment"
+ }
+ ]
+ },
+ "3": {
+ "name": "comment.block.c punctuation.definition.comment.begin.c"
+ },
+ "4": {
+ "name": "comment.block.c"
+ },
+ "5": {
+ "patterns": [
+ {
+ "match": "\\*\\/",
+ "name": "comment.block.c punctuation.definition.comment.end.c"
+ },
+ {
+ "match": "\\*",
+ "name": "comment.block.c"
+ }
+ ]
+ }
+ },
+ "end": "(\\))",
+ "endCaptures": {
+ "1": {
+ "name": "punctuation.section.parens.end.bracket.round.assembly.c"
+ }
+ },
+ "patterns": [
+ {
+ "name": "string.quoted.double.c",
+ "contentName": "meta.embedded.assembly.c",
+ "begin": "(R?)(\")",
+ "beginCaptures": {
+ "1": {
+ "name": "meta.encoding.c"
+ },
+ "2": {
+ "name": "punctuation.definition.string.begin.assembly.c"
+ }
+ },
+ "end": "(\")",
+ "endCaptures": {
+ "1": {
+ "name": "punctuation.definition.string.end.assembly.c"
+ }
+ },
+ "patterns": [
+ {
+ "include": "source.asm"
+ },
+ {
+ "include": "source.x86"
+ },
+ {
+ "include": "source.x86_64"
+ },
+ {
+ "include": "source.arm"
+ },
+ {
+ "include": "#backslash_escapes"
+ },
+ {
+ "include": "#string_escaped_char"
+ }
+ ]
+ },
+ {
+ "begin": "(\\()",
+ "beginCaptures": {
+ "1": {
+ "name": "punctuation.section.parens.begin.bracket.round.assembly.inner.c"
+ }
+ },
+ "end": "(\\))",
+ "endCaptures": {
+ "1": {
+ "name": "punctuation.section.parens.end.bracket.round.assembly.inner.c"
+ }
+ },
+ "patterns": [
+ {
+ "include": "#evaluation_context"
+ }
+ ]
+ },
+ {
+ "match": "\\[((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))([a-zA-Z_]\\w*)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))\\]",
+ "captures": {
+ "1": {
+ "patterns": [
+ {
+ "include": "#inline_comment"
+ }
+ ]
+ },
+ "2": {
+ "name": "comment.block.c punctuation.definition.comment.begin.c"
+ },
+ "3": {
+ "name": "comment.block.c"
+ },
+ "4": {
+ "patterns": [
+ {
+ "match": "\\*\\/",
+ "name": "comment.block.c punctuation.definition.comment.end.c"
+ },
+ {
+ "match": "\\*",
+ "name": "comment.block.c"
+ }
+ ]
+ },
+ "5": {
+ "name": "variable.other.asm.label.c"
+ },
+ "6": {
+ "patterns": [
+ {
+ "include": "#inline_comment"
+ }
+ ]
+ },
+ "7": {
+ "name": "comment.block.c punctuation.definition.comment.begin.c"
+ },
+ "8": {
+ "name": "comment.block.c"
+ },
+ "9": {
+ "patterns": [
+ {
+ "match": "\\*\\/",
+ "name": "comment.block.c punctuation.definition.comment.end.c"
+ },
+ {
+ "match": "\\*",
+ "name": "comment.block.c"
+ }
+ ]
+ }
+ }
+ },
+ {
+ "match": ":",
+ "name": "punctuation.separator.delimiter.colon.assembly.c"
+ },
+ {
+ "include": "#comments_context"
+ },
+ {
+ "include": "#comments"
+ }
+ ]
+ }
+ ]
+ }
+ ]
+ },
+ "string_escaped_char": {
+ "patterns": [
+ {
+ "match": "(?x)\\\\ (\n\\\\\t\t\t |\n[abefnprtv'\"?] |\n[0-3]\\d{,2}\t |\n[4-7]\\d?\t\t|\nx[a-fA-F0-9]{,2} |\nu[a-fA-F0-9]{,4} |\nU[a-fA-F0-9]{,8} )",
+ "name": "constant.character.escape.c"
+ },
+ {
+ "match": "\\\\.",
+ "name": "invalid.illegal.unknown-escape.c"
+ }
+ ]
+ },
+ "string_placeholder": {
+ "patterns": [
+ {
+ "match": "(?x) %\n(\\d+\\$)?\t\t\t\t\t\t # field (argument #)\n[#0\\- +']*\t\t\t\t\t\t # flags\n[,;:_]?\t\t\t\t\t\t\t # separator character (AltiVec)\n((-?\\d+)|\\*(-?\\d+\\$)?)?\t\t # minimum field width\n(\\.((-?\\d+)|\\*(-?\\d+\\$)?)?)?\t# precision\n(hh|h|ll|l|j|t|z|q|L|vh|vl|v|hv|hl)? # length modifier\n[diouxXDOUeEfFgGaACcSspn%]\t\t # conversion type",
+ "name": "constant.other.placeholder.c"
+ },
+ {
+ "match": "(%)(?!\"\\s*(PRI|SCN))",
+ "captures": {
+ "1": {
+ "name": "invalid.illegal.placeholder.c"
+ }
+ }
+ }
+ ]
+ },
+ "strings": {
+ "patterns": [
+ {
+ "begin": "\"",
+ "beginCaptures": {
+ "0": {
+ "name": "punctuation.definition.string.begin.c"
+ }
+ },
+ "end": "\"",
+ "endCaptures": {
+ "0": {
+ "name": "punctuation.definition.string.end.c"
+ }
+ },
+ "name": "string.quoted.double.c",
+ "patterns": [
+ {
+ "include": "#string_escaped_char"
+ },
+ {
+ "include": "#string_placeholder"
+ },
+ {
+ "include": "#line_continuation_character"
+ }
+ ]
+ },
+ {
+ "begin": "'",
+ "beginCaptures": {
+ "0": {
+ "name": "punctuation.definition.string.begin.c"
+ }
+ },
+ "end": "'",
+ "endCaptures": {
+ "0": {
+ "name": "punctuation.definition.string.end.c"
+ }
+ },
+ "name": "string.quoted.single.c",
+ "patterns": [
+ {
+ "include": "#string_escaped_char"
+ },
+ {
+ "include": "#line_continuation_character"
+ }
+ ]
+ }
+ ]
+ },
+ "switch_conditional_parentheses": {
+ "name": "meta.conditional.switch.c",
+ "begin": "((?>(?:(?:(?>(?<!\\s)\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))(\\()",
+ "beginCaptures": {
+ "1": {
+ "patterns": [
+ {
+ "include": "#inline_comment"
+ }
+ ]
+ },
+ "2": {
+ "name": "comment.block.c punctuation.definition.comment.begin.c"
+ },
+ "3": {
+ "name": "comment.block.c"
+ },
+ "4": {
+ "patterns": [
+ {
+ "match": "\\*\\/",
+ "name": "comment.block.c punctuation.definition.comment.end.c"
+ },
+ {
+ "match": "\\*",
+ "name": "comment.block.c"
+ }
+ ]
+ },
+ "5": {
+ "name": "punctuation.section.parens.begin.bracket.round.conditional.switch.c"
+ }
+ },
+ "end": "(\\))",
+ "endCaptures": {
+ "1": {
+ "name": "punctuation.section.parens.end.bracket.round.conditional.switch.c"
+ }
+ },
+ "patterns": [
+ {
+ "include": "#evaluation_context"
+ },
+ {
+ "include": "#c_conditional_context"
+ }
+ ]
+ },
+ "switch_statement": {
+ "name": "meta.block.switch.c",
+ "begin": "(((?>(?:(?:(?>(?<!\\s)\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))((?<!\\w)switch(?!\\w)))",
+ "beginCaptures": {
+ "1": {
+ "name": "meta.head.switch.c"
+ },
+ "2": {
+ "patterns": [
+ {
+ "include": "#inline_comment"
+ }
+ ]
+ },
+ "3": {
+ "name": "comment.block.c punctuation.definition.comment.begin.c"
+ },
+ "4": {
+ "name": "comment.block.c"
+ },
+ "5": {
+ "patterns": [
+ {
+ "match": "\\*\\/",
+ "name": "comment.block.c punctuation.definition.comment.end.c"
+ },
+ {
+ "match": "\\*",
+ "name": "comment.block.c"
+ }
+ ]
+ },
+ "6": {
+ "name": "keyword.control.switch.c"
+ }
+ },
+ "end": "(?:(?<=\\}|%>|\\?\\?>)|(?=[;>\\[\\]=]))",
+ "patterns": [
+ {
+ "name": "meta.head.switch.c",
+ "begin": "\\G ?",
+ "end": "((?:\\{|<%|\\?\\?<|(?=;)))",
+ "endCaptures": {
+ "1": {
+ "name": "punctuation.section.block.begin.bracket.curly.switch.c"
+ }
+ },
+ "patterns": [
+ {
+ "include": "#switch_conditional_parentheses"
+ },
+ {
+ "include": "$self"
+ }
+ ]
+ },
+ {
+ "name": "meta.body.switch.c",
+ "begin": "(?<=\\{|<%|\\?\\?<)",
+ "end": "(\\}|%>|\\?\\?>)",
... 24412 lines suppressed ...
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@netbeans.apache.org
For additional commands, e-mail: commits-help@netbeans.apache.org
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists