Upgrade cc-mode for emacs 24
This commit is contained in:
parent
140f3b7e25
commit
13b7553ecc
27 changed files with 62719 additions and 3 deletions
|
|
@ -57,7 +57,8 @@
|
|||
(add-to-list 'load-path "~/site-lisp")
|
||||
|
||||
;; Choose a cc-mode/c#-mode to use. (More on this below)
|
||||
(add-to-list 'load-path "~/site-lisp/cc-mode/5.31.3")
|
||||
(add-to-list 'load-path "~/site-lisp/cc-mode/5.32.3")
|
||||
(add-to-list 'load-path "~/site-lisp/cc-mode/csharp-only")
|
||||
|
||||
;; Also ruby mode
|
||||
(add-to-list 'load-path "c:/ruby/lib")
|
||||
|
|
@ -133,7 +134,7 @@
|
|||
(progn
|
||||
(require 'color-theme)
|
||||
(require 'color-theme-solarized)
|
||||
(color-theme-solarized-dark)))
|
||||
(color-theme-solarized-light)))
|
||||
|
||||
;; Modeline format:
|
||||
(display-time-mode -1)
|
||||
|
|
@ -324,7 +325,7 @@
|
|||
;; (autoload 'csharp-mode "cc-mode")
|
||||
|
||||
;; Here is another one that is not.
|
||||
(autoload 'csharp-mode "csharp-mode-0.6.0" "Major mode for editing C# code." t)
|
||||
(autoload 'csharp-mode "csharp-mode-0.8.6" "Major mode for editing C# code." t)
|
||||
|
||||
(c-add-style "ms-csharp"
|
||||
'((c-basic-offset . 4)
|
||||
|
|
|
|||
21
site-lisp/cc-mode/5.32.3/ANNOUNCEMENT
Normal file
21
site-lisp/cc-mode/5.32.3/ANNOUNCEMENT
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
Release Announcement
|
||||
CC Mode Version 5.32
|
||||
Alan Mackenzie
|
||||
|
||||
This message announces the availability of a new version of CC Mode,
|
||||
an Emacs and XEmacs mode for editing C (ANSI and K&R), C++,
|
||||
Objective-C, Java, CORBA's IDL, Pike and AWK code.
|
||||
|
||||
A list of user visible changes is detailed in the NEWS file and in the
|
||||
URL listed below. More information, including links to download the
|
||||
source, are available on the CC Mode web page:
|
||||
|
||||
<http://cc-mode.sourceforge.net/>
|
||||
|
||||
Send email correspondence to
|
||||
|
||||
bug-cc-mode@gnu.org
|
||||
|
||||
For a list of changes please see
|
||||
|
||||
<http://cc-mode.sourceforge.net/changes-531.php>
|
||||
674
site-lisp/cc-mode/5.32.3/COPYING
Normal file
674
site-lisp/cc-mode/5.32.3/COPYING
Normal file
|
|
@ -0,0 +1,674 @@
|
|||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 3, 29 June 2007
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The GNU General Public License is a free, copyleft license for
|
||||
software and other kinds of works.
|
||||
|
||||
The licenses for most software and other practical works are designed
|
||||
to take away your freedom to share and change the works. By contrast,
|
||||
the GNU General Public License is intended to guarantee your freedom to
|
||||
share and change all versions of a program--to make sure it remains free
|
||||
software for all its users. We, the Free Software Foundation, use the
|
||||
GNU General Public License for most of our software; it applies also to
|
||||
any other work released this way by its authors. You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
them if you wish), that you receive source code or can get it if you
|
||||
want it, that you can change the software or use pieces of it in new
|
||||
free programs, and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to prevent others from denying you
|
||||
these rights or asking you to surrender the rights. Therefore, you have
|
||||
certain responsibilities if you distribute copies of the software, or if
|
||||
you modify it: responsibilities to respect the freedom of others.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must pass on to the recipients the same
|
||||
freedoms that you received. You must make sure that they, too, receive
|
||||
or can get the source code. And you must show them these terms so they
|
||||
know their rights.
|
||||
|
||||
Developers that use the GNU GPL protect your rights with two steps:
|
||||
(1) assert copyright on the software, and (2) offer you this License
|
||||
giving you legal permission to copy, distribute and/or modify it.
|
||||
|
||||
For the developers' and authors' protection, the GPL clearly explains
|
||||
that there is no warranty for this free software. For both users' and
|
||||
authors' sake, the GPL requires that modified versions be marked as
|
||||
changed, so that their problems will not be attributed erroneously to
|
||||
authors of previous versions.
|
||||
|
||||
Some devices are designed to deny users access to install or run
|
||||
modified versions of the software inside them, although the manufacturer
|
||||
can do so. This is fundamentally incompatible with the aim of
|
||||
protecting users' freedom to change the software. The systematic
|
||||
pattern of such abuse occurs in the area of products for individuals to
|
||||
use, which is precisely where it is most unacceptable. Therefore, we
|
||||
have designed this version of the GPL to prohibit the practice for those
|
||||
products. If such problems arise substantially in other domains, we
|
||||
stand ready to extend this provision to those domains in future versions
|
||||
of the GPL, as needed to protect the freedom of users.
|
||||
|
||||
Finally, every program is threatened constantly by software patents.
|
||||
States should not allow patents to restrict development and use of
|
||||
software on general-purpose computers, but in those that do, we wish to
|
||||
avoid the special danger that patents applied to a free program could
|
||||
make it effectively proprietary. To prevent this, the GPL assures that
|
||||
patents cannot be used to render the program non-free.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
TERMS AND CONDITIONS
|
||||
|
||||
0. Definitions.
|
||||
|
||||
"This License" refers to version 3 of the GNU General Public License.
|
||||
|
||||
"Copyright" also means copyright-like laws that apply to other kinds of
|
||||
works, such as semiconductor masks.
|
||||
|
||||
"The Program" refers to any copyrightable work licensed under this
|
||||
License. Each licensee is addressed as "you". "Licensees" and
|
||||
"recipients" may be individuals or organizations.
|
||||
|
||||
To "modify" a work means to copy from or adapt all or part of the work
|
||||
in a fashion requiring copyright permission, other than the making of an
|
||||
exact copy. The resulting work is called a "modified version" of the
|
||||
earlier work or a work "based on" the earlier work.
|
||||
|
||||
A "covered work" means either the unmodified Program or a work based
|
||||
on the Program.
|
||||
|
||||
To "propagate" a work means to do anything with it that, without
|
||||
permission, would make you directly or secondarily liable for
|
||||
infringement under applicable copyright law, except executing it on a
|
||||
computer or modifying a private copy. Propagation includes copying,
|
||||
distribution (with or without modification), making available to the
|
||||
public, and in some countries other activities as well.
|
||||
|
||||
To "convey" a work means any kind of propagation that enables other
|
||||
parties to make or receive copies. Mere interaction with a user through
|
||||
a computer network, with no transfer of a copy, is not conveying.
|
||||
|
||||
An interactive user interface displays "Appropriate Legal Notices"
|
||||
to the extent that it includes a convenient and prominently visible
|
||||
feature that (1) displays an appropriate copyright notice, and (2)
|
||||
tells the user that there is no warranty for the work (except to the
|
||||
extent that warranties are provided), that licensees may convey the
|
||||
work under this License, and how to view a copy of this License. If
|
||||
the interface presents a list of user commands or options, such as a
|
||||
menu, a prominent item in the list meets this criterion.
|
||||
|
||||
1. Source Code.
|
||||
|
||||
The "source code" for a work means the preferred form of the work
|
||||
for making modifications to it. "Object code" means any non-source
|
||||
form of a work.
|
||||
|
||||
A "Standard Interface" means an interface that either is an official
|
||||
standard defined by a recognized standards body, or, in the case of
|
||||
interfaces specified for a particular programming language, one that
|
||||
is widely used among developers working in that language.
|
||||
|
||||
The "System Libraries" of an executable work include anything, other
|
||||
than the work as a whole, that (a) is included in the normal form of
|
||||
packaging a Major Component, but which is not part of that Major
|
||||
Component, and (b) serves only to enable use of the work with that
|
||||
Major Component, or to implement a Standard Interface for which an
|
||||
implementation is available to the public in source code form. A
|
||||
"Major Component", in this context, means a major essential component
|
||||
(kernel, window system, and so on) of the specific operating system
|
||||
(if any) on which the executable work runs, or a compiler used to
|
||||
produce the work, or an object code interpreter used to run it.
|
||||
|
||||
The "Corresponding Source" for a work in object code form means all
|
||||
the source code needed to generate, install, and (for an executable
|
||||
work) run the object code and to modify the work, including scripts to
|
||||
control those activities. However, it does not include the work's
|
||||
System Libraries, or general-purpose tools or generally available free
|
||||
programs which are used unmodified in performing those activities but
|
||||
which are not part of the work. For example, Corresponding Source
|
||||
includes interface definition files associated with source files for
|
||||
the work, and the source code for shared libraries and dynamically
|
||||
linked subprograms that the work is specifically designed to require,
|
||||
such as by intimate data communication or control flow between those
|
||||
subprograms and other parts of the work.
|
||||
|
||||
The Corresponding Source need not include anything that users
|
||||
can regenerate automatically from other parts of the Corresponding
|
||||
Source.
|
||||
|
||||
The Corresponding Source for a work in source code form is that
|
||||
same work.
|
||||
|
||||
2. Basic Permissions.
|
||||
|
||||
All rights granted under this License are granted for the term of
|
||||
copyright on the Program, and are irrevocable provided the stated
|
||||
conditions are met. This License explicitly affirms your unlimited
|
||||
permission to run the unmodified Program. The output from running a
|
||||
covered work is covered by this License only if the output, given its
|
||||
content, constitutes a covered work. This License acknowledges your
|
||||
rights of fair use or other equivalent, as provided by copyright law.
|
||||
|
||||
You may make, run and propagate covered works that you do not
|
||||
convey, without conditions so long as your license otherwise remains
|
||||
in force. You may convey covered works to others for the sole purpose
|
||||
of having them make modifications exclusively for you, or provide you
|
||||
with facilities for running those works, provided that you comply with
|
||||
the terms of this License in conveying all material for which you do
|
||||
not control copyright. Those thus making or running the covered works
|
||||
for you must do so exclusively on your behalf, under your direction
|
||||
and control, on terms that prohibit them from making any copies of
|
||||
your copyrighted material outside their relationship with you.
|
||||
|
||||
Conveying under any other circumstances is permitted solely under
|
||||
the conditions stated below. Sublicensing is not allowed; section 10
|
||||
makes it unnecessary.
|
||||
|
||||
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||
|
||||
No covered work shall be deemed part of an effective technological
|
||||
measure under any applicable law fulfilling obligations under article
|
||||
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
||||
similar laws prohibiting or restricting circumvention of such
|
||||
measures.
|
||||
|
||||
When you convey a covered work, you waive any legal power to forbid
|
||||
circumvention of technological measures to the extent such circumvention
|
||||
is effected by exercising rights under this License with respect to
|
||||
the covered work, and you disclaim any intention to limit operation or
|
||||
modification of the work as a means of enforcing, against the work's
|
||||
users, your or third parties' legal rights to forbid circumvention of
|
||||
technological measures.
|
||||
|
||||
4. Conveying Verbatim Copies.
|
||||
|
||||
You may convey verbatim copies of the Program's source code as you
|
||||
receive it, in any medium, provided that you conspicuously and
|
||||
appropriately publish on each copy an appropriate copyright notice;
|
||||
keep intact all notices stating that this License and any
|
||||
non-permissive terms added in accord with section 7 apply to the code;
|
||||
keep intact all notices of the absence of any warranty; and give all
|
||||
recipients a copy of this License along with the Program.
|
||||
|
||||
You may charge any price or no price for each copy that you convey,
|
||||
and you may offer support or warranty protection for a fee.
|
||||
|
||||
5. Conveying Modified Source Versions.
|
||||
|
||||
You may convey a work based on the Program, or the modifications to
|
||||
produce it from the Program, in the form of source code under the
|
||||
terms of section 4, provided that you also meet all of these conditions:
|
||||
|
||||
a) The work must carry prominent notices stating that you modified
|
||||
it, and giving a relevant date.
|
||||
|
||||
b) The work must carry prominent notices stating that it is
|
||||
released under this License and any conditions added under section
|
||||
7. This requirement modifies the requirement in section 4 to
|
||||
"keep intact all notices".
|
||||
|
||||
c) You must license the entire work, as a whole, under this
|
||||
License to anyone who comes into possession of a copy. This
|
||||
License will therefore apply, along with any applicable section 7
|
||||
additional terms, to the whole of the work, and all its parts,
|
||||
regardless of how they are packaged. This License gives no
|
||||
permission to license the work in any other way, but it does not
|
||||
invalidate such permission if you have separately received it.
|
||||
|
||||
d) If the work has interactive user interfaces, each must display
|
||||
Appropriate Legal Notices; however, if the Program has interactive
|
||||
interfaces that do not display Appropriate Legal Notices, your
|
||||
work need not make them do so.
|
||||
|
||||
A compilation of a covered work with other separate and independent
|
||||
works, which are not by their nature extensions of the covered work,
|
||||
and which are not combined with it such as to form a larger program,
|
||||
in or on a volume of a storage or distribution medium, is called an
|
||||
"aggregate" if the compilation and its resulting copyright are not
|
||||
used to limit the access or legal rights of the compilation's users
|
||||
beyond what the individual works permit. Inclusion of a covered work
|
||||
in an aggregate does not cause this License to apply to the other
|
||||
parts of the aggregate.
|
||||
|
||||
6. Conveying Non-Source Forms.
|
||||
|
||||
You may convey a covered work in object code form under the terms
|
||||
of sections 4 and 5, provided that you also convey the
|
||||
machine-readable Corresponding Source under the terms of this License,
|
||||
in one of these ways:
|
||||
|
||||
a) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by the
|
||||
Corresponding Source fixed on a durable physical medium
|
||||
customarily used for software interchange.
|
||||
|
||||
b) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by a
|
||||
written offer, valid for at least three years and valid for as
|
||||
long as you offer spare parts or customer support for that product
|
||||
model, to give anyone who possesses the object code either (1) a
|
||||
copy of the Corresponding Source for all the software in the
|
||||
product that is covered by this License, on a durable physical
|
||||
medium customarily used for software interchange, for a price no
|
||||
more than your reasonable cost of physically performing this
|
||||
conveying of source, or (2) access to copy the
|
||||
Corresponding Source from a network server at no charge.
|
||||
|
||||
c) Convey individual copies of the object code with a copy of the
|
||||
written offer to provide the Corresponding Source. This
|
||||
alternative is allowed only occasionally and noncommercially, and
|
||||
only if you received the object code with such an offer, in accord
|
||||
with subsection 6b.
|
||||
|
||||
d) Convey the object code by offering access from a designated
|
||||
place (gratis or for a charge), and offer equivalent access to the
|
||||
Corresponding Source in the same way through the same place at no
|
||||
further charge. You need not require recipients to copy the
|
||||
Corresponding Source along with the object code. If the place to
|
||||
copy the object code is a network server, the Corresponding Source
|
||||
may be on a different server (operated by you or a third party)
|
||||
that supports equivalent copying facilities, provided you maintain
|
||||
clear directions next to the object code saying where to find the
|
||||
Corresponding Source. Regardless of what server hosts the
|
||||
Corresponding Source, you remain obligated to ensure that it is
|
||||
available for as long as needed to satisfy these requirements.
|
||||
|
||||
e) Convey the object code using peer-to-peer transmission, provided
|
||||
you inform other peers where the object code and Corresponding
|
||||
Source of the work are being offered to the general public at no
|
||||
charge under subsection 6d.
|
||||
|
||||
A separable portion of the object code, whose source code is excluded
|
||||
from the Corresponding Source as a System Library, need not be
|
||||
included in conveying the object code work.
|
||||
|
||||
A "User Product" is either (1) a "consumer product", which means any
|
||||
tangible personal property which is normally used for personal, family,
|
||||
or household purposes, or (2) anything designed or sold for incorporation
|
||||
into a dwelling. In determining whether a product is a consumer product,
|
||||
doubtful cases shall be resolved in favor of coverage. For a particular
|
||||
product received by a particular user, "normally used" refers to a
|
||||
typical or common use of that class of product, regardless of the status
|
||||
of the particular user or of the way in which the particular user
|
||||
actually uses, or expects or is expected to use, the product. A product
|
||||
is a consumer product regardless of whether the product has substantial
|
||||
commercial, industrial or non-consumer uses, unless such uses represent
|
||||
the only significant mode of use of the product.
|
||||
|
||||
"Installation Information" for a User Product means any methods,
|
||||
procedures, authorization keys, or other information required to install
|
||||
and execute modified versions of a covered work in that User Product from
|
||||
a modified version of its Corresponding Source. The information must
|
||||
suffice to ensure that the continued functioning of the modified object
|
||||
code is in no case prevented or interfered with solely because
|
||||
modification has been made.
|
||||
|
||||
If you convey an object code work under this section in, or with, or
|
||||
specifically for use in, a User Product, and the conveying occurs as
|
||||
part of a transaction in which the right of possession and use of the
|
||||
User Product is transferred to the recipient in perpetuity or for a
|
||||
fixed term (regardless of how the transaction is characterized), the
|
||||
Corresponding Source conveyed under this section must be accompanied
|
||||
by the Installation Information. But this requirement does not apply
|
||||
if neither you nor any third party retains the ability to install
|
||||
modified object code on the User Product (for example, the work has
|
||||
been installed in ROM).
|
||||
|
||||
The requirement to provide Installation Information does not include a
|
||||
requirement to continue to provide support service, warranty, or updates
|
||||
for a work that has been modified or installed by the recipient, or for
|
||||
the User Product in which it has been modified or installed. Access to a
|
||||
network may be denied when the modification itself materially and
|
||||
adversely affects the operation of the network or violates the rules and
|
||||
protocols for communication across the network.
|
||||
|
||||
Corresponding Source conveyed, and Installation Information provided,
|
||||
in accord with this section must be in a format that is publicly
|
||||
documented (and with an implementation available to the public in
|
||||
source code form), and must require no special password or key for
|
||||
unpacking, reading or copying.
|
||||
|
||||
7. Additional Terms.
|
||||
|
||||
"Additional permissions" are terms that supplement the terms of this
|
||||
License by making exceptions from one or more of its conditions.
|
||||
Additional permissions that are applicable to the entire Program shall
|
||||
be treated as though they were included in this License, to the extent
|
||||
that they are valid under applicable law. If additional permissions
|
||||
apply only to part of the Program, that part may be used separately
|
||||
under those permissions, but the entire Program remains governed by
|
||||
this License without regard to the additional permissions.
|
||||
|
||||
When you convey a copy of a covered work, you may at your option
|
||||
remove any additional permissions from that copy, or from any part of
|
||||
it. (Additional permissions may be written to require their own
|
||||
removal in certain cases when you modify the work.) You may place
|
||||
additional permissions on material, added by you to a covered work,
|
||||
for which you have or can give appropriate copyright permission.
|
||||
|
||||
Notwithstanding any other provision of this License, for material you
|
||||
add to a covered work, you may (if authorized by the copyright holders of
|
||||
that material) supplement the terms of this License with terms:
|
||||
|
||||
a) Disclaiming warranty or limiting liability differently from the
|
||||
terms of sections 15 and 16 of this License; or
|
||||
|
||||
b) Requiring preservation of specified reasonable legal notices or
|
||||
author attributions in that material or in the Appropriate Legal
|
||||
Notices displayed by works containing it; or
|
||||
|
||||
c) Prohibiting misrepresentation of the origin of that material, or
|
||||
requiring that modified versions of such material be marked in
|
||||
reasonable ways as different from the original version; or
|
||||
|
||||
d) Limiting the use for publicity purposes of names of licensors or
|
||||
authors of the material; or
|
||||
|
||||
e) Declining to grant rights under trademark law for use of some
|
||||
trade names, trademarks, or service marks; or
|
||||
|
||||
f) Requiring indemnification of licensors and authors of that
|
||||
material by anyone who conveys the material (or modified versions of
|
||||
it) with contractual assumptions of liability to the recipient, for
|
||||
any liability that these contractual assumptions directly impose on
|
||||
those licensors and authors.
|
||||
|
||||
All other non-permissive additional terms are considered "further
|
||||
restrictions" within the meaning of section 10. If the Program as you
|
||||
received it, or any part of it, contains a notice stating that it is
|
||||
governed by this License along with a term that is a further
|
||||
restriction, you may remove that term. If a license document contains
|
||||
a further restriction but permits relicensing or conveying under this
|
||||
License, you may add to a covered work material governed by the terms
|
||||
of that license document, provided that the further restriction does
|
||||
not survive such relicensing or conveying.
|
||||
|
||||
If you add terms to a covered work in accord with this section, you
|
||||
must place, in the relevant source files, a statement of the
|
||||
additional terms that apply to those files, or a notice indicating
|
||||
where to find the applicable terms.
|
||||
|
||||
Additional terms, permissive or non-permissive, may be stated in the
|
||||
form of a separately written license, or stated as exceptions;
|
||||
the above requirements apply either way.
|
||||
|
||||
8. Termination.
|
||||
|
||||
You may not propagate or modify a covered work except as expressly
|
||||
provided under this License. Any attempt otherwise to propagate or
|
||||
modify it is void, and will automatically terminate your rights under
|
||||
this License (including any patent licenses granted under the third
|
||||
paragraph of section 11).
|
||||
|
||||
However, if you cease all violation of this License, then your
|
||||
license from a particular copyright holder is reinstated (a)
|
||||
provisionally, unless and until the copyright holder explicitly and
|
||||
finally terminates your license, and (b) permanently, if the copyright
|
||||
holder fails to notify you of the violation by some reasonable means
|
||||
prior to 60 days after the cessation.
|
||||
|
||||
Moreover, your license from a particular copyright holder is
|
||||
reinstated permanently if the copyright holder notifies you of the
|
||||
violation by some reasonable means, this is the first time you have
|
||||
received notice of violation of this License (for any work) from that
|
||||
copyright holder, and you cure the violation prior to 30 days after
|
||||
your receipt of the notice.
|
||||
|
||||
Termination of your rights under this section does not terminate the
|
||||
licenses of parties who have received copies or rights from you under
|
||||
this License. If your rights have been terminated and not permanently
|
||||
reinstated, you do not qualify to receive new licenses for the same
|
||||
material under section 10.
|
||||
|
||||
9. Acceptance Not Required for Having Copies.
|
||||
|
||||
You are not required to accept this License in order to receive or
|
||||
run a copy of the Program. Ancillary propagation of a covered work
|
||||
occurring solely as a consequence of using peer-to-peer transmission
|
||||
to receive a copy likewise does not require acceptance. However,
|
||||
nothing other than this License grants you permission to propagate or
|
||||
modify any covered work. These actions infringe copyright if you do
|
||||
not accept this License. Therefore, by modifying or propagating a
|
||||
covered work, you indicate your acceptance of this License to do so.
|
||||
|
||||
10. Automatic Licensing of Downstream Recipients.
|
||||
|
||||
Each time you convey a covered work, the recipient automatically
|
||||
receives a license from the original licensors, to run, modify and
|
||||
propagate that work, subject to this License. You are not responsible
|
||||
for enforcing compliance by third parties with this License.
|
||||
|
||||
An "entity transaction" is a transaction transferring control of an
|
||||
organization, or substantially all assets of one, or subdividing an
|
||||
organization, or merging organizations. If propagation of a covered
|
||||
work results from an entity transaction, each party to that
|
||||
transaction who receives a copy of the work also receives whatever
|
||||
licenses to the work the party's predecessor in interest had or could
|
||||
give under the previous paragraph, plus a right to possession of the
|
||||
Corresponding Source of the work from the predecessor in interest, if
|
||||
the predecessor has it or can get it with reasonable efforts.
|
||||
|
||||
You may not impose any further restrictions on the exercise of the
|
||||
rights granted or affirmed under this License. For example, you may
|
||||
not impose a license fee, royalty, or other charge for exercise of
|
||||
rights granted under this License, and you may not initiate litigation
|
||||
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
||||
any patent claim is infringed by making, using, selling, offering for
|
||||
sale, or importing the Program or any portion of it.
|
||||
|
||||
11. Patents.
|
||||
|
||||
A "contributor" is a copyright holder who authorizes use under this
|
||||
License of the Program or a work on which the Program is based. The
|
||||
work thus licensed is called the contributor's "contributor version".
|
||||
|
||||
A contributor's "essential patent claims" are all patent claims
|
||||
owned or controlled by the contributor, whether already acquired or
|
||||
hereafter acquired, that would be infringed by some manner, permitted
|
||||
by this License, of making, using, or selling its contributor version,
|
||||
but do not include claims that would be infringed only as a
|
||||
consequence of further modification of the contributor version. For
|
||||
purposes of this definition, "control" includes the right to grant
|
||||
patent sublicenses in a manner consistent with the requirements of
|
||||
this License.
|
||||
|
||||
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
||||
patent license under the contributor's essential patent claims, to
|
||||
make, use, sell, offer for sale, import and otherwise run, modify and
|
||||
propagate the contents of its contributor version.
|
||||
|
||||
In the following three paragraphs, a "patent license" is any express
|
||||
agreement or commitment, however denominated, not to enforce a patent
|
||||
(such as an express permission to practice a patent or covenant not to
|
||||
sue for patent infringement). To "grant" such a patent license to a
|
||||
party means to make such an agreement or commitment not to enforce a
|
||||
patent against the party.
|
||||
|
||||
If you convey a covered work, knowingly relying on a patent license,
|
||||
and the Corresponding Source of the work is not available for anyone
|
||||
to copy, free of charge and under the terms of this License, through a
|
||||
publicly available network server or other readily accessible means,
|
||||
then you must either (1) cause the Corresponding Source to be so
|
||||
available, or (2) arrange to deprive yourself of the benefit of the
|
||||
patent license for this particular work, or (3) arrange, in a manner
|
||||
consistent with the requirements of this License, to extend the patent
|
||||
license to downstream recipients. "Knowingly relying" means you have
|
||||
actual knowledge that, but for the patent license, your conveying the
|
||||
covered work in a country, or your recipient's use of the covered work
|
||||
in a country, would infringe one or more identifiable patents in that
|
||||
country that you have reason to believe are valid.
|
||||
|
||||
If, pursuant to or in connection with a single transaction or
|
||||
arrangement, you convey, or propagate by procuring conveyance of, a
|
||||
covered work, and grant a patent license to some of the parties
|
||||
receiving the covered work authorizing them to use, propagate, modify
|
||||
or convey a specific copy of the covered work, then the patent license
|
||||
you grant is automatically extended to all recipients of the covered
|
||||
work and works based on it.
|
||||
|
||||
A patent license is "discriminatory" if it does not include within
|
||||
the scope of its coverage, prohibits the exercise of, or is
|
||||
conditioned on the non-exercise of one or more of the rights that are
|
||||
specifically granted under this License. You may not convey a covered
|
||||
work if you are a party to an arrangement with a third party that is
|
||||
in the business of distributing software, under which you make payment
|
||||
to the third party based on the extent of your activity of conveying
|
||||
the work, and under which the third party grants, to any of the
|
||||
parties who would receive the covered work from you, a discriminatory
|
||||
patent license (a) in connection with copies of the covered work
|
||||
conveyed by you (or copies made from those copies), or (b) primarily
|
||||
for and in connection with specific products or compilations that
|
||||
contain the covered work, unless you entered into that arrangement,
|
||||
or that patent license was granted, prior to 28 March 2007.
|
||||
|
||||
Nothing in this License shall be construed as excluding or limiting
|
||||
any implied license or other defenses to infringement that may
|
||||
otherwise be available to you under applicable patent law.
|
||||
|
||||
12. No Surrender of Others' Freedom.
|
||||
|
||||
If conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot convey a
|
||||
covered work so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you may
|
||||
not convey it at all. For example, if you agree to terms that obligate you
|
||||
to collect a royalty for further conveying from those to whom you convey
|
||||
the Program, the only way you could satisfy both those terms and this
|
||||
License would be to refrain entirely from conveying the Program.
|
||||
|
||||
13. Use with the GNU Affero General Public License.
|
||||
|
||||
Notwithstanding any other provision of this License, you have
|
||||
permission to link or combine any covered work with a work licensed
|
||||
under version 3 of the GNU Affero General Public License into a single
|
||||
combined work, and to convey the resulting work. The terms of this
|
||||
License will continue to apply to the part which is the covered work,
|
||||
but the special requirements of the GNU Affero General Public License,
|
||||
section 13, concerning interaction through a network will apply to the
|
||||
combination as such.
|
||||
|
||||
14. Revised Versions of this License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions of
|
||||
the GNU General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the
|
||||
Program specifies that a certain numbered version of the GNU General
|
||||
Public License "or any later version" applies to it, you have the
|
||||
option of following the terms and conditions either of that numbered
|
||||
version or of any later version published by the Free Software
|
||||
Foundation. If the Program does not specify a version number of the
|
||||
GNU General Public License, you may choose any version ever published
|
||||
by the Free Software Foundation.
|
||||
|
||||
If the Program specifies that a proxy can decide which future
|
||||
versions of the GNU General Public License can be used, that proxy's
|
||||
public statement of acceptance of a version permanently authorizes you
|
||||
to choose that version for the Program.
|
||||
|
||||
Later license versions may give you additional or different
|
||||
permissions. However, no additional obligations are imposed on any
|
||||
author or copyright holder as a result of your choosing to follow a
|
||||
later version.
|
||||
|
||||
15. Disclaimer of Warranty.
|
||||
|
||||
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
||||
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
||||
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
||||
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
||||
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
||||
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. Limitation of Liability.
|
||||
|
||||
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
||||
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
||||
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
||||
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
||||
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
||||
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
||||
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGES.
|
||||
|
||||
17. Interpretation of Sections 15 and 16.
|
||||
|
||||
If the disclaimer of warranty and limitation of liability provided
|
||||
above cannot be given local legal effect according to their terms,
|
||||
reviewing courts shall apply local law that most closely approximates
|
||||
an absolute waiver of all civil liability in connection with the
|
||||
Program, unless a warranty or assumption of liability accompanies a
|
||||
copy of the Program in return for a fee.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
state the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program does terminal interaction, make it output a short
|
||||
notice like this when it starts in an interactive mode:
|
||||
|
||||
<program> Copyright (C) <year> <name of author>
|
||||
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, your program's commands
|
||||
might be different; for a GUI interface, you would use an "about box".
|
||||
|
||||
You should also get your employer (if you work as a programmer) or school,
|
||||
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
||||
For more information on this, and how to apply and follow the GNU GPL, see
|
||||
<http://www.gnu.org/licenses/>.
|
||||
|
||||
The GNU General Public License does not permit incorporating your program
|
||||
into proprietary programs. If your program is a subroutine library, you
|
||||
may consider it more useful to permit linking proprietary applications with
|
||||
the library. If this is what you want to do, use the GNU Lesser General
|
||||
Public License instead of this License. But first, please read
|
||||
<http://www.gnu.org/philosophy/why-not-lgpl.html>.
|
||||
14608
site-lisp/cc-mode/5.32.3/ChangeLog
Normal file
14608
site-lisp/cc-mode/5.32.3/ChangeLog
Normal file
File diff suppressed because it is too large
Load diff
43
site-lisp/cc-mode/5.32.3/MANIFEST
Normal file
43
site-lisp/cc-mode/5.32.3/MANIFEST
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
Manifest for CC Mode 5.31
|
||||
|
||||
You should have received the following files in this distribution:
|
||||
|
||||
MANIFEST: This file.
|
||||
|
||||
README: Quick intro into how to get CC Mode up and running.
|
||||
|
||||
NEWS: A list of the user visible changes in each version.
|
||||
|
||||
COPYING: The copyright license under which this package is
|
||||
released.
|
||||
|
||||
cc-align.el, cc-awk.el, cc-cmds.el, cc-defs.el, cc-engine.el,
|
||||
cc-fonts.el, cc-guess.el, cc-langs.el, cc-menus.el, cc-mode.el,
|
||||
cc-styles.el, cc-subword.el, cc-vars.el: The source code.
|
||||
|
||||
cc-compat.el: Helps ease the transition from c-mode.el (BOCM) to
|
||||
the new indentation engine. This is provided for your convenience
|
||||
only, and is unguaranteed and unsupported.
|
||||
|
||||
cc-fix.el: (previously named cc-mode-19.el). Detects and corrects
|
||||
bugs in various older (X)Emacs versions.
|
||||
|
||||
cc-lobotomy.el: Performance vs. accuracy trade-offs. May not
|
||||
work, yadda, yadda.
|
||||
|
||||
cc-bytecomp.el: Contains helpers used during byte compiling to
|
||||
ensure that there's no mixup with earler versions of CC Mode which
|
||||
might be loaded.
|
||||
|
||||
cc-mode.texi: The latest CC Mode Texinfo manual.
|
||||
|
||||
ANNOUNCEMENT: Release announcement as it appeared on various
|
||||
forums.
|
||||
|
||||
Note that of the above files, the following are distributed with Emacs
|
||||
and XEmacs:
|
||||
|
||||
cc-align.el, cc-awk.el, cc-bytecomp.el, cc-cmds.el, cc-compat.el,
|
||||
cc-defs.el, cc-engine.el, cc-fonts.el, cc-guess.el, cc-langs.el,
|
||||
cc-menus.el, cc-mode.el, cc-styles.el, cc-subword.el, cc-vars.el,
|
||||
cc-mode.texi
|
||||
1094
site-lisp/cc-mode/5.32.3/NEWS
Normal file
1094
site-lisp/cc-mode/5.32.3/NEWS
Normal file
File diff suppressed because it is too large
Load diff
105
site-lisp/cc-mode/5.32.3/README
Normal file
105
site-lisp/cc-mode/5.32.3/README
Normal file
|
|
@ -0,0 +1,105 @@
|
|||
README for CC Mode 5.32
|
||||
Current maintainer : Alan Mackenzie
|
||||
Contact address : bug-cc-mode@gnu.org
|
||||
|
||||
INTRODUCTION
|
||||
|
||||
The canonical web location for all knowledge CC Mode is:
|
||||
|
||||
<http://cc-mode.sourceforge.net/>
|
||||
|
||||
Please read the cc-mode.texi manual for details on using CC Mode.
|
||||
This is available on-line from:
|
||||
|
||||
<http://cc-mode.sourceforge.net/cc-mode.html>
|
||||
|
||||
As of this writing (August 2011), CC Mode currently works
|
||||
out of the box with XEmacs versions 21.4 and later, and with Emacs
|
||||
versions 22 and later. (It might well still work with some earlier
|
||||
versions and will very likely work with later versions too, when
|
||||
they become available.)
|
||||
|
||||
MORE INFORMATION
|
||||
|
||||
Check out the CC Mode web site for the latest information,
|
||||
updates, tips, installation and compatibility notes, etc. on using
|
||||
CC Mode. The installation instructions given below are an excerpt
|
||||
of the on-line instructions. If you have problems installing CC
|
||||
Mode, please check out the URL above before submitting a bug
|
||||
report. Thanks!
|
||||
|
||||
The MANIFEST file contains a description of all the files you
|
||||
should have gotten with this distribution.
|
||||
|
||||
MANUALS
|
||||
|
||||
Preformatted versions of the manual in DVI, PostScript, and Info,
|
||||
are all available at the CC Mode web page. The Info manual has
|
||||
two variants, one for GNU Emacs, the other for XEmacs - the only
|
||||
differences between them are the targets of some cross references
|
||||
within the manual.
|
||||
|
||||
To build the manual yourself, you will need Texinfo 4.7 or later.
|
||||
Simply type:
|
||||
|
||||
% makeinfo cc-mode.texi # For GNU Emacs
|
||||
or
|
||||
% makeinfo -DXEMACS cc-mode.texi # For XEmacs
|
||||
|
||||
To make the DVI version, type:
|
||||
|
||||
% texi2dvi cc-mode.texi
|
||||
|
||||
INSTALLATION
|
||||
|
||||
Here is a quick guide for installing CC Mode. For the latest
|
||||
information on installing CC Mode, please see the CC Mode web site
|
||||
given above.
|
||||
|
||||
If you're using XEmacs, make sure you've got the "advice" package
|
||||
installed.
|
||||
|
||||
Byte Compiling
|
||||
|
||||
It is highly recommended that you byte-compile CC Mode for
|
||||
performance reasons. Running CC Mode non-byte-compiled is not
|
||||
supported.
|
||||
|
||||
You can compile CC Mode in the same way as any other package. To
|
||||
compile it from a running (X)Emacs session:
|
||||
|
||||
M-0 M-x byte-recompile-directory RET /path/to/cc-mode RET
|
||||
|
||||
To compile CC Mode from the shell:
|
||||
|
||||
% cd /path/to/cc-mode
|
||||
% $(EMACS) -batch -no-site-file -q -f batch-byte-compile cc-*.el
|
||||
|
||||
where $(EMACS) is either emacs or xemacs depending on the flavor
|
||||
you use. Note that the byte compiled files from one version of
|
||||
(X)Emacs are likely not to work on a different version - compile
|
||||
them fresh when you upgrade your (X)Emacs version.
|
||||
|
||||
Installing
|
||||
|
||||
Put the compiled files somewhere (X)Emacs will find them, i.e. in
|
||||
some path that's in the load-path variable. You must make sure
|
||||
they are found before any CC Mode files which are distributed with
|
||||
(X)Emacs. A directory has higher precendence than all directories
|
||||
after it in the load-path list.
|
||||
|
||||
To test that you have things set up correctly, visit a C file and
|
||||
then type:
|
||||
|
||||
M-x c-version RET
|
||||
=> Using CC Mode version 5.XX
|
||||
|
||||
where XX is the correct minor revision number.
|
||||
|
||||
Compatibility Issues
|
||||
|
||||
CC Mode should work fine with most versions of Emacs and XEmacs
|
||||
which aren't ancient (see the introduction above).
|
||||
|
||||
For more details about interactions with different packages, see
|
||||
the CC Mode web page.
|
||||
1349
site-lisp/cc-mode/5.32.3/cc-align.el
Normal file
1349
site-lisp/cc-mode/5.32.3/cc-align.el
Normal file
File diff suppressed because it is too large
Load diff
1100
site-lisp/cc-mode/5.32.3/cc-awk.el
Normal file
1100
site-lisp/cc-mode/5.32.3/cc-awk.el
Normal file
File diff suppressed because it is too large
Load diff
494
site-lisp/cc-mode/5.32.3/cc-bytecomp.el
Normal file
494
site-lisp/cc-mode/5.32.3/cc-bytecomp.el
Normal file
|
|
@ -0,0 +1,494 @@
|
|||
;;; cc-bytecomp.el --- compile time setup for proper compilation
|
||||
|
||||
;; Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
|
||||
;; 2008, 2009, 2010, 2011, 2012 Free Software Foundation, Inc.
|
||||
|
||||
;; Author: Martin Stjernholm
|
||||
;; Maintainer: bug-cc-mode@gnu.org
|
||||
;; Created: 15-Jul-2000
|
||||
;; Version: See cc-mode.el
|
||||
;; Keywords: c languages oop
|
||||
|
||||
;; This file is part of GNU Emacs.
|
||||
|
||||
;; GNU Emacs is free software; you can redistribute it and/or modify
|
||||
;; it under the terms of the GNU General Public License as published by
|
||||
;; the Free Software Foundation; either version 3, or (at your option)
|
||||
;; any later version.
|
||||
|
||||
;; GNU Emacs is distributed in the hope that it will be useful,
|
||||
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
;; GNU General Public License for more details.
|
||||
|
||||
;; You should have received a copy of the GNU General Public License
|
||||
;; along with this program; see the file COPYING. If not, see
|
||||
;; <http://www.gnu.org/licenses/>.
|
||||
|
||||
;;; Commentary:
|
||||
|
||||
;; This file is used to ensure that the CC Mode files are correctly
|
||||
;; compiled regardless the environment (e.g. if an older CC Mode with
|
||||
;; outdated macros are loaded during compilation). It also provides
|
||||
;; features to defeat the compiler warnings for selected symbols.
|
||||
;;
|
||||
;; There's really nothing CC Mode specific here; this functionality
|
||||
;; ought to be provided by the byte compilers or some accompanying
|
||||
;; library. To use it from some package "foo.el", begin by putting
|
||||
;; the following blurb at the top of the file:
|
||||
;;
|
||||
;; (eval-when-compile
|
||||
;; (let ((load-path
|
||||
;; (if (and (boundp 'byte-compile-dest-file)
|
||||
;; (stringp byte-compile-dest-file))
|
||||
;; (cons (file-name-directory byte-compile-dest-file) load-path)
|
||||
;; load-path)))
|
||||
;; (load "cc-bytecomp" nil t))
|
||||
;;
|
||||
;; This (unfortunately rather clumsy) form will ensure that the
|
||||
;; cc-bytecomp.el in the same directory as foo.el is loaded during
|
||||
;; byte compilation of the latter.
|
||||
;;
|
||||
;; At the end of foo.el there should normally be a "(provide 'foo)".
|
||||
;; Replace it with "(cc-provide 'foo)"; that is necessary to restore
|
||||
;; the environment after the byte compilation. If you don't have a
|
||||
;; `provide' at the end, you have to add the following as the very
|
||||
;; last form in the file:
|
||||
;;
|
||||
;; (eval-when-compile (cc-bytecomp-restore-environment))
|
||||
;;
|
||||
;; Now everything is set to use the various functions and macros in
|
||||
;; this package.
|
||||
;;
|
||||
;; If your package is split into several files, you should use
|
||||
;; `cc-require', `cc-require-when-compile' or `cc-load' to load them.
|
||||
;; That ensures that the files in the same directory always are
|
||||
;; loaded, to avoid mixup with other versions of them that might exist
|
||||
;; elsewhere in the load path.
|
||||
;;
|
||||
;; To suppress byte compiler warnings, use the macros
|
||||
;; `cc-bytecomp-defun', `cc-bytecomp-defvar',
|
||||
;; `cc-bytecomp-obsolete-fun', and `cc-bytecomp-obsolete-var'.
|
||||
;;
|
||||
;; This file is not used at all after the package has been byte
|
||||
;; compiled. It is however necessary when running uncompiled.
|
||||
|
||||
|
||||
;;; Code:
|
||||
|
||||
(defvar cc-bytecomp-unbound-variables nil)
|
||||
(defvar cc-bytecomp-original-functions nil)
|
||||
(defvar cc-bytecomp-original-properties nil)
|
||||
(defvar cc-bytecomp-loaded-files nil)
|
||||
(defvar cc-bytecomp-push-vars nil
|
||||
"A stack ((VAR GLOBAL-VAL SETQD-VAL) ...)")
|
||||
|
||||
(setq cc-bytecomp-unbound-variables nil)
|
||||
(setq cc-bytecomp-original-functions nil)
|
||||
(setq cc-bytecomp-original-properties nil)
|
||||
(setq cc-bytecomp-loaded-files nil)
|
||||
(setq cc-bytecomp-push-vars nil)
|
||||
|
||||
(defvar cc-bytecomp-environment-set nil)
|
||||
|
||||
(defmacro cc-bytecomp-debug-msg (&rest args)
|
||||
;;`(message ,@args)
|
||||
)
|
||||
|
||||
(defun cc-bytecomp-setup-environment ()
|
||||
;; Eval'ed during compilation to setup variables, functions etc
|
||||
;; declared with `cc-bytecomp-defvar' et al.
|
||||
(if (not load-in-progress)
|
||||
;; Look at `load-in-progress' to tell whether we're called
|
||||
;; directly in the file being compiled or just from some file
|
||||
;; being loaded during compilation.
|
||||
(let (p)
|
||||
(if cc-bytecomp-environment-set
|
||||
(error "Byte compilation environment already set - \
|
||||
perhaps a `cc-bytecomp-restore-environment' is forgotten somewhere"))
|
||||
(setq p cc-bytecomp-unbound-variables)
|
||||
(while p
|
||||
(if (not (boundp (car p)))
|
||||
(progn
|
||||
(eval `(defvar ,(car p)))
|
||||
(set (car p) (intern (concat "cc-bytecomp-ignore-var:"
|
||||
(symbol-name (car p)))))
|
||||
(cc-bytecomp-debug-msg
|
||||
"cc-bytecomp-setup-environment: Covered variable %s"
|
||||
(car p))))
|
||||
(setq p (cdr p)))
|
||||
(setq p cc-bytecomp-original-functions)
|
||||
(while p
|
||||
(let ((fun (car (car p)))
|
||||
(temp-macro (car (cdr (car p)))))
|
||||
(if (not (fboundp fun))
|
||||
(if temp-macro
|
||||
(progn
|
||||
(eval `(defmacro ,fun ,@temp-macro))
|
||||
(cc-bytecomp-debug-msg
|
||||
"cc-bytecomp-setup-environment: Bound macro %s" fun))
|
||||
(fset fun (intern (concat "cc-bytecomp-ignore-fun:"
|
||||
(symbol-name fun))))
|
||||
(cc-bytecomp-debug-msg
|
||||
"cc-bytecomp-setup-environment: Covered function %s" fun))))
|
||||
(setq p (cdr p)))
|
||||
(setq p cc-bytecomp-original-properties)
|
||||
(while p
|
||||
(let ((sym (car (car (car p))))
|
||||
(prop (cdr (car (car p))))
|
||||
(tempdef (car (cdr (car p)))))
|
||||
(put sym prop tempdef)
|
||||
(cc-bytecomp-debug-msg
|
||||
"cc-bytecomp-setup-environment: Bound property %s for %s to %s"
|
||||
prop sym tempdef))
|
||||
(setq p (cdr p)))
|
||||
(setq p (reverse cc-bytecomp-push-vars))
|
||||
(while p
|
||||
(let ((var (caar p))
|
||||
(setqd-val (cadr (cdar p))))
|
||||
(set var setqd-val)
|
||||
(cc-bytecomp-debug-msg
|
||||
"cc-bytecomp-setup-environment: Set variable %s to %s"
|
||||
var setqd-val))
|
||||
(setq p (cdr p)))
|
||||
(setq cc-bytecomp-environment-set t)
|
||||
(cc-bytecomp-debug-msg
|
||||
"cc-bytecomp-setup-environment: Done"))))
|
||||
|
||||
(defun cc-bytecomp-restore-environment ()
|
||||
;; Eval'ed during compilation to restore variables, functions etc
|
||||
;; declared with `cc-bytecomp-defvar' et al.
|
||||
(if (not load-in-progress)
|
||||
(let (p)
|
||||
(setq p cc-bytecomp-unbound-variables)
|
||||
(while p
|
||||
(let ((var (car p)))
|
||||
(if (boundp var)
|
||||
(if (eq (intern (concat "cc-bytecomp-ignore-var:"
|
||||
(symbol-name var)))
|
||||
(symbol-value var))
|
||||
(progn
|
||||
(makunbound var)
|
||||
(cc-bytecomp-debug-msg
|
||||
"cc-bytecomp-restore-environment: Unbound variable %s"
|
||||
var))
|
||||
(cc-bytecomp-debug-msg
|
||||
"cc-bytecomp-restore-environment: Not restoring variable %s"
|
||||
var))))
|
||||
(setq p (cdr p)))
|
||||
(setq p cc-bytecomp-original-functions)
|
||||
(while p
|
||||
(let ((fun (car (car p)))
|
||||
(temp-macro (car (cdr (car p))))
|
||||
(def (car (cdr (cdr (car p))))))
|
||||
(if (fboundp fun)
|
||||
(if (eq (or temp-macro
|
||||
(intern (concat "cc-bytecomp-ignore-fun:"
|
||||
(symbol-name fun))))
|
||||
(symbol-function fun))
|
||||
(if (eq def 'unbound)
|
||||
(progn
|
||||
(fmakunbound fun)
|
||||
(cc-bytecomp-debug-msg
|
||||
"cc-bytecomp-restore-environment: Unbound function %s"
|
||||
fun))
|
||||
(fset fun def)
|
||||
(cc-bytecomp-debug-msg
|
||||
"cc-bytecomp-restore-environment: Restored function %s"
|
||||
fun))
|
||||
(cc-bytecomp-debug-msg
|
||||
"cc-bytecomp-restore-environment: Not restoring function %s"
|
||||
fun))))
|
||||
(setq p (cdr p)))
|
||||
(setq p cc-bytecomp-original-properties)
|
||||
(while p
|
||||
(let ((sym (car (car (car p))))
|
||||
(prop (cdr (car (car p))))
|
||||
(tempdef (car (cdr (car p))))
|
||||
(origdef (cdr (cdr (car p)))))
|
||||
(if (eq (get sym prop) tempdef)
|
||||
(progn
|
||||
(put sym prop origdef)
|
||||
(cc-bytecomp-debug-msg
|
||||
"cc-bytecomp-restore-environment: Restored property %s for %s to %s"
|
||||
prop sym origdef))
|
||||
(cc-bytecomp-debug-msg
|
||||
"cc-bytecomp-restore-environment: Not restoring property %s for %s"
|
||||
prop sym)))
|
||||
(setq p (cdr p)))
|
||||
(setq p cc-bytecomp-push-vars)
|
||||
(while p
|
||||
(let ((var (caar p))
|
||||
(global-val (cadr (car p)))
|
||||
)
|
||||
(if (eq global-val 'cc-bytecomp-unbound)
|
||||
(makunbound var)
|
||||
(set var global-val))
|
||||
(cc-bytecomp-debug-msg
|
||||
"cc-bytecomp-restore-environment: Restored variable %s to %s"
|
||||
var global-val))
|
||||
(setq p (cdr p)))
|
||||
(setq cc-bytecomp-environment-set nil)
|
||||
(cc-bytecomp-debug-msg
|
||||
"cc-bytecomp-restore-environment: Done"))))
|
||||
|
||||
(eval
|
||||
;; This eval is to avoid byte compilation of the function below.
|
||||
;; There's some bug in XEmacs 21.4.6 that can cause it to dump core
|
||||
;; here otherwise. My theory is that `cc-bytecomp-load' might be
|
||||
;; redefined recursively during the `load' inside it, and if it in
|
||||
;; that case is byte compiled then the byte interpreter gets
|
||||
;; confused. I haven't succeeded in isolating the bug, though. /mast
|
||||
|
||||
'(defun cc-bytecomp-load (cc-part)
|
||||
;; Eval'ed during compilation to load a CC Mode file from the source
|
||||
;; directory (assuming it's the same as the compiled file
|
||||
;; destination dir).
|
||||
(if (and (boundp 'byte-compile-dest-file)
|
||||
(stringp byte-compile-dest-file))
|
||||
(progn
|
||||
(cc-bytecomp-restore-environment)
|
||||
(let ((load-path
|
||||
(cons (file-name-directory byte-compile-dest-file)
|
||||
load-path))
|
||||
(cc-file (concat cc-part ".el")))
|
||||
(if (member cc-file cc-bytecomp-loaded-files)
|
||||
()
|
||||
(setq cc-bytecomp-loaded-files
|
||||
(cons cc-file cc-bytecomp-loaded-files))
|
||||
(cc-bytecomp-debug-msg
|
||||
"cc-bytecomp-load: Loading %S" cc-file)
|
||||
(load cc-file nil t t)
|
||||
(cc-bytecomp-debug-msg
|
||||
"cc-bytecomp-load: Loaded %S" cc-file)))
|
||||
(cc-bytecomp-setup-environment)
|
||||
t))))
|
||||
|
||||
(defmacro cc-require (cc-part)
|
||||
"Force loading of the corresponding .el file in the current directory
|
||||
during compilation, but compile in a `require'. Don't use within
|
||||
`eval-when-compile'.
|
||||
|
||||
Having cyclic cc-require's will result in infinite recursion. That's
|
||||
somewhat intentional."
|
||||
`(progn
|
||||
(eval-when-compile (cc-bytecomp-load (symbol-name ,cc-part)))
|
||||
(require ,cc-part)))
|
||||
|
||||
(defmacro cc-provide (feature)
|
||||
"A replacement for the `provide' form that restores the environment
|
||||
after the compilation. Don't use within `eval-when-compile'."
|
||||
`(progn
|
||||
(eval-when-compile (cc-bytecomp-restore-environment))
|
||||
(provide ,feature)))
|
||||
|
||||
(defmacro cc-load (cc-part)
|
||||
"Force loading of the corresponding .el file in the current directory
|
||||
during compilation. Don't use outside `eval-when-compile' or
|
||||
`eval-and-compile'.
|
||||
|
||||
Having cyclic cc-load's will result in infinite recursion. That's
|
||||
somewhat intentional."
|
||||
`(or (and (featurep 'cc-bytecomp)
|
||||
(cc-bytecomp-load ,cc-part))
|
||||
(load ,cc-part nil t nil)))
|
||||
|
||||
(defmacro cc-require-when-compile (cc-part)
|
||||
"Force loading of the corresponding .el file in the current directory
|
||||
during compilation, but do a compile time `require' otherwise. Don't
|
||||
use within `eval-when-compile'."
|
||||
`(eval-when-compile
|
||||
(if (and (featurep 'cc-bytecomp)
|
||||
(cc-bytecomp-is-compiling))
|
||||
(if (or (not load-in-progress)
|
||||
(not (featurep ,cc-part)))
|
||||
(cc-bytecomp-load (symbol-name ,cc-part)))
|
||||
(require ,cc-part))))
|
||||
|
||||
(defmacro cc-external-require (feature)
|
||||
"Do a `require' of an external package.
|
||||
This restores and sets up the compilation environment before and
|
||||
afterwards. Don't use within `eval-when-compile'."
|
||||
`(progn
|
||||
(eval-when-compile (cc-bytecomp-restore-environment))
|
||||
(require ,feature)
|
||||
(eval-when-compile (cc-bytecomp-setup-environment))))
|
||||
|
||||
(defun cc-bytecomp-is-compiling ()
|
||||
"Return non-nil if eval'ed during compilation. Don't use outside
|
||||
`eval-when-compile'."
|
||||
(and (boundp 'byte-compile-dest-file)
|
||||
(stringp byte-compile-dest-file)))
|
||||
|
||||
(defmacro cc-bytecomp-defvar (var)
|
||||
"Binds the symbol as a variable during compilation of the file,
|
||||
to silence the byte compiler. Don't use within `eval-when-compile'."
|
||||
`(eval-when-compile
|
||||
(if (boundp ',var)
|
||||
(cc-bytecomp-debug-msg
|
||||
"cc-bytecomp-defvar: %s bound already as variable" ',var)
|
||||
(if (not (memq ',var cc-bytecomp-unbound-variables))
|
||||
(progn
|
||||
(cc-bytecomp-debug-msg
|
||||
"cc-bytecomp-defvar: Saving %s (as unbound)" ',var)
|
||||
(setq cc-bytecomp-unbound-variables
|
||||
(cons ',var cc-bytecomp-unbound-variables))))
|
||||
(if (and (cc-bytecomp-is-compiling)
|
||||
(not load-in-progress))
|
||||
(progn
|
||||
(defvar ,var)
|
||||
(set ',var (intern (concat "cc-bytecomp-ignore-var:"
|
||||
(symbol-name ',var))))
|
||||
(cc-bytecomp-debug-msg
|
||||
"cc-bytecomp-defvar: Covered variable %s" ',var))))))
|
||||
|
||||
(defmacro cc-bytecomp-defun (fun)
|
||||
"Bind the symbol as a function during compilation of the file,
|
||||
to silence the byte compiler. Don't use within `eval-when-compile'.
|
||||
|
||||
If the symbol already is bound as a function, it will keep that
|
||||
definition. That means that this macro will not shut up warnings
|
||||
about incorrect number of arguments. It's dangerous to try to replace
|
||||
existing functions since the byte compiler might need the definition
|
||||
at compile time, e.g. for macros and inline functions."
|
||||
`(eval-when-compile
|
||||
(if (fboundp ',fun)
|
||||
(cc-bytecomp-debug-msg
|
||||
"cc-bytecomp-defun: %s bound already as function" ',fun)
|
||||
(if (not (assq ',fun cc-bytecomp-original-functions))
|
||||
(progn
|
||||
(cc-bytecomp-debug-msg
|
||||
"cc-bytecomp-defun: Saving %s (as unbound)" ',fun)
|
||||
(setq cc-bytecomp-original-functions
|
||||
(cons (list ',fun nil 'unbound)
|
||||
cc-bytecomp-original-functions))))
|
||||
(if (and (cc-bytecomp-is-compiling)
|
||||
(not load-in-progress))
|
||||
(progn
|
||||
(fset ',fun (intern (concat "cc-bytecomp-ignore-fun:"
|
||||
(symbol-name ',fun))))
|
||||
(cc-bytecomp-debug-msg
|
||||
"cc-bytecomp-defun: Covered function %s" ',fun))))))
|
||||
|
||||
(put 'cc-bytecomp-defmacro 'lisp-indent-function 'defun)
|
||||
(defmacro cc-bytecomp-defmacro (fun &rest temp-macro)
|
||||
"Bind the symbol as a macro during compilation (and evaluation) of the
|
||||
file. Don't use outside `eval-when-compile'."
|
||||
`(let ((orig-fun (assq ',fun cc-bytecomp-original-functions)))
|
||||
(if (not orig-fun)
|
||||
(setq orig-fun
|
||||
(list ',fun
|
||||
nil
|
||||
(if (fboundp ',fun)
|
||||
(progn
|
||||
(cc-bytecomp-debug-msg
|
||||
"cc-bytecomp-defmacro: Saving %s" ',fun)
|
||||
(symbol-function ',fun))
|
||||
(cc-bytecomp-debug-msg
|
||||
"cc-bytecomp-defmacro: Saving %s as unbound" ',fun)
|
||||
'unbound))
|
||||
cc-bytecomp-original-functions
|
||||
(cons orig-fun cc-bytecomp-original-functions)))
|
||||
(defmacro ,fun ,@temp-macro)
|
||||
(cc-bytecomp-debug-msg
|
||||
"cc-bytecomp-defmacro: Bound macro %s" ',fun)
|
||||
(setcar (cdr orig-fun) (symbol-function ',fun))))
|
||||
|
||||
(defmacro cc-bytecomp-put (symbol propname value)
|
||||
"Set a property on a symbol during compilation (and evaluation) of
|
||||
the file. Don't use outside `eval-when-compile'."
|
||||
`(eval-when-compile
|
||||
(if (not (assoc (cons ,symbol ,propname) cc-bytecomp-original-properties))
|
||||
(progn
|
||||
(cc-bytecomp-debug-msg
|
||||
"cc-bytecomp-put: Saving property %s for %s with value %s"
|
||||
,propname ,symbol (get ,symbol ,propname))
|
||||
(setq cc-bytecomp-original-properties
|
||||
(cons (cons (cons ,symbol ,propname)
|
||||
(cons ,value (get ,symbol ,propname)))
|
||||
cc-bytecomp-original-properties))))
|
||||
(put ,symbol ,propname ,value)
|
||||
(cc-bytecomp-debug-msg
|
||||
"cc-bytecomp-put: Bound property %s for %s to %s"
|
||||
,propname ,symbol ,value)))
|
||||
|
||||
(defmacro cc-bytecomp-push (symbol value)
|
||||
"Set SYMBOL to VALUE during compilation (and evaluation) of the file.
|
||||
Don't use within `eval-when-compile'."
|
||||
`(eval-when-compile
|
||||
(cc-bytecomp-debug-msg
|
||||
"cc-bytecomp-push: symbol is %s, value is %s"
|
||||
',symbol ,value)
|
||||
(setq cc-bytecomp-set-vars
|
||||
(cons (list ',symbol
|
||||
(if (boundp ',symbol)
|
||||
,symbol
|
||||
'cc-bytecomp-unbound)
|
||||
,value)
|
||||
cc-bytecomp-push-vars))
|
||||
(cc-bytecomp-debug-msg
|
||||
"cc-bytecomp-push: set %s to %s" ',symbol ,value)
|
||||
(set ',symbol ,value)
|
||||
(cc-bytecomp-debug-msg
|
||||
"cc-bytecomp-push: cc-bytecomp-push-vars is %s" cc-bytecomp-push-vars)))
|
||||
|
||||
(defmacro cc-bytecomp-obsolete-var (symbol)
|
||||
"Suppress warnings that the given symbol is an obsolete variable.
|
||||
Don't use within `eval-when-compile'."
|
||||
`(eval-when-compile
|
||||
(if (get ',symbol 'byte-obsolete-variable)
|
||||
(cc-bytecomp-put ',symbol 'byte-obsolete-variable nil)
|
||||
;; This avoids a superfluous compiler warning
|
||||
;; about calling `get' for effect.
|
||||
t)))
|
||||
|
||||
(defun cc-bytecomp-ignore-obsolete (form)
|
||||
;; Wraps a call to `byte-compile-obsolete' that suppresses the warning.
|
||||
(let ((byte-compile-warnings byte-compile-warnings))
|
||||
(if (fboundp 'byte-compile-disable-warning) ; Emacs 23+
|
||||
(byte-compile-disable-warning 'obsolete)
|
||||
(delq 'obsolete (append byte-compile-warnings nil)))
|
||||
(if (fboundp 'byte-compile-obsolete) ; purely to suppress a warnin.
|
||||
(byte-compile-obsolete form))))
|
||||
|
||||
(defmacro cc-bytecomp-obsolete-fun (symbol)
|
||||
"Suppress warnings that the given symbol is an obsolete function.
|
||||
Don't use within `eval-when-compile'."
|
||||
`(eval-when-compile
|
||||
,(if (fboundp 'byte-compile-obsolete)
|
||||
`(if (eq (get ',symbol 'byte-compile) 'byte-compile-obsolete)
|
||||
(cc-bytecomp-put ',symbol 'byte-compile
|
||||
'cc-bytecomp-ignore-obsolete)
|
||||
;; This avoids a superfluous compiler warning
|
||||
;; about calling `get' for effect.
|
||||
t)
|
||||
`(cc-bytecomp-push byte-compile-not-obsolete-funcs '(,symbol)))))
|
||||
|
||||
(defmacro cc-bytecomp-boundp (symbol)
|
||||
"Return non-nil if the given symbol is bound as a variable outside
|
||||
the compilation. This is the same as using `boundp' but additionally
|
||||
exclude any variables that have been bound during compilation with
|
||||
`cc-bytecomp-defvar'."
|
||||
(if (and (cc-bytecomp-is-compiling)
|
||||
(memq (car (cdr symbol)) cc-bytecomp-unbound-variables))
|
||||
nil
|
||||
`(boundp ,symbol)))
|
||||
|
||||
(defmacro cc-bytecomp-fboundp (symbol)
|
||||
"Return non-nil if the given symbol is bound as a function outside
|
||||
the compilation. This is the same as using `fboundp' but additionally
|
||||
exclude any functions that have been bound during compilation with
|
||||
`cc-bytecomp-defun'."
|
||||
(let (fun-elem)
|
||||
(if (and (cc-bytecomp-is-compiling)
|
||||
(setq fun-elem (assq (car (cdr symbol))
|
||||
cc-bytecomp-original-functions))
|
||||
(eq (elt fun-elem 2) 'unbound))
|
||||
nil
|
||||
`(fboundp ,symbol))))
|
||||
|
||||
|
||||
(provide 'cc-bytecomp)
|
||||
|
||||
;;; arch-tag: 2d71b3ad-57b0-4b13-abd3-ab836e08f975
|
||||
;;; cc-bytecomp.el ends here
|
||||
4710
site-lisp/cc-mode/5.32.3/cc-cmds.el
Normal file
4710
site-lisp/cc-mode/5.32.3/cc-cmds.el
Normal file
File diff suppressed because it is too large
Load diff
166
site-lisp/cc-mode/5.32.3/cc-compat.el
Normal file
166
site-lisp/cc-mode/5.32.3/cc-compat.el
Normal file
|
|
@ -0,0 +1,166 @@
|
|||
;;; cc-compat.el --- cc-mode compatibility with c-mode.el confusion
|
||||
|
||||
;; Copyright (C) 1985, 1987, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
|
||||
;; 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009,
|
||||
;; 2010, 2011, 2012 Free Software Foundation, Inc.
|
||||
|
||||
;; Authors: 1998- Martin Stjernholm
|
||||
;; 1994-1999 Barry A. Warsaw
|
||||
;; Maintainer: bug-cc-mode@gnu.org
|
||||
;; Created: August 1994, split from cc-mode.el
|
||||
;; Version: See cc-mode.el
|
||||
;; Keywords: c languages oop
|
||||
|
||||
;; This file is part of GNU Emacs.
|
||||
|
||||
;; GNU Emacs is free software; you can redistribute it and/or modify
|
||||
;; it under the terms of the GNU General Public License as published by
|
||||
;; the Free Software Foundation; either version 3, or (at your option)
|
||||
;; any later version.
|
||||
|
||||
;; GNU Emacs is distributed in the hope that it will be useful,
|
||||
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
;; GNU General Public License for more details.
|
||||
|
||||
;; You should have received a copy of the GNU General Public License
|
||||
;; along with this program; see the file COPYING. If not, see
|
||||
;; <http://www.gnu.org/licenses/>.
|
||||
|
||||
;;; Commentary:
|
||||
;;
|
||||
;; Boring old c-mode.el (BOCM) is confusion and brain melt. cc-mode.el
|
||||
;; is clarity of thought and purity of chi. If you are still unwilling
|
||||
;; to accept enlightenment, this might help, or it may prolong your
|
||||
;; agony.
|
||||
;;
|
||||
;; To use, add the following to your c-mode-hook:
|
||||
;;
|
||||
;; (require 'cc-compat)
|
||||
;; (c-set-style "BOCM")
|
||||
;;
|
||||
;; This file is completely unsupported! Although it has been patched
|
||||
;; superficially to keep pace with the rest of CC Mode, it hasn't been
|
||||
;; tested for a long time.
|
||||
|
||||
;;; Code:
|
||||
|
||||
(eval-when-compile
|
||||
(let ((load-path
|
||||
(if (and (boundp 'byte-compile-dest-file)
|
||||
(stringp byte-compile-dest-file))
|
||||
(cons (file-name-directory byte-compile-dest-file) load-path)
|
||||
load-path)))
|
||||
(load "cc-bytecomp" nil t)))
|
||||
|
||||
(cc-require 'cc-defs)
|
||||
(cc-require 'cc-vars)
|
||||
(cc-require 'cc-styles)
|
||||
(cc-require 'cc-engine)
|
||||
|
||||
|
||||
;; In case c-mode.el isn't loaded
|
||||
(defvar c-indent-level 2
|
||||
"*Indentation of C statements with respect to containing block.")
|
||||
(defvar c-brace-imaginary-offset 0
|
||||
"*Imagined indentation of a C open brace that actually follows a statement.")
|
||||
(defvar c-brace-offset 0
|
||||
"*Extra indentation for braces, compared with other text in same context.")
|
||||
(defvar c-argdecl-indent 5
|
||||
"*Indentation level of declarations of C function arguments.")
|
||||
(defvar c-label-offset -2
|
||||
"*Offset of C label lines and case statements relative to usual indentation.")
|
||||
(defvar c-continued-statement-offset 2
|
||||
"*Extra indent for lines not starting new statements.")
|
||||
(defvar c-continued-brace-offset 0
|
||||
"*Extra indent for substatements that start with open-braces.
|
||||
This is in addition to c-continued-statement-offset.")
|
||||
|
||||
|
||||
|
||||
;; these offsets are taken by brute force testing c-mode.el, since
|
||||
;; there's no logic to what it does.
|
||||
(let* ((offsets '(c-offsets-alist .
|
||||
((defun-block-intro . cc-block-intro-offset)
|
||||
(statement-block-intro . cc-block-intro-offset)
|
||||
(defun-open . 0)
|
||||
(class-open . 0)
|
||||
(inline-open . c-brace-offset)
|
||||
(block-open . c-brace-offset)
|
||||
(block-close . cc-block-close-offset)
|
||||
(brace-list-open . c-brace-offset)
|
||||
(substatement-open . cc-substatement-open-offset)
|
||||
(substatement . c-continued-statement-offset)
|
||||
(knr-argdecl-intro . c-argdecl-indent)
|
||||
(case-label . c-label-offset)
|
||||
(access-label . c-label-offset)
|
||||
(label . c-label-offset)
|
||||
))))
|
||||
(c-add-style "BOCM" offsets))
|
||||
|
||||
|
||||
(defun cc-block-intro-offset (langelem)
|
||||
;; taken directly from calculate-c-indent confusion
|
||||
(save-excursion
|
||||
(c-backward-syntactic-ws)
|
||||
(if (eq (char-before) ?{)
|
||||
(forward-char -1)
|
||||
(goto-char (cdr langelem)))
|
||||
(let* ((curcol (save-excursion
|
||||
(goto-char (cdr langelem))
|
||||
(current-column)))
|
||||
(bocm-lossage
|
||||
;; If no previous statement, indent it relative to line
|
||||
;; brace is on. For open brace in column zero, don't let
|
||||
;; statement start there too. If c-indent-level is zero,
|
||||
;; use c-brace-offset + c-continued-statement-offset
|
||||
;; instead. For open-braces not the first thing in a line,
|
||||
;; add in c-brace-imaginary-offset.
|
||||
(+ (if (and (bolp) (zerop c-indent-level))
|
||||
(+ c-brace-offset c-continued-statement-offset)
|
||||
c-indent-level)
|
||||
;; Move back over whitespace before the openbrace. If
|
||||
;; openbrace is not first nonwhite thing on the line,
|
||||
;; add the c-brace-imaginary-offset.
|
||||
(progn (skip-chars-backward " \t")
|
||||
(if (bolp) 0 c-brace-imaginary-offset))
|
||||
;; If the openbrace is preceded by a parenthesized exp,
|
||||
;; move to the beginning of that; possibly a different
|
||||
;; line
|
||||
(progn
|
||||
(if (eq (char-before) ?\))
|
||||
(c-forward-sexp -1))
|
||||
;; Get initial indentation of the line we are on.
|
||||
(current-indentation)))))
|
||||
(- bocm-lossage curcol))))
|
||||
|
||||
|
||||
(defun cc-block-close-offset (langelem)
|
||||
(save-excursion
|
||||
(let* ((here (point))
|
||||
bracep
|
||||
(curcol (progn
|
||||
(goto-char (cdr langelem))
|
||||
(current-column)))
|
||||
(bocm-lossage (progn
|
||||
(goto-char (cdr langelem))
|
||||
(if (eq (char-after) ?{)
|
||||
(setq bracep t)
|
||||
(goto-char here)
|
||||
(beginning-of-line)
|
||||
(backward-up-list 1)
|
||||
(forward-char 1)
|
||||
(c-forward-syntactic-ws))
|
||||
(current-column))))
|
||||
(- bocm-lossage curcol
|
||||
(if bracep 0 c-indent-level)))))
|
||||
|
||||
|
||||
(defun cc-substatement-open-offset (langelem)
|
||||
(+ c-continued-statement-offset c-continued-brace-offset))
|
||||
|
||||
|
||||
(cc-provide 'cc-compat)
|
||||
|
||||
;;; arch-tag: 564dab2f-e6ad-499c-a4a3-fedec3ecc192
|
||||
;;; cc-compat.el ends here
|
||||
2446
site-lisp/cc-mode/5.32.3/cc-defs.el
Normal file
2446
site-lisp/cc-mode/5.32.3/cc-defs.el
Normal file
File diff suppressed because it is too large
Load diff
10874
site-lisp/cc-mode/5.32.3/cc-engine.el
Normal file
10874
site-lisp/cc-mode/5.32.3/cc-engine.el
Normal file
File diff suppressed because it is too large
Load diff
155
site-lisp/cc-mode/5.32.3/cc-fix.el
Normal file
155
site-lisp/cc-mode/5.32.3/cc-fix.el
Normal file
|
|
@ -0,0 +1,155 @@
|
|||
;;; cc-fix.el --- compatibility library for old (X)Emacs versions
|
||||
|
||||
;; Copyright (C) 1985,1987,1992-2003, 2004, 2005, 2006, 2007, 2008,
|
||||
;; 2009, 2010, 2011, 2012 Free Software Foundation, Inc.
|
||||
|
||||
;; Authors: 2003- Alan Mackenzie
|
||||
;; 1998- Martin Stjernholm
|
||||
;; 1997-1999 Barry A. Warsaw
|
||||
;; Maintainer: bug-cc-mode@gnu.org
|
||||
;; Created: 03-Jul-1997 (as cc-mode-19.el)
|
||||
;; Version: See cc-mode.el
|
||||
;; Keywords: c languages oop
|
||||
|
||||
;; This file is not part of GNU Emacs.
|
||||
|
||||
;; This program is free software; you can redistribute it and/or modify
|
||||
;; it under the terms of the GNU General Public License as published by
|
||||
;; the Free Software Foundation; either version 3 of the License, or
|
||||
;; (at your option) any later version.
|
||||
|
||||
;; This program is distributed in the hope that it will be useful,
|
||||
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
;; GNU General Public License for more details.
|
||||
|
||||
;; You should have received a copy of the GNU General Public License
|
||||
;; along with this program; see the file COPYING. If not, see
|
||||
;; <http://www.gnu.org/licenses/>.
|
||||
|
||||
;;; Commentary:
|
||||
|
||||
;; This file is necessary in order to run CC Mode in older (X)Emacs
|
||||
;; versions. It's not needed at all for the latest versions of Emacs
|
||||
;; and XEmacs.
|
||||
|
||||
;;; Code:
|
||||
|
||||
(eval-when-compile
|
||||
(let ((load-path
|
||||
(if (and (boundp 'byte-compile-dest-file)
|
||||
(stringp byte-compile-dest-file))
|
||||
(cons (file-name-directory byte-compile-dest-file) load-path)
|
||||
load-path)))
|
||||
(load "cc-bytecomp" nil t)))
|
||||
|
||||
;; Silence the compiler (in case this file is compiled by other
|
||||
;; Emacsen even though it isn't used by them).
|
||||
(cc-bytecomp-obsolete-fun byte-code-function-p)
|
||||
(cc-bytecomp-defun regexp-opt-depth)
|
||||
|
||||
(cc-external-require 'advice)
|
||||
|
||||
;; Emacs 20.n doesn't have the macros push and pop. Here're the Emacs 21
|
||||
;; definitions.
|
||||
(or (fboundp 'push)
|
||||
(defmacro push (newelt listname)
|
||||
"Add NEWELT to the list stored in the symbol LISTNAME.
|
||||
This is equivalent to (setq LISTNAME (cons NEWELT LISTNAME)).
|
||||
LISTNAME must be a symbol."
|
||||
(list 'setq listname
|
||||
(list 'cons newelt listname))))
|
||||
|
||||
(or (fboundp 'pop)
|
||||
(defmacro pop (listname)
|
||||
"Return the first element of LISTNAME's value, and remove it from the list.
|
||||
LISTNAME must be a symbol whose value is a list.
|
||||
If the value is nil, `pop' returns nil but does not actually
|
||||
change the list."
|
||||
(list 'prog1 (list 'car listname)
|
||||
(list 'setq listname (list 'cdr listname)))))
|
||||
|
||||
|
||||
(if (/= (regexp-opt-depth "\\(\\(\\)\\)") 2)
|
||||
(progn
|
||||
;; Emacs 21.1 has a buggy regexp-opt-depth which prevents CC
|
||||
;; Mode building. Those in Emacs 21.[23] are not entirely
|
||||
;; accurate. The following definition comes from Emacs's
|
||||
;; regexp-opt.el CVS version 1.25 and is believed to be a
|
||||
;; rigorously correct implementation.
|
||||
(defconst regexp-opt-not-groupie*-re
|
||||
(let* ((harmless-ch "[^\\\\[]")
|
||||
(esc-pair-not-lp "\\\\[^(]")
|
||||
(class-harmless-ch "[^][]")
|
||||
(class-lb-harmless "[^]:]")
|
||||
(class-lb-colon-maybe-charclass ":\\([a-z]+:]\\)?")
|
||||
(class-lb (concat "\\[\\(" class-lb-harmless
|
||||
"\\|" class-lb-colon-maybe-charclass "\\)"))
|
||||
(class
|
||||
(concat "\\[^?]?"
|
||||
"\\(" class-harmless-ch
|
||||
"\\|" class-lb "\\)*"
|
||||
"\\[?]")) ; special handling for bare [ at end of re
|
||||
(shy-lp "\\\\(\\?:"))
|
||||
(concat "\\(" harmless-ch "\\|" esc-pair-not-lp
|
||||
"\\|" class "\\|" shy-lp "\\)*"))
|
||||
"Matches any part of a regular expression EXCEPT for non-shy \"\\\\(\"s")
|
||||
|
||||
(defun regexp-opt-depth (regexp)
|
||||
"Return the depth of REGEXP.
|
||||
This means the number of regexp grouping constructs (parenthesised expressions)
|
||||
in REGEXP."
|
||||
(save-match-data
|
||||
;; Hack to signal an error if REGEXP does not have balanced
|
||||
;; parentheses.
|
||||
(string-match regexp "")
|
||||
;; Count the number of open parentheses in REGEXP.
|
||||
(let ((count 0) start)
|
||||
(while
|
||||
(progn
|
||||
(string-match regexp-opt-not-groupie*-re regexp start)
|
||||
(setq start ( + (match-end 0) 2)) ; +2 for "\\(" after match-end.
|
||||
(<= start (length regexp)))
|
||||
(setq count (1+ count)))
|
||||
count)))
|
||||
))
|
||||
|
||||
;; Some XEmacs versions have a bug in which font-lock-compile-keywords
|
||||
;; overwrites the variable font-lock-keywords with its result. This causes
|
||||
;; havoc when what the function is compiling is font-lock-SYNTACTIC-keywords,
|
||||
;; hence....
|
||||
(eval-after-load "font-lock"
|
||||
'(when (and (featurep 'xemacs) ; There is now (2005/12) code in GNU Emacs CVS
|
||||
; to make the call to f-l-c-k throw an error.
|
||||
(let (font-lock-keywords)
|
||||
(font-lock-compile-keywords '("\\<\\>"))
|
||||
font-lock-keywords)) ; did the previous call foul this up?
|
||||
(defun font-lock-compile-keywords (keywords)
|
||||
"Compile KEYWORDS (a list) and return the list of compiled keywords.
|
||||
Each keyword has the form (MATCHER HIGHLIGHT ...). See `font-lock-keywords'."
|
||||
(if (eq (car-safe keywords) t)
|
||||
keywords
|
||||
(cons t (mapcar 'font-lock-compile-keyword keywords))))
|
||||
(defadvice font-lock-fontify-keywords-region (before c-compile-font-lock-keywords
|
||||
activate preactivate)
|
||||
(unless (eq (car-safe font-lock-keywords) t)
|
||||
(setq font-lock-keywords
|
||||
(font-lock-compile-keywords font-lock-keywords))))
|
||||
))
|
||||
|
||||
;; XEmacs 21.4 doesn't have `delete-dups'.
|
||||
(if (not (fboundp 'delete-dups))
|
||||
(defun delete-dups (list)
|
||||
"Destructively remove `equal' duplicates from LIST.
|
||||
Store the result in LIST and return it. LIST must be a proper list.
|
||||
Of several `equal' occurrences of an element in LIST, the first
|
||||
one is kept."
|
||||
(let ((tail list))
|
||||
(while tail
|
||||
(setcdr tail (delete (car tail) (cdr tail)))
|
||||
(setq tail (cdr tail))))
|
||||
list))
|
||||
|
||||
|
||||
(cc-provide 'cc-fix)
|
||||
;;; cc-fix.el ends here
|
||||
2694
site-lisp/cc-mode/5.32.3/cc-fonts.el
Normal file
2694
site-lisp/cc-mode/5.32.3/cc-fonts.el
Normal file
File diff suppressed because it is too large
Load diff
578
site-lisp/cc-mode/5.32.3/cc-guess.el
Normal file
578
site-lisp/cc-mode/5.32.3/cc-guess.el
Normal file
|
|
@ -0,0 +1,578 @@
|
|||
;;; cc-guess.el --- guess indentation values by scanning existing code
|
||||
|
||||
;; Copyright (C) 1985,1987,1992-2003, 2004, 2005, 2006, 2007, 2008,
|
||||
;; 2009, 2010, 2011, 2012 Free Software Foundation, Inc.
|
||||
|
||||
;; Author: 1994-1995 Barry A. Warsaw
|
||||
;; 2011- Masatake YAMATO
|
||||
;; Maintainer: bug-cc-mode@gnu.org
|
||||
;; Created: August 1994, split from cc-mode.el
|
||||
;; Version: See cc-mode.el
|
||||
;; Keywords: c languages oop
|
||||
|
||||
;; This file is part of GNU Emacs.
|
||||
|
||||
;; GNU Emacs is free software; you can redistribute it and/or modify
|
||||
;; it under the terms of the GNU General Public License as published by
|
||||
;; the Free Software Foundation; either version 3 of the License, or
|
||||
;; (at your option) any later version.
|
||||
;;
|
||||
;; GNU EMACS is distributed in the hope that it will be useful,
|
||||
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
;; GNU General Public License for more details.
|
||||
;;
|
||||
;; You should have received a copy of the GNU General Public License
|
||||
;; along with this program; see the file COPYING. If not, see
|
||||
;; <http://www.gnu.org/licenses/>.
|
||||
|
||||
;;; Commentary:
|
||||
;;
|
||||
;; This file contains routines that help guess the cc-mode style in a
|
||||
;; particular region/buffer. Here style means `c-offsets-alist' and
|
||||
;; `c-basic-offset'.
|
||||
;;
|
||||
;; The main entry point of this program is `c-guess' command but there
|
||||
;; are some variants.
|
||||
;;
|
||||
;; Suppose the major mode for the current buffer is one of the modes
|
||||
;; provided by cc-mode. `c-guess' guesses the indentation style by
|
||||
;; examining the indentation in the region between beginning of buffer
|
||||
;; and `c-guess-region-max'.
|
||||
|
||||
;; and installs the guessed style. The name for installed style is given
|
||||
;; by `c-guess-style-name'.
|
||||
;;
|
||||
;; `c-guess-buffer' does the same but in the whole buffer.
|
||||
;; `c-guess-region' does the same but in the region between the point
|
||||
;; and the mark. `c-guess-no-install', `c-guess-buffer-no-install'
|
||||
;; and `c-guess-region-no-install' guess the indentation style but
|
||||
;; don't install it. You can review a guessed style with `c-guess-view'.
|
||||
;; After reviewing, use `c-guess-install' to install the style
|
||||
;; if you prefer it.
|
||||
;;
|
||||
;; If you want to reuse the guessed style in another buffer,
|
||||
;; run `c-set-style' command with the name of the guessed style:
|
||||
;; "*c-guess*:<name-of-file-which-examined-when-guessing>".
|
||||
;; Once the guessed style is installed explicitly with `c-guess-install'
|
||||
;; or implicitly with `c-guess', `c-guess-buffer', or `c-guess-region',
|
||||
;; a style name is given by `c-guess-style-name' with the above form.
|
||||
;;
|
||||
;; If you want to reuse the guessed style in future emacs sessions,
|
||||
;; you may want to put it to your .emacs. `c-guess-view' is for
|
||||
;; you. It emits emacs lisp code which defines the last guessed
|
||||
;; style, in a temporary buffer. You can put the emitted code into
|
||||
;; your .emacs. This command was suggested by Alan Mackenzie.
|
||||
|
||||
;;; Code:
|
||||
|
||||
(eval-when-compile
|
||||
(let ((load-path
|
||||
(if (and (boundp 'byte-compile-dest-file)
|
||||
(stringp byte-compile-dest-file))
|
||||
(cons (file-name-directory byte-compile-dest-file) load-path)
|
||||
load-path)))
|
||||
(load "cc-bytecomp" nil t)))
|
||||
|
||||
(cc-require 'cc-defs)
|
||||
(cc-require 'cc-engine)
|
||||
(cc-require 'cc-styles)
|
||||
(cc-bytecomp-defvar make-progress-reporter)
|
||||
(cc-bytecomp-defvar progress-reporter-update)
|
||||
(cc-bytecomp-defvar progress-reporter-done)
|
||||
|
||||
|
||||
|
||||
(defcustom c-guess-offset-threshold 10
|
||||
"Threshold of acceptable offsets when examining indent information.
|
||||
Discard an examined offset if its absolute value is greater than this.
|
||||
|
||||
The offset of a line included in the indent information returned by
|
||||
`c-guess-basic-syntax'."
|
||||
:type 'integer
|
||||
:group 'c)
|
||||
|
||||
(defcustom c-guess-region-max 50000
|
||||
"The maximum region size for examining indent information with `c-guess'.
|
||||
It takes a long time to examine indent information from a large region;
|
||||
this option helps you limit that time. `nil' means no limit."
|
||||
:type 'integer
|
||||
:group 'c)
|
||||
|
||||
|
||||
;;;###autoload
|
||||
(defvar c-guess-guessed-offsets-alist nil
|
||||
"Currently guessed offsets-alist.")
|
||||
;;;###autoload
|
||||
(defvar c-guess-guessed-basic-offset nil
|
||||
"Currently guessed basic-offset.")
|
||||
|
||||
(defvar c-guess-accumulator nil)
|
||||
;; Accumulated examined indent information. Information is represented
|
||||
;; in a list. Each element in it has following structure:
|
||||
;;
|
||||
;; (syntactic-symbol ((indentation-offset1 . number-of-times1)
|
||||
;; (indentation-offset2 . number-of-times2)
|
||||
;; ...))
|
||||
;;
|
||||
;; This structure is built by `c-guess-accumulate-offset'.
|
||||
;;
|
||||
;; Here we call the pair (indentation-offset1 . number-of-times1) a
|
||||
;; counter. `c-guess-sort-accumulator' sorts the order of
|
||||
;; counters by number-of-times.
|
||||
;; Use `c-guess-dump-accumulator' to see the value.
|
||||
|
||||
(defconst c-guess-conversions
|
||||
'((c . c-lineup-C-comments)
|
||||
(inher-cont . c-lineup-multi-inher)
|
||||
(string . -1000)
|
||||
(comment-intro . c-lineup-comment)
|
||||
(arglist-cont-nonempty . c-lineup-arglist)
|
||||
(arglist-close . c-lineup-close-paren)
|
||||
(cpp-macro . -1000)))
|
||||
|
||||
|
||||
;;;###autoload
|
||||
(defun c-guess (&optional accumulate)
|
||||
"Guess the style in the region up to `c-guess-region-max', and install it.
|
||||
|
||||
The style is given a name based on the file's absolute file name.
|
||||
|
||||
If given a prefix argument (or if the optional argument ACCUMULATE is
|
||||
non-nil) then the previous guess is extended, otherwise a new guess is
|
||||
made from scratch."
|
||||
(interactive "P")
|
||||
(c-guess-region (point-min)
|
||||
(min (point-max) (or c-guess-region-max
|
||||
(point-max)))
|
||||
accumulate))
|
||||
|
||||
;;;###autoload
|
||||
(defun c-guess-no-install (&optional accumulate)
|
||||
"Guess the style in the region up to `c-guess-region-max'; don't install it.
|
||||
|
||||
If given a prefix argument (or if the optional argument ACCUMULATE is
|
||||
non-nil) then the previous guess is extended, otherwise a new guess is
|
||||
made from scratch."
|
||||
(interactive "P")
|
||||
(c-guess-region-no-install (point-min)
|
||||
(min (point-max) (or c-guess-region-max
|
||||
(point-max)))
|
||||
accumulate))
|
||||
|
||||
;;;###autoload
|
||||
(defun c-guess-buffer (&optional accumulate)
|
||||
"Guess the style on the whole current buffer, and install it.
|
||||
|
||||
The style is given a name based on the file's absolute file name.
|
||||
|
||||
If given a prefix argument (or if the optional argument ACCUMULATE is
|
||||
non-nil) then the previous guess is extended, otherwise a new guess is
|
||||
made from scratch."
|
||||
(interactive "P")
|
||||
(c-guess-region (point-min)
|
||||
(point-max)
|
||||
accumulate))
|
||||
|
||||
;;;###autoload
|
||||
(defun c-guess-buffer-no-install (&optional accumulate)
|
||||
"Guess the style on the whole current buffer; don't install it.
|
||||
|
||||
If given a prefix argument (or if the optional argument ACCUMULATE is
|
||||
non-nil) then the previous guess is extended, otherwise a new guess is
|
||||
made from scratch."
|
||||
(interactive "P")
|
||||
(c-guess-region-no-install (point-min)
|
||||
(point-max)
|
||||
accumulate))
|
||||
|
||||
;;;###autoload
|
||||
(defun c-guess-region (start end &optional accumulate)
|
||||
"Guess the style on the region and install it.
|
||||
|
||||
The style is given a name based on the file's absolute file name.
|
||||
|
||||
If given a prefix argument (or if the optional argument ACCUMULATE is
|
||||
non-nil) then the previous guess is extended, otherwise a new guess is
|
||||
made from scratch."
|
||||
(interactive "r\nP")
|
||||
(c-guess-region-no-install start end accumulate)
|
||||
(c-guess-install))
|
||||
|
||||
|
||||
(defsubst c-guess-empty-line-p ()
|
||||
(eq (line-beginning-position)
|
||||
(line-end-position)))
|
||||
|
||||
;;;###autoload
|
||||
(defun c-guess-region-no-install (start end &optional accumulate)
|
||||
"Guess the style on the region; don't install it.
|
||||
|
||||
Every line of code in the region is examined and values for the following two
|
||||
variables are guessed:
|
||||
|
||||
* `c-basic-offset', and
|
||||
* the indentation values of the various syntactic symbols in
|
||||
`c-offsets-alist'.
|
||||
|
||||
The guessed values are put into `c-guess-guessed-basic-offset' and
|
||||
`c-guess-guessed-offsets-alist'.
|
||||
|
||||
Frequencies of use are taken into account when guessing, so minor
|
||||
inconsistencies in the indentation style shouldn't produce wrong guesses.
|
||||
|
||||
If given a prefix argument (or if the optional argument ACCUMULATE is
|
||||
non-nil) then the previous examination is extended, otherwise a new
|
||||
guess is made from scratch.
|
||||
|
||||
Note that the larger the region to guess in, the slower the guessing.
|
||||
So you can limit the region with `c-guess-region-max'."
|
||||
(interactive "r\nP")
|
||||
(let ((accumulator (when accumulate c-guess-accumulator)))
|
||||
(setq c-guess-accumulator (c-guess-examine start end accumulator))
|
||||
(let ((pair (c-guess-guess c-guess-accumulator)))
|
||||
(setq c-guess-guessed-basic-offset (car pair)
|
||||
c-guess-guessed-offsets-alist (cdr pair)))))
|
||||
|
||||
|
||||
(defun c-guess-examine (start end accumulator)
|
||||
(let ((reporter (when (fboundp 'make-progress-reporter)
|
||||
(make-progress-reporter "Examining Indentation "
|
||||
start
|
||||
end))))
|
||||
(save-excursion
|
||||
(goto-char start)
|
||||
(while (< (point) end)
|
||||
(unless (c-guess-empty-line-p)
|
||||
(mapc (lambda (s)
|
||||
(setq accumulator (or (c-guess-accumulate accumulator s)
|
||||
accumulator)))
|
||||
(c-save-buffer-state () (c-guess-basic-syntax))))
|
||||
(when reporter (progress-reporter-update reporter (point)))
|
||||
(forward-line 1)))
|
||||
(when reporter (progress-reporter-done reporter)))
|
||||
(c-guess-sort-accumulator accumulator))
|
||||
|
||||
(defun c-guess-guess (accumulator)
|
||||
;; Guess basic-offset and offsets-alist from ACCUMULATOR,
|
||||
;; then return them as a cons: (basic-offset . offsets-alist).
|
||||
;; See the comments at `c-guess-accumulator' about the format
|
||||
;; ACCUMULATOR.
|
||||
(let* ((basic-offset (c-guess-make-basic-offset accumulator))
|
||||
(typical-offsets-alist (c-guess-make-offsets-alist
|
||||
accumulator))
|
||||
(symbolic-offsets-alist (c-guess-symbolize-offsets-alist
|
||||
typical-offsets-alist
|
||||
basic-offset))
|
||||
(merged-offsets-alist (c-guess-merge-offsets-alists
|
||||
(copy-tree c-guess-conversions)
|
||||
symbolic-offsets-alist)))
|
||||
(cons basic-offset merged-offsets-alist)))
|
||||
|
||||
(defun c-guess-current-offset (relpos)
|
||||
;; Calculate relative indentation (point) to RELPOS.
|
||||
(- (progn (back-to-indentation)
|
||||
(current-column))
|
||||
(save-excursion
|
||||
(goto-char relpos)
|
||||
(current-column))))
|
||||
|
||||
(defun c-guess-accumulate (accumulator syntax-element)
|
||||
;; Add SYNTAX-ELEMENT to ACCUMULATOR.
|
||||
(let ((symbol (car syntax-element))
|
||||
(relpos (cadr syntax-element)))
|
||||
(when (numberp relpos)
|
||||
(let ((offset (c-guess-current-offset relpos)))
|
||||
(when (< (abs offset) c-guess-offset-threshold)
|
||||
(c-guess-accumulate-offset accumulator
|
||||
symbol
|
||||
offset))))))
|
||||
|
||||
(defun c-guess-accumulate-offset (accumulator symbol offset)
|
||||
;; Added SYMBOL and OFFSET to ACCUMULATOR. See
|
||||
;; `c-guess-accumulator' about the structure of ACCUMULATOR.
|
||||
(let* ((entry (assoc symbol accumulator))
|
||||
(counters (cdr entry))
|
||||
counter)
|
||||
(if entry
|
||||
(progn
|
||||
(setq counter (assoc offset counters))
|
||||
(if counter
|
||||
(setcdr counter (1+ (cdr counter)))
|
||||
(setq counters (cons (cons offset 1) counters))
|
||||
(setcdr entry counters))
|
||||
accumulator)
|
||||
(cons (cons symbol (cons (cons offset 1) nil)) accumulator))))
|
||||
|
||||
(defun c-guess-sort-accumulator (accumulator)
|
||||
;; Sort each element of ACCUMULATOR by the number-of-times. See
|
||||
;; `c-guess-accumulator' for more details.
|
||||
(mapcar
|
||||
(lambda (entry)
|
||||
(let ((symbol (car entry))
|
||||
(counters (cdr entry)))
|
||||
(cons symbol (sort counters
|
||||
(lambda (a b)
|
||||
(if (> (cdr a) (cdr b))
|
||||
t
|
||||
(and
|
||||
(eq (cdr a) (cdr b))
|
||||
(< (car a) (car b)))))))))
|
||||
accumulator))
|
||||
|
||||
(defun c-guess-make-offsets-alist (accumulator)
|
||||
;; Throw away the rare cases in accumulator and make an offsets-alist structure.
|
||||
(mapcar
|
||||
(lambda (entry)
|
||||
(cons (car entry)
|
||||
(car (car (cdr entry)))))
|
||||
accumulator))
|
||||
|
||||
(defun c-guess-merge-offsets-alists (strong weak)
|
||||
;; Merge two offsets-alists into one.
|
||||
;; When two offsets-alists have the same symbol
|
||||
;; entry, give STRONG priority over WEAK.
|
||||
(mapc
|
||||
(lambda (weak-elt)
|
||||
(unless (assoc (car weak-elt) strong)
|
||||
(setq strong (cons weak-elt strong))))
|
||||
weak)
|
||||
strong)
|
||||
|
||||
(defun c-guess-make-basic-offset (accumulator)
|
||||
;; As candidate for `c-basic-offset', find the most frequently appearing
|
||||
;; indentation-offset in ACCUMULATOR.
|
||||
(let* (;; Drop the value related to `c' syntactic-symbol.
|
||||
;; (`c': Inside a multiline C style block comment.)
|
||||
;; The impact for values of `c' is too large for guessing
|
||||
;; `basic-offset' if the target source file is small and its license
|
||||
;; notice is at top of the file.
|
||||
(accumulator (assq-delete-all 'c (copy-tree accumulator)))
|
||||
;; Drop syntactic-symbols from ACCUMULATOR.
|
||||
(alist (apply #'append (mapcar (lambda (elts)
|
||||
(mapcar (lambda (elt)
|
||||
(cons (abs (car elt))
|
||||
(cdr elt)))
|
||||
(cdr elts)))
|
||||
accumulator)))
|
||||
;; Gather all indentation-offsets other than 0.
|
||||
;; 0 is meaningless as `basic-offset'.
|
||||
(offset-list (delete 0
|
||||
(delete-dups (mapcar
|
||||
(lambda (elt) (car elt))
|
||||
alist))))
|
||||
;; Sum of number-of-times for offset:
|
||||
;; (offset . sum)
|
||||
(summed (mapcar (lambda (offset)
|
||||
(cons offset
|
||||
(apply #'+
|
||||
(mapcar (lambda (a)
|
||||
(if (eq (car a) offset)
|
||||
(cdr a)
|
||||
0))
|
||||
alist))))
|
||||
offset-list)))
|
||||
;;
|
||||
;; Find the majority.
|
||||
;;
|
||||
(let ((majority '(nil . 0)))
|
||||
(while summed
|
||||
(when (< (cdr majority) (cdr (car summed)))
|
||||
(setq majority (car summed)))
|
||||
(setq summed (cdr summed)))
|
||||
(car majority))))
|
||||
|
||||
(defun c-guess-symbolize-offsets-alist (offsets-alist basic-offset)
|
||||
;; Convert the representation of OFFSETS-ALIST to an alist using
|
||||
;; `+', `-', `++', `--', `*', or `/'. These symbols represent
|
||||
;; a value relative to BASIC-OFFSET. Their meaning can be found
|
||||
;; in the CC Mode manual.
|
||||
(mapcar
|
||||
(lambda (elt)
|
||||
(let ((s (car elt))
|
||||
(v (cdr elt)))
|
||||
(cond
|
||||
((integerp v)
|
||||
(cons s (c-guess-symbolize-integer v
|
||||
basic-offset)))
|
||||
(t elt))))
|
||||
offsets-alist))
|
||||
|
||||
(defun c-guess-symbolize-integer (int basic-offset)
|
||||
(let ((aint (abs int)))
|
||||
(cond
|
||||
((eq int basic-offset) '+)
|
||||
((eq aint basic-offset) '-)
|
||||
((eq int (* 2 basic-offset)) '++)
|
||||
((eq aint (* 2 basic-offset)) '--)
|
||||
((eq (* 2 int) basic-offset) '*)
|
||||
((eq (* 2 aint) basic-offset) '-)
|
||||
(t int))))
|
||||
|
||||
(defun c-guess-style-name ()
|
||||
;; Make a style name for the guessed style.
|
||||
(format "*c-guess*:%s" (buffer-file-name)))
|
||||
|
||||
(defun c-guess-make-style (basic-offset offsets-alist)
|
||||
(when basic-offset
|
||||
;; Make a style from guessed values.
|
||||
(let* ((offsets-alist (c-guess-merge-offsets-alists
|
||||
offsets-alist
|
||||
c-offsets-alist)))
|
||||
`((c-basic-offset . ,basic-offset)
|
||||
(c-offsets-alist . ,offsets-alist)))))
|
||||
|
||||
;;;###autoload
|
||||
(defun c-guess-install (&optional style-name)
|
||||
"Install the latest guessed style into the current buffer.
|
||||
\(This guessed style is a combination of `c-guess-guessed-basic-offset',
|
||||
`c-guess-guessed-offsets-alist' and `c-offsets-alist'.)
|
||||
|
||||
The style is entered into CC Mode's style system by
|
||||
`c-add-style'. Its name is either STYLE-NAME, or a name based on
|
||||
the absolute file name of the file if STYLE-NAME is nil."
|
||||
(interactive "sNew style name (empty for default name): ")
|
||||
(let* ((style (c-guess-make-style c-guess-guessed-basic-offset
|
||||
c-guess-guessed-offsets-alist)))
|
||||
(if style
|
||||
(let ((style-name (or (if (equal style-name "")
|
||||
nil
|
||||
style-name)
|
||||
(c-guess-style-name))))
|
||||
(c-add-style style-name style t)
|
||||
(message "Style \"%s\" is installed" style-name))
|
||||
(error "Not yet guessed"))))
|
||||
|
||||
(defun c-guess-dump-accumulator ()
|
||||
"Show `c-guess-accumulator'."
|
||||
(interactive)
|
||||
(with-output-to-temp-buffer "*Accumulated Examined Indent Information*"
|
||||
(pp c-guess-accumulator)))
|
||||
|
||||
(defun c-guess-reset-accumulator ()
|
||||
"Reset `c-guess-accumulator'."
|
||||
(interactive)
|
||||
(setq c-guess-accumulator nil))
|
||||
|
||||
(defun c-guess-dump-guessed-values ()
|
||||
"Show `c-guess-guessed-basic-offset' and `c-guess-guessed-offsets-alist'."
|
||||
(interactive)
|
||||
(with-output-to-temp-buffer "*Guessed Values*"
|
||||
(princ "basic-offset: \n\t")
|
||||
(pp c-guess-guessed-basic-offset)
|
||||
(princ "\n\n")
|
||||
(princ "offsets-alist: \n")
|
||||
(pp c-guess-guessed-offsets-alist)
|
||||
))
|
||||
|
||||
(defun c-guess-dump-guessed-style (&optional printer)
|
||||
"Show the guessed style.
|
||||
`pp' is used to print the style but if PRINTER is given,
|
||||
PRINTER is used instead. If PRINTER is not `nil', it
|
||||
is called with one argument, the guessed style."
|
||||
(interactive)
|
||||
(let ((style (c-guess-make-style c-guess-guessed-basic-offset
|
||||
c-guess-guessed-offsets-alist)))
|
||||
(if style
|
||||
(with-output-to-temp-buffer "*Guessed Style*"
|
||||
(funcall (if printer printer 'pp) style))
|
||||
(error "Not yet guessed"))))
|
||||
|
||||
(defun c-guess-guessed-syntactic-symbols ()
|
||||
;; Return syntactic symbols in c-guess-guessed-offsets-alist
|
||||
;; but not in c-guess-conversions.
|
||||
(let ((alist c-guess-guessed-offsets-alist)
|
||||
elt
|
||||
(symbols nil))
|
||||
(while alist
|
||||
(setq elt (car alist)
|
||||
alist (cdr alist))
|
||||
(unless (assq (car elt) c-guess-conversions)
|
||||
(setq symbols (cons (car elt)
|
||||
symbols))))
|
||||
symbols))
|
||||
|
||||
(defun c-guess-view-reorder-offsets-alist-in-style (style guessed-syntactic-symbols)
|
||||
;; Reorder the `c-offsets-alist' field of STYLE.
|
||||
;; If an entry in `c-offsets-alist' holds a guessed value, move it to
|
||||
;; front in the field. In addition alphabetical sort by entry name is done.
|
||||
(setq style (copy-tree style))
|
||||
(let ((offsets-alist-cell (assq 'c-offsets-alist style))
|
||||
(guessed-syntactic-symbols (c-guess-guessed-syntactic-symbols)))
|
||||
(setcdr offsets-alist-cell
|
||||
(sort (cdr offsets-alist-cell)
|
||||
(lambda (a b)
|
||||
(let ((a-guessed? (memq (car a) guessed-syntactic-symbols))
|
||||
(b-guessed? (memq (car b) guessed-syntactic-symbols)))
|
||||
(cond
|
||||
((or (and a-guessed? b-guessed?)
|
||||
(not (or a-guessed? b-guessed?)))
|
||||
(string-lessp (symbol-name (car a))
|
||||
(symbol-name (car b))))
|
||||
(a-guessed? t)
|
||||
(b-guessed? nil)))))))
|
||||
style)
|
||||
|
||||
(defun c-guess-view-mark-guessed-entries (guessed-syntactic-symbols)
|
||||
;; Put " ; Guess value" markers on all entries which hold
|
||||
;; guessed values.
|
||||
;; `c-basic-offset' is always considered as holding a guessed value.
|
||||
(let ((needs-markers (cons 'c-basic-offset
|
||||
guessed-syntactic-symbols)))
|
||||
(while needs-markers
|
||||
(goto-char (point-min))
|
||||
(when (search-forward (concat "("
|
||||
(symbol-name (car needs-markers))
|
||||
" ") nil t)
|
||||
(move-end-of-line 1)
|
||||
(comment-dwim nil)
|
||||
(insert " Guessed value"))
|
||||
(setq needs-markers
|
||||
(cdr needs-markers)))))
|
||||
|
||||
(defun c-guess-view (&optional with-name)
|
||||
"Emit emacs lisp code which defines the last guessed style.
|
||||
So you can put the code into .emacs if you prefer the
|
||||
guessed code.
|
||||
\"STYLE NAME HERE\" is used as the name for the style in the
|
||||
emitted code. If WITH-NAME is given, it is used instead.
|
||||
WITH-NAME is expected as a string but if this function
|
||||
called interactively with prefix argument, the value for
|
||||
WITH-NAME is asked to the user."
|
||||
(interactive "P")
|
||||
(let* ((temporary-style-name (cond
|
||||
((stringp with-name) with-name)
|
||||
(with-name (read-from-minibuffer
|
||||
"New style name: "))
|
||||
(t
|
||||
"STYLE NAME HERE")))
|
||||
(guessed-style-name (c-guess-style-name))
|
||||
(current-style-name c-indentation-style)
|
||||
(parent-style-name (if (string-equal guessed-style-name
|
||||
current-style-name)
|
||||
;; The guessed style is already installed.
|
||||
;; It cannot be used as the parent style.
|
||||
;; Use the default style for the current
|
||||
;; major mode as the parent style.
|
||||
(cc-choose-style-for-mode
|
||||
major-mode
|
||||
c-default-style)
|
||||
;; The guessed style is not installed yet.
|
||||
current-style-name)))
|
||||
(c-guess-dump-guessed-style
|
||||
(lambda (style)
|
||||
(let ((guessed-syntactic-symbols (c-guess-guessed-syntactic-symbols)))
|
||||
(pp `(c-add-style ,temporary-style-name
|
||||
',(cons parent-style-name
|
||||
(c-guess-view-reorder-offsets-alist-in-style
|
||||
style
|
||||
guessed-syntactic-symbols))))
|
||||
(with-current-buffer standard-output
|
||||
(lisp-interaction-mode)
|
||||
(c-guess-view-mark-guessed-entries
|
||||
guessed-syntactic-symbols)
|
||||
(buffer-enable-undo)))))))
|
||||
|
||||
|
||||
(cc-provide 'cc-guess)
|
||||
;;; cc-guess.el ends here
|
||||
3234
site-lisp/cc-mode/5.32.3/cc-langs.el
Normal file
3234
site-lisp/cc-mode/5.32.3/cc-langs.el
Normal file
File diff suppressed because it is too large
Load diff
160
site-lisp/cc-mode/5.32.3/cc-lobotomy.el
Normal file
160
site-lisp/cc-mode/5.32.3/cc-lobotomy.el
Normal file
|
|
@ -0,0 +1,160 @@
|
|||
;;; cc-lobotomy.el --- excise portions of cc-mode's brain... for speed
|
||||
|
||||
;; Copyright (C) 1985,1987,1992-2003, 2005, 2006, 2007, 2008, 2009,
|
||||
;; 2010, 2011, 2012 Free Software Foundation, Inc.
|
||||
|
||||
;; Author: 1995 Barry A. Warsaw
|
||||
;; Maintainer: Unmaintained
|
||||
;; Created: March 1995, split from cc-mode.el
|
||||
;; Version: See cc-mode.el
|
||||
;; Keywords: c languages oop
|
||||
|
||||
;; This file is not part of GNU Emacs.
|
||||
|
||||
;; This program is free software; you can redistribute it and/or modify
|
||||
;; it under the terms of the GNU General Public License as published by
|
||||
;; the Free Software Foundation; either version 3 of the License, or
|
||||
;; (at your option) any later version.
|
||||
|
||||
;; This program is distributed in the hope that it will be useful,
|
||||
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
;; GNU General Public License for more details.
|
||||
|
||||
;; You should have received a copy of the GNU General Public License
|
||||
;; along with this program; see the file COPYING. If not, see
|
||||
;; <http://www.gnu.org/licenses/>.
|
||||
|
||||
;;; Commentary:
|
||||
;;
|
||||
;; Every effort has been made to improve the performance of
|
||||
;; cc-mode. However, due to the nature of the C, C++, and Objective-C
|
||||
;; language definitions, a trade-off is often required between
|
||||
;; accuracy of construct recognition and speed. I believe it is always
|
||||
;; best to be correct, and that the mode is currently fast enough for
|
||||
;; most normal usage. Others disagree. I have no intention of
|
||||
;; including these hacks in the main distribution. When cc-mode
|
||||
;; version 5 comes out, it will include a rewritten indentation engine
|
||||
;; so that performance will be greatly improved automatically. This
|
||||
;; was not included in this release of version 4 so that Emacs 18
|
||||
;; could still be supported. Note that this implies that cc-mode
|
||||
;; version 5 will *not* work on Emacs 18!
|
||||
;;
|
||||
;; To use, see the variable cc-lobotomy-pith-list and the function
|
||||
;; cc-lobotomize. The variable contains a good explanation of the
|
||||
;; speed/accuracy trade-offs for each option. Set it to what you'd
|
||||
;; like, and call cc-lobotomy in your c-mode-hook.
|
||||
;;
|
||||
;; This will redefine certain cc-mode functions and affect all cc-mode
|
||||
;; buffers globally.
|
||||
;;
|
||||
;; This file is completely unsupported! Although it has been patched
|
||||
;; superficially to keep pace with the rest of CC Mode, it hasn't been
|
||||
;; tested for a long time.
|
||||
|
||||
;;; Code:
|
||||
|
||||
(eval-when-compile
|
||||
(let ((load-path
|
||||
(if (and (boundp 'byte-compile-dest-file)
|
||||
(stringp byte-compile-dest-file))
|
||||
(cons (file-name-directory byte-compile-dest-file) load-path)
|
||||
load-path)))
|
||||
(load "cc-bytecomp" nil t)))
|
||||
|
||||
(cc-require 'cc-defs)
|
||||
(cc-require 'cc-engine)
|
||||
(cc-require 'cc-cmds)
|
||||
|
||||
|
||||
(defvar cc-lobotomy-pith-list ()
|
||||
"*List of things to dumb-ify to speed up cc-mode. Note that each
|
||||
incurs a penalty in correct identification of certain code constructs.
|
||||
Possible values to put on this list:
|
||||
|
||||
'literal -- `c-in-literal' is lobotomized. This will significantly
|
||||
speed up parsing over large lists of cpp macros, as seen
|
||||
for instance in header files. The penalty is that you
|
||||
cannot put the `#' character as the first non-whitespace
|
||||
character on a line inside other multi-line literals
|
||||
(i.e. comments or strings)
|
||||
|
||||
'class -- `c-narrow-out-enclosing-class' and `c-search-uplist for
|
||||
classkey' are lobotomized. This speeds up some
|
||||
indenting inside and around class and struct
|
||||
definitions. The penalty is that elements inside of
|
||||
classes and structs may not indent correctly.
|
||||
|
||||
'lists -- `c-inside-bracelist-p' is lobotomized. This speeds up
|
||||
indenting inside and around brace lists (e.g. aggregate
|
||||
initializers, enum lists, etc.). The penalty is that
|
||||
elements inside these lists may not indent correctly.")
|
||||
|
||||
(defun cc-lobotomize ()
|
||||
"Perform lobotomies on cc-mode as described in `cc-lobotomy-pith-list'."
|
||||
(let (pithedp)
|
||||
(if (memq 'literal cc-lobotomy-pith-list)
|
||||
(progn
|
||||
(fset 'c-in-literal 'cc-in-literal-lobotomized)
|
||||
(setq pithedp t)))
|
||||
(if (memq 'class cc-lobotomy-pith-list)
|
||||
(progn
|
||||
(fset 'c-narrow-out-enclosing-class
|
||||
'cc-narrow-out-enclosing-class-lobotomized)
|
||||
(fset 'c-search-uplist-for-classkey
|
||||
'cc-search-uplist-for-classkey-lobotomized)
|
||||
(setq pithedp t)))
|
||||
(if (memq 'lists cc-lobotomy-pith-list)
|
||||
(progn
|
||||
(fset 'c-inside-bracelist-p 'cc-inside-bracelist-p-lobotomized)
|
||||
(setq pithedp t)))
|
||||
(if pithedp
|
||||
(add-hook 'c-prepare-bug-report-hooks 'cc-lobo-bug-report-blurb))
|
||||
))
|
||||
|
||||
|
||||
;; This is a faster version of c-in-literal. It trades speed for one
|
||||
;; approximation, namely that within other literals, the `#' character
|
||||
;; cannot be the first non-whitespace on a line. This only happens if
|
||||
;; detect-cpp is non-nil, which isn't very often.
|
||||
(defun cc-in-literal-lobotomized (&optional lim detect-cpp)
|
||||
;; first check the cache
|
||||
(if (and (vectorp c-in-literal-cache)
|
||||
(= (point) (aref c-in-literal-cache 0)))
|
||||
(aref c-in-literal-cache 1)
|
||||
;; quickly check for cpp macro. this breaks if the `#' character
|
||||
;; appears as the first non-whitespace on a line inside another
|
||||
;; literal.
|
||||
(let* (state
|
||||
(char-at-boi (char-after (c-point 'boi)))
|
||||
(rtn (cond
|
||||
((and detect-cpp char-at-boi (= char-at-boi ?#))
|
||||
'pound)
|
||||
((nth 3 (setq state (save-excursion
|
||||
(parse-partial-sexp
|
||||
(or lim (c-point 'bod))
|
||||
(point)))))
|
||||
'string)
|
||||
((nth 4 state) (if (nth 7 state) 'c++ 'c))
|
||||
(t nil))))
|
||||
;; cache this result if the cache is enabled
|
||||
(if (not c-in-literal-cache)
|
||||
(setq c-in-literal-cache (vector (point) rtn)))
|
||||
rtn)))
|
||||
|
||||
(defun cc-narrow-out-enclosing-class-lobotomized (dummy1 dummy2) nil)
|
||||
|
||||
(defun cc-search-uplist-for-classkey-lobotomized (dummy) nil)
|
||||
|
||||
(defun cc-inside-bracelist-p-lobotomized (dummy1 dummy2) nil)
|
||||
|
||||
(defun cc-lobo-bug-report-blurb ()
|
||||
(insert
|
||||
"\nYou are using cc-lobotomy.el. You realize that by doing\n"
|
||||
"so you have already made the decision to trade off accuracy\n"
|
||||
"for speed? Don't set your hopes too high that your problem\n"
|
||||
"will be fixed.\n\n"))
|
||||
|
||||
|
||||
(cc-provide 'cc-lobotomy)
|
||||
;;; cc-lobotomy.el ends here
|
||||
446
site-lisp/cc-mode/5.32.3/cc-menus.el
Normal file
446
site-lisp/cc-mode/5.32.3/cc-menus.el
Normal file
|
|
@ -0,0 +1,446 @@
|
|||
;;; cc-menus.el --- imenu support for CC Mode
|
||||
|
||||
;; Copyright (C) 1985, 1987, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
|
||||
;; 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009,
|
||||
;; 2010, 2011, 2012 Free Software Foundation, Inc.
|
||||
|
||||
;; Authors: 1998- Martin Stjernholm
|
||||
;; 1992-1999 Barry A. Warsaw
|
||||
;; 1987 Dave Detlefs and Stewart Clamen
|
||||
;; 1985 Richard M. Stallman
|
||||
;; Maintainer: bug-cc-mode@gnu.org
|
||||
;; Created: 22-Apr-1997 (split from cc-mode.el)
|
||||
;; Version: See cc-mode.el
|
||||
;; Keywords: c languages oop
|
||||
|
||||
;; This file is part of GNU Emacs.
|
||||
|
||||
;; GNU Emacs is free software; you can redistribute it and/or modify
|
||||
;; it under the terms of the GNU General Public License as published by
|
||||
;; the Free Software Foundation; either version 3, or (at your option)
|
||||
;; any later version.
|
||||
|
||||
;; GNU Emacs is distributed in the hope that it will be useful,
|
||||
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
;; GNU General Public License for more details.
|
||||
|
||||
;; You should have received a copy of the GNU General Public License
|
||||
;; along with this program; see the file COPYING. If not, see
|
||||
;; <http://www.gnu.org/licenses/>.
|
||||
|
||||
;;; Commentary:
|
||||
|
||||
;;; Code:
|
||||
|
||||
(eval-when-compile
|
||||
(let ((load-path
|
||||
(if (and (boundp 'byte-compile-dest-file)
|
||||
(stringp byte-compile-dest-file))
|
||||
(cons (file-name-directory byte-compile-dest-file) load-path)
|
||||
load-path)))
|
||||
(load "cc-bytecomp" nil t)))
|
||||
|
||||
(cc-require 'cc-defs)
|
||||
|
||||
;; The things referenced in imenu, which we don't require.
|
||||
(cc-bytecomp-defvar imenu-case-fold-search)
|
||||
(cc-bytecomp-defvar imenu-generic-expression)
|
||||
(cc-bytecomp-defvar imenu-create-index-function)
|
||||
(cc-bytecomp-defun imenu-progress-message)
|
||||
|
||||
|
||||
;; imenu integration
|
||||
(defvar cc-imenu-c-prototype-macro-regexp nil
|
||||
"RE matching macro names used to conditionally specify function prototypes.
|
||||
|
||||
For example:
|
||||
|
||||
#ifdef __STDC__
|
||||
#define _P(x) x
|
||||
#else
|
||||
#define _P(x) /*nothing*/
|
||||
#endif
|
||||
|
||||
int main _P( (int argc, char *argv[]) )
|
||||
|
||||
A sample value might look like: `\\(_P\\|_PROTO\\)'.")
|
||||
|
||||
;; *Warning for cc-mode developers*
|
||||
;;
|
||||
;; `cc-imenu-objc-generic-expression' elements depend on
|
||||
;; `cc-imenu-c++-generic-expression'. So if you change this
|
||||
;; expression, you need to change following variables,
|
||||
;; `cc-imenu-objc-generic-expression-*-index',
|
||||
;; too. `cc-imenu-objc-function' uses these *-index variables, in
|
||||
;; order to know where the each regexp *group \\(foobar\\)* elements
|
||||
;; are started.
|
||||
;;
|
||||
;; *-index variables are initialized during `cc-imenu-objc-generic-expression'
|
||||
;; being initialized.
|
||||
;;
|
||||
|
||||
(defvar cc-imenu-c++-generic-expression
|
||||
`(
|
||||
;; Try to match ::operator definitions first. Otherwise `X::operator new ()'
|
||||
;; will be incorrectly recognised as function `new ()' because the regexps
|
||||
;; work by backtracking from the end of the definition.
|
||||
(nil
|
||||
,(concat
|
||||
"^\\<.*"
|
||||
"[^" c-alnum "_:<>~]" ; match any non-identifier char
|
||||
; (note: this can be `\n')
|
||||
"\\("
|
||||
"\\([" c-alnum "_:<>~]*::\\)?" ; match an operator
|
||||
"operator\\>[ \t]*"
|
||||
"\\(()\\|[^(]*\\)" ; special case for `()' operator
|
||||
"\\)"
|
||||
|
||||
"[ \t]*([^)]*)[ \t]*[^ \t;]" ; followed by ws, arg list,
|
||||
; require something other than
|
||||
; a `;' after the (...) to
|
||||
; avoid prototypes. Can't
|
||||
; catch cases with () inside
|
||||
; the parentheses surrounding
|
||||
; the parameters. e.g.:
|
||||
; `int foo(int a=bar()) {...}'
|
||||
) 1)
|
||||
;; Special case to match a line like `main() {}'
|
||||
;; e.g. no return type, not even on the previous line.
|
||||
(nil
|
||||
,(concat
|
||||
"^"
|
||||
"\\([" c-alpha "_][" c-alnum "_:<>~]*\\)" ; match function name
|
||||
"[ \t]*(" ; see above, BUT
|
||||
"[ \t]*\\([^ \t(*][^)]*\\)?)" ; the arg list must not start
|
||||
"[ \t]*[^ \t;(]" ; with an asterisk or parentheses
|
||||
) 1)
|
||||
;; General function name regexp
|
||||
(nil
|
||||
,(concat
|
||||
"^\\<" ; line MUST start with word char
|
||||
"[^()]*" ; no parentheses before
|
||||
"[^" c-alnum "_:<>~]" ; match any non-identifier char
|
||||
"\\([" c-alpha "_][" c-alnum "_:<>~]*\\)" ; match function name
|
||||
"\\([ \t\n]\\|\\\\\n\\)*(" ; see above, BUT the arg list
|
||||
"\\([ \t\n]\\|\\\\\n\\)*" ; must not start
|
||||
"\\([^ \t\n(*]" ; with an asterisk or parentheses
|
||||
"[^()]*\\(([^()]*)[^()]*\\)*" ; Maybe function pointer arguments
|
||||
"\\)?)"
|
||||
"\\([ \t\n]\\|\\\\\n\\)*[^ \t\n;(]"
|
||||
) 1)
|
||||
;; Special case for definitions using phony prototype macros like:
|
||||
;; `int main _PROTO( (int argc,char *argv[]) )'.
|
||||
;; This case is only included if cc-imenu-c-prototype-macro-regexp is set.
|
||||
;; Only supported in c-code, so no `:<>~' chars in function name!
|
||||
,@(if cc-imenu-c-prototype-macro-regexp
|
||||
`((nil
|
||||
,(concat
|
||||
"^\\<.*" ; line MUST start with word char
|
||||
"[^" c-alnum "_]" ; match any non-identifier char
|
||||
"\\([" c-alpha "_][" c-alnum "_]*\\)" ; match function name
|
||||
"[ \t]*" ; whitespace before macro name
|
||||
cc-imenu-c-prototype-macro-regexp
|
||||
"[ \t]*(" ; ws followed by first paren.
|
||||
"[ \t]*([^)]*)[ \t]*)[ \t]*[^ \t;]" ; see above
|
||||
) 1)))
|
||||
;; Class definitions
|
||||
("Class"
|
||||
,(concat
|
||||
"^" ; beginning of line is required
|
||||
"\\(template[ \t]*<[^>]+>[ \t]*\\)?" ; there may be a `template <...>'
|
||||
"\\(class\\|struct\\)[ \t]+"
|
||||
"\\(" ; the string we want to get
|
||||
"[" c-alnum "_]+" ; class name
|
||||
"\\(<[^>]+>\\)?" ; possibly explicitly specialized
|
||||
"\\)"
|
||||
"\\([ \t\n]\\|\\\\\n\\)*[:{]"
|
||||
) 3))
|
||||
"Imenu generic expression for C++ mode. See `imenu-generic-expression'.")
|
||||
|
||||
(defvar cc-imenu-c-generic-expression
|
||||
cc-imenu-c++-generic-expression
|
||||
"Imenu generic expression for C mode. See `imenu-generic-expression'.")
|
||||
|
||||
(defvar cc-imenu-java-generic-expression
|
||||
`((nil
|
||||
,(concat
|
||||
"[" c-alpha "_][\]\[." c-alnum "_<> ]+[ \t\n\r]+" ; type spec
|
||||
"\\([" c-alpha "_][" c-alnum "_]*\\)" ; method name
|
||||
"[ \t\n\r]*"
|
||||
;; An argument list that is either empty or contains any number
|
||||
;; of arppguments. An argument is any number of annotations
|
||||
|
||||
;; followed by a type spec followed by a word. A word is an
|
||||
;; identifier. A type spec is an identifier, possibly followed
|
||||
;; by < typespec > possibly followed by [].
|
||||
(concat "("
|
||||
"\\("
|
||||
"[ \t\n\r]*"
|
||||
"\\("
|
||||
"@"
|
||||
"[" c-alpha "_]"
|
||||
"[" c-alnum "._]*"
|
||||
"[ \t\n\r]+"
|
||||
"\\)*"
|
||||
"\\("
|
||||
"[" c-alpha "_]"
|
||||
"[][" c-alnum "_.]*"
|
||||
"\\("
|
||||
"<"
|
||||
"[ \t\n\r]*"
|
||||
"[\]\[.," c-alnum "_<> \t\n\r]*"
|
||||
">"
|
||||
"\\)?"
|
||||
"[\]\[ \t\n\r]+"
|
||||
"\\)"
|
||||
"[" c-alpha "_]"
|
||||
"[" c-alnum "_]*"
|
||||
"[ \t\n\r,]*"
|
||||
"\\)*"
|
||||
")"
|
||||
"[.," c-alnum " \t\n\r]*"
|
||||
"{"
|
||||
)) 1))
|
||||
"Imenu generic expression for Java mode. See `imenu-generic-expression'.")
|
||||
|
||||
;; Internal variables
|
||||
(defvar cc-imenu-objc-generic-expression-noreturn-index nil)
|
||||
(defvar cc-imenu-objc-generic-expression-general-func-index nil)
|
||||
(defvar cc-imenu-objc-generic-expression-proto-index nil)
|
||||
(defvar cc-imenu-objc-generic-expression-objc-base-index nil)
|
||||
|
||||
(defvar cc-imenu-objc-generic-expression
|
||||
(concat
|
||||
;;
|
||||
;; For C
|
||||
;;
|
||||
;; > Special case to match a line like `main() {}'
|
||||
;; > e.g. no return type, not even on the previous line.
|
||||
;; Pick a token by (match-string 1)
|
||||
(car (cdr (nth 1 cc-imenu-c++-generic-expression))) ; -> index += 2
|
||||
(prog2 (setq cc-imenu-objc-generic-expression-noreturn-index 1) "")
|
||||
"\\|"
|
||||
;; > General function name regexp
|
||||
;; Pick a token by (match-string 3)
|
||||
(car (cdr (nth 2 cc-imenu-c++-generic-expression))) ; -> index += 6
|
||||
(prog2 (setq cc-imenu-objc-generic-expression-general-func-index 3) "")
|
||||
;; > Special case for definitions using phony prototype macros like:
|
||||
;; > `int main _PROTO( (int argc,char *argv[]) )'.
|
||||
;; Pick a token by (match-string 8)
|
||||
(if cc-imenu-c-prototype-macro-regexp
|
||||
(concat
|
||||
"\\|"
|
||||
(car (cdr (nth 3 cc-imenu-c++-generic-expression))) ; -> index += 1
|
||||
(prog2 (setq cc-imenu-objc-generic-expression-objc-base-index 10) "")
|
||||
)
|
||||
(prog2 (setq cc-imenu-objc-generic-expression-objc-base-index 9) "")
|
||||
"") ; -> index += 0
|
||||
(prog2 (setq cc-imenu-objc-generic-expression-proto-index 9) "")
|
||||
;;
|
||||
;; For Objective-C
|
||||
;; Pick a token by (match-string 8 or 9)
|
||||
;;
|
||||
"\\|\\("
|
||||
"^[-+][:" c-alnum "()*_<>\n\t ]*[;{]" ; Methods
|
||||
"\\|"
|
||||
"^@interface[\t ]+[" c-alnum "_]+[\t ]*:"
|
||||
"\\|"
|
||||
"^@interface[\t ]+[" c-alnum "_]+[\t ]*([" c-alnum "_]+)"
|
||||
"\\|"
|
||||
;; For NSObject, NSProxy and Object... They don't have super class.
|
||||
"^@interface[\t ]+[" c-alnum "_]+[\t ]*.*$"
|
||||
"\\|"
|
||||
"^@implementation[\t ]+[" c-alnum "_]+[\t ]*([" c-alnum "_]+)"
|
||||
"\\|"
|
||||
"^@implementation[\t ]+[" c-alnum "_]+"
|
||||
"\\|"
|
||||
"^@protocol[\t ]+[" c-alnum "_]+" "\\)")
|
||||
"Imenu generic expression for ObjC mode. See `imenu-generic-expression'.")
|
||||
|
||||
|
||||
;; Imenu support for objective-c uses functions.
|
||||
(defsubst cc-imenu-objc-method-to-selector (method)
|
||||
"Return the objc selector style string of METHOD.
|
||||
Example:
|
||||
- perform: (SEL)aSelector withObject: object1 withObject: object2; /* METHOD */
|
||||
=>
|
||||
-perform:withObject:withObject:withObject: /* selector */"
|
||||
(let ((return "") ; String to be returned
|
||||
(p 0) ; Current scanning position in METHOD
|
||||
(pmax (length method)) ;
|
||||
char ; Current scanning target
|
||||
(betweenparen 0) ; CHAR is in parentheses.
|
||||
argreq ; An argument is required.
|
||||
inargvar) ; position of CHAR is in an argument variable.
|
||||
(while (< p pmax)
|
||||
(setq char (aref method p)
|
||||
p (1+ p))
|
||||
(cond
|
||||
;; Is CHAR part of a objc token?
|
||||
((and (not inargvar) ; Ignore if CHAR is part of an argument variable.
|
||||
(eq 0 betweenparen) ; Ignore if CHAR is in parentheses.
|
||||
(or (and (<= ?a char) (<= char ?z))
|
||||
(and (<= ?A char) (<= char ?Z))
|
||||
(and (<= ?0 char) (<= char ?9))
|
||||
(= ?_ char)))
|
||||
(if argreq
|
||||
(setq inargvar t
|
||||
argreq nil)
|
||||
(setq return (concat return (char-to-string char)))))
|
||||
;; Or a white space?
|
||||
((and inargvar (or (eq ?\ char) (eq ?\n char))
|
||||
(setq inargvar nil)))
|
||||
;; Or a method separator?
|
||||
;; If a method separator, the next token will be an argument variable.
|
||||
((eq ?: char)
|
||||
(setq argreq t
|
||||
return (concat return (char-to-string char))))
|
||||
;; Or an open parentheses?
|
||||
((eq ?\( char)
|
||||
(setq betweenparen (1+ betweenparen)))
|
||||
;; Or a close parentheses?
|
||||
((eq ?\) char)
|
||||
(setq betweenparen (1- betweenparen)))))
|
||||
return))
|
||||
|
||||
(defun cc-imenu-objc-remove-white-space (str)
|
||||
"Remove all spaces and tabs from STR."
|
||||
(let ((return "")
|
||||
(p 0)
|
||||
(max (length str))
|
||||
char)
|
||||
(while (< p max)
|
||||
(setq char (aref str p))
|
||||
(setq p (1+ p))
|
||||
(if (or (= char ?\ ) (= char ?\t))
|
||||
()
|
||||
(setq return (concat return (char-to-string char)))))
|
||||
return))
|
||||
|
||||
(defun cc-imenu-objc-function ()
|
||||
"imenu supports for objc-mode."
|
||||
(let (methodlist
|
||||
clist
|
||||
;;
|
||||
;; OBJC, Cnoreturn, Cgeneralfunc, Cproto are constants.
|
||||
;;
|
||||
;; *Warning for developers*
|
||||
;; These constants depend on `cc-imenu-c++-generic-expression'.
|
||||
;;
|
||||
(OBJC cc-imenu-objc-generic-expression-objc-base-index)
|
||||
;; Special case to match a line like `main() {}'
|
||||
(Cnoreturn cc-imenu-objc-generic-expression-noreturn-index)
|
||||
;; General function name regexp
|
||||
(Cgeneralfunc cc-imenu-objc-generic-expression-general-func-index)
|
||||
;; Special case for definitions using phony prototype macros like:
|
||||
(Cproto cc-imenu-objc-generic-expression-proto-index)
|
||||
langnum
|
||||
;;
|
||||
(classcount 0)
|
||||
toplist
|
||||
str
|
||||
str2
|
||||
(intflen (length "@interface"))
|
||||
(implen (length "@implementation"))
|
||||
(prtlen (length "@protocol"))
|
||||
(func
|
||||
;;
|
||||
;; Does this emacs has buffer-substring-no-properties?
|
||||
;;
|
||||
(if (fboundp 'buffer-substring-no-properties)
|
||||
'buffer-substring-no-properties
|
||||
'buffer-substring)))
|
||||
(goto-char (point-max))
|
||||
;;
|
||||
(while (re-search-backward cc-imenu-objc-generic-expression nil t)
|
||||
(setq langnum (if (match-beginning OBJC)
|
||||
OBJC
|
||||
(cond
|
||||
((match-beginning Cproto) Cproto)
|
||||
((match-beginning Cgeneralfunc) Cgeneralfunc)
|
||||
((match-beginning Cnoreturn) Cnoreturn))))
|
||||
(setq str (funcall func (match-beginning langnum) (match-end langnum)))
|
||||
;;
|
||||
(cond
|
||||
;;
|
||||
;; C
|
||||
;;
|
||||
((not (eq langnum OBJC))
|
||||
(setq clist (cons (cons str (match-beginning langnum)) clist)))
|
||||
;;
|
||||
;; ObjC
|
||||
;;
|
||||
;; An instance Method
|
||||
((eq (aref str 0) ?-)
|
||||
(setq str (concat "-" (cc-imenu-objc-method-to-selector str)))
|
||||
(setq methodlist (cons (cons str
|
||||
(match-beginning langnum))
|
||||
methodlist)))
|
||||
;; A factory Method
|
||||
((eq (aref str 0) ?+)
|
||||
(setq str (concat "+" (cc-imenu-objc-method-to-selector str)))
|
||||
(setq methodlist (cons (cons str
|
||||
(match-beginning langnum))
|
||||
methodlist)))
|
||||
;; Interface or implementation or protocol
|
||||
((eq (aref str 0) ?@)
|
||||
(setq classcount (1+ classcount))
|
||||
(cond
|
||||
((and (> (length str) implen)
|
||||
(string= (substring str 0 implen) "@implementation"))
|
||||
(setq str (substring str implen)
|
||||
str2 "@implementation"))
|
||||
((string= (substring str 0 intflen) "@interface")
|
||||
(setq str (substring str intflen)
|
||||
str2 "@interface"))
|
||||
((string= (substring str 0 prtlen) "@protocol")
|
||||
(setq str (substring str prtlen)
|
||||
str2 "@protocol")))
|
||||
(setq str (cc-imenu-objc-remove-white-space str))
|
||||
(setq methodlist (cons (cons str2
|
||||
(match-beginning langnum))
|
||||
methodlist))
|
||||
(setq toplist (cons nil (cons (cons str
|
||||
methodlist) toplist))
|
||||
methodlist nil))))
|
||||
;;
|
||||
(if (eq (car toplist) nil)
|
||||
(setq toplist (cdr toplist)))
|
||||
|
||||
;; In this buffer, there is only one or zero @{interface|implementation|protocol}.
|
||||
(if (< classcount 2)
|
||||
(let ((classname (car (car toplist)))
|
||||
(p (cdr (car (cdr (car toplist)))))
|
||||
last)
|
||||
(setq toplist (cons (cons classname p) (cdr (cdr (car toplist)))))
|
||||
;; Add C lang token
|
||||
(if clist
|
||||
(progn
|
||||
(setq last toplist)
|
||||
(while (cdr last)
|
||||
(setq last (cdr last)))
|
||||
(setcdr last clist))))
|
||||
;; Add C lang tokens as a sub menu
|
||||
(if clist
|
||||
(setq toplist (cons (cons "C" clist) toplist))))
|
||||
;;
|
||||
toplist
|
||||
))
|
||||
|
||||
;(defvar cc-imenu-pike-generic-expression
|
||||
; ())
|
||||
; FIXME: Please contribute one!
|
||||
|
||||
(defun cc-imenu-init (mode-generic-expression
|
||||
&optional mode-create-index-function)
|
||||
(setq imenu-generic-expression mode-generic-expression
|
||||
imenu-case-fold-search nil)
|
||||
(when mode-create-index-function
|
||||
(setq imenu-create-index-function mode-create-index-function)))
|
||||
|
||||
|
||||
(cc-provide 'cc-menus)
|
||||
|
||||
;;; arch-tag: f6b60933-91f0-4145-ab44-70ca6d1b919b
|
||||
;;; cc-menus.el ends here
|
||||
BIN
site-lisp/cc-mode/5.32.3/cc-mode-5.32.3.tar
Normal file
BIN
site-lisp/cc-mode/5.32.3/cc-mode-5.32.3.tar
Normal file
Binary file not shown.
1834
site-lisp/cc-mode/5.32.3/cc-mode.el
Normal file
1834
site-lisp/cc-mode/5.32.3/cc-mode.el
Normal file
File diff suppressed because it is too large
Load diff
7244
site-lisp/cc-mode/5.32.3/cc-mode.texi
Normal file
7244
site-lisp/cc-mode/5.32.3/cc-mode.texi
Normal file
File diff suppressed because it is too large
Load diff
674
site-lisp/cc-mode/5.32.3/cc-styles.el
Normal file
674
site-lisp/cc-mode/5.32.3/cc-styles.el
Normal file
|
|
@ -0,0 +1,674 @@
|
|||
;;; cc-styles.el --- support for styles in CC Mode
|
||||
|
||||
;; Copyright (C) 1985, 1987, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
|
||||
;; 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009,
|
||||
;; 2010, 2011, 2012 Free Software Foundation, Inc.
|
||||
|
||||
;; Authors: 2004- Alan Mackenzie
|
||||
;; 1998- Martin Stjernholm
|
||||
;; 1992-1999 Barry A. Warsaw
|
||||
;; 1987 Dave Detlefs and Stewart Clamen
|
||||
;; 1985 Richard M. Stallman
|
||||
;; Maintainer: bug-cc-mode@gnu.org
|
||||
;; Created: 22-Apr-1997 (split from cc-mode.el)
|
||||
;; Version: See cc-mode.el
|
||||
;; Keywords: c languages oop
|
||||
|
||||
;; This file is part of GNU Emacs.
|
||||
|
||||
;; GNU Emacs is free software; you can redistribute it and/or modify
|
||||
;; it under the terms of the GNU General Public License as published by
|
||||
;; the Free Software Foundation; either version 3, or (at your option)
|
||||
;; any later version.
|
||||
|
||||
;; GNU Emacs is distributed in the hope that it will be useful,
|
||||
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
;; GNU General Public License for more details.
|
||||
|
||||
;; You should have received a copy of the GNU General Public License
|
||||
;; along with this program; see the file COPYING. If not, see
|
||||
;; <http://www.gnu.org/licenses/>.
|
||||
|
||||
;;; Commentary:
|
||||
|
||||
;;; Code:
|
||||
|
||||
(eval-when-compile
|
||||
(let ((load-path
|
||||
(if (and (boundp 'byte-compile-dest-file)
|
||||
(stringp byte-compile-dest-file))
|
||||
(cons (file-name-directory byte-compile-dest-file) load-path)
|
||||
load-path)))
|
||||
(load "cc-bytecomp" nil t)))
|
||||
|
||||
(cc-require 'cc-defs)
|
||||
(cc-require 'cc-vars)
|
||||
(cc-require 'cc-align)
|
||||
;; cc-align is only indirectly required: Styles added with
|
||||
;; `c-add-style' often contains references to functions defined there.
|
||||
|
||||
;; Silence the compiler.
|
||||
(cc-bytecomp-defvar adaptive-fill-first-line-regexp) ; Emacs
|
||||
(cc-bytecomp-obsolete-fun make-local-hook) ; Marked obsolete in Emacs 21.1.
|
||||
; Allegedly still required by
|
||||
; XEmacs 21.4.n (2011-08).
|
||||
|
||||
|
||||
(defvar c-style-alist
|
||||
'(("gnu"
|
||||
(c-basic-offset . 2)
|
||||
(c-comment-only-line-offset . (0 . 0))
|
||||
(c-hanging-braces-alist . ((substatement-open before after)
|
||||
(arglist-cont-nonempty)))
|
||||
(c-offsets-alist . ((statement-block-intro . +)
|
||||
(knr-argdecl-intro . 5)
|
||||
(substatement-open . +)
|
||||
(substatement-label . 0)
|
||||
(label . 0)
|
||||
(statement-case-open . +)
|
||||
(statement-cont . +)
|
||||
(arglist-intro . c-lineup-arglist-intro-after-paren)
|
||||
(arglist-close . c-lineup-arglist)
|
||||
(inline-open . 0)
|
||||
(brace-list-open . +)
|
||||
(topmost-intro-cont
|
||||
. (first c-lineup-topmost-intro-cont
|
||||
c-lineup-gnu-DEFUN-intro-cont))))
|
||||
(c-special-indent-hook . c-gnu-impose-minimum)
|
||||
(c-block-comment-prefix . ""))
|
||||
|
||||
("k&r"
|
||||
(c-basic-offset . 5)
|
||||
(c-comment-only-line-offset . 0)
|
||||
(c-offsets-alist . ((statement-block-intro . +)
|
||||
(knr-argdecl-intro . 0)
|
||||
(substatement-open . 0)
|
||||
(substatement-label . 0)
|
||||
(label . 0)
|
||||
(statement-cont . +))))
|
||||
|
||||
("bsd"
|
||||
(c-basic-offset . 8)
|
||||
(c-comment-only-line-offset . 0)
|
||||
(c-offsets-alist . ((statement-block-intro . +)
|
||||
(knr-argdecl-intro . +)
|
||||
(substatement-open . 0)
|
||||
(substatement-label . 0)
|
||||
(label . 0)
|
||||
(statement-cont . +)
|
||||
(inline-open . 0)
|
||||
(inexpr-class . 0))))
|
||||
|
||||
("stroustrup"
|
||||
(c-basic-offset . 4)
|
||||
(c-comment-only-line-offset . 0)
|
||||
(c-offsets-alist . ((statement-block-intro . +)
|
||||
(substatement-open . 0)
|
||||
(substatement-label . 0)
|
||||
(label . 0)
|
||||
(statement-cont . +))))
|
||||
|
||||
("whitesmith"
|
||||
(c-basic-offset . 4)
|
||||
(c-comment-only-line-offset . 0)
|
||||
;; It's obvious that the CC Mode way of choosing anchor positions
|
||||
;; doesn't fit this style at all. :P
|
||||
(c-offsets-alist . ((defun-open . +)
|
||||
(defun-close . c-lineup-whitesmith-in-block)
|
||||
(defun-block-intro . (add c-lineup-whitesmith-in-block
|
||||
c-indent-multi-line-block))
|
||||
(class-open . +)
|
||||
(class-close . +)
|
||||
(inline-open . +)
|
||||
(inline-close . c-lineup-whitesmith-in-block)
|
||||
(knr-argdecl-intro . +)
|
||||
(block-open . 0) ; Get indentation from `statement' instead.
|
||||
(block-close . c-lineup-whitesmith-in-block)
|
||||
(brace-list-open . +)
|
||||
(brace-list-close . c-lineup-whitesmith-in-block)
|
||||
(brace-list-intro . (add c-lineup-whitesmith-in-block
|
||||
c-indent-multi-line-block))
|
||||
(brace-list-entry . (add c-lineup-after-whitesmith-blocks
|
||||
c-indent-multi-line-block))
|
||||
(brace-entry-open . (add c-lineup-after-whitesmith-blocks
|
||||
c-indent-multi-line-block))
|
||||
(statement . (add c-lineup-after-whitesmith-blocks
|
||||
c-indent-multi-line-block))
|
||||
(statement-block-intro . (add c-lineup-whitesmith-in-block
|
||||
c-indent-multi-line-block))
|
||||
(substatement-open . +)
|
||||
(substatement-label . +)
|
||||
(label . 0)
|
||||
(arglist-intro . (add c-lineup-whitesmith-in-block
|
||||
c-indent-multi-line-block))
|
||||
(arglist-cont . (add c-lineup-after-whitesmith-blocks
|
||||
c-indent-multi-line-block))
|
||||
(arglist-cont-nonempty . (add c-lineup-whitesmith-in-block
|
||||
c-indent-multi-line-block))
|
||||
(arglist-close . c-lineup-whitesmith-in-block)
|
||||
(inclass . c-lineup-whitesmith-in-block)
|
||||
(extern-lang-open . +)
|
||||
(namespace-open . +)
|
||||
(module-open . +)
|
||||
(composition-open . +)
|
||||
(extern-lang-close . +)
|
||||
(namespace-close . +)
|
||||
(module-close . +)
|
||||
(composition-close . +)
|
||||
(inextern-lang . c-lineup-whitesmith-in-block)
|
||||
(innamespace . c-lineup-whitesmith-in-block)
|
||||
(inmodule . c-lineup-whitesmith-in-block)
|
||||
(incomposition . c-lineup-whitesmith-in-block)
|
||||
(inexpr-class . 0))))
|
||||
|
||||
("ellemtel"
|
||||
(c-basic-offset . 3)
|
||||
(c-comment-only-line-offset . 0)
|
||||
(c-hanging-braces-alist . ((substatement-open before after)
|
||||
(arglist-cont-nonempty)))
|
||||
(c-offsets-alist . ((topmost-intro . 0)
|
||||
(substatement . +)
|
||||
(substatement-open . 0)
|
||||
(case-label . +)
|
||||
(access-label . -)
|
||||
(inclass . +)
|
||||
(inline-open . 0))))
|
||||
("linux"
|
||||
(c-basic-offset . 8)
|
||||
(c-comment-only-line-offset . 0)
|
||||
(c-hanging-braces-alist . ((brace-list-open)
|
||||
(brace-entry-open)
|
||||
(substatement-open after)
|
||||
(block-close . c-snug-do-while)
|
||||
(arglist-cont-nonempty)))
|
||||
(c-cleanup-list . (brace-else-brace))
|
||||
(c-offsets-alist . ((statement-block-intro . +)
|
||||
(knr-argdecl-intro . 0)
|
||||
(substatement-open . 0)
|
||||
(substatement-label . 0)
|
||||
(label . 0)
|
||||
(statement-cont . +))))
|
||||
|
||||
("python"
|
||||
(indent-tabs-mode . t)
|
||||
(fill-column . 78)
|
||||
(c-basic-offset . 8)
|
||||
(c-offsets-alist . ((substatement-open . 0)
|
||||
(inextern-lang . 0)
|
||||
(arglist-intro . +)
|
||||
(knr-argdecl-intro . +)))
|
||||
(c-hanging-braces-alist . ((brace-list-open)
|
||||
(brace-list-intro)
|
||||
(brace-list-close)
|
||||
(brace-entry-open)
|
||||
(substatement-open after)
|
||||
(block-close . c-snug-do-while)
|
||||
(arglist-cont-nonempty)))
|
||||
(c-block-comment-prefix . ""))
|
||||
|
||||
("java"
|
||||
(c-basic-offset . 4)
|
||||
(c-comment-only-line-offset . (0 . 0))
|
||||
;; the following preserves Javadoc starter lines
|
||||
(c-offsets-alist . ((inline-open . 0)
|
||||
(topmost-intro-cont . +)
|
||||
(statement-block-intro . +)
|
||||
(knr-argdecl-intro . 5)
|
||||
(substatement-open . +)
|
||||
(substatement-label . +)
|
||||
(label . +)
|
||||
(statement-case-open . +)
|
||||
(statement-cont . +)
|
||||
(arglist-intro . c-lineup-arglist-intro-after-paren)
|
||||
(arglist-close . c-lineup-arglist)
|
||||
(access-label . 0)
|
||||
(inher-cont . c-lineup-java-inher)
|
||||
(func-decl-cont . c-lineup-java-throws))))
|
||||
|
||||
;; awk style exists primarily for auto-newline settings. Otherwise it's
|
||||
;; pretty much like k&r.
|
||||
("awk"
|
||||
(c-basic-offset . 4)
|
||||
(c-comment-only-line-offset . 0)
|
||||
(c-hanging-braces-alist . ((defun-open after)
|
||||
(defun-close . c-snug-1line-defun-close)
|
||||
(substatement-open after)
|
||||
(block-close . c-snug-do-while)
|
||||
(arglist-cont-nonempty)))
|
||||
(c-hanging-semi&comma-criteria . nil)
|
||||
(c-cleanup-list . nil) ; You might want one-liner-defun here.
|
||||
(c-offsets-alist . ((statement-block-intro . +)
|
||||
(substatement-open . 0)
|
||||
(statement-cont . +))))
|
||||
|
||||
)
|
||||
"Styles of indentation.
|
||||
Elements of this alist are of the form:
|
||||
|
||||
(STYLE-STRING [BASE-STYLE] (VARIABLE . VALUE) [(VARIABLE . VALUE) ...])
|
||||
|
||||
where STYLE-STRING is a short descriptive string used to select a
|
||||
style, VARIABLE is any Emacs variable, and VALUE is the intended value
|
||||
for that variable when using the selected style.
|
||||
|
||||
Optional BASE-STYLE if present, is a string and must follow
|
||||
STYLE-STRING. BASE-STYLE names a style that this style inherits from.
|
||||
By default, all styles inherit from the \"user\" style, which is
|
||||
computed at run time. Style loops generate errors.
|
||||
|
||||
Two variables are treated specially. When VARIABLE is
|
||||
`c-offsets-alist', the VALUE is a list containing elements of the
|
||||
form:
|
||||
|
||||
(SYNTACTIC-SYMBOL . OFFSET)
|
||||
|
||||
as described in `c-offsets-alist'. These are passed directly to
|
||||
`c-set-offset' so there is no need to set every syntactic symbol in
|
||||
your style, only those that are different from the default.
|
||||
|
||||
When VARIABLE is `c-special-indent-hook', its VALUE is added to
|
||||
`c-special-indent-hook' using `add-hook'. If VALUE is a list, each
|
||||
element of the list is added with `add-hook'.
|
||||
|
||||
Do not change this variable directly. Use the function `c-add-style'
|
||||
to add new styles or modify existing styles (it is not a good idea to
|
||||
modify existing styles -- you should create a new style that inherits
|
||||
the existing style).")
|
||||
|
||||
|
||||
;; Functions that manipulate styles
|
||||
(defun c-set-style-1 (conscell dont-override)
|
||||
;; Set the style for one variable
|
||||
(let ((attr (car conscell))
|
||||
(val (cdr conscell)))
|
||||
(cond
|
||||
;; first special variable
|
||||
((eq attr 'c-offsets-alist)
|
||||
(let ((offsets (cond ((eq dont-override t)
|
||||
c-offsets-alist)
|
||||
(dont-override
|
||||
(default-value 'c-offsets-alist)))))
|
||||
(mapcar (lambda (langentry)
|
||||
(let ((langelem (car langentry))
|
||||
(offset (cdr langentry)))
|
||||
(unless (assq langelem offsets)
|
||||
(c-set-offset langelem offset))))
|
||||
val)))
|
||||
;; second special variable
|
||||
((eq attr 'c-special-indent-hook)
|
||||
;; Maybe we should ignore dont-override here and always add new
|
||||
;; hooks?
|
||||
(unless (cond ((eq dont-override t)
|
||||
c-special-indent-hook)
|
||||
(dont-override
|
||||
(default-value 'c-special-indent-hook)))
|
||||
(if (listp val)
|
||||
(mapcar (lambda (func)
|
||||
(add-hook 'c-special-indent-hook func t t))
|
||||
val)
|
||||
(add-hook 'c-special-indent-hook val t t))))
|
||||
;; all other variables
|
||||
(t (when (or (not dont-override)
|
||||
(not (memq attr c-style-variables))
|
||||
(eq (if (eq dont-override t)
|
||||
(symbol-value attr)
|
||||
(default-value attr))
|
||||
'set-from-style))
|
||||
(set attr val)
|
||||
;; Must update a number of other variables if
|
||||
;; c-comment-prefix-regexp is set.
|
||||
(if (eq attr 'c-comment-prefix-regexp)
|
||||
(c-setup-paragraph-variables)))))))
|
||||
|
||||
(defun c-get-style-variables (style basestyles)
|
||||
;; Return all variables in a style by resolving inheritances.
|
||||
(if (not style)
|
||||
(copy-alist c-fallback-style)
|
||||
(let ((vars (cdr (or (assoc (downcase style) c-style-alist)
|
||||
(assoc (upcase style) c-style-alist)
|
||||
(assoc style c-style-alist)
|
||||
(progn
|
||||
(c-benign-error "Undefined style: %s" style)
|
||||
nil)))))
|
||||
(let ((base (and (stringp (car-safe vars))
|
||||
(prog1
|
||||
(downcase (car vars))
|
||||
(setq vars (cdr vars))))))
|
||||
(if (memq base basestyles)
|
||||
(c-benign-error "Style loop detected: %s in %s" base basestyles)
|
||||
(nconc (c-get-style-variables base (cons base basestyles))
|
||||
(copy-alist vars)))))))
|
||||
|
||||
(defvar c-set-style-history nil)
|
||||
|
||||
;;;###autoload
|
||||
(defun c-set-style (stylename &optional dont-override)
|
||||
"Set the current buffer to use the style STYLENAME.
|
||||
STYLENAME, a string, must be an existing CC Mode style - These are contained
|
||||
in the variable `c-style-alist'.
|
||||
|
||||
The variable `c-indentation-style' will get set to STYLENAME.
|
||||
|
||||
\"Setting the style\" is done by setting CC Mode's \"style variables\" to the
|
||||
values indicated by the pertinent entry in `c-style-alist'. Other variables
|
||||
might get set too.
|
||||
|
||||
If DONT-OVERRIDE is neither nil nor t, style variables whose default values
|
||||
have been set (more precisely, whose default values are not the symbol
|
||||
`set-from-style') will not be changed. This avoids overriding global settings
|
||||
done in ~/.emacs. It is useful to call c-set-style from a mode hook in this
|
||||
way.
|
||||
|
||||
If DONT-OVERRIDE is t, style variables that already have values (i.e., whose
|
||||
values are not the symbol `set-from-style') will not be overridden. CC Mode
|
||||
calls c-set-style internally in this way whilst initializing a buffer; if
|
||||
cc-set-style is called like this from anywhere else, it will usually behave as
|
||||
a null operation."
|
||||
(interactive
|
||||
(list (let ((completion-ignore-case t)
|
||||
(prompt (format "Which %s indentation style? "
|
||||
mode-name)))
|
||||
(completing-read prompt c-style-alist nil t nil
|
||||
'c-set-style-history
|
||||
c-indentation-style))))
|
||||
(or c-buffer-is-cc-mode
|
||||
(error "Buffer %s is not a CC Mode buffer (c-set-style)" (buffer-name)))
|
||||
(or (stringp stylename)
|
||||
(error "Argument to c-set-style was not a string"))
|
||||
(c-initialize-builtin-style)
|
||||
(let ((vars (c-get-style-variables stylename nil)))
|
||||
(unless dont-override
|
||||
;; Since we always add to c-special-indent-hook we must reset it
|
||||
;; first, or else the hooks from the preceding style will
|
||||
;; remain. This is not necessary for c-offsets-alist, since
|
||||
;; c-get-style-variables contains every valid offset type in the
|
||||
;; fallback entry.
|
||||
(setq c-special-indent-hook
|
||||
(default-value 'c-special-indent-hook)))
|
||||
(mapc (lambda (elem)
|
||||
(c-set-style-1 elem dont-override))
|
||||
;; Need to go through the variables backwards when we
|
||||
;; don't override any settings.
|
||||
(if (eq dont-override t) (nreverse vars) vars)))
|
||||
(setq c-indentation-style stylename)
|
||||
(c-keep-region-active))
|
||||
|
||||
;;;###autoload
|
||||
(defun c-add-style (style description &optional set-p)
|
||||
"Adds a style to `c-style-alist', or updates an existing one.
|
||||
STYLE is a string identifying the style to add or update. DESCRIPTION
|
||||
is an association list describing the style and must be of the form:
|
||||
|
||||
([BASESTYLE] (VARIABLE . VALUE) [(VARIABLE . VALUE) ...])
|
||||
|
||||
See the variable `c-style-alist' for the semantics of BASESTYLE,
|
||||
VARIABLE and VALUE. This function also sets the current style to
|
||||
STYLE using `c-set-style' if the optional SET-P flag is non-nil."
|
||||
(interactive
|
||||
(let ((stylename (completing-read "Style to add: " c-style-alist
|
||||
nil nil nil 'c-set-style-history))
|
||||
(descr (eval-minibuffer "Style description: ")))
|
||||
(list stylename descr
|
||||
(y-or-n-p "Set the style too? "))))
|
||||
(setq style (downcase style))
|
||||
(let ((s (assoc style c-style-alist)))
|
||||
(if s
|
||||
(setcdr s (copy-alist description)) ; replace
|
||||
(setq c-style-alist (cons (cons style description) c-style-alist))))
|
||||
(and set-p (c-set-style style)))
|
||||
|
||||
|
||||
(defvar c-read-offset-history nil)
|
||||
|
||||
(defun c-read-offset (langelem)
|
||||
;; read new offset value for LANGELEM from minibuffer. return a
|
||||
;; valid value only
|
||||
(let* ((oldoff (cdr-safe (or (assq langelem c-offsets-alist)
|
||||
(assq langelem (get 'c-offsets-alist
|
||||
'c-stylevar-fallback)))))
|
||||
(symname (symbol-name langelem))
|
||||
(defstr (format "(default %s): " oldoff))
|
||||
(errmsg (concat "Offset must be int, func, var, vector, list, "
|
||||
"or [+,-,++,--,*,/] "
|
||||
defstr))
|
||||
(prompt (concat symname " offset " defstr))
|
||||
(keymap (make-sparse-keymap))
|
||||
(minibuffer-completion-table obarray)
|
||||
(minibuffer-completion-predicate 'fboundp)
|
||||
offset input)
|
||||
;; In principle completing-read is used here, but SPC is unbound
|
||||
;; to make it less annoying to enter lists.
|
||||
(set-keymap-parent keymap minibuffer-local-completion-map)
|
||||
(define-key keymap " " 'self-insert-command)
|
||||
(while (not offset)
|
||||
(setq input (read-from-minibuffer prompt nil keymap t
|
||||
'c-read-offset-history
|
||||
(format "%s" oldoff)))
|
||||
(if (c-valid-offset input)
|
||||
(setq offset input)
|
||||
;; error, but don't signal one, keep trying
|
||||
;; to read an input value
|
||||
(ding)
|
||||
(setq prompt errmsg)))
|
||||
offset))
|
||||
|
||||
;;;###autoload
|
||||
(defun c-set-offset (symbol offset &optional ignored)
|
||||
"Change the value of a syntactic element symbol in `c-offsets-alist'.
|
||||
SYMBOL is the syntactic element symbol to change and OFFSET is the new
|
||||
offset for that syntactic element. The optional argument is not used
|
||||
and exists only for compatibility reasons."
|
||||
(interactive
|
||||
(let* ((langelem
|
||||
(intern (completing-read
|
||||
(concat "Syntactic symbol to change"
|
||||
(if current-prefix-arg " or add" "")
|
||||
": ")
|
||||
(mapcar
|
||||
#'(lambda (langelem)
|
||||
(cons (format "%s" (car langelem)) nil))
|
||||
(get 'c-offsets-alist 'c-stylevar-fallback))
|
||||
nil (not current-prefix-arg)
|
||||
;; initial contents tries to be the last element
|
||||
;; on the syntactic analysis list for the current
|
||||
;; line
|
||||
(and c-buffer-is-cc-mode
|
||||
(c-save-buffer-state
|
||||
((syntax (c-guess-basic-syntax))
|
||||
(len (length syntax))
|
||||
(ic (format "%s" (car (nth (1- len) syntax)))))
|
||||
(cons ic 0)))
|
||||
)))
|
||||
(offset (c-read-offset langelem)))
|
||||
(list langelem offset current-prefix-arg)))
|
||||
;; sanity check offset
|
||||
(if (c-valid-offset offset)
|
||||
(let ((entry (assq symbol c-offsets-alist)))
|
||||
(if entry
|
||||
(setcdr entry offset)
|
||||
(if (assq symbol (get 'c-offsets-alist 'c-stylevar-fallback))
|
||||
(setq c-offsets-alist (cons (cons symbol offset)
|
||||
c-offsets-alist))
|
||||
(c-benign-error "%s is not a valid syntactic symbol" symbol))))
|
||||
(c-benign-error "Invalid indentation setting for symbol %s: %S"
|
||||
symbol offset))
|
||||
(c-keep-region-active))
|
||||
|
||||
|
||||
(defun c-setup-paragraph-variables ()
|
||||
"Fix things up for paragraph recognition and filling inside comments and
|
||||
strings by incorporating the values of `c-comment-prefix-regexp',
|
||||
`sentence-end', `paragraph-start' and `paragraph-separate' in the relevant
|
||||
variables."
|
||||
|
||||
(interactive)
|
||||
(or c-buffer-is-cc-mode
|
||||
(error "Buffer %s is not a CC Mode buffer (c-setup-paragraph-variables)"
|
||||
(buffer-name)))
|
||||
;; Set up the values for use in comments.
|
||||
(setq c-current-comment-prefix
|
||||
(if (listp c-comment-prefix-regexp)
|
||||
(cdr-safe (or (assoc major-mode c-comment-prefix-regexp)
|
||||
(assoc 'other c-comment-prefix-regexp)))
|
||||
c-comment-prefix-regexp))
|
||||
|
||||
(let* ((empty-is-prefix (string-match c-current-comment-prefix ""))
|
||||
(nonws-comment-line-prefix
|
||||
(concat "\\(" c-current-comment-prefix "\\)[ \t]*"))
|
||||
(comment-line-prefix (concat "[ \t]*" nonws-comment-line-prefix))
|
||||
(blank-or-comment-line-prefix
|
||||
(concat "[ \t]*"
|
||||
(if empty-is-prefix "" "\\(")
|
||||
nonws-comment-line-prefix
|
||||
(if empty-is-prefix "" "\\)?"))))
|
||||
|
||||
(setq paragraph-start (concat blank-or-comment-line-prefix
|
||||
c-paragraph-start
|
||||
"\\|"
|
||||
page-delimiter)
|
||||
paragraph-separate (concat blank-or-comment-line-prefix
|
||||
c-paragraph-separate
|
||||
"\\|"
|
||||
page-delimiter)
|
||||
paragraph-ignore-fill-prefix t
|
||||
adaptive-fill-mode t
|
||||
adaptive-fill-regexp
|
||||
(concat comment-line-prefix
|
||||
(if (default-value 'adaptive-fill-regexp)
|
||||
(concat "\\("
|
||||
(default-value 'adaptive-fill-regexp)
|
||||
"\\)")
|
||||
"")))
|
||||
|
||||
(when (boundp 'adaptive-fill-first-line-regexp)
|
||||
;; XEmacs adaptive fill mode doesn't have this.
|
||||
(make-local-variable 'adaptive-fill-first-line-regexp)
|
||||
(setq adaptive-fill-first-line-regexp
|
||||
(concat "\\`" comment-line-prefix
|
||||
;; Maybe we should incorporate the old value here,
|
||||
;; but then we have to do all sorts of kludges to
|
||||
;; deal with the \` and \' it probably contains.
|
||||
"\\'"))))
|
||||
|
||||
;; Set up the values for use in strings. These are the default
|
||||
;; paragraph-start/separate values, enhanced to accept escaped EOLs as
|
||||
;; whitespace. Used in c-beginning/end-of-sentence-in-string in cc-cmds.
|
||||
(setq c-string-par-start
|
||||
;;(concat "\\(" (default-value 'paragraph-start) "\\)\\|[ \t]*\\\\$"))
|
||||
"\f\\|[ \t]*\\\\?$")
|
||||
(setq c-string-par-separate
|
||||
;;(concat "\\(" (default-value 'paragraph-separate) "\\)\\|[ \t]*\\\\$"))
|
||||
"[ \t\f]*\\\\?$")
|
||||
(setq c-sentence-end-with-esc-eol
|
||||
(concat "\\(\\(" (c-default-value-sentence-end) "\\)"
|
||||
;; N.B.: "$" would be invalid when not enclosed like "\\($\\)".
|
||||
"\\|" "[.?!][]\"')}]* ?\\\\\\($\\)[ \t\n]*"
|
||||
"\\)")))
|
||||
|
||||
|
||||
;; Helper for setting up Filladapt mode. It's not used by CC Mode itself.
|
||||
|
||||
(cc-bytecomp-defvar filladapt-token-table)
|
||||
(cc-bytecomp-defvar filladapt-token-match-table)
|
||||
(cc-bytecomp-defvar filladapt-token-conversion-table)
|
||||
|
||||
(defun c-setup-filladapt ()
|
||||
"Convenience function to configure Kyle E. Jones' Filladapt mode for
|
||||
CC Mode by making sure the proper entries are present on
|
||||
`filladapt-token-table', `filladapt-token-match-table', and
|
||||
`filladapt-token-conversion-table'. This is intended to be used on
|
||||
`c-mode-common-hook' or similar."
|
||||
;; This function is intended to be used explicitly by the end user
|
||||
;; only.
|
||||
|
||||
;; The default configuration already handles C++ comments, but we
|
||||
;; need to add handling of C block comments. A new filladapt token
|
||||
;; `c-comment' is added for that.
|
||||
(let (p)
|
||||
(setq p filladapt-token-table)
|
||||
(while (and p (not (eq (car-safe (cdr-safe (car-safe p))) 'c-comment)))
|
||||
(setq p (cdr-safe p)))
|
||||
(if p
|
||||
(setcar (car p) c-current-comment-prefix)
|
||||
(setq filladapt-token-table
|
||||
(append (list (car filladapt-token-table)
|
||||
(list c-current-comment-prefix 'c-comment))
|
||||
(cdr filladapt-token-table)))))
|
||||
(unless (assq 'c-comment filladapt-token-match-table)
|
||||
(setq filladapt-token-match-table
|
||||
(append '((c-comment c-comment))
|
||||
filladapt-token-match-table)))
|
||||
(unless (assq 'c-comment filladapt-token-conversion-table)
|
||||
(setq filladapt-token-conversion-table
|
||||
(append '((c-comment . exact))
|
||||
filladapt-token-conversion-table))))
|
||||
|
||||
|
||||
(defun c-initialize-builtin-style ()
|
||||
;; Dynamically append the default value of most variables. This is
|
||||
;; crucial because future c-set-style calls will always reset the
|
||||
;; variables first to the `cc-mode' style before instituting the new
|
||||
;; style. Only do this once!
|
||||
(unless (get 'c-initialize-builtin-style 'is-run)
|
||||
(put 'c-initialize-builtin-style 'is-run t)
|
||||
;;(c-initialize-cc-mode)
|
||||
(unless (assoc "user" c-style-alist)
|
||||
(let ((vars c-style-variables) var val uservars)
|
||||
(while vars
|
||||
(setq var (car vars)
|
||||
val (symbol-value var)
|
||||
vars (cdr vars))
|
||||
(cond ((eq var 'c-offsets-alist)
|
||||
(or (null val)
|
||||
(setq uservars (cons (cons 'c-offsets-alist val)
|
||||
uservars))))
|
||||
((not (eq val 'set-from-style))
|
||||
(setq uservars (cons (cons var val)
|
||||
uservars)))))
|
||||
(c-add-style "user" uservars)))
|
||||
(unless (assoc "cc-mode" c-style-alist)
|
||||
(c-add-style "cc-mode" '("user")))
|
||||
(if c-style-variables-are-local-p
|
||||
(c-make-styles-buffer-local))))
|
||||
|
||||
(defun c-make-styles-buffer-local (&optional this-buf-only-p)
|
||||
"Make all CC Mode style variables buffer local.
|
||||
If `this-buf-only-p' is non-nil, the style variables will be made
|
||||
buffer local only in the current buffer. Otherwise they'll be made
|
||||
permanently buffer local in any buffer that changes their values.
|
||||
|
||||
The buffer localness of the style variables are normally controlled
|
||||
with the variable `c-style-variables-are-local-p', so there's seldom
|
||||
any reason to call this function directly."
|
||||
|
||||
;; style variables
|
||||
(let ((func (if this-buf-only-p
|
||||
'make-local-variable
|
||||
'make-variable-buffer-local))
|
||||
(varsyms (cons 'c-indentation-style (copy-alist c-style-variables))))
|
||||
(delq 'c-special-indent-hook varsyms)
|
||||
(mapc func varsyms)
|
||||
;; Hooks must be handled specially
|
||||
(if this-buf-only-p
|
||||
(or (memq 'add-hook-local c-emacs-features)
|
||||
(make-local-hook 'c-special-indent-hook))
|
||||
(make-variable-buffer-local 'c-special-indent-hook)
|
||||
(setq c-style-variables-are-local-p t))
|
||||
))
|
||||
|
||||
(defun cc-choose-style-for-mode (mode default-style)
|
||||
"Return suitable style for MODE from DEFAULT-STYLE.
|
||||
DEFAULT-STYLE has the same format as `c-default-style'."
|
||||
(if (stringp default-style)
|
||||
default-style
|
||||
(or (cdr (assq mode default-style))
|
||||
(cdr (assq 'other default-style))
|
||||
"gnu")))
|
||||
|
||||
|
||||
|
||||
(cc-provide 'cc-styles)
|
||||
|
||||
;;; arch-tag: c764f61a-96ba-484a-a68f-101c0e9d5d2c
|
||||
;;; cc-styles.el ends here
|
||||
326
site-lisp/cc-mode/5.32.3/cc-subword.el
Normal file
326
site-lisp/cc-mode/5.32.3/cc-subword.el
Normal file
|
|
@ -0,0 +1,326 @@
|
|||
;;; cc-subword.el --- Handling capitalized subwords in a nomenclature
|
||||
|
||||
;; Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012
|
||||
;; Free Software Foundation, Inc.
|
||||
|
||||
;; Author: Masatake YAMATO
|
||||
|
||||
;; This program is free software; you can redistribute it and/or modify
|
||||
;; it under the terms of the GNU General Public License as published by
|
||||
;; the Free Software Foundation; either version 3, or (at your option)
|
||||
;; any later version.
|
||||
|
||||
;; This program is distributed in the hope that it will be useful,
|
||||
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
;; GNU General Public License for more details.
|
||||
|
||||
;; You should have received a copy of the GNU General Public License
|
||||
;; along with this program; see the file COPYING. If not, see
|
||||
;; <http://www.gnu.org/licenses/>.
|
||||
|
||||
;;; Commentary:
|
||||
|
||||
;; This package provides `subword' oriented commands and a minor mode
|
||||
;; (`c-subword-mode') that substitutes the common word handling
|
||||
;; functions with them.
|
||||
|
||||
;; In spite of GNU Coding Standards, it is popular to name a symbol by
|
||||
;; mixing uppercase and lowercase letters, e.g. "GtkWidget",
|
||||
;; "EmacsFrameClass", "NSGraphicsContext", etc. Here we call these
|
||||
;; mixed case symbols `nomenclatures'. Also, each capitalized (or
|
||||
;; completely uppercase) part of a nomenclature is called a `subword'.
|
||||
;; Here are some examples:
|
||||
|
||||
;; Nomenclature Subwords
|
||||
;; ===========================================================
|
||||
;; GtkWindow => "Gtk" and "Window"
|
||||
;; EmacsFrameClass => "Emacs", "Frame" and "Class"
|
||||
;; NSGraphicsContext => "NS", "Graphics" and "Context"
|
||||
|
||||
;; The subword oriented commands defined in this package recognize
|
||||
;; subwords in a nomenclature to move between them and to edit them as
|
||||
;; words.
|
||||
|
||||
;; In the minor mode, all common key bindings for word oriented
|
||||
;; commands are overridden by the subword oriented commands:
|
||||
|
||||
;; Key Word oriented command Subword oriented command
|
||||
;; ============================================================
|
||||
;; M-f `forward-word' `c-forward-subword'
|
||||
;; M-b `backward-word' `c-backward-subword'
|
||||
;; M-@ `mark-word' `c-mark-subword'
|
||||
;; M-d `kill-word' `c-kill-subword'
|
||||
;; M-DEL `backward-kill-word' `c-backward-kill-subword'
|
||||
;; M-t `transpose-words' `c-transpose-subwords'
|
||||
;; M-c `capitalize-word' `c-capitalize-subword'
|
||||
;; M-u `upcase-word' `c-upcase-subword'
|
||||
;; M-l `downcase-word' `c-downcase-subword'
|
||||
;;
|
||||
;; Note: If you have changed the key bindings for the word oriented
|
||||
;; commands in your .emacs or a similar place, the keys you've changed
|
||||
;; to are also used for the corresponding subword oriented commands.
|
||||
|
||||
;; To make the mode turn on automatically, put the following code in
|
||||
;; your .emacs:
|
||||
;;
|
||||
;; (add-hook 'c-mode-common-hook
|
||||
;; (lambda () (c-subword-mode 1)))
|
||||
;;
|
||||
|
||||
;; Acknowledgment:
|
||||
;; The regular expressions to detect subwords are mostly based on
|
||||
;; the old `c-forward-into-nomenclature' originally contributed by
|
||||
;; Terry_Glanfield dot Southern at rxuk dot xerox dot com.
|
||||
|
||||
;; TODO: ispell-word and subword oriented C-w in isearch.
|
||||
|
||||
;;; Code:
|
||||
|
||||
(eval-when-compile
|
||||
(let ((load-path
|
||||
(if (and (boundp 'byte-compile-dest-file)
|
||||
(stringp byte-compile-dest-file))
|
||||
(cons (file-name-directory byte-compile-dest-file) load-path)
|
||||
load-path)))
|
||||
(load "cc-bytecomp" nil t)))
|
||||
|
||||
(cc-require 'cc-defs)
|
||||
(cc-require 'cc-cmds)
|
||||
|
||||
;; Don't complain about the `define-minor-mode' form if it isn't defined.
|
||||
(cc-bytecomp-defvar c-subword-mode)
|
||||
|
||||
;; Autoload directives must be on the top level, so we construct an
|
||||
;; autoload form instead.
|
||||
;;;###autoload (autoload 'c-subword-mode "cc-subword" "Mode enabling subword movement and editing keys." t)
|
||||
|
||||
(if (not (fboundp 'define-minor-mode))
|
||||
(defun c-subword-mode ()
|
||||
"(Missing) mode enabling subword movement and editing keys.
|
||||
This mode is not (yet) available in this version of (X)Emacs. Sorry! If
|
||||
you really want it, please send a request to <bug-gnu-emacs@gnu.org>,
|
||||
telling us which (X)Emacs version you're using."
|
||||
(interactive)
|
||||
(error
|
||||
"c-subword-mode is not (yet) available in this version of (X)Emacs. Sorry!"))
|
||||
|
||||
(defvar c-subword-mode-map
|
||||
(let ((map (make-sparse-keymap)))
|
||||
(substitute-key-definition 'forward-word
|
||||
'c-forward-subword
|
||||
map global-map)
|
||||
(substitute-key-definition 'backward-word
|
||||
'c-backward-subword
|
||||
map global-map)
|
||||
(substitute-key-definition 'mark-word
|
||||
'c-mark-subword
|
||||
map global-map)
|
||||
|
||||
(substitute-key-definition 'kill-word
|
||||
'c-kill-subword
|
||||
map global-map)
|
||||
(substitute-key-definition 'backward-kill-word
|
||||
'c-backward-kill-subword
|
||||
map global-map)
|
||||
|
||||
(substitute-key-definition 'transpose-words
|
||||
'c-transpose-subwords
|
||||
map global-map)
|
||||
|
||||
(substitute-key-definition 'capitalize-word
|
||||
'c-capitalize-subword
|
||||
map global-map)
|
||||
(substitute-key-definition 'upcase-word
|
||||
'c-upcase-subword
|
||||
map global-map)
|
||||
(substitute-key-definition 'downcase-word
|
||||
'c-downcase-subword
|
||||
map global-map)
|
||||
map)
|
||||
"Keymap used in command `c-subword-mode' minor mode.")
|
||||
|
||||
(define-minor-mode c-subword-mode
|
||||
"Mode enabling subword movement and editing keys.
|
||||
In spite of GNU Coding Standards, it is popular to name a symbol by
|
||||
mixing uppercase and lowercase letters, e.g. \"GtkWidget\",
|
||||
\"EmacsFrameClass\", \"NSGraphicsContext\", etc. Here we call these
|
||||
mixed case symbols `nomenclatures'. Also, each capitalized (or
|
||||
completely uppercase) part of a nomenclature is called a `subword'.
|
||||
Here are some examples:
|
||||
|
||||
Nomenclature Subwords
|
||||
===========================================================
|
||||
GtkWindow => \"Gtk\" and \"Window\"
|
||||
EmacsFrameClass => \"Emacs\", \"Frame\" and \"Class\"
|
||||
NSGraphicsContext => \"NS\", \"Graphics\" and \"Context\"
|
||||
|
||||
The subword oriented commands activated in this minor mode recognize
|
||||
subwords in a nomenclature to move between subwords and to edit them
|
||||
as words.
|
||||
|
||||
\\{c-subword-mode-map}"
|
||||
nil
|
||||
nil
|
||||
c-subword-mode-map
|
||||
(c-update-modeline))
|
||||
|
||||
)
|
||||
|
||||
(defun c-forward-subword (&optional arg)
|
||||
"Do the same as `forward-word' but on subwords.
|
||||
See the command `c-subword-mode' for a description of subwords.
|
||||
Optional argument ARG is the same as for `forward-word'."
|
||||
(interactive "p")
|
||||
(unless arg (setq arg 1))
|
||||
(c-keep-region-active)
|
||||
(cond
|
||||
((< 0 arg)
|
||||
(dotimes (i arg (point))
|
||||
(c-forward-subword-internal)))
|
||||
((> 0 arg)
|
||||
(dotimes (i (- arg) (point))
|
||||
(c-backward-subword-internal)))
|
||||
(t
|
||||
(point))))
|
||||
|
||||
(defun c-backward-subword (&optional arg)
|
||||
"Do the same as `backward-word' but on subwords.
|
||||
See the command `c-subword-mode' for a description of subwords.
|
||||
Optional argument ARG is the same as for `backward-word'."
|
||||
(interactive "p")
|
||||
(c-forward-subword (- (or arg 1))))
|
||||
|
||||
(defun c-mark-subword (arg)
|
||||
"Do the same as `mark-word' but on subwords.
|
||||
See the command `c-subword-mode' for a description of subwords.
|
||||
Optional argument ARG is the same as for `mark-word'."
|
||||
;; This code is almost copied from `mark-word' in GNU Emacs.
|
||||
(interactive "p")
|
||||
(cond ((and (eq last-command this-command) (mark t))
|
||||
(set-mark
|
||||
(save-excursion
|
||||
(goto-char (mark))
|
||||
(c-forward-subword arg)
|
||||
(point))))
|
||||
(t
|
||||
(push-mark
|
||||
(save-excursion
|
||||
(c-forward-subword arg)
|
||||
(point))
|
||||
nil t))))
|
||||
|
||||
(defun c-kill-subword (arg)
|
||||
"Do the same as `kill-word' but on subwords.
|
||||
See the command `c-subword-mode' for a description of subwords.
|
||||
Optional argument ARG is the same as for `kill-word'."
|
||||
(interactive "p")
|
||||
(kill-region (point) (c-forward-subword arg)))
|
||||
|
||||
(defun c-backward-kill-subword (arg)
|
||||
"Do the same as `backward-kill-word' but on subwords.
|
||||
See the command `c-subword-mode' for a description of subwords.
|
||||
Optional argument ARG is the same as for `backward-kill-word'."
|
||||
(interactive "p")
|
||||
(c-kill-subword (- arg)))
|
||||
|
||||
(defun c-transpose-subwords (arg)
|
||||
"Do the same as `transpose-words' but on subwords.
|
||||
See the command `c-subword-mode' for a description of subwords.
|
||||
Optional argument ARG is the same as for `transpose-words'."
|
||||
(interactive "*p")
|
||||
(transpose-subr 'c-forward-subword arg))
|
||||
|
||||
|
||||
|
||||
(defun c-downcase-subword (arg)
|
||||
"Do the same as `downcase-word' but on subwords.
|
||||
See the command `c-subword-mode' for a description of subwords.
|
||||
Optional argument ARG is the same as for `downcase-word'."
|
||||
(interactive "p")
|
||||
(let ((start (point)))
|
||||
(downcase-region (point) (c-forward-subword arg))
|
||||
(when (< arg 0)
|
||||
(goto-char start))))
|
||||
|
||||
(defun c-upcase-subword (arg)
|
||||
"Do the same as `upcase-word' but on subwords.
|
||||
See the command `c-subword-mode' for a description of subwords.
|
||||
Optional argument ARG is the same as for `upcase-word'."
|
||||
(interactive "p")
|
||||
(let ((start (point)))
|
||||
(upcase-region (point) (c-forward-subword arg))
|
||||
(when (< arg 0)
|
||||
(goto-char start))))
|
||||
|
||||
(defun c-capitalize-subword (arg)
|
||||
"Do the same as `capitalize-word' but on subwords.
|
||||
See the command `c-subword-mode' for a description of subwords.
|
||||
Optional argument ARG is the same as for `capitalize-word'."
|
||||
(interactive "p")
|
||||
(let ((count (abs arg))
|
||||
(start (point))
|
||||
(advance (if (< arg 0) nil t)))
|
||||
(dotimes (i count)
|
||||
(if advance
|
||||
(progn (re-search-forward
|
||||
(concat "[" c-alpha "]")
|
||||
nil t)
|
||||
(goto-char (match-beginning 0)))
|
||||
(c-backward-subword))
|
||||
(let* ((p (point))
|
||||
(pp (1+ p))
|
||||
(np (c-forward-subword)))
|
||||
(upcase-region p pp)
|
||||
(downcase-region pp np)
|
||||
(goto-char (if advance np p))))
|
||||
(unless advance
|
||||
(goto-char start))))
|
||||
|
||||
|
||||
|
||||
;;
|
||||
;; Internal functions
|
||||
;;
|
||||
(defun c-forward-subword-internal ()
|
||||
(if (and
|
||||
(save-excursion
|
||||
(let ((case-fold-search nil))
|
||||
(re-search-forward
|
||||
(concat "\\W*\\(\\([" c-upper "]*\\W?\\)[" c-lower c-digit "]*\\)")
|
||||
nil t)))
|
||||
(> (match-end 0) (point))) ; So we don't get stuck at a
|
||||
; "word-constituent" which isn't c-upper,
|
||||
; c-lower or c-digit
|
||||
(goto-char
|
||||
(cond
|
||||
((< 1 (- (match-end 2) (match-beginning 2)))
|
||||
(1- (match-end 2)))
|
||||
(t
|
||||
(match-end 0))))
|
||||
(forward-word 1)))
|
||||
|
||||
|
||||
(defun c-backward-subword-internal ()
|
||||
(if (save-excursion
|
||||
(let ((case-fold-search nil))
|
||||
(re-search-backward
|
||||
(concat
|
||||
"\\(\\(\\W\\|[" c-lower c-digit "]\\)\\([" c-upper "]+\\W*\\)"
|
||||
"\\|\\W\\w+\\)")
|
||||
nil t)))
|
||||
(goto-char
|
||||
(cond
|
||||
((and (match-end 3)
|
||||
(< 1 (- (match-end 3) (match-beginning 3)))
|
||||
(not (eq (point) (match-end 3))))
|
||||
(1- (match-end 3)))
|
||||
(t
|
||||
(1+ (match-beginning 0)))))
|
||||
(backward-word 1)))
|
||||
|
||||
|
||||
(cc-provide 'cc-subword)
|
||||
|
||||
;; arch-tag: 2be9d294-7f30-4626-95e6-9964bb93c7a3
|
||||
;;; cc-subword.el ends here
|
||||
1775
site-lisp/cc-mode/5.32.3/cc-vars.el
Normal file
1775
site-lisp/cc-mode/5.32.3/cc-vars.el
Normal file
File diff suppressed because it is too large
Load diff
5911
site-lisp/cc-mode/csharp-only/csharp-mode-0.8.6.el
Normal file
5911
site-lisp/cc-mode/csharp-only/csharp-mode-0.8.6.el
Normal file
File diff suppressed because it is too large
Load diff
Loading…
Add table
Add a link
Reference in a new issue