uppsrc: MacOS fixes

This commit is contained in:
Mirek Fidler 2023-03-21 11:10:03 +01:00
parent ca6d5122c2
commit b2456a14bb
13 changed files with 11 additions and 28 deletions

View file

@ -231,7 +231,9 @@
enum enum
{ {
INVALID_SOCKET = -1, INVALID_SOCKET = -1,
#ifndef TCP_NODELAY // macos defines it as macro, with the same value 1
TCP_NODELAY = 1, TCP_NODELAY = 1,
#endif
SD_RECEIVE = 0, SD_RECEIVE = 0,
SD_SEND = 1, SD_SEND = 1,
SD_BOTH = 2, SD_BOTH = 2,

View file

@ -85,9 +85,9 @@ void sF128::MulPow10(int powi)
LTIMING("MulPow10"); LTIMING("MulPow10");
ASSERT(l == 0); // we can only do F64xF128 multiplication ASSERT(l == 0); // we can only do F64xF128 multiplication
const auto& pow10 = ipow10table[powi + 350]; const auto& pow10 = ipow10table[powi + 350];
uint64 hh, midh, midl; uint64 hh, midh;
l = mul64(h, pow10.h, hh); l = mul64(h, pow10.h, hh);
midl = mul64(h, pow10.l, midh); mul64(h, pow10.l, midh);
h = hh + addc64(l, midh, 0); h = hh + addc64(l, midh, 0);
exponent += pow10.exponent; exponent += pow10.exponent;
if((h & ((uint64)1 << 63)) == 0) { // renormalize if((h & ((uint64)1 << 63)) == 0) { // renormalize

View file

@ -20,18 +20,13 @@ FileSelNative& FileSelNative::AllFilesType()
} }
bool FileSelNative::Execute0(int open, const char *title) bool FileSelNative::Execute0(int open, const char *title)
{ {
path.Clear(); path.Clear();
Ctrl::ReleaseCtrlCapture(); Ctrl::ReleaseCtrlCapture();
if(!title) if(!title)
title = open ? t_("Open") : t_("Save as"); title = open ? t_("Open") : t_("Save as");
CFRef<CFStringRef> mmtitle = CFStringCreateWithCString(NULL, title, kCFStringEncodingUTF8); CFRef<CFStringRef> mmtitle = CFStringCreateWithCString(NULL, title, kCFStringEncodingUTF8);
NSWindow *window = nil;
Ctrl *win = Ctrl::GetActiveWindow();
if(win)
window = (NSWindow *)win->GetNSWindow();
if(open) { if(open) {
NSOpenPanel *panel = [NSOpenPanel openPanel]; NSOpenPanel *panel = [NSOpenPanel openPanel];
[panel setAllowsMultipleSelection: multi ? YES : NO]; [panel setAllowsMultipleSelection: multi ? YES : NO];

View file

@ -240,7 +240,6 @@ RichCaret RichTable::GetCaret(int pos, RichContext rc) const
ASSERT(pos >= 0); ASSERT(pos >= 0);
int nx = format.column.GetCount(); int nx = format.column.GetCount();
int ny = cell.GetCount(); int ny = cell.GetCount();
int ti = 0;
const TabLayout& tab = Realize(rc); const TabLayout& tab = Realize(rc);
for(int i = 0; i < ny; i++) { for(int i = 0; i < ny; i++) {
const PaintRow& pr = tab[i]; const PaintRow& pr = tab[i];
@ -252,7 +251,6 @@ RichCaret RichTable::GetCaret(int pos, RichContext rc) const
int l = cl.text.GetLength() + 1; int l = cl.text.GetLength() + 1;
if(pos < l) if(pos < l)
return cl.GetCaret(pos, pr[j].MakeRichContext(MakeRichContext(rc, pr.py)), pyy); return cl.GetCaret(pos, pr[j].MakeRichContext(MakeRichContext(rc, pr.py)), pyy);
ti += cl.text.GetTableCount();
pos -= l; pos -= l;
} }
} }

View file

@ -162,7 +162,6 @@ void RichTxt::Paint(PageDraw& pw, RichContext& rc, const PaintInfo& _pi) const
{ {
PaintInfo pi = _pi; PaintInfo pi = _pi;
int parti = 0; int parti = 0;
int pos = 0;
RichPara::Number n; RichPara::Number n;
while(rc.py < pi.bottom && parti < part.GetCount()) { while(rc.py < pi.bottom && parti < part.GetCount()) {
if(part[parti].Is<RichTable>()) { if(part[parti].Is<RichTable>()) {
@ -202,7 +201,6 @@ void RichTxt::Paint(PageDraw& pw, RichContext& rc, const PaintInfo& _pi) const
pi.highlightpara -= l; pi.highlightpara -= l;
pi.sell -= l; pi.sell -= l;
pi.selh -= l; pi.selh -= l;
pos += l;
++parti; ++parti;
} }
} }

View file

@ -47,7 +47,6 @@ void TextCompareCtrl::DoSelection(int y, bool shift)
void TextCompareCtrl::LeftDown(Point pt, dword keyflags) void TextCompareCtrl::LeftDown(Point pt, dword keyflags)
{ {
Size sz = GetSize();
DoSelection(pt.y, keyflags & K_SHIFT); DoSelection(pt.y, keyflags & K_SHIFT);
SetCapture(); SetCapture();
SetWantFocus(); SetWantFocus();

View file

@ -670,7 +670,6 @@ int AssistEditor::ToUtf8x(int line, int pos)
int AssistEditor::FromUtf8x(int line, int pos) int AssistEditor::FromUtf8x(int line, int pos)
{ // libclang treats utf-8 bytes as whole characters { // libclang treats utf-8 bytes as whole characters
if(line < GetLineCount() && GetLineLength(line) < 1000) { if(line < GetLineCount() && GetLineLength(line) < 1000) {
bool isutf8 = false;
const String& h = GetUtf8Line(line); const String& h = GetUtf8Line(line);
if(pos <= h.GetCount()) if(pos <= h.GetCount())
for(const char ch : h) for(const char ch : h)
@ -684,7 +683,6 @@ void AssistEditor::Assist(bool macros)
{ {
LTIMING("Assist"); LTIMING("Assist");
CloseAssist(); CloseAssist();
int q = GetCursor32();
assist_type.Clear(); assist_type.Clear();
assist_item.Clear(); assist_item.Clear();
include_assist = false; include_assist = false;
@ -965,7 +963,7 @@ void AssistEditor::AssistInsert()
ch++; ch++;
Remove(cl, ch - cl); Remove(cl, ch - cl);
SetCursor(cl); SetCursor(cl);
int n = Paste(ToUnicode(txt, CHARSET_WIN1250)); Paste(ToUnicode(txt, CHARSET_WIN1250));
if(param_count > 0) { if(param_count > 0) {
SetCursor(GetCursor32() - 1); SetCursor(GetCursor32() - 1);
StartParamInfo(f, cl); StartParamInfo(f, cl);

View file

@ -518,7 +518,6 @@ void ReformatDlg::Set(Stream& in)
int ii = 0; int ii = 0;
String master_id; String master_id;
for(const ClangFormat& f : clang_format) { for(const ClangFormat& f : clang_format) {
int x = 0;
String id = f.id; String id = f.id;
if(*id == ' ') if(*id == ' ')
id = master_id + ":" + TrimBoth(id); id = master_id + ":" + TrimBoth(id);

View file

@ -15,6 +15,7 @@ struct InsertImageDlg : WithInsertImageLayout<TopWindow>, Display {
bool warning = false; bool warning = false;
void Paint(Draw& w, const Rect& r, const Value& q, Color ink, Color paper, dword style) const override; void Paint(Draw& w, const Rect& r, const Value& q, Color ink, Color paper, dword style) const override;
void Paint(Draw& w) override { return TopWindow::Paint(w); } // silence clang warning
void Layout() override; void Layout() override;
void Serialize(Stream& s) override { SerializePlacement(s); s % noupp % index; } void Serialize(Stream& s) override { SerializePlacement(s); s % noupp % index; }

View file

@ -142,7 +142,6 @@ void Navigator::Navigate()
navigating = true; navigating = true;
int ii = list.GetCursor(); int ii = list.GetCursor();
if(theide && ii >= 0 && ii < litem.GetCount()) { if(theide && ii >= 0 && ii < litem.GetCount()) {
int ln = GetCurrentLine() + 1;
const NavItem& m = *litem[ii]; const NavItem& m = *litem[ii];
if(m.kind == KIND_NEST) { if(m.kind == KIND_NEST) {
String h = m.pretty; String h = m.pretty;
@ -311,8 +310,6 @@ void Navigator::Search()
sortitems.Check(sorting); sortitems.Check(sorting);
String s = TrimBoth(~search); String s = TrimBoth(~search);
String search_name, search_nest; String search_name, search_nest;
bool wholeclass = false;
bool both = false;
navigator_global = false; navigator_global = false;
if(s.Find('.') >= 0) { if(s.Find('.') >= 0) {
Vector<String> h = Split((String)~search, '.'); Vector<String> h = Split((String)~search, '.');
@ -323,12 +320,9 @@ void Navigator::Search()
if(h.GetCount()) if(h.GetCount())
search_nest = Join(h, "::"); search_nest = Join(h, "::");
} }
wholeclass = *s == '.' && search_nest.GetCount();
} }
else { else
search_name = ~search; search_name = ~search;
both = true;
}
s = Join(Split(s, '.'), "::") + (s.EndsWith(".") ? "::" : ""); s = Join(Split(s, '.'), "::") + (s.EndsWith(".") ? "::" : "");
int lineno = StrInt(s); int lineno = StrInt(s);
nitem.Clear(); nitem.Clear();
@ -348,7 +342,6 @@ void Navigator::Search()
} }
else else
if(IsNull(s) && !sorting) { if(IsNull(s) && !sorting) {
bool sch = GetFileExt(theide->editfile) == ".sch";
Ide *theide = TheIde(); Ide *theide = TheIde();
if(theide) if(theide)
for(const AnnotationItem& m : theide->editor.annotations) { for(const AnnotationItem& m : theide->editor.annotations) {

View file

@ -179,7 +179,6 @@ void Indexer::IndexerThread()
Clang clang; Clang clang;
clang_CXIndex_setGlobalOptions(clang.index, CXGlobalOpt_ThreadBackgroundPriorityForIndexing); clang_CXIndex_setGlobalOptions(clang.index, CXGlobalOpt_ThreadBackgroundPriorityForIndexing);
int tm0 = msecs(); int tm0 = msecs();
bool was_job = false; // for diagnostics
++running_indexers; ++running_indexers;
while(!Thread::IsShutdownThreads()) { while(!Thread::IsShutdownThreads()) {
Job job; Job job;
@ -190,7 +189,6 @@ void Indexer::IndexerThread()
job = jobs[jobi++]; job = jobs[jobi++];
else else
break; break;
was_job = true;
} }
if(Thread::IsShutdownThreads()) if(Thread::IsShutdownThreads())

View file

@ -5,6 +5,7 @@
//#BLITZ_PROHIBIT //#BLITZ_PROHIBIT
#ifdef PLATFORM_WIN32
const char umacros[] = const char umacros[] =
R"(#define CHECK_GRID(g) R"(#define CHECK_GRID(g)
#define CHECK_MATRIX(g) #define CHECK_MATRIX(g)
@ -816,6 +817,8 @@ R"(#define CHECK_GRID(g)
#define _stdcall __attribute__((__stdcall__)) #define _stdcall __attribute__((__stdcall__))
#define _thiscall __attribute__((__thiscall__)))"; #define _thiscall __attribute__((__thiscall__)))";
#endif
String RedefineMacros() String RedefineMacros()
{ {
String cmdline; String cmdline;

View file

@ -633,7 +633,6 @@ struct IndexerProgress : ImageMaker {
void Ide::SyncClang() void Ide::SyncClang()
{ {
Vector<Color> a; Vector<Color> a;
Color display_ink = Null;
int phase = msecs() / 30; // TODO: Use phase int phase = msecs() / 30; // TODO: Use phase
auto AnimColor = [](int animator) { auto AnimColor = [](int animator) {
return Blend(IsDarkTheme() ? GrayColor(70) : SColorLtFace(), Color(198, 170, 0), animator); return Blend(IsDarkTheme() ? GrayColor(70) : SColorLtFace(), Color(198, 170, 0), animator);