Move system calls to the new class FSystem
This commit is contained in:
parent
5bd8590dee
commit
fa66a7091e
|
@ -1,5 +1,9 @@
|
||||||
|
2019-05-17 Markus Gans <guru.mail@muenster.de>
|
||||||
|
* Move system calls to the new class FSystem
|
||||||
|
|
||||||
2019-04-27 Markus Gans <guru.mail@muenster.de>
|
2019-04-27 Markus Gans <guru.mail@muenster.de>
|
||||||
* Add the reserve() method to FListBox to increase the capacity of the list
|
* Add the reserve() method to FListBox to increase the capacity
|
||||||
|
of the list
|
||||||
* Use shrink_to_fit() to save memory space
|
* Use shrink_to_fit() to save memory space
|
||||||
|
|
||||||
2019-03-24 Markus Gans <guru.mail@muenster.de>
|
2019-03-24 Markus Gans <guru.mail@muenster.de>
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
*Travis CI:*<br />
|
*Travis CI:*<br />
|
||||||
     [![Build Status](https://travis-ci.org/gansm/finalcut.svg?branch=master)](https://travis-ci.org/gansm/finalcut) <br />
|
     [![Build Status](https://travis-ci.org/gansm/finalcut.svg?branch=master)](https://travis-ci.org/gansm/finalcut) <br />
|
||||||
*Coverity Scan:*<br />
|
*Coverity Scan:*<br />
|
||||||
     [![Coverity Scan Status](https://scan.coverity.com/projects/6508/badge.svg)](https://scan.coverity.com/projects/6508) <br />
|
     [![Coverity Scan Status](https://img.shields.io/coverity/scan/6508.svg)](https://scan.coverity.com/projects/6508) <br />
|
||||||
*LGTM:*<br />
|
*LGTM:*<br />
|
||||||
     [![Language grade: C/C++](https://img.shields.io/lgtm/grade/cpp/g/gansm/finalcut.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/gansm/finalcut/context:cpp) <br />
|
     [![Language grade: C/C++](https://img.shields.io/lgtm/grade/cpp/g/gansm/finalcut.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/gansm/finalcut/context:cpp) <br />
|
||||||
*Class Reference:*<br />
|
*Class Reference:*<br />
|
||||||
|
|
16
build.sh
16
build.sh
|
@ -35,7 +35,7 @@ then
|
||||||
autoreconf --install --force
|
autoreconf --install --force
|
||||||
else
|
else
|
||||||
echo "Build failed, please install autoconf first"
|
echo "Build failed, please install autoconf first"
|
||||||
exit -1
|
exit 255
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
@ -46,7 +46,7 @@ case "$1" in
|
||||||
if ! ./configure --prefix="$PREFIX" CXXFLAGS="-O2" # "-O3 -fno-rtti"
|
if ! ./configure --prefix="$PREFIX" CXXFLAGS="-O2" # "-O3 -fno-rtti"
|
||||||
then
|
then
|
||||||
echo "${RED}Configure failed!${NORMAL}" 1>&2
|
echo "${RED}Configure failed!${NORMAL}" 1>&2
|
||||||
exit -1
|
exit 255
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
@ -54,7 +54,7 @@ case "$1" in
|
||||||
if ! ./configure --prefix="$PREFIX" CPPFLAGS="-DDEBUG" CXXFLAGS="-g -O0 -DDEBUG -W -Wall -pedantic"
|
if ! ./configure --prefix="$PREFIX" CPPFLAGS="-DDEBUG" CXXFLAGS="-g -O0 -DDEBUG -W -Wall -pedantic"
|
||||||
then
|
then
|
||||||
echo "${RED}Configure failed!${NORMAL}" 1>&2
|
echo "${RED}Configure failed!${NORMAL}" 1>&2
|
||||||
exit -1
|
exit 255
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
@ -62,7 +62,7 @@ case "$1" in
|
||||||
if ! ./configure --prefix="$PREFIX" CPPFLAGS="-DDEBUG" CXXFLAGS="-g -O0 -DDEBUG -W -Wall -Weffc++ -pedantic -pedantic-errors -Wextra -Wformat-nonliteral -Wformat-security -Wformat-y2k -Wimport -Winit-self -Winvalid-pch -Wlong-long -Wmissing-braces -Wmissing-field-initializers -Wmissing-format-attribute -Wmissing-include-dirs -Wmissing-noreturn -Wpacked -Wpadded -Wparentheses -Wpointer-arith -Wredundant-decls -Wreturn-type -Wsequence-point -Wshadow -Wsign-compare -fstack-protector -Wstrict-aliasing -Wstrict-aliasing=3 -Wswitch -Wswitch-enum -Wtrigraphs -Wuninitialized -Wunknown-pragmas -Wunreachable-code -Wunused -Wunused-function -Wunused-label -Wunused-parameter -Wunused-value -Wunused-variable -Wvariadic-macros -Wvolatile-register-var -Wwrite-strings -Wsign-promo -Woverloaded-virtual -Wstrict-null-sentinel -fext-numeric-literals -Wreorder -Wnoexcept -Wnarrowing -Wliteral-suffix -Wctor-dtor-privacy -ftree-loop-distribute-patterns -Wmemset-transposed-args"
|
if ! ./configure --prefix="$PREFIX" CPPFLAGS="-DDEBUG" CXXFLAGS="-g -O0 -DDEBUG -W -Wall -Weffc++ -pedantic -pedantic-errors -Wextra -Wformat-nonliteral -Wformat-security -Wformat-y2k -Wimport -Winit-self -Winvalid-pch -Wlong-long -Wmissing-braces -Wmissing-field-initializers -Wmissing-format-attribute -Wmissing-include-dirs -Wmissing-noreturn -Wpacked -Wpadded -Wparentheses -Wpointer-arith -Wredundant-decls -Wreturn-type -Wsequence-point -Wshadow -Wsign-compare -fstack-protector -Wstrict-aliasing -Wstrict-aliasing=3 -Wswitch -Wswitch-enum -Wtrigraphs -Wuninitialized -Wunknown-pragmas -Wunreachable-code -Wunused -Wunused-function -Wunused-label -Wunused-parameter -Wunused-value -Wunused-variable -Wvariadic-macros -Wvolatile-register-var -Wwrite-strings -Wsign-promo -Woverloaded-virtual -Wstrict-null-sentinel -fext-numeric-literals -Wreorder -Wnoexcept -Wnarrowing -Wliteral-suffix -Wctor-dtor-privacy -ftree-loop-distribute-patterns -Wmemset-transposed-args"
|
||||||
then
|
then
|
||||||
echo "${RED}Configure failed!${NORMAL}" 1>&2
|
echo "${RED}Configure failed!${NORMAL}" 1>&2
|
||||||
exit -1
|
exit 255
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
@ -70,7 +70,7 @@ case "$1" in
|
||||||
if ! ./configure --prefix="$PREFIX" CPPFLAGS="-DDEBUG" CXXFLAGS="-g -pg -O0 -DDEBUG -W -Wall -pedantic"
|
if ! ./configure --prefix="$PREFIX" CPPFLAGS="-DDEBUG" CXXFLAGS="-g -pg -O0 -DDEBUG -W -Wall -pedantic"
|
||||||
then
|
then
|
||||||
echo "${RED}Configure failed!${NORMAL}" 1>&2
|
echo "${RED}Configure failed!${NORMAL}" 1>&2
|
||||||
exit -1
|
exit 255
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
@ -78,7 +78,7 @@ case "$1" in
|
||||||
if ! ./configure --prefix="$PREFIX" --with-profiler
|
if ! ./configure --prefix="$PREFIX" --with-profiler
|
||||||
then
|
then
|
||||||
echo "${RED}Configure failed!${NORMAL}" 1>&2
|
echo "${RED}Configure failed!${NORMAL}" 1>&2
|
||||||
exit -1
|
exit 255
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
@ -86,7 +86,7 @@ case "$1" in
|
||||||
if ! ./configure --prefix="$PREFIX" CPPFLAGS="-DDEBUG" CXXFLAGS="-g -O0 -DDEBUG" --with-unit-test
|
if ! ./configure --prefix="$PREFIX" CPPFLAGS="-DDEBUG" CXXFLAGS="-g -O0 -DDEBUG" --with-unit-test
|
||||||
then
|
then
|
||||||
echo "${RED}Configure failed!${NORMAL}" 1>&2
|
echo "${RED}Configure failed!${NORMAL}" 1>&2
|
||||||
exit -1
|
exit 255
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
@ -94,7 +94,7 @@ case "$1" in
|
||||||
if ! ./configure --prefix="$PREFIX" CPPFLAGS="-DDEBUG" CXXFLAGS="-g -O0 -DDEBUG" --with-unit-test --with-gcov
|
if ! ./configure --prefix="$PREFIX" CPPFLAGS="-DDEBUG" CXXFLAGS="-g -O0 -DDEBUG" --with-unit-test --with-gcov
|
||||||
then
|
then
|
||||||
echo "${RED}Configure failed!${NORMAL}" 1>&2
|
echo "${RED}Configure failed!${NORMAL}" 1>&2
|
||||||
exit -1
|
exit 255
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
|
|
@ -38,7 +38,7 @@ class SegmentView : public finalcut::FDialog
|
||||||
virtual void draw() override;
|
virtual void draw() override;
|
||||||
|
|
||||||
// Data Members
|
// Data Members
|
||||||
std::map<wchar_t, sevenSegment> code;
|
std::map<wchar_t, sevenSegment> code{};
|
||||||
finalcut::FString line[3];
|
finalcut::FString line[3];
|
||||||
finalcut::FLineEdit Input{"0123", this};
|
finalcut::FLineEdit Input{"0123", this};
|
||||||
finalcut::FButton Exit{"E&xit", this};
|
finalcut::FButton Exit{"E&xit", this};
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#!/bin/bash
|
#!/bin/sh
|
||||||
|
|
||||||
test -f 8x16graph.pcf.gz && rm 8x16graph.pcf.gz
|
test -f 8x16graph.pcf.gz && rm 8x16graph.pcf.gz
|
||||||
bdftopcf -o 8x16graph.pcf 8x16graph.bdf
|
bdftopcf -o 8x16graph.pcf 8x16graph.bdf
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#!/bin/bash
|
#!/bin/sh
|
||||||
|
|
||||||
if [ $# -gt 0 ]
|
if [ $# -gt 0 ]
|
||||||
then
|
then
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#!/bin/bash
|
#!/bin/sh
|
||||||
|
|
||||||
LD_LIBRARY_PATH=../src/.libs/ LD_PRELOAD="/usr/lib64/libprofiler.so.0" CPUPROFILE=../examples/.libs/ui.prof ../examples/.libs/ui
|
LD_LIBRARY_PATH=../src/.libs/ LD_PRELOAD="/usr/lib64/libprofiler.so.0" CPUPROFILE=../examples/.libs/ui.prof ../examples/.libs/ui
|
||||||
pprof --gv ../examples/.libs/ui ../examples/.libs/ui.prof
|
pprof --gv ../examples/.libs/ui ../examples/.libs/ui.prof
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#!/bin/bash
|
#!/bin/sh
|
||||||
|
|
||||||
# Protokoliert Funktionsaufrufe in dynamisch hinzugelinkten Bibliotheken
|
# Protokoliert Funktionsaufrufe in dynamisch hinzugelinkten Bibliotheken
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#!/bin/bash
|
#!/bin/sh
|
||||||
|
|
||||||
DIR="$PWD"
|
DIR="$PWD"
|
||||||
cd ../examples/.libs/ || exit
|
cd ../examples/.libs/ || exit
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#!/bin/bash
|
#!/bin/sh
|
||||||
|
|
||||||
find ../src/ \
|
find ../src/ \
|
||||||
../src/include/final/ \
|
../src/include/final/ \
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
#!/bin/bash
|
#!/bin/sh
|
||||||
xfd -center -columns 16 -fn -misc-8x16graph-medium-r-normal--17-160-75-75-*-80-iso8859-1
|
xfd -center -columns 16 -fn -misc-8x16graph-medium-r-normal--17-160-75-75-*-80-iso8859-1
|
||||||
|
|
||||||
|
|
|
@ -27,6 +27,8 @@ libfinal_la_SOURCES = \
|
||||||
flistview.cpp \
|
flistview.cpp \
|
||||||
fmenu.cpp \
|
fmenu.cpp \
|
||||||
fmouse.cpp \
|
fmouse.cpp \
|
||||||
|
fsystem.cpp \
|
||||||
|
fsystemimpl.cpp \
|
||||||
fkeyboard.cpp \
|
fkeyboard.cpp \
|
||||||
fdialoglistmenu.cpp \
|
fdialoglistmenu.cpp \
|
||||||
fmenubar.cpp \
|
fmenubar.cpp \
|
||||||
|
@ -112,6 +114,8 @@ finalcutinclude_HEADERS = \
|
||||||
include/final/fscrollview.h \
|
include/final/fscrollview.h \
|
||||||
include/final/fstatusbar.h \
|
include/final/fstatusbar.h \
|
||||||
include/final/fstring.h \
|
include/final/fstring.h \
|
||||||
|
include/final/fsystem.h \
|
||||||
|
include/final/fsystemimpl.h \
|
||||||
include/final/ftermcap.h \
|
include/final/ftermcap.h \
|
||||||
include/final/ftermcapquirks.h \
|
include/final/ftermcapquirks.h \
|
||||||
include/final/ftermxterminal.h \
|
include/final/ftermxterminal.h \
|
||||||
|
|
|
@ -39,6 +39,8 @@ INCLUDE_HEADERS = \
|
||||||
fprogressbar.h \
|
fprogressbar.h \
|
||||||
fradiobutton.h \
|
fradiobutton.h \
|
||||||
frect.h \
|
frect.h \
|
||||||
|
fsystem.h \
|
||||||
|
fsystemimpl.h \
|
||||||
fscrollbar.h \
|
fscrollbar.h \
|
||||||
fscrollview.h \
|
fscrollview.h \
|
||||||
fstatusbar.h \
|
fstatusbar.h \
|
||||||
|
@ -107,6 +109,8 @@ OBJS = \
|
||||||
ftextview.o \
|
ftextview.o \
|
||||||
fstatusbar.o \
|
fstatusbar.o \
|
||||||
fmouse.o \
|
fmouse.o \
|
||||||
|
fsystem.o \
|
||||||
|
fsystemimpl.o \
|
||||||
fkeyboard.o \
|
fkeyboard.o \
|
||||||
ftermcap.o \
|
ftermcap.o \
|
||||||
fterm.o \
|
fterm.o \
|
||||||
|
|
|
@ -43,6 +43,8 @@ INCLUDE_HEADERS = \
|
||||||
fscrollview.h \
|
fscrollview.h \
|
||||||
fstatusbar.h \
|
fstatusbar.h \
|
||||||
fstring.h \
|
fstring.h \
|
||||||
|
fsystem.h \
|
||||||
|
fsystemimpl.h \
|
||||||
fmouse.h \
|
fmouse.h \
|
||||||
fkeyboard.h \
|
fkeyboard.h \
|
||||||
ftermcap.h \
|
ftermcap.h \
|
||||||
|
@ -107,6 +109,8 @@ OBJS = \
|
||||||
ftextview.o \
|
ftextview.o \
|
||||||
fstatusbar.o \
|
fstatusbar.o \
|
||||||
fmouse.o \
|
fmouse.o \
|
||||||
|
fsystem.o \
|
||||||
|
fsystemimpl.o \
|
||||||
fkeyboard.o \
|
fkeyboard.o \
|
||||||
ftermcap.o \
|
ftermcap.o \
|
||||||
fterm.o \
|
fterm.o \
|
||||||
|
|
|
@ -306,9 +306,9 @@ void FFileDialog::adjustSize()
|
||||||
Y = 1 + int((max_height - getHeight()) / 3);
|
Y = 1 + int((max_height - getHeight()) / 3);
|
||||||
setPos(FPoint(X, Y), false);
|
setPos(FPoint(X, Y), false);
|
||||||
filebrowser.setHeight (h - 8, false);
|
filebrowser.setHeight (h - 8, false);
|
||||||
hidden.setY (int(h) - 4, false);
|
hidden_check.setY (int(h) - 4, false);
|
||||||
cancel.setY (int(h) - 4, false);
|
cancel_btn.setY (int(h) - 4, false);
|
||||||
open.setY (int(h) - 4, false);
|
open_btn.setY (int(h) - 4, false);
|
||||||
FDialog::adjustSize();
|
FDialog::adjustSize();
|
||||||
printPath(directory);
|
printPath(directory);
|
||||||
}
|
}
|
||||||
|
@ -355,18 +355,18 @@ inline void FFileDialog::widgetSettings (const FPoint& pos)
|
||||||
filebrowser.setGeometry (FPoint(2, 3), FSize(38, 6));
|
filebrowser.setGeometry (FPoint(2, 3), FSize(38, 6));
|
||||||
printPath (directory);
|
printPath (directory);
|
||||||
|
|
||||||
hidden.setText ("&hidden files");
|
hidden_check.setText ("&hidden files");
|
||||||
hidden.setGeometry (FPoint(2, 10), FSize(16, 1));
|
hidden_check.setGeometry (FPoint(2, 10), FSize(16, 1));
|
||||||
|
|
||||||
cancel.setText ("&Cancel");
|
cancel_btn.setText ("&Cancel");
|
||||||
cancel.setGeometry(FPoint(19, 10), FSize(9, 1));
|
cancel_btn.setGeometry(FPoint(19, 10), FSize(9, 1));
|
||||||
|
|
||||||
if ( dlg_type == FFileDialog::Save )
|
if ( dlg_type == FFileDialog::Save )
|
||||||
open.setText ("&Save");
|
open_btn.setText ("&Save");
|
||||||
else
|
else
|
||||||
open.setText ("&Open");
|
open_btn.setText ("&Open");
|
||||||
|
|
||||||
open.setGeometry(FPoint(30, 10), FSize(9, 1));
|
open_btn.setGeometry(FPoint(30, 10), FSize(9, 1));
|
||||||
setGeometry (pos, getSize());
|
setGeometry (pos, getSize());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -391,19 +391,19 @@ void FFileDialog::initCallbacks()
|
||||||
F_METHOD_CALLBACK (this, &FFileDialog::cb_processClicked)
|
F_METHOD_CALLBACK (this, &FFileDialog::cb_processClicked)
|
||||||
);
|
);
|
||||||
|
|
||||||
hidden.addCallback
|
hidden_check.addCallback
|
||||||
(
|
(
|
||||||
"toggled",
|
"toggled",
|
||||||
F_METHOD_CALLBACK (this, &FFileDialog::cb_processShowHidden)
|
F_METHOD_CALLBACK (this, &FFileDialog::cb_processShowHidden)
|
||||||
);
|
);
|
||||||
|
|
||||||
cancel.addCallback
|
cancel_btn.addCallback
|
||||||
(
|
(
|
||||||
"clicked",
|
"clicked",
|
||||||
F_METHOD_CALLBACK (this, &FFileDialog::cb_processCancel)
|
F_METHOD_CALLBACK (this, &FFileDialog::cb_processCancel)
|
||||||
);
|
);
|
||||||
|
|
||||||
open.addCallback
|
open_btn.addCallback
|
||||||
(
|
(
|
||||||
"clicked",
|
"clicked",
|
||||||
F_METHOD_CALLBACK (this, &FFileDialog::cb_processOpen)
|
F_METHOD_CALLBACK (this, &FFileDialog::cb_processOpen)
|
||||||
|
|
|
@ -0,0 +1,42 @@
|
||||||
|
/***********************************************************************
|
||||||
|
* fsystem.cpp - Abstract class for system calls *
|
||||||
|
* *
|
||||||
|
* This file is part of the Final Cut widget toolkit *
|
||||||
|
* *
|
||||||
|
* Copyright 2019 Markus Gans *
|
||||||
|
* *
|
||||||
|
* The Final Cut 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 3 of *
|
||||||
|
* the License, or (at your option) any later version. *
|
||||||
|
* *
|
||||||
|
* The Final Cut 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 program. If not, see *
|
||||||
|
* <http://www.gnu.org/licenses/>. *
|
||||||
|
***********************************************************************/
|
||||||
|
|
||||||
|
#include "final/fsystem.h"
|
||||||
|
|
||||||
|
namespace finalcut
|
||||||
|
{
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
// class FSystem
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
|
||||||
|
// constructors and destructor
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
FSystem::FSystem()
|
||||||
|
{ }
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
FSystem::~FSystem() // destructor
|
||||||
|
{ }
|
||||||
|
|
||||||
|
} // namespace finalcut
|
||||||
|
|
|
@ -0,0 +1,42 @@
|
||||||
|
/***********************************************************************
|
||||||
|
* fsystemimpl.cpp - FSystem implementation *
|
||||||
|
* *
|
||||||
|
* This file is part of the Final Cut widget toolkit *
|
||||||
|
* *
|
||||||
|
* Copyright 2019 Markus Gans *
|
||||||
|
* *
|
||||||
|
* The Final Cut 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 3 of *
|
||||||
|
* the License, or (at your option) any later version. *
|
||||||
|
* *
|
||||||
|
* The Final Cut 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 program. If not, see *
|
||||||
|
* <http://www.gnu.org/licenses/>. *
|
||||||
|
***********************************************************************/
|
||||||
|
|
||||||
|
#include "final/fsystemimpl.h"
|
||||||
|
|
||||||
|
namespace finalcut
|
||||||
|
{
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
// class FSystemImpl
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
|
||||||
|
// constructors and destructor
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
FSystemImpl::FSystemImpl()
|
||||||
|
{ }
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
FSystemImpl::~FSystemImpl() // destructor
|
||||||
|
{ }
|
||||||
|
|
||||||
|
} // namespace finalcut
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
* fterm.cpp - Base class for terminal detection and control *
|
* fterm.cpp - Base class for terminal control *
|
||||||
* *
|
* *
|
||||||
* This file is part of the Final Cut widget toolkit *
|
* This file is part of the Final Cut widget toolkit *
|
||||||
* *
|
* *
|
||||||
|
@ -43,6 +43,7 @@ int (*FTerm::Fputchar)(int);
|
||||||
// static class attributes
|
// static class attributes
|
||||||
FTerm::initializationValues FTerm::init_values;
|
FTerm::initializationValues FTerm::init_values;
|
||||||
FTermData* FTerm::data = nullptr;
|
FTermData* FTerm::data = nullptr;
|
||||||
|
FSystem* FTerm::fsys = nullptr;
|
||||||
FTermcap::tcap_map* FTerm::tcap = nullptr;
|
FTermcap::tcap_map* FTerm::tcap = nullptr;
|
||||||
FOptiMove* FTerm::opti_move = nullptr;
|
FOptiMove* FTerm::opti_move = nullptr;
|
||||||
FOptiAttr* FTerm::opti_attr = nullptr;
|
FOptiAttr* FTerm::opti_attr = nullptr;
|
||||||
|
@ -354,12 +355,12 @@ int FTerm::openConsole()
|
||||||
if ( fd >= 0 ) // console is already opened
|
if ( fd >= 0 ) // console is already opened
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if ( ! *termfilename )
|
if ( ! *termfilename || ! fsys )
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
for (std::size_t i = 0; terminal_devices[i] != 0; i++)
|
for (std::size_t i = 0; terminal_devices[i] != 0; i++)
|
||||||
{
|
{
|
||||||
fd = open(terminal_devices[i], O_RDWR, 0);
|
fd = fsys->open(terminal_devices[i], O_RDWR, 0);
|
||||||
data->setTTYFileDescriptor(fd);
|
data->setTTYFileDescriptor(fd);
|
||||||
|
|
||||||
if ( fd >= 0 )
|
if ( fd >= 0 )
|
||||||
|
@ -373,12 +374,14 @@ int FTerm::openConsole()
|
||||||
int FTerm::closeConsole()
|
int FTerm::closeConsole()
|
||||||
{
|
{
|
||||||
int fd = data->getTTYFileDescriptor();
|
int fd = data->getTTYFileDescriptor();
|
||||||
|
int ret = -1;
|
||||||
|
|
||||||
if ( fd < 0 ) // console is already closed
|
if ( fd < 0 ) // console is already closed
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
// use 'close' from the global namespace
|
if ( fsys )
|
||||||
int ret = ::close (fd);
|
ret = fsys->close(fd); // close console
|
||||||
|
|
||||||
data->setTTYFileDescriptor(-1);
|
data->setTTYFileDescriptor(-1);
|
||||||
|
|
||||||
if ( ret == 0 )
|
if ( ret == 0 )
|
||||||
|
@ -502,7 +505,11 @@ void FTerm::detectTermSize()
|
||||||
}
|
}
|
||||||
|
|
||||||
auto& term_geometry = data->getTermGeometry();
|
auto& term_geometry = data->getTermGeometry();
|
||||||
ret = ioctl (fd, TIOCGWINSZ, &win_size);
|
|
||||||
|
if ( fsys )
|
||||||
|
ret = fsys->ioControl (fd, TIOCGWINSZ, &win_size);
|
||||||
|
else
|
||||||
|
ret = -1;
|
||||||
|
|
||||||
if ( ret != 0 || win_size.ws_col == 0 || win_size.ws_row == 0 )
|
if ( ret != 0 || win_size.ws_col == 0 || win_size.ws_row == 0 )
|
||||||
{
|
{
|
||||||
|
@ -519,6 +526,7 @@ void FTerm::detectTermSize()
|
||||||
term_geometry.setRect(1, 1, win_size.ws_col, win_size.ws_row);
|
term_geometry.setRect(1, 1, win_size.ws_col, win_size.ws_row);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( opti_move )
|
||||||
opti_move->setTermSize ( term_geometry.getWidth()
|
opti_move->setTermSize ( term_geometry.getWidth()
|
||||||
, term_geometry.getHeight() );
|
, term_geometry.getHeight() );
|
||||||
|
|
||||||
|
@ -1398,7 +1406,7 @@ void FTerm::init_term_encoding()
|
||||||
int stdout_no = FTermios::getStdOut();
|
int stdout_no = FTermios::getStdOut();
|
||||||
const char* termtype = data->getTermType();
|
const char* termtype = data->getTermType();
|
||||||
|
|
||||||
if ( isatty(stdout_no)
|
if ( fsys->isTTY(stdout_no)
|
||||||
&& ! std::strcmp(nl_langinfo(CODESET), "UTF-8") )
|
&& ! std::strcmp(nl_langinfo(CODESET), "UTF-8") )
|
||||||
{
|
{
|
||||||
data->setUTF8Console(true);
|
data->setUTF8Console(true);
|
||||||
|
@ -1408,7 +1416,7 @@ void FTerm::init_term_encoding()
|
||||||
setUTF8(true);
|
setUTF8(true);
|
||||||
keyboard->enableUTF8();
|
keyboard->enableUTF8();
|
||||||
}
|
}
|
||||||
else if ( isatty(stdout_no)
|
else if ( fsys->isTTY(stdout_no)
|
||||||
&& (std::strlen(termtype) > 0)
|
&& (std::strlen(termtype) > 0)
|
||||||
&& (TCAP(fc::t_exit_alt_charset_mode) != 0) )
|
&& (TCAP(fc::t_exit_alt_charset_mode) != 0) )
|
||||||
{
|
{
|
||||||
|
@ -1733,6 +1741,7 @@ inline void FTerm::allocationValues()
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
data = new FTermData();
|
data = new FTermData();
|
||||||
|
fsys = new FSystemImpl;
|
||||||
opti_move = new FOptiMove();
|
opti_move = new FOptiMove();
|
||||||
opti_attr = new FOptiAttr();
|
opti_attr = new FOptiAttr();
|
||||||
term_detection = new FTermDetection();
|
term_detection = new FTermDetection();
|
||||||
|
@ -1796,6 +1805,9 @@ inline void FTerm::deallocationValues()
|
||||||
if ( opti_move )
|
if ( opti_move )
|
||||||
delete opti_move;
|
delete opti_move;
|
||||||
|
|
||||||
|
if ( fsys )
|
||||||
|
delete fsys;
|
||||||
|
|
||||||
if ( data )
|
if ( data )
|
||||||
delete data;
|
delete data;
|
||||||
}
|
}
|
||||||
|
@ -1826,6 +1838,7 @@ void FTerm::init (bool disable_alt_screen)
|
||||||
|
|
||||||
// Terminal detection
|
// Terminal detection
|
||||||
term_detection->setFTermData(data);
|
term_detection->setFTermData(data);
|
||||||
|
term_detection->setFSystem(fsys);
|
||||||
term_detection->detect();
|
term_detection->detect();
|
||||||
setTermType (term_detection->getTermType());
|
setTermType (term_detection->getTermType());
|
||||||
|
|
||||||
|
@ -1915,6 +1928,7 @@ void FTerm::initOSspecifics()
|
||||||
{
|
{
|
||||||
#if defined(__linux__)
|
#if defined(__linux__)
|
||||||
linux->setFTermData(data);
|
linux->setFTermData(data);
|
||||||
|
linux->setFSystem(fsys);
|
||||||
linux->setFTermDetection(term_detection);
|
linux->setFTermDetection(term_detection);
|
||||||
linux->init(); // Initialize Linux console
|
linux->init(); // Initialize Linux console
|
||||||
|
|
||||||
|
@ -1925,6 +1939,8 @@ void FTerm::initOSspecifics()
|
||||||
#endif // defined(__linux__)
|
#endif // defined(__linux__)
|
||||||
|
|
||||||
#if defined(__FreeBSD__) || defined(__DragonFly__)
|
#if defined(__FreeBSD__) || defined(__DragonFly__)
|
||||||
|
freebsd->setFSystem(fsys);
|
||||||
|
|
||||||
if ( init_values.meta_sends_escape )
|
if ( init_values.meta_sends_escape )
|
||||||
freebsd->enableMetaSendsEscape();
|
freebsd->enableMetaSendsEscape();
|
||||||
else
|
else
|
||||||
|
@ -1937,6 +1953,8 @@ void FTerm::initOSspecifics()
|
||||||
|
|
||||||
freebsd->init(); // Initialize BSD console
|
freebsd->init(); // Initialize BSD console
|
||||||
#elif defined(__NetBSD__) || defined(__OpenBSD__)
|
#elif defined(__NetBSD__) || defined(__OpenBSD__)
|
||||||
|
openbsd->setFSystem(fsys);
|
||||||
|
|
||||||
if ( init_values.meta_sends_escape )
|
if ( init_values.meta_sends_escape )
|
||||||
openbsd->enableMetaSendsEscape();
|
openbsd->enableMetaSendsEscape();
|
||||||
else
|
else
|
||||||
|
@ -1966,7 +1984,7 @@ void FTerm::initBaudRate()
|
||||||
uInt baud = FTermios::getBaudRate();
|
uInt baud = FTermios::getBaudRate();
|
||||||
data->setBaudrate(baud);
|
data->setBaudrate(baud);
|
||||||
|
|
||||||
if ( isatty(stdout_no) )
|
if ( fsys->isTTY(stdout_no) )
|
||||||
opti_move->setBaudRate(int(baud));
|
opti_move->setBaudRate(int(baud));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2120,7 +2138,7 @@ void FTerm::signal_handler (int signum)
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
uInt env2uint (const char* env)
|
uInt env2uint (const char* env)
|
||||||
{
|
{
|
||||||
FString str(env);
|
FString str(getenv(env));
|
||||||
|
|
||||||
if ( str.isEmpty() )
|
if ( str.isEmpty() )
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -32,6 +32,7 @@ FTermDetection::terminalType FTermDetection::terminal_type = \
|
||||||
FTermDetection::colorEnv FTermDetection::color_env;
|
FTermDetection::colorEnv FTermDetection::color_env;
|
||||||
FTermDetection::secondaryDA FTermDetection::secondary_da;
|
FTermDetection::secondaryDA FTermDetection::secondary_da;
|
||||||
FTermData* FTermDetection::fterm_data = nullptr;
|
FTermData* FTermDetection::fterm_data = nullptr;
|
||||||
|
FSystem* FTermDetection::fsystem = nullptr;
|
||||||
char FTermDetection::termtype[256] = { };
|
char FTermDetection::termtype[256] = { };
|
||||||
char FTermDetection::ttytypename[256] = { };
|
char FTermDetection::ttytypename[256] = { };
|
||||||
bool FTermDetection::decscusr_support;
|
bool FTermDetection::decscusr_support;
|
||||||
|
@ -90,6 +91,12 @@ void FTermDetection::setFTermData (FTermData* data)
|
||||||
fterm_data = data;
|
fterm_data = data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
void FTermDetection::setFSystem (FSystem* fsys)
|
||||||
|
{
|
||||||
|
fsystem = fsys;
|
||||||
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FTermDetection::setTtyTypeFileName (char ttytype_filename[])
|
void FTermDetection::setTtyTypeFileName (char ttytype_filename[])
|
||||||
{
|
{
|
||||||
|
@ -180,7 +187,7 @@ bool FTermDetection::getTTYtype()
|
||||||
|
|
||||||
std::FILE *fp;
|
std::FILE *fp;
|
||||||
|
|
||||||
if ( (fp = std::fopen(ttytypename, "r")) != 0 )
|
if ( fsystem && (fp = fsystem->fopen(ttytypename, "r")) != 0 )
|
||||||
{
|
{
|
||||||
char* p;
|
char* p;
|
||||||
char str[BUFSIZ];
|
char str[BUFSIZ];
|
||||||
|
@ -210,12 +217,12 @@ bool FTermDetection::getTTYtype()
|
||||||
// Save name in termtype
|
// Save name in termtype
|
||||||
std::strncpy (termtype, type, sizeof(termtype));
|
std::strncpy (termtype, type, sizeof(termtype));
|
||||||
termtype[sizeof(termtype) - 1] = '\0';
|
termtype[sizeof(termtype) - 1] = '\0';
|
||||||
std::fclose(fp);
|
fsystem->fclose(fp);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
std::fclose(fp);
|
fsystem->fclose(fp);
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
* *
|
* *
|
||||||
* This file is part of the Final Cut widget toolkit *
|
* This file is part of the Final Cut widget toolkit *
|
||||||
* *
|
* *
|
||||||
* Copyright 2018 Markus Gans *
|
* Copyright 2018-2019 Markus Gans *
|
||||||
* *
|
* *
|
||||||
* The Final Cut is free software; you can redistribute it and/or *
|
* The Final Cut is free software; you can redistribute it and/or *
|
||||||
* modify it under the terms of the GNU Lesser General Public License *
|
* modify it under the terms of the GNU Lesser General Public License *
|
||||||
|
@ -32,6 +32,7 @@ namespace finalcut
|
||||||
FTermFreeBSD::CursorStyle FTermFreeBSD::cursor_style = fc::normal_cursor;
|
FTermFreeBSD::CursorStyle FTermFreeBSD::cursor_style = fc::normal_cursor;
|
||||||
bool FTermFreeBSD::change_cursorstyle = true;
|
bool FTermFreeBSD::change_cursorstyle = true;
|
||||||
bool FTermFreeBSD::meta_sends_escape = true;
|
bool FTermFreeBSD::meta_sends_escape = true;
|
||||||
|
FSystem* FTermFreeBSD::fsystem = nullptr;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
@ -52,10 +53,7 @@ void FTermFreeBSD::setCursorStyle (CursorStyle style, bool hidden)
|
||||||
{
|
{
|
||||||
// Set cursor style in a BSD console
|
// Set cursor style in a BSD console
|
||||||
|
|
||||||
if ( ! isFreeBSDConsole() )
|
if ( ! fsysten || ! isFreeBSDConsole() || ! change_cursorstyle )
|
||||||
return;
|
|
||||||
|
|
||||||
if ( ! change_cursorstyle )
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
cursor_style = style;
|
cursor_style = style;
|
||||||
|
@ -63,7 +61,7 @@ void FTermFreeBSD::setCursorStyle (CursorStyle style, bool hidden)
|
||||||
if ( hidden )
|
if ( hidden )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
ioctl(0, CONS_CURSORTYPE, &style);
|
fsysten->ioControl (0, CONS_CURSORTYPE, &style);
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
@ -73,7 +71,7 @@ bool FTermFreeBSD::isFreeBSDConsole()
|
||||||
|
|
||||||
keymap_t keymap;
|
keymap_t keymap;
|
||||||
|
|
||||||
if ( ioctl(0, GIO_KEYMAP, &keymap) == 0 )
|
if ( fsysten && fsysten->ioControl(0, GIO_KEYMAP, &keymap) == 0 )
|
||||||
return true;
|
return true;
|
||||||
else
|
else
|
||||||
return false;
|
return false;
|
||||||
|
@ -145,10 +143,11 @@ bool FTermFreeBSD::saveFreeBSDAltKey()
|
||||||
// Saving the current mapping for the alt key
|
// Saving the current mapping for the alt key
|
||||||
|
|
||||||
static constexpr int left_alt = 0x38;
|
static constexpr int left_alt = 0x38;
|
||||||
int ret;
|
int ret = -1;
|
||||||
keymap_t keymap;
|
keymap_t keymap;
|
||||||
|
|
||||||
ret = ioctl(0, GIO_KEYMAP, &keymap);
|
if ( fsystem )
|
||||||
|
ret = fsysten->ioControl (0, GIO_KEYMAP, &keymap);
|
||||||
|
|
||||||
if ( ret < 0 )
|
if ( ret < 0 )
|
||||||
return false;
|
return false;
|
||||||
|
@ -164,10 +163,11 @@ bool FTermFreeBSD::setFreeBSDAltKey (uInt key)
|
||||||
// Remapping the alt key
|
// Remapping the alt key
|
||||||
|
|
||||||
static constexpr int left_alt = 0x38;
|
static constexpr int left_alt = 0x38;
|
||||||
int ret;
|
int ret = -1;
|
||||||
keymap_t keymap;
|
keymap_t keymap;
|
||||||
|
|
||||||
ret = ioctl(0, GIO_KEYMAP, &keymap);
|
if ( fsystem )
|
||||||
|
ret = fsysten->ioControl (0, GIO_KEYMAP, &keymap);
|
||||||
|
|
||||||
if ( ret < 0 )
|
if ( ret < 0 )
|
||||||
return false;
|
return false;
|
||||||
|
@ -175,7 +175,8 @@ bool FTermFreeBSD::setFreeBSDAltKey (uInt key)
|
||||||
// map to meta key
|
// map to meta key
|
||||||
keymap.key[left_alt].map[0] = key;
|
keymap.key[left_alt].map[0] = key;
|
||||||
|
|
||||||
if ( (keymap.n_keys > 0) && (ioctl(0, PIO_KEYMAP, &keymap) < 0) )
|
if ( (keymap.n_keys > 0)
|
||||||
|
&& fsystem && (fsysten->ioControl(0, PIO_KEYMAP, &keymap) < 0) )
|
||||||
return false;
|
return false;
|
||||||
else
|
else
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -45,6 +45,7 @@ namespace finalcut
|
||||||
bool FTermLinux::has_saved_palette = false;
|
bool FTermLinux::has_saved_palette = false;
|
||||||
|
|
||||||
FTermData* FTermLinux::fterm_data = nullptr;
|
FTermData* FTermLinux::fterm_data = nullptr;
|
||||||
|
FSystem* FTermLinux::fsystem = nullptr;
|
||||||
FTermDetection* FTermLinux::term_detection = nullptr;
|
FTermDetection* FTermLinux::term_detection = nullptr;
|
||||||
fc::linuxConsoleCursorStyle FTermLinux::linux_console_cursor_style;
|
fc::linuxConsoleCursorStyle FTermLinux::linux_console_cursor_style;
|
||||||
FTermLinux::ColorMap FTermLinux::saved_color_map;
|
FTermLinux::ColorMap FTermLinux::saved_color_map;
|
||||||
|
@ -135,12 +136,15 @@ bool FTermLinux::isLinuxConsole()
|
||||||
{
|
{
|
||||||
// Check if it's a Linux console
|
// Check if it's a Linux console
|
||||||
|
|
||||||
|
if ( ! fsystem )
|
||||||
|
return false;
|
||||||
|
|
||||||
char arg = 0;
|
char arg = 0;
|
||||||
int fd_tty = FTerm::getTTYFileDescriptor();
|
int fd_tty = FTerm::getTTYFileDescriptor();
|
||||||
|
|
||||||
// get keyboard type an compare
|
// get keyboard type an compare
|
||||||
return ( isatty (fd_tty)
|
return ( fsystem->isTTY(fd_tty)
|
||||||
&& ioctl(fd_tty, KDGKBTYPE, &arg) == 0
|
&& fsystem->ioControl(fd_tty, KDGKBTYPE, &arg) == 0
|
||||||
&& ((arg == KB_101) || (arg == KB_84)) );
|
&& ((arg == KB_101) || (arg == KB_84)) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -471,31 +475,33 @@ FKey FTermLinux::modifierKeyCorrection (const FKey& key_id)
|
||||||
int FTermLinux::getFramebuffer_bpp()
|
int FTermLinux::getFramebuffer_bpp()
|
||||||
{
|
{
|
||||||
int fd = -1;
|
int fd = -1;
|
||||||
|
const char* fb = C_STR("/dev/fb/0");
|
||||||
struct fb_var_screeninfo fb_var;
|
struct fb_var_screeninfo fb_var;
|
||||||
struct fb_fix_screeninfo fb_fix;
|
struct fb_fix_screeninfo fb_fix;
|
||||||
|
|
||||||
const char* fb = C_STR("/dev/fb/0");
|
if ( ! fsystem )
|
||||||
|
return -1;
|
||||||
|
|
||||||
if ( (fd = open(fb, O_RDWR)) < 0 )
|
if ( (fd = fsystem->open(fb, O_RDWR)) < 0 )
|
||||||
{
|
{
|
||||||
if ( errno != ENOENT && errno != ENOTDIR )
|
if ( errno != ENOENT && errno != ENOTDIR )
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
fb = C_STR("/dev/fb0");
|
fb = C_STR("/dev/fb0");
|
||||||
|
|
||||||
if ( (fd = open(fb, O_RDWR)) < 0 )
|
if ( (fd = fsystem->open(fb, O_RDWR)) < 0 )
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( ! ioctl(fd, FBIOGET_VSCREENINFO, &fb_var)
|
if ( ! fsystem->ioControl(fd, FBIOGET_VSCREENINFO, &fb_var)
|
||||||
&& ! ioctl(fd, FBIOGET_FSCREENINFO, &fb_fix) )
|
&& ! fsystem->ioControl(fd, FBIOGET_FSCREENINFO, &fb_fix) )
|
||||||
{
|
{
|
||||||
::close(fd);
|
fsystem->close(fd);
|
||||||
return int(fb_var.bits_per_pixel);
|
return int(fb_var.bits_per_pixel);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
::close(fd);
|
fsystem->close(fd);
|
||||||
}
|
}
|
||||||
|
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -506,8 +512,7 @@ bool FTermLinux::getScreenFont()
|
||||||
{
|
{
|
||||||
struct console_font_op font;
|
struct console_font_op font;
|
||||||
int fd_tty = FTerm::getTTYFileDescriptor();
|
int fd_tty = FTerm::getTTYFileDescriptor();
|
||||||
|
int ret = -1;
|
||||||
int ret;
|
|
||||||
|
|
||||||
if ( fd_tty < 0 )
|
if ( fd_tty < 0 )
|
||||||
return false;
|
return false;
|
||||||
|
@ -534,7 +539,8 @@ bool FTermLinux::getScreenFont()
|
||||||
}
|
}
|
||||||
|
|
||||||
// font operation
|
// font operation
|
||||||
ret = ioctl (fd_tty, KDFONTOP, &font);
|
if ( fsystem )
|
||||||
|
ret = fsystem->ioControl (fd_tty, KDFONTOP, &font);
|
||||||
|
|
||||||
if ( ret == 0 )
|
if ( ret == 0 )
|
||||||
{
|
{
|
||||||
|
@ -551,7 +557,7 @@ bool FTermLinux::getScreenFont()
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
bool FTermLinux::getUnicodeMap()
|
bool FTermLinux::getUnicodeMap()
|
||||||
{
|
{
|
||||||
int ret;
|
int ret = -1;
|
||||||
int fd_tty = FTerm::getTTYFileDescriptor();
|
int fd_tty = FTerm::getTTYFileDescriptor();
|
||||||
|
|
||||||
if ( fd_tty < 0 )
|
if ( fd_tty < 0 )
|
||||||
|
@ -561,7 +567,8 @@ bool FTermLinux::getUnicodeMap()
|
||||||
screen_unicode_map.entries = nullptr;
|
screen_unicode_map.entries = nullptr;
|
||||||
|
|
||||||
// get count
|
// get count
|
||||||
ret = ioctl (fd_tty, GIO_UNIMAP, &screen_unicode_map);
|
if ( fsystem )
|
||||||
|
ret = fsystem->ioControl (fd_tty, GIO_UNIMAP, &screen_unicode_map);
|
||||||
|
|
||||||
if ( ret != 0 )
|
if ( ret != 0 )
|
||||||
{
|
{
|
||||||
|
@ -581,7 +588,8 @@ bool FTermLinux::getUnicodeMap()
|
||||||
}
|
}
|
||||||
|
|
||||||
// get unicode-to-font mapping from kernel
|
// get unicode-to-font mapping from kernel
|
||||||
ret = ioctl(fd_tty, GIO_UNIMAP, &screen_unicode_map);
|
if ( fsystem )
|
||||||
|
ret = fsystem->ioControl (fd_tty, GIO_UNIMAP, &screen_unicode_map);
|
||||||
|
|
||||||
if ( ret != 0 )
|
if ( ret != 0 )
|
||||||
return false;
|
return false;
|
||||||
|
@ -601,7 +609,7 @@ FTermLinux::modifier_key& FTermLinux::getModifierKey()
|
||||||
std::memset (&mod_key, 0x00, sizeof(mod_key));
|
std::memset (&mod_key, 0x00, sizeof(mod_key));
|
||||||
|
|
||||||
// TIOCLINUX, subcode = 6 (TIOCL_GETSHIFTSTATE)
|
// TIOCLINUX, subcode = 6 (TIOCL_GETSHIFTSTATE)
|
||||||
if ( ioctl(0, TIOCLINUX, &subcode) >= 0 )
|
if ( fsystem && fsystem->ioControl(0, TIOCLINUX, &subcode) >= 0 )
|
||||||
{
|
{
|
||||||
if ( subcode & (1 << KG_SHIFT) )
|
if ( subcode & (1 << KG_SHIFT) )
|
||||||
mod_key.shift = true;
|
mod_key.shift = true;
|
||||||
|
@ -625,8 +633,8 @@ int FTermLinux::setScreenFont ( uChar fontdata[], uInt count
|
||||||
, bool direct)
|
, bool direct)
|
||||||
{
|
{
|
||||||
struct console_font_op font;
|
struct console_font_op font;
|
||||||
int ret;
|
|
||||||
int fd_tty = FTerm::getTTYFileDescriptor();
|
int fd_tty = FTerm::getTTYFileDescriptor();
|
||||||
|
int ret = -1;
|
||||||
|
|
||||||
if ( fd_tty < 0 )
|
if ( fd_tty < 0 )
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -664,7 +672,8 @@ int FTermLinux::setScreenFont ( uChar fontdata[], uInt count
|
||||||
}
|
}
|
||||||
|
|
||||||
// font operation
|
// font operation
|
||||||
ret = ioctl (fd_tty, KDFONTOP, &font);
|
if ( fsystem )
|
||||||
|
ret = fsystem->ioControl (fd_tty, KDFONTOP, &font);
|
||||||
|
|
||||||
if ( ret != 0 && errno != ENOSYS && errno != EINVAL )
|
if ( ret != 0 && errno != ENOSYS && errno != EINVAL )
|
||||||
{
|
{
|
||||||
|
@ -687,8 +696,8 @@ int FTermLinux::setScreenFont ( uChar fontdata[], uInt count
|
||||||
int FTermLinux::setUnicodeMap (struct unimapdesc* unimap)
|
int FTermLinux::setUnicodeMap (struct unimapdesc* unimap)
|
||||||
{
|
{
|
||||||
struct unimapinit advice;
|
struct unimapinit advice;
|
||||||
int ret;
|
|
||||||
int fd_tty = FTerm::getTTYFileDescriptor();
|
int fd_tty = FTerm::getTTYFileDescriptor();
|
||||||
|
int ret = -1;
|
||||||
|
|
||||||
if ( fd_tty < 0 )
|
if ( fd_tty < 0 )
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -700,13 +709,15 @@ int FTermLinux::setUnicodeMap (struct unimapdesc* unimap)
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
// clear the unicode-to-font table
|
// clear the unicode-to-font table
|
||||||
ret = ioctl(fd_tty, PIO_UNIMAPCLR, &advice);
|
if ( fsystem )
|
||||||
|
ret = fsystem->ioControl (fd_tty, PIO_UNIMAPCLR, &advice);
|
||||||
|
|
||||||
if ( ret != 0 )
|
if ( ret != 0 )
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
// put the new unicode-to-font mapping in kernel
|
// put the new unicode-to-font mapping in kernel
|
||||||
ret = ioctl(fd_tty, PIO_UNIMAP, unimap);
|
if ( fsystem )
|
||||||
|
ret = fsystem->ioControl (fd_tty, PIO_UNIMAP, unimap);
|
||||||
|
|
||||||
if ( ret != 0 )
|
if ( ret != 0 )
|
||||||
advice.advised_hashlevel++;
|
advice.advised_hashlevel++;
|
||||||
|
@ -725,9 +736,13 @@ inline uInt16 FTermLinux::getInputStatusRegisterOne()
|
||||||
{
|
{
|
||||||
// Gets the VGA input-status-register-1
|
// Gets the VGA input-status-register-1
|
||||||
|
|
||||||
|
if ( ! fsystem )
|
||||||
|
return 0x3da;
|
||||||
|
|
||||||
// Miscellaneous output (read port)
|
// Miscellaneous output (read port)
|
||||||
static constexpr uInt16 misc_read = 0x3cc;
|
static constexpr uInt16 misc_read = 0x3cc;
|
||||||
const uInt16 io_base = ( inb(misc_read) & 0x01 ) ? 0x3d0 : 0x3b0;
|
uChar misc_value = fsystem->inPortByte(misc_read);
|
||||||
|
const uInt16 io_base = ( misc_value & 0x01 ) ? 0x3d0 : 0x3b0;
|
||||||
// 0x3ba : Input status 1 mono/MDA (read port)
|
// 0x3ba : Input status 1 mono/MDA (read port)
|
||||||
// 0x3da : Input status 1 color/CGA (read port)
|
// 0x3da : Input status 1 color/CGA (read port)
|
||||||
return io_base + 0x0a;
|
return io_base + 0x0a;
|
||||||
|
@ -738,6 +753,9 @@ uChar FTermLinux::readAttributeController (uChar index)
|
||||||
{
|
{
|
||||||
// Reads a byte from the attribute controller from a given index
|
// Reads a byte from the attribute controller from a given index
|
||||||
|
|
||||||
|
if ( ! fsystem )
|
||||||
|
return 0;
|
||||||
|
|
||||||
uChar res;
|
uChar res;
|
||||||
// Attribute controller (write port)
|
// Attribute controller (write port)
|
||||||
static constexpr uInt16 attrib_cntlr_write = 0x3c0;
|
static constexpr uInt16 attrib_cntlr_write = 0x3c0;
|
||||||
|
@ -745,15 +763,15 @@ uChar FTermLinux::readAttributeController (uChar index)
|
||||||
static constexpr uInt16 attrib_cntlr_read = 0x3c1;
|
static constexpr uInt16 attrib_cntlr_read = 0x3c1;
|
||||||
const uInt16 input_status_1 = getInputStatusRegisterOne();
|
const uInt16 input_status_1 = getInputStatusRegisterOne();
|
||||||
|
|
||||||
inb (input_status_1); // switch to index mode
|
fsystem->inPortByte (input_status_1); // switch to index mode
|
||||||
outb (index & 0x1f, attrib_cntlr_write); // selects address register
|
fsystem->outPortByte (index & 0x1f, attrib_cntlr_write); // selects address register
|
||||||
res = inb (attrib_cntlr_read); // read from data register
|
res = fsystem->inPortByte (attrib_cntlr_read); // read from data register
|
||||||
|
|
||||||
// Disable access to the palette and unblank the display
|
// Disable access to the palette and unblank the display
|
||||||
inb (input_status_1); // switch to index mode
|
fsystem->inPortByte (input_status_1); // switch to index mode
|
||||||
index = (index & 0x1f) | 0x20; // set bit 5 (enable display)
|
index = (index & 0x1f) | 0x20; // set bit 5 (enable display)
|
||||||
outb (index, attrib_cntlr_write);
|
fsystem->outPortByte (index, attrib_cntlr_write);
|
||||||
inb (attrib_cntlr_read);
|
fsystem->inPortByte (attrib_cntlr_read);
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
@ -763,19 +781,22 @@ void FTermLinux::writeAttributeController (uChar index, uChar data)
|
||||||
{
|
{
|
||||||
// Writes a byte from the attribute controller from a given index
|
// Writes a byte from the attribute controller from a given index
|
||||||
|
|
||||||
|
if ( ! fsystem )
|
||||||
|
return;
|
||||||
|
|
||||||
// Attribute controller (write port)
|
// Attribute controller (write port)
|
||||||
static constexpr uInt16 attrib_cntlr_write = 0x3c0;
|
static constexpr uInt16 attrib_cntlr_write = 0x3c0;
|
||||||
const uInt16 input_status_1 = getInputStatusRegisterOne();
|
const uInt16 input_status_1 = getInputStatusRegisterOne();
|
||||||
|
|
||||||
inb (input_status_1); // switch to index mode
|
fsystem->inPortByte (input_status_1); // switch to index mode
|
||||||
outb (index & 0x1f, attrib_cntlr_write); // selects address register
|
fsystem->outPortByte (index & 0x1f, attrib_cntlr_write); // selects address register
|
||||||
outb (data, attrib_cntlr_write); // write to data register
|
fsystem->outPortByte (data, attrib_cntlr_write); // write to data register
|
||||||
|
|
||||||
// Disable access to the palette and unblank the display
|
// Disable access to the palette and unblank the display
|
||||||
inb (input_status_1); // switch to index mode
|
fsystem->inPortByte (input_status_1); // switch to index mode
|
||||||
index = (index & 0x1f) | 0x20; // set bit 5 (enable display)
|
index = (index & 0x1f) | 0x20; // set bit 5 (enable display)
|
||||||
outb (index, attrib_cntlr_write);
|
fsystem->outPortByte (index, attrib_cntlr_write);
|
||||||
outb (data, attrib_cntlr_write);
|
fsystem->outPortByte (data, attrib_cntlr_write);
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
@ -800,6 +821,9 @@ int FTermLinux::setBlinkAsIntensity (bool enable)
|
||||||
// Uses blink-bit as background intensity.
|
// Uses blink-bit as background intensity.
|
||||||
// That permits 16 colors for background
|
// That permits 16 colors for background
|
||||||
|
|
||||||
|
if ( ! fsystem )
|
||||||
|
return -1;
|
||||||
|
|
||||||
int fd_tty = FTerm::getTTYFileDescriptor();
|
int fd_tty = FTerm::getTTYFileDescriptor();
|
||||||
|
|
||||||
// Test if the blink-bit is used by the screen font (512 characters)
|
// Test if the blink-bit is used by the screen font (512 characters)
|
||||||
|
@ -813,7 +837,7 @@ int FTermLinux::setBlinkAsIntensity (bool enable)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
// Enable access to VGA I/O ports (from 0x3B4 with num = 0x2C)
|
// Enable access to VGA I/O ports (from 0x3B4 with num = 0x2C)
|
||||||
if ( ioctl(fd_tty, KDENABIO, 0) < 0 )
|
if ( fsystem->ioControl(fd_tty, KDENABIO, 0) < 0 )
|
||||||
return -1; // error on KDENABIO
|
return -1; // error on KDENABIO
|
||||||
|
|
||||||
if ( enable )
|
if ( enable )
|
||||||
|
@ -822,7 +846,7 @@ int FTermLinux::setBlinkAsIntensity (bool enable)
|
||||||
setAttributeMode (getAttributeMode() | 0x08); // set bit 3
|
setAttributeMode (getAttributeMode() | 0x08); // set bit 3
|
||||||
|
|
||||||
// Disable access to VGA I/O ports
|
// Disable access to VGA I/O ports
|
||||||
if ( ioctl(fd_tty, KDDISABIO, 0) < 0 )
|
if ( fsystem->ioControl(fd_tty, KDDISABIO, 0) < 0 )
|
||||||
return -1; // error on KDDISABIO
|
return -1; // error on KDDISABIO
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -842,7 +866,7 @@ bool FTermLinux::setVGAPalette (FColor index, int r, int g, int b)
|
||||||
cmap.color[index].blue = uChar(b);
|
cmap.color[index].blue = uChar(b);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( ioctl (0, PIO_CMAP, &cmap) )
|
if ( fsystem && fsystem->ioControl (0, PIO_CMAP, &cmap) )
|
||||||
return false;
|
return false;
|
||||||
else
|
else
|
||||||
return true;
|
return true;
|
||||||
|
@ -853,7 +877,7 @@ bool FTermLinux::saveVGAPalette()
|
||||||
{
|
{
|
||||||
// Save the current vga color map
|
// Save the current vga color map
|
||||||
|
|
||||||
if ( ioctl (0, GIO_CMAP, &saved_color_map) )
|
if ( fsystem && fsystem->ioControl (0, GIO_CMAP, &saved_color_map) )
|
||||||
has_saved_palette = false;
|
has_saved_palette = false;
|
||||||
else
|
else
|
||||||
has_saved_palette = true;
|
has_saved_palette = true;
|
||||||
|
@ -866,14 +890,17 @@ bool FTermLinux::resetVGAPalette()
|
||||||
{
|
{
|
||||||
// Reset the vga color map
|
// Reset the vga color map
|
||||||
|
|
||||||
|
if ( ! fsystem )
|
||||||
|
return false;
|
||||||
|
|
||||||
if ( has_saved_palette )
|
if ( has_saved_palette )
|
||||||
{
|
{
|
||||||
if ( ioctl (0, PIO_CMAP, &saved_color_map) )
|
if ( fsystem->ioControl (0, PIO_CMAP, &saved_color_map) )
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
rgb defaultColor[16] =
|
constexpr rgb defaultColor[16] =
|
||||||
{
|
{
|
||||||
{0x00, 0x00, 0x00}, {0xaa, 0x00, 0x00},
|
{0x00, 0x00, 0x00}, {0xaa, 0x00, 0x00},
|
||||||
{0x00, 0xaa, 0x00}, {0xaa, 0x55, 0x00},
|
{0x00, 0xaa, 0x00}, {0xaa, 0x55, 0x00},
|
||||||
|
@ -892,7 +919,7 @@ bool FTermLinux::resetVGAPalette()
|
||||||
cmap.color[index].blue = defaultColor[index].blue;
|
cmap.color[index].blue = defaultColor[index].blue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( ioctl (0, PIO_CMAP, &cmap) )
|
if ( fsystem->ioControl (0, PIO_CMAP, &cmap) )
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
* *
|
* *
|
||||||
* This file is part of the Final Cut widget toolkit *
|
* This file is part of the Final Cut widget toolkit *
|
||||||
* *
|
* *
|
||||||
* Copyright 2018 Markus Gans *
|
* Copyright 2018-2019 Markus Gans *
|
||||||
* *
|
* *
|
||||||
* The Final Cut is free software; you can redistribute it and/or *
|
* The Final Cut is free software; you can redistribute it and/or *
|
||||||
* modify it under the terms of the GNU Lesser General Public License *
|
* modify it under the terms of the GNU Lesser General Public License *
|
||||||
|
@ -29,6 +29,7 @@ namespace finalcut
|
||||||
#if defined(__NetBSD__) || defined(__OpenBSD__)
|
#if defined(__NetBSD__) || defined(__OpenBSD__)
|
||||||
kbd_t FTermOpenBSD::bsd_keyboard_encoding = 0;
|
kbd_t FTermOpenBSD::bsd_keyboard_encoding = 0;
|
||||||
bool FTermOpenBSD::meta_sends_escape = true;
|
bool FTermOpenBSD::meta_sends_escape = true;
|
||||||
|
FSystem* FTermOpenBSD::fsystem = nullptr;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
@ -45,7 +46,8 @@ bool FTermOpenBSD::isBSDConsole()
|
||||||
|
|
||||||
static kbd_t kbdencoding;
|
static kbd_t kbdencoding;
|
||||||
|
|
||||||
if ( ioctl(0, WSKBDIO_GETENCODING, &kbdencoding) == 0 )
|
if ( fsystem
|
||||||
|
&& fsysten->ioControl(0, WSKBDIO_GETENCODING, &kbdencoding) == 0 )
|
||||||
return true;
|
return true;
|
||||||
else
|
else
|
||||||
return false;
|
return false;
|
||||||
|
@ -85,7 +87,10 @@ void FTermOpenBSD::finish()
|
||||||
bool FTermOpenBSD::saveBSDConsoleEncoding()
|
bool FTermOpenBSD::saveBSDConsoleEncoding()
|
||||||
{
|
{
|
||||||
static kbd_t k_encoding;
|
static kbd_t k_encoding;
|
||||||
int ret = ioctl(0, WSKBDIO_GETENCODING, &k_encoding);
|
int ret = -1;
|
||||||
|
|
||||||
|
if ( fsystem )
|
||||||
|
ret = fsysten->ioControl (0, WSKBDIO_GETENCODING, &k_encoding);
|
||||||
|
|
||||||
if ( ret < 0 )
|
if ( ret < 0 )
|
||||||
return false;
|
return false;
|
||||||
|
@ -98,7 +103,8 @@ bool FTermOpenBSD::saveBSDConsoleEncoding()
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
bool FTermOpenBSD::setBSDConsoleEncoding (kbd_t k_encoding)
|
bool FTermOpenBSD::setBSDConsoleEncoding (kbd_t k_encoding)
|
||||||
{
|
{
|
||||||
if ( ioctl(0, WSKBDIO_SETENCODING, &k_encoding) < 0 )
|
if ( fsysten
|
||||||
|
&& fsysten->ioControl(0, WSKBDIO_SETENCODING, &k_encoding) < 0 )
|
||||||
return false;
|
return false;
|
||||||
else
|
else
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -50,9 +50,7 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Define to 1 if GPM mouse is enabled */
|
/* Define to 1 if GPM mouse is enabled */
|
||||||
#ifndef F_HAVE_LIBGPM
|
/* #undef HAVE_LIBGPM */
|
||||||
#define F_HAVE_LIBGPM 1
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Define to 1 if you have the <linux/fb.h> header file. */
|
/* Define to 1 if you have the <linux/fb.h> header file. */
|
||||||
#ifndef F_HAVE_LINUX_FB_H
|
#ifndef F_HAVE_LINUX_FB_H
|
||||||
|
|
|
@ -199,9 +199,9 @@ class FFileDialog : public FDialog
|
||||||
FString filter_pattern{};
|
FString filter_pattern{};
|
||||||
FLineEdit filename{this};
|
FLineEdit filename{this};
|
||||||
FListBox filebrowser{this};
|
FListBox filebrowser{this};
|
||||||
FCheckBox hidden{this};
|
FCheckBox hidden_check{this};
|
||||||
FButton cancel{this};
|
FButton cancel_btn{this};
|
||||||
FButton open{this};
|
FButton open_btn{this};
|
||||||
DialogType dlg_type{FFileDialog::Open};
|
DialogType dlg_type{FFileDialog::Open};
|
||||||
bool show_hidden{false};
|
bool show_hidden{false};
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,75 @@
|
||||||
|
/***********************************************************************
|
||||||
|
* fsystem.h - Abstract class for system calls *
|
||||||
|
* *
|
||||||
|
* This file is part of the Final Cut widget toolkit *
|
||||||
|
* *
|
||||||
|
* Copyright 2019 Markus Gans *
|
||||||
|
* *
|
||||||
|
* The Final Cut 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 3 of *
|
||||||
|
* the License, or (at your option) any later version. *
|
||||||
|
* *
|
||||||
|
* The Final Cut 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 program. If not, see *
|
||||||
|
* <http://www.gnu.org/licenses/>. *
|
||||||
|
***********************************************************************/
|
||||||
|
|
||||||
|
/* Standalone class
|
||||||
|
* ════════════════
|
||||||
|
*
|
||||||
|
* ▕▔▔▔▔▔▔▔▔▔▏
|
||||||
|
* ▕ FSystem ▏
|
||||||
|
* ▕▁▁▁▁▁▁▁▁▁▏
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef FSYSTEM_H
|
||||||
|
#define FSYSTEM_H
|
||||||
|
|
||||||
|
#if !defined (USE_FINAL_H) && !defined (COMPILE_FINAL_CUT)
|
||||||
|
#error "Only <final/final.h> can be included directly."
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "final/ftypes.h"
|
||||||
|
|
||||||
|
namespace finalcut
|
||||||
|
{
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
// class FSystem
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
|
||||||
|
#pragma pack(push)
|
||||||
|
#pragma pack(1)
|
||||||
|
|
||||||
|
class FSystem
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
// Constructor
|
||||||
|
FSystem();
|
||||||
|
|
||||||
|
// Destructor
|
||||||
|
virtual ~FSystem();
|
||||||
|
|
||||||
|
// Methods
|
||||||
|
virtual uChar inPortByte (uShort) = 0;
|
||||||
|
virtual void outPortByte (uChar, uShort) = 0;
|
||||||
|
virtual int isTTY (int) = 0;
|
||||||
|
virtual int ioControl (int, uLong, ...) = 0;
|
||||||
|
virtual int open (const char*, int, ...) = 0;
|
||||||
|
virtual int close (int) = 0;
|
||||||
|
virtual FILE* fopen (const char*, const char*) = 0;
|
||||||
|
virtual int fclose (FILE*) = 0;
|
||||||
|
};
|
||||||
|
#pragma pack(pop)
|
||||||
|
|
||||||
|
} // namespace finalcut
|
||||||
|
|
||||||
|
#endif // FSYSTEM_H
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,125 @@
|
||||||
|
/***********************************************************************
|
||||||
|
* fsystemimpl.h - FSystem implementation *
|
||||||
|
* *
|
||||||
|
* This file is part of the Final Cut widget toolkit *
|
||||||
|
* *
|
||||||
|
* Copyright 2019 Markus Gans *
|
||||||
|
* *
|
||||||
|
* The Final Cut 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 3 of *
|
||||||
|
* the License, or (at your option) any later version. *
|
||||||
|
* *
|
||||||
|
* The Final Cut 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 program. If not, see *
|
||||||
|
* <http://www.gnu.org/licenses/>. *
|
||||||
|
***********************************************************************/
|
||||||
|
|
||||||
|
/* Standalone class
|
||||||
|
* ════════════════
|
||||||
|
*
|
||||||
|
* ▕▔▔▔▔▔▔▔▔▔▔▔▔▔▏
|
||||||
|
* ▕ FSystemImpl ▏
|
||||||
|
* ▕▁▁▁▁▁▁▁▁▁▁▁▁▁▏
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef FSYSTEMIMPL_H
|
||||||
|
#define FSYSTEMIMPL_H
|
||||||
|
|
||||||
|
#if !defined (USE_FINAL_H) && !defined (COMPILE_FINAL_CUT)
|
||||||
|
#error "Only <final/final.h> can be included directly."
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <fcntl.h>
|
||||||
|
#include <stdarg.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <sys/ioctl.h>
|
||||||
|
#include <sys/io.h>
|
||||||
|
#include <sys/stat.h>
|
||||||
|
#include <sys/types.h>
|
||||||
|
|
||||||
|
#include "final/fc.h"
|
||||||
|
#include "final/fsystem.h"
|
||||||
|
|
||||||
|
namespace finalcut
|
||||||
|
{
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
// class FSystemImpl
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
|
||||||
|
#pragma pack(push)
|
||||||
|
#pragma pack(1)
|
||||||
|
|
||||||
|
class FSystemImpl : public FSystem
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
// Constructor
|
||||||
|
FSystemImpl();
|
||||||
|
|
||||||
|
// Destructor
|
||||||
|
virtual ~FSystemImpl();
|
||||||
|
|
||||||
|
// Methods
|
||||||
|
virtual uChar inPortByte (uShort port)
|
||||||
|
{
|
||||||
|
return ::inb (port);
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual void outPortByte (uChar value, uShort port)
|
||||||
|
{
|
||||||
|
::outb (value, port);
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual int isTTY (int fd)
|
||||||
|
{
|
||||||
|
return ::isatty(fd);
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual int ioControl (int fd, uLong request, ...)
|
||||||
|
{
|
||||||
|
va_list args;
|
||||||
|
va_start (args, request);
|
||||||
|
void* argp = va_arg (args, void*);
|
||||||
|
int ret = ::ioctl (fd, request, argp);
|
||||||
|
va_end (args);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual int open (const char* pathname, int flags, ...)
|
||||||
|
{
|
||||||
|
va_list args;
|
||||||
|
va_start (args, flags);
|
||||||
|
mode_t mode = va_arg (args, mode_t);
|
||||||
|
int ret = ::open (pathname, flags, mode);
|
||||||
|
va_end (args);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual int close (int fildes)
|
||||||
|
{
|
||||||
|
return ::close(fildes);
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual FILE* fopen (const char* path, const char* mode)
|
||||||
|
{
|
||||||
|
return std::fopen (path, mode);
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual int fclose (FILE* fp)
|
||||||
|
{
|
||||||
|
return std::fclose (fp);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
#pragma pack(pop)
|
||||||
|
|
||||||
|
} // namespace finalcut
|
||||||
|
|
||||||
|
#endif // FSYSTEMIMPL_H
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
* fterm.h - Base class for terminal detection and control *
|
* fterm.h - Base class for terminal control *
|
||||||
* *
|
* *
|
||||||
* This file is part of the Final Cut widget toolkit *
|
* This file is part of the Final Cut widget toolkit *
|
||||||
* *
|
* *
|
||||||
|
@ -124,6 +124,8 @@
|
||||||
#include "final/fpoint.h"
|
#include "final/fpoint.h"
|
||||||
#include "final/frect.h"
|
#include "final/frect.h"
|
||||||
#include "final/fstring.h"
|
#include "final/fstring.h"
|
||||||
|
#include "final/fsystem.h"
|
||||||
|
#include "final/fsystemimpl.h"
|
||||||
#include "final/ftermcap.h"
|
#include "final/ftermcap.h"
|
||||||
#include "final/ftermcapquirks.h"
|
#include "final/ftermcapquirks.h"
|
||||||
#include "final/ftermdata.h"
|
#include "final/ftermdata.h"
|
||||||
|
@ -189,6 +191,8 @@ class FTerm final
|
||||||
characterSub& getCharSubstitutionMap();
|
characterSub& getCharSubstitutionMap();
|
||||||
|
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
|
static FTermData* getFTermData();
|
||||||
|
static FTermDetection* getFTermDetection();
|
||||||
FTermDebugData& getFTermDebugData();
|
FTermDebugData& getFTermDebugData();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -393,6 +397,7 @@ class FTerm final
|
||||||
|
|
||||||
// Data Members
|
// Data Members
|
||||||
static FTermData* data;
|
static FTermData* data;
|
||||||
|
static FSystem* fsys;
|
||||||
static FTermcap::tcap_map* tcap;
|
static FTermcap::tcap_map* tcap;
|
||||||
static FOptiMove* opti_move;
|
static FOptiMove* opti_move;
|
||||||
static FOptiAttr* opti_attr;
|
static FOptiAttr* opti_attr;
|
||||||
|
@ -459,6 +464,14 @@ inline FTerm::characterSub& FTerm::getCharSubstitutionMap()
|
||||||
{ return data->getCharSubstitutionMap(); }
|
{ return data->getCharSubstitutionMap(); }
|
||||||
|
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
inline FTermData* FTerm::getFTermData()
|
||||||
|
{ return data; }
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
inline FTermDetection* FTerm::getFTermDetection()
|
||||||
|
{ return term_detection; }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline FTermDebugData& FTerm::getFTermDebugData()
|
inline FTermDebugData& FTerm::getFTermDebugData()
|
||||||
{ return *debug_data; }
|
{ return *debug_data; }
|
||||||
|
|
|
@ -61,13 +61,13 @@ class FTermData final
|
||||||
typedef std::unordered_map<wchar_t, wchar_t> characterSub;
|
typedef std::unordered_map<wchar_t, wchar_t> characterSub;
|
||||||
|
|
||||||
// Constructors
|
// Constructors
|
||||||
FTermData() = default;
|
FTermData() {}
|
||||||
|
|
||||||
// Disable copy constructor
|
// Disable copy constructor
|
||||||
FTermData (const FTermData&) = delete;
|
FTermData (const FTermData&) = delete;
|
||||||
|
|
||||||
// Destructor
|
// Destructor
|
||||||
~FTermData() = default;
|
~FTermData() {}
|
||||||
|
|
||||||
// Disable assignment operator (=)
|
// Disable assignment operator (=)
|
||||||
FTermData& operator = (const FTermData&) = delete;
|
FTermData& operator = (const FTermData&) = delete;
|
||||||
|
|
|
@ -43,6 +43,7 @@
|
||||||
|
|
||||||
#include "final/fc.h"
|
#include "final/fc.h"
|
||||||
#include "final/fconfig.h"
|
#include "final/fconfig.h"
|
||||||
|
#include "final/fsystem.h"
|
||||||
#include "final/ftermdata.h"
|
#include "final/ftermdata.h"
|
||||||
#include "final/ftermios.h"
|
#include "final/ftermios.h"
|
||||||
#include "final/ftypes.h"
|
#include "final/ftypes.h"
|
||||||
|
@ -154,6 +155,7 @@ class FTermDetection final
|
||||||
static void setTmuxTerm (bool);
|
static void setTmuxTerm (bool);
|
||||||
static void setTerminalDetection (bool);
|
static void setTerminalDetection (bool);
|
||||||
static void setFTermData (FTermData*);
|
static void setFTermData (FTermData*);
|
||||||
|
static void setFSystem (FSystem*);
|
||||||
static void setTtyTypeFileName (char[]);
|
static void setTtyTypeFileName (char[]);
|
||||||
|
|
||||||
// Methods
|
// Methods
|
||||||
|
@ -210,6 +212,7 @@ class FTermDetection final
|
||||||
static const FString* answer_back;
|
static const FString* answer_back;
|
||||||
static const FString* sec_da;
|
static const FString* sec_da;
|
||||||
static FTermData* fterm_data;
|
static FTermData* fterm_data;
|
||||||
|
static FSystem* fsystem;
|
||||||
static terminalType terminal_type;
|
static terminalType terminal_type;
|
||||||
|
|
||||||
static struct colorEnv
|
static struct colorEnv
|
||||||
|
|
|
@ -36,6 +36,7 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "final/fc.h"
|
#include "final/fc.h"
|
||||||
|
#include "final/fsystem.h"
|
||||||
#include "final/ftypes.h"
|
#include "final/ftypes.h"
|
||||||
|
|
||||||
#if defined(__FreeBSD__) || defined(__DragonFly__)
|
#if defined(__FreeBSD__) || defined(__DragonFly__)
|
||||||
|
@ -82,6 +83,7 @@ class FTermFreeBSD final
|
||||||
static bool isFreeBSDConsole();
|
static bool isFreeBSDConsole();
|
||||||
|
|
||||||
// Mutators
|
// Mutators
|
||||||
|
static void setFSystem (FSystem*);
|
||||||
static void setCursorStyle (CursorStyle, bool);
|
static void setCursorStyle (CursorStyle, bool);
|
||||||
static void enableChangeCursorStyle();
|
static void enableChangeCursorStyle();
|
||||||
static void disableChangeCursorStyle();
|
static void disableChangeCursorStyle();
|
||||||
|
@ -106,6 +108,7 @@ class FTermFreeBSD final
|
||||||
static CursorStyle cursor_style;
|
static CursorStyle cursor_style;
|
||||||
static bool change_cursorstyle;
|
static bool change_cursorstyle;
|
||||||
static bool meta_sends_escape;
|
static bool meta_sends_escape;
|
||||||
|
static FSystem* fsystem;
|
||||||
};
|
};
|
||||||
#pragma pack(pop)
|
#pragma pack(pop)
|
||||||
|
|
||||||
|
@ -116,6 +119,10 @@ inline const char* FTermFreeBSD::getClassName() const
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
#if defined(__FreeBSD__) || defined(__DragonFly__)
|
#if defined(__FreeBSD__) || defined(__DragonFly__)
|
||||||
|
inline void FTermFreeBSD::setFSystem (FSystem* fsys)
|
||||||
|
{ fsystem = fsys; }
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
inline void FTermFreeBSD::enableChangeCursorStyle()
|
inline void FTermFreeBSD::enableChangeCursorStyle()
|
||||||
{ change_cursorstyle = true; }
|
{ change_cursorstyle = true; }
|
||||||
|
|
||||||
|
|
|
@ -53,6 +53,7 @@
|
||||||
|
|
||||||
#include "final/fc.h"
|
#include "final/fc.h"
|
||||||
#include "final/fcharmap.h"
|
#include "final/fcharmap.h"
|
||||||
|
#include "final/fsystem.h"
|
||||||
#include "final/ftermdetection.h"
|
#include "final/ftermdetection.h"
|
||||||
#include "final/ftypes.h"
|
#include "final/ftypes.h"
|
||||||
|
|
||||||
|
@ -88,6 +89,7 @@ class FTermLinux final
|
||||||
|
|
||||||
// Mutators
|
// Mutators
|
||||||
static void setFTermData (FTermData*);
|
static void setFTermData (FTermData*);
|
||||||
|
static void setFSystem (FSystem*);
|
||||||
static void setFTermDetection (FTermDetection*);
|
static void setFTermDetection (FTermDetection*);
|
||||||
static char* setCursorStyle (fc::linuxConsoleCursorStyle, bool);
|
static char* setCursorStyle (fc::linuxConsoleCursorStyle, bool);
|
||||||
static bool setPalette (FColor, int, int, int);
|
static bool setPalette (FColor, int, int, int);
|
||||||
|
@ -181,6 +183,7 @@ class FTermLinux final
|
||||||
static bool half_block_character;
|
static bool half_block_character;
|
||||||
static bool has_saved_palette;
|
static bool has_saved_palette;
|
||||||
static FTermData* fterm_data;
|
static FTermData* fterm_data;
|
||||||
|
static FSystem* fsystem;
|
||||||
static FTermDetection* term_detection;
|
static FTermDetection* term_detection;
|
||||||
static fc::linuxConsoleCursorStyle
|
static fc::linuxConsoleCursorStyle
|
||||||
linux_console_cursor_style;
|
linux_console_cursor_style;
|
||||||
|
@ -207,6 +210,10 @@ inline int FTermLinux::getFramebufferBpp()
|
||||||
inline void FTermLinux::setFTermData (FTermData* data)
|
inline void FTermLinux::setFTermData (FTermData* data)
|
||||||
{ fterm_data = data; }
|
{ fterm_data = data; }
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
inline void FTermLinux::setFSystem (FSystem* fsys)
|
||||||
|
{ fsystem = fsys; }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline void FTermLinux::setFTermDetection (FTermDetection* td)
|
inline void FTermLinux::setFTermDetection (FTermDetection* td)
|
||||||
{ term_detection = td; }
|
{ term_detection = td; }
|
||||||
|
|
|
@ -36,6 +36,7 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <sys/ioctl.h>
|
#include <sys/ioctl.h>
|
||||||
|
#include "final/fsystem.h"
|
||||||
|
|
||||||
#if defined(__NetBSD__) || defined(__OpenBSD__)
|
#if defined(__NetBSD__) || defined(__OpenBSD__)
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
|
@ -74,6 +75,7 @@ class FTermOpenBSD final
|
||||||
static bool isBSDConsole();
|
static bool isBSDConsole();
|
||||||
|
|
||||||
// Mutators
|
// Mutators
|
||||||
|
static void setFSystem (FSystem*);
|
||||||
static void disableMetaSendsEscape();
|
static void disableMetaSendsEscape();
|
||||||
static void enableMetaSendsEscape();
|
static void enableMetaSendsEscape();
|
||||||
|
|
||||||
|
@ -92,6 +94,7 @@ class FTermOpenBSD final
|
||||||
// Data Members
|
// Data Members
|
||||||
static kbd_t bsd_keyboard_encoding;
|
static kbd_t bsd_keyboard_encoding;
|
||||||
static bool meta_sends_escape;
|
static bool meta_sends_escape;
|
||||||
|
static FSystem* fsystem;
|
||||||
#endif // defined(__NetBSD__) || defined(__OpenBSD__)
|
#endif // defined(__NetBSD__) || defined(__OpenBSD__)
|
||||||
};
|
};
|
||||||
#pragma pack(pop)
|
#pragma pack(pop)
|
||||||
|
@ -103,6 +106,10 @@ inline const char* FTermOpenBSD::getClassName() const
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
#if defined(__NetBSD__) || defined(__OpenBSD__)
|
#if defined(__NetBSD__) || defined(__OpenBSD__)
|
||||||
|
inline void FTermOpenBSD::setFSystem (FSystem* fsys)
|
||||||
|
{ fsystem = fsys; }
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
inline void FTermOpenBSD::enableMetaSendsEscape()
|
inline void FTermOpenBSD::enableMetaSendsEscape()
|
||||||
{ meta_sends_escape = true; }
|
{ meta_sends_escape = true; }
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
* *
|
* *
|
||||||
* This file is part of the Final Cut widget toolkit *
|
* This file is part of the Final Cut widget toolkit *
|
||||||
* *
|
* *
|
||||||
* Copyright 2017-2018 Markus Gans *
|
* Copyright 2017-2019 Markus Gans *
|
||||||
* *
|
* *
|
||||||
* The Final Cut is free software; you can redistribute it and/or *
|
* The Final Cut is free software; you can redistribute it and/or *
|
||||||
* modify it under the terms of the GNU Lesser General Public License *
|
* modify it under the terms of the GNU Lesser General Public License *
|
||||||
|
@ -40,6 +40,7 @@ namespace
|
||||||
{
|
{
|
||||||
|
|
||||||
typedef unsigned char uChar;
|
typedef unsigned char uChar;
|
||||||
|
typedef unsigned short uShort;
|
||||||
typedef unsigned int uInt;
|
typedef unsigned int uInt;
|
||||||
typedef unsigned long uLong;
|
typedef unsigned long uLong;
|
||||||
typedef uint8_t uInt8;
|
typedef uint8_t uInt8;
|
||||||
|
|
Loading…
Reference in New Issue