mirror of
https://git.savannah.gnu.org/git/grub.git
synced 2026-10-27 17:49:23 +00:00
Import brltty
This commit is contained in:
1 parent
93c120754a
commit
16fba4d65d
982 files changed
+326586
No files matched your search
@@ -0,0 +1,27 @@
|
||||
#!/bin/bash -p
|
||||
###############################################################################
|
||||
# libbrlapi - A library providing access to braille terminals for applications.
|
||||
#
|
||||
# Copyright (C) 2006-2012 by Dave Mielke <dave@mielke.cc>
|
||||
#
|
||||
# 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://mielke.cc/brltty/
|
||||
#
|
||||
# This software is maintained by Dave Mielke <dave@mielke.cc>.
|
||||
###############################################################################
|
||||
|
||||
programName="$(basename "${0}")"
|
||||
programDirectory="$(cd "$(dirname "${0}")" && pwd)"
|
||||
currentDirectory="$(pwd)"
|
||||
|
||||
export LD_LIBRARY_PATH="${currentDirectory}"
|
||||
export LD_PRELOAD="${currentDirectory}/../../Programs/libbrlapi.so"
|
||||
|
||||
exec tclsh "${programDirectory}/${programName}.tcl" "${@}"
|
||||
exit "${?}"
|
||||
@@ -0,0 +1,63 @@
|
||||
#!/usr/bin/env tclsh
|
||||
###############################################################################
|
||||
# libbrlapi - A library providing access to braille terminals for applications.
|
||||
#
|
||||
# Copyright (C) 2006-2012 by Dave Mielke <dave@mielke.cc>
|
||||
#
|
||||
# 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://mielke.cc/brltty/
|
||||
#
|
||||
# This software is maintained by Dave Mielke <dave@mielke.cc>.
|
||||
###############################################################################
|
||||
|
||||
source [file join [file dirname $argv0] prologue.tcl]
|
||||
processProgramOptions optionValues {
|
||||
{host string "where the BrlAPI server is [name][:port]"}
|
||||
}
|
||||
|
||||
load libbrlapi_tcl.so
|
||||
|
||||
proc expandList {list args} {
|
||||
set result ""
|
||||
set delimiter ""
|
||||
foreach field $args value $list {
|
||||
append result "$delimiter$field=$value"
|
||||
set delimiter " "
|
||||
}
|
||||
return $result
|
||||
}
|
||||
|
||||
set connectionSettings [list]
|
||||
if {[info exists optionValues(host)]} {
|
||||
lappend connectionSettings -host $optionValues(host)
|
||||
}
|
||||
set session [eval brlapi openConnection $connectionSettings]
|
||||
puts "Object: $session"
|
||||
|
||||
set host [$session getHost]
|
||||
puts "Host: $host"
|
||||
|
||||
set auth [$session getAuth]
|
||||
puts "Auth: $auth"
|
||||
|
||||
set fileDescriptor [$session getFileDescriptor]
|
||||
puts "FileDescriptor: $fileDescriptor"
|
||||
|
||||
set driverName [$session getDriverName]
|
||||
puts "DriverName: $driverName"
|
||||
|
||||
set displaySize [$session getDisplaySize]
|
||||
puts "DisplaySize: [expandList $displaySize width height]"
|
||||
|
||||
set tty [$session enterTtyMode]
|
||||
puts "Tty: $tty"
|
||||
|
||||
$session leaveTtyMode
|
||||
$session closeConnection; unset session
|
||||
exit 0
|
||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,100 @@
|
||||
###############################################################################
|
||||
# libbrlapi - A library providing access to braille terminals for applications.
|
||||
#
|
||||
# Copyright (C) 2006-2012 by Dave Mielke <dave@mielke.cc>
|
||||
#
|
||||
# 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://mielke.cc/brltty/
|
||||
#
|
||||
# This software is maintained by Dave Mielke <dave@mielke.cc>.
|
||||
###############################################################################
|
||||
|
||||
AC_DEFUN([BRLTTY_TCL_BINDINGS], [dnl
|
||||
TCL_OK=false
|
||||
TCL_CPPFLAGS=""
|
||||
TCL_LIBS=""
|
||||
|
||||
BRLTTY_ARG_WITH(
|
||||
[tcl-config], [PATH],
|
||||
[the path to the Tcl configuration script (tclConfig.sh) or to the directory containing it],
|
||||
[tcl_config_script], ["yes"]
|
||||
)
|
||||
|
||||
tcl_config_name="tclConfig.sh"
|
||||
if test "${tcl_config_script}" = "no"
|
||||
then
|
||||
AC_CHECK_HEADER([tcl.h], [dnl
|
||||
TCL_OK=true
|
||||
TCL_LIBS="-ltcl"
|
||||
])
|
||||
else
|
||||
test "${tcl_config_script}" != "yes" || tcl_config_script=""
|
||||
|
||||
if test -z "${tcl_config_script}"
|
||||
then
|
||||
for directory in "/usr/lib" "/usr/local/lib" "/usr/lib64" "/usr/local/lib64"
|
||||
do
|
||||
script="${directory}/${tcl_config_name}"
|
||||
test ! -f "${script}" || {
|
||||
tcl_config_script="${script}"
|
||||
AC_MSG_NOTICE([Tcl configuration script is ${tcl_config_script}])
|
||||
break
|
||||
}
|
||||
done
|
||||
|
||||
test -n "${tcl_config_script}" || {
|
||||
AC_MSG_WARN([Tcl configuration script not found: ${tcl_config_name}])
|
||||
}
|
||||
else
|
||||
test ! -d "${tcl_config_script}" || tcl_config_script="${tcl_config_script}/${tcl_config_name}"
|
||||
|
||||
test -f "${tcl_config_script}" || {
|
||||
AC_MSG_WARN([Tcl configuration script not found: ${tcl_config_script}])
|
||||
tcl_config_script=""
|
||||
}
|
||||
fi
|
||||
|
||||
test -z "${tcl_config_script}" || {
|
||||
if test ! -r "${tcl_config_script}"
|
||||
then
|
||||
AC_MSG_WARN([Tcl configuration script not readable: ${tcl_config_script}])
|
||||
elif . "${tcl_config_script}"
|
||||
then
|
||||
TCL_OK=true
|
||||
TCL_CPPFLAGS="${TCL_INCLUDE_SPEC}"
|
||||
TCL_LIBS="${TCL_LIB_SPEC}"
|
||||
fi
|
||||
}
|
||||
fi
|
||||
|
||||
"${TCL_OK}" && {
|
||||
AC_PATH_PROGS([TCLSH], [tclsh${TCL_VERSION} tclsh], [TCLSH_NOT_FOUND_BY_CONFIGURE])
|
||||
}
|
||||
|
||||
TCL_DIR=""
|
||||
test -z "${TCL_PACKAGE_PATH}" || {
|
||||
for directory in ${TCL_PACKAGE_PATH}
|
||||
do
|
||||
test `expr "${directory}" : '.*/lib'` -eq 0 || {
|
||||
TCL_DIR="${directory}"
|
||||
break
|
||||
}
|
||||
done
|
||||
}
|
||||
|
||||
test -n "${TCL_DIR}" || {
|
||||
AC_MSG_WARN([Tcl packages directory not found])
|
||||
TCL_DIR="TCL_PACKAGES_DIRECTORY_NOT_FOUND_BY_CONFIGURE"
|
||||
}
|
||||
AC_SUBST([TCL_DIR])
|
||||
|
||||
AC_SUBST([TCL_OK])
|
||||
AC_SUBST([TCL_CPPFLAGS])
|
||||
AC_SUBST([TCL_LIBS])
|
||||
])
|
||||
@@ -0,0 +1,46 @@
|
||||
brlapi <function> [<arg> ...]
|
||||
openConnection [<option> ...]
|
||||
-host <hostSpec>
|
||||
-auth <file>
|
||||
expandKeyCode <keyCode> <arrayName>
|
||||
describeKeyCode <keyCode> <arrayName>
|
||||
makeDots <numbersList>
|
||||
getHandleSize
|
||||
|
||||
brlapi<sessionNumber> function [arg ...]
|
||||
getHost
|
||||
getAuth
|
||||
getFileDescriptor
|
||||
getDriverName
|
||||
getDisplaySize
|
||||
enterTtyMode [<option> ...]
|
||||
-tty {default | <number>}
|
||||
-keyCodes
|
||||
-events <driver>
|
||||
enterTtyModeWithPath [<option> ...]
|
||||
-path <list>
|
||||
-keyCodes
|
||||
-events <driver>
|
||||
leaveTtyMode
|
||||
setFocus <ttyNumber>
|
||||
readKey <wait>
|
||||
acceptKeys <rangeType> [<keyCodeList>]
|
||||
ignoreKeys <rangeType> [<keyCodeList>]
|
||||
acceptKeyRanges <keyRangeList>
|
||||
ignoreKeyRanges <keyRangeList>
|
||||
write [<option> ...]
|
||||
-text <string>
|
||||
-andMask <dots>
|
||||
-orMask <dots>
|
||||
-begin <offset>
|
||||
-cursor {leave | off | <offset>}
|
||||
-displayNumber {default | <number>}
|
||||
writeDots <dots>
|
||||
enterRawMode <driver>
|
||||
leaveRawMode
|
||||
recvRaw <maximumLength>
|
||||
sendRaw <packet>
|
||||
suspendDriver <driver>
|
||||
resumeDriver
|
||||
closeConnection
|
||||
|
||||
@@ -0,0 +1,163 @@
|
||||
###############################################################################
|
||||
# libbrlapi - A library providing access to braille terminals for applications.
|
||||
#
|
||||
# Copyright (C) 2006-2012 by Dave Mielke <dave@mielke.cc>
|
||||
#
|
||||
# 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://mielke.cc/brltty/
|
||||
#
|
||||
# This software is maintained by Dave Mielke <dave@mielke.cc>.
|
||||
###############################################################################
|
||||
|
||||
proc getProgramPath {} {
|
||||
return [uplevel #0 set argv0]
|
||||
}
|
||||
|
||||
proc getProgramName {} {
|
||||
return [file tail [getProgramPath]]
|
||||
}
|
||||
|
||||
proc writeProgramMessage {message} {
|
||||
puts stderr "[getProgramName]: $message"
|
||||
}
|
||||
|
||||
proc syntaxError {message} {
|
||||
writeProgramMessage $message
|
||||
exit 2
|
||||
}
|
||||
|
||||
proc getArgument {resultVariable} {
|
||||
global argv
|
||||
if {[llength $argv] == 0} {
|
||||
return 0
|
||||
}
|
||||
uplevel 1 [list set $resultVariable [lindex $argv 0]]
|
||||
set argv [lrange $argv 1 end]
|
||||
return 1
|
||||
}
|
||||
|
||||
proc nextArgument {description} {
|
||||
if {![getArgument result]} {
|
||||
syntaxError "missing $description."
|
||||
}
|
||||
return $result
|
||||
}
|
||||
|
||||
proc noMoreArguments {} {
|
||||
if {[getArgument argument]} {
|
||||
syntaxError "excess parameter: $argument"
|
||||
}
|
||||
}
|
||||
|
||||
proc processOptions {argumentsList valuesArray options} {
|
||||
upvar 1 $argumentsList arguments
|
||||
upvar 1 $valuesArray values
|
||||
|
||||
set checkValue(string) {1}
|
||||
set checkValue(integer) {[string is integer -strict $value]}
|
||||
set checkValue(double) {[string is double -strict $value]}
|
||||
set checkValue(boolean) {[string is boolean -strict $value]}
|
||||
|
||||
foreach option $options {
|
||||
foreach variable {name type description} value $option {
|
||||
set $variable $value
|
||||
}
|
||||
|
||||
if {[info exists types($name)]} {
|
||||
return -code error "option defined more than once: $name"
|
||||
}
|
||||
|
||||
if {[set defaultSpecified [expr {[set delimiter [string first : $type]] >= 0}]]} {
|
||||
set value [string range $type [expr {$delimiter + 1}] end]
|
||||
set type [string range $type 0 [expr {$delimiter - 1}]]
|
||||
}
|
||||
|
||||
if {[string length $type] == 0} {
|
||||
return -code error "option type not defined: $name"
|
||||
}
|
||||
|
||||
if {[string equal $type flag]} {
|
||||
if {$defaultSpecified} {
|
||||
return -code error "default value specified for $type option: $name"
|
||||
}
|
||||
|
||||
set value 0
|
||||
set defaultSpecified 1
|
||||
} elseif {![info exists checkValue($type)]} {
|
||||
return -code error "invalid option type: $type"
|
||||
} elseif {$defaultSpecified && ![expr $checkValue($type)]} {
|
||||
return -code error "invalid default value for $type option: $name=$value"
|
||||
}
|
||||
|
||||
if {$defaultSpecified} {
|
||||
set values($name) $value
|
||||
}
|
||||
|
||||
set types($name) $type
|
||||
set descriptions($name) $description
|
||||
|
||||
set abbreviation $name
|
||||
while {[string length $abbreviation] > 0} {
|
||||
if {[info exists names($abbreviation)]} {
|
||||
set name ""
|
||||
}
|
||||
|
||||
set names($abbreviation) $name
|
||||
set abbreviation [string range $abbreviation 0 end-1]
|
||||
}
|
||||
}
|
||||
|
||||
while {[llength $arguments] > 0} {
|
||||
if {[string length [set argument [lindex $arguments 0]]] == 0} {
|
||||
breaK
|
||||
}
|
||||
|
||||
if {[string equal [set option [string trimleft $argument -]] $argument]} {
|
||||
break
|
||||
}
|
||||
set arguments [lrange $arguments 1 end]
|
||||
|
||||
if {[string length $option] == 0} {
|
||||
break
|
||||
}
|
||||
|
||||
if {![info exists names($option)]} {
|
||||
return -code error "unknown option: $argument"
|
||||
}
|
||||
|
||||
if {[string length [set name $names($option)]] == 0} {
|
||||
return -code error "ambiguous option: $argument"
|
||||
}
|
||||
|
||||
if {[string equal [set type $types($name)] flag]} {
|
||||
set values($name) 1
|
||||
} elseif {[llength $arguments] == 0} {
|
||||
return -code error "value not supplied for option: $argument"
|
||||
} else {
|
||||
set value [lindex $arguments 0]
|
||||
set arguments [lrange $arguments 1 end]
|
||||
|
||||
if {![expr $checkValue($type)]} {
|
||||
return -code error "invalid value for $type option: $argument $value"
|
||||
}
|
||||
|
||||
set values($name) $value
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
proc processProgramOptions {valuesArray options} {
|
||||
global argv
|
||||
upvar 1 $valuesArray values
|
||||
|
||||
if {[catch [list processOptions argv values $options] response] != 0} {
|
||||
syntaxError $response
|
||||
}
|
||||
return $response
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
# Dependencies for bindings.$O:
|
||||
bindings.$O: $(SRC_DIR)/bindings.c
|
||||
bindings.$O: $(SRC_TOP)Programs/brldots.h
|
||||
bindings.$O: $(BLD_TOP)Programs/brlapi.h
|
||||
bindings.$O: $(BLD_TOP)Programs/brlapi_constants.h
|
||||
bindings.$O: $(SRC_TOP)Programs/brlapi_keycodes.h
|
||||
|
||||
Reference in new issue
Block a user