From 4e3d346e9177b9a6ad3d84c28a39c08898e0a6ec Mon Sep 17 00:00:00 2001 From: Jonathan Schleifer Date: Sun, 4 Nov 2012 17:34:34 +0100 Subject: [PATCH 01/36] Terminal: Make cursor blinking an option. Signed-off-by: Rene Gollent --- src/apps/terminal/AppearPrefView.cpp | 16 ++++++++++++++++ src/apps/terminal/AppearPrefView.h | 4 +++- src/apps/terminal/PrefHandler.cpp | 1 + src/apps/terminal/TermConst.h | 1 + src/apps/terminal/TermView.cpp | 5 ++++- 5 files changed, 25 insertions(+), 2 deletions(-) diff --git a/src/apps/terminal/AppearPrefView.cpp b/src/apps/terminal/AppearPrefView.cpp index bbf1c78708..d0864e7c50 100644 --- a/src/apps/terminal/AppearPrefView.cpp +++ b/src/apps/terminal/AppearPrefView.cpp @@ -80,6 +80,10 @@ AppearancePrefView::AppearancePrefView(const char* name, NULL }; + fBlinkCursor = new BCheckBox( + B_TRANSLATE("Blink the cursor"), + new BMessage(MSG_BLINK_CURSOR_CHANGED)); + fWarnOnExit = new BCheckBox( B_TRANSLATE("Confirm exit if active programs exist"), new BMessage(MSG_WARN_ON_EXIT_CHANGED)); @@ -141,6 +145,7 @@ AppearancePrefView::AppearancePrefView(const char* name, .AddGlue() .Add(fColorControl = new BColorControl(BPoint(10, 10), B_CELLS_32x8, 8.0, "", new BMessage(MSG_COLOR_CHANGED))) + .Add(fBlinkCursor) .Add(fWarnOnExit); fTabTitle->SetAlignment(B_ALIGN_RIGHT, B_ALIGN_LEFT); @@ -157,6 +162,7 @@ AppearancePrefView::AppearancePrefView(const char* name, fColorControl->SetValue( PrefHandler::Default()->getRGB(PREF_TEXT_FORE_COLOR)); + fBlinkCursor->SetValue(PrefHandler::Default()->getBool(PREF_BLINK_CURSOR)); fWarnOnExit->SetValue(PrefHandler::Default()->getBool(PREF_WARN_ON_EXIT)); BTextControl* redInput = (BTextControl*)fColorControl->ChildAt(0); @@ -205,6 +211,7 @@ AppearancePrefView::AttachedToWindow() { fTabTitle->SetTarget(this); fWindowTitle->SetTarget(this); + fBlinkCursor->SetTarget(this); fWarnOnExit->SetTarget(this); fFontSize->Menu()->SetTargetForItems(this); @@ -293,6 +300,15 @@ AppearancePrefView::MessageReceived(BMessage* msg) fColorField->Menu()->FindMarked()->Label())); break; + case MSG_BLINK_CURSOR_CHANGED: + if (PrefHandler::Default()->getBool(PREF_BLINK_CURSOR) + != fBlinkCursor->Value()) { + PrefHandler::Default()->setBool(PREF_BLINK_CURSOR, + fBlinkCursor->Value()); + modified = true; + } + break; + case MSG_WARN_ON_EXIT_CHANGED: if (PrefHandler::Default()->getBool(PREF_WARN_ON_EXIT) != fWarnOnExit->Value()) { diff --git a/src/apps/terminal/AppearPrefView.h b/src/apps/terminal/AppearPrefView.h index 6f85e52835..b1d2c26009 100644 --- a/src/apps/terminal/AppearPrefView.h +++ b/src/apps/terminal/AppearPrefView.h @@ -23,10 +23,11 @@ static const uint32 MSG_COLOR_SCHEMA_CHANGED = 'mccs'; static const uint32 MSG_TAB_TITLE_SETTING_CHANGED = 'mtts'; static const uint32 MSG_WINDOW_TITLE_SETTING_CHANGED = 'mwts'; +static const uint32 MSG_BLINK_CURSOR_CHANGED = 'mbcc'; static const uint32 MSG_WARN_ON_EXIT_CHANGED = 'mwec'; static const uint32 MSG_COLS_CHANGED = 'mccl'; static const uint32 MSG_ROWS_CHANGED = 'mcrw'; -static const uint32 MSG_HISTORY_CHANGED = 'mhst'; +static const uint32 MSG_HISTORY_CHANGED = 'mhst'; static const uint32 MSG_PREF_MODIFIED = 'mpmo'; @@ -71,6 +72,7 @@ private: const color_schema** schemas, const color_schema* defaultItemName); + BCheckBox* fBlinkCursor; BCheckBox* fWarnOnExit; BMenuField* fFont; BMenuField* fFontSize; diff --git a/src/apps/terminal/PrefHandler.cpp b/src/apps/terminal/PrefHandler.cpp index 694ea1c907..c60d156ef5 100644 --- a/src/apps/terminal/PrefHandler.cpp +++ b/src/apps/terminal/PrefHandler.cpp @@ -61,6 +61,7 @@ static const pref_defaults kTermDefaults[] = { { PREF_TAB_TITLE, "%1d: %p" }, { PREF_WINDOW_TITLE, "Terminal %i: %t" }, + { PREF_BLINK_CURSOR, PREF_TRUE }, { PREF_WARN_ON_EXIT, PREF_TRUE }, { NULL, NULL}, diff --git a/src/apps/terminal/TermConst.h b/src/apps/terminal/TermConst.h index 2e759f4405..4181a85739 100644 --- a/src/apps/terminal/TermConst.h +++ b/src/apps/terminal/TermConst.h @@ -131,6 +131,7 @@ static const char* const PREF_SHELL = "Shell"; static const char* const PREF_TEXT_ENCODING = "Text encoding"; static const char* const PREF_GUI_LANGUAGE = "Language"; +static const char* const PREF_BLINK_CURSOR = "Blink the cursor"; static const char* const PREF_WARN_ON_EXIT = "Warn on exit"; static const char* const PREF_TAB_TITLE = "Tab title"; diff --git a/src/apps/terminal/TermView.cpp b/src/apps/terminal/TermView.cpp index aa3c441083..cad69cc2b7 100644 --- a/src/apps/terminal/TermView.cpp +++ b/src/apps/terminal/TermView.cpp @@ -54,6 +54,7 @@ #include #include "InlineInput.h" +#include "PrefHandler.h" #include "Shell.h" #include "ShellParameters.h" #include "TermConst.h" @@ -1096,9 +1097,11 @@ TermView::_DetachShell() void TermView::_Activate() { + bool blinkCursor = PrefHandler::Default()->getBool(PREF_BLINK_CURSOR); + fActive = true; - if (fCursorBlinkRunner == NULL) { + if (fCursorBlinkRunner == NULL && blinkCursor) { BMessage blinkMessage(kBlinkCursor); fCursorBlinkRunner = new (std::nothrow) BMessageRunner( BMessenger(this), &blinkMessage, kCursorBlinkInterval); From b5446310e961f84511a71964c4dca96ce6b7d2f9 Mon Sep 17 00:00:00 2001 From: John Scipione Date: Sun, 4 Nov 2012 13:32:13 -0500 Subject: [PATCH 02/36] Remove the scroll bar knobs and corresponding setting --- headers/os/interface/ScrollBar.h | 7 -- src/kits/interface/ScrollBar.cpp | 63 ---------- src/preferences/appearance/FakeScrollBar.cpp | 41 +----- src/preferences/appearance/FakeScrollBar.h | 2 +- .../appearance/LookAndFeelSettingsView.cpp | 118 ++---------------- .../appearance/LookAndFeelSettingsView.h | 8 -- 6 files changed, 16 insertions(+), 223 deletions(-) diff --git a/headers/os/interface/ScrollBar.h b/headers/os/interface/ScrollBar.h index 2549122ba4..c70acbe88f 100644 --- a/headers/os/interface/ScrollBar.h +++ b/headers/os/interface/ScrollBar.h @@ -19,13 +19,6 @@ #define DISABLES_ON_WINDOW_DEACTIVATION 1 -enum { - B_KNOB_STYLE_NONE = 0, - B_KNOB_STYLE_DOTS, - B_KNOB_STYLE_LINES -}; - - class BScrollBar : public BView { public: BScrollBar(BRect frame, const char* name, diff --git a/src/kits/interface/ScrollBar.cpp b/src/kits/interface/ScrollBar.cpp index 48cd1da978..540d8405c4 100644 --- a/src/kits/interface/ScrollBar.cpp +++ b/src/kits/interface/ScrollBar.cpp @@ -1153,69 +1153,6 @@ BScrollBar::Draw(BRect updateRect) FillRect(rect); } } - - if (fPrivateData->fScrollBarInfo.knob == B_KNOB_STYLE_NONE) - return; - - // draw the scrollbar thumb knobs - bool square = fPrivateData->fScrollBarInfo.knob == B_KNOB_STYLE_DOTS; - int32 knobWidth = 0; - int32 knobHeight = 0; - - if (square) { - knobWidth = 2; - knobHeight = 2; - } else { - knobWidth = 1; - knobHeight = 3; - } - - int32 flags = 0; - if (!enabled) - flags |= BControlLook::B_DISABLED; - - float hmiddle = rect.Width() / 2; - float vmiddle = rect.Height() / 2; - - BRect middleKnob = BRect( - rect.left + hmiddle - - (fOrientation == B_HORIZONTAL ? knobWidth : knobHeight), - rect.top + vmiddle - - (fOrientation == B_HORIZONTAL ? knobHeight : knobWidth), - rect.left + hmiddle - + (fOrientation == B_HORIZONTAL ? knobWidth : knobHeight), - rect.top + vmiddle - + (fOrientation == B_HORIZONTAL ? knobHeight : knobWidth)); - - if (fOrientation == B_HORIZONTAL) { - BRect leftKnob = middleKnob.OffsetByCopy(knobWidth * -4, 0); - if (leftKnob.left > rect.left + knobWidth) { - be_control_look->DrawButtonBackground(this, leftKnob, updateRect, - normal, flags, BControlLook::B_ALL_BORDERS, fOrientation); - } - - BRect rightKnob = middleKnob.OffsetByCopy(knobWidth * 4, 0); - if (rightKnob.right < rect.right - knobWidth) { - be_control_look->DrawButtonBackground(this, rightKnob, updateRect, - normal, flags, BControlLook::B_ALL_BORDERS, fOrientation); - } - } else { - BRect topKnob = middleKnob.OffsetByCopy(0, knobWidth * -4); - if (topKnob.top > rect.top + knobHeight) { - be_control_look->DrawButtonBackground(this, topKnob, updateRect, - normal, flags, BControlLook::B_ALL_BORDERS, fOrientation); - } - - BRect bottomKnob = middleKnob.OffsetByCopy(0, knobWidth * 4); - if (bottomKnob.bottom < rect.bottom - knobHeight) { - be_control_look->DrawButtonBackground(this, bottomKnob, updateRect, - normal, flags, BControlLook::B_ALL_BORDERS, fOrientation); - } - } - - // draw middle knob last because it modifies middleKnob - be_control_look->DrawButtonBackground(this, middleKnob, updateRect, - normal, flags, BControlLook::B_ALL_BORDERS, fOrientation); } diff --git a/src/preferences/appearance/FakeScrollBar.cpp b/src/preferences/appearance/FakeScrollBar.cpp index aa8ee8b7fa..fdbd1d1f16 100644 --- a/src/preferences/appearance/FakeScrollBar.cpp +++ b/src/preferences/appearance/FakeScrollBar.cpp @@ -29,12 +29,11 @@ typedef enum { FakeScrollBar::FakeScrollBar(bool drawArrows, bool doubleArrows, - int32 knobStyle, BMessage* message) + BMessage* message) : BControl("FakeScrollBar", NULL, message, B_WILL_DRAW | B_NAVIGABLE), fDrawArrows(drawArrows), - fDoubleArrows(doubleArrows), - fKnobStyle(knobStyle) + fDoubleArrows(doubleArrows) { SetExplicitMinSize(BSize(160, 20)); SetExplicitMaxSize(BSize(B_SIZE_UNLIMITED, 20)); @@ -142,42 +141,6 @@ FakeScrollBar::Draw(BRect updateRect) // fill the clickable surface of the thumb be_control_look->DrawButtonBackground(this, bgRect, updateRect, normal, 0, BControlLook::B_ALL_BORDERS, B_HORIZONTAL); - - if (fKnobStyle == B_KNOB_STYLE_NONE) - return; - - // draw the scrollbar thumb knobs - bool square = fKnobStyle == B_KNOB_STYLE_DOTS; - int32 knobWidth = 0; - int32 knobHeight = 0; - - if (square) { - knobWidth = 2; - knobHeight = 2; - } else { - knobWidth = 1; - knobHeight = 3; - } - - float hmiddle = bgRect.Width() / 2; - float vmiddle = bgRect.Height() / 2; - - BRect middleKnob = BRect(bgRect.left + hmiddle - knobWidth, - bgRect.top + vmiddle - knobHeight, - bgRect.left + hmiddle + knobWidth, - bgRect.top + vmiddle + knobHeight); - - BRect leftKnob = middleKnob.OffsetByCopy(knobWidth * -4, 0); - be_control_look->DrawButtonBackground(this, leftKnob, updateRect, - normal, 0, BControlLook::B_ALL_BORDERS, B_HORIZONTAL); - - BRect rightKnob = middleKnob.OffsetByCopy(knobWidth * 4, 0); - be_control_look->DrawButtonBackground(this, rightKnob, updateRect, - normal, 0, BControlLook::B_ALL_BORDERS, B_HORIZONTAL); - - // draw middle knob last because it modifies middleKnob - be_control_look->DrawButtonBackground(this, middleKnob, updateRect, - normal, 0, BControlLook::B_ALL_BORDERS, B_HORIZONTAL); } diff --git a/src/preferences/appearance/FakeScrollBar.h b/src/preferences/appearance/FakeScrollBar.h index 7f96f613d1..74e034b4cd 100644 --- a/src/preferences/appearance/FakeScrollBar.h +++ b/src/preferences/appearance/FakeScrollBar.h @@ -16,7 +16,7 @@ class FakeScrollBar : public BControl { public: FakeScrollBar(bool drawArrows, bool doubleArrows, - int32 knobStyle, BMessage* message); + BMessage* message); ~FakeScrollBar(void); virtual void MouseDown(BPoint point); diff --git a/src/preferences/appearance/LookAndFeelSettingsView.cpp b/src/preferences/appearance/LookAndFeelSettingsView.cpp index 4ac5f43fdd..5c7bd75725 100644 --- a/src/preferences/appearance/LookAndFeelSettingsView.cpp +++ b/src/preferences/appearance/LookAndFeelSettingsView.cpp @@ -16,6 +16,7 @@ #include #include +#include #include #include #include @@ -28,7 +29,6 @@ #include #include #include -#include #include #include #include @@ -79,15 +79,15 @@ LookAndFeelSettingsView::LookAndFeelSettingsView(const char* name) fDecorInfoButton = new BButton(B_TRANSLATE("About"), new BMessage(kMsgDecorInfo)); - // scrollbar arrow style + // scroll bar arrow style BBox* arrowStyleBox = new BBox("arrow style"); arrowStyleBox->SetLabel(B_TRANSLATE("Arrow style")); fSavedDoubleArrowsValue = _DoubleScrollBarArrows(); - fArrowStyleSingle = new FakeScrollBar(true, false, B_KNOB_STYLE_LINES, + fArrowStyleSingle = new FakeScrollBar(true, false, new BMessage(kMsgArrowStyleSingle)); - fArrowStyleDouble = new FakeScrollBar(true, true, B_KNOB_STYLE_LINES, + fArrowStyleDouble = new FakeScrollBar(true, true, new BMessage(kMsgArrowStyleDouble)); BView* arrowStyleView; @@ -98,39 +98,18 @@ LookAndFeelSettingsView::LookAndFeelSettingsView(const char* name) .Add(new BStringView("spacer", "")) .Add(new BStringView("double", B_TRANSLATE("Double:"))) .Add(fArrowStyleDouble) - .Add(BSpaceLayoutItem::CreateVerticalStrut(0)) .SetInsets(B_USE_DEFAULT_SPACING, B_USE_DEFAULT_SPACING, B_USE_DEFAULT_SPACING, B_USE_DEFAULT_SPACING) .End() .View(); arrowStyleBox->AddChild(arrowStyleView); + arrowStyleBox->SetExplicitAlignment(BAlignment(B_ALIGN_LEFT, + B_ALIGN_VERTICAL_CENTER)); - // scrollbar knob style - fSavedKnobStyleValue = _ScrollBarKnobStyle(); - - BBox* knobStyleBox = new BBox("knob style"); - knobStyleBox->SetLabel(B_TRANSLATE("Knob style")); - - fKnobStyleNone = new FakeScrollBar(false, false, B_KNOB_STYLE_NONE, - new BMessage(kMsgKnobStyleNone)); - fKnobStyleDots = new FakeScrollBar(false, false, B_KNOB_STYLE_DOTS, - new BMessage(kMsgKnobStyleDots)); - fKnobStyleLines = new FakeScrollBar(false, false, B_KNOB_STYLE_LINES, - new BMessage(kMsgKnobStyleLines)); - - BView* knobStyleView; - knobStyleView = BLayoutBuilder::Group<>() - .AddGroup(B_VERTICAL, 0) - .Add(fKnobStyleNone) - .Add(new BStringView("spacer", "")) - .Add(fKnobStyleDots) - .Add(new BStringView("spacer", "")) - .Add(fKnobStyleLines) - .SetInsets(B_USE_DEFAULT_SPACING, B_USE_DEFAULT_SPACING, - B_USE_DEFAULT_SPACING, B_USE_DEFAULT_SPACING) - .End() - .View(); - knobStyleBox->AddChild(knobStyleView); + BStringView* scrollBarLabel + = new BStringView("scroll bar", "Scroll bar:"); + scrollBarLabel->SetExplicitAlignment( + BAlignment(B_ALIGN_LEFT, B_ALIGN_TOP)); SetLayout(new BGroupLayout(B_VERTICAL)); @@ -143,10 +122,9 @@ LookAndFeelSettingsView::LookAndFeelSettingsView(const char* name) .Add(fDecorMenuField->CreateMenuBarLayoutItem(), 1, 0) .Add(fDecorInfoButton, 2, 0) ) - .Add(new BStringView("label", B_TRANSLATE("Scroll bars:"))) .AddGroup(B_HORIZONTAL, B_USE_DEFAULT_SPACING) + .Add(scrollBarLabel) .Add(arrowStyleBox) - .Add(knobStyleBox) .End() .AddGlue() .End() @@ -174,28 +152,11 @@ LookAndFeelSettingsView::AttachedToWindow() fDecorInfoButton->SetTarget(this); fArrowStyleSingle->SetTarget(this); fArrowStyleDouble->SetTarget(this); - fKnobStyleNone->SetTarget(this); - fKnobStyleDots->SetTarget(this); - fKnobStyleLines->SetTarget(this); if (fSavedDoubleArrowsValue) fArrowStyleDouble->SetValue(B_CONTROL_ON); else fArrowStyleSingle->SetValue(B_CONTROL_ON); - - switch (fSavedKnobStyleValue) { - case B_KNOB_STYLE_NONE: - fKnobStyleNone->SetValue(B_CONTROL_ON); - break; - - case B_KNOB_STYLE_DOTS: - fKnobStyleDots->SetValue(B_CONTROL_ON); - break; - - case B_KNOB_STYLE_LINES: - fKnobStyleLines->SetValue(B_CONTROL_ON); - break; - } } @@ -248,18 +209,6 @@ LookAndFeelSettingsView::MessageReceived(BMessage *msg) _SetDoubleScrollBarArrows(true); break; - case kMsgKnobStyleNone: - _SetScrollBarKnobStyle(B_KNOB_STYLE_NONE); - break; - - case kMsgKnobStyleDots: - _SetScrollBarKnobStyle(B_KNOB_STYLE_DOTS); - break; - - case kMsgKnobStyleLines: - _SetScrollBarKnobStyle(B_KNOB_STYLE_LINES); - break; - default: BView::MessageReceived(msg); break; @@ -359,49 +308,11 @@ LookAndFeelSettingsView::_SetDoubleScrollBarArrows(bool doubleArrows) } -int32 -LookAndFeelSettingsView::_ScrollBarKnobStyle() -{ - scroll_bar_info info; - get_scroll_bar_info(&info); - - return info.knob; -} - - -void -LookAndFeelSettingsView::_SetScrollBarKnobStyle(int32 knobStyle) -{ - scroll_bar_info info; - get_scroll_bar_info(&info); - - info.knob = knobStyle; - set_scroll_bar_info(&info); - - switch (knobStyle) { - case B_KNOB_STYLE_NONE: - fKnobStyleNone->SetValue(B_CONTROL_ON); - break; - - case B_KNOB_STYLE_DOTS: - fKnobStyleDots->SetValue(B_CONTROL_ON); - break; - - case B_KNOB_STYLE_LINES: - fKnobStyleLines->SetValue(B_CONTROL_ON); - break; - } - - Window()->PostMessage(kMsgUpdate); -} - - bool LookAndFeelSettingsView::IsDefaultable() { return fCurrentDecor != fDecorUtility.DefaultDecorator()->Name() - || _DoubleScrollBarArrows() != false - || _ScrollBarKnobStyle() != B_KNOB_STYLE_DOTS; + || _DoubleScrollBarArrows() != false; } @@ -410,7 +321,6 @@ LookAndFeelSettingsView::SetDefaults() { _SetDecor(fDecorUtility.DefaultDecorator()); _SetDoubleScrollBarArrows(false); - _SetScrollBarKnobStyle(B_KNOB_STYLE_DOTS); } @@ -418,8 +328,7 @@ bool LookAndFeelSettingsView::IsRevertable() { return fCurrentDecor != fSavedDecor - || _DoubleScrollBarArrows() != fSavedDoubleArrowsValue - || _ScrollBarKnobStyle() != fSavedKnobStyleValue; + || _DoubleScrollBarArrows() != fSavedDoubleArrowsValue; } @@ -427,6 +336,5 @@ void LookAndFeelSettingsView::Revert() { _SetDecor(fSavedDecor); - _SetScrollBarKnobStyle(fSavedKnobStyleValue); _SetDoubleScrollBarArrows(fSavedDoubleArrowsValue); } diff --git a/src/preferences/appearance/LookAndFeelSettingsView.h b/src/preferences/appearance/LookAndFeelSettingsView.h index bc06657544..787c8feffb 100644 --- a/src/preferences/appearance/LookAndFeelSettingsView.h +++ b/src/preferences/appearance/LookAndFeelSettingsView.h @@ -48,9 +48,6 @@ private: bool _DoubleScrollBarArrows(); void _SetDoubleScrollBarArrows(bool doubleArrows); - int32 _ScrollBarKnobStyle(); - void _SetScrollBarKnobStyle(int32 knobStyle); - private: DecorInfoUtility fDecorUtility; @@ -61,15 +58,10 @@ private: FakeScrollBar* fArrowStyleSingle; FakeScrollBar* fArrowStyleDouble; - FakeScrollBar* fKnobStyleNone; - FakeScrollBar* fKnobStyleDots; - FakeScrollBar* fKnobStyleLines; - BString fSavedDecor; BString fCurrentDecor; bool fSavedDoubleArrowsValue; - int32 fSavedKnobStyleValue; }; #endif // LOOK_AND_FEEL_SETTINGS_VIEW_H From 9a31eef24ce61e8c420e76b9653f049332d513a5 Mon Sep 17 00:00:00 2001 From: John Scipione Date: Sun, 4 Nov 2012 13:35:54 -0500 Subject: [PATCH 03/36] Appearance preflet is not resizable, make it official --- src/preferences/appearance/APRWindow.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/preferences/appearance/APRWindow.cpp b/src/preferences/appearance/APRWindow.cpp index 301887bcf8..61203bcacb 100644 --- a/src/preferences/appearance/APRWindow.cpp +++ b/src/preferences/appearance/APRWindow.cpp @@ -37,8 +37,8 @@ static const uint32 kMsgRevert = 'rvrt'; APRWindow::APRWindow(BRect frame) : BWindow(frame, B_TRANSLATE_SYSTEM_NAME("Appearance"), B_TITLED_WINDOW, - B_NOT_ZOOMABLE | B_AUTO_UPDATE_SIZE_LIMITS | B_QUIT_ON_WINDOW_CLOSE, - B_ALL_WORKSPACES) + B_NOT_RESIZABLE | B_NOT_ZOOMABLE | B_AUTO_UPDATE_SIZE_LIMITS + | B_QUIT_ON_WINDOW_CLOSE, B_ALL_WORKSPACES) { SetLayout(new BGroupLayout(B_HORIZONTAL)); From 03e2e071fd006ea8d8fe0ca0fd9e909aa42ce4ea Mon Sep 17 00:00:00 2001 From: "Ithamar R. Adema" Date: Sat, 3 Nov 2012 05:01:10 +0100 Subject: [PATCH 04/36] bring back framebuffer support in haiku_loader on ARM/u-boot * General fixes to get the refactored framebuffer code to work (across all 3 supported architectures) * PXA (verdex) specific fixes to framebuffer code. Now properly displays the (greyed) icons on the framebuffer! Signed-off-by: Ithamar R. Adema --- .../boot/arch/arm/arch_framebuffer_920.cpp | 11 ++++--- .../boot/arch/arm/arch_framebuffer_omap3.cpp | 11 +++++-- .../boot/arch/arm/arch_framebuffer_pxa.cpp | 31 ++++++++++--------- src/system/boot/platform/u-boot/video.cpp | 19 +++--------- 4 files changed, 37 insertions(+), 35 deletions(-) diff --git a/src/system/boot/arch/arm/arch_framebuffer_920.cpp b/src/system/boot/arch/arm/arch_framebuffer_920.cpp index ee2125d3a8..c9762e508d 100644 --- a/src/system/boot/arch/arm/arch_framebuffer_920.cpp +++ b/src/system/boot/arch/arm/arch_framebuffer_920.cpp @@ -21,16 +21,19 @@ class ArchFBArm920 : public ArchFramebuffer { public: - ArchFBArm920(addr_t base); - ~ArchFBArm920(); + ArchFBArm920(addr_t base) + : ArchFramebuffer(base) {} + ~ArchFBArm920() {} status_t Init(); status_t Probe(); status_t SetDefaultMode(); status_t SetVideoMode(int width, int height, int depth); }; -ArchFBArm920 *arch_get_fb_arm_920(addr_t base); - +extern "C" ArchFramebuffer *arch_get_fb_arm_920(addr_t base) +{ + return new ArchFBArm920(base); +} status_t ArchFBArm920::Init() diff --git a/src/system/boot/arch/arm/arch_framebuffer_omap3.cpp b/src/system/boot/arch/arm/arch_framebuffer_omap3.cpp index 03e38b26a8..976cace382 100644 --- a/src/system/boot/arch/arm/arch_framebuffer_omap3.cpp +++ b/src/system/boot/arch/arm/arch_framebuffer_omap3.cpp @@ -40,15 +40,20 @@ extern "C" addr_t mmu_map_physical_memory(addr_t physicalAddress, size_t size, class ArchFBArmOmap3 : public ArchFramebuffer { public: - ArchFBArmOmap3(addr_t base); - ~ArchFBArmOmap3(); + ArchFBArmOmap3(addr_t base) + : ArchFramebuffer(base) {} + ~ArchFBArmOmap3() {} + status_t Init(); status_t Probe(); status_t SetDefaultMode(); status_t SetVideoMode(int width, int height, int depth); }; -ArchFBArmOmap3 *arch_get_fb_arm_omap3(addr_t base); +extern "C" ArchFramebuffer *arch_get_fb_arm_omap3(addr_t base) +{ + return new ArchFBArmOmap3(base); +} // #pragma mark - diff --git a/src/system/boot/arch/arm/arch_framebuffer_pxa.cpp b/src/system/boot/arch/arm/arch_framebuffer_pxa.cpp index 1bcc304d21..9c2048b80c 100644 --- a/src/system/boot/arch/arm/arch_framebuffer_pxa.cpp +++ b/src/system/boot/arch/arm/arch_framebuffer_pxa.cpp @@ -32,15 +32,19 @@ extern "C" addr_t mmu_map_physical_memory(addr_t physicalAddress, size_t size, class ArchFBArmPxa270 : public ArchFramebuffer { public: - ArchFBArmPxa270(addr_t base); - ~ArchFBArmPxa270(); + ArchFBArmPxa270(addr_t base) + : ArchFramebuffer(base) {} + ~ArchFBArmPxa270() {} status_t Init(); status_t Probe(); status_t SetDefaultMode(); status_t SetVideoMode(int width, int height, int depth); }; -ArchFBArmPxa270 *arch_get_fb_arm_pxa270(addr_t base); +extern "C" ArchFramebuffer *arch_get_fb_arm_pxa270(addr_t base) +{ + return new ArchFBArmPxa270(base); +} // #pragma mark - @@ -97,8 +101,13 @@ dprintf("error %08x\n", err); struct pxa27x_lcd_dma_descriptor *dma; // check if LCD controller is enabled - if (!(read_io_32(LCCR0) | 0x00000001)) + if (!(read_io_32(LCCR0) & 0x00000001)) { + // not enabled, so return suggested mode + gKernelArgs.frame_buffer.depth = 32; + gKernelArgs.frame_buffer.width = 640; + gKernelArgs.frame_buffer.height = 480; return B_NO_INIT; + } pixelFormat = bppCode = read_io_32(LCCR3); bppCode = ((bppCode >> 26) & 0x08) | ((bppCode >> 24) & 0x07); @@ -126,7 +135,7 @@ dprintf("error %08x\n", err); return B_ERROR; } - gKernelArgs.frame_buffer.physical_buffer.start = (dma->fdadr & ~0x0f); + gKernelArgs.frame_buffer.physical_buffer.start = (dma->fsadr & ~0x0f); gKernelArgs.frame_buffer.width = (read_io_32(LCCR1) & ((1 << 10) - 1)) + 1; gKernelArgs.frame_buffer.height = (read_io_32(LCCR2) & ((1 << 10) - 1)) + 1; gKernelArgs.frame_buffer.bytes_per_row = gKernelArgs.frame_buffer.width @@ -150,12 +159,6 @@ ArchFBArmPxa270::SetVideoMode(int width, int height, int depth) void *fb; uint32 fbSize = width * height * depth / 8; - //fb = malloc(800 * 600 * 4 + 16 - 1); - //fb = (void *)(((uint32)fb) & ~(0x0f)); - //fb = scratch - 800; - //fb = (void *)0xa0000000; - -// fBase = scratch - 800; fb = (void*)fBase; @@ -168,8 +171,8 @@ ArchFBArmPxa270::SetVideoMode(int width, int height, int depth) // if not already enabled, set a default mode if (!(read_io_32(LCCR0) & 0x00000001)) { - int bpp = 0x09; // 24 bpp - int pdfor = 0x3; // Format 4: RGB888 (no alpha bit) + int bpp; + int pdfor; dprintf("Setting video mode\n"); switch (depth) { case 4: @@ -201,7 +204,7 @@ ArchFBArmPxa270::SetVideoMode(int width, int height, int depth) dumpr(LCCR3); dumpr(LCCR4); } else - return EALREADY; // for now + return B_OK; // assume we're already setup // clear the video memory memset((void *)fb, 0, fbSize); diff --git a/src/system/boot/platform/u-boot/video.cpp b/src/system/boot/platform/u-boot/video.cpp index d3767f9934..f7c4c72a19 100644 --- a/src/system/boot/platform/u-boot/video.cpp +++ b/src/system/boot/platform/u-boot/video.cpp @@ -14,6 +14,7 @@ #include #include #include +#include #include #include @@ -76,14 +77,10 @@ platform_blit4(addr_t frameBuffer, const uint8 *data, uint16 width, extern "C" void platform_switch_to_logo(void) { - CALLED(); // in debug mode, we'll never show the logo if ((platform_boot_options() & BOOT_OPTION_DEBUG_OUTPUT) != 0) return; - //XXX: not yet, DISABLED - return; - status_t err; if (gFramebuffer != NULL) { @@ -95,30 +92,28 @@ platform_switch_to_logo(void) err = video_display_splash(gFramebuffer->Base()); } - #warning U-Boot:TODO } extern "C" void platform_switch_to_text_mode(void) { - CALLED(); - #warning U-Boot:TODO } extern "C" status_t platform_init_video(void) { - CALLED(); - #ifdef __ARM__ #if defined(BOARD_CPU_ARM920T) + extern ArchFramebuffer *arch_get_fb_arm_920(addr_t base); gFramebuffer = arch_get_fb_arm_920(0x88000000); #elif defined(BOARD_CPU_OMAP3) + extern ArchFramebuffer *arch_get_fb_arm_omap3(addr_t base); gFramebuffer = arch_get_fb_arm_omap3(0x88000000); #elif defined(BOARD_CPU_PXA270) - gFramebuffer = arch_get_fb_arm_pxa270(0xA4000000); + ArchFramebuffer *arch_get_fb_arm_pxa270(addr_t base); + gFramebuffer = arch_get_fb_arm_pxa270(0xA3000000); #endif #endif @@ -127,9 +122,5 @@ platform_init_video(void) gFramebuffer->Init(); } - //XXX for testing - //platform_switch_to_logo(); - //return arch_probe_video_mode(); - return B_OK; } From 457556ca122af2fb035a9792325f99e48494701d Mon Sep 17 00:00:00 2001 From: "Ithamar R. Adema" Date: Sat, 3 Nov 2012 13:22:08 +0100 Subject: [PATCH 05/36] Fix variable name in TRACE() statement Signed-off-by: Ithamar R. Adema --- src/system/kernel/vm/VMKernelAddressSpace.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/system/kernel/vm/VMKernelAddressSpace.cpp b/src/system/kernel/vm/VMKernelAddressSpace.cpp index efaa473dc2..9b5c5c20d1 100644 --- a/src/system/kernel/vm/VMKernelAddressSpace.cpp +++ b/src/system/kernel/vm/VMKernelAddressSpace.cpp @@ -151,7 +151,7 @@ VMKernelAddressSpace::CreateArea(const char* name, uint32 wiring, void VMKernelAddressSpace::DeleteArea(VMArea* _area, uint32 allocationFlags) { - TRACE("VMKernelAddressSpace::DeleteArea(%p)\n", area); + TRACE("VMKernelAddressSpace::DeleteArea(%p)\n", _area); VMKernelArea* area = static_cast(_area); object_cache_delete(fAreaObjectCache, area); From b867e1156e0b3396628f1f82231fc5ebae85426a Mon Sep 17 00:00:00 2001 From: "Ithamar R. Adema" Date: Mon, 5 Nov 2012 01:14:58 +0100 Subject: [PATCH 06/36] fix a TRACE() formatting string --- src/system/kernel/arch/x86/arch_thread.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/system/kernel/arch/x86/arch_thread.cpp b/src/system/kernel/arch/x86/arch_thread.cpp index 69ca734eb4..93cf26621b 100644 --- a/src/system/kernel/arch/x86/arch_thread.cpp +++ b/src/system/kernel/arch/x86/arch_thread.cpp @@ -317,7 +317,7 @@ arch_thread_init_kthread_stack(Thread* thread, void* _stack, void* _stackTop, { addr_t* stackTop = (addr_t*)_stackTop; - TRACE(("arch_thread_init_kthread_stack: stack top %p, function %, data: " + TRACE(("arch_thread_init_kthread_stack: stack top %p, function %p, data: " "%p\n", stackTop, function, data)); // push the function argument, a pointer to the data From d09e7b5b90b86793a6f44d90e5ccc86c1bcbfffe Mon Sep 17 00:00:00 2001 From: "Ithamar R. Adema" Date: Mon, 5 Nov 2012 01:33:26 +0100 Subject: [PATCH 07/36] ARM: mark pages found in query as present --- .../kernel/arch/arm/paging/32bit/ARMVMTranslationMap32Bit.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/system/kernel/arch/arm/paging/32bit/ARMVMTranslationMap32Bit.cpp b/src/system/kernel/arch/arm/paging/32bit/ARMVMTranslationMap32Bit.cpp index d822cafc0c..2d19cb8f9a 100644 --- a/src/system/kernel/arch/arm/paging/32bit/ARMVMTranslationMap32Bit.cpp +++ b/src/system/kernel/arch/arm/paging/32bit/ARMVMTranslationMap32Bit.cpp @@ -594,6 +594,8 @@ ARMVMTranslationMap32Bit::Query(addr_t va, phys_addr_t *_physical, | ((entry & ARM_PTE_PRESENT) != 0 ? PAGE_PRESENT : 0); #else *_flags = B_KERNEL_WRITE_AREA | B_KERNEL_READ_AREA; + if (*_physical != 0) + *_flags |= PAGE_PRESENT; #endif pinner.Unlock(); From be7195d0f79a82a419cc06e4fc5b40e5dccf36a2 Mon Sep 17 00:00:00 2001 From: "Ithamar R. Adema" Date: Mon, 5 Nov 2012 01:34:25 +0100 Subject: [PATCH 08/36] ARM: add initial timer support. Currently hardcoded to PXA (verdex) support, needs SoC abstraction for seperating implementations, best done using FDT code as committed by Francois. --- src/system/kernel/arch/arm/arch_timer.cpp | 63 +++++++++++++++++++---- 1 file changed, 53 insertions(+), 10 deletions(-) diff --git a/src/system/kernel/arch/arm/arch_timer.cpp b/src/system/kernel/arch/arm/arch_timer.cpp index 7224c90c20..2bda04042c 100644 --- a/src/system/kernel/arch/arm/arch_timer.cpp +++ b/src/system/kernel/arch/arm/arch_timer.cpp @@ -1,9 +1,10 @@ /* - * Copyright 2007, Haiku Inc. All rights reserved. + * Copyright 2007-2012, Haiku Inc. All rights reserved. * Distributed under the terms of the MIT License. * * Authors: * François Revol + * Ithamar R. Adema * * Copyright 2001, Travis Geiselbrecht. All rights reserved. * Distributed under the terms of the NewOS License. @@ -16,30 +17,72 @@ #include #include -//#include +#include + +#define PXA_TIMERS_PHYS_BASE 0x40A00000 +#define PXA_TIMERS_SIZE 0x000000C0 +#define PXA_TIMERS_INTERRUPT 7 /* OST_4_11 */ + +#define PXA_OSSR 0x05 +#define PXA_OIER 0x07 +#define PXA_OSCR4 0x10 +#define PXA_OSMR4 0x20 +#define PXA_OMCR4 0x30 + +#define TRACE(x) //dprintf x + +static area_id sPxaTimersArea; +static uint32 *sPxaTimersBase; + + +static int32 +pxa_timer_interrupt(void *data) +{ + int32 ret = timer_interrupt(); + sPxaTimersBase[PXA_OSSR] |= (1 << 4); + + return ret; +} void arch_timer_set_hardware_timer(bigtime_t timeout) { - #warning ARM:WRITEME - // M68KPlatform::Default()->SetHardwareTimer(timeout); + TRACE(("arch_timer_set_hardware_timer(%lld): %p\n", timeout, sPxaTimersBase)); + + if (sPxaTimersBase) { + sPxaTimersBase[PXA_OIER] |= (1 << 4); + sPxaTimersBase[PXA_OMCR4] = 4; // set to exactly single milisecond resolution + sPxaTimersBase[PXA_OSMR4] = timeout; + sPxaTimersBase[PXA_OSCR4] = 0; // start counting from 0 again + } } void arch_timer_clear_hardware_timer() { - #warning ARM:WRITEME - // M68KPlatform::Default()->ClearHardwareTimer(); + TRACE(("arch_timer_clear_hardware_timer: %p\n", sPxaTimersBase)); + + if (sPxaTimersBase) { + sPxaTimersBase[PXA_OMCR4] = 0; // disable our timer + sPxaTimersBase[PXA_OIER] &= ~(4 << 1); + } } int arch_init_timer(kernel_args *args) { - #warning ARM:WRITEME - // M68KPlatform::Default()->InitTimer(args); - return 0; -} + sPxaTimersArea = map_physical_memory("pxa_timers", PXA_TIMERS_PHYS_BASE, + PXA_TIMERS_SIZE, 0, B_KERNEL_READ_AREA | B_KERNEL_WRITE_AREA, (void**)&sPxaTimersBase); + if (sPxaTimersArea < 0) + return sPxaTimersArea; + + sPxaTimersBase[PXA_OMCR4] = 0; // disable our timer + + install_io_interrupt_handler(PXA_TIMERS_INTERRUPT, &pxa_timer_interrupt, NULL, 0); + + return B_OK; +} From 02081e0950d201a246c8adb86a92a8bb65e28490 Mon Sep 17 00:00:00 2001 From: "Ithamar R. Adema" Date: Mon, 5 Nov 2012 01:36:41 +0100 Subject: [PATCH 09/36] ARM: Initial implementation of interrupt/exception handling. This contains both the common ARM(v5) vector handling as well as the PXA(verdex) specific interrupt controller code, to be seperated when ARM support for FDT is implemented. Functional enough to handle interrupts, needs work on KDL support. --- src/system/kernel/arch/arm/Jamfile | 2 +- src/system/kernel/arch/arm/arch_exceptions.S | 176 +++++++++++++++ src/system/kernel/arch/arm/arch_int.cpp | 212 +++++++++++++------ 3 files changed, 320 insertions(+), 70 deletions(-) create mode 100644 src/system/kernel/arch/arm/arch_exceptions.S diff --git a/src/system/kernel/arch/arm/Jamfile b/src/system/kernel/arch/arm/Jamfile index 13a56e44e6..68124ed9b9 100644 --- a/src/system/kernel/arch/arm/Jamfile +++ b/src/system/kernel/arch/arm/Jamfile @@ -17,7 +17,7 @@ KernelMergeObject kernel_arch_arm.o : arch_debug_console.cpp arch_debug.cpp arch_elf.cpp -# arch_exceptions.S + arch_exceptions.S arch_int.cpp arch_platform.cpp arch_real_time_clock.cpp diff --git a/src/system/kernel/arch/arm/arch_exceptions.S b/src/system/kernel/arch/arm/arch_exceptions.S new file mode 100644 index 0000000000..cffb1f87f8 --- /dev/null +++ b/src/system/kernel/arch/arm/arch_exceptions.S @@ -0,0 +1,176 @@ +/* + * Copyright 2012, Haiku Inc. All rights reserved. + * Distributed under the terms of the MIT License. + * + * Authors: + * Ithamar R. Adema + * + */ + +#include + + .text + +.globl _vectors_start +_vectors_start: + ldr pc, _arm_reset + ldr pc, _arm_undefined + ldr pc, _arm_syscall + ldr pc, _arm_prefetch_abort + ldr pc, _arm_data_abort + ldr pc, _arm_reserved + ldr pc, _arm_irq + ldr pc, _arm_fiq + +_arm_reset: + .word arm_reserved // actually reset, but not used when mapped +_arm_undefined: + .word arm_undefined +_arm_syscall: + .word arm_syscall +_arm_prefetch_abort: + .word arm_prefetch_abort +_arm_data_abort: + .word arm_data_abort +_arm_reserved: + .word arm_reserved +_arm_irq: + .word arm_irq +_arm_fiq: + .word arm_fiq +.globl _vectors_end +_vectors_end: + + + .rept 64 + .word 0xaabbccdd + .endr +abort_stack: + .word . + +FUNCTION(arm_undefined): + stmfd sp!, { r0-r12, r14 } + sub sp, sp, #12 + mov r0, sp + mrs r1, spsr + stmia r0, { r1, r13-r14 } + b arch_arm_undefined + b . + +FUNCTION(arm_syscall): + stmfd sp!, { r0-r12, r14 } + sub sp, sp, #12 + mov r0, sp + mrs r1, spsr + stmia r0, { r1, r13-r14 } + b arch_arm_syscall + b . + +FUNCTION(arm_prefetch_abort): + ldr sp, abort_stack + stmfd sp!, { r0-r12, r14 } + sub sp, sp, #12 + mov r0, sp + mrs r1, spsr + stmia r0, { r1, r13-r14 } + b arch_arm_prefetch_abort + b . + +FUNCTION(arm_data_abort): + ldr sp, abort_stack + /* XXX only deals with interrupting supervisor mode */ + + /* save r4-r6 and use as a temporary place to save while we switch into supervisor mode */ + stmia r13, { r4-r6 } + mov r4, r13 + sub r5, lr, #8 + mrs r6, spsr + + /* move into supervisor mode. irq/fiq disabled */ + msr cpsr_c, #0x13 + + /* save the return address */ + stmfd sp!, { r5 } + + /* save C trashed regs, supervisor lr */ + stmfd sp!, { r0-r3, r12, lr } + + /* save spsr */ + stmfd sp!, { r6 } + + /* restore r4-r6 */ + ldmia r4, { r4-r6 } + + /* call into higher level code */ + mrc p15, 0, r2, c5, c0, 0 @ get FSR + mrc p15, 0, r3, c6, c0, 0 @ get FAR + sub sp, sp, #20 + mov r0, sp /* iframe */ + stmia r0, { r6,r2,r3,r4,r5 } + bl arch_arm_data_abort + add sp, sp, #20 + + /* restore spsr */ + ldmfd sp!, { r0 } + msr spsr_cxsf, r0 + + /* restore back to where we came from */ + ldmfd sp!, { r0-r3, r12, lr, pc }^ + +FUNCTION(arm_reserved): + b . + +FUNCTION(arm_irq): + ldr sp, abort_stack + /* XXX only deals with interrupting supervisor mode */ + + /* save r4-r6 and use as a temporary place to save while we switch into supervisor mode */ + stmia r13, { r4-r6 } + mov r4, r13 + sub r5, lr, #4 + mrs r6, spsr + + /* move into supervisor mode. irq/fiq disabled */ + msr cpsr_c, #(3<<6 | 0x13) + + /* save the return address */ + stmfd sp!, { r5 } + + /* save C trashed regs, supervisor lr */ + stmfd sp!, { r0-r3, r12, lr } + + /* save spsr */ + stmfd sp!, { r6 } + + /* restore r4-r6 */ + ldmia r4, { r4-r6 } + + /* call into higher level code */ + mov r0, sp /* iframe */ + bl arch_arm_irq + + /* restore spsr */ + ldmfd sp!, { r0 } + msr spsr_cxsf, r0 + + /* restore back to where we came from */ + ldmfd sp!, { r0-r3, r12, lr, pc }^ + +.bss +.align 2 + .global irq_save_spot +irq_save_spot: + .word 0 /* r4 */ + .word 0 /* r5 */ + .word 0 /* r6 */ + +.text +FUNCTION(arm_fiq): + ldr sp, abort_stack + sub lr, lr, #4 + stmfd sp!, { r0-r3, r12, lr } + + bl arch_arm_fiq + + ldmfd sp!, { r0-r3, r12, pc }^ + diff --git a/src/system/kernel/arch/arm/arch_int.cpp b/src/system/kernel/arch/arm/arch_int.cpp index 1337705665..97a735aa4a 100644 --- a/src/system/kernel/arch/arm/arch_int.cpp +++ b/src/system/kernel/arch/arm/arch_int.cpp @@ -1,11 +1,12 @@ /* - * Copyright 2003-2010, Haiku Inc. All rights reserved. + * Copyright 2003-2012, Haiku Inc. All rights reserved. * Distributed under the terms of the MIT License. * * Authors: * Axel Dörfler * Ingo Weinhold * François Revol + * Ithamar R. Adema * * Copyright 2001, Travis Geiselbrecht. All rights reserved. * Distributed under the terms of the NewOS License. @@ -30,27 +31,35 @@ #include -//#define TRACE_ARCH_INT +#define TRACE_ARCH_INT #ifdef TRACE_ARCH_INT # define TRACE(x) dprintf x #else # define TRACE(x) ; #endif -/*typedef void (*m68k_exception_handler)(void); -#define M68K_EXCEPTION_VECTOR_COUNT 256 -#warning M68K: align on 4 ? -//m68k_exception_handler gExceptionVectors[M68K_EXCEPTION_VECTOR_COUNT]; -m68k_exception_handler *gExceptionVectors; +#define VECTORPAGE_SIZE 64 +#define USER_VECTOR_ADDR_LOW 0x00000000 +#define USER_VECTOR_ADDR_HIGH 0xffff0000 -// defined in arch_exceptions.S -extern "C" void __m68k_exception_noop(void); -extern "C" void __m68k_exception_common(void); -*/ -extern int __irqvec_start; -extern int __irqvec_end; +#define PXA_INTERRUPT_PHYS_BASE 0x40D00000 +#define PXA_INTERRUPT_SIZE 0x00000034 -//extern"C" void m68k_exception_tail(void); +#define PXA_ICIP 0x00 +#define PXA_ICMR 0x01 +#define PXA_ICFP 0x03 +#define PXA_ICMR2 0x28 + +static area_id sPxaInterruptArea; +static uint32 *sPxaInterruptBase; + +extern int _vectors_start; +extern int _vectors_end; + +static area_id sVectorPageArea; +static void *sVectorPageAddress; +static area_id sUserVectorPageArea; +static void *sUserVectorPageAddress; // current fault handler addr_t gFaultHandler; @@ -59,35 +68,48 @@ addr_t gFaultHandler; // threads yet. struct iframe_stack gBootFrameStack; -// interrupt controller interface (initialized -// in arch_int_init_post_device_manager()) -//static struct interrupt_controller_module_info *sPIC; -//static void *sPICCookie; + +uint32 +mmu_read_c1() +{ + uint32 controlReg = 0; + asm volatile("MRC p15, 0, %[c1out], c1, c0, 0":[c1out] "=r" (controlReg)); + return controlReg; +} + + +void +mmu_write_c1(uint32 value) +{ + asm volatile("MCR p15, 0, %[c1in], c1, c0, 0"::[c1in] "r" (value)); +} void arch_int_enable_io_interrupt(int irq) { - #warning ARM WRITEME - //if (!sPIC) - // return; + TRACE(("arch_int_enable_io_interrupt(%d)\n", irq)); - // TODO: I have no idea, what IRQ type is appropriate. - //sPIC->enable_io_interrupt(sPICCookie, irq, IRQ_TYPE_LEVEL); -// M68KPlatform::Default()->EnableIOInterrupt(irq); + if (irq <= 31) { + sPxaInterruptBase[PXA_ICMR] |= 1 << irq; + return; + } + + sPxaInterruptBase[PXA_ICMR2] |= 1 << (irq - 32); } void arch_int_disable_io_interrupt(int irq) { - #warning ARM WRITEME + TRACE(("arch_int_disable_io_interrupt(%d)\n", irq)); - //if (!sPIC) - // return; + if (irq <= 31) { + sPxaInterruptBase[PXA_ICMR] &= ~(1 << irq); + return; + } - //sPIC->disable_io_interrupt(sPICCookie, irq); -// M68KPlatform::Default()->DisableIOInterrupt(irq); + sPxaInterruptBase[PXA_ICMR2] &= ~(1 << (irq - 32)); } @@ -97,60 +119,67 @@ arch_int_disable_io_interrupt(int irq) static void print_iframe(struct iframe *frame) { - #if 0 - dprintf("r0-r3: 0x%08lx 0x%08lx 0x%08lx 0x%08lx\n", frame->r0, frame->r1, - frame->r2, frame->r3); - dprintf("r4-r7: 0x%08lx 0x%08lx 0x%08lx 0x%08lx\n", frame->r4, frame->r5, - frame->r6, frame->r7); - dprintf("r8-r11: 0x%08lx 0x%08lx 0x%08lx 0x%08lx\n", frame->r8, frame->r9, - frame->r10, frame->r11); - dprintf("r12-r15: 0x%08lx 0x%08lx 0x%08lx 0x%08lx\n", frame->r12, frame->r13, - frame->a6, frame->a7); - dprintf(" pc 0x%08lx sr 0x%08lx\n", frame->pc, frame->sr); - #endif - - #warning ARM WRITEME } status_t arch_int_init(kernel_args *args) { - #if 0 - status_t err; - addr_t vbr; - int i; + // see if high vectors are enabled + if (mmu_read_c1() & (1<<13)) + dprintf("High vectors already enabled\n"); + else { + mmu_write_c1(mmu_read_c1() | (1<<13)); - gExceptionVectors = (m68k_exception_handler *)args->arch_args.vir_vbr; + if (!(mmu_read_c1() & (1<<13))) + dprintf("Unable to enable high vectors!\n"); + else + dprintf("Enabled high vectors\n"); + } - /* fill in the vector table */ - for (i = 0; i < M68K_EXCEPTION_VECTOR_COUNT; i++) - gExceptionVectors[i] = &__m68k_exception_common; + return B_OK; +} - vbr = args->arch_args.phys_vbr; - /* point VBR to the new table */ - asm volatile ("movec %0,%%vbr" : : "r"(vbr):); - #endif - #warning ARM WRITEME +status_t +arch_int_init_post_vm(kernel_args *args) +{ + // create a read/write kernel area + sVectorPageArea = create_area("vectorpage", (void **)&sVectorPageAddress, + B_ANY_ADDRESS, VECTORPAGE_SIZE, B_FULL_LOCK, + B_KERNEL_WRITE_AREA | B_KERNEL_READ_AREA); + + if (sVectorPageArea < 0) + panic("vector page could not be created!"); + + // clone it at a fixed address with user read/only permissions + sUserVectorPageAddress = (addr_t*)USER_VECTOR_ADDR_HIGH; + sUserVectorPageArea = clone_area("user_vectorpage", + (void **)&sUserVectorPageAddress, B_EXACT_ADDRESS, + B_READ_AREA | B_EXECUTE_AREA, sVectorPageArea); + + if (sUserVectorPageArea < 0) + panic("user vector page @ %p could not be created (%lx)!", sVectorPageAddress, sUserVectorPageArea); + + // copy vectors into the newly created area + memcpy(sVectorPageAddress, &_vectors_start, VECTORPAGE_SIZE); + + sPxaInterruptArea = map_physical_memory("pxa_intc", PXA_INTERRUPT_PHYS_BASE, + PXA_INTERRUPT_SIZE, 0, B_KERNEL_READ_AREA | B_KERNEL_WRITE_AREA, (void**)&sPxaInterruptBase); + + if (sPxaInterruptArea < 0) + return sPxaInterruptArea; + + sPxaInterruptBase[PXA_ICMR] = 0; + sPxaInterruptBase[PXA_ICMR2] = 0; return B_OK; } -status_t -arch_int_init_post_vm(kernel_args *args) -{ - status_t err; - // err = M68KPlatform::Default()->InitPIC(args); - #warning ARM WRITEME - - return err; -} - - status_t arch_int_init_io(kernel_args* args) { + TRACE(("arch_int_init_io(%p)\n", args)); return B_OK; } @@ -158,8 +187,53 @@ arch_int_init_io(kernel_args* args) status_t arch_int_init_post_device_manager(struct kernel_args *args) { - // no PIC found - panic("arch_int_init_post_device_manager(): Found no supported PIC!"); - return B_ENTRY_NOT_FOUND; } + + +extern "C" void arch_arm_undefined(struct iframe *iframe) +{ + panic("Undefined instruction!"); +} + +extern "C" void arch_arm_syscall(struct iframe *iframe) +{ + panic("Software interrupt!\n"); +} + +extern "C" void arch_arm_data_abort(struct iframe *iframe) +{ + addr_t newip; + status_t res = vm_page_fault(iframe->r2 /* FAR */, iframe->r4 /* lr */, + true /* TODO how to determine read/write? */, + false /* only kernelspace for now */, + &newip); + + if (res != B_HANDLED_INTERRUPT) { + panic("Data Abort: %08x %08x %08x %08x (res=%lx)", iframe->r0 /* spsr */, + iframe->r1 /* FSR */, iframe->r2 /* FAR */, + iframe->r4 /* lr */, + res); + } else { + //panic("vm_page_fault was ok (%08lx/%08lx)!", iframe->r2 /* FAR */, iframe->r0 /* spsr */); + } +} + +extern "C" void arch_arm_prefetch_abort(struct iframe *iframe) +{ + panic("Prefetch Abort: %08x %08x %08x", iframe->r0, iframe->r1, iframe->r2); +} + +extern "C" void arch_arm_irq(struct iframe *iframe) +{ + for (int i=0; i < 32; i++) + if (sPxaInterruptBase[PXA_ICIP] & (1 << i)) + int_io_interrupt_handler(i, true); +} + +extern "C" void arch_arm_fiq(struct iframe *iframe) +{ + for (int i=0; i < 32; i++) + if (sPxaInterruptBase[PXA_ICIP] & (1 << i)) + dprintf("arch_arm_fiq: help me, FIQ %d was triggered but no FIQ support!\n", i); +} From f8b47f2b2a56299562a6264662957a82bec57b13 Mon Sep 17 00:00:00 2001 From: "Ithamar R. Adema" Date: Mon, 5 Nov 2012 01:39:52 +0100 Subject: [PATCH 10/36] ARM: fixup interrupt enable/disable/restore functions --- src/system/kernel/arch/arm/arch_asm.S | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/src/system/kernel/arch/arm/arch_asm.S b/src/system/kernel/arch/arm/arch_asm.S index c34511e54f..c417a91742 100644 --- a/src/system/kernel/arch/arm/arch_asm.S +++ b/src/system/kernel/arch/arm/arch_asm.S @@ -27,8 +27,8 @@ FUNCTION_END(arch_int_enable_interrupts) */ FUNCTION(arch_int_disable_interrupts): mrs r0, cpsr - orr r0, r0, #(1<<7) - msr cpsr_c, r0 + orr r1, r0, #(1<<7) + msr cpsr_c, r1 bx lr FUNCTION_END(arch_int_disable_interrupts) @@ -37,8 +37,8 @@ FUNCTION_END(arch_int_disable_interrupts) */ FUNCTION(arch_int_restore_interrupts): mrs r1, cpsr - orr r0,r0, #(1<<7) - bic r1, r1,#(1<<7) + and r0, r0, #(1<<7) + bic r1, r1, #(1<<7) orr r1, r1, r0 msr cpsr_c, r1 bx lr @@ -49,10 +49,19 @@ FUNCTION_END(arch_int_restore_interrupts) FUNCTION(arch_int_are_interrupts_enabled): mrs r0, cpsr and r0, r0, #(1<<7) /*read the I bit*/ - cmp r0,#0 - moveq r0,#1 - movne r0,#0 + cmp r0, #0 + moveq r0, #1 + movne r0, #0 bx lr FUNCTION_END(arch_int_are_interrupts_enabled) +/* void arm_context_switch(struct arch_thread* oldState, + struct arch_thread* newState); */ +FUNCTION(arm_context_switch): + stmfd sp!, { r0-r12, lr } + str sp, [r0] + ldr sp, [r1] + ldmfd sp!, { r0-r12, lr } + bx lr +FUNCTION_END(arm_context_switch) From 4fc1dadd583e79fcc8e3c40d28726b9c20f478c8 Mon Sep 17 00:00:00 2001 From: "Ithamar R. Adema" Date: Mon, 5 Nov 2012 01:41:05 +0100 Subject: [PATCH 11/36] ARM: add context switch implementation --- src/system/kernel/arch/arm/arch_thread.cpp | 61 +++++++++++++++------- 1 file changed, 43 insertions(+), 18 deletions(-) diff --git a/src/system/kernel/arch/arm/arch_thread.cpp b/src/system/kernel/arch/arm/arch_thread.cpp index 3d3d38cecf..2ae92ae4cc 100644 --- a/src/system/kernel/arch/arm/arch_thread.cpp +++ b/src/system/kernel/arch/arm/arch_thread.cpp @@ -20,13 +20,20 @@ #include #include #include +#include #include #include #include -//#include +#include #include +#define TRACE_ARCH_THREAD +#ifdef TRACE_ARCH_THREAD +# define TRACE(x) dprintf x +#else +# define TRACE(x) ; +#endif // Valid initial arch_thread state. We just memcpy() it when initializing // a new thread structure. @@ -67,35 +74,53 @@ void arch_thread_init_kthread_stack(Thread* thread, void* _stack, void* _stackTop, void (*function)(void*), const void* data) { -#warning ARM:WRITEME + addr_t* stackTop = (addr_t*)_stackTop; + + TRACE(("arch_thread_init_kthread_stack(%s): stack top %p, function %p, data: " + "%p\n", thread->name, stackTop, function, data)); + + // push the function address -- that's the return address used after the + // context switch (lr/r14 register) + *--stackTop = (addr_t)function; + + // simulate storing registers r1-r12 + for (int i = 1; i <= 12; i++) + *--stackTop = 0; + + // push the function argument as r0 + *--stackTop = (addr_t)data; + + // save the stack position + thread->arch_info.sp = stackTop; } status_t arch_thread_init_tls(Thread *thread) { - // TODO: Implement! - return B_OK; + uint32 tls[TLS_USER_THREAD_SLOT + 1]; + + thread->user_local_storage = thread->user_stack_base + + thread->user_stack_size; + + // initialize default TLS fields + memset(tls, 0, sizeof(tls)); + tls[TLS_BASE_ADDRESS_SLOT] = thread->user_local_storage; + tls[TLS_THREAD_ID_SLOT] = thread->id; + tls[TLS_USER_THREAD_SLOT] = (addr_t)thread->user_thread; + + return user_memcpy((void *)thread->user_local_storage, tls, sizeof(tls)); } +extern "C" void arm_context_switch(void *from, void *to); void arch_thread_context_switch(Thread *from, Thread *to) { - #if 0 - addr_t newPageDirectory; - - newPageDirectory = (addr_t)m68k_next_page_directory(from, to); - - if ((newPageDirectory % B_PAGE_SIZE) != 0) - panic("arch_thread_context_switch: bad pgdir 0x%lx\n", - newPageDirectory); - #warning M68K: export from arch_vm.c - m68k_set_pgdir(newPageDirectory); - m68k_context_switch(&from->arch_info.sp, to->arch_info.sp); - #endif - - #warning ARM:WRITEME + TRACE(("arch_thread_context_switch: %p(%s/%p) -> %p(%s/%p)\n", + from, from->name, from->arch_info.sp, to, to->name, to->arch_info.sp)); + arm_context_switch(&from->arch_info, &to->arch_info); + TRACE(("arch_thread_context_switch %p %p\n", to, from)); } From de4f3cf3a7e969666af6e78479fad1779116a014 Mon Sep 17 00:00:00 2001 From: "Ithamar R. Adema" Date: Mon, 5 Nov 2012 01:41:50 +0100 Subject: [PATCH 12/36] ARM: only warn if unknown memory types are being mapped. This is a workaround for missing writecombine & friends support. Needs proper fixing, but too many other things to do atm to focus on that... --- src/system/kernel/arch/arm/arch_vm.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/system/kernel/arch/arm/arch_vm.cpp b/src/system/kernel/arch/arm/arch_vm.cpp index 340ae784d0..bdde3ce928 100644 --- a/src/system/kernel/arch/arm/arch_vm.cpp +++ b/src/system/kernel/arch/arm/arch_vm.cpp @@ -97,8 +97,8 @@ arch_vm_unset_memory_type(VMArea *area) status_t arch_vm_set_memory_type(VMArea *area, phys_addr_t physicalBase, uint32 type) { - if (type == 0) - return B_OK; + if (type != 0) + dprintf("%s: undefined type %lx!\n", __PRETTY_FUNCTION__, type); - return B_ERROR; + return B_OK; } From 73f7af4d6cbb09e0bc353422446c9e5a47e7c843 Mon Sep 17 00:00:00 2001 From: Oliver Tappe Date: Sat, 3 Nov 2012 19:04:05 +0100 Subject: [PATCH 13/36] Drop "protected"-define from bsd-compatibility header * drop "protected" from bsd-compat header sys/cdefs.h, as that define pollutes the global namespace and at least FreeBSD doesn't provide it anymore * remove all uses of that macro from libedit, which seems to be the only user in our tree --- headers/compatibility/bsd/sys/cdefs.h | 6 +- src/libs/edit/chared.c | 48 +++++++------- src/libs/edit/chared.h | 44 ++++++------- src/libs/edit/common.c | 70 ++++++++++---------- src/libs/edit/common.h | 70 ++++++++++---------- src/libs/edit/el.c | 2 +- src/libs/edit/el.h | 2 +- src/libs/edit/emacs.c | 40 ++++++------ src/libs/edit/emacs.h | 40 ++++++------ src/libs/edit/fcns.c | 2 +- src/libs/edit/fcns.h | 2 +- src/libs/edit/help.c | 2 +- src/libs/edit/help.h | 2 +- src/libs/edit/hist.c | 12 ++-- src/libs/edit/hist.h | 12 ++-- src/libs/edit/key.c | 24 +++---- src/libs/edit/key.h | 24 +++---- src/libs/edit/map.c | 16 ++--- src/libs/edit/map.h | 16 ++--- src/libs/edit/parse.c | 8 +-- src/libs/edit/parse.h | 8 +-- src/libs/edit/prompt.c | 10 +-- src/libs/edit/prompt.h | 10 +-- src/libs/edit/read.c | 10 +-- src/libs/edit/read.h | 10 +-- src/libs/edit/refresh.c | 14 ++-- src/libs/edit/refresh.h | 14 ++-- src/libs/edit/search.c | 20 +++--- src/libs/edit/search.h | 20 +++--- src/libs/edit/sig.c | 8 +-- src/libs/edit/sig.h | 8 +-- src/libs/edit/term.c | 48 +++++++------- src/libs/edit/term.h | 46 ++++++------- src/libs/edit/tty.c | 16 ++--- src/libs/edit/tty.h | 16 ++--- src/libs/edit/vi.c | 94 +++++++++++++-------------- src/libs/edit/vi.h | 94 +++++++++++++-------------- 37 files changed, 442 insertions(+), 446 deletions(-) diff --git a/headers/compatibility/bsd/sys/cdefs.h b/headers/compatibility/bsd/sys/cdefs.h index 739f2b5e4b..f82b7d747a 100644 --- a/headers/compatibility/bsd/sys/cdefs.h +++ b/headers/compatibility/bsd/sys/cdefs.h @@ -1,5 +1,5 @@ /* - * Copyright 2006-2010 Haiku Inc. All Rights Reserved. + * Copyright 2006-2012 Haiku Inc. All Rights Reserved. * Distributed under the terms of the MIT License. */ #ifndef _BSD_SYS_CDEFS_H_ @@ -12,10 +12,6 @@ #define __FBSDID(x) #define __unused -#ifndef __cplusplus -# define protected -#endif - #define __printflike(a, b) __attribute__ ((format (__printf__, (a), (b)))) #define __printf0like(a, b) diff --git a/src/libs/edit/chared.c b/src/libs/edit/chared.c index 0991d98f50..ea401dac2f 100644 --- a/src/libs/edit/chared.c +++ b/src/libs/edit/chared.c @@ -54,7 +54,7 @@ private void ch__clearmacro(EditLine *); /* cv_undo(): * Handle state for the vi undo command */ -protected void +void cv_undo(EditLine *el) { c_undo_t *vu = &el->el_chared.c_undo; @@ -78,7 +78,7 @@ cv_undo(EditLine *el) /* cv_yank(): * Save yank/delete data for paste */ -protected void +void cv_yank(EditLine *el, const char *ptr, int size) { c_kill_t *k = &el->el_chared.c_kill; @@ -91,7 +91,7 @@ cv_yank(EditLine *el, const char *ptr, int size) /* c_insert(): * Insert num characters */ -protected void +void c_insert(EditLine *el, int num) { char *cp; @@ -113,7 +113,7 @@ c_insert(EditLine *el, int num) /* c_delafter(): * Delete num characters after the cursor */ -protected void +void c_delafter(EditLine *el, int num) { @@ -139,7 +139,7 @@ c_delafter(EditLine *el, int num) /* c_delafter1(): * Delete the character after the cursor, do not yank */ -protected void +void c_delafter1(EditLine *el) { char *cp; @@ -154,7 +154,7 @@ c_delafter1(EditLine *el) /* c_delbefore(): * Delete num characters before the cursor */ -protected void +void c_delbefore(EditLine *el, int num) { @@ -182,7 +182,7 @@ c_delbefore(EditLine *el, int num) /* c_delbefore1(): * Delete the character before the cursor, do not yank */ -protected void +void c_delbefore1(EditLine *el) { char *cp; @@ -197,7 +197,7 @@ c_delbefore1(EditLine *el) /* ce__isword(): * Return if p is part of a word according to emacs */ -protected int +int ce__isword(int p) { return (isalnum(p) || strchr("*?_-.[]~=", p) != NULL); @@ -207,7 +207,7 @@ ce__isword(int p) /* cv__isword(): * Return if p is part of a word according to vi */ -protected int +int cv__isword(int p) { if (isalnum(p) || p == '_') @@ -221,7 +221,7 @@ cv__isword(int p) /* cv__isWord(): * Return if p is part of a big word according to vi */ -protected int +int cv__isWord(int p) { return (!isspace(p)); @@ -231,7 +231,7 @@ cv__isWord(int p) /* c__prev_word(): * Find the previous word */ -protected char * +char * c__prev_word(char *p, char *low, int n, int (*wtest)(int)) { p--; @@ -255,7 +255,7 @@ c__prev_word(char *p, char *low, int n, int (*wtest)(int)) /* c__next_word(): * Find the next word */ -protected char * +char * c__next_word(char *p, char *high, int n, int (*wtest)(int)) { while (n--) { @@ -273,7 +273,7 @@ c__next_word(char *p, char *high, int n, int (*wtest)(int)) /* cv_next_word(): * Find the next word vi style */ -protected char * +char * cv_next_word(EditLine *el, char *p, char *high, int n, int (*wtest)(int)) { int test; @@ -302,7 +302,7 @@ cv_next_word(EditLine *el, char *p, char *high, int n, int (*wtest)(int)) /* cv_prev_word(): * Find the previous word vi style */ -protected char * +char * cv_prev_word(char *p, char *low, int n, int (*wtest)(int)) { int test; @@ -331,7 +331,7 @@ cv_prev_word(char *p, char *low, int n, int (*wtest)(int)) * A '$' by itself means a big number; "$-" is for negative; '^' means 1. * Return p pointing to last char used. */ -protected char * +char * c__number( char *p, /* character position */ int *num, /* Return value */ @@ -362,7 +362,7 @@ c__number( /* cv_delfini(): * Finish vi delete action */ -protected void +void cv_delfini(EditLine *el) { int size; @@ -401,7 +401,7 @@ cv_delfini(EditLine *el) /* ce__endword(): * Go to the end of this word according to emacs */ -protected char * +char * ce__endword(char *p, char *high, int n) { p++; @@ -422,7 +422,7 @@ ce__endword(char *p, char *high, int n) /* cv__endword(): * Go to the end of this word according to vi */ -protected char * +char * cv__endword(char *p, char *high, int n, int (*wtest)(int)) { int test; @@ -444,7 +444,7 @@ cv__endword(char *p, char *high, int n, int (*wtest)(int)) /* ch_init(): * Initialize the character editor */ -protected int +int ch_init(EditLine *el) { c_macro_t *ma = &el->el_chared.c_macro; @@ -500,7 +500,7 @@ ch_init(EditLine *el) /* ch_reset(): * Reset the character editor */ -protected void +void ch_reset(EditLine *el, int mclear) { el->el_line.cursor = el->el_line.buffer; @@ -541,7 +541,7 @@ ch__clearmacro(el) * Enlarge line buffer to be able to hold twice as much characters. * Returns 1 if successful, 0 if not. */ -protected int +int ch_enlargebufs(el, addlen) EditLine *el; size_t addlen; @@ -627,7 +627,7 @@ ch_enlargebufs(el, addlen) /* ch_end(): * Free the data structures used by the editor */ -protected void +void ch_end(EditLine *el) { el_free((ptr_t) el->el_line.buffer); @@ -691,7 +691,7 @@ el_deletestr(EditLine *el, int n) /* c_gets(): * Get a string */ -protected int +int c_gets(EditLine *el, char *buf, const char *prompt) { char ch; @@ -756,7 +756,7 @@ c_gets(EditLine *el, char *buf, const char *prompt) /* c_hpos(): * Return the current horizontal position of the cursor */ -protected int +int c_hpos(EditLine *el) { char *ptr; diff --git a/src/libs/edit/chared.h b/src/libs/edit/chared.h index 17d4e3e439..b036b034e6 100644 --- a/src/libs/edit/chared.h +++ b/src/libs/edit/chared.h @@ -141,28 +141,28 @@ typedef struct el_chared_t { #include "fcns.h" -protected int cv__isword(int); -protected int cv__isWord(int); -protected void cv_delfini(EditLine *); -protected char *cv__endword(char *, char *, int, int (*)(int)); -protected int ce__isword(int); -protected void cv_undo(EditLine *); -protected void cv_yank(EditLine *, const char *, int); -protected char *cv_next_word(EditLine*, char *, char *, int, int (*)(int)); -protected char *cv_prev_word(char *, char *, int, int (*)(int)); -protected char *c__next_word(char *, char *, int, int (*)(int)); -protected char *c__prev_word(char *, char *, int, int (*)(int)); -protected void c_insert(EditLine *, int); -protected void c_delbefore(EditLine *, int); -protected void c_delbefore1(EditLine *); -protected void c_delafter(EditLine *, int); -protected void c_delafter1(EditLine *); -protected int c_gets(EditLine *, char *, const char *); -protected int c_hpos(EditLine *); +int cv__isword(int); +int cv__isWord(int); +void cv_delfini(EditLine *); +char *cv__endword(char *, char *, int, int (*)(int)); +int ce__isword(int); +void cv_undo(EditLine *); +void cv_yank(EditLine *, const char *, int); +char *cv_next_word(EditLine*, char *, char *, int, int (*)(int)); +char *cv_prev_word(char *, char *, int, int (*)(int)); +char *c__next_word(char *, char *, int, int (*)(int)); +char *c__prev_word(char *, char *, int, int (*)(int)); +void c_insert(EditLine *, int); +void c_delbefore(EditLine *, int); +void c_delbefore1(EditLine *); +void c_delafter(EditLine *, int); +void c_delafter1(EditLine *); +int c_gets(EditLine *, char *, const char *); +int c_hpos(EditLine *); -protected int ch_init(EditLine *); -protected void ch_reset(EditLine *, int); -protected int ch_enlargebufs(EditLine *, size_t); -protected void ch_end(EditLine *); +int ch_init(EditLine *); +void ch_reset(EditLine *, int); +int ch_enlargebufs(EditLine *, size_t); +void ch_end(EditLine *); #endif /* _h_el_chared */ diff --git a/src/libs/edit/common.c b/src/libs/edit/common.c index 60bed6eac7..ac6d87191d 100644 --- a/src/libs/edit/common.c +++ b/src/libs/edit/common.c @@ -48,7 +48,7 @@ __FBSDID("$FreeBSD: src/lib/libedit/common.c,v 1.11 2005/08/09 13:37:59 stefanf * Indicate end of file * [^D] */ -protected el_action_t +el_action_t /*ARGSUSED*/ ed_end_of_file(EditLine *el, int c __unused) { @@ -63,7 +63,7 @@ ed_end_of_file(EditLine *el, int c __unused) * Add character to the line * Insert a character [bound to all insert keys] */ -protected el_action_t +el_action_t ed_insert(EditLine *el, int c) { int count = el->el_state.argument; @@ -105,7 +105,7 @@ ed_insert(EditLine *el, int c) * Delete from beginning of current word to cursor * [M-^?] [^W] */ -protected el_action_t +el_action_t /*ARGSUSED*/ ed_delete_prev_word(EditLine *el, int c __unused) { @@ -133,7 +133,7 @@ ed_delete_prev_word(EditLine *el, int c __unused) * Delete character under cursor * [^D] [x] */ -protected el_action_t +el_action_t /*ARGSUSED*/ ed_delete_next_char(EditLine *el, int c __unused) { @@ -184,7 +184,7 @@ ed_delete_next_char(EditLine *el, int c __unused) * Cut to the end of line * [^K] [^K] */ -protected el_action_t +el_action_t /*ARGSUSED*/ ed_kill_line(EditLine *el, int c __unused) { @@ -205,7 +205,7 @@ ed_kill_line(EditLine *el, int c __unused) * Move cursor to the end of line * [^E] [^E] */ -protected el_action_t +el_action_t /*ARGSUSED*/ ed_move_to_end(EditLine *el, int c __unused) { @@ -228,7 +228,7 @@ ed_move_to_end(EditLine *el, int c __unused) * Move cursor to the beginning of line * [^A] [^A] */ -protected el_action_t +el_action_t /*ARGSUSED*/ ed_move_to_beg(EditLine *el, int c __unused) { @@ -252,7 +252,7 @@ ed_move_to_beg(EditLine *el, int c __unused) * Exchange the character to the left of the cursor with the one under it * [^T] [^T] */ -protected el_action_t +el_action_t ed_transpose_chars(EditLine *el, int c) { @@ -277,7 +277,7 @@ ed_transpose_chars(EditLine *el, int c) * Move to the right one character * [^F] [^F] */ -protected el_action_t +el_action_t /*ARGSUSED*/ ed_next_char(EditLine *el, int c __unused) { @@ -306,7 +306,7 @@ ed_next_char(EditLine *el, int c __unused) * Move to the beginning of the current word * [M-b] [b] */ -protected el_action_t +el_action_t /*ARGSUSED*/ ed_prev_word(EditLine *el, int c __unused) { @@ -332,7 +332,7 @@ ed_prev_word(EditLine *el, int c __unused) * Move to the left one character * [^B] [^B] */ -protected el_action_t +el_action_t /*ARGSUSED*/ ed_prev_char(EditLine *el, int c __unused) { @@ -357,7 +357,7 @@ ed_prev_char(EditLine *el, int c __unused) * Add the next character typed verbatim * [^V] [^V] */ -protected el_action_t +el_action_t ed_quoted_insert(EditLine *el, int c) { int num; @@ -377,7 +377,7 @@ ed_quoted_insert(EditLine *el, int c) /* ed_digit(): * Adds to argument or enters a digit */ -protected el_action_t +el_action_t ed_digit(EditLine *el, int c) { @@ -405,7 +405,7 @@ ed_digit(EditLine *el, int c) * Digit that starts argument * For ESC-n */ -protected el_action_t +el_action_t ed_argument_digit(EditLine *el, int c) { @@ -429,7 +429,7 @@ ed_argument_digit(EditLine *el, int c) * Indicates unbound character * Bound to keys that are not assigned */ -protected el_action_t +el_action_t /*ARGSUSED*/ ed_unassigned(EditLine *el, int c __unused) { @@ -446,7 +446,7 @@ ed_unassigned(EditLine *el, int c __unused) * Tty interrupt character * [^C] */ -protected el_action_t +el_action_t /*ARGSUSED*/ ed_tty_sigint(EditLine *el __unused, int c __unused) @@ -460,7 +460,7 @@ ed_tty_sigint(EditLine *el __unused, * Tty delayed suspend character * [^Y] */ -protected el_action_t +el_action_t /*ARGSUSED*/ ed_tty_dsusp(EditLine *el __unused, int c __unused) @@ -474,7 +474,7 @@ ed_tty_dsusp(EditLine *el __unused, * Tty flush output characters * [^O] */ -protected el_action_t +el_action_t /*ARGSUSED*/ ed_tty_flush_output(EditLine *el __unused, int c __unused) @@ -488,7 +488,7 @@ ed_tty_flush_output(EditLine *el __unused, * Tty quit character * [^\] */ -protected el_action_t +el_action_t /*ARGSUSED*/ ed_tty_sigquit(EditLine *el __unused, int c __unused) @@ -502,7 +502,7 @@ ed_tty_sigquit(EditLine *el __unused, * Tty suspend character * [^Z] */ -protected el_action_t +el_action_t /*ARGSUSED*/ ed_tty_sigtstp(EditLine *el __unused, int c __unused) @@ -516,7 +516,7 @@ ed_tty_sigtstp(EditLine *el __unused, * Tty disallow output characters * [^S] */ -protected el_action_t +el_action_t /*ARGSUSED*/ ed_tty_stop_output(EditLine *el __unused, int c __unused) @@ -530,7 +530,7 @@ ed_tty_stop_output(EditLine *el __unused, * Tty allow output characters * [^Q] */ -protected el_action_t +el_action_t /*ARGSUSED*/ ed_tty_start_output(EditLine *el __unused, int c __unused) @@ -544,7 +544,7 @@ ed_tty_start_output(EditLine *el __unused, * Execute command * [^J] */ -protected el_action_t +el_action_t /*ARGSUSED*/ ed_newline(EditLine *el, int c __unused) { @@ -560,7 +560,7 @@ ed_newline(EditLine *el, int c __unused) * Delete the character to the left of the cursor * [^?] */ -protected el_action_t +el_action_t /*ARGSUSED*/ ed_delete_prev_char(EditLine *el, int c __unused) { @@ -580,7 +580,7 @@ ed_delete_prev_char(EditLine *el, int c __unused) * Clear screen leaving current line at the top * [^L] */ -protected el_action_t +el_action_t /*ARGSUSED*/ ed_clear_screen(EditLine *el, int c __unused) { @@ -595,7 +595,7 @@ ed_clear_screen(EditLine *el, int c __unused) * Redisplay everything * ^R */ -protected el_action_t +el_action_t /*ARGSUSED*/ ed_redisplay(EditLine *el __unused, int c __unused) @@ -609,7 +609,7 @@ ed_redisplay(EditLine *el __unused, * Erase current line and start from scratch * [^G] */ -protected el_action_t +el_action_t /*ARGSUSED*/ ed_start_over(EditLine *el, int c __unused) { @@ -623,7 +623,7 @@ ed_start_over(EditLine *el, int c __unused) * First character in a bound sequence * Placeholder for external keys */ -protected el_action_t +el_action_t /*ARGSUSED*/ ed_sequence_lead_in(EditLine *el __unused, int c __unused) @@ -637,7 +637,7 @@ ed_sequence_lead_in(EditLine *el __unused, * Move to the previous history line * [^P] [k] */ -protected el_action_t +el_action_t /*ARGSUSED*/ ed_prev_history(EditLine *el, int c __unused) { @@ -675,7 +675,7 @@ ed_prev_history(EditLine *el, int c __unused) * Move to the next history line * [^N] [j] */ -protected el_action_t +el_action_t /*ARGSUSED*/ ed_next_history(EditLine *el, int c __unused) { @@ -702,7 +702,7 @@ ed_next_history(EditLine *el, int c __unused) * Search previous in history for a line matching the current * next search history [M-P] [K] */ -protected el_action_t +el_action_t /*ARGSUSED*/ ed_search_prev_history(EditLine *el, int c __unused) { @@ -770,7 +770,7 @@ ed_search_prev_history(EditLine *el, int c __unused) * Search next in history for a line matching the current * [M-N] [J] */ -protected el_action_t +el_action_t /*ARGSUSED*/ ed_search_next_history(EditLine *el, int c __unused) { @@ -824,7 +824,7 @@ ed_search_next_history(EditLine *el, int c __unused) * Move up one line * Could be [k] [^p] */ -protected el_action_t +el_action_t /*ARGSUSED*/ ed_prev_line(EditLine *el, int c __unused) { @@ -867,7 +867,7 @@ ed_prev_line(EditLine *el, int c __unused) * Move down one line * Could be [j] [^n] */ -protected el_action_t +el_action_t /*ARGSUSED*/ ed_next_line(EditLine *el, int c __unused) { @@ -901,7 +901,7 @@ ed_next_line(EditLine *el, int c __unused) * Editline extended command * [M-X] [:] */ -protected el_action_t +el_action_t /*ARGSUSED*/ ed_command(EditLine *el, int c __unused) { diff --git a/src/libs/edit/common.h b/src/libs/edit/common.h index 35c61eb9a6..866bfefb7c 100644 --- a/src/libs/edit/common.h +++ b/src/libs/edit/common.h @@ -1,39 +1,39 @@ /* Automatically generated file, do not edit */ #ifndef _h_common_c #define _h_common_c -protected el_action_t ed_end_of_file (EditLine *, int); -protected el_action_t ed_insert (EditLine *, int); -protected el_action_t ed_delete_prev_word (EditLine *, int); -protected el_action_t ed_delete_next_char (EditLine *, int); -protected el_action_t ed_kill_line (EditLine *, int); -protected el_action_t ed_move_to_end (EditLine *, int); -protected el_action_t ed_move_to_beg (EditLine *, int); -protected el_action_t ed_transpose_chars (EditLine *, int); -protected el_action_t ed_next_char (EditLine *, int); -protected el_action_t ed_prev_word (EditLine *, int); -protected el_action_t ed_prev_char (EditLine *, int); -protected el_action_t ed_quoted_insert (EditLine *, int); -protected el_action_t ed_digit (EditLine *, int); -protected el_action_t ed_argument_digit (EditLine *, int); -protected el_action_t ed_unassigned (EditLine *, int); -protected el_action_t ed_tty_sigint (EditLine *, int); -protected el_action_t ed_tty_dsusp (EditLine *, int); -protected el_action_t ed_tty_flush_output (EditLine *, int); -protected el_action_t ed_tty_sigquit (EditLine *, int); -protected el_action_t ed_tty_sigtstp (EditLine *, int); -protected el_action_t ed_tty_stop_output (EditLine *, int); -protected el_action_t ed_tty_start_output (EditLine *, int); -protected el_action_t ed_newline (EditLine *, int); -protected el_action_t ed_delete_prev_char (EditLine *, int); -protected el_action_t ed_clear_screen (EditLine *, int); -protected el_action_t ed_redisplay (EditLine *, int); -protected el_action_t ed_start_over (EditLine *, int); -protected el_action_t ed_sequence_lead_in (EditLine *, int); -protected el_action_t ed_prev_history (EditLine *, int); -protected el_action_t ed_next_history (EditLine *, int); -protected el_action_t ed_search_prev_history (EditLine *, int); -protected el_action_t ed_search_next_history (EditLine *, int); -protected el_action_t ed_prev_line (EditLine *, int); -protected el_action_t ed_next_line (EditLine *, int); -protected el_action_t ed_command (EditLine *, int); +el_action_t ed_end_of_file (EditLine *, int); +el_action_t ed_insert (EditLine *, int); +el_action_t ed_delete_prev_word (EditLine *, int); +el_action_t ed_delete_next_char (EditLine *, int); +el_action_t ed_kill_line (EditLine *, int); +el_action_t ed_move_to_end (EditLine *, int); +el_action_t ed_move_to_beg (EditLine *, int); +el_action_t ed_transpose_chars (EditLine *, int); +el_action_t ed_next_char (EditLine *, int); +el_action_t ed_prev_word (EditLine *, int); +el_action_t ed_prev_char (EditLine *, int); +el_action_t ed_quoted_insert (EditLine *, int); +el_action_t ed_digit (EditLine *, int); +el_action_t ed_argument_digit (EditLine *, int); +el_action_t ed_unassigned (EditLine *, int); +el_action_t ed_tty_sigint (EditLine *, int); +el_action_t ed_tty_dsusp (EditLine *, int); +el_action_t ed_tty_flush_output (EditLine *, int); +el_action_t ed_tty_sigquit (EditLine *, int); +el_action_t ed_tty_sigtstp (EditLine *, int); +el_action_t ed_tty_stop_output (EditLine *, int); +el_action_t ed_tty_start_output (EditLine *, int); +el_action_t ed_newline (EditLine *, int); +el_action_t ed_delete_prev_char (EditLine *, int); +el_action_t ed_clear_screen (EditLine *, int); +el_action_t ed_redisplay (EditLine *, int); +el_action_t ed_start_over (EditLine *, int); +el_action_t ed_sequence_lead_in (EditLine *, int); +el_action_t ed_prev_history (EditLine *, int); +el_action_t ed_next_history (EditLine *, int); +el_action_t ed_search_prev_history (EditLine *, int); +el_action_t ed_search_next_history (EditLine *, int); +el_action_t ed_prev_line (EditLine *, int); +el_action_t ed_next_line (EditLine *, int); +el_action_t ed_command (EditLine *, int); #endif /* _h_common_c */ diff --git a/src/libs/edit/el.c b/src/libs/edit/el.c index 80fb8b6a63..890dfa6da6 100644 --- a/src/libs/edit/el.c +++ b/src/libs/edit/el.c @@ -531,7 +531,7 @@ el_beep(EditLine *el) /* el_editmode() * Set the state of EDIT_DISABLED from the `edit' command. */ -protected int +int /*ARGSUSED*/ el_editmode(EditLine *el, int argc, const char **argv) { diff --git a/src/libs/edit/el.h b/src/libs/edit/el.h index 398c4ad36e..d836d90de4 100644 --- a/src/libs/edit/el.h +++ b/src/libs/edit/el.h @@ -134,7 +134,7 @@ struct editline { el_read_t el_read; /* Character reading stuff */ }; -protected int el_editmode(EditLine *, int, const char **); +int el_editmode(EditLine *, int, const char **); #ifdef DEBUG #define EL_ABORT(a) do { \ diff --git a/src/libs/edit/emacs.c b/src/libs/edit/emacs.c index 890a1d1809..2c6c9925c1 100644 --- a/src/libs/edit/emacs.c +++ b/src/libs/edit/emacs.c @@ -45,7 +45,7 @@ __FBSDID("$FreeBSD: src/lib/libedit/emacs.c,v 1.10 2005/08/09 13:37:59 stefanf E * Delete character under cursor or list completions if at end of line * [^D] */ -protected el_action_t +el_action_t /*ARGSUSED*/ em_delete_or_list(EditLine *el, int c __unused) { @@ -82,7 +82,7 @@ em_delete_or_list(EditLine *el, int c __unused) * Cut from cursor to end of current word * [M-d] */ -protected el_action_t +el_action_t /*ARGSUSED*/ em_delete_next_word(EditLine *el, int c __unused) { @@ -111,7 +111,7 @@ em_delete_next_word(EditLine *el, int c __unused) * Paste cut buffer at cursor position * [^Y] */ -protected el_action_t +el_action_t /*ARGSUSED*/ em_yank(EditLine *el, int c __unused) { @@ -146,7 +146,7 @@ em_yank(EditLine *el, int c __unused) * Cut the entire line and save in cut buffer * [^U] */ -protected el_action_t +el_action_t /*ARGSUSED*/ em_kill_line(EditLine *el, int c __unused) { @@ -168,7 +168,7 @@ em_kill_line(EditLine *el, int c __unused) * Cut area between mark and cursor and save in cut buffer * [^W] */ -protected el_action_t +el_action_t /*ARGSUSED*/ em_kill_region(EditLine *el, int c __unused) { @@ -201,7 +201,7 @@ em_kill_region(EditLine *el, int c __unused) * Copy area between mark and cursor to cut buffer * [M-W] */ -protected el_action_t +el_action_t /*ARGSUSED*/ em_copy_region(EditLine *el, int c __unused) { @@ -231,7 +231,7 @@ em_copy_region(EditLine *el, int c __unused) * Exchange the two characters before the cursor * Gosling emacs transpose chars [^T] */ -protected el_action_t +el_action_t em_gosmacs_transpose(EditLine *el, int c) { @@ -250,7 +250,7 @@ em_gosmacs_transpose(EditLine *el, int c) * Move next to end of current word * [M-f] */ -protected el_action_t +el_action_t /*ARGSUSED*/ em_next_word(EditLine *el, int c __unused) { @@ -275,7 +275,7 @@ em_next_word(EditLine *el, int c __unused) * Uppercase the characters from cursor to end of current word * [M-u] */ -protected el_action_t +el_action_t /*ARGSUSED*/ em_upper_case(EditLine *el, int c __unused) { @@ -299,7 +299,7 @@ em_upper_case(EditLine *el, int c __unused) * Capitalize the characters from cursor to end of current word * [M-c] */ -protected el_action_t +el_action_t /*ARGSUSED*/ em_capitol_case(EditLine *el, int c __unused) { @@ -331,7 +331,7 @@ em_capitol_case(EditLine *el, int c __unused) * Lowercase the characters from cursor to end of current word * [M-l] */ -protected el_action_t +el_action_t /*ARGSUSED*/ em_lower_case(EditLine *el, int c __unused) { @@ -355,7 +355,7 @@ em_lower_case(EditLine *el, int c __unused) * Set the mark at cursor * [^@] */ -protected el_action_t +el_action_t /*ARGSUSED*/ em_set_mark(EditLine *el, int c __unused) { @@ -369,7 +369,7 @@ em_set_mark(EditLine *el, int c __unused) * Exchange the cursor and mark * [^X^X] */ -protected el_action_t +el_action_t /*ARGSUSED*/ em_exchange_mark(EditLine *el, int c __unused) { @@ -386,7 +386,7 @@ em_exchange_mark(EditLine *el, int c __unused) * Universal argument (argument times 4) * [^U] */ -protected el_action_t +el_action_t /*ARGSUSED*/ em_universal_argument(EditLine *el, int c __unused) { /* multiply current argument by 4 */ @@ -403,7 +403,7 @@ em_universal_argument(EditLine *el, int c __unused) * Add 8th bit to next character typed * [] */ -protected el_action_t +el_action_t /*ARGSUSED*/ em_meta_next(EditLine *el, int c __unused) { @@ -416,7 +416,7 @@ em_meta_next(EditLine *el, int c __unused) /* em_toggle_overwrite(): * Switch from insert to overwrite mode or vice versa */ -protected el_action_t +el_action_t /*ARGSUSED*/ em_toggle_overwrite(EditLine *el, int c __unused) { @@ -430,7 +430,7 @@ em_toggle_overwrite(EditLine *el, int c __unused) /* em_copy_prev_word(): * Copy current word to cursor */ -protected el_action_t +el_action_t /*ARGSUSED*/ em_copy_prev_word(EditLine *el, int c __unused) { @@ -457,7 +457,7 @@ em_copy_prev_word(EditLine *el, int c __unused) /* em_inc_search_next(): * Emacs incremental next search */ -protected el_action_t +el_action_t /*ARGSUSED*/ em_inc_search_next(EditLine *el, int c __unused) { @@ -470,7 +470,7 @@ em_inc_search_next(EditLine *el, int c __unused) /* em_inc_search_prev(): * Emacs incremental reverse search */ -protected el_action_t +el_action_t /*ARGSUSED*/ em_inc_search_prev(EditLine *el, int c __unused) { @@ -484,7 +484,7 @@ em_inc_search_prev(EditLine *el, int c __unused) * Delete the character to the left of the cursor * [^?] */ -protected el_action_t +el_action_t /*ARGSUSED*/ em_delete_prev_char(EditLine *el, int c __unused) { diff --git a/src/libs/edit/emacs.h b/src/libs/edit/emacs.h index 60a5e9e012..ff588804bc 100644 --- a/src/libs/edit/emacs.h +++ b/src/libs/edit/emacs.h @@ -1,24 +1,24 @@ /* Automatically generated file, do not edit */ #ifndef _h_emacs_c #define _h_emacs_c -protected el_action_t em_delete_or_list (EditLine *, int); -protected el_action_t em_delete_next_word (EditLine *, int); -protected el_action_t em_yank (EditLine *, int); -protected el_action_t em_kill_line (EditLine *, int); -protected el_action_t em_kill_region (EditLine *, int); -protected el_action_t em_copy_region (EditLine *, int); -protected el_action_t em_gosmacs_transpose (EditLine *, int); -protected el_action_t em_next_word (EditLine *, int); -protected el_action_t em_upper_case (EditLine *, int); -protected el_action_t em_capitol_case (EditLine *, int); -protected el_action_t em_lower_case (EditLine *, int); -protected el_action_t em_set_mark (EditLine *, int); -protected el_action_t em_exchange_mark (EditLine *, int); -protected el_action_t em_universal_argument (EditLine *, int); -protected el_action_t em_meta_next (EditLine *, int); -protected el_action_t em_toggle_overwrite (EditLine *, int); -protected el_action_t em_copy_prev_word (EditLine *, int); -protected el_action_t em_inc_search_next (EditLine *, int); -protected el_action_t em_inc_search_prev (EditLine *, int); -protected el_action_t em_delete_prev_char (EditLine *, int); +el_action_t em_delete_or_list (EditLine *, int); +el_action_t em_delete_next_word (EditLine *, int); +el_action_t em_yank (EditLine *, int); +el_action_t em_kill_line (EditLine *, int); +el_action_t em_kill_region (EditLine *, int); +el_action_t em_copy_region (EditLine *, int); +el_action_t em_gosmacs_transpose (EditLine *, int); +el_action_t em_next_word (EditLine *, int); +el_action_t em_upper_case (EditLine *, int); +el_action_t em_capitol_case (EditLine *, int); +el_action_t em_lower_case (EditLine *, int); +el_action_t em_set_mark (EditLine *, int); +el_action_t em_exchange_mark (EditLine *, int); +el_action_t em_universal_argument (EditLine *, int); +el_action_t em_meta_next (EditLine *, int); +el_action_t em_toggle_overwrite (EditLine *, int); +el_action_t em_copy_prev_word (EditLine *, int); +el_action_t em_inc_search_next (EditLine *, int); +el_action_t em_inc_search_prev (EditLine *, int); +el_action_t em_delete_prev_char (EditLine *, int); #endif /* _h_emacs_c */ diff --git a/src/libs/edit/fcns.c b/src/libs/edit/fcns.c index e8594d4b15..805b32ae9d 100644 --- a/src/libs/edit/fcns.c +++ b/src/libs/edit/fcns.c @@ -55,4 +55,4 @@ private const el_func_t el_func[] = { vi_yank_end, vi_zero, }; -protected const el_func_t* func__get() { return el_func; } +const el_func_t* func__get() { return el_func; } diff --git a/src/libs/edit/fcns.h b/src/libs/edit/fcns.h index adf9c48e8a..b95c8c868f 100644 --- a/src/libs/edit/fcns.h +++ b/src/libs/edit/fcns.h @@ -105,5 +105,5 @@ #define VI_ZERO 101 #define EL_NUM_FCNS 102 typedef el_action_t (*el_func_t)(EditLine *, int); -protected const el_func_t* func__get(void); +const el_func_t* func__get(void); #endif /* _h_fcns_c */ diff --git a/src/libs/edit/help.c b/src/libs/edit/help.c index 898e919327..5c695781df 100644 --- a/src/libs/edit/help.c +++ b/src/libs/edit/help.c @@ -208,4 +208,4 @@ private const struct el_bindings_t el_func_help[] = { "Editline extended command" }, }; -protected const el_bindings_t* help__get(){ return el_func_help; } +const el_bindings_t* help__get(){ return el_func_help; } diff --git a/src/libs/edit/help.h b/src/libs/edit/help.h index a7e89a1af0..a93a1297cb 100644 --- a/src/libs/edit/help.h +++ b/src/libs/edit/help.h @@ -1,5 +1,5 @@ /* Automatically generated file, do not edit */ #ifndef _h_help_c #define _h_help_c -protected const el_bindings_t *help__get(void); +const el_bindings_t *help__get(void); #endif /* _h_help_c */ diff --git a/src/libs/edit/hist.c b/src/libs/edit/hist.c index 9b919b3c1c..676f52b294 100644 --- a/src/libs/edit/hist.c +++ b/src/libs/edit/hist.c @@ -42,7 +42,7 @@ /* hist_init(): * Initialization function. */ -protected int +int hist_init(EditLine *el) { @@ -60,7 +60,7 @@ hist_init(EditLine *el) /* hist_end(): * clean up history; */ -protected void +void hist_end(EditLine *el) { @@ -72,7 +72,7 @@ hist_end(EditLine *el) /* hist_set(): * Set new history interface */ -protected int +int hist_set(EditLine *el, hist_fun_t fun, ptr_t ptr) { @@ -86,7 +86,7 @@ hist_set(EditLine *el, hist_fun_t fun, ptr_t ptr) * Get a history line and update it in the buffer. * eventno tells us the event to get. */ -protected el_action_t +el_action_t hist_get(EditLine *el) { const char *hp; @@ -144,7 +144,7 @@ hist_get(EditLine *el) /* hist_command() * process a history command */ -protected int +int hist_command(EditLine *el, int argc, const char **argv) { const char *str; @@ -181,7 +181,7 @@ hist_command(EditLine *el, int argc, const char **argv) * Enlarge history buffer to specified value. Called from el_enlargebufs(). * Return 0 for failure, 1 for success. */ -protected int +int /*ARGSUSED*/ hist_enlargebuf(EditLine *el, size_t oldsz, size_t newsz) { diff --git a/src/libs/edit/hist.h b/src/libs/edit/hist.h index 079d4ad289..5efa345e9e 100644 --- a/src/libs/edit/hist.h +++ b/src/libs/edit/hist.h @@ -67,11 +67,11 @@ typedef struct el_history_t { #define HIST_LOAD(el, fname) HIST_FUN(el, H_LOAD fname) #define HIST_SAVE(el, fname) HIST_FUN(el, H_SAVE fname) -protected int hist_init(EditLine *); -protected void hist_end(EditLine *); -protected el_action_t hist_get(EditLine *); -protected int hist_set(EditLine *, hist_fun_t, ptr_t); -protected int hist_command(EditLine *, int, const char **); -protected int hist_enlargebuf(EditLine *, size_t, size_t); +int hist_init(EditLine *); +void hist_end(EditLine *); +el_action_t hist_get(EditLine *); +int hist_set(EditLine *, hist_fun_t, ptr_t); +int hist_command(EditLine *, int, const char **); +int hist_enlargebuf(EditLine *, size_t, size_t); #endif /* _h_el_hist */ diff --git a/src/libs/edit/key.c b/src/libs/edit/key.c index 495249cb5a..ba127ea4d4 100644 --- a/src/libs/edit/key.c +++ b/src/libs/edit/key.c @@ -93,7 +93,7 @@ private int key__decode_char(char *, int, int); /* key_init(): * Initialize the key maps */ -protected int +int key_init(EditLine *el) { @@ -108,7 +108,7 @@ key_init(EditLine *el) /* key_end(): * Free the key maps */ -protected void +void key_end(EditLine *el) { @@ -121,7 +121,7 @@ key_end(EditLine *el) /* key_map_cmd(): * Associate cmd with a key value */ -protected key_value_t * +key_value_t * key_map_cmd(EditLine *el, int cmd) { @@ -133,7 +133,7 @@ key_map_cmd(EditLine *el, int cmd) /* key_map_str(): * Associate str with a key value */ -protected key_value_t * +key_value_t * key_map_str(EditLine *el, char *str) { @@ -147,7 +147,7 @@ key_map_str(EditLine *el, char *str) * initializes el->el_key.map with arrow keys * [Always bind the ansi arrow keys?] */ -protected void +void key_reset(EditLine *el) { @@ -165,7 +165,7 @@ key_reset(EditLine *el) * Returns NULL in val.str and XK_STR for no match. * The last character read is returned in *ch. */ -protected int +int key_get(EditLine *el, char *ch, key_value_t *val) { @@ -179,7 +179,7 @@ key_get(EditLine *el, char *ch, key_value_t *val) * existing key. Ntype specifies if code is a command, an * out str or a unix command. */ -protected void +void key_add(EditLine *el, const char *key, key_value_t *val, int ntype) { @@ -207,7 +207,7 @@ key_add(EditLine *el, const char *key, key_value_t *val, int ntype) /* key_clear(): * */ -protected void +void key_clear(EditLine *el, el_action_t *map, const char *in) { @@ -224,7 +224,7 @@ key_clear(EditLine *el, el_action_t *map, const char *in) * Delete the key and all longer keys staring with key, if * they exists. */ -protected int +int key_delete(EditLine *el, const char *key) { @@ -245,7 +245,7 @@ key_delete(EditLine *el, const char *key) * Print the binding associated with key key. * Print entire el->el_key.map if null */ -protected void +void key_print(EditLine *el, const char *key) { @@ -565,7 +565,7 @@ node_enum(EditLine *el, key_node_t *ptr, int cnt) * Print the specified key and its associated * function specified by val */ -protected void +void key_kprint(EditLine *el, const char *key, key_value_t *val, int ntype) { el_bindings_t *fp; @@ -643,7 +643,7 @@ key__decode_char(char *buf, int cnt, int ch) /* key__decode_str(): * Make a printable version of the ey */ -protected char * +char * key__decode_str(const char *str, char *buf, const char *sep) { char *b; diff --git a/src/libs/edit/key.h b/src/libs/edit/key.h index 880157b5ec..6565bffe73 100644 --- a/src/libs/edit/key.h +++ b/src/libs/edit/key.h @@ -64,18 +64,18 @@ typedef struct el_key_t { #undef key_clear #undef key_print -protected int key_init(EditLine *); -protected void key_end(EditLine *); -protected key_value_t *key_map_cmd(EditLine *, int); -protected key_value_t *key_map_str(EditLine *, char *); -protected void key_reset(EditLine *); -protected int key_get(EditLine *, char *, key_value_t *); -protected void key_add(EditLine *, const char *, key_value_t *, int); -protected void key_clear(EditLine *, el_action_t *, const char *); -protected int key_delete(EditLine *, const char *); -protected void key_print(EditLine *, const char *); -protected void key_kprint(EditLine *, const char *, key_value_t *, +int key_init(EditLine *); +void key_end(EditLine *); +key_value_t *key_map_cmd(EditLine *, int); +key_value_t *key_map_str(EditLine *, char *); +void key_reset(EditLine *); +int key_get(EditLine *, char *, key_value_t *); +void key_add(EditLine *, const char *, key_value_t *, int); +void key_clear(EditLine *, el_action_t *, const char *); +int key_delete(EditLine *, const char *); +void key_print(EditLine *, const char *); +void key_kprint(EditLine *, const char *, key_value_t *, int); -protected char *key__decode_str(const char *, char *, const char *); +char *key__decode_str(const char *, char *, const char *); #endif /* _h_el_key */ diff --git a/src/libs/edit/map.c b/src/libs/edit/map.c index 680ea7d24e..bc055afe12 100644 --- a/src/libs/edit/map.c +++ b/src/libs/edit/map.c @@ -884,7 +884,7 @@ private const el_action_t el_map_vi_command[] = { /* map_init(): * Initialize and allocate the maps */ -protected int +int map_init(EditLine *el) { @@ -934,7 +934,7 @@ map_init(EditLine *el) /* map_end(): * Free the space taken by the editor maps */ -protected void +void map_end(EditLine *el) { @@ -1012,7 +1012,7 @@ map_init_meta(EditLine *el) /* map_init_vi(): * Initialize the vi bindings */ -protected void +void map_init_vi(EditLine *el) { int i; @@ -1042,7 +1042,7 @@ map_init_vi(EditLine *el) /* map_init_emacs(): * Initialize the emacs bindings */ -protected void +void map_init_emacs(EditLine *el) { int i; @@ -1076,7 +1076,7 @@ map_init_emacs(EditLine *el) /* map_set_editor(): * Set the editor */ -protected int +int map_set_editor(EditLine *el, char *editor) { @@ -1095,7 +1095,7 @@ map_set_editor(EditLine *el, char *editor) /* map_get_editor(): * Retrieve the editor */ -protected int +int map_get_editor(EditLine *el, const char **editor) { @@ -1231,7 +1231,7 @@ map_print_all_keys(EditLine *el) /* map_bind(): * Add/remove/change bindings */ -protected int +int map_bind(EditLine *el, int argc, const char **argv) { el_action_t *map; @@ -1381,7 +1381,7 @@ map_bind(EditLine *el, int argc, const char **argv) /* map_addfunc(): * add a user defined function */ -protected int +int map_addfunc(EditLine *el, const char *name, const char *help, el_func_t func) { void *p; diff --git a/src/libs/edit/map.h b/src/libs/edit/map.h index f82a963826..893c84def3 100644 --- a/src/libs/edit/map.h +++ b/src/libs/edit/map.h @@ -63,13 +63,13 @@ typedef struct el_map_t { #define MAP_EMACS 0 #define MAP_VI 1 -protected int map_bind(EditLine *, int, const char **); -protected int map_init(EditLine *); -protected void map_end(EditLine *); -protected void map_init_vi(EditLine *); -protected void map_init_emacs(EditLine *); -protected int map_set_editor(EditLine *, char *); -protected int map_get_editor(EditLine *, const char **); -protected int map_addfunc(EditLine *, const char *, const char *, el_func_t); +int map_bind(EditLine *, int, const char **); +int map_init(EditLine *); +void map_end(EditLine *); +void map_init_vi(EditLine *); +void map_init_emacs(EditLine *); +int map_set_editor(EditLine *, char *); +int map_get_editor(EditLine *, const char **); +int map_addfunc(EditLine *, const char *, const char *, el_func_t); #endif /* _h_el_map */ diff --git a/src/libs/edit/parse.c b/src/libs/edit/parse.c index 74f3786e3d..e5f4963acc 100644 --- a/src/libs/edit/parse.c +++ b/src/libs/edit/parse.c @@ -73,7 +73,7 @@ private const struct { /* parse_line(): * Parse a line and dispatch it */ -protected int +int parse_line(EditLine *el, const char *line) { const char **argv; @@ -133,7 +133,7 @@ el_parse(EditLine *el, int argc, const char *argv[]) * Parse a string of the form ^ \ \ and return * the appropriate character or -1 if the escape is not valid */ -protected int +int parse__escape(const char **ptr) { const char *p; @@ -211,7 +211,7 @@ parse__escape(const char **ptr) /* parse__string(): * Parse the escapes from in and put the raw string out */ -protected char * +char * parse__string(char *out, const char *in) { char *rv = out; @@ -249,7 +249,7 @@ parse__string(char *out, const char *in) * Return the command number for the command string given * or -1 if one is not found */ -protected int +int parse_cmd(EditLine *el, const char *cmd) { el_bindings_t *b; diff --git a/src/libs/edit/parse.h b/src/libs/edit/parse.h index 73340d1afd..eedb2887df 100644 --- a/src/libs/edit/parse.h +++ b/src/libs/edit/parse.h @@ -40,9 +40,9 @@ #ifndef _h_el_parse #define _h_el_parse -protected int parse_line(EditLine *, const char *); -protected int parse__escape(const char **); -protected char *parse__string(char *, const char *); -protected int parse_cmd(EditLine *, const char *); +int parse_line(EditLine *, const char *); +int parse__escape(const char **); +char *parse__string(char *, const char *); +int parse_cmd(EditLine *, const char *); #endif /* _h_el_parse */ diff --git a/src/libs/edit/prompt.c b/src/libs/edit/prompt.c index 551d39d7b7..374c6d3e6f 100644 --- a/src/libs/edit/prompt.c +++ b/src/libs/edit/prompt.c @@ -77,7 +77,7 @@ prompt_default_r(EditLine *el __unused) * literal escape sequences in the prompt and we want a * bit to flag them */ -protected void +void prompt_print(EditLine *el, int op) { el_prompt_t *elp; @@ -99,7 +99,7 @@ prompt_print(EditLine *el, int op) /* prompt_init(): * Initialize the prompt stuff */ -protected int +int prompt_init(EditLine *el) { @@ -116,7 +116,7 @@ prompt_init(EditLine *el) /* prompt_end(): * Clean up the prompt stuff */ -protected void +void /*ARGSUSED*/ prompt_end(EditLine *el __unused) { @@ -126,7 +126,7 @@ prompt_end(EditLine *el __unused) /* prompt_set(): * Install a prompt printing function */ -protected int +int prompt_set(EditLine *el, el_pfunc_t prf, int op) { el_prompt_t *p; @@ -151,7 +151,7 @@ prompt_set(EditLine *el, el_pfunc_t prf, int op) /* prompt_get(): * Retrieve the prompt printing function */ -protected int +int prompt_get(EditLine *el, el_pfunc_t *prf, int op) { diff --git a/src/libs/edit/prompt.h b/src/libs/edit/prompt.h index a48135fa62..d262b66165 100644 --- a/src/libs/edit/prompt.h +++ b/src/libs/edit/prompt.h @@ -49,10 +49,10 @@ typedef struct el_prompt_t { coord_t p_pos; /* position in the line after prompt */ } el_prompt_t; -protected void prompt_print(EditLine *, int); -protected int prompt_set(EditLine *, el_pfunc_t, int); -protected int prompt_get(EditLine *, el_pfunc_t *, int); -protected int prompt_init(EditLine *); -protected void prompt_end(EditLine *); +void prompt_print(EditLine *, int); +int prompt_set(EditLine *, el_pfunc_t, int); +int prompt_get(EditLine *, el_pfunc_t *, int); +int prompt_init(EditLine *); +void prompt_end(EditLine *); #endif /* _h_el_prompt */ diff --git a/src/libs/edit/read.c b/src/libs/edit/read.c index 98bdc5e19e..cfc5cbf897 100644 --- a/src/libs/edit/read.c +++ b/src/libs/edit/read.c @@ -59,7 +59,7 @@ private int read_getcmd(EditLine *, el_action_t *, char *); /* read_init(): * Initialize the read stuff */ -protected int +int read_init(EditLine *el) { /* builtin read_char */ @@ -72,7 +72,7 @@ read_init(EditLine *el) * Set the read char function to the one provided. * If it is set to EL_BUILTIN_GETCFN, then reset to the builtin one. */ -protected int +int el_read_setfn(EditLine *el, el_rfunc_t rc) { el->el_read.read_char = (rc == EL_BUILTIN_GETCFN) ? read_char : rc; @@ -84,7 +84,7 @@ el_read_setfn(EditLine *el, el_rfunc_t rc) * return the current read char function, or EL_BUILTIN_GETCFN * if it is the default one */ -protected el_rfunc_t +el_rfunc_t el_read_getfn(EditLine *el) { return (el->el_read.read_char == read_char) ? @@ -348,7 +348,7 @@ el_getc(EditLine *el, char *cp) return (num_read); } -protected void +void read_prepare(EditLine *el) { if (el->el_flags & HANDLE_SIGNALS) @@ -369,7 +369,7 @@ read_prepare(EditLine *el) term__flush(); } -protected void +void read_finish(EditLine *el) { if ((el->el_flags & UNBUFFERED) == 0) diff --git a/src/libs/edit/read.h b/src/libs/edit/read.h index df7dc58862..464a16137b 100644 --- a/src/libs/edit/read.h +++ b/src/libs/edit/read.h @@ -49,10 +49,10 @@ typedef struct el_read_t { el_rfunc_t read_char; /* Function to read a character */ } el_read_t; -protected int read_init(EditLine *); -protected void read_prepare(EditLine *); -protected void read_finish(EditLine *); -protected int el_read_setfn(EditLine *, el_rfunc_t); -protected el_rfunc_t el_read_getfn(EditLine *); +int read_init(EditLine *); +void read_prepare(EditLine *); +void read_finish(EditLine *); +int el_read_setfn(EditLine *, el_rfunc_t); +el_rfunc_t el_read_getfn(EditLine *); #endif /* _h_el_read */ diff --git a/src/libs/edit/refresh.c b/src/libs/edit/refresh.c index ee210e8456..579e8f21b8 100644 --- a/src/libs/edit/refresh.c +++ b/src/libs/edit/refresh.c @@ -132,7 +132,7 @@ re_addc(EditLine *el, int c) /* re_putc(): * Draw the character given */ -protected void +void re_putc(EditLine *el, int c, int shift) { @@ -180,7 +180,7 @@ re_putc(EditLine *el, int c, int shift) * virtual image. The routine to re-draw a line can be replaced * easily in hopes of a smarter one being placed there. */ -protected void +void re_refresh(EditLine *el) { int i, rhdiff; @@ -316,7 +316,7 @@ re_refresh(EditLine *el) /* re_goto_bottom(): * used to go to last used screen line */ -protected void +void re_goto_bottom(EditLine *el) { @@ -952,7 +952,7 @@ re__copy_and_pad(char *dst, const char *src, size_t width) /* re_refresh_cursor(): * Move to the new cursor position */ -protected void +void re_refresh_cursor(EditLine *el) { char *cp, c; @@ -1062,7 +1062,7 @@ re_fastputc(EditLine *el, int c) * we added just one char, handle it fast. * Assumes that screen cursor == real cursor */ -protected void +void re_fastaddc(EditLine *el) { char c; @@ -1099,7 +1099,7 @@ re_fastaddc(EditLine *el) /* re_clear_display(): * clear the screen buffers so that new new prompt starts fresh. */ -protected void +void re_clear_display(EditLine *el) { int i; @@ -1115,7 +1115,7 @@ re_clear_display(EditLine *el) /* re_clear_lines(): * Make sure all lines are *really* blank */ -protected void +void re_clear_lines(EditLine *el) { diff --git a/src/libs/edit/refresh.h b/src/libs/edit/refresh.h index 7e05878f11..01b52b4740 100644 --- a/src/libs/edit/refresh.h +++ b/src/libs/edit/refresh.h @@ -48,12 +48,12 @@ typedef struct { int r_newcv; } el_refresh_t; -protected void re_putc(EditLine *, int, int); -protected void re_clear_lines(EditLine *); -protected void re_clear_display(EditLine *); -protected void re_refresh(EditLine *); -protected void re_refresh_cursor(EditLine *); -protected void re_fastaddc(EditLine *); -protected void re_goto_bottom(EditLine *); +void re_putc(EditLine *, int, int); +void re_clear_lines(EditLine *); +void re_clear_display(EditLine *); +void re_refresh(EditLine *); +void re_refresh_cursor(EditLine *); +void re_fastaddc(EditLine *); +void re_goto_bottom(EditLine *); #endif /* _h_el_refresh */ diff --git a/src/libs/edit/search.c b/src/libs/edit/search.c index 0f31416b2c..663ad23e23 100644 --- a/src/libs/edit/search.c +++ b/src/libs/edit/search.c @@ -60,7 +60,7 @@ __FBSDID("$FreeBSD: src/lib/libedit/search.c,v 1.10 2005/08/07 20:51:52 stefanf /* search_init(): * Initialize the search stuff */ -protected int +int search_init(EditLine *el) { @@ -79,7 +79,7 @@ search_init(EditLine *el) /* search_end(): * Initialize the search stuff */ -protected void +void search_end(EditLine *el) { @@ -103,7 +103,7 @@ regerror(const char *msg) /* el_match(): * Return if string matches pattern */ -protected int +int el_match(const char *str, const char *pat) { #if defined (REGEX) @@ -148,7 +148,7 @@ el_match(const char *str, const char *pat) /* c_hmatch(): * return True if the pattern matches the prefix */ -protected int +int c_hmatch(EditLine *el, const char *str) { #ifdef SDEBUG @@ -163,7 +163,7 @@ c_hmatch(EditLine *el, const char *str) /* c_setpat(): * Set the history seatch pattern */ -protected void +void c_setpat(EditLine *el) { if (el->el_state.lastcmd != ED_SEARCH_PREV_HISTORY && @@ -194,7 +194,7 @@ c_setpat(EditLine *el) /* ce_inc_search(): * Emacs incremental search */ -protected el_action_t +el_action_t ce_inc_search(EditLine *el, int dir) { static const char STRfwd[] = {'f', 'w', 'd', '\0'}, @@ -440,7 +440,7 @@ ce_inc_search(EditLine *el, int dir) /* cv_search(): * Vi search. */ -protected el_action_t +el_action_t cv_search(EditLine *el, int dir) { char ch; @@ -514,7 +514,7 @@ cv_search(EditLine *el, int dir) /* ce_search_line(): * Look for a pattern inside a line */ -protected el_action_t +el_action_t ce_search_line(EditLine *el, int dir) { char *cp = el->el_line.cursor; @@ -556,7 +556,7 @@ ce_search_line(EditLine *el, int dir) /* cv_repeat_srch(): * Vi repeat search */ -protected el_action_t +el_action_t cv_repeat_srch(EditLine *el, int c) { @@ -582,7 +582,7 @@ cv_repeat_srch(EditLine *el, int c) /* cv_csearch(): * Vi character search */ -protected el_action_t +el_action_t cv_csearch(EditLine *el, int direction, int ch, int count, int tflag) { char *cp; diff --git a/src/libs/edit/search.h b/src/libs/edit/search.h index ea97f8ba32..22359df395 100644 --- a/src/libs/edit/search.h +++ b/src/libs/edit/search.h @@ -52,15 +52,15 @@ typedef struct el_search_t { } el_search_t; -protected int el_match(const char *, const char *); -protected int search_init(EditLine *); -protected void search_end(EditLine *); -protected int c_hmatch(EditLine *, const char *); -protected void c_setpat(EditLine *); -protected el_action_t ce_inc_search(EditLine *, int); -protected el_action_t cv_search(EditLine *, int); -protected el_action_t ce_search_line(EditLine *, int); -protected el_action_t cv_repeat_srch(EditLine *, int); -protected el_action_t cv_csearch(EditLine *, int, int, int, int); +int el_match(const char *, const char *); +int search_init(EditLine *); +void search_end(EditLine *); +int c_hmatch(EditLine *, const char *); +void c_setpat(EditLine *); +el_action_t ce_inc_search(EditLine *, int); +el_action_t cv_search(EditLine *, int); +el_action_t ce_search_line(EditLine *, int); +el_action_t cv_repeat_srch(EditLine *, int); +el_action_t cv_csearch(EditLine *, int, int, int, int); #endif /* _h_el_search */ diff --git a/src/libs/edit/sig.c b/src/libs/edit/sig.c index d3f6ed960f..07e24b4279 100644 --- a/src/libs/edit/sig.c +++ b/src/libs/edit/sig.c @@ -103,7 +103,7 @@ sig_handler(int signo) /* sig_init(): * Initialize all signal stuff */ -protected int +int sig_init(EditLine *el) { int i; @@ -132,7 +132,7 @@ sig_init(EditLine *el) /* sig_end(): * Clear all signal stuff */ -protected void +void sig_end(EditLine *el) { @@ -144,7 +144,7 @@ sig_end(EditLine *el) /* sig_set(): * set all the signal handlers */ -protected void +void sig_set(EditLine *el) { int i; @@ -170,7 +170,7 @@ sig_set(EditLine *el) /* sig_clr(): * clear all the signal handlers */ -protected void +void sig_clr(EditLine *el) { int i; diff --git a/src/libs/edit/sig.h b/src/libs/edit/sig.h index 43894ed52c..1fb2c15b9c 100644 --- a/src/libs/edit/sig.h +++ b/src/libs/edit/sig.h @@ -61,9 +61,9 @@ typedef void (*el_signalhandler_t)(int); typedef el_signalhandler_t *el_signal_t; -protected void sig_end(EditLine*); -protected int sig_init(EditLine*); -protected void sig_set(EditLine*); -protected void sig_clr(EditLine*); +void sig_end(EditLine*); +int sig_init(EditLine*); +void sig_set(EditLine*); +void sig_clr(EditLine*); #endif /* _h_el_sig */ diff --git a/src/libs/edit/term.c b/src/libs/edit/term.c index 734acd6e63..8262d8b60c 100644 --- a/src/libs/edit/term.c +++ b/src/libs/edit/term.c @@ -310,7 +310,7 @@ term_setflags(EditLine *el) /* term_init(): * Initialize the terminal stuff */ -protected int +int term_init(EditLine *el) { @@ -341,7 +341,7 @@ term_init(EditLine *el) /* term_end(): * Clean up the terminal stuff */ -protected void +void term_end(EditLine *el) { @@ -507,7 +507,7 @@ term_free_display(EditLine *el) * move to line (first line == 0) * as efficiently as possible */ -protected void +void term_move_to_line(EditLine *el, int where) { int del; @@ -563,7 +563,7 @@ term_move_to_line(EditLine *el, int where) /* term_move_to_char(): * Move to the character position specified */ -protected void +void term_move_to_char(EditLine *el, int where) { int del, i; @@ -652,7 +652,7 @@ mc_again: /* term_overwrite(): * Overstrike num characters */ -protected void +void term_overwrite(EditLine *el, const char *cp, int n) { if (n <= 0) @@ -694,7 +694,7 @@ term_overwrite(EditLine *el, const char *cp, int n) /* term_deletechars(): * Delete num characters */ -protected void +void term_deletechars(EditLine *el, int num) { if (num <= 0) @@ -736,7 +736,7 @@ term_deletechars(EditLine *el, int num) * Puts terminal in insert character mode or inserts num * characters in the line */ -protected void +void term_insertwrite(EditLine *el, char *cp, int num) { if (num <= 0) @@ -797,7 +797,7 @@ term_insertwrite(EditLine *el, char *cp, int num) /* term_clear_EOL(): * clear to end of line. There are num characters to clear */ -protected void +void term_clear_EOL(EditLine *el, int num) { int i; @@ -815,7 +815,7 @@ term_clear_EOL(EditLine *el, int num) /* term_clear_screen(): * Clear the screen */ -protected void +void term_clear_screen(EditLine *el) { /* clear the whole screen and home */ @@ -836,7 +836,7 @@ term_clear_screen(EditLine *el) /* term_beep(): * Beep the way the terminal wants us */ -protected void +void term_beep(EditLine *el) { if (GoodStr(T_bl)) @@ -851,7 +851,7 @@ term_beep(EditLine *el) /* term_clear_to_bottom(): * Clear to the bottom of the screen */ -protected void +void term_clear_to_bottom(EditLine *el) { if (GoodStr(T_cd)) @@ -861,7 +861,7 @@ term_clear_to_bottom(EditLine *el) } #endif -protected void +void term_get(EditLine *el, const char **term) { *term = el->el_term.t_name; @@ -871,7 +871,7 @@ term_get(EditLine *el, const char **term) /* term_set(): * Read in the terminal capabilities from the requested terminal */ -protected int +int term_set(EditLine *el, const char *term) { int i; @@ -960,7 +960,7 @@ term_set(EditLine *el, const char *term) * Return the new window size in lines and cols, and * true if the size was changed. */ -protected int +int term_get_size(EditLine *el, int *lins, int *cols) { @@ -996,7 +996,7 @@ term_get_size(EditLine *el, int *lins, int *cols) /* term_change_size(): * Change the size of the terminal */ -protected int +int term_change_size(EditLine *el, int lins, int cols) { /* @@ -1112,7 +1112,7 @@ term_reset_arrow(EditLine *el) /* term_set_arrow(): * Set an arrow key binding */ -protected int +int term_set_arrow(EditLine *el, const char *name, key_value_t *fun, int type) { fkey_t *arrow = el->el_term.t_fkey; @@ -1131,7 +1131,7 @@ term_set_arrow(EditLine *el, const char *name, key_value_t *fun, int type) /* term_clear_arrow(): * Clear an arrow key binding */ -protected int +int term_clear_arrow(EditLine *el, const char *name) { fkey_t *arrow = el->el_term.t_fkey; @@ -1149,7 +1149,7 @@ term_clear_arrow(EditLine *el, const char *name) /* term_print_arrow(): * Print the arrow key bindings */ -protected void +void term_print_arrow(EditLine *el, const char *name) { int i; @@ -1166,7 +1166,7 @@ term_print_arrow(EditLine *el, const char *name) /* term_bind_arrow(): * Bind the arrow keys */ -protected void +void term_bind_arrow(EditLine *el) { el_action_t *map; @@ -1223,7 +1223,7 @@ term_bind_arrow(EditLine *el) /* term__putc(): * Add a character */ -protected int +int term__putc(int c) { @@ -1234,7 +1234,7 @@ term__putc(int c) /* term__flush(): * Flush output */ -protected void +void term__flush(void) { @@ -1245,7 +1245,7 @@ term__flush(void) /* term_telltc(): * Print the current termcap characteristics */ -protected int +int /*ARGSUSED*/ term_telltc(EditLine *el, int argc __unused, const char **argv __unused) @@ -1281,7 +1281,7 @@ term_telltc(EditLine *el, int argc __unused, /* term_settc(): * Change the current terminal characteristics */ -protected int +int /*ARGSUSED*/ term_settc(EditLine *el, int argc __unused, const char **argv) @@ -1358,7 +1358,7 @@ term_settc(EditLine *el, int argc __unused, /* term_echotc(): * Print the termcap string out with variable substitution */ -protected int +int /*ARGSUSED*/ term_echotc(EditLine *el, int argc __unused, const char **argv) diff --git a/src/libs/edit/term.h b/src/libs/edit/term.h index c9fdae5a9b..47600c5cc4 100644 --- a/src/libs/edit/term.h +++ b/src/libs/edit/term.h @@ -81,29 +81,29 @@ typedef struct { #define A_K_EN 5 #define A_K_NKEYS 6 -protected void term_move_to_line(EditLine *, int); -protected void term_move_to_char(EditLine *, int); -protected void term_clear_EOL(EditLine *, int); -protected void term_overwrite(EditLine *, const char *, int); -protected void term_insertwrite(EditLine *, char *, int); -protected void term_deletechars(EditLine *, int); -protected void term_clear_screen(EditLine *); -protected void term_beep(EditLine *); -protected int term_change_size(EditLine *, int, int); -protected int term_get_size(EditLine *, int *, int *); -protected int term_init(EditLine *); -protected void term_bind_arrow(EditLine *); -protected void term_print_arrow(EditLine *, const char *); -protected int term_clear_arrow(EditLine *, const char *); -protected int term_set_arrow(EditLine *, const char *, key_value_t *, int); -protected void term_end(EditLine *); -protected void term_get(EditLine *, const char **); -protected int term_set(EditLine *, const char *); -protected int term_settc(EditLine *, int, const char **); -protected int term_telltc(EditLine *, int, const char **); -protected int term_echotc(EditLine *, int, const char **); -protected int term__putc(int); -protected void term__flush(void); +void term_move_to_line(EditLine *, int); +void term_move_to_char(EditLine *, int); +void term_clear_EOL(EditLine *, int); +void term_overwrite(EditLine *, const char *, int); +void term_insertwrite(EditLine *, char *, int); +void term_deletechars(EditLine *, int); +void term_clear_screen(EditLine *); +void term_beep(EditLine *); +int term_change_size(EditLine *, int, int); +int term_get_size(EditLine *, int *, int *); +int term_init(EditLine *); +void term_bind_arrow(EditLine *); +void term_print_arrow(EditLine *, const char *); +int term_clear_arrow(EditLine *, const char *); +int term_set_arrow(EditLine *, const char *, key_value_t *, int); +void term_end(EditLine *); +void term_get(EditLine *, const char **); +int term_set(EditLine *, const char *); +int term_settc(EditLine *, int, const char **); +int term_telltc(EditLine *, int, const char **); +int term_echotc(EditLine *, int, const char **); +int term__putc(int); +void term__flush(void); /* * Easy access macros diff --git a/src/libs/edit/tty.c b/src/libs/edit/tty.c index 91fa00b2be..ff6eb7b703 100644 --- a/src/libs/edit/tty.c +++ b/src/libs/edit/tty.c @@ -522,7 +522,7 @@ tty_setup(EditLine *el) return (0); } -protected int +int tty_init(EditLine *el) { @@ -537,7 +537,7 @@ tty_init(EditLine *el) /* tty_end(): * Restore the tty to its original settings */ -protected void +void /*ARGSUSED*/ tty_end(EditLine *el __unused) { @@ -834,7 +834,7 @@ tty__setchar(struct termios *td, unsigned char *s) /* tty_bind_char(): * Rebind the editline functions */ -protected void +void tty_bind_char(EditLine *el, int force) { @@ -880,7 +880,7 @@ tty_bind_char(EditLine *el, int force) /* tty_rawmode(): * Set terminal into 1 character at a time mode. */ -protected int +int tty_rawmode(EditLine *el) { @@ -1008,7 +1008,7 @@ tty_rawmode(EditLine *el) /* tty_cookedmode(): * Set the tty back to normal mode */ -protected int +int tty_cookedmode(EditLine *el) { /* set tty in normal setup */ @@ -1034,7 +1034,7 @@ tty_cookedmode(EditLine *el) /* tty_quotemode(): * Turn on quote mode */ -protected int +int tty_quotemode(EditLine *el) { if (el->el_tty.t_mode == QU_IO) @@ -1069,7 +1069,7 @@ tty_quotemode(EditLine *el) /* tty_noquotemode(): * Turn off quote mode */ -protected int +int tty_noquotemode(EditLine *el) { @@ -1090,7 +1090,7 @@ tty_noquotemode(EditLine *el) /* tty_stty(): * Stty builtin */ -protected int +int /*ARGSUSED*/ tty_stty(EditLine *el, int argc __unused, const char **argv) { diff --git a/src/libs/edit/tty.h b/src/libs/edit/tty.h index 1f39ba43e8..f745281cae 100644 --- a/src/libs/edit/tty.h +++ b/src/libs/edit/tty.h @@ -456,14 +456,14 @@ typedef struct { typedef unsigned char ttychar_t[NN_IO][C_NCC]; -protected int tty_init(EditLine *); -protected void tty_end(EditLine *); -protected int tty_stty(EditLine *, int, const char **); -protected int tty_rawmode(EditLine *); -protected int tty_cookedmode(EditLine *); -protected int tty_quotemode(EditLine *); -protected int tty_noquotemode(EditLine *); -protected void tty_bind_char(EditLine *, int); +int tty_init(EditLine *); +void tty_end(EditLine *); +int tty_stty(EditLine *, int, const char **); +int tty_rawmode(EditLine *); +int tty_cookedmode(EditLine *); +int tty_quotemode(EditLine *); +int tty_noquotemode(EditLine *); +void tty_bind_char(EditLine *, int); typedef struct { ttyperm_t t_t; diff --git a/src/libs/edit/vi.c b/src/libs/edit/vi.c index 61f87178ef..70d4bc250d 100644 --- a/src/libs/edit/vi.c +++ b/src/libs/edit/vi.c @@ -113,7 +113,7 @@ cv_paste(EditLine *el, int c) * Vi paste previous deletion to the right of the cursor * [p] */ -protected el_action_t +el_action_t /*ARGSUSED*/ vi_paste_next(EditLine *el, int c __unused) { @@ -126,7 +126,7 @@ vi_paste_next(EditLine *el, int c __unused) * Vi paste previous deletion to the left of the cursor * [P] */ -protected el_action_t +el_action_t /*ARGSUSED*/ vi_paste_prev(EditLine *el, int c __unused) { @@ -139,7 +139,7 @@ vi_paste_prev(EditLine *el, int c __unused) * Vi move to the previous space delimited word * [B] */ -protected el_action_t +el_action_t /*ARGSUSED*/ vi_prev_big_word(EditLine *el, int c) { @@ -164,7 +164,7 @@ vi_prev_big_word(EditLine *el, int c) * Vi move to the previous word * [b] */ -protected el_action_t +el_action_t /*ARGSUSED*/ vi_prev_word(EditLine *el, int c __unused) { @@ -189,7 +189,7 @@ vi_prev_word(EditLine *el, int c __unused) * Vi move to the next space delimited word * [W] */ -protected el_action_t +el_action_t /*ARGSUSED*/ vi_next_big_word(EditLine *el, int c) { @@ -213,7 +213,7 @@ vi_next_big_word(EditLine *el, int c) * Vi move to the next word * [w] */ -protected el_action_t +el_action_t /*ARGSUSED*/ vi_next_word(EditLine *el, int c __unused) { @@ -237,7 +237,7 @@ vi_next_word(EditLine *el, int c __unused) * Vi change case of character under the cursor and advance one character * [~] */ -protected el_action_t +el_action_t vi_change_case(EditLine *el, int c) { int i; @@ -268,7 +268,7 @@ vi_change_case(EditLine *el, int c) * Vi change prefix command * [c] */ -protected el_action_t +el_action_t /*ARGSUSED*/ vi_change_meta(EditLine *el, int c __unused) { @@ -285,7 +285,7 @@ vi_change_meta(EditLine *el, int c __unused) * Vi enter insert mode at the beginning of line * [I] */ -protected el_action_t +el_action_t /*ARGSUSED*/ vi_insert_at_bol(EditLine *el, int c __unused) { @@ -301,7 +301,7 @@ vi_insert_at_bol(EditLine *el, int c __unused) * Vi replace character under the cursor with the next character typed * [r] */ -protected el_action_t +el_action_t /*ARGSUSED*/ vi_replace_char(EditLine *el, int c __unused) { @@ -320,7 +320,7 @@ vi_replace_char(EditLine *el, int c __unused) * Vi enter replace mode * [R] */ -protected el_action_t +el_action_t /*ARGSUSED*/ vi_replace_mode(EditLine *el, int c __unused) { @@ -336,7 +336,7 @@ vi_replace_mode(EditLine *el, int c __unused) * Vi replace character under the cursor and enter insert mode * [s] */ -protected el_action_t +el_action_t /*ARGSUSED*/ vi_substitute_char(EditLine *el, int c __unused) { @@ -351,7 +351,7 @@ vi_substitute_char(EditLine *el, int c __unused) * Vi substitute entire line * [S] */ -protected el_action_t +el_action_t /*ARGSUSED*/ vi_substitute_line(EditLine *el, int c __unused) { @@ -369,7 +369,7 @@ vi_substitute_line(EditLine *el, int c __unused) * Vi change to end of line * [C] */ -protected el_action_t +el_action_t /*ARGSUSED*/ vi_change_to_eol(EditLine *el, int c __unused) { @@ -387,7 +387,7 @@ vi_change_to_eol(EditLine *el, int c __unused) * Vi enter insert mode * [i] */ -protected el_action_t +el_action_t /*ARGSUSED*/ vi_insert(EditLine *el, int c __unused) { @@ -402,7 +402,7 @@ vi_insert(EditLine *el, int c __unused) * Vi enter insert mode after the cursor * [a] */ -protected el_action_t +el_action_t /*ARGSUSED*/ vi_add(EditLine *el, int c __unused) { @@ -427,7 +427,7 @@ vi_add(EditLine *el, int c __unused) * Vi enter insert mode at end of line * [A] */ -protected el_action_t +el_action_t /*ARGSUSED*/ vi_add_at_eol(EditLine *el, int c __unused) { @@ -443,7 +443,7 @@ vi_add_at_eol(EditLine *el, int c __unused) * Vi delete prefix command * [d] */ -protected el_action_t +el_action_t /*ARGSUSED*/ vi_delete_meta(EditLine *el, int c __unused) { @@ -456,7 +456,7 @@ vi_delete_meta(EditLine *el, int c __unused) * Vi move to the end of the current space delimited word * [E] */ -protected el_action_t +el_action_t /*ARGSUSED*/ vi_end_big_word(EditLine *el, int c) { @@ -480,7 +480,7 @@ vi_end_big_word(EditLine *el, int c) * Vi move to the end of the current word * [e] */ -protected el_action_t +el_action_t /*ARGSUSED*/ vi_end_word(EditLine *el, int c __unused) { @@ -504,7 +504,7 @@ vi_end_word(EditLine *el, int c __unused) * Vi undo last change * [u] */ -protected el_action_t +el_action_t /*ARGSUSED*/ vi_undo(EditLine *el, int c __unused) { @@ -530,7 +530,7 @@ vi_undo(EditLine *el, int c __unused) * Vi enter command mode (use alternative key bindings) * [] */ -protected el_action_t +el_action_t /*ARGSUSED*/ vi_command_mode(EditLine *el, int c __unused) { @@ -555,7 +555,7 @@ vi_command_mode(EditLine *el, int c __unused) * Vi move to the beginning of line * [0] */ -protected el_action_t +el_action_t vi_zero(EditLine *el, int c) { @@ -575,7 +575,7 @@ vi_zero(EditLine *el, int c) * Vi move to previous character (backspace) * [^H] in insert mode only */ -protected el_action_t +el_action_t /*ARGSUSED*/ vi_delete_prev_char(EditLine *el, int c __unused) { @@ -593,7 +593,7 @@ vi_delete_prev_char(EditLine *el, int c __unused) * Vi list choices for completion or indicate end of file if empty line * [^D] */ -protected el_action_t +el_action_t /*ARGSUSED*/ vi_list_or_eof(EditLine *el, int c __unused) { @@ -631,7 +631,7 @@ vi_list_or_eof(EditLine *el, int c __unused) * Vi cut from beginning of line to cursor * [^U] */ -protected el_action_t +el_action_t /*ARGSUSED*/ vi_kill_line_prev(EditLine *el, int c __unused) { @@ -652,7 +652,7 @@ vi_kill_line_prev(EditLine *el, int c __unused) * Vi search history previous * [?] */ -protected el_action_t +el_action_t /*ARGSUSED*/ vi_search_prev(EditLine *el, int c __unused) { @@ -665,7 +665,7 @@ vi_search_prev(EditLine *el, int c __unused) * Vi search history next * [/] */ -protected el_action_t +el_action_t /*ARGSUSED*/ vi_search_next(EditLine *el, int c __unused) { @@ -678,7 +678,7 @@ vi_search_next(EditLine *el, int c __unused) * Vi repeat current search in the same search direction * [n] */ -protected el_action_t +el_action_t /*ARGSUSED*/ vi_repeat_search_next(EditLine *el, int c __unused) { @@ -695,7 +695,7 @@ vi_repeat_search_next(EditLine *el, int c __unused) * [N] */ /*ARGSUSED*/ -protected el_action_t +el_action_t vi_repeat_search_prev(EditLine *el, int c __unused) { @@ -712,7 +712,7 @@ vi_repeat_search_prev(EditLine *el, int c __unused) * Vi move to the character specified next * [f] */ -protected el_action_t +el_action_t /*ARGSUSED*/ vi_next_char(EditLine *el, int c __unused) { @@ -724,7 +724,7 @@ vi_next_char(EditLine *el, int c __unused) * Vi move to the character specified previous * [F] */ -protected el_action_t +el_action_t /*ARGSUSED*/ vi_prev_char(EditLine *el, int c __unused) { @@ -736,7 +736,7 @@ vi_prev_char(EditLine *el, int c __unused) * Vi move up to the character specified next * [t] */ -protected el_action_t +el_action_t /*ARGSUSED*/ vi_to_next_char(EditLine *el, int c __unused) { @@ -748,7 +748,7 @@ vi_to_next_char(EditLine *el, int c __unused) * Vi move up to the character specified previous * [T] */ -protected el_action_t +el_action_t /*ARGSUSED*/ vi_to_prev_char(EditLine *el, int c __unused) { @@ -760,7 +760,7 @@ vi_to_prev_char(EditLine *el, int c __unused) * Vi repeat current character search in the same search direction * [;] */ -protected el_action_t +el_action_t /*ARGSUSED*/ vi_repeat_next_char(EditLine *el, int c __unused) { @@ -774,7 +774,7 @@ vi_repeat_next_char(EditLine *el, int c __unused) * Vi repeat current character search in the opposite search direction * [,] */ -protected el_action_t +el_action_t /*ARGSUSED*/ vi_repeat_prev_char(EditLine *el, int c __unused) { @@ -792,7 +792,7 @@ vi_repeat_prev_char(EditLine *el, int c __unused) * Vi go to matching () {} or [] * [%] */ -protected el_action_t +el_action_t /*ARGSUSED*/ vi_match(EditLine *el, int c) { @@ -839,7 +839,7 @@ vi_match(EditLine *el, int c) * Vi undo all changes to line * [U] */ -protected el_action_t +el_action_t /*ARGSUSED*/ vi_undo_line(EditLine *el, int c) { @@ -853,7 +853,7 @@ vi_undo_line(EditLine *el, int c) * [|] * NB netbsd vi goes to screen column 'n', posix says nth character */ -protected el_action_t +el_action_t /*ARGSUSED*/ vi_to_column(EditLine *el, int c) { @@ -867,7 +867,7 @@ vi_to_column(EditLine *el, int c) * Vi yank to end of line * [Y] */ -protected el_action_t +el_action_t /*ARGSUSED*/ vi_yank_end(EditLine *el, int c) { @@ -881,7 +881,7 @@ vi_yank_end(EditLine *el, int c) * Vi yank * [y] */ -protected el_action_t +el_action_t /*ARGSUSED*/ vi_yank(EditLine *el, int c) { @@ -893,7 +893,7 @@ vi_yank(EditLine *el, int c) * Vi comment out current command * [#] */ -protected el_action_t +el_action_t /*ARGSUSED*/ vi_comment_out(EditLine *el, int c) { @@ -911,7 +911,7 @@ vi_comment_out(EditLine *el, int c) * NB: posix implies that we should enter insert mode, however * this is against historical precedent... */ -protected el_action_t +el_action_t /*ARGSUSED*/ vi_alias(EditLine *el, int c) { @@ -943,7 +943,7 @@ vi_alias(EditLine *el, int c) * Vi go to specified history file line. * [G] */ -protected el_action_t +el_action_t /*ARGSUSED*/ vi_to_history_line(EditLine *el, int c) { @@ -988,7 +988,7 @@ vi_to_history_line(EditLine *el, int c) * Vi edit history line with vi * [v] */ -protected el_action_t +el_action_t /*ARGSUSED*/ vi_histedit(EditLine *el, int c) { @@ -1044,7 +1044,7 @@ vi_histedit(EditLine *el, int c) * Who knows where this one came from! * '_' in vi means 'entire current line', so 'cc' is a synonym for 'c_' */ -protected el_action_t +el_action_t /*ARGSUSED*/ vi_history_word(EditLine *el, int c) { @@ -1093,7 +1093,7 @@ vi_history_word(EditLine *el, int c) * Vi redo last non-motion command * [.] */ -protected el_action_t +el_action_t /*ARGSUSED*/ vi_redo(EditLine *el, int c) { diff --git a/src/libs/edit/vi.h b/src/libs/edit/vi.h index fec33b44c2..cb5df6ef9f 100644 --- a/src/libs/edit/vi.h +++ b/src/libs/edit/vi.h @@ -1,51 +1,51 @@ /* Automatically generated file, do not edit */ #ifndef _h_vi_c #define _h_vi_c -protected el_action_t vi_paste_next (EditLine *, int); -protected el_action_t vi_paste_prev (EditLine *, int); -protected el_action_t vi_prev_big_word (EditLine *, int); -protected el_action_t vi_prev_word (EditLine *, int); -protected el_action_t vi_next_big_word (EditLine *, int); -protected el_action_t vi_next_word (EditLine *, int); -protected el_action_t vi_change_case (EditLine *, int); -protected el_action_t vi_change_meta (EditLine *, int); -protected el_action_t vi_insert_at_bol (EditLine *, int); -protected el_action_t vi_replace_char (EditLine *, int); -protected el_action_t vi_replace_mode (EditLine *, int); -protected el_action_t vi_substitute_char (EditLine *, int); -protected el_action_t vi_substitute_line (EditLine *, int); -protected el_action_t vi_change_to_eol (EditLine *, int); -protected el_action_t vi_insert (EditLine *, int); -protected el_action_t vi_add (EditLine *, int); -protected el_action_t vi_add_at_eol (EditLine *, int); -protected el_action_t vi_delete_meta (EditLine *, int); -protected el_action_t vi_end_big_word (EditLine *, int); -protected el_action_t vi_end_word (EditLine *, int); -protected el_action_t vi_undo (EditLine *, int); -protected el_action_t vi_command_mode (EditLine *, int); -protected el_action_t vi_zero (EditLine *, int); -protected el_action_t vi_delete_prev_char (EditLine *, int); -protected el_action_t vi_list_or_eof (EditLine *, int); -protected el_action_t vi_kill_line_prev (EditLine *, int); -protected el_action_t vi_search_prev (EditLine *, int); -protected el_action_t vi_search_next (EditLine *, int); -protected el_action_t vi_repeat_search_next (EditLine *, int); -protected el_action_t vi_repeat_search_prev (EditLine *, int); -protected el_action_t vi_next_char (EditLine *, int); -protected el_action_t vi_prev_char (EditLine *, int); -protected el_action_t vi_to_next_char (EditLine *, int); -protected el_action_t vi_to_prev_char (EditLine *, int); -protected el_action_t vi_repeat_next_char (EditLine *, int); -protected el_action_t vi_repeat_prev_char (EditLine *, int); -protected el_action_t vi_match (EditLine *, int); -protected el_action_t vi_undo_line (EditLine *, int); -protected el_action_t vi_to_column (EditLine *, int); -protected el_action_t vi_yank_end (EditLine *, int); -protected el_action_t vi_yank (EditLine *, int); -protected el_action_t vi_comment_out (EditLine *, int); -protected el_action_t vi_alias (EditLine *, int); -protected el_action_t vi_to_history_line (EditLine *, int); -protected el_action_t vi_histedit (EditLine *, int); -protected el_action_t vi_history_word (EditLine *, int); -protected el_action_t vi_redo (EditLine *, int); +el_action_t vi_paste_next (EditLine *, int); +el_action_t vi_paste_prev (EditLine *, int); +el_action_t vi_prev_big_word (EditLine *, int); +el_action_t vi_prev_word (EditLine *, int); +el_action_t vi_next_big_word (EditLine *, int); +el_action_t vi_next_word (EditLine *, int); +el_action_t vi_change_case (EditLine *, int); +el_action_t vi_change_meta (EditLine *, int); +el_action_t vi_insert_at_bol (EditLine *, int); +el_action_t vi_replace_char (EditLine *, int); +el_action_t vi_replace_mode (EditLine *, int); +el_action_t vi_substitute_char (EditLine *, int); +el_action_t vi_substitute_line (EditLine *, int); +el_action_t vi_change_to_eol (EditLine *, int); +el_action_t vi_insert (EditLine *, int); +el_action_t vi_add (EditLine *, int); +el_action_t vi_add_at_eol (EditLine *, int); +el_action_t vi_delete_meta (EditLine *, int); +el_action_t vi_end_big_word (EditLine *, int); +el_action_t vi_end_word (EditLine *, int); +el_action_t vi_undo (EditLine *, int); +el_action_t vi_command_mode (EditLine *, int); +el_action_t vi_zero (EditLine *, int); +el_action_t vi_delete_prev_char (EditLine *, int); +el_action_t vi_list_or_eof (EditLine *, int); +el_action_t vi_kill_line_prev (EditLine *, int); +el_action_t vi_search_prev (EditLine *, int); +el_action_t vi_search_next (EditLine *, int); +el_action_t vi_repeat_search_next (EditLine *, int); +el_action_t vi_repeat_search_prev (EditLine *, int); +el_action_t vi_next_char (EditLine *, int); +el_action_t vi_prev_char (EditLine *, int); +el_action_t vi_to_next_char (EditLine *, int); +el_action_t vi_to_prev_char (EditLine *, int); +el_action_t vi_repeat_next_char (EditLine *, int); +el_action_t vi_repeat_prev_char (EditLine *, int); +el_action_t vi_match (EditLine *, int); +el_action_t vi_undo_line (EditLine *, int); +el_action_t vi_to_column (EditLine *, int); +el_action_t vi_yank_end (EditLine *, int); +el_action_t vi_yank (EditLine *, int); +el_action_t vi_comment_out (EditLine *, int); +el_action_t vi_alias (EditLine *, int); +el_action_t vi_to_history_line (EditLine *, int); +el_action_t vi_histedit (EditLine *, int); +el_action_t vi_history_word (EditLine *, int); +el_action_t vi_redo (EditLine *, int); #endif /* _h_vi_c */ From 735ef328dbe55987d504511add0b68faf7e7f57d Mon Sep 17 00:00:00 2001 From: Oliver Tappe Date: Sat, 3 Nov 2012 21:26:33 +0100 Subject: [PATCH 14/36] add test for strptime() to locale_test --- .../system/libroot/posix/locale_test.cpp | 136 +++++++++++++++++- 1 file changed, 133 insertions(+), 3 deletions(-) diff --git a/src/tests/system/libroot/posix/locale_test.cpp b/src/tests/system/libroot/posix/locale_test.cpp index 5a5053725a..9c5dd36e12 100644 --- a/src/tests/system/libroot/posix/locale_test.cpp +++ b/src/tests/system/libroot/posix/locale_test.cpp @@ -534,12 +534,12 @@ test_strftime(const char* locale, const strftime_data data[]) setlocale(LC_TIME, locale); printf("strftime for '%s'\n", locale); - time_t nowSecs = 1279391169; // pure magic - tm* now = localtime(&nowSecs); + time_t testTimeInSecs = 1279391169; // Sat Jul 17 18:26:09 2010 UTC + tm* testTime = localtime(&testTimeInSecs); int problemCount = 0; for(int i = 0; data[i].format != NULL; ++i) { char buf[100]; - strftime(buf, 100, data[i].format, now); + strftime(buf, 100, data[i].format, testTime); if (strcmp(buf, data[i].result) != 0) { printf("\tPROBLEM: strftime(\"%s\") = \"%s\" (expected \"%s\")\n", data[i].format, buf, data[i].result); @@ -644,6 +644,135 @@ test_strftime() } +// #pragma mark - strftime ----------------------------------------------------- + + +struct strptime_data { + const char* format; + const char* dateString; +}; + + +void +test_strptime(const char* locale, const strptime_data data[]) +{ + setlocale(LC_TIME, locale); + printf("strptime for '%s'\n", locale); + + time_t expectedTimeInSecs = 1279391169; // Sat Jul 17 18:26:09 2010 UTC + int problemCount = 0; + for(int i = 0; data[i].format != NULL; ++i) { + struct tm resultTime; + if (strptime(data[i].dateString, data[i].format, &resultTime) == NULL) { + printf("\tPROBLEM: strptime(\"%s\", \"%s\") failed\n", + data[i].dateString, data[i].format); + problemCount++; + } else { + time_t resultTimeInSecs = mktime(&resultTime); + if (resultTimeInSecs != expectedTimeInSecs) { + printf("\tPROBLEM: strptime(\"%s\", \"%s\") = \"%d\" (expected \"%d\")\n", + data[i].dateString, data[i].format, resultTimeInSecs, expectedTimeInSecs); + problemCount++; + } + } + } + if (problemCount) + printf("\t%d problem(s) found!\n", problemCount); + else + printf("\tall fine\n"); +} + + +void +test_strptime() +{ + setenv("TZ", "GMT", 1); + + const strptime_data strptime_posix[] = { + { "%c", "Sat Jul 17 18:26:09 2010" }, + { "%x", "07/17/10" }, + { "%X", "18:26:09" }, + { "%a", "Sat" }, + { "%A", "Saturday" }, + { "%b", "Jul" }, + { "%B", "July" }, + { NULL, NULL } + }; + test_strptime("POSIX", strptime_posix); + + const strptime_data strptime_de[] = { + { "%c", "Samstag, 17. Juli 2010 18:26:09 GMT" }, + { "%x", "17.07.2010" }, + { "%X", "18:26:09" }, + { "%a", "Sa." }, + { "%A", "Samstag" }, + { "%b", "Jul" }, + { "%B", "Juli" }, + { NULL, NULL } + }; + test_strptime("de_DE.UTF-8", strptime_de); + + const strptime_data strptime_hr[] = { + { "%c", "subota, 17. srpnja 2010. 18:26:09 GMT" }, + { "%x", "17. 07. 2010." }, + { "%X", "18:26:09" }, + { "%a", "sub" }, + { "%A", "subota" }, + { "%b", "srp" }, + { "%B", "srpnja" }, + { NULL, NULL } + }; + test_strptime("hr_HR.ISO8859-2", strptime_hr); + + const strptime_data strptime_gu[] = { + { "%c", "શનિવાર, 17 જુલાઈ, 2010 06:26:09 PM GMT" }, + { "%x", "17 જુલાઈ, 2010" }, + { "%X", "06:26:09 PM" }, + { "%a", "શનિ" }, + { "%A", "શનિવાર" }, + { "%b", "જુલાઈ" }, + { "%B", "જુલાઈ" }, + { NULL, NULL } + }; + test_strptime("gu_IN", strptime_gu); + + const strptime_data strptime_it[] = { + { "%c", "sabato 17 luglio 2010 18:26:09 GMT" }, + { "%x", "17/lug/2010" }, + { "%X", "18:26:09" }, + { "%a", "sab" }, + { "%A", "sabato" }, + { "%b", "lug" }, + { "%B", "luglio" }, + { NULL, NULL } + }; + test_strptime("it_IT", strptime_it); + + const strptime_data strptime_nl[] = { + { "%c", "zaterdag 17 juli 2010 18:26:09 GMT" }, + { "%x", "17 jul. 2010" }, + { "%X", "18:26:09" }, + { "%a", "za" }, + { "%A", "zaterdag" }, + { "%b", "jul." }, + { "%B", "juli" }, + { NULL, NULL } + }; + test_strptime("nl_NL", strptime_nl); + + const strptime_data strptime_nb[] = { + { "%c", "kl. 18:26:09 GMT lørdag 17. juli 2010" }, + { "%x", "17. juli 2010" }, + { "%X", "18:26:09" }, + { "%a", "lør." }, + { "%A", "lørdag" }, + { "%b", "juli" }, + { "%B", "juli" }, + { NULL, NULL } + }; + test_strptime("nb_NO", strptime_nb); +} + // #pragma mark - ctype -------------------------------------------------------- @@ -2087,6 +2216,7 @@ main(void) test_setlocale(); test_localeconv(); test_strftime(); + test_strptime(); test_ctype(); test_wctype(); test_wctrans(); From 410d1973c1bd568785c97b437a3857b122054fd7 Mon Sep 17 00:00:00 2001 From: Oliver Tappe Date: Sat, 3 Nov 2012 23:19:50 +0100 Subject: [PATCH 15/36] Adjust modifier for fast scrolling to match other OSes. * instead of any of (OPTION, COMMAND, CONTROL), use SHIFT to trigger accelerated scrolling via the mouse wheel --- src/kits/interface/View.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/kits/interface/View.cpp b/src/kits/interface/View.cpp index efbe9549a6..47eb59fc73 100644 --- a/src/kits/interface/View.cpp +++ b/src/kits/interface/View.cpp @@ -5711,11 +5711,11 @@ BView::ScrollWithMouseWheelDelta(BScrollBar* scrollBar, float delta) float smallStep, largeStep; scrollBar->GetSteps(&smallStep, &largeStep); - // pressing the option/command/control key scrolls faster - if (modifiers() - & (B_OPTION_KEY | B_COMMAND_KEY | B_CONTROL_KEY)) { + // pressing the shift key scrolls faster (following the pseudo-standard set + // by other desktop environments). + if ((modifiers() & B_SHIFT_KEY) != 0) delta *= largeStep; - } else + else delta *= smallStep * 3; scrollBar->SetValue(scrollBar->Value() + delta); From 21f50d63e6440f58af865849174a4639e6c6f0b6 Mon Sep 17 00:00:00 2001 From: Oliver Tappe Date: Sat, 3 Nov 2012 23:33:49 +0100 Subject: [PATCH 16/36] Use SHIFT to accelerate scrolling via the bar arrows. --- src/kits/interface/ScrollBar.cpp | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/kits/interface/ScrollBar.cpp b/src/kits/interface/ScrollBar.cpp index 540d8405c4..c12c5ab5b2 100644 --- a/src/kits/interface/ScrollBar.cpp +++ b/src/kits/interface/ScrollBar.cpp @@ -701,19 +701,24 @@ BScrollBar::MouseDown(BPoint where) // hit test for arrows or empty area float scrollValue = 0.0; + + // pressing the shift key scrolls faster + float buttonStepSize + = (modifiers() & B_SHIFT_KEY) != 0 ? fLargeStep : fSmallStep; + fPrivateData->fButtonDown = _ButtonFor(where); switch (fPrivateData->fButtonDown) { case ARROW1: - scrollValue = -fSmallStep; + scrollValue = -buttonStepSize; break; case ARROW2: - scrollValue = fSmallStep; + scrollValue = buttonStepSize; break; case ARROW3: - scrollValue = -fSmallStep; + scrollValue = -buttonStepSize; break; case ARROW4: - scrollValue = fSmallStep; + scrollValue = buttonStepSize; break; case NOARROW: // we hit the empty area, figure out which side of the thumb From 0619f34b525cc9dae8febf61cdc30a371496116b Mon Sep 17 00:00:00 2001 From: Oliver Tappe Date: Sun, 4 Nov 2012 17:33:42 +0100 Subject: [PATCH 17/36] Add BWindow::HasShortcut() --- headers/os/interface/Window.h | 1 + src/kits/interface/Window.cpp | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/headers/os/interface/Window.h b/headers/os/interface/Window.h index f1c406f07d..59f6c5e560 100644 --- a/headers/os/interface/Window.h +++ b/headers/os/interface/Window.h @@ -132,6 +132,7 @@ public: BMessage* message); void AddShortcut(uint32 key, uint32 modifiers, BMessage* message, BHandler* target); + bool HasShortcut(uint32 key, uint32 modifiers); void RemoveShortcut(uint32 key, uint32 modifiers); void SetDefaultButton(BButton* button); diff --git a/src/kits/interface/Window.cpp b/src/kits/interface/Window.cpp index 64ee73a113..276d672127 100644 --- a/src/kits/interface/Window.cpp +++ b/src/kits/interface/Window.cpp @@ -1859,6 +1859,13 @@ BWindow::AddShortcut(uint32 key, uint32 modifiers, BMessage* message, } +bool +BWindow::HasShortcut(uint32 key, uint32 modifiers) +{ + return _FindShortcut(key, modifiers) != NULL; +} + + void BWindow::RemoveShortcut(uint32 key, uint32 modifiers) { From 402c3b2c0980aab7b94a4f9fb2ceec530c110456 Mon Sep 17 00:00:00 2001 From: Oliver Tappe Date: Sun, 4 Nov 2012 17:34:26 +0100 Subject: [PATCH 18/36] BTextView uses cmd instead of ctrl for navigation * Adjust BTextView to use B_COMMAND_KEY instead of B_CONTROL_KEY for wordwise navigation and jumping to the top and bottom. This requires a shortcut, which is only installed if there is none already (for the groups B_LEFT_ARROW/B_RIGHT_ARROW and B_HOME/B_END). As a result, wordwise navigation no longer works in Mail, for instance. --- headers/os/interface/TextView.h | 10 +++-- src/kits/interface/TextView.cpp | 71 +++++++++++++++++++++++++++++---- 2 files changed, 70 insertions(+), 11 deletions(-) diff --git a/headers/os/interface/TextView.h b/headers/os/interface/TextView.h index 4d3e958f04..81517e43cd 100644 --- a/headers/os/interface/TextView.h +++ b/headers/os/interface/TextView.h @@ -294,9 +294,11 @@ private: void _ResetTextRect(); void _HandleBackspace(); - void _HandleArrowKey(uint32 inArrowKey); + void _HandleArrowKey(uint32 inArrowKey, + bool commandKeyDown = false); void _HandleDelete(); - void _HandlePageKey(uint32 inPageKey); + void _HandlePageKey(uint32 inPageKey, + bool commandKeyDown = false); void _HandleAlphaKey(const char* bytes, int32 numBytes); @@ -451,8 +453,10 @@ private: float fMinTextRectWidth; LayoutData* fLayoutData; int32 fLastClickOffset; + bool fInstalledNavigateWordwiseShortcuts; + bool fInstalledNavigateToTopOrBottomShortcuts; - uint32 _reserved[7]; + uint32 _reserved[6]; }; #endif // _TEXTVIEW_H diff --git a/src/kits/interface/TextView.cpp b/src/kits/interface/TextView.cpp index f93582850f..7caca729d3 100644 --- a/src/kits/interface/TextView.cpp +++ b/src/kits/interface/TextView.cpp @@ -194,6 +194,14 @@ static const float kHorizontalScrollBarStep = 10.0; static const float kVerticalScrollBarStep = 12.0; +enum { + NAVIGATE_TO_PREVIOUS_WORD = '_NVP', + NAVIGATE_TO_NEXT_WORD = '_NVN', + NAVIGATE_TO_TOP = '_NVT', + NAVIGATE_TO_BOTTOM = '_NVB', +}; + + static property_info sPropertyList[] = { { "selection", @@ -1032,6 +1040,20 @@ BTextView::MessageReceived(BMessage *message) _TrackDrag(fWhere); break; + case NAVIGATE_TO_PREVIOUS_WORD: + _HandleArrowKey(B_LEFT_ARROW, true); + break; + case NAVIGATE_TO_NEXT_WORD: + _HandleArrowKey(B_RIGHT_ARROW, true); + break; + + case NAVIGATE_TO_TOP: + _HandlePageKey(B_HOME, true); + break; + case NAVIGATE_TO_BOTTOM: + _HandlePageKey(B_END, true); + break; + default: BView::MessageReceived(message); break; @@ -3216,6 +3238,9 @@ BTextView::_InitObject(BRect textRect, const BFont *initialFont, fLines = new LineBuffer; fStyles = new StyleBuffer(&font, initialColor); + fInstalledNavigateWordwiseShortcuts = false; + fInstalledNavigateToTopOrBottomShortcuts = false; + // We put these here instead of in the constructor initializer list // to have less code duplication, and a single place where to do changes // if needed. @@ -3298,7 +3323,7 @@ BTextView::_HandleBackspace() \param inArrowKey The code for the pressed key. */ void -BTextView::_HandleArrowKey(uint32 inArrowKey) +BTextView::_HandleArrowKey(uint32 inArrowKey, bool commandKeyDown) { // return if there's nowhere to go if (fText->Length() == 0) @@ -3313,7 +3338,6 @@ BTextView::_HandleArrowKey(uint32 inArrowKey) message->FindInt32("modifiers", &modifiers); bool shiftDown = modifiers & B_SHIFT_KEY; - bool ctrlDown = modifiers & B_CONTROL_KEY; int32 lastClickOffset = fCaretOffset; switch (inArrowKey) { @@ -3324,7 +3348,7 @@ BTextView::_HandleArrowKey(uint32 inArrowKey) fCaretOffset = fSelStart; else { fCaretOffset - = ctrlDown + = commandKeyDown ? _PreviousWordStart(fCaretOffset - 1) : _PreviousInitialByte(fCaretOffset); if (shiftDown && fCaretOffset != lastClickOffset) { @@ -3350,7 +3374,7 @@ BTextView::_HandleArrowKey(uint32 inArrowKey) fCaretOffset = fSelEnd; else { fCaretOffset - = ctrlDown + = commandKeyDown ? _NextWordEnd(fCaretOffset) : _NextInitialByte(fCaretOffset); if (shiftDown && fCaretOffset != lastClickOffset) { @@ -3475,7 +3499,7 @@ BTextView::_HandleDelete() \param inPageKey The page key which has been pressed. */ void -BTextView::_HandlePageKey(uint32 inPageKey) +BTextView::_HandlePageKey(uint32 inPageKey, bool commandKeyDown) { int32 mods = 0; BMessage *currentMessage = Window()->CurrentMessage(); @@ -3483,7 +3507,6 @@ BTextView::_HandlePageKey(uint32 inPageKey) currentMessage->FindInt32("modifiers", &mods); bool shiftDown = mods & B_SHIFT_KEY; - bool ctrlDown = mods & B_CONTROL_KEY; STELine* line = NULL; int32 selStart = fSelStart; int32 selEnd = fSelEnd; @@ -3496,7 +3519,7 @@ BTextView::_HandlePageKey(uint32 inPageKey) break; } - if (ctrlDown) { + if (commandKeyDown) { _ScrollTo(0, 0); fCaretOffset = 0; } else { @@ -3529,7 +3552,7 @@ BTextView::_HandlePageKey(uint32 inPageKey) break; } - if (ctrlDown) { + if (commandKeyDown) { _ScrollTo(0, fTextRect.bottom + fLayoutData->bottomInset); fCaretOffset = fText->Length(); } else { @@ -5044,6 +5067,25 @@ BTextView::_Activate() GetMouse(&where, &buttons, false); if (Bounds().Contains(where)) _TrackMouse(where, NULL); + + if (Window() != NULL) { + if (!Window()->HasShortcut(B_LEFT_ARROW, B_COMMAND_KEY) + && !Window()->HasShortcut(B_RIGHT_ARROW, B_COMMAND_KEY)) { + Window()->AddShortcut(B_LEFT_ARROW, B_COMMAND_KEY, + new BMessage(NAVIGATE_TO_PREVIOUS_WORD), this); + Window()->AddShortcut(B_RIGHT_ARROW, B_COMMAND_KEY, + new BMessage(NAVIGATE_TO_NEXT_WORD), this); + fInstalledNavigateWordwiseShortcuts = true; + } + if (!Window()->HasShortcut(B_HOME, B_COMMAND_KEY) + && !Window()->HasShortcut(B_END, B_COMMAND_KEY)) { + Window()->AddShortcut(B_HOME, B_COMMAND_KEY, + new BMessage(NAVIGATE_TO_TOP), this); + Window()->AddShortcut(B_END, B_COMMAND_KEY, + new BMessage(NAVIGATE_TO_BOTTOM), this); + fInstalledNavigateToTopOrBottomShortcuts = true; + } + } } @@ -5062,6 +5104,19 @@ BTextView::_Deactivate() Highlight(fSelStart, fSelEnd); } else _HideCaret(); + + if (Window() != NULL) { + if (fInstalledNavigateWordwiseShortcuts) { + Window()->RemoveShortcut(B_LEFT_ARROW, B_COMMAND_KEY); + Window()->RemoveShortcut(B_RIGHT_ARROW, B_COMMAND_KEY); + fInstalledNavigateWordwiseShortcuts = false; + } + if (fInstalledNavigateToTopOrBottomShortcuts) { + Window()->RemoveShortcut(B_HOME, B_COMMAND_KEY); + Window()->RemoveShortcut(B_END, B_COMMAND_KEY); + fInstalledNavigateToTopOrBottomShortcuts = false; + } + } } From de62b051e4f059d8ebe04e4df7e64afa03f4626a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Mon, 5 Nov 2012 10:02:13 +0100 Subject: [PATCH 19/36] Disabled HDA MSI for now again. * At least on my hardware, audio becomes a bit flaky (ie. sometimes it would just stop doing anything at all). --- src/add-ons/kernel/drivers/audio/hda/hda_controller.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/add-ons/kernel/drivers/audio/hda/hda_controller.cpp b/src/add-ons/kernel/drivers/audio/hda/hda_controller.cpp index c101540068..533e91e8b2 100644 --- a/src/add-ons/kernel/drivers/audio/hda/hda_controller.cpp +++ b/src/add-ons/kernel/drivers/audio/hda/hda_controller.cpp @@ -34,6 +34,7 @@ #define ALIGN(size, align) (((size) + align - 1) & ~(align - 1)) #define PAGE_ALIGN(size) (((size) + B_PAGE_SIZE - 1) & ~(B_PAGE_SIZE - 1)) + static const struct { uint32 multi_rate; uint32 hw_rate; @@ -54,6 +55,7 @@ static const struct { // {B_SR_384000, MAKE_RATE(44100, ??, ??), 384000}, }; + static pci_x86_module_info* sPCIx86Module; @@ -830,6 +832,9 @@ hda_hw_init(hda_controller* controller) controller->irq = controller->pci_info.u.h0.interrupt_line; controller->msi = false; + // TODO: temporarily disabled, as at least on my hardware audio becomes + // flaky after this. +/* if (sPCIx86Module != NULL && sPCIx86Module->get_msi_count( controller->pci_info.bus, controller->pci_info.device, controller->pci_info.function) >= 1) { @@ -846,6 +851,7 @@ hda_hw_init(hda_controller* controller) controller->msi = true; } } +*/ status = install_io_interrupt_handler(controller->irq, (interrupt_handler)hda_interrupt_handler, controller, 0); From 0a361580ad81fd49bdb887656e0c934a73020fb4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Mon, 5 Nov 2012 10:13:32 +0100 Subject: [PATCH 20/36] Added HDA quirks for enabling snoop. * Enabled snoop for all Intel hardware as found in the Linux driver. * This fixes #8949. --- .../drivers/audio/hda/hda_controller.cpp | 83 ++++++++++++++----- .../drivers/audio/hda/hda_controller_defs.h | 14 +--- 2 files changed, 67 insertions(+), 30 deletions(-) diff --git a/src/add-ons/kernel/drivers/audio/hda/hda_controller.cpp b/src/add-ons/kernel/drivers/audio/hda/hda_controller.cpp index 533e91e8b2..6d75b06e1e 100644 --- a/src/add-ons/kernel/drivers/audio/hda/hda_controller.cpp +++ b/src/add-ons/kernel/drivers/audio/hda/hda_controller.cpp @@ -35,6 +35,33 @@ #define PAGE_ALIGN(size) (((size) + B_PAGE_SIZE - 1) & ~(B_PAGE_SIZE - 1)) +#define PCI_VENDOR_AMD 0x1002 +#define PCI_VENDOR_INTEL 0x8086 +#define PCI_VENDOR_NVIDIA 0x10de +#define PCI_ALL_DEVICES 0xffffffff +#define HDA_QUIRK_SNOOP 0x0001 + + +static const struct { + uint32 vendor_id, device_id; + uint32 quirks; +} kControllerQuirks[] = { + { PCI_VENDOR_INTEL, 0x1c20, HDA_QUIRK_SNOOP }, + { PCI_VENDOR_INTEL, 0x1d20, HDA_QUIRK_SNOOP }, + { PCI_VENDOR_INTEL, 0x1e20, HDA_QUIRK_SNOOP }, + { PCI_VENDOR_INTEL, 0x8c20, HDA_QUIRK_SNOOP }, + { PCI_VENDOR_INTEL, 0x9c20, HDA_QUIRK_SNOOP }, + { PCI_VENDOR_INTEL, 0x9c21, HDA_QUIRK_SNOOP }, + { PCI_VENDOR_INTEL, 0x0c0c, HDA_QUIRK_SNOOP }, + { PCI_VENDOR_INTEL, 0x811b, HDA_QUIRK_SNOOP }, + { PCI_VENDOR_INTEL, 0x080a, HDA_QUIRK_SNOOP }, + // Enable snooping for ATI and Nvidia, right now for all their hda-devices, + // but only based on guessing. + { PCI_VENDOR_AMD, PCI_ALL_DEVICES, HDA_QUIRK_SNOOP }, + { PCI_VENDOR_NVIDIA, PCI_ALL_DEVICES, HDA_QUIRK_SNOOP }, +}; + + static const struct { uint32 multi_rate; uint32 hw_rate; @@ -59,6 +86,20 @@ static const struct { static pci_x86_module_info* sPCIx86Module; +static uint32 +get_controller_quirks(pci_info& info) +{ + for (size_t i = 0; + i < sizeof(kControllerQuirks) / sizeof(kControllerQuirks[0]); i++) { + if (info.vendor_id == kControllerQuirks[i].vendor_id + && (kControllerQuirks[i].device_id == PCI_ALL_DEVICES + || kControllerQuirks[i].device_id == info.device_id)) + return kControllerQuirks[i].quirks; + } + return 0; +} + + static inline void update_pci_register(hda_controller* controller, uint8 reg, uint32 mask, uint32 value, uint8 size) @@ -800,8 +841,11 @@ hda_verb_read(hda_codec* codec, uint32 nid, uint32 vid, uint32* response) status_t hda_hw_init(hda_controller* controller) { - uint16 capabilities, stateStatus, cmd; + uint16 capabilities; + uint16 stateStatus; + uint16 cmd; status_t status; + uint32 quirks; // Map MMIO registers controller->regs_area = map_physical_memory("hda_hw_regs", @@ -861,27 +905,26 @@ hda_hw_init(hda_controller* controller) // TCSEL is reset to TC0 (clear 0-2 bits) update_pci_register(controller, PCI_HDA_TCSEL, PCI_HDA_TCSEL_MASK, 0, 1); - // Enable snooping for ATI and Nvidia, right now for all their hda-devices, - // but only based on guessing. - switch (controller->pci_info.vendor_id) { - case NVIDIA_VENDORID: - update_pci_register(controller, NVIDIA_HDA_TRANSREG, - NVIDIA_HDA_TRANSREG_MASK, NVIDIA_HDA_ENABLE_COHBITS, 1); - update_pci_register(controller, NVIDIA_HDA_ISTRM_COH, - ~NVIDIA_HDA_ENABLE_COHBIT, NVIDIA_HDA_ENABLE_COHBIT, 1); - update_pci_register(controller, NVIDIA_HDA_OSTRM_COH, - ~NVIDIA_HDA_ENABLE_COHBIT, NVIDIA_HDA_ENABLE_COHBIT, 1); - break; - case ATI_VENDORID: - update_pci_register(controller, ATI_HDA_MISC_CNTR2, - ATI_HDA_MISC_CNTR2_MASK, ATI_HDA_ENABLE_SNOOP, 1); - break; - case INTEL_VENDORID: - if (controller->pci_info.device_id == INTEL_SCH_DEVICEID) { + quirks = get_controller_quirks(controller->pci_info); + if ((quirks & HDA_QUIRK_SNOOP) != 0) { + switch (controller->pci_info.vendor_id) { + case PCI_VENDOR_NVIDIA: + update_pci_register(controller, NVIDIA_HDA_TRANSREG, + NVIDIA_HDA_TRANSREG_MASK, NVIDIA_HDA_ENABLE_COHBITS, 1); + update_pci_register(controller, NVIDIA_HDA_ISTRM_COH, + ~NVIDIA_HDA_ENABLE_COHBIT, NVIDIA_HDA_ENABLE_COHBIT, 1); + update_pci_register(controller, NVIDIA_HDA_OSTRM_COH, + ~NVIDIA_HDA_ENABLE_COHBIT, NVIDIA_HDA_ENABLE_COHBIT, 1); + break; + case PCI_VENDOR_AMD: + update_pci_register(controller, ATI_HDA_MISC_CNTR2, + ATI_HDA_MISC_CNTR2_MASK, ATI_HDA_ENABLE_SNOOP, 1); + break; + case PCI_VENDOR_INTEL: update_pci_register(controller, INTEL_SCH_HDA_DEVC, ~INTEL_SCH_HDA_DEVC_SNOOP, 0, 2); - } - break; + break; + } } capabilities = controller->Read16(HDAC_GLOBAL_CAP); diff --git a/src/add-ons/kernel/drivers/audio/hda/hda_controller_defs.h b/src/add-ons/kernel/drivers/audio/hda/hda_controller_defs.h index 1fbca3f87b..154ab38feb 100644 --- a/src/add-ons/kernel/drivers/audio/hda/hda_controller_defs.h +++ b/src/add-ons/kernel/drivers/audio/hda/hda_controller_defs.h @@ -1,5 +1,5 @@ /* - * Copyright 2007-2008, Haiku, Inc. All Rights Reserved. + * Copyright 2007-2012, Haiku, Inc. All Rights Reserved. * Distributed under the terms of the MIT License. * * Authors: @@ -135,24 +135,18 @@ #define PCI_HDA_TCSEL 0x44 #define PCI_HDA_TCSEL_MASK 0xf8 -#define ATI_HDA_MISC_CNTR2 0x42 +#define ATI_HDA_MISC_CNTR2 0x42 #define ATI_HDA_MISC_CNTR2_MASK 0xf8 #define ATI_HDA_ENABLE_SNOOP 0x02 #define NVIDIA_HDA_OSTRM_COH 0x4c #define NVIDIA_HDA_ISTRM_COH 0x4d #define NVIDIA_HDA_ENABLE_COHBIT 0x01 -#define NVIDIA_HDA_TRANSREG 0x4e +#define NVIDIA_HDA_TRANSREG 0x4e #define NVIDIA_HDA_TRANSREG_MASK 0xf0 #define NVIDIA_HDA_ENABLE_COHBITS 0x0f -#define INTEL_SCH_HDA_DEVC 0x78 +#define INTEL_SCH_HDA_DEVC 0x78 #define INTEL_SCH_HDA_DEVC_SNOOP 0x800 -#define ATI_VENDORID 0x1002 -#define INTEL_VENDORID 0x8086 -#define INTEL_SCH_DEVICEID 0x811b -#define NVIDIA_VENDORID 0x10de - - typedef uint32 corb_t; typedef struct { From 1a1e2020f98dac774110baa4df2ab303f1f7292d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Revol?= Date: Mon, 5 Nov 2012 11:48:43 +0100 Subject: [PATCH 21/36] kdlhangman: Fallback to thread names when fortune is missing When loading from the boot drivers tgz without a mounted boot partition, fall back to thread names to find words. --- src/add-ons/kernel/debugger/hangman/hangman.c | 55 ++++++++++++++++++- 1 file changed, 53 insertions(+), 2 deletions(-) diff --git a/src/add-ons/kernel/debugger/hangman/hangman.c b/src/add-ons/kernel/debugger/hangman/hangman.c index 231d004977..8a0585fdd1 100644 --- a/src/add-ons/kernel/debugger/hangman/hangman.c +++ b/src/add-ons/kernel/debugger/hangman/hangman.c @@ -76,6 +76,7 @@ char bigbuffer[BIGBUFFSZ]; #define BIT_FROM_LETTER(l) (0x1 << (l - 'a')) status_t init_words(char *from); +status_t init_words_from_threadnames(void); void print_hangman(int fails); void display_word(int current, uint32 tried_letters); int play_hangman(void); @@ -169,6 +170,51 @@ init_words(char *from) } +status_t +init_words_from_threadnames(void) +{ + size_t sz, got; + int current, beg, end, i; + thread_info ti; + + memset((void *)words, 0, sizeof(words)); + srand((unsigned int)(system_time() & 0x0ffffffff)); + for (current = 0; current < MAX_CACHED_WORDS; ) { + int offset; + char *p; + if (get_thread_info(rand() % 200, &ti) != B_OK) + continue; + sz = strnlen(ti.name, B_OS_NAME_LENGTH); + if (sz <= MIN_LETTERS) + continue; + offset = (rand() % (sz - MIN_LETTERS)); + //dprintf("thread '%-.32s' + %d\n", ti.name, offset); + p = ti.name + offset; + got = sz - offset; + for (beg = 0; beg < got && isalpha(p[beg]); beg++); + for (; beg < got && !isalpha(p[beg]); beg++); + if (beg + 1 < got && isalpha(p[beg])) { + for (end = beg; end < got && isalpha(p[end]); end++); + if (end < got && !isalpha(p[end]) && beg + MIN_LETTERS < end) { + /* got one */ + /* tolower */ + for (i = beg; i < end; i++) + p[i] = tolower(p[i]); + strncpy(&(words[current][0]), &(p[beg]), end - beg); + } else + continue; + } else + continue; + current++; + } + /* + for (current = 0; current < MAX_CACHED_WORDS; current++) + dprintf("%s\n", words[current]); + */ + return B_OK; +} + + void print_hangman(int fails) { @@ -456,7 +502,12 @@ std_ops(int32 op, ...) if (err < B_OK) { dprintf("hangman: error reading fortune file: %s\n", strerror(err)); - return B_ERROR; + err = init_words_from_threadnames(); + if (err < B_OK) { + dprintf("hangman: error getting thread names: %s\n", + strerror(err)); + return B_ERROR; + } } add_debugger_command("kdlhangman", kdlhangman, KCMD_HELP); return B_OK; @@ -497,7 +548,7 @@ kdl_trip(void) fd = open("/dev/misc/hangman", O_WRONLY); if (fd < B_OK) { puts("hey, you're pissing me off, no /dev/"DEV_ENTRY" !!!"); - system("/bin/alert --stop 'It would work better with the hangman driver enabled...\nyou really deserves a forced reboot :P'"); + system("/bin/alert --stop 'It would work better with the hangman driver enabled...\nyou really deserve a forced reboot :P'"); return; } write(fd, "hangme!", 7); From d2c8db267dd912f719bb582acc14c8c521eac15c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Mon, 5 Nov 2012 12:18:46 +0100 Subject: [PATCH 22/36] Just ignore unknown ELF program headers instead of failing. * This fixes loading executables with a TLS section (which we do not support so far, though). Still, no reason to let the runtime loader choke on it. --- src/system/runtime_loader/elf_load_image.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/system/runtime_loader/elf_load_image.cpp b/src/system/runtime_loader/elf_load_image.cpp index 97f6988aa3..d8286cea72 100644 --- a/src/system/runtime_loader/elf_load_image.cpp +++ b/src/system/runtime_loader/elf_load_image.cpp @@ -1,6 +1,6 @@ /* * Copyright 2008-2009, Ingo Weinhold, ingo_weinhold@gmx.de. - * Copyright 2003-2008, Axel Dörfler, axeld@pinc-software.de. + * Copyright 2003-2012, Axel Dörfler, axeld@pinc-software.de. * Distributed under the terms of the MIT License. * * Copyright 2002, Manuel J. Petit. All rights reserved. @@ -80,7 +80,7 @@ count_regions(const char* imagePath, char const* buff, int phnum, int phentsize) default: FATAL("%s: Unhandled pheader type in count 0x%lx\n", imagePath, pheaders->p_type); - return B_BAD_DATA; + break; } } From 4656e550b0998dae6450e63a6a37b2f664b03e4d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Sun, 4 Nov 2012 10:45:51 +0100 Subject: [PATCH 23/36] Added method SetExplicitSize() for convenience. --- headers/os/interface/LayoutItem.h | 1 + headers/os/interface/View.h | 4 +++- src/kits/interface/LayoutItem.cpp | 16 +++++++++++++--- src/kits/interface/View.cpp | 10 ++++++++++ 4 files changed, 27 insertions(+), 4 deletions(-) diff --git a/headers/os/interface/LayoutItem.h b/headers/os/interface/LayoutItem.h index b0d5302581..851fdd031c 100644 --- a/headers/os/interface/LayoutItem.h +++ b/headers/os/interface/LayoutItem.h @@ -32,6 +32,7 @@ public: virtual void SetExplicitMinSize(BSize size) = 0; virtual void SetExplicitMaxSize(BSize size) = 0; virtual void SetExplicitPreferredSize(BSize size) = 0; + void SetExplicitSize(BSize size); virtual void SetExplicitAlignment(BAlignment alignment) = 0; virtual bool IsVisible() = 0; diff --git a/headers/os/interface/View.h b/headers/os/interface/View.h index 4471ddd1a6..bac388e38f 100644 --- a/headers/os/interface/View.h +++ b/headers/os/interface/View.h @@ -1,5 +1,5 @@ /* - * Copyright 2001-2009, Haiku, Inc. All rights reserved. + * Copyright 2001-2012, Haiku, Inc. All rights reserved. * Distributed under the terms of the MIT License. */ #ifndef _VIEW_H @@ -537,6 +537,7 @@ public: void SetExplicitMinSize(BSize size); void SetExplicitMaxSize(BSize size); void SetExplicitPreferredSize(BSize size); + void SetExplicitSize(BSize size); void SetExplicitAlignment(BAlignment alignment); BSize ExplicitMinSize() const; @@ -753,4 +754,5 @@ BView::SetLowColor(uchar r, uchar g, uchar b, uchar a) SetLowColor(color); } + #endif // _VIEW_H diff --git a/src/kits/interface/LayoutItem.cpp b/src/kits/interface/LayoutItem.cpp index 0382c611f9..5ef6cab9c5 100644 --- a/src/kits/interface/LayoutItem.cpp +++ b/src/kits/interface/LayoutItem.cpp @@ -1,9 +1,10 @@ /* - * Copyright 2010, Haiku, Inc. + * Copyright 2010-2012, Haiku, Inc. * Copyright 2006, Ingo Weinhold . * All rights reserved. Distributed under the terms of the MIT License. */ + #include #include @@ -46,6 +47,15 @@ BLayoutItem::Layout() const } +void +BLayoutItem::SetExplicitSize(BSize size) +{ + SetExplicitMinSize(size); + SetExplicitMaxSize(size); + SetExplicitPreferredSize(size); +} + + bool BLayoutItem::HasHeightForWidth() { @@ -122,7 +132,7 @@ BLayoutItem::AlignInFrame(BRect frame) float minHeight; GetHeightForWidth(frame.Width(), &minHeight, NULL, NULL); - + frame.bottom = frame.top + max_c(frame.Height(), minHeight); maxSize.height = minHeight; } @@ -178,7 +188,7 @@ BLayoutItem::SetLayout(BLayout* layout) BView::Private(view).RegisterLayoutItem(this); } } - + if (fLayout) AttachedToLayout(); } diff --git a/src/kits/interface/View.cpp b/src/kits/interface/View.cpp index 47eb59fc73..7adf00e468 100644 --- a/src/kits/interface/View.cpp +++ b/src/kits/interface/View.cpp @@ -4586,6 +4586,16 @@ BView::SetExplicitPreferredSize(BSize size) } +void +BView::SetExplicitSize(BSize size) +{ + fLayoutData->fMinSize = size; + fLayoutData->fMaxSize = size; + fLayoutData->fPreferredSize = size; + InvalidateLayout(); +} + + void BView::SetExplicitAlignment(BAlignment alignment) { From 2267b7e7fbfd5c977d50ec35613eb1a0b9ecf521 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Sun, 4 Nov 2012 10:53:34 +0100 Subject: [PATCH 24/36] Added Grid::AddGlue(), and SetExplicit*Size() methods. --- headers/os/interface/LayoutBuilder.h | 78 +++++++++++++++++++++++++++- 1 file changed, 77 insertions(+), 1 deletion(-) diff --git a/headers/os/interface/LayoutBuilder.h b/headers/os/interface/LayoutBuilder.h index 83e8824b16..7e9bda0c14 100644 --- a/headers/os/interface/LayoutBuilder.h +++ b/headers/os/interface/LayoutBuilder.h @@ -1,5 +1,5 @@ /* - * Copyright 2009-2010, Haiku, Inc. All rights reserved. + * Copyright 2009-2012, Haiku, Inc. All rights reserved. * Distributed under the terms of the MIT License. */ #ifndef _LAYOUT_BUILDER_H @@ -108,6 +108,10 @@ public: inline ThisBuilder& SetInsets(float horizontal, float vertical); inline ThisBuilder& SetInsets(float insets); + inline ThisBuilder& SetExplicitMinSize(BSize size); + inline ThisBuilder& SetExplicitMaxSize(BSize size); + inline ThisBuilder& SetExplicitPreferredSize(BSize size); + inline operator BGroupLayout*(); private: @@ -188,6 +192,9 @@ public: int32 row, int32 columnCount = 1, int32 rowCount = 1); + inline ThisBuilder& AddGlue(int32 column, int32 row, + int32 columnCount = 1, int32 rowCount = 1); + inline ThisBuilder& SetColumnWeight(int32 column, float weight); inline ThisBuilder& SetRowWeight(int32 row, float weight); @@ -196,6 +203,10 @@ public: inline ThisBuilder& SetInsets(float horizontal, float vertical); inline ThisBuilder& SetInsets(float insets); + inline ThisBuilder& SetExplicitMinSize(BSize size); + inline ThisBuilder& SetExplicitMaxSize(BSize size); + inline ThisBuilder& SetExplicitPreferredSize(BSize size); + inline operator BGridLayout*(); private: @@ -604,6 +615,33 @@ Group::SetInsets(float insets) } +template +typename Group::ThisBuilder& +Group::SetExplicitMinSize(BSize size) +{ + fLayout->SetExplicitMinSize(size); + return *this; +} + + +template +typename Group::ThisBuilder& +Group::SetExplicitMaxSize(BSize size) +{ + fLayout->SetExplicitMaxSize(size); + return *this; +} + + +template +typename Group::ThisBuilder& +Group::SetExplicitPreferredSize(BSize size) +{ + fLayout->SetExplicitPreferredSize(size); + return *this; +} + + template Group::operator BGroupLayout*() { @@ -833,6 +871,17 @@ Grid::AddSplit(BSplitView* splitView, int32 column, int32 row, } +template +typename Grid::ThisBuilder& +Grid::AddGlue(int32 column, int32 row, int32 columnCount, + int32 rowCount) +{ + fLayout->AddItem(BSpaceLayoutItem::CreateGlue(), column, row, columnCount, + rowCount); + return *this; +} + + template typename Grid::ThisBuilder& Grid::SetColumnWeight(int32 column, float weight) @@ -879,6 +928,33 @@ Grid::SetInsets(float insets) } +template +typename Grid::ThisBuilder& +Grid::SetExplicitMinSize(BSize size) +{ + fLayout->SetExplicitMinSize(size); + return *this; +} + + +template +typename Grid::ThisBuilder& +Grid::SetExplicitMaxSize(BSize size) +{ + fLayout->SetExplicitMaxSize(size); + return *this; +} + + +template +typename Grid::ThisBuilder& +Grid::SetExplicitPreferredSize(BSize size) +{ + fLayout->SetExplicitPreferredSize(size); + return *this; +} + + template Grid::operator BGridLayout*() { From 6643ead593c3c936c676df6f535337e57002c843 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Sun, 4 Nov 2012 14:07:46 +0100 Subject: [PATCH 25/36] Made the BRect::*Copy() methods const as they should have been. --- headers/os/interface/Rect.h | 20 ++++---- src/kits/interface/Rect.cpp | 95 ++++++++++++++++++++++++++++++------- 2 files changed, 88 insertions(+), 27 deletions(-) diff --git a/headers/os/interface/Rect.h b/headers/os/interface/Rect.h index f55f24f6f6..b48499f298 100644 --- a/headers/os/interface/Rect.h +++ b/headers/os/interface/Rect.h @@ -1,16 +1,16 @@ /* - * Copyright 2001-2009, Haiku, Inc. All rights reserved. + * Copyright 2001-2012, Haiku, Inc. All rights reserved. * Distributed under the terms of the MIT License. */ #ifndef _RECT_H #define _RECT_H +#include + #include #include -#include - class BRect { public: @@ -54,16 +54,16 @@ public: // Expression transformations BRect& InsetBySelf(BPoint inset); BRect& InsetBySelf(float dx, float dy); - BRect InsetByCopy(BPoint inset); - BRect InsetByCopy(float dx, float dy); + BRect InsetByCopy(BPoint inset) const; + BRect InsetByCopy(float dx, float dy) const; BRect& OffsetBySelf(BPoint offset); BRect& OffsetBySelf(float dx, float dy); - BRect OffsetByCopy(BPoint offset); - BRect OffsetByCopy(float dx, float dy); + BRect OffsetByCopy(BPoint offset) const; + BRect OffsetByCopy(float dx, float dy) const; BRect& OffsetToSelf(BPoint offset); BRect& OffsetToSelf(float dx, float dy); - BRect OffsetToCopy(BPoint offset); - BRect OffsetToCopy(float dx, float dy); + BRect OffsetToCopy(BPoint offset) const; + BRect OffsetToCopy(float dx, float dy) const; // Comparison bool operator==(BRect r) const; @@ -120,7 +120,7 @@ inline BRect::BRect() : left(0), - top(0), + top(0), right(-1), bottom(-1) { diff --git a/src/kits/interface/Rect.cpp b/src/kits/interface/Rect.cpp index c56d51d5bb..20b51308ff 100644 --- a/src/kits/interface/Rect.cpp +++ b/src/kits/interface/Rect.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2001-2007, Haiku, Inc. All Rights Reserved. + * Copyright 2001-2012, Haiku, Inc. All Rights Reserved. * Distributed under the terms of the MIT License. * * Authors: @@ -80,7 +80,7 @@ BRect::InsetBySelf(float dx, float dy) BRect -BRect::InsetByCopy(BPoint point) +BRect::InsetByCopy(BPoint point) const { BRect copy(*this); copy.InsetBy(point); @@ -89,7 +89,7 @@ BRect::InsetByCopy(BPoint point) BRect -BRect::InsetByCopy(float dx, float dy) +BRect::InsetByCopy(float dx, float dy) const { BRect copy(*this); copy.InsetBy(dx, dy); @@ -134,7 +134,7 @@ BRect::OffsetBySelf(float dx, float dy) BRect -BRect::OffsetByCopy(BPoint point) +BRect::OffsetByCopy(BPoint point) const { BRect copy(*this); copy.OffsetBy(point); @@ -143,7 +143,7 @@ BRect::OffsetByCopy(BPoint point) BRect -BRect::OffsetByCopy(float dx, float dy) +BRect::OffsetByCopy(float dx, float dy) const { BRect copy(*this); copy.OffsetBy(dx, dy); @@ -188,7 +188,7 @@ BRect::OffsetToSelf(float dx, float dy) BRect -BRect::OffsetToCopy(BPoint point) +BRect::OffsetToCopy(BPoint point) const { BRect copy(*this); copy.OffsetTo(point); @@ -197,7 +197,7 @@ BRect::OffsetToCopy(BPoint point) BRect -BRect::OffsetToCopy(float dx, float dy) +BRect::OffsetToCopy(float dx, float dy) const { BRect copy(*this); copy.OffsetTo(dx, dy); @@ -215,31 +215,31 @@ BRect::PrintToStream() const bool BRect::operator==(BRect rect) const { - return left == rect.left && right == rect.right && - top == rect.top && bottom == rect.bottom; + return left == rect.left && right == rect.right && + top == rect.top && bottom == rect.bottom; } bool BRect::operator!=(BRect rect) const { - return !(*this == rect); + return !(*this == rect); } BRect BRect::operator&(BRect rect) const { - return BRect(max_c(left, rect.left), max_c(top, rect.top), - min_c(right, rect.right), min_c(bottom, rect.bottom)); + return BRect(max_c(left, rect.left), max_c(top, rect.top), + min_c(right, rect.right), min_c(bottom, rect.bottom)); } BRect BRect::operator|(BRect rect) const { - return BRect(min_c(left, rect.left), min_c(top, rect.top), - max_c(right, rect.right), max_c(bottom, rect.bottom)); + return BRect(min_c(left, rect.left), min_c(top, rect.top), + max_c(right, rect.right), max_c(bottom, rect.bottom)); } @@ -250,7 +250,7 @@ BRect::Intersects(BRect rect) const return false; return !(rect.left > right || rect.right < left - || rect.top > bottom || rect.bottom < top); + || rect.top > bottom || rect.bottom < top); } @@ -258,7 +258,7 @@ bool BRect::Contains(BPoint point) const { return point.x >= left && point.x <= right - && point.y >= top && point.y <= bottom; + && point.y >= top && point.y <= bottom; } @@ -266,5 +266,66 @@ bool BRect::Contains(BRect rect) const { return rect.left >= left && rect.right <= right - && rect.top >= top && rect.bottom <= bottom; + && rect.top >= top && rect.bottom <= bottom; } + + +// #pragma mark - BeOS compatibility only +#if __GNUC__ == 2 + + +extern "C" BRect +InsetByCopy__5BRectG6BPoint(BRect* self, BPoint point) +{ + BRect copy(*self); + copy.InsetBy(point); + return copy; +} + + +extern "C" BRect +InsetByCopy__5BRectff(BRect* self, float dx, float dy) +{ + BRect copy(*self); + copy.InsetBy(dx, dy); + return copy; +} + + +extern "C" BRect +OffsetByCopy__5BRectG6BPoint(BRect* self, BPoint point) +{ + BRect copy(*self); + copy.OffsetBy(point); + return copy; +} + + +extern "C" BRect +OffsetByCopy__5BRectff(BRect* self, float dx, float dy) +{ + BRect copy(*self); + copy.OffsetBy(dx, dy); + return copy; +} + + +extern "C" BRect +OffsetToCopy__5BRectG6BPoint(BRect* self, BPoint point) +{ + BRect copy(*self); + copy.OffsetTo(point); + return copy; +} + + +extern "C" BRect +OffsetToCopy__5BRectff(BRect* self, float dx, float dy) +{ + BRect copy(*self); + copy.OffsetTo(dx, dy); + return copy; +} + + +#endif // __GNUC__ == 2 From 09d87d9151728f731c1d27e8914c5bbd6e72ec5b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Sun, 4 Nov 2012 15:23:09 +0100 Subject: [PATCH 26/36] The text control is now more flexible with its layout items. * Before, you had to have both, the text view layout item, and the label layout item or else nothing would ever be visible. * Now you can only create the text view item, and it will still work. * Also, no matter the order you added the layout items, they would always put the label on the left, and the control to the right. * You can place the label and text view layout items anywhere now, although you should keep in mind that the view spans over their frame unions; IOW they should always adjacent to each other, but not necessarily horizontally and left to right. * No longer uses a fixed label spacing, but utilizes BControlLook::DefaultLabelSpacing() instead. * However, the spacing is always added to the right of the label, no matter how you place it in the layout. Maybe one wants to add a SetLabelTextViewGap() like method. --- headers/os/interface/TextControl.h | 9 ++- src/kits/interface/TextControl.cpp | 114 ++++++++++++++++++++--------- 2 files changed, 85 insertions(+), 38 deletions(-) diff --git a/headers/os/interface/TextControl.h b/headers/os/interface/TextControl.h index 456c6f1dee..aca56a18f9 100644 --- a/headers/os/interface/TextControl.h +++ b/headers/os/interface/TextControl.h @@ -1,5 +1,5 @@ /* - * Copyright 2006-2010, Haiku, Inc. All rights reserved. + * Copyright 2006-2012, Haiku, Inc. All rights reserved. * Distributed under the terms of the MIT License. */ #ifndef _TEXT_CONTROL_H @@ -9,6 +9,7 @@ #include #include + class BLayoutItem; namespace BPrivate { class _BTextInput_; @@ -22,14 +23,14 @@ public: BMessage* message, uint32 resizeMode = B_FOLLOW_LEFT | B_FOLLOW_TOP, - uint32 flags = B_WILL_DRAW | B_NAVIGABLE); + uint32 flags = B_WILL_DRAW | B_NAVIGABLE); BTextControl(const char* name, const char* label, const char* initialText, BMessage* message, - uint32 flags = B_WILL_DRAW | B_NAVIGABLE); + uint32 flags = B_WILL_DRAW | B_NAVIGABLE); BTextControl(const char* label, const char* initialText, - BMessage* message); + BMessage* message); virtual ~BTextControl(); BTextControl(BMessage* archive); diff --git a/src/kits/interface/TextControl.cpp b/src/kits/interface/TextControl.cpp index f0f64f4405..90ee19dd13 100644 --- a/src/kits/interface/TextControl.cpp +++ b/src/kits/interface/TextControl.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2001-2008, Haiku Inc. + * Copyright 2001-2012, Haiku Inc. * Distributed under the terms of the MIT License. * * Authors: @@ -8,12 +8,14 @@ * Ingo Weinhold */ + /*! BTextControl displays text that can act like a control. */ -#include #include +#include + #include #include #include @@ -82,8 +84,11 @@ public: virtual BSize BasePreferredSize(); virtual BAlignment BaseAlignment(); + BRect FrameInParent() const; + virtual status_t Archive(BMessage* into, bool deep = true) const; static BArchivable* Instantiate(BMessage* from); + private: BTextControl* fParent; BRect fFrame; @@ -109,6 +114,8 @@ public: virtual BSize BasePreferredSize(); virtual BAlignment BaseAlignment(); + BRect FrameInParent() const; + virtual status_t Archive(BMessage* into, bool deep = true) const; static BArchivable* Instantiate(BMessage* from); private: @@ -425,13 +432,17 @@ BTextControl::Draw(BRect updateRect) be_control_look->DrawTextControlBorder(this, rect, updateRect, base, flags); - rect = Bounds(); - rect.right = fDivider - kLabelInputSpacing; -// rect.right = fText->Frame().left - 2; -// rect.right -= 3;//be_control_look->DefaultLabelSpacing(); - be_control_look->DrawLabel(this, Label(), rect, updateRect, - base, flags, BAlignment(fLabelAlign, B_ALIGN_MIDDLE)); + if (Label() != NULL) { + if (fLayoutData->label_layout_item != NULL) { + rect = fLayoutData->label_layout_item->FrameInParent(); + } else { + rect = Bounds(); + rect.right = fDivider - kLabelInputSpacing; + } + be_control_look->DrawLabel(this, Label(), rect, updateRect, + base, flags, BAlignment(fLabelAlign, B_ALIGN_MIDDLE)); + } return; } @@ -524,9 +535,8 @@ BTextControl::Draw(BRect updateRect) void BTextControl::MouseDown(BPoint where) { - if (!fText->IsFocus()) { + if (!fText->IsFocus()) fText->MakeFocus(true); - } } @@ -892,23 +902,28 @@ BTextControl::DoLayout() if (size.height < fLayoutData->min.height) size.height = fLayoutData->min.height; + BRect dirty(fText->Frame()); + BRect textFrame; + // divider float divider = 0; - if (fLayoutData->label_layout_item && fLayoutData->text_view_layout_item) { - // We have layout items. They define the divider location. - divider = fLayoutData->text_view_layout_item->Frame().left - - fLayoutData->label_layout_item->Frame().left; + if (fLayoutData->text_view_layout_item != NULL) { + if (fLayoutData->label_layout_item != NULL) { + // We have layout items. They define the divider location. + divider = fabs(fLayoutData->text_view_layout_item->Frame().left + - fLayoutData->label_layout_item->Frame().left); + } + textFrame = fLayoutData->text_view_layout_item->FrameInParent(); } else { - if (fLayoutData->label_width > 0) - divider = fLayoutData->label_width + 5; + if (fLayoutData->label_width > 0) { + divider = fLayoutData->label_width + + be_control_look->DefaultLabelSpacing(); + } + textFrame.Set(divider, 0, size.width, size.height); } - // text view - BRect dirty(fText->Frame()); - BRect textFrame(divider + kFrameMargin, kFrameMargin, - size.width - kFrameMargin, size.height - kFrameMargin); - // place the text view and set the divider + textFrame.InsetBy(kFrameMargin, kFrameMargin); BLayoutUtils::AlignInFrame(fText, textFrame); fDivider = divider; @@ -1071,7 +1086,6 @@ BTextControl::_InitData(const char* label, const BMessage* archive) if (label) fDivider = floorf(bounds.Width() / 2.0f); - } @@ -1139,8 +1153,14 @@ BTextControl::_LayoutTextView() { CALLED(); - BRect frame = Bounds(); - frame.left = fDivider; + BRect frame; + if (fLayoutData->text_view_layout_item != NULL) { + frame = fLayoutData->text_view_layout_item->FrameInParent(); + } else { + frame = Bounds(); + frame.left = fDivider; + } + // we are stroking the frame around the text view, which // is 2 pixels wide frame.InsetBy(kFrameMargin, kFrameMargin); @@ -1160,17 +1180,26 @@ BTextControl::_UpdateFrame() { CALLED(); - if (fLayoutData->label_layout_item && fLayoutData->text_view_layout_item) { - BRect labelFrame = fLayoutData->label_layout_item->Frame(); + if (fLayoutData->text_view_layout_item != NULL) { BRect textFrame = fLayoutData->text_view_layout_item->Frame(); + BRect labelFrame; + if (fLayoutData->label_layout_item != NULL) + labelFrame = fLayoutData->label_layout_item->Frame(); - // update divider - fDivider = textFrame.left - labelFrame.left; + BRect frame; + if (labelFrame.IsValid()) { + frame = textFrame | labelFrame; - MoveTo(labelFrame.left, labelFrame.top); + // update divider + fDivider = fabs(textFrame.left - labelFrame.left); + } else { + frame = textFrame; + fDivider = 0; + } + + MoveTo(frame.left, frame.top); BSize oldSize = Bounds().Size(); - ResizeTo(textFrame.left + textFrame.Width() - labelFrame.left, - textFrame.top + textFrame.Height() - labelFrame.top); + ResizeTo(frame.Width(), frame.Height()); BSize newSize = Bounds().Size(); // If the size changes, ResizeTo() will trigger a relayout, otherwise @@ -1203,8 +1232,10 @@ BTextControl::_ValidateLayoutData() // compute the minimal divider float divider = 0; - if (fLayoutData->label_width > 0) - divider = fLayoutData->label_width + 5; + if (fLayoutData->label_width > 0) { + divider = fLayoutData->label_width + + be_control_look->DefaultLabelSpacing(); + } // If we shan't do real layout, we let the current divider take influence. if (!(Flags() & B_SUPPORTS_LAYOUT)) @@ -1306,7 +1337,8 @@ BTextControl::LabelLayoutItem::BaseMinSize() if (!fParent->Label()) return BSize(-1, -1); - return BSize(fParent->fLayoutData->label_width + 5, + return BSize(fParent->fLayoutData->label_width + + be_control_look->DefaultLabelSpacing(), fParent->fLayoutData->label_height); } @@ -1332,6 +1364,13 @@ BTextControl::LabelLayoutItem::BaseAlignment() } +BRect +BTextControl::LabelLayoutItem::FrameInParent() const +{ + return fFrame.OffsetByCopy(-fParent->Frame().left, -fParent->Frame().top); +} + + status_t BTextControl::LabelLayoutItem::Archive(BMessage* into, bool deep) const { @@ -1459,6 +1498,13 @@ BTextControl::TextViewLayoutItem::BaseAlignment() } +BRect +BTextControl::TextViewLayoutItem::FrameInParent() const +{ + return fFrame.OffsetByCopy(-fParent->Frame().left, -fParent->Frame().top); +} + + status_t BTextControl::TextViewLayoutItem::Archive(BMessage* into, bool deep) const { From 9e42a44cad6e56c2a04b9ee1b76446fdd2916a62 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Sun, 4 Nov 2012 17:21:12 +0100 Subject: [PATCH 27/36] Added BPath::IsAbsolute() method. --- headers/os/storage/Path.h | 7 ++++--- src/kits/storage/Path.cpp | 14 +++++++++++++- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/headers/os/storage/Path.h b/headers/os/storage/Path.h index 13438a40f9..d12723afc3 100644 --- a/headers/os/storage/Path.h +++ b/headers/os/storage/Path.h @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009, Haiku, Inc. All Rights Reserved. + * Copyright 2002-2012, Haiku, Inc. All Rights Reserved. * Distributed under the terms of the MIT License. */ #ifndef _PATH_H @@ -25,7 +25,7 @@ public: BPath(const BEntry* entry); BPath(const char* dir, const char* leaf = NULL, bool normalize = false); - BPath(const BDirectory* dir, + BPath(const BDirectory* dir, const char* leaf = NULL, bool normalize = false); @@ -37,7 +37,7 @@ public: status_t SetTo(const BEntry* entry); status_t SetTo(const char* path, const char* leaf = NULL, bool normalize = false); - status_t SetTo(const BDirectory* dir, + status_t SetTo(const BDirectory* dir, const char* leaf = NULL, bool normalize = false); void Unset(); @@ -47,6 +47,7 @@ public: const char* Path() const; const char* Leaf() const; status_t GetParent(BPath* path) const; + bool IsAbsolute() const; bool operator==(const BPath& item) const; bool operator==(const char* path) const; diff --git a/src/kits/storage/Path.cpp b/src/kits/storage/Path.cpp index 7ba3171ab8..7c612992cd 100644 --- a/src/kits/storage/Path.cpp +++ b/src/kits/storage/Path.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009, Haiku Inc. + * Copyright 2002-2012, Haiku Inc. * Distributed under the terms of the MIT License. * * Authors: @@ -7,11 +7,13 @@ * Ingo Weinhold, bonefish@users.sf.net */ + /*! \file Path.cpp BPath implementation. */ + #include #include @@ -402,6 +404,16 @@ BPath::GetParent(BPath* path) const } +bool +BPath::IsAbsolute() const +{ + if (InitCheck() != B_OK) + return false; + + return fName[0] == '/'; +} + + /*! \brief Performs a simple (string-wise) comparison of paths. No normalization takes place! Uninitialized BPath objects are considered to be equal. From 762e4ecaffb1bbaa3fef83ea8fc2b14554aa1c1b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Sun, 4 Nov 2012 17:21:47 +0100 Subject: [PATCH 28/36] BMessage::Append() is now actually working. --- src/kits/app/Message.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/kits/app/Message.cpp b/src/kits/app/Message.cpp index ecfa625a5d..09bf7e4d91 100644 --- a/src/kits/app/Message.cpp +++ b/src/kits/app/Message.cpp @@ -2729,16 +2729,17 @@ BMessage::Append(const BMessage &other) size_t size = field->data_size / field->count; for (uint32 j = 0; j < field->count; j++) { - if (!isFixed) + if (!isFixed) { size = *(uint32 *)data; + data = (const void *)((const char *)data + sizeof(uint32)); + } status_t status = AddData(name, field->type, data, size, - isFixed != 0, 1); + isFixed, 1); if (status != B_OK) return status; - data = (const void *)((const char *)data + size - + (isFixed ? 0 : sizeof(uint32))); + data = (const void *)((const char *)data + size); } } return B_OK; From 17ad59afd3b25f230efd7231a3315e344ef73ae0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Sun, 4 Nov 2012 17:22:32 +0100 Subject: [PATCH 29/36] Added BLayoutBuilder::{Group|Grid}::SetExplicitAlignment(). --- headers/os/interface/LayoutBuilder.h | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/headers/os/interface/LayoutBuilder.h b/headers/os/interface/LayoutBuilder.h index 7e9bda0c14..3b50c7d494 100644 --- a/headers/os/interface/LayoutBuilder.h +++ b/headers/os/interface/LayoutBuilder.h @@ -111,6 +111,7 @@ public: inline ThisBuilder& SetExplicitMinSize(BSize size); inline ThisBuilder& SetExplicitMaxSize(BSize size); inline ThisBuilder& SetExplicitPreferredSize(BSize size); + inline ThisBuilder& SetExplicitAlignment(BAlignment alignment); inline operator BGroupLayout*(); @@ -206,6 +207,7 @@ public: inline ThisBuilder& SetExplicitMinSize(BSize size); inline ThisBuilder& SetExplicitMaxSize(BSize size); inline ThisBuilder& SetExplicitPreferredSize(BSize size); + inline ThisBuilder& SetExplicitAlignment(BAlignment alignment); inline operator BGridLayout*(); @@ -642,6 +644,15 @@ Group::SetExplicitPreferredSize(BSize size) } +template +typename Group::ThisBuilder& +Group::SetExplicitAlignment(BAlignment alignment) +{ + fLayout->SetExplicitAlignment(alignment); + return *this; +} + + template Group::operator BGroupLayout*() { @@ -955,6 +966,15 @@ Grid::SetExplicitPreferredSize(BSize size) } +template +typename Grid::ThisBuilder& +Grid::SetExplicitAlignment(BAlignment alignment) +{ + fLayout->SetExplicitAlignment(alignment); + return *this; +} + + template Grid::operator BGridLayout*() { From 095d0385780b041d07d427390be095b48ef7575c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Mon, 5 Nov 2012 13:29:52 +0100 Subject: [PATCH 30/36] Reverted hrev42962 - there is no right command key in US internatinal. * This makes the keymap behave as in every other operating system. * I don't really understand the original purpose of this change. Please enlighten me (see #4464). --- src/data/keymaps/US-International.keymap | 434 +++++++++++------------ 1 file changed, 217 insertions(+), 217 deletions(-) diff --git a/src/data/keymaps/US-International.keymap b/src/data/keymaps/US-International.keymap index 737d3279d8..4d5f7be457 100644 --- a/src/data/keymaps/US-International.keymap +++ b/src/data/keymaps/US-International.keymap @@ -37,11 +37,11 @@ NumLock = 0x22 LShift = 0x4b RShift = 0x56 LCommand = 0x5d -RCommand = 0x5f +RCommand = 0x00 LControl = 0x5c RControl = 0x60 LOption = 0x66 -ROption = 0x67 +ROption = 0x5f Menu = 0x68 # # Lock settings @@ -51,224 +51,224 @@ Menu = 0x68 # To set everything, do the following: # LockSettings = CapsLock NumLock ScrollLock # -LockSettings = +LockSettings = # Legend: # n = Normal # s = Shift # c = Control # C = CapsLock # o = Option -# Key n s c o os C Cs Co Cos -Key 0x00 = '' '' '' '' '' '' '' '' '' -Key 0x01 = 0x1b 0x1b 0x1b 0x1b 0x1b 0x1b 0x1b 0x1b 0x1b -Key 0x02 = 0x10 0x10 0x10 0x10 0x10 0x10 0x10 0x10 0x10 -Key 0x03 = 0x10 0x10 0x10 0x10 0x10 0x10 0x10 0x10 0x10 -Key 0x04 = 0x10 0x10 0x10 0x10 0x10 0x10 0x10 0x10 0x10 -Key 0x05 = 0x10 0x10 0x10 0x10 0x10 0x10 0x10 0x10 0x10 -Key 0x06 = 0x10 0x10 0x10 0x10 0x10 0x10 0x10 0x10 0x10 -Key 0x07 = 0x10 0x10 0x10 0x10 0x10 0x10 0x10 0x10 0x10 -Key 0x08 = 0x10 0x10 0x10 0x10 0x10 0x10 0x10 0x10 0x10 -Key 0x09 = 0x10 0x10 0x10 0x10 0x10 0x10 0x10 0x10 0x10 -Key 0x0a = 0x10 0x10 0x10 0x10 0x10 0x10 0x10 0x10 0x10 -Key 0x0b = 0x10 0x10 0x10 0x10 0x10 0x10 0x10 0x10 0x10 -Key 0x0c = 0x10 0x10 0x10 0x10 0x10 0x10 0x10 0x10 0x10 -Key 0x0d = 0x10 0x10 0x10 0x10 0x10 0x10 0x10 0x10 0x10 -Key 0x0e = 0x10 0x10 0x10 0x10 0x10 0x10 0x10 0x10 0x10 -Key 0x0f = 0x10 0x10 0x10 0x10 0x10 0x10 0x10 0x10 0x10 -Key 0x10 = 0x10 0x10 0x10 0x10 0x10 0x10 0x10 0x10 0x10 -Key 0x11 = '`' '~' '' '`' '~' '`' '~' '`' '~' -Key 0x12 = '1' '!' '' 0xc2a1 0xc2b9 '1' '!' 0xc2b9 0xc2a1 -Key 0x13 = '2' '@' 0x00 0xc2b2 0xc2ba '2' '@' 0xc2ba 0xc2b2 -Key 0x14 = '3' '#' '' 0xc2b3 0xc2aa '3' '#' 0xc2aa 0xc2b3 -Key 0x15 = '4' '$' '' 0xc2a4 0xc2a3 '4' '$' 0xc2a3 0xc2a4 -Key 0x16 = '5' '%' '' 0xe282ac '' '5' '%' '' 0xe282ac -Key 0x17 = '6' '^' 0x1e 0xc2bc '^' '6' '^' 0xc2bc '^' -Key 0x18 = '7' '&' '' 0xc2bd '' '7' '&' '' 0xc2bd -Key 0x19 = '8' '*' '' 0xc2be '' '8' '*' '' 0xc2be -Key 0x1a = '9' '(' '' 0xe28098 '' '9' '(' '' 0xe28098 -Key 0x1b = '0' ')' '' 0xe28099 0xc2b1 '0' ')' 0xc2b1 0xe28099 -Key 0x1c = '-' '_' 0x1f 0xc2a5 0xc2af '-' '_' 0xc2af 0xc2a5 -Key 0x1d = '=' '+' '' 0xc397 0xc3b7 '=' '+' 0xc3b7 0xc397 -Key 0x1e = 0x08 0x08 0x7f 0x08 0x08 0x08 0x08 0x08 0x08 -Key 0x1f = 0x05 0x05 0x05 0x05 0x05 0x05 0x05 0x05 0x05 -Key 0x20 = 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 -Key 0x21 = 0x0b 0x0b 0x0b 0x0b 0x0b 0x0b 0x0b 0x0b 0x0b -Key 0x22 = '' '' '' '' '' '' '' '' '' -Key 0x23 = '/' '/' '/' '/' '/' '/' '/' '/' '/' -Key 0x24 = '*' '*' '*' '*' '*' '*' '*' '*' '*' -Key 0x25 = '-' '-' '-' '-' '-' '-' '-' '-' '-' -Key 0x26 = 0x09 0x09 0x09 0x09 0x09 0x09 0x09 0x09 0x09 -Key 0x27 = 'q' 'Q' 0x11 0xc3a4 0xc384 'Q' '' 0xc384 0xc3a4 -Key 0x28 = 'w' 'W' 0x17 0xc3a5 0xc385 'W' '' 0xc385 0xc3a5 -Key 0x29 = 'e' 'E' 0x05 0xc3a9 0xc389 'E' '' 0xc389 0xc3a9 -Key 0x2a = 'r' 'R' 0x12 0xc2ae '' 'R' '' '' 0xc2ae -Key 0x2b = 't' 'T' 0x14 0xc3be 0xc39e 'T' '' 0xc39e 0xc3be -Key 0x2c = 'y' 'Y' 0x19 0xc3bc 0xc39c 'Y' '' 0xc39c 0xc3bc -Key 0x2d = 'u' 'U' 0x15 0xc3ba 0xc39a 'U' '' 0xc39a 0xc3ba -Key 0x2e = 'i' 'I' 0x09 0xc3ad 0xc38d 'I' '' 0xc38d 0xc3ad -Key 0x2f = 'o' 'O' 0x0f 0xc3b3 0xc393 'O' '' 0xc393 0xc3b3 -Key 0x30 = 'p' 'P' 0x10 0xc3b6 0xc396 'P' '' 0xc396 0xc3b6 -Key 0x31 = '[' '{' 0x1b 0xc2ab '' '[' '' '' 0xc2ab -Key 0x32 = ']' '}' 0x1d 0xc2bb '' ']' '' '' 0xc2bb -Key 0x33 = '\\' '|' 0x1c 0xc2ac 0xc2a6 '\\' '' 0xc2a6 0xc2ac -Key 0x34 = 0x7f 0x7f 0x7f 0x7f 0x7f 0x7f 0x7f 0x7f 0x7f -Key 0x35 = 0x04 0x04 0x04 0x04 0x04 0x04 0x04 0x04 0x04 -Key 0x36 = 0x0c 0x0c 0x0c 0x0c 0x0c 0x0c 0x0c 0x0c 0x0c -Key 0x37 = 0x01 '7' 0x01 0x01 '7' 0x01 '7' '7' 0x01 -Key 0x38 = 0x1e '8' 0x1e 0x1e '8' 0x1e '8' '8' 0x1e -Key 0x39 = 0x0b '9' 0x0b 0x0b '9' 0x0b '9' '9' 0x0b -Key 0x3a = '+' '+' '+' '+' '+' '+' '+' '+' '+' -Key 0x3b = '' '' '' '' '' '' '' '' '' -Key 0x3c = 'a' 'A' 0x01 0xc3a1 0xc381 'A' '' 0xc381 0xc3a1 -Key 0x3d = 's' 'S' 0x13 0xc39f 0xc2a7 'S' '' 0xc2a7 0xc39f -Key 0x3e = 'd' 'D' 0x04 0xc3b0 0xc390 'D' '' 0xc390 0xc3b0 -Key 0x3f = 'f' 'F' 0x06 '' '' 'F' '' '' '' -Key 0x40 = 'g' 'G' 0x07 '' '' 'G' '' '' '' -Key 0x41 = 'h' 'H' 0x08 '' '' 'H' '' '' '' -Key 0x42 = 'j' 'J' 0x0a '' '' 'J' '' '' '' -Key 0x43 = 'k' 'K' 0x0b '' '' 'K' '' '' '' -Key 0x44 = 'l' 'L' 0x0c 0xc3b8 0xc398 'L' '' 0xc398 0xc3b8 -Key 0x45 = ';' ':' '' 0xc2b6 0xc2b0 ';' '' 0xc2b0 0xc2b6 -Key 0x46 = '\'' '"' '' 0xc2b4 0xc2a8 '\'' '' 0xc2b4 0xc2a8 -Key 0x47 = 0x0a 0x0a 0x0a 0x0a 0x0a 0x0a 0x0a 0x0a 0x0a -Key 0x48 = 0x1c '4' 0x1c 0x1c '4' 0x1c '4' '4' 0x1c -Key 0x49 = '' '5' '' '' '5' '' '5' '5' '' -Key 0x4a = 0x1d '6' 0x1d 0x1d '6' 0x1d '6' '6' 0x1d -Key 0x4b = '' '' '' '' '' '' '' '' '' -Key 0x4c = 'z' 'Z' 0x1a 0xc3a6 0xc386 'Z' '' 0xc386 0xc3a6 -Key 0x4d = 'x' 'X' 0x18 '' '' 'X' '' '' '' -Key 0x4e = 'c' 'C' 0x03 0xc2a9 0xc2a2 'C' '' 0xc2a9 0xc2a2 -Key 0x4f = 'v' 'V' 0x16 0xe2889a '' 'V' '' '' 0xe2889a -Key 0x50 = 'b' 'B' 0x02 '' '' 'B' '' '' '' -Key 0x51 = 'n' 'N' 0x0e 0xc3b1 0xc391 'N' '' 0xc391 0xc3b1 -Key 0x52 = 'm' 'M' 0x0d 0xc2b5 '' 'M' '' '' 0xc2b5 -Key 0x53 = ',' '<' '' 0xc3a7 0xc387 ',' '' 0xc387 0xc3a7 -Key 0x54 = '.' '>' '' 0xc2b7 0xc2b8 '.' '' 0xc2b8 0xc2b7 -Key 0x55 = '/' '?' '' '' '' '/' '' '' '' -Key 0x56 = '' '' '' '' '' '' '' '' '' -Key 0x57 = 0x1e 0x1e 0x1e 0x1e 0x1e 0x1e 0x1e 0x1e 0x1e -Key 0x58 = 0x04 '1' 0x04 0x04 '1' 0x04 '1' '1' 0x04 -Key 0x59 = 0x1f '2' 0x1f 0x1f '2' 0x1f '2' '2' 0x1f -Key 0x5a = 0x0c '3' 0x0c 0x0c '3' 0x0c '3' '3' 0x0c -Key 0x5b = 0x0a 0x0a 0x0a 0x0a 0x0a 0x0a 0x0a 0x0a 0x0a -Key 0x5c = '' '' '' '' '' '' '' '' '' -Key 0x5d = '' '' '' '' '' '' '' '' '' -Key 0x5e = ' ' ' ' 0x00 ' ' '' ' ' ' ' '' ' ' -Key 0x5f = '' '' '' '' '' '' '' '' '' -Key 0x60 = '' '' '' '' '' '' '' '' '' -Key 0x61 = 0x1c 0x1c 0x1c 0x1c 0x1c 0x1c 0x1c 0x1c 0x1c -Key 0x62 = 0x1f 0x1f 0x1f 0x1f 0x1f 0x1f 0x1f 0x1f 0x1f -Key 0x63 = 0x1d 0x1d 0x1d 0x1d 0x1d 0x1d 0x1d 0x1d 0x1d -Key 0x64 = 0x05 '0' 0x05 0x05 '0' 0x05 '0' '0' 0x05 -Key 0x65 = 0x7f '.' 0x7f 0x7f '.' 0x7f '.' '.' 0x7f -Key 0x66 = '' '' '' '' '' '' '' '' '' -Key 0x67 = '' '' '' '' '' '' '' '' '' -Key 0x68 = '' '' '' '' '' '' '' '' '' -Key 0x69 = '\\' '|' 0x1c 0xc2ac 0xc2a6 '\\' '|' 0xc2a6 0xc2ac -Key 0x6a = '' '' '' '' '' '' '' '' '' -Key 0x6b = '' '' '' '' '' '' '' '' '' -Key 0x6c = '' '' '' '' '' '' '' '' '' -Key 0x6d = '' '' '' '' '' '' '' '' '' -Key 0x6e = '' '' '' '' '' '' '' '' '' -Key 0x6f = '' '' '' '' '' '' '' '' '' -Key 0x70 = '' '' '' '' '' '' '' '' '' -Key 0x71 = '' '' '' '' '' '' '' '' '' -Key 0x72 = '' '' '' '' '' '' '' '' '' -Key 0x73 = '' '' '' '' '' '' '' '' '' -Key 0x74 = '' '' '' '' '' '' '' '' '' -Key 0x75 = '' '' '' '' '' '' '' '' '' -Key 0x76 = '' '' '' '' '' '' '' '' '' -Key 0x77 = '' '' '' '' '' '' '' '' '' -Key 0x78 = '' '' '' '' '' '' '' '' '' -Key 0x79 = '' '' '' '' '' '' '' '' '' -Key 0x7a = '' '' '' '' '' '' '' '' '' -Key 0x7b = '' '' '' '' '' '' '' '' '' -Key 0x7c = '' '' '' '' '' '' '' '' '' -Key 0x7d = '' '' '' '' '' '' '' '' '' -Key 0x7e = '' '' '' '' '' '' '' '' '' -Key 0x7f = '' '' '' '' '' '' '' '' '' -Acute ' ' = 0xc2b4 -Acute 'A' = 0xc381 -Acute 'C' = 0xc387 -Acute 'E' = 0xc389 -Acute 'I' = 0xc38d -Acute 'O' = 0xc393 -Acute 'U' = 0xc39a -Acute 'Y' = 0xc39d -Acute 'a' = 0xc3a1 -Acute 'c' = 0xc3a7 -Acute 'e' = 0xc3a9 -Acute 'i' = 0xc3ad -Acute 'o' = 0xc3b3 -Acute 'u' = 0xc3ba -Acute 'y' = 0xc3bd -Acute '' = '' -AcuteTab = Option CapsLock-Option -Grave ' ' = '`' -Grave 'A' = 0xc380 -Grave 'E' = 0xc388 -Grave 'I' = 0xc38c -Grave 'O' = 0xc392 -Grave 'U' = 0xc399 -Grave 'a' = 0xc3a0 -Grave 'e' = 0xc3a8 -Grave 'i' = 0xc3ac -Grave 'o' = 0xc3b2 -Grave 'u' = 0xc3b9 -Grave '' = '' -Grave '' = '' -Grave '' = '' -Grave '' = '' -Grave '' = '' -GraveTab = Option CapsLock-Option -Circumflex ' ' = '^' -Circumflex 'A' = 0xc382 -Circumflex 'E' = 0xc38a -Circumflex 'I' = 0xc38e -Circumflex 'O' = 0xc394 -Circumflex 'U' = 0xc39b -Circumflex 'a' = 0xc3a2 -Circumflex 'e' = 0xc3aa -Circumflex 'i' = 0xc3ae -Circumflex 'o' = 0xc3b4 -Circumflex 'u' = 0xc3bb -Circumflex '' = '' -Circumflex '' = '' -Circumflex '' = '' -Circumflex '' = '' -Circumflex '' = '' -CircumflexTab = Option-Shift CapsLock-Shift-Option -Diaeresis ' ' = 0xc2a8 -Diaeresis 'A' = 0xc384 -Diaeresis 'E' = 0xc38b -Diaeresis 'I' = 0xc38f -Diaeresis 'O' = 0xc396 -Diaeresis 'U' = 0xc39c -Diaeresis 'Y' = 0xc5b8 -Diaeresis 'a' = 0xc3a4 -Diaeresis 'e' = 0xc3ab -Diaeresis 'i' = 0xc3af -Diaeresis 'o' = 0xc3b6 -Diaeresis 'u' = 0xc3bc -Diaeresis 'y' = 0xc3bf -Diaeresis '' = '' -Diaeresis '' = '' -Diaeresis '' = '' -DiaeresisTab = Option-Shift CapsLock-Shift-Option -Tilde ' ' = '~' -Tilde 'A' = 0xc383 -Tilde 'O' = 0xc395 -Tilde 'N' = 0xc391 -Tilde 'a' = 0xc3a3 -Tilde 'o' = 0xc3b5 -Tilde 'n' = 0xc3b1 -Tilde '' = '' -Tilde '' = '' -Tilde '' = '' -Tilde '' = '' -Tilde '' = '' -Tilde '' = '' -Tilde '' = '' -Tilde '' = '' -Tilde '' = '' -TildeTab = Option-Shift CapsLock-Shift-Option +# Key n s c o os C Cs Co Cos +Key 0x00 = '' '' '' '' '' '' '' '' '' +Key 0x01 = 0x1b 0x1b 0x1b 0x1b 0x1b 0x1b 0x1b 0x1b 0x1b +Key 0x02 = 0x10 0x10 0x10 0x10 0x10 0x10 0x10 0x10 0x10 +Key 0x03 = 0x10 0x10 0x10 0x10 0x10 0x10 0x10 0x10 0x10 +Key 0x04 = 0x10 0x10 0x10 0x10 0x10 0x10 0x10 0x10 0x10 +Key 0x05 = 0x10 0x10 0x10 0x10 0x10 0x10 0x10 0x10 0x10 +Key 0x06 = 0x10 0x10 0x10 0x10 0x10 0x10 0x10 0x10 0x10 +Key 0x07 = 0x10 0x10 0x10 0x10 0x10 0x10 0x10 0x10 0x10 +Key 0x08 = 0x10 0x10 0x10 0x10 0x10 0x10 0x10 0x10 0x10 +Key 0x09 = 0x10 0x10 0x10 0x10 0x10 0x10 0x10 0x10 0x10 +Key 0x0a = 0x10 0x10 0x10 0x10 0x10 0x10 0x10 0x10 0x10 +Key 0x0b = 0x10 0x10 0x10 0x10 0x10 0x10 0x10 0x10 0x10 +Key 0x0c = 0x10 0x10 0x10 0x10 0x10 0x10 0x10 0x10 0x10 +Key 0x0d = 0x10 0x10 0x10 0x10 0x10 0x10 0x10 0x10 0x10 +Key 0x0e = 0x10 0x10 0x10 0x10 0x10 0x10 0x10 0x10 0x10 +Key 0x0f = 0x10 0x10 0x10 0x10 0x10 0x10 0x10 0x10 0x10 +Key 0x10 = 0x10 0x10 0x10 0x10 0x10 0x10 0x10 0x10 0x10 +Key 0x11 = '`' '~' '' '`' '~' '`' '~' '`' '~' +Key 0x12 = '1' '!' '' 0xc2a1 0xc2b9 '1' '!' 0xc2b9 0xc2a1 +Key 0x13 = '2' '@' 0x00 0xc2b2 0xc2ba '2' '@' 0xc2ba 0xc2b2 +Key 0x14 = '3' '#' '' 0xc2b3 0xc2aa '3' '#' 0xc2aa 0xc2b3 +Key 0x15 = '4' '$' '' 0xc2a4 0xc2a3 '4' '$' 0xc2a3 0xc2a4 +Key 0x16 = '5' '%' '' 0xe282ac '' '5' '%' '' 0xe282ac +Key 0x17 = '6' '^' 0x1e 0xc2bc '^' '6' '^' 0xc2bc '^' +Key 0x18 = '7' '&' '' 0xc2bd '' '7' '&' '' 0xc2bd +Key 0x19 = '8' '*' '' 0xc2be '' '8' '*' '' 0xc2be +Key 0x1a = '9' '(' '' 0xe28098 '' '9' '(' '' 0xe28098 +Key 0x1b = '0' ')' '' 0xe28099 0xc2b1 '0' ')' 0xc2b1 0xe28099 +Key 0x1c = '-' '_' 0x1f 0xc2a5 0xc2af '-' '_' 0xc2af 0xc2a5 +Key 0x1d = '=' '+' '' 0xc397 0xc3b7 '=' '+' 0xc3b7 0xc397 +Key 0x1e = 0x08 0x08 0x7f 0x08 0x08 0x08 0x08 0x08 0x08 +Key 0x1f = 0x05 0x05 0x05 0x05 0x05 0x05 0x05 0x05 0x05 +Key 0x20 = 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 +Key 0x21 = 0x0b 0x0b 0x0b 0x0b 0x0b 0x0b 0x0b 0x0b 0x0b +Key 0x22 = '' '' '' '' '' '' '' '' '' +Key 0x23 = '/' '/' '/' '/' '/' '/' '/' '/' '/' +Key 0x24 = '*' '*' '*' '*' '*' '*' '*' '*' '*' +Key 0x25 = '-' '-' '-' '-' '-' '-' '-' '-' '-' +Key 0x26 = 0x09 0x09 0x09 0x09 0x09 0x09 0x09 0x09 0x09 +Key 0x27 = 'q' 'Q' 0x11 0xc3a4 0xc384 'Q' '' 0xc384 0xc3a4 +Key 0x28 = 'w' 'W' 0x17 0xc3a5 0xc385 'W' '' 0xc385 0xc3a5 +Key 0x29 = 'e' 'E' 0x05 0xc3a9 0xc389 'E' '' 0xc389 0xc3a9 +Key 0x2a = 'r' 'R' 0x12 0xc2ae '' 'R' '' '' 0xc2ae +Key 0x2b = 't' 'T' 0x14 0xc3be 0xc39e 'T' '' 0xc39e 0xc3be +Key 0x2c = 'y' 'Y' 0x19 0xc3bc 0xc39c 'Y' '' 0xc39c 0xc3bc +Key 0x2d = 'u' 'U' 0x15 0xc3ba 0xc39a 'U' '' 0xc39a 0xc3ba +Key 0x2e = 'i' 'I' 0x09 0xc3ad 0xc38d 'I' '' 0xc38d 0xc3ad +Key 0x2f = 'o' 'O' 0x0f 0xc3b3 0xc393 'O' '' 0xc393 0xc3b3 +Key 0x30 = 'p' 'P' 0x10 0xc3b6 0xc396 'P' '' 0xc396 0xc3b6 +Key 0x31 = '[' '{' 0x1b 0xc2ab '' '[' '' '' 0xc2ab +Key 0x32 = ']' '}' 0x1d 0xc2bb '' ']' '' '' 0xc2bb +Key 0x33 = '\\' '|' 0x1c 0xc2ac 0xc2a6 '\\' '' 0xc2a6 0xc2ac +Key 0x34 = 0x7f 0x7f 0x7f 0x7f 0x7f 0x7f 0x7f 0x7f 0x7f +Key 0x35 = 0x04 0x04 0x04 0x04 0x04 0x04 0x04 0x04 0x04 +Key 0x36 = 0x0c 0x0c 0x0c 0x0c 0x0c 0x0c 0x0c 0x0c 0x0c +Key 0x37 = 0x01 '7' 0x01 0x01 '7' 0x01 '7' '7' 0x01 +Key 0x38 = 0x1e '8' 0x1e 0x1e '8' 0x1e '8' '8' 0x1e +Key 0x39 = 0x0b '9' 0x0b 0x0b '9' 0x0b '9' '9' 0x0b +Key 0x3a = '+' '+' '+' '+' '+' '+' '+' '+' '+' +Key 0x3b = '' '' '' '' '' '' '' '' '' +Key 0x3c = 'a' 'A' 0x01 0xc3a1 0xc381 'A' '' 0xc381 0xc3a1 +Key 0x3d = 's' 'S' 0x13 0xc39f 0xc2a7 'S' '' 0xc2a7 0xc39f +Key 0x3e = 'd' 'D' 0x04 0xc3b0 0xc390 'D' '' 0xc390 0xc3b0 +Key 0x3f = 'f' 'F' 0x06 '' '' 'F' '' '' '' +Key 0x40 = 'g' 'G' 0x07 '' '' 'G' '' '' '' +Key 0x41 = 'h' 'H' 0x08 '' '' 'H' '' '' '' +Key 0x42 = 'j' 'J' 0x0a '' '' 'J' '' '' '' +Key 0x43 = 'k' 'K' 0x0b '' '' 'K' '' '' '' +Key 0x44 = 'l' 'L' 0x0c 0xc3b8 0xc398 'L' '' 0xc398 0xc3b8 +Key 0x45 = ';' ':' '' 0xc2b6 0xc2b0 ';' '' 0xc2b0 0xc2b6 +Key 0x46 = '\'' '"' '' 0xc2b4 0xc2a8 '\'' '' 0xc2b4 0xc2a8 +Key 0x47 = 0x0a 0x0a 0x0a 0x0a 0x0a 0x0a 0x0a 0x0a 0x0a +Key 0x48 = 0x1c '4' 0x1c 0x1c '4' 0x1c '4' '4' 0x1c +Key 0x49 = '' '5' '' '' '5' '' '5' '5' '' +Key 0x4a = 0x1d '6' 0x1d 0x1d '6' 0x1d '6' '6' 0x1d +Key 0x4b = '' '' '' '' '' '' '' '' '' +Key 0x4c = 'z' 'Z' 0x1a 0xc3a6 0xc386 'Z' '' 0xc386 0xc3a6 +Key 0x4d = 'x' 'X' 0x18 '' '' 'X' '' '' '' +Key 0x4e = 'c' 'C' 0x03 0xc2a9 0xc2a2 'C' '' 0xc2a9 0xc2a2 +Key 0x4f = 'v' 'V' 0x16 0xe2889a '' 'V' '' '' 0xe2889a +Key 0x50 = 'b' 'B' 0x02 '' '' 'B' '' '' '' +Key 0x51 = 'n' 'N' 0x0e 0xc3b1 0xc391 'N' '' 0xc391 0xc3b1 +Key 0x52 = 'm' 'M' 0x0d 0xc2b5 '' 'M' '' '' 0xc2b5 +Key 0x53 = ',' '<' '' 0xc3a7 0xc387 ',' '' 0xc387 0xc3a7 +Key 0x54 = '.' '>' '' 0xc2b7 0xc2b8 '.' '' 0xc2b8 0xc2b7 +Key 0x55 = '/' '?' '' '' '' '/' '' '' '' +Key 0x56 = '' '' '' '' '' '' '' '' '' +Key 0x57 = 0x1e 0x1e 0x1e 0x1e 0x1e 0x1e 0x1e 0x1e 0x1e +Key 0x58 = 0x04 '1' 0x04 0x04 '1' 0x04 '1' '1' 0x04 +Key 0x59 = 0x1f '2' 0x1f 0x1f '2' 0x1f '2' '2' 0x1f +Key 0x5a = 0x0c '3' 0x0c 0x0c '3' 0x0c '3' '3' 0x0c +Key 0x5b = 0x0a 0x0a 0x0a 0x0a 0x0a 0x0a 0x0a 0x0a 0x0a +Key 0x5c = '' '' '' '' '' '' '' '' '' +Key 0x5d = '' '' '' '' '' '' '' '' '' +Key 0x5e = ' ' ' ' 0x00 ' ' '' ' ' ' ' '' ' ' +Key 0x5f = '' '' '' '' '' '' '' '' '' +Key 0x60 = '' '' '' '' '' '' '' '' '' +Key 0x61 = 0x1c 0x1c 0x1c 0x1c 0x1c 0x1c 0x1c 0x1c 0x1c +Key 0x62 = 0x1f 0x1f 0x1f 0x1f 0x1f 0x1f 0x1f 0x1f 0x1f +Key 0x63 = 0x1d 0x1d 0x1d 0x1d 0x1d 0x1d 0x1d 0x1d 0x1d +Key 0x64 = 0x05 '0' 0x05 0x05 '0' 0x05 '0' '0' 0x05 +Key 0x65 = 0x7f '.' 0x7f 0x7f '.' 0x7f '.' '.' 0x7f +Key 0x66 = '' '' '' '' '' '' '' '' '' +Key 0x67 = '' '' '' '' '' '' '' '' '' +Key 0x68 = '' '' '' '' '' '' '' '' '' +Key 0x69 = '\\' '|' 0x1c 0xc2ac 0xc2a6 '\\' '|' 0xc2a6 0xc2ac +Key 0x6a = '' '' '' '' '' '' '' '' '' +Key 0x6b = '' '' '' '' '' '' '' '' '' +Key 0x6c = '' '' '' '' '' '' '' '' '' +Key 0x6d = '' '' '' '' '' '' '' '' '' +Key 0x6e = '' '' '' '' '' '' '' '' '' +Key 0x6f = '' '' '' '' '' '' '' '' '' +Key 0x70 = '' '' '' '' '' '' '' '' '' +Key 0x71 = '' '' '' '' '' '' '' '' '' +Key 0x72 = '' '' '' '' '' '' '' '' '' +Key 0x73 = '' '' '' '' '' '' '' '' '' +Key 0x74 = '' '' '' '' '' '' '' '' '' +Key 0x75 = '' '' '' '' '' '' '' '' '' +Key 0x76 = '' '' '' '' '' '' '' '' '' +Key 0x77 = '' '' '' '' '' '' '' '' '' +Key 0x78 = '' '' '' '' '' '' '' '' '' +Key 0x79 = '' '' '' '' '' '' '' '' '' +Key 0x7a = '' '' '' '' '' '' '' '' '' +Key 0x7b = '' '' '' '' '' '' '' '' '' +Key 0x7c = '' '' '' '' '' '' '' '' '' +Key 0x7d = '' '' '' '' '' '' '' '' '' +Key 0x7e = '' '' '' '' '' '' '' '' '' +Key 0x7f = '' '' '' '' '' '' '' '' '' +Acute ' ' = 0xc2b4 +Acute 'A' = 0xc381 +Acute 'C' = 0xc387 +Acute 'E' = 0xc389 +Acute 'I' = 0xc38d +Acute 'O' = 0xc393 +Acute 'U' = 0xc39a +Acute 'Y' = 0xc39d +Acute 'a' = 0xc3a1 +Acute 'c' = 0xc3a7 +Acute 'e' = 0xc3a9 +Acute 'i' = 0xc3ad +Acute 'o' = 0xc3b3 +Acute 'u' = 0xc3ba +Acute 'y' = 0xc3bd +Acute '' = '' +AcuteTab = Option CapsLock-Option +Grave ' ' = '`' +Grave 'A' = 0xc380 +Grave 'E' = 0xc388 +Grave 'I' = 0xc38c +Grave 'O' = 0xc392 +Grave 'U' = 0xc399 +Grave 'a' = 0xc3a0 +Grave 'e' = 0xc3a8 +Grave 'i' = 0xc3ac +Grave 'o' = 0xc3b2 +Grave 'u' = 0xc3b9 +Grave '' = '' +Grave '' = '' +Grave '' = '' +Grave '' = '' +Grave '' = '' +GraveTab = Option CapsLock-Option +Circumflex ' ' = '^' +Circumflex 'A' = 0xc382 +Circumflex 'E' = 0xc38a +Circumflex 'I' = 0xc38e +Circumflex 'O' = 0xc394 +Circumflex 'U' = 0xc39b +Circumflex 'a' = 0xc3a2 +Circumflex 'e' = 0xc3aa +Circumflex 'i' = 0xc3ae +Circumflex 'o' = 0xc3b4 +Circumflex 'u' = 0xc3bb +Circumflex '' = '' +Circumflex '' = '' +Circumflex '' = '' +Circumflex '' = '' +Circumflex '' = '' +CircumflexTab = Option-Shift CapsLock-Shift-Option +Diaeresis ' ' = 0xc2a8 +Diaeresis 'A' = 0xc384 +Diaeresis 'E' = 0xc38b +Diaeresis 'I' = 0xc38f +Diaeresis 'O' = 0xc396 +Diaeresis 'U' = 0xc39c +Diaeresis 'Y' = 0xc5b8 +Diaeresis 'a' = 0xc3a4 +Diaeresis 'e' = 0xc3ab +Diaeresis 'i' = 0xc3af +Diaeresis 'o' = 0xc3b6 +Diaeresis 'u' = 0xc3bc +Diaeresis 'y' = 0xc3bf +Diaeresis '' = '' +Diaeresis '' = '' +Diaeresis '' = '' +DiaeresisTab = Option-Shift CapsLock-Shift-Option +Tilde ' ' = '~' +Tilde 'A' = 0xc383 +Tilde 'O' = 0xc395 +Tilde 'N' = 0xc391 +Tilde 'a' = 0xc3a3 +Tilde 'o' = 0xc3b5 +Tilde 'n' = 0xc3b1 +Tilde '' = '' +Tilde '' = '' +Tilde '' = '' +Tilde '' = '' +Tilde '' = '' +Tilde '' = '' +Tilde '' = '' +Tilde '' = '' +Tilde '' = '' +TildeTab = Option-Shift CapsLock-Shift-Option From 634feff0e97e3d0e60976eb7a27938743440506b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Mon, 5 Nov 2012 13:32:51 +0100 Subject: [PATCH 31/36] Cut off the trailing spaces from the key dump. * Noticed these on the keymap changes made by John, however, I have no idea how they did get there (the keymap command doesn't use this code). --- src/add-ons/input_server/devices/keyboard/Keymap.cpp | 9 +++++---- src/preferences/keymap/Keymap.cpp | 7 ++++--- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/src/add-ons/input_server/devices/keyboard/Keymap.cpp b/src/add-ons/input_server/devices/keyboard/Keymap.cpp index 86afbe0178..f003b02c03 100644 --- a/src/add-ons/input_server/devices/keyboard/Keymap.cpp +++ b/src/add-ons/input_server/devices/keyboard/Keymap.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2004-2010, Haiku, Inc. All rights reserved. + * Copyright 2004-2012, Haiku, Inc. All rights reserved. * Distributed under the terms of the MIT License. * * Authors: @@ -23,7 +23,7 @@ static void -print_key(char* chars, int32 offset) +print_key(char* chars, int32 offset, bool last = false) { int size = chars[offset++]; @@ -53,7 +53,8 @@ print_key(char* chars, int32 offset) } } - fputs("\t", stdout); + if (!last) + fputs("\t", stdout); } @@ -91,7 +92,7 @@ Keymap::DumpKeymap() print_key(fChars, fKeys.caps_map[i]); print_key(fChars, fKeys.caps_shift_map[i]); print_key(fChars, fKeys.option_caps_map[i]); - print_key(fChars, fKeys.option_caps_shift_map[i]); + print_key(fChars, fKeys.option_caps_shift_map[i], true); fputs("\n", stdout); } } diff --git a/src/preferences/keymap/Keymap.cpp b/src/preferences/keymap/Keymap.cpp index 817d86ef2c..e2225f9be4 100644 --- a/src/preferences/keymap/Keymap.cpp +++ b/src/preferences/keymap/Keymap.cpp @@ -26,7 +26,7 @@ static const uint32 kModifierKeys = B_SHIFT_KEY | B_CAPS_LOCK | B_CONTROL_KEY static void -print_key(char *chars, int32 offset) +print_key(char *chars, int32 offset, bool last = false) { int size = chars[offset++]; @@ -53,7 +53,8 @@ print_key(char *chars, int32 offset) } } - fputs("\t", stdout); + if (!last) + fputs("\t", stdout); } @@ -110,7 +111,7 @@ Keymap::DumpKeymap() print_key(fChars, fKeys.caps_map[i]); print_key(fChars, fKeys.caps_shift_map[i]); print_key(fChars, fKeys.option_caps_map[i]); - print_key(fChars, fKeys.option_caps_shift_map[i]); + print_key(fChars, fKeys.option_caps_shift_map[i], true); fputs("\n", stdout); } } From 04434656afa98246c3c2122f710bb448afd03919 Mon Sep 17 00:00:00 2001 From: Adrien Destugues - PulkoMandy Date: Sun, 4 Nov 2012 23:52:48 +0100 Subject: [PATCH 32/36] Serial port configuration * Dynamically update the serial port list in the connection menu when devices get added or removed * Make the settings in the settings menu actually do something --- src/apps/serialconnect/SerialApp.cpp | 100 ++++++++++- src/apps/serialconnect/SerialApp.h | 6 + src/apps/serialconnect/SerialWindow.cpp | 216 ++++++++++++++++-------- src/apps/serialconnect/SerialWindow.h | 3 + 4 files changed, 256 insertions(+), 69 deletions(-) diff --git a/src/apps/serialconnect/SerialApp.cpp b/src/apps/serialconnect/SerialApp.cpp index 67a96fa929..24b7d9e7c8 100644 --- a/src/apps/serialconnect/SerialApp.cpp +++ b/src/apps/serialconnect/SerialApp.cpp @@ -37,9 +37,13 @@ void SerialApp::MessageReceived(BMessage* message) case kMsgOpenPort: { const char* portName; - message->FindString("port name", &portName); - fSerialPort.Open(portName); - release_sem(fSerialLock); + if(message->FindString("port name", &portName) == B_OK) + { + fSerialPort.Open(portName); + release_sem(fSerialLock); + } else { + fSerialPort.Close(); + } break; } case kMsgDataRead: @@ -56,6 +60,96 @@ void SerialApp::MessageReceived(BMessage* message) message->FindData("data", B_RAW_TYPE, (const void**)&bytes, &size); fSerialPort.Write(bytes, size); + break; + } + case kMsgSettings: + { + int32 baudrate; + stop_bits stopBits; + data_bits dataBits; + parity_mode parity; + uint32 flowcontrol; + + if(message->FindInt32("databits", (int32*)&dataBits) == B_OK) + fSerialPort.SetDataBits(dataBits); + + if(message->FindInt32("stopbits", (int32*)&stopBits) == B_OK) + fSerialPort.SetStopBits(stopBits); + + if(message->FindInt32("parity", (int32*)&parity) == B_OK) + fSerialPort.SetParityMode(parity); + + if(message->FindInt32("flowcontrol", (int32*)&flowcontrol) == B_OK) + fSerialPort.SetFlowControl(flowcontrol); + + if(message->FindInt32("baudrate", &baudrate) == B_OK) { + data_rate rate; + switch(baudrate) { + case 50: + rate = B_50_BPS; + break; + case 75: + rate = B_75_BPS; + break; + case 110: + rate = B_110_BPS; + break; + case 134: + rate = B_134_BPS; + break; + case 150: + rate = B_150_BPS; + break; + case 200: + rate = B_200_BPS; + break; + case 300: + rate = B_300_BPS; + break; + case 600: + rate = B_600_BPS; + break; + case 1200: + rate = B_1200_BPS; + break; + case 1800: + rate = B_1800_BPS; + break; + case 2400: + rate = B_2400_BPS; + break; + case 4800: + rate = B_4800_BPS; + break; + case 9600: + rate = B_9600_BPS; + break; + case 19200: + rate = B_19200_BPS; + break; + case 31250: + rate = B_31250_BPS; + break; + case 38400: + rate = B_38400_BPS; + break; + case 57600: + rate = B_57600_BPS; + break; + case 115200: + rate = B_115200_BPS; + break; + case 230400: + rate = B_230400_BPS; + break; + default: + rate = B_0_BPS; + break; + } + fSerialPort.SetDataRate(rate); + } + + break; } default: BApplication::MessageReceived(message); diff --git a/src/apps/serialconnect/SerialApp.h b/src/apps/serialconnect/SerialApp.h index a08069a33b..7dd7c50629 100644 --- a/src/apps/serialconnect/SerialApp.h +++ b/src/apps/serialconnect/SerialApp.h @@ -4,6 +4,10 @@ */ +#ifndef _SERIALAPP_H_ +#define _SERIALAPP_H_ + + #include #include @@ -33,5 +37,7 @@ enum messageConstants { kMsgOpenPort = 'open', kMsgDataRead = 'dare', kMsgDataWrite = 'dawr', + kMsgSettings = 'stty', }; +#endif diff --git a/src/apps/serialconnect/SerialWindow.cpp b/src/apps/serialconnect/SerialWindow.cpp index 0dafcd6ebf..ed5f030962 100644 --- a/src/apps/serialconnect/SerialWindow.cpp +++ b/src/apps/serialconnect/SerialWindow.cpp @@ -6,6 +6,8 @@ #include "SerialWindow.h" +#include + #include #include #include @@ -29,18 +31,142 @@ SerialWindow::SerialWindow() AddChild(menuBar); AddChild(fTermView); - BMenu* connectionMenu = new BMenu("Connections"); + fConnectionMenu = new BMenu("Connection"); + fConnectionMenu->SetRadioMode(true); + BMenu* editMenu = new BMenu("Edit"); BMenu* settingsMenu = new BMenu("Settings"); - menuBar->AddItem(connectionMenu); + menuBar->AddItem(fConnectionMenu); menuBar->AddItem(editMenu); menuBar->AddItem(settingsMenu); - // TODO messages - BMenu* connect = new BMenu("Connect"); - connectionMenu->AddItem(connect); + // TODO edit menu - what's in it ? + + // Configuring all this by menus may be a bit unhandy. Make a setting + // window instead ? + BMenu* baudRate = new BMenu("Baud rate"); + baudRate->SetRadioMode(true); + settingsMenu->AddItem(baudRate); + BMenu* parity = new BMenu("Parity"); + parity->SetRadioMode(true); + settingsMenu->AddItem(parity); + + BMenu* stopBits = new BMenu("Stop bits"); + stopBits->SetRadioMode(true); + settingsMenu->AddItem(stopBits); + + BMenu* flowControl = new BMenu("Flow control"); + flowControl->SetRadioMode(true); + settingsMenu->AddItem(flowControl); + + BMenu* dataBits = new BMenu("Data bits"); + dataBits->SetRadioMode(true); + settingsMenu->AddItem(dataBits); + + + BMessage* message = new BMessage(kMsgSettings); + message->AddInt32("parity", B_NO_PARITY); + BMenuItem* parityNone = new BMenuItem("None", message); + + message = new BMessage(kMsgSettings); + message->AddInt32("parity", B_ODD_PARITY); + BMenuItem* parityOdd = new BMenuItem("Odd", message); + + message = new BMessage(kMsgSettings); + message->AddInt32("parity", B_EVEN_PARITY); + BMenuItem* parityEven = new BMenuItem("Even", message); + parityNone->SetMarked(true); + + parity->AddItem(parityNone); + parity->AddItem(parityOdd); + parity->AddItem(parityEven); + parity->SetTargetForItems(be_app); + + message = new BMessage(kMsgSettings); + message->AddInt32("databits", B_DATA_BITS_7); + BMenuItem* data7 = new BMenuItem("7", message); + + message = new BMessage(kMsgSettings); + message->AddInt32("databits", B_DATA_BITS_8); + BMenuItem* data8 = new BMenuItem("8", message); + data8->SetMarked(true); + + dataBits->AddItem(data7); + dataBits->AddItem(data8); + dataBits->SetTargetForItems(be_app); + + message = new BMessage(kMsgSettings); + message->AddInt32("stopbits", B_STOP_BITS_1); + BMenuItem* stop1 = new BMenuItem("1", NULL); + + message = new BMessage(kMsgSettings); + message->AddInt32("stopbits", B_STOP_BITS_2); + BMenuItem* stop2 = new BMenuItem("2", NULL); + stop1->SetMarked(true); + + stopBits->AddItem(stop1); + stopBits->AddItem(stop2); + stopBits->SetTargetForItems(be_app); + + static const int baudrates[] = { 50, 75, 110, 134, 150, 200, 300, 600, + 1200, 1800, 2400, 4800, 9600, 19200, 31250, 38400, 57600, 115200, + 230400 + }; + + // Loop backwards to add fastest rates at top of menu + for (int i = sizeof(baudrates) / sizeof(char*); --i >= 0;) + { + message = new BMessage(kMsgSettings); + message->AddInt32("baudrate", baudrates[i]); + + char buffer[7]; + sprintf(buffer,"%d", baudrates[i]); + BMenuItem* item = new BMenuItem(buffer, message); + + if (baudrates[i] == 19200) + item->SetMarked(true); + + baudRate->AddItem(item); + } + + baudRate->SetTargetForItems(be_app); + + message = new BMessage(kMsgSettings); + message->AddInt32("flowcontrol", B_HARDWARE_CONTROL); + BMenuItem* hardware = new BMenuItem("Hardware", message); + hardware->SetMarked(true); + + message = new BMessage(kMsgSettings); + message->AddInt32("flowcontrol", B_SOFTWARE_CONTROL); + BMenuItem* software = new BMenuItem("Software", message); + + message = new BMessage(kMsgSettings); + message->AddInt32("flowcontrol", B_HARDWARE_CONTROL | B_SOFTWARE_CONTROL); + BMenuItem* both = new BMenuItem("Both", message); + + message = new BMessage(kMsgSettings); + message->AddInt32("flowcontrol", 0); + BMenuItem* noFlow = new BMenuItem("None", message); + + flowControl->AddItem(hardware); + flowControl->AddItem(software); + flowControl->AddItem(both); + flowControl->AddItem(noFlow); + flowControl->SetTargetForItems(be_app); + + CenterOnScreen(); +} + +#include + +void SerialWindow::MenusBeginning() +{ + // remove all items from the menu + while(fConnectionMenu->RemoveItem(0L)); + + // fill it with the (updated) serial port list BSerialPort serialPort; int deviceCount = serialPort.CountDevices(); @@ -52,78 +178,36 @@ SerialWindow::SerialWindow() BMessage* message = new BMessage(kMsgOpenPort); message->AddString("port name", buffer); BMenuItem* portItem = new BMenuItem(buffer, message); - - connect->AddItem(portItem); - portItem->SetTarget(be_app); + + fConnectionMenu->AddItem(portItem); } -#if SUPPORTS_MODEM - BMenuItem* connectModem = new BMenuItem( - "Connect via modem" B_UTF8_ELLIPSIS, NULL, 'M', 0); - connectionMenu->AddItem(connectModem); -#endif - BMenuItem* Disconnect = new BMenuItem("Disconnect", NULL, - 'Z', B_OPTION_KEY); - connectionMenu->AddItem(Disconnect); + if (deviceCount > 0) { + fConnectionMenu->AddSeparatorItem(); - // TODO edit menu - what's in it ? - - // Configuring all this by menus may be a bit unhandy. Make a setting - // window instead ? - BMenu* parity = new BMenu("Parity"); - settingsMenu->AddItem(parity); - BMenu* dataBits = new BMenu("Data bits"); - settingsMenu->AddItem(dataBits); - BMenu* stopBits = new BMenu("Stop bits"); - settingsMenu->AddItem(stopBits); - BMenu* baudRate = new BMenu("Baud rate"); - settingsMenu->AddItem(baudRate); - BMenu* flowControl = new BMenu("Flow control"); - settingsMenu->AddItem(flowControl); - - BMenuItem* parityNone = new BMenuItem("None", NULL); - parity->AddItem(parityNone); - BMenuItem* parityOdd = new BMenuItem("Odd", NULL); - parity->AddItem(parityOdd); - BMenuItem* parityEven = new BMenuItem("Even", NULL); - parity->AddItem(parityEven); - - BMenuItem* data7 = new BMenuItem("7", NULL); - dataBits->AddItem(data7); - BMenuItem* data8 = new BMenuItem("8", NULL); - dataBits->AddItem(data8); - - BMenuItem* stop1 = new BMenuItem("1", NULL); - stopBits->AddItem(stop1); - BMenuItem* stop2 = new BMenuItem("2", NULL); - stopBits->AddItem(stop2); - - static const char* baudrates[] = { "50", "75", "110", "134", "150", "200", - "300", "600", "1200", "1800", "2400", "4800", "9600", "19200", "31250", - "38400", "57600", "115200", "230400" - }; - - // Loop backwards to add fastest rates at top of menu - for (int i = sizeof(baudrates) / sizeof(char*); --i >= 0;) - { - BMenuItem* item = new BMenuItem(baudrates[i], NULL); - baudRate->AddItem(item); + BMenuItem* disconnect = new BMenuItem("Disconnect", + new BMessage(kMsgOpenPort), 'Z', B_OPTION_KEY); + fConnectionMenu->AddItem(disconnect); + } else { + BMenuItem* noDevices = new BMenuItem("", NULL); + noDevices->SetEnabled(false); + fConnectionMenu->AddItem(noDevices); } - - BMenuItem* rtsCts = new BMenuItem("RTS/CTS", NULL); - flowControl->AddItem(rtsCts); - BMenuItem* noFlow = new BMenuItem("None", NULL); - flowControl->AddItem(noFlow); - - CenterOnScreen(); } - void SerialWindow::MessageReceived(BMessage* message) { switch(message->what) { + case kMsgOpenPort: + { + BMenuItem* disconnectMenu; + if(message->FindPointer("source", (void**)&disconnectMenu) == B_OK) + disconnectMenu->SetMarked(false); + be_app->PostMessage(new BMessage(*message)); + break; + } case kMsgDataRead: { const char* bytes; diff --git a/src/apps/serialconnect/SerialWindow.h b/src/apps/serialconnect/SerialWindow.h index 557b0eabc1..d8f20468ba 100644 --- a/src/apps/serialconnect/SerialWindow.h +++ b/src/apps/serialconnect/SerialWindow.h @@ -7,6 +7,7 @@ #include +class BMenu; class TermView; @@ -15,10 +16,12 @@ class SerialWindow: public BWindow public: SerialWindow(); + void MenusBeginning(); void MessageReceived(BMessage* message); private: TermView* fTermView; + BMenu* fConnectionMenu; static const char* kWindowTitle; }; From 469e6cd2280c0d42e37df77f331248d29a5b5a8b Mon Sep 17 00:00:00 2001 From: Adrien Destugues - PulkoMandy Date: Mon, 5 Nov 2012 11:21:12 +0100 Subject: [PATCH 33/36] Log serial input to a file. --- src/apps/serialconnect/Jamfile | 2 +- src/apps/serialconnect/SerialApp.cpp | 53 +++++++++++++++++++++++-- src/apps/serialconnect/SerialApp.h | 6 ++- src/apps/serialconnect/SerialWindow.cpp | 44 ++++++++++++++++---- src/apps/serialconnect/SerialWindow.h | 2 + 5 files changed, 94 insertions(+), 13 deletions(-) diff --git a/src/apps/serialconnect/Jamfile b/src/apps/serialconnect/Jamfile index 20043b14bc..1d04a0c251 100644 --- a/src/apps/serialconnect/Jamfile +++ b/src/apps/serialconnect/Jamfile @@ -16,6 +16,6 @@ Application SerialConnect : state.c unicode.c vterm.c - : be device $(HAIKU_LOCALE_LIBS) $(TARGET_LIBSUPC++) + : be device tracker $(HAIKU_LOCALE_LIBS) $(TARGET_LIBSUPC++) ; diff --git a/src/apps/serialconnect/SerialApp.cpp b/src/apps/serialconnect/SerialApp.cpp index 24b7d9e7c8..3a69305371 100644 --- a/src/apps/serialconnect/SerialApp.cpp +++ b/src/apps/serialconnect/SerialApp.cpp @@ -4,16 +4,21 @@ */ -#include - #include "SerialApp.h" +#include +#include + +#include +#include +#include + #include "SerialWindow.h" SerialApp::SerialApp() - : - BApplication(SerialApp::kApplicationSignature) + : BApplication(SerialApp::kApplicationSignature) + , fLogFile(NULL) { fWindow = new SerialWindow(); @@ -24,6 +29,12 @@ SerialApp::SerialApp() } +SerialApp::~SerialApp() +{ + delete fLogFile; +} + + void SerialApp::ReadyToRun() { fWindow->Show(); @@ -51,6 +62,19 @@ void SerialApp::MessageReceived(BMessage* message) // forward the message to the window, which will display the // incoming data fWindow->PostMessage(message); + + if (fLogFile) + { + const char* bytes; + ssize_t length; + message->FindData("data", B_RAW_TYPE, (const void**)&bytes, + &length); + if(fLogFile->Write(bytes, length) != length) + { + puts("### WRITE ERROR"); + } + } + break; } case kMsgDataWrite: @@ -62,6 +86,27 @@ void SerialApp::MessageReceived(BMessage* message) fSerialPort.Write(bytes, size); break; } + case kMsgLogfile: + { + entry_ref parent; + const char* filename; + + if (message->FindRef("directory", &parent) == B_OK + && message->FindString("name", &filename) == B_OK) + { + delete fLogFile; + BDirectory directory(&parent); + fLogFile = new BFile(&directory, filename, + B_WRITE_ONLY | B_CREATE_FILE | B_OPEN_AT_END); + status_t error = fLogFile->InitCheck(); + if(error != B_OK) + { + puts(strerror(error)); + } + } else { + debugger("Invalid BMessage received"); + } + } case kMsgSettings: { int32 baudrate; diff --git a/src/apps/serialconnect/SerialApp.h b/src/apps/serialconnect/SerialApp.h index 7dd7c50629..5aa79670cc 100644 --- a/src/apps/serialconnect/SerialApp.h +++ b/src/apps/serialconnect/SerialApp.h @@ -12,6 +12,7 @@ #include +class BFile; class SerialWindow; @@ -19,6 +20,7 @@ class SerialApp: public BApplication { public: SerialApp(); + ~SerialApp(); void ReadyToRun(); void MessageReceived(BMessage* message); @@ -26,6 +28,7 @@ class SerialApp: public BApplication BSerialPort fSerialPort; sem_id fSerialLock; SerialWindow* fWindow; + BFile* fLogFile; static status_t PollSerial(void*); @@ -34,9 +37,10 @@ class SerialApp: public BApplication enum messageConstants { - kMsgOpenPort = 'open', kMsgDataRead = 'dare', kMsgDataWrite = 'dawr', + kMsgLogfile = 'logf', + kMsgOpenPort = 'open', kMsgSettings = 'stty', }; diff --git a/src/apps/serialconnect/SerialWindow.cpp b/src/apps/serialconnect/SerialWindow.cpp index ed5f030962..ccc099c5e4 100644 --- a/src/apps/serialconnect/SerialWindow.cpp +++ b/src/apps/serialconnect/SerialWindow.cpp @@ -8,6 +8,7 @@ #include +#include #include #include #include @@ -19,9 +20,9 @@ SerialWindow::SerialWindow() - : - BWindow(BRect(100, 100, 400, 400), SerialWindow::kWindowTitle, + : BWindow(BRect(100, 100, 400, 400), SerialWindow::kWindowTitle, B_DOCUMENT_WINDOW, B_QUIT_ON_WINDOW_CLOSE | B_AUTO_UPDATE_SIZE_LIMITS) + , fLogFilePanel(NULL) { SetLayout(new BGroupLayout(B_VERTICAL, 0.0f)); @@ -32,17 +33,29 @@ SerialWindow::SerialWindow() AddChild(fTermView); fConnectionMenu = new BMenu("Connection"); - fConnectionMenu->SetRadioMode(true); - - BMenu* editMenu = new BMenu("Edit"); + BMenu* fileMenu = new BMenu("File"); BMenu* settingsMenu = new BMenu("Settings"); + fConnectionMenu->SetRadioMode(true); + menuBar->AddItem(fConnectionMenu); - menuBar->AddItem(editMenu); + menuBar->AddItem(fileMenu); menuBar->AddItem(settingsMenu); // TODO edit menu - what's in it ? + //BMenu* editMenu = new BMenu("Edit"); + //menuBar->AddItem(editMenu); + BMenuItem* logFile = new BMenuItem("Log to file" B_UTF8_ELLIPSIS, + new BMessage(kMsgLogfile)); + fileMenu->AddItem(logFile); + BMenuItem* xmodemSend = new BMenuItem("X/Y/ZModem send" B_UTF8_ELLIPSIS, + NULL); + fileMenu->AddItem(xmodemSend); + BMenuItem* xmodemReceive = new BMenuItem( + "X/Y/Zmodem receive" B_UTF8_ELLIPSIS, NULL); + fileMenu->AddItem(xmodemReceive); + // Configuring all this by menus may be a bit unhandy. Make a setting // window instead ? BMenu* baudRate = new BMenu("Baud rate"); @@ -159,7 +172,13 @@ SerialWindow::SerialWindow() CenterOnScreen(); } -#include + + +SerialWindow::~SerialWindow() +{ + delete fLogFilePanel; +} + void SerialWindow::MenusBeginning() { @@ -216,6 +235,17 @@ void SerialWindow::MessageReceived(BMessage* message) fTermView->PushBytes(bytes, length); break; } + case kMsgLogfile: + { + // Let's lazy init the file panel + if(fLogFilePanel == NULL) { + fLogFilePanel = new BFilePanel(B_SAVE_PANEL, &be_app_messenger, + NULL, B_FILE_NODE, false); + fLogFilePanel->SetMessage(message); + } + fLogFilePanel->Show(); + break; + } default: BWindow::MessageReceived(message); } diff --git a/src/apps/serialconnect/SerialWindow.h b/src/apps/serialconnect/SerialWindow.h index d8f20468ba..10591f6cbe 100644 --- a/src/apps/serialconnect/SerialWindow.h +++ b/src/apps/serialconnect/SerialWindow.h @@ -15,6 +15,7 @@ class SerialWindow: public BWindow { public: SerialWindow(); + ~SerialWindow(); void MenusBeginning(); void MessageReceived(BMessage* message); @@ -22,6 +23,7 @@ class SerialWindow: public BWindow private: TermView* fTermView; BMenu* fConnectionMenu; + BFilePanel* fLogFilePanel; static const char* kWindowTitle; }; From 7e23386ae81d3e0b2053d1fc43d3d31267d516ad Mon Sep 17 00:00:00 2001 From: Adrien Destugues - PulkoMandy Date: Mon, 5 Nov 2012 11:57:24 +0100 Subject: [PATCH 34/36] Resize terminal buffer with window. Unlike in Haiku terminal, vterm does not rearrange lines wen they are wrapped. Chars outside the viewing area are just lost. --- src/apps/serialconnect/TermView.cpp | 18 +++++++++++++++--- src/apps/serialconnect/TermView.h | 1 + 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/src/apps/serialconnect/TermView.cpp b/src/apps/serialconnect/TermView.cpp index cb655251ea..d977222576 100644 --- a/src/apps/serialconnect/TermView.cpp +++ b/src/apps/serialconnect/TermView.cpp @@ -15,7 +15,7 @@ TermView::TermView() : - BView("TermView", B_WILL_DRAW) + BView("TermView", B_WILL_DRAW | B_FRAME_EVENTS) { font_height height; GetFontHeight(&height); @@ -52,6 +52,10 @@ void TermView::Draw(BRect updateRect) VTermPos pos; font_height height; GetFontHeight(&height); + + int availableRows, availableCols; + vterm_get_size(fTerm, &availableRows, &availableCols); + for (pos.row = updatedChars.start_row; pos.row <= updatedChars.end_row; pos.row++) { float x = updatedChars.start_col * fFontWidth + kBorderSpacing; @@ -60,8 +64,8 @@ void TermView::Draw(BRect updateRect) for (pos.col = updatedChars.start_col; pos.col <= updatedChars.end_col;) { - if (pos.col < 0 || pos.row < 0 || pos.col >= kDefaultWidth - || pos.row >= kDefaultHeight) { + if (pos.col < 0 || pos.row < 0 || pos.col >= availableCols + || pos.row >= availableRows) { DrawString(" "); pos.col ++; } else { @@ -102,6 +106,14 @@ void TermView::KeyDown(const char* bytes, int32 numBytes) } +void TermView::FrameResized(float width, float height) +{ + VTermRect newSize = PixelsToGlyphs(BRect(0, 0, width - 2 * kBorderSpacing, + height - 2 * kBorderSpacing)); + vterm_set_size(fTerm, newSize.end_row, newSize.end_col); +} + + void TermView::PushBytes(const char* bytes, size_t length) { vterm_push_bytes(fTerm, bytes, length); diff --git a/src/apps/serialconnect/TermView.h b/src/apps/serialconnect/TermView.h index 985863d19e..50c8c7e63d 100644 --- a/src/apps/serialconnect/TermView.h +++ b/src/apps/serialconnect/TermView.h @@ -20,6 +20,7 @@ class TermView: public BView void Draw(BRect updateRect); void GetPreferredSize(float* width, float* height); void KeyDown(const char* bytes, int32 numBytes); + void FrameResized(float width, float height); void PushBytes(const char* bytes, const size_t length); private: From d481cb73703367a949cedb2abeb4140cf0d29f0d Mon Sep 17 00:00:00 2001 From: Adrien Destugues - PulkoMandy Date: Mon, 5 Nov 2012 12:59:45 +0100 Subject: [PATCH 35/36] Fix newline handling Haiku sends '\n' when you press the enter key, but the terminal standard mandates that we use "\r\n" instead. This can be made into a setting later. --- src/apps/serialconnect/SerialApp.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/apps/serialconnect/SerialApp.cpp b/src/apps/serialconnect/SerialApp.cpp index 3a69305371..fccbc6b44c 100644 --- a/src/apps/serialconnect/SerialApp.cpp +++ b/src/apps/serialconnect/SerialApp.cpp @@ -71,7 +71,7 @@ void SerialApp::MessageReceived(BMessage* message) &length); if(fLogFile->Write(bytes, length) != length) { - puts("### WRITE ERROR"); + // TODO error handling } } @@ -83,6 +83,11 @@ void SerialApp::MessageReceived(BMessage* message) ssize_t size; message->FindData("data", B_RAW_TYPE, (const void**)&bytes, &size); + + if (bytes[0] == '\n') { + size = 2; + bytes = "\r\n"; + } fSerialPort.Write(bytes, size); break; } From 5d6ec6d03a891b68cdb52bd21430bc4f338f8773 Mon Sep 17 00:00:00 2001 From: Adrien Destugues - PulkoMandy Date: Mon, 5 Nov 2012 15:20:43 +0100 Subject: [PATCH 36/36] Handle colors. --- src/apps/serialconnect/TermView.cpp | 55 ++++++++++++++++++++++++++--- src/apps/serialconnect/TermView.h | 3 +- 2 files changed, 53 insertions(+), 5 deletions(-) diff --git a/src/apps/serialconnect/TermView.cpp b/src/apps/serialconnect/TermView.cpp index d977222576..60acc832c0 100644 --- a/src/apps/serialconnect/TermView.cpp +++ b/src/apps/serialconnect/TermView.cpp @@ -8,6 +8,8 @@ #include +#include +#include #include #include "SerialApp.h" @@ -72,6 +74,28 @@ void TermView::Draw(BRect updateRect) VTermScreenCell cell; vterm_screen_get_cell(fTermScreen, pos, &cell); + rgb_color foreground, background; + foreground.red = cell.fg.red; + foreground.green = cell.fg.green; + foreground.blue = cell.fg.blue; + background.red = cell.bg.red; + background.green = cell.bg.green; + background.blue = cell.bg.blue; + + if(cell.attrs.reverse) { + SetLowColor(foreground); + SetViewColor(foreground); + SetHighColor(background); + } else { + SetLowColor(background); + SetViewColor(background); + SetHighColor(foreground); + } + + BPoint penLocation = PenLocation(); + FillRect(BRect(penLocation.x, penLocation.y - height.ascent, + penLocation.x + cell.width * fFontWidth, penLocation.y), B_SOLID_LOW); + if (cell.chars[0] == 0) { DrawString(" "); pos.col ++; @@ -89,6 +113,14 @@ void TermView::Draw(BRect updateRect) } +void TermView::FrameResized(float width, float height) +{ + VTermRect newSize = PixelsToGlyphs(BRect(0, 0, width - 2 * kBorderSpacing, + height - 2 * kBorderSpacing)); + vterm_set_size(fTerm, newSize.end_row, newSize.end_col); +} + + void TermView::GetPreferredSize(float* width, float* height) { if (width != NULL) @@ -106,11 +138,23 @@ void TermView::KeyDown(const char* bytes, int32 numBytes) } -void TermView::FrameResized(float width, float height) +void TermView::MessageReceived(BMessage* message) { - VTermRect newSize = PixelsToGlyphs(BRect(0, 0, width - 2 * kBorderSpacing, - height - 2 * kBorderSpacing)); - vterm_set_size(fTerm, newSize.end_row, newSize.end_col); + switch(message->what) + { + case 'DATA': + { + entry_ref ref; + if(message->FindRef("refs", &ref) == B_OK) + { + // The user just dropped a file on us + // TODO send it by XMODEM or so + } + break; + } + default: + BView::MessageReceived(message); + } } @@ -120,6 +164,9 @@ void TermView::PushBytes(const char* bytes, size_t length) } +//#pragma mark - + + VTermRect TermView::PixelsToGlyphs(BRect pixels) const { pixels.OffsetBy(-kBorderSpacing, -kBorderSpacing); diff --git a/src/apps/serialconnect/TermView.h b/src/apps/serialconnect/TermView.h index 50c8c7e63d..a673489b8e 100644 --- a/src/apps/serialconnect/TermView.h +++ b/src/apps/serialconnect/TermView.h @@ -18,9 +18,10 @@ class TermView: public BView void AttachedToWindow(); void Draw(BRect updateRect); + void FrameResized(float width, float height); void GetPreferredSize(float* width, float* height); void KeyDown(const char* bytes, int32 numBytes); - void FrameResized(float width, float height); + void MessageReceived(BMessage* message); void PushBytes(const char* bytes, const size_t length); private: