diff options
author | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2020-10-12 14:27:29 +0200 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2020-10-13 09:35:20 +0000 |
commit | c30a6232df03e1efbd9f3b226777b07e087a1122 (patch) | |
tree | e992f45784689f373bcc38d1b79a239ebe17ee23 /chromium/third_party/libbrlapi | |
parent | 7b5b123ac58f58ffde0f4f6e488bcd09aa4decd3 (diff) | |
download | qtwebengine-chromium-85-based.tar.gz |
BASELINE: Update Chromium to 85.0.4183.14085-based
Change-Id: Iaa42f4680837c57725b1344f108c0196741f6057
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'chromium/third_party/libbrlapi')
-rw-r--r-- | chromium/third_party/libbrlapi/BUILD.gn | 28 | ||||
-rw-r--r-- | chromium/third_party/libbrlapi/LICENSE | 510 | ||||
-rw-r--r-- | chromium/third_party/libbrlapi/OWNERS | 4 | ||||
-rw-r--r-- | chromium/third_party/libbrlapi/README.chromium | 19 | ||||
-rw-r--r-- | chromium/third_party/libbrlapi/brlapi.h | 1647 | ||||
-rw-r--r-- | chromium/third_party/libbrlapi/brlapi_brldefs.h | 454 | ||||
-rw-r--r-- | chromium/third_party/libbrlapi/brlapi_constants.h | 437 | ||||
-rw-r--r-- | chromium/third_party/libbrlapi/brlapi_keycodes.h | 191 | ||||
-rw-r--r-- | chromium/third_party/libbrlapi/brlapi_param.h | 289 | ||||
-rw-r--r-- | chromium/third_party/libbrlapi/brlapi_protocol.h | 308 |
10 files changed, 3887 insertions, 0 deletions
diff --git a/chromium/third_party/libbrlapi/BUILD.gn b/chromium/third_party/libbrlapi/BUILD.gn new file mode 100644 index 00000000000..1928ead2b89 --- /dev/null +++ b/chromium/third_party/libbrlapi/BUILD.gn @@ -0,0 +1,28 @@ +# Copyright 2016 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +import("//tools/generate_library_loader/generate_library_loader.gni") + +generate_library_loader("libbrlapi") { + name = "LibBrlapiLoader" + output_h = "libbrlapi.h" + output_cc = "libbrlapi_loader.cc" + header = "<brlapi.h>" + bundled_header = "\"third_party/libbrlapi/brlapi.h\"" + + functions = [ + "brlapi_getHandleSize", + "brlapi_error_location", + "brlapi_strerror", + "brlapi__acceptKeys", + "brlapi__openConnection", + "brlapi__closeConnection", + "brlapi__getDisplaySize", + "brlapi__enterTtyModeWithPath", + "brlapi__leaveTtyMode", + "brlapi__writeDots", + "brlapi__readKey", + "brlapi__getParameter", + ] +} diff --git a/chromium/third_party/libbrlapi/LICENSE b/chromium/third_party/libbrlapi/LICENSE new file mode 100644 index 00000000000..b124cf58125 --- /dev/null +++ b/chromium/third_party/libbrlapi/LICENSE @@ -0,0 +1,510 @@ + + GNU LESSER GENERAL PUBLIC LICENSE + Version 2.1, February 1999 + + Copyright (C) 1991, 1999 Free Software Foundation, Inc. + 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + +[This is the first released version of the Lesser GPL. It also counts + as the successor of the GNU Library Public License, version 2, hence + the version number 2.1.] + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +Licenses are intended to guarantee your freedom to share and change +free software--to make sure the software is free for all its users. + + This license, the Lesser General Public License, applies to some +specially designated software packages--typically libraries--of the +Free Software Foundation and other authors who decide to use it. You +can use it too, but we suggest you first think carefully about whether +this license or the ordinary General Public License is the better +strategy to use in any particular case, based on the explanations +below. + + When we speak of free software, we are referring to freedom of use, +not price. Our General Public Licenses are designed to make sure that +you have the freedom to distribute copies of free software (and charge +for this service if you wish); that you receive source code or can get +it if you want it; that you can change the software and use pieces of +it in new free programs; and that you are informed that you can do +these things. + + To protect your rights, we need to make restrictions that forbid +distributors to deny you these rights or to ask you to surrender these +rights. These restrictions translate to certain responsibilities for +you if you distribute copies of the library or if you modify it. + + For example, if you distribute copies of the library, whether gratis +or for a fee, you must give the recipients all the rights that we gave +you. You must make sure that they, too, receive or can get the source +code. If you link other code with the library, you must provide +complete object files to the recipients, so that they can relink them +with the library after making changes to the library and recompiling +it. And you must show them these terms so they know their rights. + + We protect your rights with a two-step method: (1) we copyright the +library, and (2) we offer you this license, which gives you legal +permission to copy, distribute and/or modify the library. + + To protect each distributor, we want to make it very clear that +there is no warranty for the free library. Also, if the library is +modified by someone else and passed on, the recipients should know +that what they have is not the original version, so that the original +author's reputation will not be affected by problems that might be +introduced by others. + + Finally, software patents pose a constant threat to the existence of +any free program. We wish to make sure that a company cannot +effectively restrict the users of a free program by obtaining a +restrictive license from a patent holder. Therefore, we insist that +any patent license obtained for a version of the library must be +consistent with the full freedom of use specified in this license. + + Most GNU software, including some libraries, is covered by the +ordinary GNU General Public License. This license, the GNU Lesser +General Public License, applies to certain designated libraries, and +is quite different from the ordinary General Public License. We use +this license for certain libraries in order to permit linking those +libraries into non-free programs. + + When a program is linked with a library, whether statically or using +a shared library, the combination of the two is legally speaking a +combined work, a derivative of the original library. The ordinary +General Public License therefore permits such linking only if the +entire combination fits its criteria of freedom. The Lesser General +Public License permits more lax criteria for linking other code with +the library. + + We call this license the "Lesser" General Public License because it +does Less to protect the user's freedom than the ordinary General +Public License. It also provides other free software developers Less +of an advantage over competing non-free programs. These disadvantages +are the reason we use the ordinary General Public License for many +libraries. However, the Lesser license provides advantages in certain +special circumstances. + + For example, on rare occasions, there may be a special need to +encourage the widest possible use of a certain library, so that it +becomes a de-facto standard. To achieve this, non-free programs must +be allowed to use the library. A more frequent case is that a free +library does the same job as widely used non-free libraries. In this +case, there is little to gain by limiting the free library to free +software only, so we use the Lesser General Public License. + + In other cases, permission to use a particular library in non-free +programs enables a greater number of people to use a large body of +free software. For example, permission to use the GNU C Library in +non-free programs enables many more people to use the whole GNU +operating system, as well as its variant, the GNU/Linux operating +system. + + Although the Lesser General Public License is Less protective of the +users' freedom, it does ensure that the user of a program that is +linked with the Library has the freedom and the wherewithal to run +that program using a modified version of the Library. + + The precise terms and conditions for copying, distribution and +modification follow. Pay close attention to the difference between a +"work based on the library" and a "work that uses the library". The +former contains code derived from the library, whereas the latter must +be combined with the library in order to run. + + GNU LESSER GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License Agreement applies to any software library or other +program which contains a notice placed by the copyright holder or +other authorized party saying it may be distributed under the terms of +this Lesser General Public License (also called "this License"). +Each licensee is addressed as "you". + + A "library" means a collection of software functions and/or data +prepared so as to be conveniently linked with application programs +(which use some of those functions and data) to form executables. + + The "Library", below, refers to any such software library or work +which has been distributed under these terms. A "work based on the +Library" means either the Library or any derivative work under +copyright law: that is to say, a work containing the Library or a +portion of it, either verbatim or with modifications and/or translated +straightforwardly into another language. (Hereinafter, translation is +included without limitation in the term "modification".) + + "Source code" for a work means the preferred form of the work for +making modifications to it. For a library, complete source code means +all the source code for all modules it contains, plus any associated +interface definition files, plus the scripts used to control +compilation and installation of the library. + + Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running a program using the Library is not restricted, and output from +such a program is covered only if its contents constitute a work based +on the Library (independent of the use of the Library in a tool for +writing it). Whether that is true depends on what the Library does +and what the program that uses the Library does. + + 1. You may copy and distribute verbatim copies of the Library's +complete source code as you receive it, in any medium, provided that +you conspicuously and appropriately publish on each copy an +appropriate copyright notice and disclaimer of warranty; keep intact +all the notices that refer to this License and to the absence of any +warranty; and distribute a copy of this License along with the +Library. + + You may charge a fee for the physical act of transferring a copy, +and you may at your option offer warranty protection in exchange for a +fee. + + 2. You may modify your copy or copies of the Library or any portion +of it, thus forming a work based on the Library, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) The modified work must itself be a software library. + + b) You must cause the files modified to carry prominent notices + stating that you changed the files and the date of any change. + + c) You must cause the whole of the work to be licensed at no + charge to all third parties under the terms of this License. + + d) If a facility in the modified Library refers to a function or a + table of data to be supplied by an application program that uses + the facility, other than as an argument passed when the facility + is invoked, then you must make a good faith effort to ensure that, + in the event an application does not supply such function or + table, the facility still operates, and performs whatever part of + its purpose remains meaningful. + + (For example, a function in a library to compute square roots has + a purpose that is entirely well-defined independent of the + application. Therefore, Subsection 2d requires that any + application-supplied function or table used by this function must + be optional: if the application does not supply it, the square + root function must still compute square roots.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Library, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Library, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote +it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Library. + +In addition, mere aggregation of another work not based on the Library +with the Library (or with a work based on the Library) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may opt to apply the terms of the ordinary GNU General Public +License instead of this License to a given copy of the Library. To do +this, you must alter all the notices that refer to this License, so +that they refer to the ordinary GNU General Public License, version 2, +instead of to this License. (If a newer version than version 2 of the +ordinary GNU General Public License has appeared, then you can specify +that version instead if you wish.) Do not make any other change in +these notices. + + Once this change is made in a given copy, it is irreversible for +that copy, so the ordinary GNU General Public License applies to all +subsequent copies and derivative works made from that copy. + + This option is useful when you wish to copy part of the code of +the Library into a program that is not a library. + + 4. You may copy and distribute the Library (or a portion or +derivative of it, under Section 2) in object code or executable form +under the terms of Sections 1 and 2 above provided that you accompany +it with the complete corresponding machine-readable source code, which +must be distributed under the terms of Sections 1 and 2 above on a +medium customarily used for software interchange. + + If distribution of object code is made by offering access to copy +from a designated place, then offering equivalent access to copy the +source code from the same place satisfies the requirement to +distribute the source code, even though third parties are not +compelled to copy the source along with the object code. + + 5. A program that contains no derivative of any portion of the +Library, but is designed to work with the Library by being compiled or +linked with it, is called a "work that uses the Library". Such a +work, in isolation, is not a derivative work of the Library, and +therefore falls outside the scope of this License. + + However, linking a "work that uses the Library" with the Library +creates an executable that is a derivative of the Library (because it +contains portions of the Library), rather than a "work that uses the +library". The executable is therefore covered by this License. +Section 6 states terms for distribution of such executables. + + When a "work that uses the Library" uses material from a header file +that is part of the Library, the object code for the work may be a +derivative work of the Library even though the source code is not. +Whether this is true is especially significant if the work can be +linked without the Library, or if the work is itself a library. The +threshold for this to be true is not precisely defined by law. + + If such an object file uses only numerical parameters, data +structure layouts and accessors, and small macros and small inline +functions (ten lines or less in length), then the use of the object +file is unrestricted, regardless of whether it is legally a derivative +work. (Executables containing this object code plus portions of the +Library will still fall under Section 6.) + + Otherwise, if the work is a derivative of the Library, you may +distribute the object code for the work under the terms of Section 6. +Any executables containing that work also fall under Section 6, +whether or not they are linked directly with the Library itself. + + 6. As an exception to the Sections above, you may also combine or +link a "work that uses the Library" with the Library to produce a +work containing portions of the Library, and distribute that work +under terms of your choice, provided that the terms permit +modification of the work for the customer's own use and reverse +engineering for debugging such modifications. + + You must give prominent notice with each copy of the work that the +Library is used in it and that the Library and its use are covered by +this License. You must supply a copy of this License. If the work +during execution displays copyright notices, you must include the +copyright notice for the Library among them, as well as a reference +directing the user to the copy of this License. Also, you must do one +of these things: + + a) Accompany the work with the complete corresponding + machine-readable source code for the Library including whatever + changes were used in the work (which must be distributed under + Sections 1 and 2 above); and, if the work is an executable linked + with the Library, with the complete machine-readable "work that + uses the Library", as object code and/or source code, so that the + user can modify the Library and then relink to produce a modified + executable containing the modified Library. (It is understood + that the user who changes the contents of definitions files in the + Library will not necessarily be able to recompile the application + to use the modified definitions.) + + b) Use a suitable shared library mechanism for linking with the + Library. A suitable mechanism is one that (1) uses at run time a + copy of the library already present on the user's computer system, + rather than copying library functions into the executable, and (2) + will operate properly with a modified version of the library, if + the user installs one, as long as the modified version is + interface-compatible with the version that the work was made with. + + c) Accompany the work with a written offer, valid for at least + three years, to give the same user the materials specified in + Subsection 6a, above, for a charge no more than the cost of + performing this distribution. + + d) If distribution of the work is made by offering access to copy + from a designated place, offer equivalent access to copy the above + specified materials from the same place. + + e) Verify that the user has already received a copy of these + materials or that you have already sent this user a copy. + + For an executable, the required form of the "work that uses the +Library" must include any data and utility programs needed for +reproducing the executable from it. However, as a special exception, +the materials to be distributed need not include anything that is +normally distributed (in either source or binary form) with the major +components (compiler, kernel, and so on) of the operating system on +which the executable runs, unless that component itself accompanies +the executable. + + It may happen that this requirement contradicts the license +restrictions of other proprietary libraries that do not normally +accompany the operating system. Such a contradiction means you cannot +use both them and the Library together in an executable that you +distribute. + + 7. You may place library facilities that are a work based on the +Library side-by-side in a single library together with other library +facilities not covered by this License, and distribute such a combined +library, provided that the separate distribution of the work based on +the Library and of the other library facilities is otherwise +permitted, and provided that you do these two things: + + a) Accompany the combined library with a copy of the same work + based on the Library, uncombined with any other library + facilities. This must be distributed under the terms of the + Sections above. + + b) Give prominent notice with the combined library of the fact + that part of it is a work based on the Library, and explaining + where to find the accompanying uncombined form of the same work. + + 8. You may not copy, modify, sublicense, link with, or distribute +the Library except as expressly provided under this License. Any +attempt otherwise to copy, modify, sublicense, link with, or +distribute the Library is void, and will automatically terminate your +rights under this License. However, parties who have received copies, +or rights, from you under this License will not have their licenses +terminated so long as such parties remain in full compliance. + + 9. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Library or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Library (or any work based on the +Library), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Library or works based on it. + + 10. Each time you redistribute the Library (or any work based on the +Library), the recipient automatically receives a license from the +original licensor to copy, distribute, link with or modify the Library +subject to these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties with +this License. + + 11. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Library at all. For example, if a patent +license would not permit royalty-free redistribution of the Library by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Library. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply, and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 12. If the distribution and/or use of the Library is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Library under this License +may add an explicit geographical distribution limitation excluding those +countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 13. The Free Software Foundation may publish revised and/or new +versions of the Lesser General Public License from time to time. +Such new versions will be similar in spirit to the present version, +but may differ in detail to address new problems or concerns. + +Each version is given a distinguishing version number. If the Library +specifies a version number of this License which applies to it and +"any later version", you have the option of following the terms and +conditions either of that version or of any later version published by +the Free Software Foundation. If the Library does not specify a +license version number, you may choose any version ever published by +the Free Software Foundation. + + 14. If you wish to incorporate parts of the Library into other free +programs whose distribution conditions are incompatible with these, +write to the author to ask for permission. For software which is +copyrighted by the Free Software Foundation, write to the Free +Software Foundation; we sometimes make exceptions for this. Our +decision will be guided by the two goals of preserving the free status +of all derivatives of our free software and of promoting the sharing +and reuse of software generally. + + NO WARRANTY + + 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO +WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. +EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR +OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY +KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE +LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME +THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN +WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY +AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU +FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR +CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE +LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING +RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A +FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF +SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH +DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Libraries + + If you develop a new library, and you want it to be of the greatest +possible use to the public, we recommend making it free software that +everyone can redistribute and change. You can do so by permitting +redistribution under these terms (or, alternatively, under the terms +of the ordinary General Public License). + + To apply these terms, attach the following notices to the library. +It is safest to attach them to the start of each source file to most +effectively convey the exclusion of warranty; and each file should +have at least the "copyright" line and a pointer to where the full +notice is found. + + + <one line to give the library's name and a brief idea of what it does.> + Copyright (C) <year> <name of author> + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +Also add information on how to contact you by electronic and paper mail. + +You should also get your employer (if you work as a programmer) or +your school, if any, to sign a "copyright disclaimer" for the library, +if necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the + library `Frob' (a library for tweaking knobs) written by James + Random Hacker. + + <signature of Ty Coon>, 1 April 1990 + Ty Coon, President of Vice + +That's all there is to it! + + diff --git a/chromium/third_party/libbrlapi/OWNERS b/chromium/third_party/libbrlapi/OWNERS new file mode 100644 index 00000000000..47e691696de --- /dev/null +++ b/chromium/third_party/libbrlapi/OWNERS @@ -0,0 +1,4 @@ +file://ui/accessibility/OWNERS + +# TEAM: chromium-accessibility@chromium.org +# COMPONENT: UI>Accessibility>ChromeVox diff --git a/chromium/third_party/libbrlapi/README.chromium b/chromium/third_party/libbrlapi/README.chromium new file mode 100644 index 00000000000..e8b311f78ed --- /dev/null +++ b/chromium/third_party/libbrlapi/README.chromium @@ -0,0 +1,19 @@ +Name: libbrlapi +URL: http://brltty.app +Version: 0.8 +License: LGPL 2.1 +Security Critical: yes +CPEPrefix: cpe:/a:mielke:brltty:3.7.2 + +Description: +BRLTTY is a background process (daemon) which provides access to the Linux/Unix +console (when in text mode) for a blind person using a refreshable braille +display. It drives the braille display, and provides complete screen review +functionality. Some speech capability has also been incorporated. + +BRLTTY is used in Chrome OS to provide braille output for the ChromeVox screen +reader. ChromeVox communicates with BRLTTY using libbrlapi, the public client +api. + +The libbrlapi.h header is imported because we need to keep it in sync with the +libbrlapi so in Chrome OS. diff --git a/chromium/third_party/libbrlapi/brlapi.h b/chromium/third_party/libbrlapi/brlapi.h new file mode 100644 index 00000000000..29b543f5a55 --- /dev/null +++ b/chromium/third_party/libbrlapi/brlapi.h @@ -0,0 +1,1647 @@ +/* Programs/brlapi.h. Generated from brlapi.h.in by configure. */ +/* + * libbrlapi - A library providing access to braille terminals for applications. + * + * Copyright (C) 2002-2020 by + * Samuel Thibault <Samuel.Thibault@ens-lyon.org> + * Sébastien Hinderer <Sebastien.Hinderer@ens-lyon.org> + * + * libbrlapi comes with ABSOLUTELY NO WARRANTY. + * + * This is free software, placed under the terms of the + * GNU Lesser General Public License, as published by the Free Software + * Foundation; either version 2.1 of the License, or (at your option) any + * later version. Please see the file LICENSE-LGPL for details. + * + * Web Page: http://brltty.app/ + * + * This software is maintained by Dave Mielke <dave@mielke.cc>. + */ + +/** \file + * \brief Types, defines and functions prototypes for \e BrlAPI's library + */ + +#ifndef BRLAPI_INCLUDED +#define BRLAPI_INCLUDED + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +/* #undef BRLAPI_WIN32 */ + +/** \defgroup brlapi_version Version of the BrlAPI library + * @{ */ + +/** Library version. */ +#define BRLAPI_RELEASE "0.8.0" + +/** Library major version. */ +#define BRLAPI_MAJOR 0 + +/** Library minor version. */ +#define BRLAPI_MINOR 8 + +/** Library revision. */ +#define BRLAPI_REVISION 0 + +/** Returns the version of the library */ +void brlapi_getLibraryVersion(int* major, int* minor, int* revision); + +/** @} */ + +/* Types are defined there */ +#include <sys/types.h> + +#ifdef BRLAPI_WIN32 +#include <windows.h> +#define BRLAPI_STDCALL __stdcall +#else /* BRLAPI_WIN32 */ +#define BRLAPI_STDCALL +#endif /* BRLAPI_WIN32 */ + +#ifdef _MSC_VER +typedef __int64 uint64_t; +typedef __int32 uint32_t; +#define UINT64_C(x) (x##Ui64) +#define PRIx64 "I64x" +typedef signed int ssize_t; +#else /* _MSC_VER */ + +/* this is for uint*_t */ +#include <stdint.h> + +/* NULL is defined there */ +#include <unistd.h> + +#include <inttypes.h> /* For PRIx64 */ +#endif /* _MSC_VER */ + +#include <wchar.h> + +/** \defgroup brlapi_handles BrlAPI handles + * + * Each function provided by BrlAPI comes in two versions. + * + * 1. A version whose name is prefixed by brlapi_ for clients opening only + * one simultaneous connection with BrlAPI (most frequen case) + * + * 2. A version whose name is prefixed by brlapi__ for use by clients + * wishing to open more than one connection to BrlAPI. + * + * A function called brlapi__foo is used in exactly the same way as its + * brlapi_foo counterpart, except that it takes an additional argument + * (the first one), which is a handle letting the client refer to a given + * connection in a similar manner to what file descriptors do. + * + * In case you want to check that your code is not erroneously using brlapi_foo + * functions, define BRLAPI_NO_SINGLE_SESSION before including <brlapi.h>: that + * will disable the declaration of all single session functions. + * + * @{ */ + +/** Type for BrlAPI hanles */ +typedef struct brlapi_handle_t brlapi_handle_t; + +/** Returns the size of an object of type brlapi_handle_t in bytes */ +size_t BRLAPI_STDCALL brlapi_getHandleSize(void); + +/** @} */ + +/** \defgroup brlapi_connection Connecting to BrlAPI + * + * Before calling any other function of the library, calling + * brlapi_openConnection() is needed to establish a connection to + * \e BrlAPI 's server. + * When the connection is not needed any more, brlapi_closeConnection() must be + * called to close the connection. + * + * @{ */ + +/** Default port number on which connections to \e BrlAPI can be established */ +#define BRLAPI_SOCKETPORTNUM 4101 +#define BRLAPI_SOCKETPORT "4101" + +/** Default unix path on which connections to \e BrlAPI can be established */ +#define BRLAPI_SOCKETPATH "/run/brltty/BrlAPI" + +/** \e brltty 's settings directory + * + * This is where authorization key and driver-dependent key names are found + * for instance. */ +#define BRLAPI_ETCDIR "/etc" + +/** Default name of the file containing \e BrlAPI 's authorization key + * + * This name is relative to BRLAPI_ETCDIR */ +#define BRLAPI_AUTHKEYFILE "brlapi.key" + +/** Default authorization setting */ +#ifdef BRLAPI_WIN32 +/* No authentication by default on Windows */ +#define BRLAPI_DEFAUTH "none" +#else /* BRLAPI_WIN32 */ +#define BRLAPI_DEFAUTH_KEYFILE "keyfile:" BRLAPI_ETCDIR "/" BRLAPI_AUTHKEYFILE + +#ifdef USE_POLKIT +#define BRLAPI_DEFAUTH_POLKIT "+polkit" +#else /* USE_POLKIT */ +#define BRLAPI_DEFAUTH_POLKIT "" +#endif /* USE_POLKIT */ + +#define BRLAPI_DEFAUTH BRLAPI_DEFAUTH_KEYFILE BRLAPI_DEFAUTH_POLKIT +#endif /* BRLAPI_WIN32 */ + +#ifdef __MINGW32__ +typedef HANDLE brlapi_fileDescriptor; +#else /* __MINGW32__ */ +typedef int brlapi_fileDescriptor; +#endif /* __MINGW32__ */ + +/** \brief Settings structure for \e BrlAPI connection + * + * This structure holds every parameter needed to connect to \e BrlAPI: which + * file the authorization key can be found in and which computer to connect to. + * + * \par Examples: + * \code + * brlapi_connectionSettings_t settings; + * + * settings.auth="/etc/brlapi.key"; + * settings.host="foo"; + * \endcode + * + * \e libbrlapi will read authorization key from file \p /etc/brlapi.key + * and connect to the machine called "foo", on the default TCP port. + * + * \code + * settings.host="10.1.0.2"; + * \endcode + * + * lets directly enter an IP address instead of a machine name. + * + * \code + * settings.host=":1"; + * \endcode + * + * lets \e libbrlapi connect to the local computer, on port + * BRLAPI_SOCKETPORTNUM+1 + * + * \sa brlapi_openConnection() + */ +typedef struct { + /** For security reasons, \e libbrlapi has to get authorized to connect to the + * \e BrlAPI server. This can be done via a secret key, for instance. This is + * the path to the file which holds it; it will hence have to be readable by + * the application. + * + * Setting \c NULL defaults it to local installation setup or to the content + * of the BRLAPI_AUTH environment variable, if it exists. */ + const char* auth; + + /** This tells where the \e BrlAPI server resides: it might be listening on + * another computer, on any TCP port. It should look like "foo:1", which + * means TCP port number BRLAPI_SOCKETPORTNUM+1 on computer called "foo". + * \note Please check that resolving this name works before complaining + * + * Settings \c NULL defaults it to localhost, using the local installation's + * default TCP port, or to the content of the BRLAPI_HOST environment + * variable, if it exists. */ + const char* host; +} brlapi_connectionSettings_t; + +/* BRLAPI_SETTINGS_INITIALIZER */ +/** Allows to initialize a structure of type \e brlapi_connectionSettings_t * + * with default values. */ +#define BRLAPI_SETTINGS_INITIALIZER \ + { NULL, NULL } + +/* brlapi_openConnection */ +/** Open a socket and connect it to \e BrlAPI 's server + * + * This function first loads an authorization key as specified in settings. + * It then creates a TCP socket and connects it to the specified machine, on + * the specified port. It writes the authorization key on the socket and + * waits for acknowledgement. + * + * \return the file descriptor, or -1 on error + * + * \note The file descriptor is returned in case the client wants to + * communicate with the server without using \e libbrlapi functions. If it uses + * them however, it won't have to pass the file descriptor later, since the + * library keeps a copy of it. But that also means that + * brlapi_openConnection() may be called several times, but \e libbrlapi + * functions will always work with the last call's descriptor + * + * \par Example: + * \code + * if (brlapi_openConnection(&settings,&settings)<0) { + * fprintf(stderr,"couldn't connect to BrlAPI at %s: %s\n", + * settings.host, brlapi_strerror(&brlapi_error)); + * exit(1); + * } + * \endcode + * + * \par Errors: + * \e BrlAPI might not be on this TCP port, the host name might not be + * resolvable, the authorization may fail,... + * + * \param desiredSettings this gives the desired connection parameters, as + * described in brlapi_connectionSettings_t. If \c NULL, defaults values are + * used, so that it is generally a good idea to give \c NULL as default, and + * only fill a brlapi_connectionSettings_t structure when the user gave + * parameters to the program for instance; \param actualSettings if not \c NULL, + * parameters which were actually used are stored here, if the application ever + * needs them. + * + * \sa + * brlapi_connectionSettings_t + * brlapi_writePacket() + * brlapi_readPacketHeader() + * brlapi_readPacketContent() + * brlapi_readPacket() + */ +#ifndef BRLAPI_NO_SINGLE_SESSION +brlapi_fileDescriptor BRLAPI_STDCALL +brlapi_openConnection(const brlapi_connectionSettings_t* desiredSettings, + brlapi_connectionSettings_t* actualSettings); +#endif /* BRLAPI_NO_SINGLE_SESSION */ +brlapi_fileDescriptor BRLAPI_STDCALL +brlapi__openConnection(brlapi_handle_t* handle, + const brlapi_connectionSettings_t* desiredSettings, + brlapi_connectionSettings_t* actualSettings); + +/* brlapi_closeConnection */ +/** Cleanly close the socket + * + * This function locks until a closing acknowledgement is received from the + * server. The socket is then freed, so the file descriptor + * brlapi_openConnection() gave has no meaning any more + */ +#ifndef BRLAPI_NO_SINGLE_SESSION +void BRLAPI_STDCALL brlapi_closeConnection(void); +#endif /* BRLAPI_NO_SINGLE_SESSION */ +void BRLAPI_STDCALL brlapi__closeConnection(brlapi_handle_t* handle); + +/** @} */ + +/** \defgroup brlapi_clientData Setting and getting client data + * + * Clients can register a pointer to data that can then be used + * e.g. in exception handlers. + * @{ */ + +/* brlapi__setClientData */ +/** Register a pointer to client data + * + * \param data The pointer to the private client data + */ +#ifndef BRLAPI_NO_SINGLE_SESSION +void BRLAPI_STDCALL brlapi_setClientData(void* data); +#endif /* BRLAPI_NO_SINGLE_SESSION */ +void BRLAPI_STDCALL brlapi__setClientData(brlapi_handle_t* handle, void* data); + +/* brlapi__getClientData */ +/** Retrieves the pointer to the private client data + * + * \return the pointer to the private client data + */ +#ifndef BRLAPI_NO_SINGLE_SESSION +void* BRLAPI_STDCALL brlapi_getClientData(void); +#endif /* BRLAPI_NO_SINGLE_SESSION */ +void* BRLAPI_STDCALL brlapi__getClientData(brlapi_handle_t* handle); + +/** @} */ + +/** \defgroup brlapi_info Getting Terminal information + * \brief How to get information about the connected Terminal + * + * Before using Raw mode or key codes, the application should always check the + * type of the connected terminal, to be sure it is really the one it expects. + * + * One should also check for display size, so as to adjust further displaying + * on it. + * @{ + */ + +/** Maximum name length for names embeded in BrlAPI packets, not counting any + * termination \\0 character */ +#define BRLAPI_MAXNAMELENGTH 31 + +/* brlapi_getDriverName */ +/** Return the complete name of the driver used by \e brltty + * + * This function fills its argument with the whole name of the braille + * driver if available, terminated with a '\\0'. + * + * \param buffer is the buffer provided by the application; + * \param size is the maximum size for the name buffer. + * + * \return -1 on error, otherwise a positive value giving the size of the needed + * buffer (including '\\0'). If that value is bigger than \p size, the value was + * truncated and the caller should retry with a bigger buffer accordingly. + */ +#ifndef BRLAPI_NO_SINGLE_SESSION +int BRLAPI_STDCALL brlapi_getDriverName(char* buffer, size_t size); +#endif /* BRLAPI_NO_SINGLE_SESSION */ +int BRLAPI_STDCALL brlapi__getDriverName(brlapi_handle_t* handle, + char* buffer, + size_t size); + +/* brlapi_getModelIdentifier */ +/** Return an identifier for the device model used by \e brltty + * + * This function fills its argument with the whole identifier of the braille + * device model if available, terminated with a '\\0'. + * + * \param buffer is the buffer given by the application; + * \param size is the maximum size for the identifier buffer. + * + * \return -1 on error, otherwise a positive value giving the size of the needed + * buffer (including '\\0'). If that value is bigger than \p size, the value was + * truncated and the caller should retry with a bigger buffer accordingly. + */ +#ifndef BRLAPI_NO_SINGLE_SESSION +int BRLAPI_STDCALL brlapi_getModelIdentifier(char* buffer, size_t size); +#endif /* BRLAPI_NO_SINGLE_SESSION */ +int BRLAPI_STDCALL brlapi__getModelIdentifier(brlapi_handle_t* handle, + char* buffer, + size_t size); + +/* brlapi_getDisplaySize */ +/** Return the size of the braille display */ +#ifndef BRLAPI_NO_SINGLE_SESSION +int BRLAPI_STDCALL brlapi_getDisplaySize(unsigned int* x, unsigned int* y); +#endif /* BRLAPI_NO_SINGLE_SESSION */ +int BRLAPI_STDCALL brlapi__getDisplaySize(brlapi_handle_t* handle, + unsigned int* x, + unsigned int* y); + +/** @} */ + +/** \defgroup brlapi_tty Entering & leaving tty mode + * \brief How to take control of ttys for direct braille display / read + * + * Before being able to write on the braille display, the application must tell + * the server which tty it will handle. + * + * The application must also specify how braille keys will be delivered to it. + * Two ways are possible: key codes and commands: + * + * - key codes are specific to each braille driver, since the raw key code, as + * defined in the driver will be given for each key press. + * Using them leads to building highly driver-dependent applications, which + * can yet sometimes be useful to mimic existing proprietary applications + * for instance. + * - commands means that applications will get exactly the same values as + * \e brltty. This allows driver-independent clients, which will hopefully + * be nice to use with a lot of different terminals. + * \sa brlapi_readKey() + * @{ + */ + +/* brlapi_enterTtyMode */ +/** Ask for some tty, with some key mechanism + * + * \param tty + * - If tty>=0 then take control of the specified tty. + * - If tty==::BRLAPI_TTY_DEFAULT then take control of the default tty. + * + * \param driver tells how the application wants brlapi_readKey() to return + * key presses. NULL or "" means BRLTTY commands are required, + * whereas a driver name means that raw key codes returned by this + * driver are expected. + * + * WINDOWPATH and WINDOWID should be propagated when running remote applications + * via ssh, for instance, along with BRLAPI_HOST and the authorization key (see + * SendEnv in ssh_config(5) and AcceptEnv in sshd_config(5)) + * + * \return the used tty number on success, -1 on error + * + * \sa brlapi_leaveTtyMode() brlapi_readKey() + */ +#ifndef BRLAPI_NO_SINGLE_SESSION +int BRLAPI_STDCALL brlapi_enterTtyMode(int tty, const char* driver); +#endif /* BRLAPI_NO_SINGLE_SESSION */ +int BRLAPI_STDCALL brlapi__enterTtyMode(brlapi_handle_t* handle, + int tty, + const char* driver); + +/** Select the default tty. + * + * The library takes the following steps: + * -# Try to get the tty number from the \c WINDOWID environment variable (for + * the \c xterm case). + * -# Try to get the tty number from the \c CONTROLVT environment variable. + * -# Read \c /proc/self/stat (on \c Linux). + * + * \sa brlapi_enterTtyMode() + */ +#define BRLAPI_TTY_DEFAULT -1 + +/* brlapi_enterTtyModeWithPath */ +/** Ask for some tty specified by its path in the tty tree, with some key + * mechanism + * + * \param ttys points on the array of ttys representing the tty path to be got. + * Can be NULL if nttys is 0. + * \param count gives the number of elements in ttys. + * \param driver has the same meaning as in brlapi_enterTtyMode() + * + * Providing nttys == 0 means to get the root. + * + * \sa brlapi_enterTtyMode() + */ +#ifndef BRLAPI_NO_SINGLE_SESSION +int BRLAPI_STDCALL brlapi_enterTtyModeWithPath(int* ttys, + int count, + const char* driver); +#endif /* BRLAPI_NO_SINGLE_SESSION */ +int BRLAPI_STDCALL brlapi__enterTtyModeWithPath(brlapi_handle_t* handle, + int* ttys, + int count, + const char* driver); + +/* brlapi_leaveTtyMode */ +/** Stop controlling the tty + * + * \return 0 on success, -1 on error. + * + * \sa brlapi_enterTtyMode() + */ +#ifndef BRLAPI_NO_SINGLE_SESSION +int BRLAPI_STDCALL brlapi_leaveTtyMode(void); +#endif /* BRLAPI_NO_SINGLE_SESSION */ +int BRLAPI_STDCALL brlapi__leaveTtyMode(brlapi_handle_t* handle); + +/* brlapi_setFocus */ +/** Tell the current tty to brltty + * + * This is intended for focus tellers, such as brltty, xbrlapi, screen, ... + * brlapi_enterTtyMode() must have been called beforehand to tell where this + * focus applies in the tty tree. + * + * \return 0 on success, -1 on error. + * + * \sa brlapi_enterTtyMode() brlapi_leaveTtyMode() + */ +#ifndef BRLAPI_NO_SINGLE_SESSION +int BRLAPI_STDCALL brlapi_setFocus(int tty); +#endif /* BRLAPI_NO_SINGLE_SESSION */ +int BRLAPI_STDCALL brlapi__setFocus(brlapi_handle_t* handle, int tty); + +/** @} */ + +/** \defgroup brlapi_write Writing on the braille display + * \brief Write text to the braille display + * + * After brlapi_enterTtyMode() has been called, the application can + * call one of these functions to write things on the braille display. + * + * \note Be sure to call brlapi_enterTtyMode() \e before calling brlapi_write(), + * or else you'll get an error. This is particularly not always trivial when + * writing multithreaded applications. + * + * \note Dots are coded as described in ISO/TR 11548-1: a dot pattern is coded + * by a byte in which bit 0 is set iff dot 1 is up, bit 1 is set iff dot 2 is + * up, ... bit 7 is set iff dot 8 is up. This also corresponds to the low-order + * byte of the coding of unicode's braille row U+2800. + * + * \note Text is translated by the server one to one, by just using a simple + * wchar_t to pattern table, i.e. no contraction/expansion is performed, because + * the client would then have no way to know how wide the output would be and + * thus the quantity of text to feed. If contraction/expansion is desired, the + * client should perform it itself (e.g. thanks to liblouis or gnome-braille) + * and send the resulting dot patterns. This is actually exactly the same + * problem as font rendering on a graphical display: for better control, + * nowadays all font rasterization is performed on the client side, and mere + * pixmaps are sent to the X server. + * + * @{ */ + +/* brlapi_writeText */ +/** Write the given \\0-terminated string to the braille display + * + * If the string is too long, it is truncated. If it's too short, + * it is padded with spaces. The text is assumed to be in the current + * locale charset set by setlocale(3) if it was called, or the locale charset + * from the locale environment variables if setlocale(3) was not called. + * + * \param cursor gives the cursor position; if equal to ::BRLAPI_CURSOR_OFF, no + * cursor is shown at all; if cursor==::BRLAPI_CURSOR_LEAVE, the cursor is left + * where it is + * + * \param text points to the string to be displayed. + * + * \return 0 on success, -1 on error. + */ +#ifndef BRLAPI_NO_SINGLE_SESSION +int BRLAPI_STDCALL brlapi_writeText(int cursor, const char* text); +#endif /* BRLAPI_NO_SINGLE_SESSION */ +int BRLAPI_STDCALL brlapi__writeText(brlapi_handle_t* handle, + int cursor, + const char* text); + +/* brlapi_writeWText */ +/** Write the given \\0-terminated unicode string to the braille display + * + * If the string is too long, it is truncated. If it's too short, + * it is padded with spaces. + * + * \param cursor gives the cursor position; if equal to ::BRLAPI_CURSOR_OFF, no + * cursor is shown at all; if cursor==::BRLAPI_CURSOR_LEAVE, the cursor is left + * where it is + * + * \param text points to the string to be displayed. + * + * \return 0 on success, -1 on error. + */ +#ifndef BRLAPI_NO_SINGLE_SESSION +int BRLAPI_STDCALL brlapi_writeWText(int cursor, const wchar_t* text); +#endif /* BRLAPI_NO_SINGLE_SESSION */ +int BRLAPI_STDCALL brlapi__writeWText(brlapi_handle_t* handle, + int cursor, + const wchar_t* text); + +/* brlapi_writeDots */ +/** Write the given dots array to the display + * + * \param dots points on an array of dot information, one per character. Its + * size must hence be the same as what brlapi_getDisplaySize() returns. + * + * \return 0 on success, -1 on error. + */ +#ifndef BRLAPI_NO_SINGLE_SESSION +int BRLAPI_STDCALL brlapi_writeDots(const unsigned char* dots); +#endif /* BRLAPI_NO_SINGLE_SESSION */ +int BRLAPI_STDCALL brlapi__writeDots(brlapi_handle_t* handle, + const unsigned char* dots); + +/* brlapi_writeArguments_t */ +/** Structure containing arguments to be given to brlapi_write() */ +typedef struct { + int displayNumber /** Display number ::BRLAPI_DISPLAY_DEFAULT == unspecified + */ + ; + unsigned int regionBegin /** Region of display to update, 1st character of + display is 1 */ + ; + unsigned int + regionSize /** Number of characters held in text, andMask and orMask. */; + char* text /** Text to display, must hold as many characters as the region + fields expresses. */ + ; + int textSize /** Size of text in bytes. If -1, strlen() is used for computing + it. */ + ; + unsigned char* andMask /** And attributes; applied first */; + unsigned char* orMask /** Or attributes; applied \e after ANDing */; + int cursor /** ::BRLAPI_CURSOR_LEAVE == don't touch, ::BRLAPI_CURSOR_OFF == + turn off, 1 = 1st char of display, ... */ + ; + char* charset /** Text charset. NULL means it is assumed to be 8bits, and the + same as the server's. "" means current locale's charset. If + no locale was selected, defaults to NULL's meaning. */ + ; +} brlapi_writeArguments_t; + +/** Write to the default display on the braille device. + * + * \sa brlapi_write() brlapi_writeArguments_t + */ +#define BRLAPI_DISPLAY_DEFAULT -1 + +/** Do not change the cursor's state or position. + * + * \sa brlapi_writeText() brlapi_write() brlapi_writeArguments_t + */ +#define BRLAPI_CURSOR_LEAVE -1 + +/** Do not display the cursor. + * + * \sa brlapi_writeText() brlapi_write() brlapi_writeArguments_t + */ +#define BRLAPI_CURSOR_OFF 0 + +/* BRLAPI_WRITEARGUMENTS_INITIALIZER */ +/** Allows to initialize a structure of type \e brlapi_writeArguments_t * + * with default values: + * displayNumber = ::BRLAPI_DISPLAY_DEFAULT; (unspecified) + * regionBegin = regionSize = 0; (update the whole display, DEPRECATED and will + * be forbidden in next release. You must always express the region you wish to + * update) + * text = andMask = orMask = NULL; (no text, no attribute) + * cursor = ::BRLAPI_CURSOR_LEAVE; (don't touch cursor) + */ +#define BRLAPI_WRITEARGUMENTS_INITIALIZER \ + { \ + .displayNumber = BRLAPI_DISPLAY_DEFAULT, .regionBegin = 0, \ + .regionSize = 0, .text = NULL, .textSize = -1, .andMask = NULL, \ + .orMask = NULL, .cursor = BRLAPI_CURSOR_LEAVE, .charset = NULL \ + } + +/* brlapi_write */ +/** Update a specific region of the braille display and apply and/or masks + * + * \param arguments gives information necessary for the update + * + * regionBegin and regionSize must be filled for specifying which part of the + * display will be updated, as well as the size (in characters, not bytes) of + * the text, andMask and orMask members. + * + * If given, the "text" field holds the text that will be displayed in the + * region. The char string must hold exactly as many characters as the region + * fields express. For multibyte text, this is the number of \e multibyte + * caracters. Notably, combining and double-width caracters count for 1. + * + * The actual length of the text in \e bytes may be specified thanks to + * textSize. If -1 is given, it will be computed thanks to strlen(), so "text" + * must then be a NUL-terminated string. + * + * The "andMask" and "orMask" masks, if present, are then applied on top of + * the text, one byte per character. This hence permits the superimposing of + * attributes over the text. For instance, setting an andMask mask full of + * BRLAPI_DOTS(1,1,1,1,1,1,0,0) will only keep (logical AND) dots 1-6, + * hence dropping dots 7 and 8. On the contrary, setting an orMask full of + * BRLAPI_DOT7|BRLAPI_DOT8 will add (logical OR) dots 7 and 8. + * + * The "charset" field, if present, specifies the charset of the "text" field. + * If it is "", the current locale's charset (if any) is assumed. Else, the + * 8-bit charset of the server is assumed. + * + * A special invocation is with an unmodified initialized structure: this clears + * the client's whole display, letting the display of other applications on + * the same tty or of applications "under" the tty appear. See Concurrency + * management section of the BrlAPI documentation for more details. + * + * \return 0 on success, -1 on error. + */ +#ifndef BRLAPI_NO_SINGLE_SESSION +int BRLAPI_STDCALL brlapi_write(const brlapi_writeArguments_t* arguments); +#endif /* BRLAPI_NO_SINGLE_SESSION */ +int BRLAPI_STDCALL brlapi__write(brlapi_handle_t* handle, + const brlapi_writeArguments_t* arguments); + +/** @} */ + +#include "brlapi_keycodes.h" + +/** \defgroup brlapi_keys Reading key presses + * \brief How to read key presses from the braille terminal + * + * Once brlapi_enterTtyMode() has been called, the application can call + * brlapi_readKey() to read key presses. Either key codes (see \ref + * brlapi_keycodes) or commands will be returned, depending on parameters given + * to brlapi_enterTtyMode(). + * + * Key presses are buffered, so that calling brlapi_readKey() in non-blocking + * mode from time to time should suffice. + * + * @{ + */ + +/* brlapi_expandedKeyCode_t */ +/** Structure holding the components of a key code as returned by + * brlapi_expandKeyCode() */ +typedef struct { + unsigned int type /** the type value */; + unsigned int command /** the command value */; + unsigned int argument /** the argument value */; + unsigned int flags /** the flags value */; +} brlapi_expandedKeyCode_t; + +/* brlapi_expandKeyCode */ +/** Expand the components of a key code + * + * \param code the key code to be expanded + * \param expansion pointer to the structure that receives the components + * + * \return 0 on success, -1 on error + */ +int BRLAPI_STDCALL brlapi_expandKeyCode(brlapi_keyCode_t code, + brlapi_expandedKeyCode_t* expansion); + +/* brlapi_describedKeyCode_t */ +/** Structure holding the components of a key code as returned by + * brlapi_describeKeyCode() */ +typedef struct { + const char* type /** the type name */; + const char* command /** the command name */; + unsigned int argument /** the argument value */; + unsigned int flags /** the flag count */; + const char* flag[64 - BRLAPI_KEY_FLAGS_SHIFT] /** the flag names */; + brlapi_expandedKeyCode_t values /** the actual values of the components */; +} brlapi_describedKeyCode_t; + +/* brlapi_describeKeyCode */ +/** Describe the components of a key code. + * + * \param code the keycode to be described + * \param description pointer to the structure that receives the description + * + * \return 0 on success, -1 on error + */ +int BRLAPI_STDCALL +brlapi_describeKeyCode(brlapi_keyCode_t code, + brlapi_describedKeyCode_t* description); + +/** Unicode braille row */ +#define BRLAPI_UC_ROW 0x2800UL + +/* brlapi_readKey */ +/** Read a key from the braille keyboard + * + * This function returns one key press's code. + * + * If NULL or "" was given to brlapi_enterTtyMode(), a \e brltty command is + * returned, as described in the documentation for ::brlapi_keyCode_t . It is + * hence pretty driver-independent, and should be used by default when no other + * option is possible. + * + * By default, all commands but those which restart drivers and switch + * virtual terminals are returned to the application and not to brltty. + * If the application doesn't want to see some command events, + * it should call brlapi_ignoreKeys() + * + * If some driver name was given to brlapi_enterTtyMode(), a raw keycode is + * returned, as specified by the terminal driver, usually in <brltty/brldefs-xy> + * where xy is the driver's code. It generally corresponds to the very code that + * the terminal tells to the driver. This should only be used by applications + * which are dedicated to a particular braille terminal. Hence, checking the + * terminal type thanks to a call to brlapi_getDriverName() before getting tty + * control is a pretty good idea. + * + * By default, all the keypresses will be passed to the client, none will go + * through brltty, so the application will have to handle console switching + * itself for instance. + * + * \param wait tells whether the call should block until a key is pressed (1) + * or should only probe key presses (0); + * \param code holds the key code if a key press is indeed read. + * + * \return -1 on error or signal interrupt and *code is then undefined, 0 if + * block was 0 and no key was pressed so far, or 1 and *code holds the key code. + * + * Programming hints: + * + * If your application is only driven by braille command keypresses, you can + * just call brlapi_readKey(1, &code) so that it keeps blocking, waiting for + * keypresses. + * + * Else, you'll probably want to use the file descriptor returned by + * brlapi_openConnection() in your "big polling loop". For instance: + * + * - in a \c select() loop, just add it to the \c readfds and \c exceptfds file + * descriptor sets; + * - in a gtk or atspi application, use + * \c g_io_add_watch(fileDescriptor, \c G_IO_IN|G_IO_ERR|G_IO_HUP, \c f, \c + * data) for adding a callback called \c f; + * - in an Xt/Xaw/motif-based application, use + * \c XtAppAddInput(app_context, \c fileDescriptor, \c + * XtInputReadMask|XtInputExceptMask, \c f, \c data) + * - etc. + * + * and then, when you detect inbound trafic on the file descriptor, do something + * like this: + * + * while (brlapi_readKey(0, &code) { + * // process keycode code + * // ... + * } + * + * The \c while loop is needed for processing \e all pending key presses, else + * some of them may be left in libbrlapi's internal key buffer and you wouldn't + * get them immediately. + * + * \note If the read is interrupted by a signal, brlapi_readKey() will return + * -1, brlapi_errno will be BRLAPI_ERROR_LIBCERR and errno will be EINTR. + */ +#ifndef BRLAPI_NO_SINGLE_SESSION +int BRLAPI_STDCALL brlapi_readKey(int wait, brlapi_keyCode_t* code); +#endif /* BRLAPI_NO_SINGLE_SESSION */ +int BRLAPI_STDCALL brlapi__readKey(brlapi_handle_t* handle, + int wait, + brlapi_keyCode_t* code); + +/* brlapi_readKeyWithTimeout */ +/** Read a key from the braille keyboard, unless a timeout expires + * + * This function works like brlapi_readKey, except that parameter \e wait is + * replaced by a \e timeout_ms parameter + * + * \param timeout_ms specifies how long the function should wait for a keypress. + * \param code holds the key code if a key press is indeed read. + * + * \return -1 on error or signal interrupt and *code is then undefined, 0 if + * the timeout expired and no key was pressed, or 1 and *code holds the key + * code. + * + * If the timeout expires without any key being pressed, 0 is returned. + * + * If timeout_ms is set to 0, this function looks for key events that have been + * already received, but does not wait at all if no event was received. + * + * If timeout_ms is set to a negative value, this function behaves like + * brlapi_readKey, i.e. it uses an infinite timeout. + */ +#ifndef BRLAPI_NO_SINGLE_SESSION +int BRLAPI_STDCALL brlapi_readKeyWithTimeout(int timeout_ms, + brlapi_keyCode_t* code); +#endif /* BRLAPI_NO_SINGLE_SESSION */ +int BRLAPI_STDCALL brlapi__readKeyWithTimeout(brlapi_handle_t* handle, + int timeout_ms, + brlapi_keyCode_t* code); + +/** types of key ranges */ +typedef enum { + brlapi_rangeType_all, /**< all keys, code must be 0 */ + brlapi_rangeType_type, /**< all keys of a given type */ + brlapi_rangeType_command, /**< all keys of a given command block, i.e. + matching the key type and command parts */ + brlapi_rangeType_key, /**< a given key with any flags */ + brlapi_rangeType_code, /**< a given key code */ +} brlapi_rangeType_t; + +/* brlapi_ignoreKeys */ +/** Ignore some key presses from the braille keyboard + * + * This function asks the server to give the provided keys to \e brltty, rather + * than returning them to the application via brlapi_readKey(). + * + * \param type type of keys to be ignored + * \param keys array of keys to be ignored + * \param count number of keys + * + * \note The given codes should be \e brltty commands (NULL or "" was given to + * brlapi_enterTtyMode()) + */ +#ifndef BRLAPI_NO_SINGLE_SESSION +int BRLAPI_STDCALL brlapi_ignoreKeys(brlapi_rangeType_t type, + const brlapi_keyCode_t keys[], + unsigned int count); +#endif /* BRLAPI_NO_SINGLE_SESSION */ +int BRLAPI_STDCALL brlapi__ignoreKeys(brlapi_handle_t* handle, + brlapi_rangeType_t type, + const brlapi_keyCode_t keys[], + unsigned int count); + +/* brlapi_acceptKeys */ +/** Accept some key presses from the braille keyboard + * + * This function asks the server to give the provided keys to the application, + * and not give them to \e brltty. + * + * \param type type of keys to be ignored + * \param keys array of keys to be ignored + * \param count number of keys + * + * \note The given codes should be \e brltty commands (NULL or "" was given to + * brlapi_enterTtyMode()) + */ +#ifndef BRLAPI_NO_SINGLE_SESSION +int BRLAPI_STDCALL brlapi_acceptKeys(brlapi_rangeType_t type, + const brlapi_keyCode_t keys[], + unsigned int count); +#endif /* BRLAPI_NO_SINGLE_SESSION */ +int BRLAPI_STDCALL brlapi__acceptKeys(brlapi_handle_t* handle, + brlapi_rangeType_t type, + const brlapi_keyCode_t keys[], + unsigned int count); + +/* brlapi_ignoreAllKeys */ +/** Ignore all key presses from the braille keyboard + * + * This function asks the server to give all keys to \e brltty, rather than + * returning them to the application via brlapi_readKey(). + */ +#ifndef BRLAPI_NO_SINGLE_SESSION +int BRLAPI_STDCALL brlapi_ignoreAllKeys(void); +#define brlapi_ignoreAllKeys() brlapi_ignoreKeys(brlapi_rangeType_all, NULL, 0) +#endif /* BRLAPI_NO_SINGLE_SESSION */ +int BRLAPI_STDCALL brlapi__ignoreAllKeys(brlapi_handle_t* handle); +#define brlapi__ignoreAllKeys(handle) \ + brlapi__ignoreKeys(handle, brlapi_rangeType_all, NULL, 0) + +/* brlapi_acceptAllKeys */ +/** Accept all key presses from the braille keyboard + * + * This function asks the server to give all keys to the application, and not + * give them to \e brltty. + * + * Warning: after calling this function, make sure to call brlapi_ignoreKeys() + * for ignoring important keys like BRL_CMD_SWITCHVT_PREV/NEXT and such. + */ +#ifndef BRLAPI_NO_SINGLE_SESSION +int BRLAPI_STDCALL brlapi_acceptAllKeys(void); +#define brlapi_acceptAllKeys() brlapi_acceptKeys(brlapi_rangeType_all, NULL, 0) +#endif /* BRLAPI_NO_SINGLE_SESSION */ +int BRLAPI_STDCALL brlapi__acceptAllKeys(brlapi_handle_t* handle); +#define brlapi__acceptAllKeys(handle) \ + brlapi__acceptKeys(handle, brlapi_rangeType_all, NULL, 0) + +/** Type for raw keycode ranges + * + * Denotes the set of keycodes between \e first and \e last (inclusive) + */ +typedef struct { + brlapi_keyCode_t first; /**< first key of the range */ + brlapi_keyCode_t last; /**< last key of the range */ +} brlapi_range_t; + +/* brlapi_ignoreKeyRanges */ +/** Ignore some key presses from the braille keyboard + * + * This function asks the server to give the provided key ranges to \e brltty, + * rather than returning them to the application via brlapi_readKey(). + * + * \param ranges key ranges, which are inclusive + * \param count number of ranges + * + * \note The given codes should be raw keycodes (i.e. some driver name was given + * to brlapi_enterTtyMode()) */ +#ifndef BRLAPI_NO_SINGLE_SESSION +int BRLAPI_STDCALL brlapi_ignoreKeyRanges(const brlapi_range_t ranges[], + unsigned int count); +#endif /* BRLAPI_NO_SINGLE_SESSION */ +int BRLAPI_STDCALL brlapi__ignoreKeyRanges(brlapi_handle_t* handle, + const brlapi_range_t ranges[], + unsigned int count); + +/* brlapi_acceptKeyRanges */ +/** Accept some key presses from the braille keyboard + * + * This function asks the server to return the provided key ranges (inclusive) + * to the application, and not give them to \e brltty. + * + * \param ranges key ranges, which are inclusive + * \param count number of ranges + * + * \note The given codes should be raw keycodes (i.e. some driver name was given + * to brlapi_enterTtyMode()) */ +#ifndef BRLAPI_NO_SINGLE_SESSION +int BRLAPI_STDCALL brlapi_acceptKeyRanges(const brlapi_range_t ranges[], + unsigned int count); +#endif /* BRLAPI_NO_SINGLE_SESSION */ +int BRLAPI_STDCALL brlapi__acceptKeyRanges(brlapi_handle_t* handle, + const brlapi_range_t ranges[], + unsigned int count); +/** @} */ + +/** \defgroup brlapi_driverspecific Driver-Specific modes + * \brief Raw and Suspend Modes mechanism + * + * If the application wants to directly talk to the braille terminal, it should + * use Raw Mode. In this special mode, the driver gives the whole control of the + * terminal to it: \e brltty doesn't work any more. + * + * For this, it simply has to call brlapi_enterRawMode(), then brlapi_sendRaw() + * and brlapi_recvRaw(), and finally give control back thanks to + * brlapi_leaveRawMode(). + * + * Special care of the terminal should be taken, since one might completely + * trash the terminal's data, or even lock it! The application should always + * check for terminal's type thanks to brlapi_getDriverName(). + * + * The client can also make brltty close the driver by using + * brlapi_suspendDriver(), and resume it again with brlapi_resumeDriver(). This + * should not be used if possible: raw mode should be sufficient for any use. If + * not, please ask for features :) + * + * @{ + */ + +/* brlapi_enterRawMode */ +/** Switch to Raw mode + * \param driver Specifies the name of the driver for which the raw + * communication will be established. + * \return 0 on success, -1 on error */ +#ifndef BRLAPI_NO_SINGLE_SESSION +int BRLAPI_STDCALL brlapi_enterRawMode(const char* driver); +#endif /* BRLAPI_NO_SINGLE_SESSION */ +int BRLAPI_STDCALL brlapi__enterRawMode(brlapi_handle_t* handle, + const char* driver); + +/* brlapi_leaveRawMode */ +/** Leave Raw mode + * \return 0 on success, -1 on error */ +#ifndef BRLAPI_NO_SINGLE_SESSION +int BRLAPI_STDCALL brlapi_leaveRawMode(void); +#endif /* BRLAPI_NO_SINGLE_SESSION */ +int BRLAPI_STDCALL brlapi__leaveRawMode(brlapi_handle_t* handle); + +/* brlapi_sendRaw */ +/** Send Raw data + * + * \param buffer points on the data; + * \param size holds the packet size. + * \return size on success, -1 on error */ +#ifndef BRLAPI_NO_SINGLE_SESSION +ssize_t BRLAPI_STDCALL brlapi_sendRaw(const void* buffer, size_t size); +#endif /* BRLAPI_NO_SINGLE_SESSION */ +ssize_t BRLAPI_STDCALL brlapi__sendRaw(brlapi_handle_t* handle, + const void* buffer, + size_t size); + +/* brlapi_recvRaw */ +/** Get Raw data + * + * \param buffer points on a buffer where the function will store the received + * data; + * \param size holds the buffer size. + * \return its size, -1 on error or signal interruption */ +#ifndef BRLAPI_NO_SINGLE_SESSION +ssize_t BRLAPI_STDCALL brlapi_recvRaw(void* buffer, size_t size); +#endif /* BRLAPI_NO_SINGLE_SESSION */ +ssize_t BRLAPI_STDCALL brlapi__recvRaw(brlapi_handle_t* handle, + void* buffer, + size_t size); + +/* brlapi_suspendDriver */ +/** Suspend braille driver + * \param driver Specifies the name of the driver which will be suspended. + * \return -1 on error + */ +#ifndef BRLAPI_NO_SINGLE_SESSION +int BRLAPI_STDCALL brlapi_suspendDriver(const char* driver); +#endif /* BRLAPI_NO_SINGLE_SESSION */ +int BRLAPI_STDCALL brlapi__suspendDriver(brlapi_handle_t* handle, + const char* driver); + +/* brlapi_resumeDriver */ +/** Resume braille driver + * \return -1 on error + */ +#ifndef BRLAPI_NO_SINGLE_SESSION +int BRLAPI_STDCALL brlapi_resumeDriver(void); +#endif /* BRLAPI_NO_SINGLE_SESSION */ +int BRLAPI_STDCALL brlapi__resumeDriver(brlapi_handle_t* handle); +/** @} */ + +#include "brlapi_param.h" + +/** \defgroup brlapi_parameterManagement Parameter management + * \brief How to manage BrlAPI parameters + * + * There are several kinds of parameters: + * - states associated with the braille device itself, such as its size or + * parameters of the device port + * - states of the BrlAPI connection itself, such as the displaying level or + * key passing preferences. + * - general states such as the cut buffer, + * - braille parameters: braille table, contraction, cursor shape, etc, + * - browse parameters: line skip, beep, etc. + * + * Some of them are subdivided in subparameters. Others have only subparameter + * 0. + * + * Some of them are read-only, others are read/write. + * + * A client can either request the immediate content of a parameter by + * using brlapi_getParameter(); set the content of a parameter by using + * brlapi_setParameter(); or register a callback that may be called immediately + * and on each change of a given parameter, by using brlapi_watchParameter(). + * + * @{ */ + +/** Flags for parameter requests */ +typedef uint32_t brlapi_param_flags_t; +#define BRLAPI_PARAMF_LOCAL \ + 0X00 /**< Refer to the value local to the connection instead of the global \ + value */ +#define BRLAPI_PARAMF_GLOBAL \ + 0X01 /**< Refer to the global value instead of the value local to the \ + connection */ +#define BRLAPI_PARAMF_SELF \ + 0X02 /**< Specify whether to receive notifications of value self-changes */ + +/* brlapi_getParameter */ +/** Get the content of a parameter + * + * brlapi_getParameter gets the current content of a parameter + * + * \param parameter is the parameter whose content shall be gotten; + * \param subparam is a specific instance of the parameter; + * \param flags specify which value and how it should be returned; + * \param data is a buffer where content of the parameter shall be stored; + * \param len is the size of the buffer. + * + * \return the real size of the parameter's content. If the parameter does not + * fit in the provided buffer, it is truncated to len bytes (but the real size + * of the parameter is still returned). In that case, the client must call + * brlapi_getParameter again with a big enough buffer. + */ +#ifndef BRLAPI_NO_SINGLE_SESSION +ssize_t BRLAPI_STDCALL brlapi_getParameter(brlapi_param_t parameter, + brlapi_param_subparam_t subparam, + brlapi_param_flags_t flags, + void* data, + size_t len); +#endif +ssize_t BRLAPI_STDCALL brlapi__getParameter(brlapi_handle_t* handle, + brlapi_param_t parameter, + brlapi_param_subparam_t subparam, + brlapi_param_flags_t flags, + void* data, + size_t len); + +/* brlapi_getParameterAlloc */ +/** Return the content of a parameter + * + * brlapi_getParameterAlloc gets the current content of a parameter, by + * returning it as a newly-allocated buffer. The buffer is allocated to one byte + * more than the parameter value. This byte is set to zero. This allows, for + * string parameters, to be able to immediately use it as a C string. + * + * \param parameter is the parameter whose content shall be gotten; + * \param subparam is a specific instance of the parameter; + * \param flags specify which value and how it should be returned; + * \param len is the address where to store the size of the parameter value. + * + * \return a newly-allocated buffer that contains the value of the parameter. + * The caller must call free() on it after use. NULL is returned on errors + */ +#ifndef BRLAPI_NO_SINGLE_SESSION +void* BRLAPI_STDCALL brlapi_getParameterAlloc(brlapi_param_t parameter, + brlapi_param_subparam_t subparam, + brlapi_param_flags_t flags, + size_t* len); +#endif +void* BRLAPI_STDCALL brlapi__getParameterAlloc(brlapi_handle_t* handle, + brlapi_param_t parameter, + brlapi_param_subparam_t subparam, + brlapi_param_flags_t flags, + size_t* len); + +/* brlapi_setParameter */ +/** Set the content of a parameter + * + * brlapi_setParameter sets the content of a parameter + * + * \param parameter is the parameter to set; + * \param subparam is a specific instance of the parameter; + * \param flags specify which value and how it should be set; + * \param data is a buffer containing the data to store in the parameter; + * \param len is the size of the data. + * + * \return 0 on success, -1 on error (read-only parameter for instance). + */ +#ifndef BRLAPI_NO_SINGLE_SESSION +int BRLAPI_STDCALL brlapi_setParameter(brlapi_param_t parameter, + brlapi_param_subparam_t subparam, + brlapi_param_flags_t flags, + const void* data, + size_t len); +#endif +int BRLAPI_STDCALL brlapi__setParameter(brlapi_handle_t* handle, + brlapi_param_t parameter, + brlapi_param_subparam_t subparam, + brlapi_param_flags_t flags, + const void* data, + size_t len); + +/* brlapi_paramCallback_t */ +/** Callback for parameter changes + * + * When a parameter gets changed, application-defined callbacks set by the + * brlapi_watchParameter() function are called. + * + * \param parameter is the parameter that changed; + * \param flags specify which value and how it was changed; + * \param priv is the void pointer that was passed to the brlapi_watchParameter + * call which registered the callback; \param data is a buffer containing the + * new value of the parameter; \param len is the size of the data. + * + * This callback only gets called when the application calls some brlapi_ + * function (i.e. BrlAPI gets direct control of the execution). + */ +typedef void (*brlapi_paramCallback_t)(brlapi_param_t parameter, + brlapi_param_subparam_t subparam, + brlapi_param_flags_t flags, + void* priv, + const void* data, + size_t len); + +/* brlapi_paramCallbackDescriptor_t */ +/** Type for callback descriptors + * This is returned by brlapi_watchParameter, to be passed to + * brlapi_unwatchParameter. + */ +typedef void* brlapi_paramCallbackDescriptor_t; + +/* brlapi_watchParameter */ +/** Set a parameter change callback + * + * brlapi_watchParameter registers a parameter change callback: whenever the + * given parameter changes, the given function is called. + * + * \param parameter is the parameter to watch; + * \param subparam is a specific instance of the parameter; + * \param flags specify which value and how it should be monitored; + * \param func is the function to call on parameter change; + * \param priv is a void pointer which will be passed as such to the function; + * \param data is a buffer where the current content of the parameter shall be + * stored; + * \param len is the size of the buffer. + * + * \return the callback descriptor (to be passed to brlapi_unwatchParameter to + * unregister the callback), or NULL on error. + * + * \note Default parameter callbacks don't do anything, except the ones for + * display size which just raise SIGWINCH. + * \note If data is NULL, the callback will be called immediately by + * brlapi_watchParameter, for providing the initial value + */ +#ifndef BRLAPI_NO_SINGLE_SESSION +brlapi_paramCallbackDescriptor_t BRLAPI_STDCALL +brlapi_watchParameter(brlapi_param_t parameter, + brlapi_param_subparam_t subparam, + brlapi_param_flags_t flags, + brlapi_paramCallback_t func, + void* priv, + void* data, + size_t len); +#endif +brlapi_paramCallbackDescriptor_t BRLAPI_STDCALL +brlapi__watchParameter(brlapi_handle_t* handle, + brlapi_param_t parameter, + brlapi_param_subparam_t subparam, + brlapi_param_flags_t flags, + brlapi_paramCallback_t func, + void* priv, + void* data, + size_t len); + +/* brlapi_unwatchParameter */ +/** Clear a parameter change callback + * + * brlapi_unwatchParameter unregisters a parameter change callback: the + * callback function previously registered with brlapi_watchParameter will + * not be called any longer. + * + * \param descriptor refers to the callback to be removed. + * + * \return 0 on success, -1 on error. + */ +#ifndef BRLAPI_NO_SINGLE_SESSION +int BRLAPI_STDCALL +brlapi_unwatchParameter(brlapi_paramCallbackDescriptor_t descriptor); +#endif +int BRLAPI_STDCALL +brlapi__unwatchParameter(brlapi_handle_t* handle, + brlapi_paramCallbackDescriptor_t descriptor); + +/** @} */ + +/** \defgroup brlapi_misc Miscellaneous functions + * @{ */ + +/* brlapi_pause */ +/** + * Waits until an event is received from the BrlAPI server + * \param timeout_ms specifies an optional timeout which can be zero for + * polling, or -1 for infinite wait \return nothing + */ +#ifndef BRLAPI_NO_SINGLE_SESSION +void BRLAPI_STDCALL brlapi_pause(int timeout_ms); +#endif +void BRLAPI_STDCALL brlapi__pause(brlapi_handle_t* handle, int timeout_ms); + +/** @} */ + +/** \defgroup brlapi_error Error handling + * \brief How to handle errors + * + * When a function fails, ::brlapi_errno will hold an error + * code to explain why it failed. It should always be reported somehow. + * + * Although most errors are reported that way, some (called exceptions) + * are reported asynchronously for efficiency reasons, because they always + * just report a programming error. The affected functions are: brlapi_setFocus, + * brlapi_write* and brlapi_sendRaw. When they happen, the next call to + * brlapi_something will close the connection and call the \e exception + * handler. If the exception handler returns, the brlapi_something function will + * return an end-of-file error. + * + * The default exception handler (brlapi_defaultExceptionHandler()) dumps + * the guilty packet before abort()ing. It can be replaced by calling + * brlapi_setExceptionHandler(). For instance, the Java and Python bindings use + * this for raising a Java or Python exception that may be caught. + * + * @{ */ + +/* Error codes */ +#define BRLAPI_ERROR_SUCCESS 0 /**< Success */ +#define BRLAPI_ERROR_NOMEM 1 /**< Not enough memory */ +#define BRLAPI_ERROR_TTYBUSY \ + 2 /**< A connection is already running in this tty */ +#define BRLAPI_ERROR_DEVICEBUSY \ + 3 /**< A connection is already using RAW or suspend mode */ +#define BRLAPI_ERROR_UNKNOWN_INSTRUCTION 4 /**< Not implemented in protocol */ +#define BRLAPI_ERROR_ILLEGAL_INSTRUCTION 5 /**< Forbiden in current mode */ +#define BRLAPI_ERROR_INVALID_PARAMETER 6 /**< Out of range or have no sense */ +#define BRLAPI_ERROR_INVALID_PACKET 7 /**< Invalid size */ +#define BRLAPI_ERROR_CONNREFUSED 8 /**< Connection refused */ +#define BRLAPI_ERROR_OPNOTSUPP 9 /**< Operation not supported */ +#define BRLAPI_ERROR_GAIERR 10 /**< Getaddrinfo error */ +#define BRLAPI_ERROR_LIBCERR 11 /**< Libc error */ +#define BRLAPI_ERROR_UNKNOWNTTY 12 /**< Couldn't find out the tty number */ +#define BRLAPI_ERROR_PROTOCOL_VERSION 13 /**< Bad protocol version */ +#define BRLAPI_ERROR_EOF 14 /**< Unexpected end of file */ +#define BRLAPI_ERROR_EMPTYKEY 15 /**< Key file empty */ +#define BRLAPI_ERROR_DRIVERERROR \ + 16 /**< Packet returned by driver too large \ + */ +#define BRLAPI_ERROR_AUTHENTICATION 17 /**< Authentication failed */ +#define BRLAPI_ERROR_READONLY_PARAMETER \ + 18 /**< Parameter can not be changed \ + */ + +/* brlapi_errlist */ +/** Error message list + * + * These are the string constants used by brlapi_perror(). + */ +extern const char* brlapi_errlist[]; + +/* brlapi_nerr */ +/** Number of error messages */ +extern const int brlapi_nerr; + +/* brlapi_perror */ +/** Print a BrlAPI error message + * + * brlapi_perror() reads ::brlapi_error, and acts just like perror(). + */ +void BRLAPI_STDCALL brlapi_perror(const char* s); + +/* brlapi_error_t */ +/** All information that is needed to describe brlapi errors */ +typedef struct { + int brlerrno; + int libcerrno; + int gaierrno; + const char* errfun; +} brlapi_error_t; + +/** Get per-thread error location + * + * In multithreaded software, ::brlapi_error is thread-specific, so api.h + * cheats about the brlapi_error token and actually calls + * brlapi_error_location(). + * + * This gets the thread specific location of global variable ::brlapi_error + */ +brlapi_error_t* BRLAPI_STDCALL brlapi_error_location(void); + +/** Global variable brlapi_error + * + * ::brlapi_error is a global left-value containing the last error information. + * Its errno field is not reset to BRLAPI_ERROR_SUCCESS on success. + * + * This information may be copied in brlapi_error_t variables for later use + * with the brlapi_strerror function. + */ +extern brlapi_error_t brlapi_error; + +/** Shorthand for brlapi_error.errno */ +extern int brlapi_errno; +/** Shorthand for brlapi_error.libcerrno */ +extern int brlapi_libcerrno; +/** Shorthand for brlapi_error.gaierrno */ +extern int brlapi_gaierrno; +/** Shorthand for brlapi_error.errfun */ +extern const char* brlapi_errfun; + +/** Cheat about the brlapi_error C token */ +#define brlapi_error (*brlapi_error_location()) +/** Cheat about the brlapi_errno C token */ +#define brlapi_errno (brlapi_error.brlerrno) +/** Cheat about the brlapi_libcerrno C token */ +#define brlapi_libcerrno (brlapi_error.libcerrno) +/** Cheat about the brlapi_gaierrno C token */ +#define brlapi_gaierrno (brlapi_error.gaierrno) +/** Cheat about the brlapi_errfun C token */ +#define brlapi_errfun (brlapi_error.errfun) + +/* brlapi_strerror */ +/** Get plain error message + * + * brlapi_strerror() returns the plain error message corresponding to its + * argument. + */ +const char* BRLAPI_STDCALL brlapi_strerror(const brlapi_error_t* error); + +/** Type for packet type. Only unsigned can cross networks, 32bits */ +typedef uint32_t brlapi_packetType_t; + +/* brlapi_getPacketTypeName */ +/** Get plain packet type + * + * brlapi_getPacketTypeName() returns the plain packet type name corresponding + * to its argument. + */ +const char* BRLAPI_STDCALL brlapi_getPacketTypeName(brlapi_packetType_t type); + +/* brlapi_exceptionHandler_t */ +/** Types for exception handlers + * + * Types of exception handlers which are to be given to + * brlapi_setExceptionHandler() and brlapi__setExceptionHandler(). + * + * \param handle is the handle corresponding to the guilty connection; + * \param error is a BRLAPI_ERROR_ error code; + * \param type is the type of the guilty packet; + * \param packet points to the content of the guilty packet (might be a little + * bit truncated); \param size gives the guilty packet's size. + */ +#ifndef BRLAPI_NO_SINGLE_SESSION +typedef void(BRLAPI_STDCALL* brlapi_exceptionHandler_t)( + int error, + brlapi_packetType_t type, + const void* packet, + size_t size); +#endif /* BRLAPI_NO_SINGLE_SESSION */ +typedef void(BRLAPI_STDCALL* brlapi__exceptionHandler_t)( + brlapi_handle_t* handle, + int error, + brlapi_packetType_t type, + const void* packet, + size_t size); + +/* brlapi_strexception */ +/** Describes an exception + * + * brlapi_strexception() puts a text describing the given exception in buffer. + * + * The beginning of the guilty packet is dumped as a sequence of hex bytes. + * + * \return the size of the text describing the exception, following + * snprintf()'s semantics. + */ +#ifndef BRLAPI_NO_SINGLE_SESSION +int BRLAPI_STDCALL brlapi_strexception(char* buffer, + size_t bufferSize, + int error, + brlapi_packetType_t type, + const void* packet, + size_t packetSize); +#endif /* BRLAPI_NO_SINGLE_SESSION */ +int BRLAPI_STDCALL brlapi__strexception(brlapi_handle_t* handle, + char* buffer, + size_t bufferSize, + int error, + brlapi_packetType_t type, + const void* packet, + size_t packetSize); + +/* brlapi_setExceptionHandler */ +/** Set a new exception handler + * + * brlapi_setExceptionHandler() replaces the previous exception handler with + * the handler parameter. The previous exception handler is returned to make + * chaining error handlers possible. + * + * The default handler just prints the exception and abort()s. + */ +#ifndef BRLAPI_NO_SINGLE_SESSION +brlapi_exceptionHandler_t BRLAPI_STDCALL +brlapi_setExceptionHandler(brlapi_exceptionHandler_t handler); +#endif /* BRLAPI_NO_SINGLE_SESSION */ +brlapi__exceptionHandler_t BRLAPI_STDCALL +brlapi__setExceptionHandler(brlapi_handle_t* handle, + brlapi__exceptionHandler_t handler); + +#ifndef BRLAPI_NO_SINGLE_SESSION +void BRLAPI_STDCALL brlapi_defaultExceptionHandler(int error, + brlapi_packetType_t type, + const void* packet, + size_t size); +#endif /* BRLAPI_NO_SINGLE_SESSION */ +void BRLAPI_STDCALL brlapi__defaultExceptionHandler(brlapi_handle_t* handle, + int error, + brlapi_packetType_t type, + const void* packet, + size_t size); + +/** @} */ + +/* Windows-specific tricks - don't look at this */ +#ifdef BRLAPI_WIN32 +#ifndef BRLAPI_NO_SINGLE_SESSION +int BRLAPI_STDCALL brlapi_writeTextWin(int cursor, const void* str, int wide); +#endif /* BRLAPI_NO_SINGLE_SESSION */ +int BRLAPI_STDCALL brlapi__writeTextWin(brlapi_handle_t* handle, + int cursor, + const void* str, + int wide); + +#ifndef BRLAPI_NO_SINGLE_SESSION +int BRLAPI_STDCALL brlapi_writeWin(const brlapi_writeArguments_t* s, int wide); +#endif /* BRLAPI_NO_SINGLE_SESSION */ +int BRLAPI_STDCALL brlapi__writeWin(brlapi_handle_t* handle, + const brlapi_writeArguments_t* s, + int wide); + +#ifdef UNICODE +#ifndef BRLAPI_NO_SINGLE_SESSION +#define brlapi_writeText(cursor, str) brlapi_writeTextWin(cursor, str, 1) +#endif /* BRLAPI_NO_SINGLE_SESSION */ +#define brlapi__writeText(handle, cursor, str) \ + brlapi__writeTextWin(handle, cursor, str, 1) + +#ifndef BRLAPI_NO_SINGLE_SESSION +#define brlapi_write(s) brlapi_writeWin(s, 1) +#endif /* BRLAPI_NO_SINGLE_SESSION */ +#define brlapi__write(handle, s) brlapi__writeWin(handle, s, 1) + +#else /* UNICODE */ + +#ifndef BRLAPI_NO_SINGLE_SESSION +#define brlapi_writeText(cursor, str) brlapi_writeTextWin(cursor, str, 0) +#endif /* BRLAPI_NO_SINGLE_SESSION */ +#define brlapi__writeText(handle, cursor, str) \ + brlapi__writeTextWin(handle, cursor, str, 0) + +#ifndef BRLAPI_NO_SINGLE_SESSION +#define brlapi_write(s) brlapi_writeWin(s, 0) +#endif /* BRLAPI_NO_SINGLE_SESSION */ +#define brlapi__write(handle, s) brlapi__writeWin(handle, s, 0) + +#endif /* UNICODE */ +#endif /* BRLAPI_WIN32 */ + +#ifndef BRLAPI_NO_DEPRECATED +/** \defgroup brlapi_deprecated Deprecated names + * + * With version 0.5.0, BrlAPI is now provided through including <brlapi.h> and + * got a big renaming pass. Old names are still available through macros, but + * they are deprecated since they will get dropped in the next release. This + * documentation is for you to know the new names. + * + * For checking that you have completely switched to new names, just define + * BRLAPI_NO_DEPRECATED: that will disable compatibility macros. + * + * @{ */ + +#define brlapi_settings_t brlapi_connectionSettings_t + +/** brlapi_writeStruct, replaced by brlapi_writeArguments_t */ +typedef struct { + int displayNumber; + unsigned int regionBegin; + unsigned int regionSize; + char* text; + int textSize; + unsigned char* attrAnd; + unsigned char* attrOr; + int cursor; + char* charset; +} brlapi_writeStruct; +#define BRLAPI_WRITESTRUCT_INITIALIZER BRLAPI_WRITEARGUMENTS_INITIALIZER + +#define brl_keycode_t brlapi_keyCode_t +#define brl_type_t brlapi_packetType_t + +#define BRLCOMMANDS NULL +#define BRL_KEYCODE_MAX BRLAPI_KEY_MAX + +#ifndef BRLAPI_NO_SINGLE_SESSION +#define brlapi_initializeConnection brlapi_openConnection +#define brlapi_getTty brlapi_enterTtyMode +#define brlapi_getTtyPath brlapi_enterTtyModeWithPath +#define brlapi_leaveTty brlapi_leaveTtyMode +#define brlapi_unignoreKeyRange brlapi_acceptKeyRange +#define brlapi_unignoreKeySet brlapi_acceptKeySet +#define brlapi_getRaw brlapi_enterRawMode +#define brlapi_leaveRaw brlapi_leaveRawMode +#define brlapi_suspend brlapi_suspendDriver +#define brlapi_resume brlapi_resumeDriver +#endif /* BRLAPI_NO_SINGLE_SESSION */ + +#define BRLERR_SUCCESS BRLAPI_ERROR_SUCCESS +#define BRLERR_NOMEM BRLAPI_ERROR_NOMEM +#define BRLERR_TTYBUSY BRLAPI_ERROR_TTYBUSY +#define BRLERR_DEVICEBUSY BRLAPI_ERROR_DEVICEBUSY +#define BRLERR_UNKNOWN_INSTRUCTION BRLAPI_ERROR_UNKNOWN_INSTRUCTION +#define BRLERR_ILLEGAL_INSTRUCTION BRLAPI_ERROR_ILLEGAL_INSTRUCTION +#define BRLERR_INVALID_PARAMETER BRLAPI_ERROR_INVALID_PARAMETER +#define BRLERR_INVALID_PACKET BRLAPI_ERROR_INVALID_PACKET +#define BRLERR_CONNREFUSED BRLAPI_ERROR_CONNREFUSED +#define BRLERR_OPNOTSUPP BRLAPI_ERROR_OPNOTSUPP +#define BRLERR_GAIERR BRLAPI_ERROR_GAIERR +#define BRLERR_LIBCERR BRLAPI_ERROR_LIBCERR +#define BRLERR_UNKNOWNTTY BRLAPI_ERROR_UNKNOWNTTY +#define BRLERR_PROTOCOL_VERSION BRLAPI_ERROR_PROTOCOL_VERSION +#define BRLERR_EOF BRLAPI_ERROR_EOF +#define BRLERR_EMPTYKEY BRLAPI_ERROR_EMPTYKEY +#define BRLERR_DRIVERERROR BRLAPI_ERROR_DRIVERERROR + +/** @} */ +#endif /* BRLAPI_NO_DEPRECATED */ + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* BRLAPI_INCLUDED */ diff --git a/chromium/third_party/libbrlapi/brlapi_brldefs.h b/chromium/third_party/libbrlapi/brlapi_brldefs.h new file mode 100644 index 00000000000..26b495ede4e --- /dev/null +++ b/chromium/third_party/libbrlapi/brlapi_brldefs.h @@ -0,0 +1,454 @@ +/* + * BRLTTY - A background process providing access to the console screen (when in + * text mode) for a blind person using a refreshable braille display. + * + * Copyright (C) 1995-2020 by The BRLTTY Developers. + * + * BRLTTY comes with ABSOLUTELY NO WARRANTY. + * + * This is free software, placed under the terms of the + * GNU Lesser General Public License, as published by the Free Software + * Foundation; either version 2.1 of the License, or (at your option) any + * later version. Please see the file LICENSE-LGPL for details. + * + * Web Page: http://brltty.app/ + * + * This software is maintained by Dave Mielke <dave@mielke.cc>. + */ + +#ifndef BRLAPI_INCLUDED_BRLDEFS +#define BRLAPI_INCLUDED_BRLDEFS + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +#define BRL_FLG_PUT(fLG) BRLAPI_KEY_FLG_PUT(fLG) +/** do nothing */ +#define BRL_CMD_NOOP (BRLAPI_KEY_TYPE_CMD | BRLAPI_KEY_CMD_NOOP) +/** go up one line */ +#define BRL_CMD_LNUP (BRLAPI_KEY_TYPE_CMD | BRLAPI_KEY_CMD_LNUP) +/** go down one line */ +#define BRL_CMD_LNDN (BRLAPI_KEY_TYPE_CMD | BRLAPI_KEY_CMD_LNDN) +/** go up several lines */ +#define BRL_CMD_WINUP (BRLAPI_KEY_TYPE_CMD | BRLAPI_KEY_CMD_WINUP) +/** go down several lines */ +#define BRL_CMD_WINDN (BRLAPI_KEY_TYPE_CMD | BRLAPI_KEY_CMD_WINDN) +/** go up to nearest line with different content */ +#define BRL_CMD_PRDIFLN (BRLAPI_KEY_TYPE_CMD | BRLAPI_KEY_CMD_PRDIFLN) +/** go down to nearest line with different content */ +#define BRL_CMD_NXDIFLN (BRLAPI_KEY_TYPE_CMD | BRLAPI_KEY_CMD_NXDIFLN) +/** go up to nearest line with different highlighting */ +#define BRL_CMD_ATTRUP (BRLAPI_KEY_TYPE_CMD | BRLAPI_KEY_CMD_ATTRUP) +/** go down to nearest line with different highlighting */ +#define BRL_CMD_ATTRDN (BRLAPI_KEY_TYPE_CMD | BRLAPI_KEY_CMD_ATTRDN) +/** go to top line */ +#define BRL_CMD_TOP (BRLAPI_KEY_TYPE_CMD | BRLAPI_KEY_CMD_TOP) +/** go to bottom line */ +#define BRL_CMD_BOT (BRLAPI_KEY_TYPE_CMD | BRLAPI_KEY_CMD_BOT) +/** go to beginning of top line */ +#define BRL_CMD_TOP_LEFT (BRLAPI_KEY_TYPE_CMD | BRLAPI_KEY_CMD_TOP_LEFT) +/** go to beginning of bottom line */ +#define BRL_CMD_BOT_LEFT (BRLAPI_KEY_TYPE_CMD | BRLAPI_KEY_CMD_BOT_LEFT) +/** go up to first line of paragraph */ +#define BRL_CMD_PRPGRPH (BRLAPI_KEY_TYPE_CMD | BRLAPI_KEY_CMD_PRPGRPH) +/** go down to first line of next paragraph */ +#define BRL_CMD_NXPGRPH (BRLAPI_KEY_TYPE_CMD | BRLAPI_KEY_CMD_NXPGRPH) +/** go up to previous command prompt */ +#define BRL_CMD_PRPROMPT (BRLAPI_KEY_TYPE_CMD | BRLAPI_KEY_CMD_PRPROMPT) +/** go down to next command prompt */ +#define BRL_CMD_NXPROMPT (BRLAPI_KEY_TYPE_CMD | BRLAPI_KEY_CMD_NXPROMPT) +/** search backward for clipboard text */ +#define BRL_CMD_PRSEARCH (BRLAPI_KEY_TYPE_CMD | BRLAPI_KEY_CMD_PRSEARCH) +/** search forward for clipboard text */ +#define BRL_CMD_NXSEARCH (BRLAPI_KEY_TYPE_CMD | BRLAPI_KEY_CMD_NXSEARCH) +/** go left one character */ +#define BRL_CMD_CHRLT (BRLAPI_KEY_TYPE_CMD | BRLAPI_KEY_CMD_CHRLT) +/** go right one character */ +#define BRL_CMD_CHRRT (BRLAPI_KEY_TYPE_CMD | BRLAPI_KEY_CMD_CHRRT) +/** go left half a braille window */ +#define BRL_CMD_HWINLT (BRLAPI_KEY_TYPE_CMD | BRLAPI_KEY_CMD_HWINLT) +/** go right half a braille window */ +#define BRL_CMD_HWINRT (BRLAPI_KEY_TYPE_CMD | BRLAPI_KEY_CMD_HWINRT) +/** go backward one braille window */ +#define BRL_CMD_FWINLT (BRLAPI_KEY_TYPE_CMD | BRLAPI_KEY_CMD_FWINLT) +/** go forward one braille window */ +#define BRL_CMD_FWINRT (BRLAPI_KEY_TYPE_CMD | BRLAPI_KEY_CMD_FWINRT) +/** go backward skipping blank braille windows */ +#define BRL_CMD_FWINLTSKIP (BRLAPI_KEY_TYPE_CMD | BRLAPI_KEY_CMD_FWINLTSKIP) +/** go forward skipping blank braille windows */ +#define BRL_CMD_FWINRTSKIP (BRLAPI_KEY_TYPE_CMD | BRLAPI_KEY_CMD_FWINRTSKIP) +/** go to beginning of line */ +#define BRL_CMD_LNBEG (BRLAPI_KEY_TYPE_CMD | BRLAPI_KEY_CMD_LNBEG) +/** go to end of line */ +#define BRL_CMD_LNEND (BRLAPI_KEY_TYPE_CMD | BRLAPI_KEY_CMD_LNEND) +/** go to screen cursor */ +#define BRL_CMD_HOME (BRLAPI_KEY_TYPE_CMD | BRLAPI_KEY_CMD_HOME) +/** go back after cursor tracking */ +#define BRL_CMD_BACK (BRLAPI_KEY_TYPE_CMD | BRLAPI_KEY_CMD_BACK) +/** go to screen cursor or go back after cursor tracking */ +#define BRL_CMD_RETURN (BRLAPI_KEY_TYPE_CMD | BRLAPI_KEY_CMD_RETURN) +/** set screen image frozen/unfrozen */ +#define BRL_CMD_FREEZE (BRLAPI_KEY_TYPE_CMD | BRLAPI_KEY_CMD_FREEZE) +/** set display mode attributes/text */ +#define BRL_CMD_DISPMD (BRLAPI_KEY_TYPE_CMD | BRLAPI_KEY_CMD_DISPMD) +/** set text style 6-dot/8-dot */ +#define BRL_CMD_SIXDOTS (BRLAPI_KEY_TYPE_CMD | BRLAPI_KEY_CMD_SIXDOTS) +/** set sliding braille window on/off */ +#define BRL_CMD_SLIDEWIN (BRLAPI_KEY_TYPE_CMD | BRLAPI_KEY_CMD_SLIDEWIN) +/** set skipping of lines with identical content on/off */ +#define BRL_CMD_SKPIDLNS (BRLAPI_KEY_TYPE_CMD | BRLAPI_KEY_CMD_SKPIDLNS) +/** set skipping of blank braille windows on/off */ +#define BRL_CMD_SKPBLNKWINS (BRLAPI_KEY_TYPE_CMD | BRLAPI_KEY_CMD_SKPBLNKWINS) +/** set screen cursor visibility on/off */ +#define BRL_CMD_CSRVIS (BRLAPI_KEY_TYPE_CMD | BRLAPI_KEY_CMD_CSRVIS) +/** set hidden screen cursor on/off */ +#define BRL_CMD_CSRHIDE (BRLAPI_KEY_TYPE_CMD | BRLAPI_KEY_CMD_CSRHIDE) +/** set track screen cursor on/off */ +#define BRL_CMD_CSRTRK (BRLAPI_KEY_TYPE_CMD | BRLAPI_KEY_CMD_CSRTRK) +/** set screen cursor style block/underline */ +#define BRL_CMD_CSRSIZE (BRLAPI_KEY_TYPE_CMD | BRLAPI_KEY_CMD_CSRSIZE) +/** set screen cursor blinking on/off */ +#define BRL_CMD_CSRBLINK (BRLAPI_KEY_TYPE_CMD | BRLAPI_KEY_CMD_CSRBLINK) +/** set attribute underlining on/off */ +#define BRL_CMD_ATTRVIS (BRLAPI_KEY_TYPE_CMD | BRLAPI_KEY_CMD_ATTRVIS) +/** set attribute blinking on/off */ +#define BRL_CMD_ATTRBLINK (BRLAPI_KEY_TYPE_CMD | BRLAPI_KEY_CMD_ATTRBLINK) +/** set capital letter blinking on/off */ +#define BRL_CMD_CAPBLINK (BRLAPI_KEY_TYPE_CMD | BRLAPI_KEY_CMD_CAPBLINK) +/** set alert tunes on/off */ +#define BRL_CMD_TUNES (BRLAPI_KEY_TYPE_CMD | BRLAPI_KEY_CMD_TUNES) +/** set autorepeat on/off */ +#define BRL_CMD_AUTOREPEAT (BRLAPI_KEY_TYPE_CMD | BRLAPI_KEY_CMD_AUTOREPEAT) +/** set autospeak on/off */ +#define BRL_CMD_AUTOSPEAK (BRLAPI_KEY_TYPE_CMD | BRLAPI_KEY_CMD_AUTOSPEAK) +/** enter/leave help display */ +#define BRL_CMD_HELP (BRLAPI_KEY_TYPE_CMD | BRLAPI_KEY_CMD_HELP) +/** enter/leave status display */ +#define BRL_CMD_INFO (BRLAPI_KEY_TYPE_CMD | BRLAPI_KEY_CMD_INFO) +/** enter/leave command learn mode */ +#define BRL_CMD_LEARN (BRLAPI_KEY_TYPE_CMD | BRLAPI_KEY_CMD_LEARN) +/** enter/leave preferences menu */ +#define BRL_CMD_PREFMENU (BRLAPI_KEY_TYPE_CMD | BRLAPI_KEY_CMD_PREFMENU) +/** save preferences to disk */ +#define BRL_CMD_PREFSAVE (BRLAPI_KEY_TYPE_CMD | BRLAPI_KEY_CMD_PREFSAVE) +/** restore preferences from disk */ +#define BRL_CMD_PREFLOAD (BRLAPI_KEY_TYPE_CMD | BRLAPI_KEY_CMD_PREFLOAD) +/** go up to first item */ +#define BRL_CMD_MENU_FIRST_ITEM (BRLAPI_KEY_TYPE_CMD | BRLAPI_KEY_CMD_MENU_FIRST_ITEM) +/** go down to last item */ +#define BRL_CMD_MENU_LAST_ITEM (BRLAPI_KEY_TYPE_CMD | BRLAPI_KEY_CMD_MENU_LAST_ITEM) +/** go up to previous item */ +#define BRL_CMD_MENU_PREV_ITEM (BRLAPI_KEY_TYPE_CMD | BRLAPI_KEY_CMD_MENU_PREV_ITEM) +/** go down to next item */ +#define BRL_CMD_MENU_NEXT_ITEM (BRLAPI_KEY_TYPE_CMD | BRLAPI_KEY_CMD_MENU_NEXT_ITEM) +/** select previous choice */ +#define BRL_CMD_MENU_PREV_SETTING (BRLAPI_KEY_TYPE_CMD | BRLAPI_KEY_CMD_MENU_PREV_SETTING) +/** select next choice */ +#define BRL_CMD_MENU_NEXT_SETTING (BRLAPI_KEY_TYPE_CMD | BRLAPI_KEY_CMD_MENU_NEXT_SETTING) +/** stop speaking */ +#define BRL_CMD_MUTE (BRLAPI_KEY_TYPE_CMD | BRLAPI_KEY_CMD_MUTE) +/** go to current speaking position */ +#define BRL_CMD_SPKHOME (BRLAPI_KEY_TYPE_CMD | BRLAPI_KEY_CMD_SPKHOME) +/** speak current line */ +#define BRL_CMD_SAY_LINE (BRLAPI_KEY_TYPE_CMD | BRLAPI_KEY_CMD_SAY_LINE) +/** speak from top of screen through current line */ +#define BRL_CMD_SAY_ABOVE (BRLAPI_KEY_TYPE_CMD | BRLAPI_KEY_CMD_SAY_ABOVE) +/** speak from current line through bottom of screen */ +#define BRL_CMD_SAY_BELOW (BRLAPI_KEY_TYPE_CMD | BRLAPI_KEY_CMD_SAY_BELOW) +/** decrease speaking rate */ +#define BRL_CMD_SAY_SLOWER (BRLAPI_KEY_TYPE_CMD | BRLAPI_KEY_CMD_SAY_SLOWER) +/** increase speaking rate */ +#define BRL_CMD_SAY_FASTER (BRLAPI_KEY_TYPE_CMD | BRLAPI_KEY_CMD_SAY_FASTER) +/** decrease speaking volume */ +#define BRL_CMD_SAY_SOFTER (BRLAPI_KEY_TYPE_CMD | BRLAPI_KEY_CMD_SAY_SOFTER) +/** increase speaking volume */ +#define BRL_CMD_SAY_LOUDER (BRLAPI_KEY_TYPE_CMD | BRLAPI_KEY_CMD_SAY_LOUDER) +/** switch to the previous virtual terminal */ +#define BRL_CMD_SWITCHVT_PREV (BRLAPI_KEY_TYPE_CMD | BRLAPI_KEY_CMD_SWITCHVT_PREV) +/** switch to the next virtual terminal */ +#define BRL_CMD_SWITCHVT_NEXT (BRLAPI_KEY_TYPE_CMD | BRLAPI_KEY_CMD_SWITCHVT_NEXT) +/** bring screen cursor to current line */ +#define BRL_CMD_CSRJMP_VERT (BRLAPI_KEY_TYPE_CMD | BRLAPI_KEY_CMD_CSRJMP_VERT) +/** insert clipboard text after screen cursor */ +#define BRL_CMD_PASTE (BRLAPI_KEY_TYPE_CMD | BRLAPI_KEY_CMD_PASTE) +/** restart braille driver */ +#define BRL_CMD_RESTARTBRL (BRLAPI_KEY_TYPE_CMD | BRLAPI_KEY_CMD_RESTARTBRL) +/** restart speech driver */ +#define BRL_CMD_RESTARTSPEECH (BRLAPI_KEY_TYPE_CMD | BRLAPI_KEY_CMD_RESTARTSPEECH) +/** braille display temporarily unavailable */ +#define BRL_CMD_OFFLINE (BRLAPI_KEY_TYPE_CMD | BRLAPI_KEY_CMD_OFFLINE) +/** cycle the Shift sticky input modifier (next, on, off) */ +#define BRL_CMD_SHIFT (BRLAPI_KEY_TYPE_CMD | BRLAPI_KEY_CMD_SHIFT) +/** cycle the Upper sticky input modifier (next, on, off) */ +#define BRL_CMD_UPPER (BRLAPI_KEY_TYPE_CMD | BRLAPI_KEY_CMD_UPPER) +/** cycle the Control sticky input modifier (next, on, off) */ +#define BRL_CMD_CONTROL (BRLAPI_KEY_TYPE_CMD | BRLAPI_KEY_CMD_CONTROL) +/** cycle the Meta (Left Alt) sticky input modifier (next, on, off) */ +#define BRL_CMD_META (BRLAPI_KEY_TYPE_CMD | BRLAPI_KEY_CMD_META) +/** show current date and time */ +#define BRL_CMD_TIME (BRLAPI_KEY_TYPE_CMD | BRLAPI_KEY_CMD_TIME) +/** go to previous menu level */ +#define BRL_CMD_MENU_PREV_LEVEL (BRLAPI_KEY_TYPE_CMD | BRLAPI_KEY_CMD_MENU_PREV_LEVEL) +/** set autospeak selected line on/off */ +#define BRL_CMD_ASPK_SEL_LINE (BRLAPI_KEY_TYPE_CMD | BRLAPI_KEY_CMD_ASPK_SEL_LINE) +/** set autospeak selected character on/off */ +#define BRL_CMD_ASPK_SEL_CHAR (BRLAPI_KEY_TYPE_CMD | BRLAPI_KEY_CMD_ASPK_SEL_CHAR) +/** set autospeak inserted characters on/off */ +#define BRL_CMD_ASPK_INS_CHARS (BRLAPI_KEY_TYPE_CMD | BRLAPI_KEY_CMD_ASPK_INS_CHARS) +/** set autospeak deleted characters on/off */ +#define BRL_CMD_ASPK_DEL_CHARS (BRLAPI_KEY_TYPE_CMD | BRLAPI_KEY_CMD_ASPK_DEL_CHARS) +/** set autospeak replaced characters on/off */ +#define BRL_CMD_ASPK_REP_CHARS (BRLAPI_KEY_TYPE_CMD | BRLAPI_KEY_CMD_ASPK_REP_CHARS) +/** set autospeak completed words on/off */ +#define BRL_CMD_ASPK_CMP_WORDS (BRLAPI_KEY_TYPE_CMD | BRLAPI_KEY_CMD_ASPK_CMP_WORDS) +/** speak current character */ +#define BRL_CMD_SPEAK_CURR_CHAR (BRLAPI_KEY_TYPE_CMD | BRLAPI_KEY_CMD_SPEAK_CURR_CHAR) +/** go to and speak previous character */ +#define BRL_CMD_SPEAK_PREV_CHAR (BRLAPI_KEY_TYPE_CMD | BRLAPI_KEY_CMD_SPEAK_PREV_CHAR) +/** go to and speak next character */ +#define BRL_CMD_SPEAK_NEXT_CHAR (BRLAPI_KEY_TYPE_CMD | BRLAPI_KEY_CMD_SPEAK_NEXT_CHAR) +/** speak current word */ +#define BRL_CMD_SPEAK_CURR_WORD (BRLAPI_KEY_TYPE_CMD | BRLAPI_KEY_CMD_SPEAK_CURR_WORD) +/** go to and speak previous word */ +#define BRL_CMD_SPEAK_PREV_WORD (BRLAPI_KEY_TYPE_CMD | BRLAPI_KEY_CMD_SPEAK_PREV_WORD) +/** go to and speak next word */ +#define BRL_CMD_SPEAK_NEXT_WORD (BRLAPI_KEY_TYPE_CMD | BRLAPI_KEY_CMD_SPEAK_NEXT_WORD) +/** speak current line */ +#define BRL_CMD_SPEAK_CURR_LINE (BRLAPI_KEY_TYPE_CMD | BRLAPI_KEY_CMD_SPEAK_CURR_LINE) +/** go to and speak previous line */ +#define BRL_CMD_SPEAK_PREV_LINE (BRLAPI_KEY_TYPE_CMD | BRLAPI_KEY_CMD_SPEAK_PREV_LINE) +/** go to and speak next line */ +#define BRL_CMD_SPEAK_NEXT_LINE (BRLAPI_KEY_TYPE_CMD | BRLAPI_KEY_CMD_SPEAK_NEXT_LINE) +/** go to and speak first non-blank character on line */ +#define BRL_CMD_SPEAK_FRST_CHAR (BRLAPI_KEY_TYPE_CMD | BRLAPI_KEY_CMD_SPEAK_FRST_CHAR) +/** go to and speak last non-blank character on line */ +#define BRL_CMD_SPEAK_LAST_CHAR (BRLAPI_KEY_TYPE_CMD | BRLAPI_KEY_CMD_SPEAK_LAST_CHAR) +/** go to and speak first non-blank line on screen */ +#define BRL_CMD_SPEAK_FRST_LINE (BRLAPI_KEY_TYPE_CMD | BRLAPI_KEY_CMD_SPEAK_FRST_LINE) +/** go to and speak last non-blank line on screen */ +#define BRL_CMD_SPEAK_LAST_LINE (BRLAPI_KEY_TYPE_CMD | BRLAPI_KEY_CMD_SPEAK_LAST_LINE) +/** describe current character */ +#define BRL_CMD_DESC_CURR_CHAR (BRLAPI_KEY_TYPE_CMD | BRLAPI_KEY_CMD_DESC_CURR_CHAR) +/** spell current word */ +#define BRL_CMD_SPELL_CURR_WORD (BRLAPI_KEY_TYPE_CMD | BRLAPI_KEY_CMD_SPELL_CURR_WORD) +/** bring screen cursor to speech cursor */ +#define BRL_CMD_ROUTE_CURR_LOCN (BRLAPI_KEY_TYPE_CMD | BRLAPI_KEY_CMD_ROUTE_CURR_LOCN) +/** speak speech cursor location */ +#define BRL_CMD_SPEAK_CURR_LOCN (BRLAPI_KEY_TYPE_CMD | BRLAPI_KEY_CMD_SPEAK_CURR_LOCN) +/** set speech cursor visibility on/off */ +#define BRL_CMD_SHOW_CURR_LOCN (BRLAPI_KEY_TYPE_CMD | BRLAPI_KEY_CMD_SHOW_CURR_LOCN) +/** save clipboard to disk */ +#define BRL_CMD_CLIP_SAVE (BRLAPI_KEY_TYPE_CMD | BRLAPI_KEY_CMD_CLIP_SAVE) +/** restore clipboard from disk */ +#define BRL_CMD_CLIP_RESTORE (BRLAPI_KEY_TYPE_CMD | BRLAPI_KEY_CMD_CLIP_RESTORE) +/** set braille typing mode dots/text */ +#define BRL_CMD_BRLUCDOTS (BRLAPI_KEY_TYPE_CMD | BRLAPI_KEY_CMD_BRLUCDOTS) +/** set braille keyboard enabled/disabled */ +#define BRL_CMD_BRLKBD (BRLAPI_KEY_TYPE_CMD | BRLAPI_KEY_CMD_BRLKBD) +/** clear all sticky input modifiers */ +#define BRL_CMD_UNSTICK (BRLAPI_KEY_TYPE_CMD | BRLAPI_KEY_CMD_UNSTICK) +/** cycle the AltGr (Right Alt) sticky input modifier (next, on, off) */ +#define BRL_CMD_ALTGR (BRLAPI_KEY_TYPE_CMD | BRLAPI_KEY_CMD_ALTGR) +/** cycle the GUI (Windows) sticky input modifier (next, on, off) */ +#define BRL_CMD_GUI (BRLAPI_KEY_TYPE_CMD | BRLAPI_KEY_CMD_GUI) +/** stop the braille driver */ +#define BRL_CMD_BRL_STOP (BRLAPI_KEY_TYPE_CMD | BRLAPI_KEY_CMD_BRL_STOP) +/** start the braille driver */ +#define BRL_CMD_BRL_START (BRLAPI_KEY_TYPE_CMD | BRLAPI_KEY_CMD_BRL_START) +/** stop the speech driver */ +#define BRL_CMD_SPK_STOP (BRLAPI_KEY_TYPE_CMD | BRLAPI_KEY_CMD_SPK_STOP) +/** start the speech driver */ +#define BRL_CMD_SPK_START (BRLAPI_KEY_TYPE_CMD | BRLAPI_KEY_CMD_SPK_START) +/** stop the screen driver */ +#define BRL_CMD_SCR_STOP (BRLAPI_KEY_TYPE_CMD | BRLAPI_KEY_CMD_SCR_STOP) +/** start the screen driver */ +#define BRL_CMD_SCR_START (BRLAPI_KEY_TYPE_CMD | BRLAPI_KEY_CMD_SCR_START) +/** bind to the previous virtual terminal */ +#define BRL_CMD_SELECTVT_PREV (BRLAPI_KEY_TYPE_CMD | BRLAPI_KEY_CMD_SELECTVT_PREV) +/** bind to the next virtual terminal */ +#define BRL_CMD_SELECTVT_NEXT (BRLAPI_KEY_TYPE_CMD | BRLAPI_KEY_CMD_SELECTVT_NEXT) +/** go backward to nearest non-blank braille window */ +#define BRL_CMD_PRNBWIN (BRLAPI_KEY_TYPE_CMD | BRLAPI_KEY_CMD_PRNBWIN) +/** go forward to nearest non-blank braille window */ +#define BRL_CMD_NXNBWIN (BRLAPI_KEY_TYPE_CMD | BRLAPI_KEY_CMD_NXNBWIN) +/** set touch navigation on/off */ +#define BRL_CMD_TOUCH_NAV (BRLAPI_KEY_TYPE_CMD | BRLAPI_KEY_CMD_TOUCH_NAV) +/** speak indent of current line */ +#define BRL_CMD_SPEAK_INDENT (BRLAPI_KEY_TYPE_CMD | BRLAPI_KEY_CMD_SPEAK_INDENT) +/** set autospeak indent of current line on/off */ +#define BRL_CMD_ASPK_INDENT (BRLAPI_KEY_TYPE_CMD | BRLAPI_KEY_CMD_ASPK_INDENT) +/** refresh braille display */ +#define BRL_CMD_REFRESH (BRLAPI_KEY_TYPE_CMD | BRLAPI_KEY_CMD_REFRESH) +/** bring screen cursor to character */ +#define BRL_BLK_ROUTE (BRLAPI_KEY_TYPE_CMD | BRLAPI_KEY_CMD_ROUTE) +/** start new clipboard at character */ +#define BRL_BLK_CLIP_NEW (BRLAPI_KEY_TYPE_CMD | BRLAPI_KEY_CMD_CLIP_NEW) +/** deprecated definition of CLIP_NEW - start new clipboard at character */ +#define BRL_BLK_CUTBEGIN (BRLAPI_KEY_TYPE_CMD | BRLAPI_KEY_CMD_CUTBEGIN) +/** append to clipboard from character */ +#define BRL_BLK_CLIP_ADD (BRLAPI_KEY_TYPE_CMD | BRLAPI_KEY_CMD_CLIP_ADD) +/** deprecated definition of CLIP_ADD - append to clipboard from character */ +#define BRL_BLK_CUTAPPEND (BRLAPI_KEY_TYPE_CMD | BRLAPI_KEY_CMD_CUTAPPEND) +/** rectangular copy to character */ +#define BRL_BLK_COPY_RECT (BRLAPI_KEY_TYPE_CMD | BRLAPI_KEY_CMD_COPY_RECT) +/** deprecated definition of COPY_RECT - rectangular copy to character */ +#define BRL_BLK_CUTRECT (BRLAPI_KEY_TYPE_CMD | BRLAPI_KEY_CMD_CUTRECT) +/** linear copy to character */ +#define BRL_BLK_COPY_LINE (BRLAPI_KEY_TYPE_CMD | BRLAPI_KEY_CMD_COPY_LINE) +/** deprecated definition of COPY_LINE - linear copy to character */ +#define BRL_BLK_CUTLINE (BRLAPI_KEY_TYPE_CMD | BRLAPI_KEY_CMD_CUTLINE) +/** switch to specific virtual terminal */ +#define BRL_BLK_SWITCHVT (BRLAPI_KEY_TYPE_CMD | BRLAPI_KEY_CMD_SWITCHVT) +/** go up to nearest line with less indent than character */ +#define BRL_BLK_PRINDENT (BRLAPI_KEY_TYPE_CMD | BRLAPI_KEY_CMD_PRINDENT) +/** go down to nearest line with less indent than character */ +#define BRL_BLK_NXINDENT (BRLAPI_KEY_TYPE_CMD | BRLAPI_KEY_CMD_NXINDENT) +/** describe character */ +#define BRL_BLK_DESCCHAR (BRLAPI_KEY_TYPE_CMD | BRLAPI_KEY_CMD_DESCCHAR) +/** place left end of braille window at character */ +#define BRL_BLK_SETLEFT (BRLAPI_KEY_TYPE_CMD | BRLAPI_KEY_CMD_SETLEFT) +/** remember current braille window position */ +#define BRL_BLK_SETMARK (BRLAPI_KEY_TYPE_CMD | BRLAPI_KEY_CMD_SETMARK) +/** go to remembered braille window position */ +#define BRL_BLK_GOTOMARK (BRLAPI_KEY_TYPE_CMD | BRLAPI_KEY_CMD_GOTOMARK) +/** go to selected line */ +#define BRL_BLK_GOTOLINE (BRLAPI_KEY_TYPE_CMD | BRLAPI_KEY_CMD_GOTOLINE) +/** go up to nearest line with different character */ +#define BRL_BLK_PRDIFCHAR (BRLAPI_KEY_TYPE_CMD | BRLAPI_KEY_CMD_PRDIFCHAR) +/** go down to nearest line with different character */ +#define BRL_BLK_NXDIFCHAR (BRLAPI_KEY_TYPE_CMD | BRLAPI_KEY_CMD_NXDIFCHAR) +/** copy characters to clipboard */ +#define BRL_BLK_CLIP_COPY (BRLAPI_KEY_TYPE_CMD | BRLAPI_KEY_CMD_CLIP_COPY) +/** deprecated definition of CLIP_COPY - copy characters to clipboard */ +#define BRL_BLK_COPYCHARS (BRLAPI_KEY_TYPE_CMD | BRLAPI_KEY_CMD_COPYCHARS) +/** append characters to clipboard */ +#define BRL_BLK_CLIP_APPEND (BRLAPI_KEY_TYPE_CMD | BRLAPI_KEY_CMD_CLIP_APPEND) +/** deprecated definition of CLIP_APPEND - append characters to clipboard */ +#define BRL_BLK_APNDCHARS (BRLAPI_KEY_TYPE_CMD | BRLAPI_KEY_CMD_APNDCHARS) +/** insert clipboard history entry after screen cursor */ +#define BRL_BLK_PASTE_HISTORY (BRLAPI_KEY_TYPE_CMD | BRLAPI_KEY_CMD_PASTE_HISTORY) +/** set text table */ +#define BRL_BLK_SET_TEXT_TABLE (BRLAPI_KEY_TYPE_CMD | BRLAPI_KEY_CMD_SET_TEXT_TABLE) +/** set attributes table */ +#define BRL_BLK_SET_ATTRIBUTES_TABLE (BRLAPI_KEY_TYPE_CMD | BRLAPI_KEY_CMD_SET_ATTRIBUTES_TABLE) +/** set contraction table */ +#define BRL_BLK_SET_CONTRACTION_TABLE (BRLAPI_KEY_TYPE_CMD | BRLAPI_KEY_CMD_SET_CONTRACTION_TABLE) +/** set keyboard table */ +#define BRL_BLK_SET_KEYBOARD_TABLE (BRLAPI_KEY_TYPE_CMD | BRLAPI_KEY_CMD_SET_KEYBOARD_TABLE) +/** set language profile */ +#define BRL_BLK_SET_LANGUAGE_PROFILE (BRLAPI_KEY_TYPE_CMD | BRLAPI_KEY_CMD_SET_LANGUAGE_PROFILE) +/** bring screen cursor to line */ +#define BRL_BLK_ROUTE_LINE (BRLAPI_KEY_TYPE_CMD | BRLAPI_KEY_CMD_ROUTE_LINE) +/** refresh braille line */ +#define BRL_BLK_REFRESH_LINE (BRLAPI_KEY_TYPE_CMD | BRLAPI_KEY_CMD_REFRESH_LINE) +/** bind to specific virtual terminal */ +#define BRL_BLK_SELECTVT (BRLAPI_KEY_TYPE_CMD | BRLAPI_KEY_CMD_SELECTVT) +/** render an alert */ +#define BRL_BLK_ALERT (BRLAPI_KEY_TYPE_CMD | BRLAPI_KEY_CMD_ALERT) +/** type unicode character */ +#define BRL_KEY_PASSCHAR (BRLAPI_KEY_TYPE_SYM | 0X0000) +/** type braille dots */ +#define BRL_BLK_PASSDOTS (BRLAPI_KEY_TYPE_CMD | BRLAPI_KEY_CMD_PASSDOTS) +/** AT (set 2) keyboard scan code */ +#define BRL_BLK_PASSAT (BRLAPI_KEY_TYPE_CMD | BRLAPI_KEY_CMD_PASSAT) +/** XT (set 1) keyboard scan code */ +#define BRL_BLK_PASSXT (BRLAPI_KEY_TYPE_CMD | BRLAPI_KEY_CMD_PASSXT) +/** PS/2 (set 3) keyboard scan code */ +#define BRL_BLK_PASSPS2 (BRLAPI_KEY_TYPE_CMD | BRLAPI_KEY_CMD_PASSPS2) +/** switch to command context */ +#define BRL_BLK_CONTEXT (BRLAPI_KEY_TYPE_CMD | BRLAPI_KEY_CMD_CONTEXT) +/** current reading location */ +#define BRL_BLK_TOUCH_AT (BRLAPI_KEY_TYPE_CMD | BRLAPI_KEY_CMD_TOUCH_AT) +/** enter key */ +#define BRL_KEY_ENTER (BRLAPI_KEY_SYM_LINEFEED & 0XFF) +/** tab key */ +#define BRL_KEY_TAB (BRLAPI_KEY_SYM_TAB & 0XFF) +/** backspace key */ +#define BRL_KEY_BACKSPACE (BRLAPI_KEY_SYM_BACKSPACE & 0XFF) +/** escape key */ +#define BRL_KEY_ESCAPE (BRLAPI_KEY_SYM_ESCAPE & 0XFF) +/** cursor-left key */ +#define BRL_KEY_CURSOR_LEFT (BRLAPI_KEY_SYM_LEFT & 0XFF) +/** cursor-right key */ +#define BRL_KEY_CURSOR_RIGHT (BRLAPI_KEY_SYM_RIGHT & 0XFF) +/** cursor-up key */ +#define BRL_KEY_CURSOR_UP (BRLAPI_KEY_SYM_UP & 0XFF) +/** cursor-down key */ +#define BRL_KEY_CURSOR_DOWN (BRLAPI_KEY_SYM_DOWN & 0XFF) +/** page-up key */ +#define BRL_KEY_PAGE_UP (BRLAPI_KEY_SYM_PAGE_UP & 0XFF) +/** page-down key */ +#define BRL_KEY_PAGE_DOWN (BRLAPI_KEY_SYM_PAGE_DOWN & 0XFF) +/** home key */ +#define BRL_KEY_HOME (BRLAPI_KEY_SYM_HOME & 0XFF) +/** end key */ +#define BRL_KEY_END (BRLAPI_KEY_SYM_END & 0XFF) +/** insert key */ +#define BRL_KEY_INSERT (BRLAPI_KEY_SYM_INSERT & 0XFF) +/** delete key */ +#define BRL_KEY_DELETE (BRLAPI_KEY_SYM_DELETE & 0XFF) +/** function key */ +#define BRL_KEY_FUNCTION (BRLAPI_KEY_SYM_FUNCTION & 0XFF) +/** enable feature */ +#define BRL_FLG_TOGGLE_ON BRLAPI_KEY_FLG_TOGGLE_ON +/** disable feature */ +#define BRL_FLG_TOGGLE_OFF BRLAPI_KEY_FLG_TOGGLE_OFF +/** mask for all toggle flags */ +#define BRL_FLG_TOGGLE_MASK BRLAPI_KEY_FLG_TOGGLE_MASK +/** bring screen cursor into braille window after function */ +#define BRL_FLG_MOTION_ROUTE BRLAPI_KEY_FLG_MOTION_ROUTE +/** scale arg=0X00-0XFF to screen height */ +#define BRL_FLG_MOTION_SCALED BRLAPI_KEY_FLG_MOTION_SCALED +/** go to beginning of line */ +#define BRL_FLG_MOTION_TOLEFT BRLAPI_KEY_FLG_MOTION_TOLEFT +/** shift key pressed */ +#define BRL_FLG_INPUT_SHIFT BRLAPI_KEY_FLG_INPUT_SHIFT +/** convert to uppercase */ +#define BRL_FLG_INPUT_UPPER BRLAPI_KEY_FLG_INPUT_UPPER +/** control key pressed */ +#define BRL_FLG_INPUT_CONTROL BRLAPI_KEY_FLG_INPUT_CONTROL +/** meta (left alt) key pressed */ +#define BRL_FLG_INPUT_META BRLAPI_KEY_FLG_INPUT_META +/** altgr (right alt) key pressed */ +#define BRL_FLG_INPUT_ALTGR BRLAPI_KEY_FLG_INPUT_ALTGR +/** gui (windows) key pressed */ +#define BRL_FLG_INPUT_GUI BRLAPI_KEY_FLG_INPUT_GUI +/** it is a release scan code */ +#define BRL_FLG_KBD_RELEASE BRLAPI_KEY_FLG_KBD_RELEASE +/** it is an emulation 0 scan code */ +#define BRL_FLG_KBD_EMUL0 BRLAPI_KEY_FLG_KBD_EMUL0 +/** it is an emulation 1 scan code */ +#define BRL_FLG_KBD_EMUL1 BRLAPI_KEY_FLG_KBD_EMUL1 +/** upper-left dot of standard braille cell */ +#define BRL_DOT1 BRLAPI_DOT1 +/** middle-left dot of standard braille cell */ +#define BRL_DOT2 BRLAPI_DOT2 +/** lower-left dot of standard braille cell */ +#define BRL_DOT3 BRLAPI_DOT3 +/** upper-right dot of standard braille cell */ +#define BRL_DOT4 BRLAPI_DOT4 +/** middle-right dot of standard braille cell */ +#define BRL_DOT5 BRLAPI_DOT5 +/** lower-right dot of standard braille cell */ +#define BRL_DOT6 BRLAPI_DOT6 +/** lower-left dot of computer braille cell */ +#define BRL_DOT7 BRLAPI_DOT7 +/** lower-right dot of computer braille cell */ +#define BRL_DOT8 BRLAPI_DOT8 +/** chord (space bar on braille keyboard) */ +#define BRL_DOTC BRLAPI_DOTC +/** mask for command type */ +#define BRL_MSK_BLK (BRLAPI_KEY_TYPE_MASK | BRLAPI_KEY_CMD_BLK_MASK) +/** mask for command value/argument */ +#define BRL_MSK_ARG BRLAPI_KEY_CMD_ARG_MASK +/** mask for command flags */ +#define BRL_MSK_FLG BRLAPI_KEY_FLAGS_MASK +/** mask for command */ +#define BRL_MSK_CMD (BRL_MSK_BLK | BRL_MSK_ARG) + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* BRLAPI_INCLUDED_BRLDEFS */ diff --git a/chromium/third_party/libbrlapi/brlapi_constants.h b/chromium/third_party/libbrlapi/brlapi_constants.h new file mode 100644 index 00000000000..978e454a498 --- /dev/null +++ b/chromium/third_party/libbrlapi/brlapi_constants.h @@ -0,0 +1,437 @@ +/* + * libbrlapi - A library providing access to braille terminals for applications. + * + * Copyright (C) 2002-2020 by + * Samuel Thibault <Samuel.Thibault@ens-lyon.org> + * Sébastien Hinderer <Sebastien.Hinderer@ens-lyon.org> + * + * libbrlapi comes with ABSOLUTELY NO WARRANTY. + * + * This is free software, placed under the terms of the + * GNU Lesser General Public License, as published by the Free Software + * Foundation; either version 2.1 of the License, or (at your option) any + * later version. Please see the file LICENSE-LGPL for details. + * + * Web Page: http://brltty.app/ + * + * This software is maintained by Dave Mielke <dave@mielke.cc>. + */ + +#ifndef BRLAPI_INCLUDED_CONSTANTS +#define BRLAPI_INCLUDED_CONSTANTS + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +/** \file + */ + +/** \ingroup brlapi_keycodes + * @{ */ + +/** do nothing */ +#define BRLAPI_KEY_CMD_NOOP (BRLAPI_KEY_CMD(0) + 0) +/** go up one line */ +#define BRLAPI_KEY_CMD_LNUP (BRLAPI_KEY_CMD(0) + 1) +/** go down one line */ +#define BRLAPI_KEY_CMD_LNDN (BRLAPI_KEY_CMD(0) + 2) +/** go up several lines */ +#define BRLAPI_KEY_CMD_WINUP (BRLAPI_KEY_CMD(0) + 3) +/** go down several lines */ +#define BRLAPI_KEY_CMD_WINDN (BRLAPI_KEY_CMD(0) + 4) +/** go up to nearest line with different content */ +#define BRLAPI_KEY_CMD_PRDIFLN (BRLAPI_KEY_CMD(0) + 5) +/** go down to nearest line with different content */ +#define BRLAPI_KEY_CMD_NXDIFLN (BRLAPI_KEY_CMD(0) + 6) +/** go up to nearest line with different highlighting */ +#define BRLAPI_KEY_CMD_ATTRUP (BRLAPI_KEY_CMD(0) + 7) +/** go down to nearest line with different highlighting */ +#define BRLAPI_KEY_CMD_ATTRDN (BRLAPI_KEY_CMD(0) + 8) +/** go to top line */ +#define BRLAPI_KEY_CMD_TOP (BRLAPI_KEY_CMD(0) + 9) +/** go to bottom line */ +#define BRLAPI_KEY_CMD_BOT (BRLAPI_KEY_CMD(0) + 10) +/** go to beginning of top line */ +#define BRLAPI_KEY_CMD_TOP_LEFT (BRLAPI_KEY_CMD(0) + 11) +/** go to beginning of bottom line */ +#define BRLAPI_KEY_CMD_BOT_LEFT (BRLAPI_KEY_CMD(0) + 12) +/** go up to first line of paragraph */ +#define BRLAPI_KEY_CMD_PRPGRPH (BRLAPI_KEY_CMD(0) + 13) +/** go down to first line of next paragraph */ +#define BRLAPI_KEY_CMD_NXPGRPH (BRLAPI_KEY_CMD(0) + 14) +/** go up to previous command prompt */ +#define BRLAPI_KEY_CMD_PRPROMPT (BRLAPI_KEY_CMD(0) + 15) +/** go down to next command prompt */ +#define BRLAPI_KEY_CMD_NXPROMPT (BRLAPI_KEY_CMD(0) + 16) +/** search backward for clipboard text */ +#define BRLAPI_KEY_CMD_PRSEARCH (BRLAPI_KEY_CMD(0) + 17) +/** search forward for clipboard text */ +#define BRLAPI_KEY_CMD_NXSEARCH (BRLAPI_KEY_CMD(0) + 18) +/** go left one character */ +#define BRLAPI_KEY_CMD_CHRLT (BRLAPI_KEY_CMD(0) + 19) +/** go right one character */ +#define BRLAPI_KEY_CMD_CHRRT (BRLAPI_KEY_CMD(0) + 20) +/** go left half a braille window */ +#define BRLAPI_KEY_CMD_HWINLT (BRLAPI_KEY_CMD(0) + 21) +/** go right half a braille window */ +#define BRLAPI_KEY_CMD_HWINRT (BRLAPI_KEY_CMD(0) + 22) +/** go backward one braille window */ +#define BRLAPI_KEY_CMD_FWINLT (BRLAPI_KEY_CMD(0) + 23) +/** go forward one braille window */ +#define BRLAPI_KEY_CMD_FWINRT (BRLAPI_KEY_CMD(0) + 24) +/** go backward skipping blank braille windows */ +#define BRLAPI_KEY_CMD_FWINLTSKIP (BRLAPI_KEY_CMD(0) + 25) +/** go forward skipping blank braille windows */ +#define BRLAPI_KEY_CMD_FWINRTSKIP (BRLAPI_KEY_CMD(0) + 26) +/** go to beginning of line */ +#define BRLAPI_KEY_CMD_LNBEG (BRLAPI_KEY_CMD(0) + 27) +/** go to end of line */ +#define BRLAPI_KEY_CMD_LNEND (BRLAPI_KEY_CMD(0) + 28) +/** go to screen cursor */ +#define BRLAPI_KEY_CMD_HOME (BRLAPI_KEY_CMD(0) + 29) +/** go back after cursor tracking */ +#define BRLAPI_KEY_CMD_BACK (BRLAPI_KEY_CMD(0) + 30) +/** go to screen cursor or go back after cursor tracking */ +#define BRLAPI_KEY_CMD_RETURN (BRLAPI_KEY_CMD(0) + 31) +/** set screen image frozen/unfrozen */ +#define BRLAPI_KEY_CMD_FREEZE (BRLAPI_KEY_CMD(0) + 32) +/** set display mode attributes/text */ +#define BRLAPI_KEY_CMD_DISPMD (BRLAPI_KEY_CMD(0) + 33) +/** set text style 6-dot/8-dot */ +#define BRLAPI_KEY_CMD_SIXDOTS (BRLAPI_KEY_CMD(0) + 34) +/** set sliding braille window on/off */ +#define BRLAPI_KEY_CMD_SLIDEWIN (BRLAPI_KEY_CMD(0) + 35) +/** set skipping of lines with identical content on/off */ +#define BRLAPI_KEY_CMD_SKPIDLNS (BRLAPI_KEY_CMD(0) + 36) +/** set skipping of blank braille windows on/off */ +#define BRLAPI_KEY_CMD_SKPBLNKWINS (BRLAPI_KEY_CMD(0) + 37) +/** set screen cursor visibility on/off */ +#define BRLAPI_KEY_CMD_CSRVIS (BRLAPI_KEY_CMD(0) + 38) +/** set hidden screen cursor on/off */ +#define BRLAPI_KEY_CMD_CSRHIDE (BRLAPI_KEY_CMD(0) + 39) +/** set track screen cursor on/off */ +#define BRLAPI_KEY_CMD_CSRTRK (BRLAPI_KEY_CMD(0) + 40) +/** set screen cursor style block/underline */ +#define BRLAPI_KEY_CMD_CSRSIZE (BRLAPI_KEY_CMD(0) + 41) +/** set screen cursor blinking on/off */ +#define BRLAPI_KEY_CMD_CSRBLINK (BRLAPI_KEY_CMD(0) + 42) +/** set attribute underlining on/off */ +#define BRLAPI_KEY_CMD_ATTRVIS (BRLAPI_KEY_CMD(0) + 43) +/** set attribute blinking on/off */ +#define BRLAPI_KEY_CMD_ATTRBLINK (BRLAPI_KEY_CMD(0) + 44) +/** set capital letter blinking on/off */ +#define BRLAPI_KEY_CMD_CAPBLINK (BRLAPI_KEY_CMD(0) + 45) +/** set alert tunes on/off */ +#define BRLAPI_KEY_CMD_TUNES (BRLAPI_KEY_CMD(0) + 46) +/** set autorepeat on/off */ +#define BRLAPI_KEY_CMD_AUTOREPEAT (BRLAPI_KEY_CMD(0) + 47) +/** set autospeak on/off */ +#define BRLAPI_KEY_CMD_AUTOSPEAK (BRLAPI_KEY_CMD(0) + 48) +/** enter/leave help display */ +#define BRLAPI_KEY_CMD_HELP (BRLAPI_KEY_CMD(0) + 49) +/** enter/leave status display */ +#define BRLAPI_KEY_CMD_INFO (BRLAPI_KEY_CMD(0) + 50) +/** enter/leave command learn mode */ +#define BRLAPI_KEY_CMD_LEARN (BRLAPI_KEY_CMD(0) + 51) +/** enter/leave preferences menu */ +#define BRLAPI_KEY_CMD_PREFMENU (BRLAPI_KEY_CMD(0) + 52) +/** save preferences to disk */ +#define BRLAPI_KEY_CMD_PREFSAVE (BRLAPI_KEY_CMD(0) + 53) +/** restore preferences from disk */ +#define BRLAPI_KEY_CMD_PREFLOAD (BRLAPI_KEY_CMD(0) + 54) +/** go up to first item */ +#define BRLAPI_KEY_CMD_MENU_FIRST_ITEM (BRLAPI_KEY_CMD(0) + 55) +/** go down to last item */ +#define BRLAPI_KEY_CMD_MENU_LAST_ITEM (BRLAPI_KEY_CMD(0) + 56) +/** go up to previous item */ +#define BRLAPI_KEY_CMD_MENU_PREV_ITEM (BRLAPI_KEY_CMD(0) + 57) +/** go down to next item */ +#define BRLAPI_KEY_CMD_MENU_NEXT_ITEM (BRLAPI_KEY_CMD(0) + 58) +/** select previous choice */ +#define BRLAPI_KEY_CMD_MENU_PREV_SETTING (BRLAPI_KEY_CMD(0) + 59) +/** select next choice */ +#define BRLAPI_KEY_CMD_MENU_NEXT_SETTING (BRLAPI_KEY_CMD(0) + 60) +/** stop speaking */ +#define BRLAPI_KEY_CMD_MUTE (BRLAPI_KEY_CMD(0) + 61) +/** go to current speaking position */ +#define BRLAPI_KEY_CMD_SPKHOME (BRLAPI_KEY_CMD(0) + 62) +/** speak current line */ +#define BRLAPI_KEY_CMD_SAY_LINE (BRLAPI_KEY_CMD(0) + 63) +/** speak from top of screen through current line */ +#define BRLAPI_KEY_CMD_SAY_ABOVE (BRLAPI_KEY_CMD(0) + 64) +/** speak from current line through bottom of screen */ +#define BRLAPI_KEY_CMD_SAY_BELOW (BRLAPI_KEY_CMD(0) + 65) +/** decrease speaking rate */ +#define BRLAPI_KEY_CMD_SAY_SLOWER (BRLAPI_KEY_CMD(0) + 66) +/** increase speaking rate */ +#define BRLAPI_KEY_CMD_SAY_FASTER (BRLAPI_KEY_CMD(0) + 67) +/** decrease speaking volume */ +#define BRLAPI_KEY_CMD_SAY_SOFTER (BRLAPI_KEY_CMD(0) + 68) +/** increase speaking volume */ +#define BRLAPI_KEY_CMD_SAY_LOUDER (BRLAPI_KEY_CMD(0) + 69) +/** switch to the previous virtual terminal */ +#define BRLAPI_KEY_CMD_SWITCHVT_PREV (BRLAPI_KEY_CMD(0) + 70) +/** switch to the next virtual terminal */ +#define BRLAPI_KEY_CMD_SWITCHVT_NEXT (BRLAPI_KEY_CMD(0) + 71) +/** bring screen cursor to current line */ +#define BRLAPI_KEY_CMD_CSRJMP_VERT (BRLAPI_KEY_CMD(0) + 72) +/** insert clipboard text after screen cursor */ +#define BRLAPI_KEY_CMD_PASTE (BRLAPI_KEY_CMD(0) + 73) +/** restart braille driver */ +#define BRLAPI_KEY_CMD_RESTARTBRL (BRLAPI_KEY_CMD(0) + 74) +/** restart speech driver */ +#define BRLAPI_KEY_CMD_RESTARTSPEECH (BRLAPI_KEY_CMD(0) + 75) +/** braille display temporarily unavailable */ +#define BRLAPI_KEY_CMD_OFFLINE (BRLAPI_KEY_CMD(0) + 76) +/** cycle the Shift sticky input modifier (next, on, off) */ +#define BRLAPI_KEY_CMD_SHIFT (BRLAPI_KEY_CMD(0) + 77) +/** cycle the Upper sticky input modifier (next, on, off) */ +#define BRLAPI_KEY_CMD_UPPER (BRLAPI_KEY_CMD(0) + 78) +/** cycle the Control sticky input modifier (next, on, off) */ +#define BRLAPI_KEY_CMD_CONTROL (BRLAPI_KEY_CMD(0) + 79) +/** cycle the Meta (Left Alt) sticky input modifier (next, on, off) */ +#define BRLAPI_KEY_CMD_META (BRLAPI_KEY_CMD(0) + 80) +/** show current date and time */ +#define BRLAPI_KEY_CMD_TIME (BRLAPI_KEY_CMD(0) + 81) +/** go to previous menu level */ +#define BRLAPI_KEY_CMD_MENU_PREV_LEVEL (BRLAPI_KEY_CMD(0) + 82) +/** set autospeak selected line on/off */ +#define BRLAPI_KEY_CMD_ASPK_SEL_LINE (BRLAPI_KEY_CMD(0) + 83) +/** set autospeak selected character on/off */ +#define BRLAPI_KEY_CMD_ASPK_SEL_CHAR (BRLAPI_KEY_CMD(0) + 84) +/** set autospeak inserted characters on/off */ +#define BRLAPI_KEY_CMD_ASPK_INS_CHARS (BRLAPI_KEY_CMD(0) + 85) +/** set autospeak deleted characters on/off */ +#define BRLAPI_KEY_CMD_ASPK_DEL_CHARS (BRLAPI_KEY_CMD(0) + 86) +/** set autospeak replaced characters on/off */ +#define BRLAPI_KEY_CMD_ASPK_REP_CHARS (BRLAPI_KEY_CMD(0) + 87) +/** set autospeak completed words on/off */ +#define BRLAPI_KEY_CMD_ASPK_CMP_WORDS (BRLAPI_KEY_CMD(0) + 88) +/** speak current character */ +#define BRLAPI_KEY_CMD_SPEAK_CURR_CHAR (BRLAPI_KEY_CMD(0) + 89) +/** go to and speak previous character */ +#define BRLAPI_KEY_CMD_SPEAK_PREV_CHAR (BRLAPI_KEY_CMD(0) + 90) +/** go to and speak next character */ +#define BRLAPI_KEY_CMD_SPEAK_NEXT_CHAR (BRLAPI_KEY_CMD(0) + 91) +/** speak current word */ +#define BRLAPI_KEY_CMD_SPEAK_CURR_WORD (BRLAPI_KEY_CMD(0) + 92) +/** go to and speak previous word */ +#define BRLAPI_KEY_CMD_SPEAK_PREV_WORD (BRLAPI_KEY_CMD(0) + 93) +/** go to and speak next word */ +#define BRLAPI_KEY_CMD_SPEAK_NEXT_WORD (BRLAPI_KEY_CMD(0) + 94) +/** speak current line */ +#define BRLAPI_KEY_CMD_SPEAK_CURR_LINE (BRLAPI_KEY_CMD(0) + 95) +/** go to and speak previous line */ +#define BRLAPI_KEY_CMD_SPEAK_PREV_LINE (BRLAPI_KEY_CMD(0) + 96) +/** go to and speak next line */ +#define BRLAPI_KEY_CMD_SPEAK_NEXT_LINE (BRLAPI_KEY_CMD(0) + 97) +/** go to and speak first non-blank character on line */ +#define BRLAPI_KEY_CMD_SPEAK_FRST_CHAR (BRLAPI_KEY_CMD(0) + 98) +/** go to and speak last non-blank character on line */ +#define BRLAPI_KEY_CMD_SPEAK_LAST_CHAR (BRLAPI_KEY_CMD(0) + 99) +/** go to and speak first non-blank line on screen */ +#define BRLAPI_KEY_CMD_SPEAK_FRST_LINE (BRLAPI_KEY_CMD(0) + 100) +/** go to and speak last non-blank line on screen */ +#define BRLAPI_KEY_CMD_SPEAK_LAST_LINE (BRLAPI_KEY_CMD(0) + 101) +/** describe current character */ +#define BRLAPI_KEY_CMD_DESC_CURR_CHAR (BRLAPI_KEY_CMD(0) + 102) +/** spell current word */ +#define BRLAPI_KEY_CMD_SPELL_CURR_WORD (BRLAPI_KEY_CMD(0) + 103) +/** bring screen cursor to speech cursor */ +#define BRLAPI_KEY_CMD_ROUTE_CURR_LOCN (BRLAPI_KEY_CMD(0) + 104) +/** speak speech cursor location */ +#define BRLAPI_KEY_CMD_SPEAK_CURR_LOCN (BRLAPI_KEY_CMD(0) + 105) +/** set speech cursor visibility on/off */ +#define BRLAPI_KEY_CMD_SHOW_CURR_LOCN (BRLAPI_KEY_CMD(0) + 106) +/** save clipboard to disk */ +#define BRLAPI_KEY_CMD_CLIP_SAVE (BRLAPI_KEY_CMD(0) + 107) +/** restore clipboard from disk */ +#define BRLAPI_KEY_CMD_CLIP_RESTORE (BRLAPI_KEY_CMD(0) + 108) +/** set braille typing mode dots/text */ +#define BRLAPI_KEY_CMD_BRLUCDOTS (BRLAPI_KEY_CMD(0) + 109) +/** set braille keyboard enabled/disabled */ +#define BRLAPI_KEY_CMD_BRLKBD (BRLAPI_KEY_CMD(0) + 110) +/** clear all sticky input modifiers */ +#define BRLAPI_KEY_CMD_UNSTICK (BRLAPI_KEY_CMD(0) + 111) +/** cycle the AltGr (Right Alt) sticky input modifier (next, on, off) */ +#define BRLAPI_KEY_CMD_ALTGR (BRLAPI_KEY_CMD(0) + 112) +/** cycle the GUI (Windows) sticky input modifier (next, on, off) */ +#define BRLAPI_KEY_CMD_GUI (BRLAPI_KEY_CMD(0) + 113) +/** stop the braille driver */ +#define BRLAPI_KEY_CMD_BRL_STOP (BRLAPI_KEY_CMD(0) + 114) +/** start the braille driver */ +#define BRLAPI_KEY_CMD_BRL_START (BRLAPI_KEY_CMD(0) + 115) +/** stop the speech driver */ +#define BRLAPI_KEY_CMD_SPK_STOP (BRLAPI_KEY_CMD(0) + 116) +/** start the speech driver */ +#define BRLAPI_KEY_CMD_SPK_START (BRLAPI_KEY_CMD(0) + 117) +/** stop the screen driver */ +#define BRLAPI_KEY_CMD_SCR_STOP (BRLAPI_KEY_CMD(0) + 118) +/** start the screen driver */ +#define BRLAPI_KEY_CMD_SCR_START (BRLAPI_KEY_CMD(0) + 119) +/** bind to the previous virtual terminal */ +#define BRLAPI_KEY_CMD_SELECTVT_PREV (BRLAPI_KEY_CMD(0) + 120) +/** bind to the next virtual terminal */ +#define BRLAPI_KEY_CMD_SELECTVT_NEXT (BRLAPI_KEY_CMD(0) + 121) +/** go backward to nearest non-blank braille window */ +#define BRLAPI_KEY_CMD_PRNBWIN (BRLAPI_KEY_CMD(0) + 122) +/** go forward to nearest non-blank braille window */ +#define BRLAPI_KEY_CMD_NXNBWIN (BRLAPI_KEY_CMD(0) + 123) +/** set touch navigation on/off */ +#define BRLAPI_KEY_CMD_TOUCH_NAV (BRLAPI_KEY_CMD(0) + 124) +/** speak indent of current line */ +#define BRLAPI_KEY_CMD_SPEAK_INDENT (BRLAPI_KEY_CMD(0) + 125) +/** set autospeak indent of current line on/off */ +#define BRLAPI_KEY_CMD_ASPK_INDENT (BRLAPI_KEY_CMD(0) + 126) +/** refresh braille display */ +#define BRLAPI_KEY_CMD_REFRESH (BRLAPI_KEY_CMD(0) + 127) +/** bring screen cursor to character */ +#define BRLAPI_KEY_CMD_ROUTE BRLAPI_KEY_CMD(1) +/** start new clipboard at character */ +#define BRLAPI_KEY_CMD_CLIP_NEW BRLAPI_KEY_CMD(2) +/** deprecated definition of CLIP_NEW - start new clipboard at character */ +#define BRLAPI_KEY_CMD_CUTBEGIN BRLAPI_KEY_CMD(2) +/** append to clipboard from character */ +#define BRLAPI_KEY_CMD_CLIP_ADD BRLAPI_KEY_CMD(3) +/** deprecated definition of CLIP_ADD - append to clipboard from character */ +#define BRLAPI_KEY_CMD_CUTAPPEND BRLAPI_KEY_CMD(3) +/** rectangular copy to character */ +#define BRLAPI_KEY_CMD_COPY_RECT BRLAPI_KEY_CMD(4) +/** deprecated definition of COPY_RECT - rectangular copy to character */ +#define BRLAPI_KEY_CMD_CUTRECT BRLAPI_KEY_CMD(4) +/** linear copy to character */ +#define BRLAPI_KEY_CMD_COPY_LINE BRLAPI_KEY_CMD(5) +/** deprecated definition of COPY_LINE - linear copy to character */ +#define BRLAPI_KEY_CMD_CUTLINE BRLAPI_KEY_CMD(5) +/** switch to specific virtual terminal */ +#define BRLAPI_KEY_CMD_SWITCHVT BRLAPI_KEY_CMD(6) +/** go up to nearest line with less indent than character */ +#define BRLAPI_KEY_CMD_PRINDENT BRLAPI_KEY_CMD(7) +/** go down to nearest line with less indent than character */ +#define BRLAPI_KEY_CMD_NXINDENT BRLAPI_KEY_CMD(8) +/** describe character */ +#define BRLAPI_KEY_CMD_DESCCHAR BRLAPI_KEY_CMD(9) +/** place left end of braille window at character */ +#define BRLAPI_KEY_CMD_SETLEFT BRLAPI_KEY_CMD(10) +/** remember current braille window position */ +#define BRLAPI_KEY_CMD_SETMARK BRLAPI_KEY_CMD(11) +/** go to remembered braille window position */ +#define BRLAPI_KEY_CMD_GOTOMARK BRLAPI_KEY_CMD(12) +/** go to selected line */ +#define BRLAPI_KEY_CMD_GOTOLINE BRLAPI_KEY_CMD(13) +/** go up to nearest line with different character */ +#define BRLAPI_KEY_CMD_PRDIFCHAR BRLAPI_KEY_CMD(14) +/** go down to nearest line with different character */ +#define BRLAPI_KEY_CMD_NXDIFCHAR BRLAPI_KEY_CMD(15) +/** copy characters to clipboard */ +#define BRLAPI_KEY_CMD_CLIP_COPY BRLAPI_KEY_CMD(16) +/** deprecated definition of CLIP_COPY - copy characters to clipboard */ +#define BRLAPI_KEY_CMD_COPYCHARS BRLAPI_KEY_CMD(16) +/** append characters to clipboard */ +#define BRLAPI_KEY_CMD_CLIP_APPEND BRLAPI_KEY_CMD(17) +/** deprecated definition of CLIP_APPEND - append characters to clipboard */ +#define BRLAPI_KEY_CMD_APNDCHARS BRLAPI_KEY_CMD(17) +/** insert clipboard history entry after screen cursor */ +#define BRLAPI_KEY_CMD_PASTE_HISTORY BRLAPI_KEY_CMD(18) +/** set text table */ +#define BRLAPI_KEY_CMD_SET_TEXT_TABLE BRLAPI_KEY_CMD(19) +/** set attributes table */ +#define BRLAPI_KEY_CMD_SET_ATTRIBUTES_TABLE BRLAPI_KEY_CMD(20) +/** set contraction table */ +#define BRLAPI_KEY_CMD_SET_CONTRACTION_TABLE BRLAPI_KEY_CMD(21) +/** set keyboard table */ +#define BRLAPI_KEY_CMD_SET_KEYBOARD_TABLE BRLAPI_KEY_CMD(22) +/** set language profile */ +#define BRLAPI_KEY_CMD_SET_LANGUAGE_PROFILE BRLAPI_KEY_CMD(23) +/** bring screen cursor to line */ +#define BRLAPI_KEY_CMD_ROUTE_LINE BRLAPI_KEY_CMD(24) +/** refresh braille line */ +#define BRLAPI_KEY_CMD_REFRESH_LINE BRLAPI_KEY_CMD(25) +/** bind to specific virtual terminal */ +#define BRLAPI_KEY_CMD_SELECTVT BRLAPI_KEY_CMD(30) +/** render an alert */ +#define BRLAPI_KEY_CMD_ALERT BRLAPI_KEY_CMD(31) +/** type braille dots */ +#define BRLAPI_KEY_CMD_PASSDOTS BRLAPI_KEY_CMD(34) +/** AT (set 2) keyboard scan code */ +#define BRLAPI_KEY_CMD_PASSAT BRLAPI_KEY_CMD(35) +/** XT (set 1) keyboard scan code */ +#define BRLAPI_KEY_CMD_PASSXT BRLAPI_KEY_CMD(36) +/** PS/2 (set 3) keyboard scan code */ +#define BRLAPI_KEY_CMD_PASSPS2 BRLAPI_KEY_CMD(37) +/** switch to command context */ +#define BRLAPI_KEY_CMD_CONTEXT BRLAPI_KEY_CMD(38) +/** current reading location */ +#define BRLAPI_KEY_CMD_TOUCH_AT BRLAPI_KEY_CMD(39) +/** enable feature */ +#define BRLAPI_KEY_FLG_TOGGLE_ON BRLAPI_KEY_FLG(0X0100) +/** disable feature */ +#define BRLAPI_KEY_FLG_TOGGLE_OFF BRLAPI_KEY_FLG(0X0200) +/** mask for all toggle flags */ +#define BRLAPI_KEY_FLG_TOGGLE_MASK (BRLAPI_KEY_FLG_TOGGLE_ON | BRLAPI_KEY_FLG_TOGGLE_OFF) +/** bring screen cursor into braille window after function */ +#define BRLAPI_KEY_FLG_MOTION_ROUTE BRLAPI_KEY_FLG(0X0400) +/** scale arg=0X00-0XFF to screen height */ +#define BRLAPI_KEY_FLG_MOTION_SCALED BRLAPI_KEY_FLG(0X0800) +/** go to beginning of line */ +#define BRLAPI_KEY_FLG_MOTION_TOLEFT BRLAPI_KEY_FLG(0X1000) +/** shift key pressed */ +#define BRLAPI_KEY_FLG_SHIFT BRLAPI_KEY_FLG(0X01) +/** convert to uppercase */ +#define BRLAPI_KEY_FLG_UPPER BRLAPI_KEY_FLG(0X02) +/** control key pressed */ +#define BRLAPI_KEY_FLG_CONTROL BRLAPI_KEY_FLG(0X04) +/** meta (left alt) key pressed */ +#define BRLAPI_KEY_FLG_META BRLAPI_KEY_FLG(0X08) +/** altgr (right alt) key pressed */ +#define BRLAPI_KEY_FLG_ALTGR BRLAPI_KEY_FLG(0X10) +/** gui (windows) key pressed */ +#define BRLAPI_KEY_FLG_GUI BRLAPI_KEY_FLG(0X20) +/** it is a release scan code */ +#define BRLAPI_KEY_FLG_KBD_RELEASE BRLAPI_KEY_FLG(0X0100) +/** it is an emulation 0 scan code */ +#define BRLAPI_KEY_FLG_KBD_EMUL0 BRLAPI_KEY_FLG(0X0200) +/** it is an emulation 1 scan code */ +#define BRLAPI_KEY_FLG_KBD_EMUL1 BRLAPI_KEY_FLG(0X0400) +/** upper-left dot of standard braille cell */ +#define BRLAPI_DOT1 1 +/** middle-left dot of standard braille cell */ +#define BRLAPI_DOT2 2 +/** lower-left dot of standard braille cell */ +#define BRLAPI_DOT3 4 +/** upper-right dot of standard braille cell */ +#define BRLAPI_DOT4 8 +/** middle-right dot of standard braille cell */ +#define BRLAPI_DOT5 16 +/** lower-right dot of standard braille cell */ +#define BRLAPI_DOT6 32 +/** lower-left dot of computer braille cell */ +#define BRLAPI_DOT7 64 +/** lower-right dot of computer braille cell */ +#define BRLAPI_DOT8 128 +/** chord (space bar on braille keyboard) */ +#define BRLAPI_DOTC 256 + +/** Helper macro to easily produce braille patterns */ +#define BRLAPI_DOTS(dot1, dot2, dot3, dot4, dot5, dot6, dot7, dot8) (\ + ((dot1)? BRLAPI_DOT1: 0) | \ + ((dot2)? BRLAPI_DOT2: 0) | \ + ((dot3)? BRLAPI_DOT3: 0) | \ + ((dot4)? BRLAPI_DOT4: 0) | \ + ((dot5)? BRLAPI_DOT5: 0) | \ + ((dot6)? BRLAPI_DOT6: 0) | \ + ((dot7)? BRLAPI_DOT7: 0) | \ + ((dot8)? BRLAPI_DOT8: 0) \ +) + +/** space key */ +#define BRLAPI_DOT_CHORD 256 +/** @} */ + + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* BRLAPI_INCLUDED_CONSTANTS */ diff --git a/chromium/third_party/libbrlapi/brlapi_keycodes.h b/chromium/third_party/libbrlapi/brlapi_keycodes.h new file mode 100644 index 00000000000..c49c9585f58 --- /dev/null +++ b/chromium/third_party/libbrlapi/brlapi_keycodes.h @@ -0,0 +1,191 @@ +/* + * libbrlapi - A library providing access to braille terminals for applications. + * + * Copyright (C) 2002-2020 by + * Samuel Thibault <Samuel.Thibault@ens-lyon.org> + * Sébastien Hinderer <Sebastien.Hinderer@ens-lyon.org> + * + * libbrlapi comes with ABSOLUTELY NO WARRANTY. + * + * This is free software, placed under the terms of the + * GNU Lesser General Public License, as published by the Free Software + * Foundation; either version 2.1 of the License, or (at your option) any + * later version. Please see the file LICENSE-LGPL for details. + * + * Web Page: http://brltty.app/ + * + * This software is maintained by Dave Mielke <dave@mielke.cc>. + */ + +/** \file + */ + +#ifndef BRLAPI_INCLUDED_KEYCODES +#define BRLAPI_INCLUDED_KEYCODES + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +/** \defgroup brlapi_keycodes Types and Defines for \e BrlAPI Key Codes + * + * Key codes are unsigned 64 bit integers. This 64-bit space is split into 3 + * parts: + * + * - bits 63-32 (BRLAPI_KEY_FLAGS_MASK), flags: bits 39-32 are standard X + * modifiers (shift, control, meta, ...). Other flags are used for some commands, + * see documentation of BRLAPI_KEY_FLG_* for their respective uses. + * - bits 31-29 (BRLAPI_KEY_TYPE_MASK), key type: either BRLAPI_KEY_TYPE_CMD for + * braille commands, or BRLAPI_KEY_TYPE_SYM for standard X keysyms. + * - bits 28-0 (BRLAPI_KEY_CODE_MASK), key code: for braille commands, see + * BRLAPI_KEY_CMD_* ; for standard X keysyms, this is the keysym value, see + * X11 documentation, a complete list is probably available on your system in + * /usr/include/X11/keysymdef.h + * + * The third part is itself split into two parts: a command number and a command + * value. The relative sizes of these parts vary according to the key type. + * + * For a braille command, bits 28-16 (BRLAPI_KEY_CMD_BLK_MASK) hold the braille + * command number, while bits 15-0 (BRLAPI_KEY_CMD_ARG_MASK) hold the command + * value. + * + * For a X keysym, if it is a unicode keysym (0x1uvwxyz), then the command + * number part is 0x1000000 and the value part is 0xuvwxyz. Else, the command + * part is held by bits 28-8 and the value part is held by bits 7-0. This + * permits to easily handle usual cases like 0x00xy (latin1), 0x01xy (latin2), + * XK_Backspace (0xff08, backspace), XK_Tab (0xff09, tab), ... + * + * For instance, if key == 0x0000000020010008, + * - (key & BRLAPI_KEY_TYPE_MASK) == BRLAPI_KEY_TYPE_CMD, so it's a braille + * command + * - (key & BRLAPI_KEY_CMD_BLK_MASK) == BRLAPI_KEY_CMD_ROUTE, so it's the + * braille route command. + * - (key & BRLAPI_KEY_CMD_ARG_MASK) == 8, so the highlighted cell is the 9th + * one (cells are numbered from 0) + * - (key & BRLAPI_KEY_FLAGS_MASK) == 0, so no modifier key was pressed during + * the command, and no particular flag applies to the command. + * + * if key == 0x000000010000FF09, + * - (key & BRLAPI_KEY_TYPE_MASK) == BRLAPI_KEY_TYPE_SYM, so it's a keysym + * - (key & BRLAPI_KEY_CODE_MASK) == XK_Tab, so it's the tab key. + * BRLAPI_KEY_SYM_TAB can also be used here, as well as a few other + * BRLAPI_KEY_SYM_* constants which are provided to avoid having to include + * X11/keysymdef.h + * - (key & BRLAPI_KEY_FLAGS_MASK) == BRLAPI_KEY_FLG_SHIFT, so the shift + * modifier was pressed during the command. + * + * in the X11 standard some keysyms are directly unicode, for instance if + * key == 0x0000000001001EA0, + * - (key & BRLAPI_KEY_TYPE_MASK) == BRLAPI_KEY_TYPE_SYM, so it's a keysym + * - (key & BRLAPI_KEY_SYM_UNICODE) != 0 so it's a unicode keysym, whose value + * is key & (BRLAPI_KEY_SYM_UNICODE-1). Of course, one can also consider + * (key & BRLAPI_KEY_CODE_MASK) == XK_Abelowdot + * - (key & BRLAPI_KEY_FLAGS_MASK) == 0, so no modifier key was pressed during + * the command, and no particular flag applies to the command. + * + * The brlapi_expandKeyCode() function may be used for splitting key codes into + * these parts. + * @{ + */ +typedef uint64_t brlapi_keyCode_t; + +/** Define a brlapi_keyCode_t constant */ +#define BRLAPI_KEYCODE_C(value) UINT64_C(value) + +/** Hexadecimal print format for brlapi_keyCode_t */ +#define BRLAPI_PRIxKEYCODE PRIx64 + +/** Unsigned decimal print format for brlapi_keyCode_t */ +#define BRLAPI_PRIuKEYCODE PRIu64 + +/** Brlapi_keyCode_t's biggest value + * + * As defined in \c <stdint.h> */ +#define BRLAPI_KEY_MAX UINT64_C(0XFFFFFFFFFFFFFFFF) + +/** + * Mask for flags of brlapi_keyCode_t + */ +#define BRLAPI_KEY_FLAGS_MASK UINT64_C(0XFFFFFFFF00000000) +/** Shift for flags of brlapi_keyCode_t */ +#define BRLAPI_KEY_FLAGS_SHIFT 32 + +#define BRLAPI_KEY_FLG(v) ((brlapi_keyCode_t)(v) << BRLAPI_KEY_FLAGS_SHIFT) +/** Standard X modifiers */ +/** Mod1 modifier (AKA meta) */ +#define BRLAPI_KEY_FLG_MOD1 BRLAPI_KEY_FLG(0x00000008) +/** Mod2 modifier (usually numlock) */ +#define BRLAPI_KEY_FLG_MOD2 BRLAPI_KEY_FLG(0x00000010) +/** Mod3 modifier */ +#define BRLAPI_KEY_FLG_MOD3 BRLAPI_KEY_FLG(0x00000020) +/** Mod4 modifier */ +#define BRLAPI_KEY_FLG_MOD4 BRLAPI_KEY_FLG(0x00000040) +/** Mod5 modifier (usually Alt-Gr) */ +#define BRLAPI_KEY_FLG_MOD5 BRLAPI_KEY_FLG(0x00000080) + + +/** + * Mask for type of brlapi_keyCode_t + */ +#define BRLAPI_KEY_TYPE_MASK UINT64_C(0X00000000E0000000) +/** Shift for type of brlapi_keyCode_t */ +#define BRLAPI_KEY_TYPE_SHIFT 29 +/** Braille command brlapi_keyCode_t */ +#define BRLAPI_KEY_TYPE_CMD UINT64_C(0X0000000020000000) +/** X Keysym brlapi_keyCode_t */ +#define BRLAPI_KEY_TYPE_SYM UINT64_C(0X0000000000000000) + +/** + * Mask for code of brlapi_keyCode_t + */ +#define BRLAPI_KEY_CODE_MASK UINT64_C(0X000000001FFFFFFF) +/** Shift for code of brlapi_keyCode_t */ +#define BRLAPI_KEY_CODE_SHIFT 0 + +/** Mask for braille command type */ +#define BRLAPI_KEY_CMD_BLK_MASK UINT64_C(0X1FFF0000) +/** Shift for braille command type */ +#define BRLAPI_KEY_CMD_BLK_SHIFT 16 +/** Mask for braille command value */ +#define BRLAPI_KEY_CMD_ARG_MASK UINT64_C(0X0000FFFF) +/** Shift for braille command value */ +#define BRLAPI_KEY_CMD_ARG_SHIFT 0 +#define BRLAPI_KEY_CMD(v) ((v) << BRLAPI_KEY_CMD_BLK_SHIFT) + +/** Standard X keysyms */ +#define BRLAPI_KEY_SYM_BACKSPACE UINT64_C(0X0000FF08) +#define BRLAPI_KEY_SYM_TAB UINT64_C(0X0000FF09) +#define BRLAPI_KEY_SYM_LINEFEED UINT64_C(0X0000FF0D) +#define BRLAPI_KEY_SYM_ESCAPE UINT64_C(0X0000FF1B) +#define BRLAPI_KEY_SYM_HOME UINT64_C(0X0000FF50) +#define BRLAPI_KEY_SYM_LEFT UINT64_C(0X0000FF51) +#define BRLAPI_KEY_SYM_UP UINT64_C(0X0000FF52) +#define BRLAPI_KEY_SYM_RIGHT UINT64_C(0X0000FF53) +#define BRLAPI_KEY_SYM_DOWN UINT64_C(0X0000FF54) +#define BRLAPI_KEY_SYM_PAGE_UP UINT64_C(0X0000FF55) +#define BRLAPI_KEY_SYM_PAGE_DOWN UINT64_C(0X0000FF56) +#define BRLAPI_KEY_SYM_END UINT64_C(0X0000FF57) +#define BRLAPI_KEY_SYM_INSERT UINT64_C(0X0000FF63) +#define BRLAPI_KEY_SYM_FUNCTION UINT64_C(0X0000FFBE) +#define BRLAPI_KEY_SYM_DELETE UINT64_C(0X0000FFFF) +#define BRLAPI_KEY_SYM_UNICODE UINT64_C(0X01000000) + +/** + * Flag for a raw keycode press vs release + * + * When brlapi_enterTtyMode() has been called with a driver name, + * brlapi_readKey() and brlapi_readKeyWithTimeout() will return + * driver-specific key codes except for the common BRLAPI_DRV_KEY_PRESS flag + * which indicates that it's a key press (as opposed to a release) event. + */ +#define BRLAPI_DRV_KEY_PRESS BRLAPI_KEYCODE_C(0X8000000000000000) + +/** @} */ + +#include "brlapi_constants.h" + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* BRLAPI_INCLUDED_KEYCODES */ diff --git a/chromium/third_party/libbrlapi/brlapi_param.h b/chromium/third_party/libbrlapi/brlapi_param.h new file mode 100644 index 00000000000..141b38ef368 --- /dev/null +++ b/chromium/third_party/libbrlapi/brlapi_param.h @@ -0,0 +1,289 @@ +/* + * libbrlapi - A library providing access to braille terminals for applications. + * + * Copyright (C) 2002-2020 by + * Samuel Thibault <Samuel.Thibault@ens-lyon.org> + * Sébastien Hinderer <Sebastien.Hinderer@ens-lyon.org> + * + * libbrlapi comes with ABSOLUTELY NO WARRANTY. + * + * This is free software, placed under the terms of the + * GNU Lesser General Public License, as published by the Free Software + * Foundation; either version 2.1 of the License, or (at your option) any + * later version. Please see the file LICENSE-LGPL for details. + * + * Web Page: http://brltty.app/ + * + * This software is maintained by Dave Mielke <dave@mielke.cc>. + */ + +/** \file + */ + +#ifndef BRLAPI_INCLUDED_PARAM +#define BRLAPI_INCLUDED_PARAM + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +#include "brlapi_keycodes.h" + +/** \ingroup brlapi_parameterManagement + * + * @{ */ + +typedef enum { +//Connection Parameters + BRLAPI_PARAM_SERVER_VERSION = 0, /**< Version of the server: uint32_t */ + BRLAPI_PARAM_CLIENT_PRIORITY = 1, /**< Priority of the client: uint32_t (from 0 through 100, default is 50) */ + +//Device Parameters + BRLAPI_PARAM_DRIVER_NAME = 2, /**< Full name of the driver: string */ + BRLAPI_PARAM_DRIVER_CODE = 3, /**< Code (short name) of the driver: string */ + BRLAPI_PARAM_DRIVER_VERSION = 4, /**< Version of the driver: string */ + BRLAPI_PARAM_DEVICE_MODEL = 5, /**< Model of the device: string */ + BRLAPI_PARAM_DEVICE_CELL_SIZE = 31, /**< Number of dots in a cell: uint8_t */ + BRLAPI_PARAM_DISPLAY_SIZE = 6, /**< Dimensions of the braille display: { uint32_t columns; uint32_t rows; } */ + BRLAPI_PARAM_DEVICE_IDENTIFIER = 7, /**< Identifier of the device: string */ + BRLAPI_PARAM_DEVICE_SPEED = 8, /**< Speed of the device: uint32_t */ + BRLAPI_PARAM_DEVICE_ONLINE = 9, /**< Device is online: boolean */ +/* TODO: status area */ + +//Input Parameters + BRLAPI_PARAM_RETAIN_DOTS = 10, /**< Pass dot combinations (rather than characters): boolean */ + +//Braille Rendering Parameters + BRLAPI_PARAM_COMPUTER_BRAILLE_CELL_SIZE = 11, /**< Number of dots used to render a computer braille character: uint8_t (8 or 6) */ + BRLAPI_PARAM_LITERARY_BRAILLE = 12, /**< Whether braille is literary (rather than computer): boolean */ + BRLAPI_PARAM_CURSOR_DOTS = 13, /**< Representation of the cursor: uint8_t (ISO 11548-1) */ + BRLAPI_PARAM_CURSOR_BLINK_PERIOD = 14, /**< Blinking period of the cursor: uint32_t (milliseconds) */ + BRLAPI_PARAM_CURSOR_BLINK_PERCENTAGE = 15, /**< Portion of the blinking period that the cursor is visible: uint8_t (from 0 through 100) */ + BRLAPI_PARAM_RENDERED_CELLS = 16, /**< Cells rendered by the client: uint8_t[] (ISO 11548-1), one cell per element */ + +//Navigation Parameters + BRLAPI_PARAM_SKIP_IDENTICAL_LINES = 17, /**< Whether to skip identical screen lines: boolean */ + BRLAPI_PARAM_AUDIBLE_ALERTS = 18, /**< Whether to use audible alerts: boolean */ + +//Clipboard Parameters + BRLAPI_PARAM_CLIPBOARD_CONTENT = 19, /**< Content of the clipboard: UTF-8 string */ + +//TTY Mode Parameters + BRLAPI_PARAM_BOUND_COMMAND_CODES = 20, /**< Commands bound for the device: + * uint64_t[], one command code per element */ + BRLAPI_PARAM_COMMAND_SHORT_NAME = 21, /**< Short name for a command + * (specified via the subparam argument): + * string (usually a few characters) */ + BRLAPI_PARAM_COMMAND_LONG_NAME = 22, /**< Long name for a command + * (specified via the subparam argument): + * string (usually a few words) */ + +//Raw Mode Parameters + BRLAPI_PARAM_DEVICE_KEY_CODES = 23, /**< Keys defined for the device: + * uint64_t[], one key code per element */ + BRLAPI_PARAM_KEY_SHORT_NAME = 24, /**< Short name for a key + * (specified via the subparam argument): + * string (usually a few characters) */ + BRLAPI_PARAM_KEY_LONG_NAME = 25, /**< Long name for a key + * (specified via the subparam argument): + * string (usually a few words) */ + +//Braille Translation Parameters + BRLAPI_PARAM_COMPUTER_BRAILLE_ROWS_MASK = 26, /**< Set of Unicode rows that are defined for computer braille + * (from U+0000 through U+10FFFF): + * uint8_t[544], one bit per row, eight rows per element */ + BRLAPI_PARAM_COMPUTER_BRAILLE_ROW_CELLS = 27, /**< Computer braille cells for a Unicode row + * (specified via the subparam argument): + * uint8_t[256] (ISO 11548-1), one cell per element */ + BRLAPI_PARAM_COMPUTER_BRAILLE_TABLE = 28, /**< Name of the computer braille table: string */ + BRLAPI_PARAM_LITERARY_BRAILLE_TABLE = 29, /**< Name of the literary braille table: string */ + BRLAPI_PARAM_MESSAGE_LOCALE = 30, /**< Locale to use for messages: string */ +/* TODO: dot-to-unicode as well */ + + /* TODO: help strings */ + + BRLAPI_PARAM_COUNT = 32 /** Number of parameters */ +} brlapi_param_t; + +/* brlapi_param_subparam_t */ +/** Type to be used for specifying a sub-parameter */ +typedef uint64_t brlapi_param_subparam_t; + +/* brlapi_param_bool_t */ +/** Type to be used for boolean parameters */ +typedef uint8_t brlapi_param_bool_t; + +/* brlapi_param_serverVersion_t */ +/** Type to be used for BRLAPI_PARAM_SERVER_VERSION */ +typedef uint32_t brlapi_param_serverVersion_t; + +/* brlapi_param_clientPriority_t */ +/** Type to be used for BRLAPI_PARAM_CLIENT_PRIORITY */ +typedef uint32_t brlapi_param_clientPriority_t; + +/* BRLAPI_PARAM_CLIENT_PRIORITY_DEFAULT */ +/** Default value for BRLAPI_PARAM_CLIENT_PRIORITY */ +#define BRLAPI_PARAM_CLIENT_PRIORITY_DEFAULT 50 + +/* brlapi_param_driverName_t */ +/** Type to be used for BRLAPI_PARAM_DRIVER_NAME */ +typedef char *brlapi_param_driverName_t; + +/* brlapi_param_driverCode_t */ +/** Type to be used for BRLAPI_PARAM_DRIVER_CODE */ +typedef char *brlapi_param_driverCode_t; + +/* brlapi_param_driverVersion_t */ +/** Type to be used for BRLAPI_PARAM_DRIVER_VERSION */ +typedef char *brlapi_param_driverVersion_t; + +/* brlapi_param_deviceModel_t */ +/** Type to be used for BRLAPI_PARAM_DEVICE_MODEL */ +typedef char *brlapi_param_deviceModel_t; + +/* brlapi_param_deviceCellSize_t */ +/** Type to be used for BRLAPI_PARAM_DEVICE_CELL_SIZE */ +typedef uint8_t brlapi_param_deviceCellSize_t; + +/* brlapi_param_displaySize_t */ +/** Type to be used for BRLAPI_PARAM_DISPLAY_SIZE */ +typedef struct { + uint32_t columns; + uint32_t rows; +} brlapi_param_displaySize_t; + +/* brlapi_param_deviceIdentifier_t */ +/** Type to be used for BRLAPI_PARAM_DEVICE_IDENTIFIER */ +typedef char *brlapi_param_deviceIdentifier_t; + +/* brlapi_param_deviceSpeed_t */ +/** Type to be used for BRLAPI_PARAM_DEVICE_SPEED */ +typedef uint32_t brlapi_param_deviceSpeed_t; + +/* brlapi_param_deviceOnline_t */ +/** Type to be used for BRLAPI_PARAM_DEVICE_ONLINE */ +typedef brlapi_param_bool_t brlapi_param_deviceOnline_t; + +/* brlapi_param_retainDots_t */ +/** Type to be used for BRLAPI_PARAM_RETAIN_DOTS */ +typedef brlapi_param_bool_t brlapi_param_retainDots_t; + +/* brlapi_param_computerBrailleCellSize_t */ +/** Type to be used for BRLAPI_PARAM_COMPUTER_BRAILLE_CELL_SIZE */ +typedef uint8_t brlapi_param_computerBrailleCellSize_t; + +/* brlapi_param_literaryBraille_t */ +/** Type to be used for BRLAPI_PARAM_LITERARY_BRAILLE */ +typedef brlapi_param_bool_t brlapi_param_literaryBraille_t; + +/* brlapi_param_cursorDots_t */ +/** Type to be used for BRLAPI_PARAM_CURSOR_DOTS */ +typedef uint8_t brlapi_param_cursorDots_t; + +/* brlapi_param_cursorBlinkPeriod_t */ +/** Type to be used for BRLAPI_PARAM_CURSOR_BLINK_PERIOD */ +typedef uint32_t brlapi_param_cursorBlinkPeriod_t; + +/* brlapi_param_cursorBlinkPercentage_t */ +/** Type to be used for BRLAPI_PARAM_CURSOR_BLINK_PERCENTAGE */ +typedef uint8_t brlapi_param_cursorBlinkPercentage_t; + +/* brlapi_param_renderedCells_t */ +/** Type to be used for BRLAPI_PARAM_RENDERED_CELLS */ +typedef uint8_t *brlapi_param_renderedCells_t; + +/* brlapi_param_skipIdenticalLines_t */ +/** Type to be used for BRLAPI_PARAM_SKIP_IDENTICAL_LINES */ +typedef brlapi_param_bool_t brlapi_param_skipIdenticalLines_t; + +/* brlapi_param_audibleAlerts_t */ +/** Type to be used for BRLAPI_PARAM_AUDIBLE_ALERTS */ +typedef brlapi_param_bool_t brlapi_param_audibleAlerts_t; + +/* brlapi_param_clipboardContent_t */ +/** Type to be used for BRLAPI_PARAM_CLIPBOARD_CONTENT */ +typedef char *brlapi_param_clipboardContent_t; + +/* brlapi_param_commandCode_t */ +/** Type to be used for BRLAPI_PARAM_BOUND_COMMAND_CODES */ +typedef brlapi_keyCode_t brlapi_param_commandCode_t; + +/* brlapi_param_commandShortName_t */ +/** Type to be used for BRLAPI_PARAM_COMMAND_SHORT_NAME */ +typedef char *brlapi_param_commandShortName_t; + +/* brlapi_param_commandLongName_t */ +/** Type to be used for BRLAPI_PARAM_COMMAND_LONG_NAME */ +typedef char *brlapi_param_commandLongName_t; + +/* brlapi_param_keyCode_t */ +/** Type to be used for BRLAPI_PARAM_DEVICE_KEY_CODES */ +typedef brlapi_keyCode_t brlapi_param_keyCode_t; + +/* brlapi_param_keyShortName_t */ +/** Type to be used for BRLAPI_PARAM_KEY_SHORT_NAME */ +typedef char *brlapi_param_keyShortName_t; + +/* brlapi_param_keyLongName_t */ +/** Type to be used for BRLAPI_PARAM_KEY_LONG_NAME */ +typedef char *brlapi_param_keyLongName_t; + +/* brlapi_param_computerBrailleRowsMask_t */ +/** Type to be used for BRLAPI_PARAM_COMPUTER_BRAILLE_ROWS_MASK */ +typedef uint8_t brlapi_param_computerBrailleRowsMask_t[544]; + +/* brlapi_param_computerBrailleRowCells_t */ +/** Type to be used for BRLAPI_PARAM_COMPUTER_BRAILLE_ROW_CELLS */ +typedef struct { + uint8_t cells[0X100]; + uint8_t defined[0X100 / 8]; +} brlapi_param_computerBrailleRowCells_t; + +/* brlapi_param_computerBrailleTable_t */ +/** Type to be used for BRLAPI_PARAM_COMPUTER_BRAILLE_TABLE */ +typedef char *brlapi_param_computerBrailleTable_t; + +/* brlapi_param_literaryBrailleTable_t */ +/** Type to be used for BRLAPI_PARAM_LITERARY_BRAILLE_TABLE */ +typedef char *brlapi_param_literaryBrailleTable_t; + +/* brlapi_param_messageLocale_t */ +/** Type to be used for BRLAPI_PARAM_MESSAGE_LOCALE */ +typedef char *brlapi_param_messageLocale_t; + +/** Enumeration of parameter value types */ +typedef enum { + BRLAPI_PARAM_TYPE_STRING, /**< Parameter is a string of UTF-8 characters */ + BRLAPI_PARAM_TYPE_BOOLEAN, /**< Parameter is one or more booleans represented by a uint8_t */ + BRLAPI_PARAM_TYPE_UINT8, /**< Parameter is one or more 8-bit unsigned integers */ + BRLAPI_PARAM_TYPE_UINT16, /**< Parameter is one or more 16-bit unsigned integers */ + BRLAPI_PARAM_TYPE_UINT32, /**< Parameter is one or more 32-bit unsigned integers */ + BRLAPI_PARAM_TYPE_UINT64, /**< Parameter is one or more 64-bit unsigned integers */ + BRLAPI_PARAM_TYPE_KEYCODE = BRLAPI_PARAM_TYPE_UINT64, /**< Parameter is one or more key codes */ +} brlapi_param_type_t; + +/** Structure that describes the properties of a parameter */ +typedef struct { + brlapi_param_type_t type; /**< Type of the parameter's value */ + uint16_t count; /**< Number of elements in the parameter's value */ + uint8_t isArray; /**< Whether the parameter contains several values, or always only one */ + uint8_t hasSubparam; /**< Parameter uses the subparam argument */ +} brlapi_param_properties_t; + +/** Enumeration of parameter types */ +/* brlapi_getParameterProperties */ +/** Return a description of the properties of a parameter + * + * \param parameter is the parameter whose properties describion shall be returned. + * + * \return a pointer to the description of the properties of the parameter. + */ +extern const brlapi_param_properties_t *brlapi_getParameterProperties(brlapi_param_t parameter); + +/** @} */ + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* BRLAPI_INCLUDED_PARAM */ diff --git a/chromium/third_party/libbrlapi/brlapi_protocol.h b/chromium/third_party/libbrlapi/brlapi_protocol.h new file mode 100644 index 00000000000..f82d2f1aeb1 --- /dev/null +++ b/chromium/third_party/libbrlapi/brlapi_protocol.h @@ -0,0 +1,308 @@ +/* + * libbrlapi - A library providing access to braille terminals for applications. + * + * Copyright (C) 2002-2020 by + * Samuel Thibault <Samuel.Thibault@ens-lyon.org> + * Sébastien Hinderer <Sebastien.Hinderer@ens-lyon.org> + * + * libbrlapi comes with ABSOLUTELY NO WARRANTY. + * + * This is free software, placed under the terms of the + * GNU Lesser General Public License, as published by the Free Software + * Foundation; either version 2.1 of the License, or (at your option) any + * later version. Please see the file LICENSE-LGPL for details. + * + * Web Page: http://brltty.app/ + * + * This software is maintained by Dave Mielke <dave@mielke.cc>. + */ + +/** \file + * \brief types and constants for \e BrlAPI's protocol + */ + +#ifndef BRLAPI_INCLUDED_PROTOCOL +#define BRLAPI_INCLUDED_PROTOCOL + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +#include "brlapi.h" + +/* this is for UINT32_MAX */ +#include <inttypes.h> +#ifndef UINT32_MAX +#define UINT32_MAX (4294967295U) +#endif /* UINT32_MAX */ + +/* The type size_t is defined there! */ +#include <unistd.h> + +/** \defgroup brlapi_protocol BrlAPI's protocol + * \brief Instructions and constants for \e BrlAPI 's protocol + * + * These are defines for the protocol between \e BrlAPI 's server and clients. + * Understanding is not needed to use the \e BrlAPI library, so reading this + * is not needed unless really wanting to connect to \e BrlAPI without + * \e BrlAPI 's library. + * + * @{ */ + +#define BRLAPI_PROTOCOL_VERSION ((uint32_t) 8) /** Communication protocol version */ + +/** Maximum packet size for packets exchanged on sockets and with braille + * terminal */ +#define BRLAPI_MAXPACKETSIZE 4096 + +#define BRLAPI_PACKET_VERSION 'v' /**< Version */ +#define BRLAPI_PACKET_AUTH 'a' /**< Authorization */ +#define BRLAPI_PACKET_GETDRIVERNAME 'n' /**< Ask which driver is used */ +#define BRLAPI_PACKET_GETMODELID 'd' /**< Ask which model is used */ +#define BRLAPI_PACKET_GETDISPLAYSIZE 's' /**< Dimensions of brl display */ +#define BRLAPI_PACKET_ENTERTTYMODE 't' /**< Asks for a specified tty */ +#define BRLAPI_PACKET_SETFOCUS 'F' /**< Set current tty focus */ +#define BRLAPI_PACKET_LEAVETTYMODE 'L' /**< Release the tty */ +#define BRLAPI_PACKET_KEY 'k' /**< Braille key */ +#define BRLAPI_PACKET_IGNOREKEYRANGES 'm' /**< Mask key ranges */ +#define BRLAPI_PACKET_ACCEPTKEYRANGES 'u' /**< Unmask key ranges */ +#define BRLAPI_PACKET_WRITE 'w' /**< Write */ +#define BRLAPI_PACKET_ENTERRAWMODE '*' /**< Enter in raw mode */ +#define BRLAPI_PACKET_LEAVERAWMODE '#' /**< Leave raw mode */ +#define BRLAPI_PACKET_PACKET 'p' /**< Raw packets */ +#define BRLAPI_PACKET_ACK 'A' /**< Acknowledgement */ +#define BRLAPI_PACKET_ERROR 'e' /**< non-fatal error */ +#define BRLAPI_PACKET_EXCEPTION 'E' /**< Exception */ +#define BRLAPI_PACKET_SUSPENDDRIVER 'S' /**< Suspend driver */ +#define BRLAPI_PACKET_RESUMEDRIVER 'R' /**< Resume driver */ +#define BRLAPI_PACKET_PARAM_VALUE (('P'<<8) + 'V') /**< Parameter value */ +#define BRLAPI_PACKET_PARAM_REQUEST (('P'<<8) + 'R') /**< Parameter request*/ +#define BRLAPI_PACKET_PARAM_UPDATE (('P'<<8) + 'U') /**< Parameter update */ + +/** Magic number to give when sending a BRLPACKET_ENTERRAWMODE or BRLPACKET_SUSPEND packet */ +#define BRLAPI_DEVICE_MAGIC (0xdeadbeefL) + +/** Structure of packets headers */ +typedef struct { + uint32_t size; + brlapi_packetType_t type; +} brlapi_header_t; + +/** Size of packet headers */ +#define BRLAPI_HEADERSIZE sizeof(brlapi_header_t) + +/** Structure of version packets */ +typedef struct { + uint32_t protocolVersion; +} brlapi_versionPacket_t; + +/** Structure of authorization packets */ +typedef struct { + uint32_t type; + unsigned char key; +} brlapi_authClientPacket_t; + +typedef struct { + uint32_t type[1]; +} brlapi_authServerPacket_t; + +#define BRLAPI_AUTH_NONE 'N' /**< No or implicit authorization */ +#define BRLAPI_AUTH_KEY 'K' /**< Key authorization */ +#define BRLAPI_AUTH_CRED 'C' /**< Explicit socket credentials authorization */ + +/** Structure of error packets */ +typedef struct { + uint32_t code; + brlapi_packetType_t type; + unsigned char packet; +} brlapi_errorPacket_t; + +/** Structure of enterRawMode / suspend packets */ +typedef struct { + uint32_t magic; + unsigned char nameLength; + char name; +} brlapi_getDriverSpecificModePacket_t; + +/** Flags for writing */ +#define BRLAPI_WF_DISPLAYNUMBER 0X01 /**< Display number */ +#define BRLAPI_WF_REGION 0X02 /**< Region parameter */ +#define BRLAPI_WF_TEXT 0X04 /**< Contains some text */ +#define BRLAPI_WF_ATTR_AND 0X08 /**< And attributes */ +#define BRLAPI_WF_ATTR_OR 0X10 /**< Or attributes */ +#define BRLAPI_WF_CURSOR 0X20 /**< Cursor position */ +#define BRLAPI_WF_CHARSET 0X40 /**< Charset */ + +/** Structure of extended write packets */ +typedef struct { + uint32_t flags; /** Flags to tell which fields are present */ + unsigned char data; /** Fields in the same order as flag weight */ +} brlapi_writeArgumentsPacket_t; + +/** Flags for parameter values */ +#define BRLAPI_PVF_GLOBAL 0X01 /** Value is the global value */ + +#define BRLAPI_MAXPARAMSIZE (BRLAPI_MAXPACKETSIZE - (sizeof(uint32_t) + sizeof(brlapi_param_t) + 2*sizeof(uint32_t))) + +/** Structure of Parameter value or update */ +typedef struct { + uint32_t flags; /** Flags to tell how value was gotten */ + brlapi_param_t param; /** Which parameter being transmitted */ + uint32_t subparam_hi; /** Which sub-parameter being transmitted, hi 32bits */ + uint32_t subparam_lo; /** Which sub-parameter being transmitted, lo 32bits */ + unsigned char data[BRLAPI_MAXPARAMSIZE]; /** Content of the parameter */ +} brlapi_paramValuePacket_t; + +/** Flags for parameter requests */ +#define BRLAPI_PARAMF_GET 0X100 /** Get current parameter value */ +#define BRLAPI_PARAMF_SUBSCRIBE 0X200 /** Subscribe to parameter updates */ +#define BRLAPI_PARAMF_UNSUBSCRIBE 0X400 /** Unsubscribe from parameter updates */ + +/** Structure of Parameter request */ +typedef struct { + uint32_t flags; /** Flags to tell whether/how to get values */ + brlapi_param_t param; /** Which parameter to be transmitted */ + uint32_t subparam_hi; /** Which sub-parameter being transmitted, hi 32bits */ + uint32_t subparam_lo; /** Which sub-parameter being transmitted, lo 32bits */ +} brlapi_paramRequestPacket_t; + +/** Type for packets. Should be used instead of a mere char[], since it has + * correct alignment requirements. */ +typedef union { + unsigned char data[BRLAPI_MAXPACKETSIZE]; + brlapi_versionPacket_t version; + brlapi_authClientPacket_t authClient; + brlapi_authServerPacket_t authServer; + brlapi_errorPacket_t error; + brlapi_getDriverSpecificModePacket_t getDriverSpecificMode; + brlapi_writeArgumentsPacket_t writeArguments; + brlapi_paramValuePacket_t paramValue; + brlapi_paramRequestPacket_t paramRequest; + uint32_t uint32; +} brlapi_packet_t; + +/* brlapi_writePacket */ +/** Send a packet to \e BrlAPI server + * + * This function is for internal use, but one might use it if one really knows + * what one is doing... + * + * \e type should only be one of the above defined BRLPACKET_*. + * + * The syntax is the same as write()'s. + * + * \return 0 on success, -1 on failure. + * + * \sa brlapi_readPacketHeader() + * brlapi_readPacketContent() + * brlapi_readPacket() + */ +ssize_t brlapi_writePacket(brlapi_fileDescriptor fd, brlapi_packetType_t type, const void *buf, size_t size); + +/* brlapi_readPacketHeader */ +/** Read the header (type+size) of a packet from \e BrlAPI server + * + * This function is for internal use, but one might use it if one really knows + * what one is doing... + * + * \e type is where the function will store the packet type; it should always + * be one of the above defined BRLPACKET_* (or else something very nasty must + * have happened :/). + * + * \return packet's size, -2 if \c EOF occurred, -1 on error or signal + * interruption. + * + * \sa brlapi_writePacket() + * brlapi_readPacketContent + * brlapi_readPacket + */ +ssize_t brlapi_readPacketHeader(brlapi_fileDescriptor fd, brlapi_packetType_t *packetType); + +/* brlapi_readPacketContent */ +/** Read the content of a packet from \e BrlAPI server + * + * This function is for internal use, but one might use it if one really knows + * what one is doing... + * + * \e packetSize is the size announced by \e brlapi_readPacketHeader() + * + * \e bufSize is the size of \e buf + * + * \return packetSize, -2 if \c EOF occurred, -1 on error. + * + * If the packet is larger than the supplied buffer, the buffer will be + * filled with the beginning of the packet, the rest of the packet being + * discarded. This follows the semantics of the recv system call when the + * MSG_TRUNC option is given. + * + * \sa brlapi_writePacket() + * brlapi_readPacketHeader() + * brlapi_readPacket() + */ +ssize_t brlapi_readPacketContent(brlapi_fileDescriptor fd, size_t packetSize, void *buf, size_t bufSize); + +/* brlapi_readPacket */ +/** Read a packet from \e BrlAPI server + * + * This function is for internal use, but one might use it if one really knows + * what one is doing... + * + * \e type is where the function will store the packet type; it should always + * be one of the above defined BRLPACKET_* (or else something very nasty must + * have happened :/). + * + * The syntax is the same as read()'s. + * + * \return packet's size, -2 if \c EOF occurred, -1 on error or signal + * interruption. + * + * If the packet is larger than the supplied buffer, the buffer will be + * filled with the beginning of the packet, the rest of the packet being + * discarded. This follows the semantics of the recv system call when the + * MSG_TRUNC option is given. + * + * \sa brlapi_writePacket() + */ +ssize_t brlapi_readPacket(brlapi_fileDescriptor fd, brlapi_packetType_t *type, void *buf, size_t size); + +/* brlapi_fd_mutex */ +/** Mutex for protecting concurrent fd access + * + * In order to regulate concurrent access to the library's file descriptor and + * requests to / answers from \e BrlAPI server, every function of the library + * locks this mutex, namely + * + * - brlapi_openConnection() + * - brlapi_closeConnection() + * - brlapi_enterRawMode() + * - brlapi_leaveRawMode() + * - brlapi_sendRaw() + * - brlapi_recvRaw() + * - brlapi_getDriverName() + * - brlapi_getDisplaySize() + * - brlapi_enterTtyMode() + * - brlapi_enterTtyModeWithPath() + * - brlapi_leaveTtyMode() + * - brlapi_*write*() + * - brlapi_(un)?ignorekey(Range|Set)() + * - brlapi_readKey() + * + * If both these functions and brlapi_writePacket() or brlapi_readPacket() are + * used in a multithreaded application, this mutex must be locked before calling + * brlapi_writePacket() or brlapi_readPacket(), and unlocked afterwards. + */ +#ifdef __MINGW32__ +#include <windows.h> +extern HANDLE brlapi_fd_mutex; +#else /* __MINGW32__ */ +#include <pthread.h> +extern pthread_mutex_t brlapi_fd_mutex; +#endif /* __MINGW32__ */ + +/* @} */ + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* BRLAPI_INCLUDED_PROTOCOL */ |