diff --git a/uppsrc/Core/Core.h b/uppsrc/Core/Core.h index 4f6615b5d..fea93088f 100644 --- a/uppsrc/Core/Core.h +++ b/uppsrc/Core/Core.h @@ -58,6 +58,7 @@ #ifdef flagSOLARIS #define PLATFORM_SOLARIS #define PLATFORM_POSIX + #define __NOASSEMBLY__ #ifdef flagGUI #define PLATFORM_X11 #endif diff --git a/uppsrc/Core/Cpu.cpp b/uppsrc/Core/Cpu.cpp index 52707b2fb..3cd9888ae 100644 --- a/uppsrc/Core/Cpu.cpp +++ b/uppsrc/Core/Cpu.cpp @@ -81,7 +81,7 @@ int CPU_Cores() n += !!(sa & (1 << i)); #endif #elif defined(PLATFORM_POSIX) -#ifdef PLATFORM_FREEBSD +#if defined(PLATFORM_FREEBSD) || defined(PLATFORM_SOLARIS) n = minmax((int)sysconf(_SC_NPROCESSORS_ONLN), 1, 256); #else n = minmax(get_nprocs(), 1, 256); diff --git a/uppsrc/Core/dli.h b/uppsrc/Core/dli.h index 2608bd64a..b7e13f407 100644 --- a/uppsrc/Core/dli.h +++ b/uppsrc/Core/dli.h @@ -1,4 +1,4 @@ -#pragma BLITZ_APPROVE +//#BLITZ_APPROVE #define DLISTR__(s) #s #define DLISTR_(s) DLISTR__(s) diff --git a/uppsrc/Core/sheap.cpp b/uppsrc/Core/sheap.cpp index fd90255d2..dfb1b2432 100644 --- a/uppsrc/Core/sheap.cpp +++ b/uppsrc/Core/sheap.cpp @@ -305,7 +305,7 @@ void Heap::Free48(void *ptr) } Heap::Page dummy; -#define DI { 0, 0, 0, 0, &dummy, &dummy } +#define DI { { 0, 0, 0, 0, &dummy, &dummy } } thread__ Heap heap = { { DI, DI, DI, DI, DI, DI, DI, DI, DI, DI, DI, DI, DI, DI, DI, DI, DI, DI } diff --git a/uppsrc/Core/srcdoc.tpp/Decisions$en-us.tpp b/uppsrc/Core/srcdoc.tpp/Decisions$en-us.tpp index 8b47f1f80..5ebab0737 100644 --- a/uppsrc/Core/srcdoc.tpp/Decisions$en-us.tpp +++ b/uppsrc/Core/srcdoc.tpp/Decisions$en-us.tpp @@ -1,11 +1,11 @@ TITLE("Design decisions and tradeoffs") COMPRESSED -120,156,133,86,107,111,27,199,21,253,43,131,200,9,36,121,73,236,188,246,65,162,69,12,41,40,130,198,177,17,215,205,7,65,40,135,187,67,114,234,125,48,51,187,146,153,162,254,237,61,119,118,169,8,181,138,90,48,41,174,230,190,206,227,14,239,4,123,245,42,77,210,139,244,255,252,91,221,218,157,25,155,225,254,174,17,69,177,118,121,170,214,134,231,235,119,229,250,203,151,47,203,178,20,107,74,197,145,138,167,74,114,193,185,74,83,37,114,174,203,180,212,5,47,82,153,43,161,243,84,175,142,198,155,246,254,206,20,114,125,253,75,134,40,145,232,11,201,37,79,121,38,20,78,165,50,21,138,11,205,139,66,241,92,23,178,204,178,85,101,142,131,235,187,251,187,45,197,81,49,137,176,52,47,50,197,17,164,180,144,185,86,8,86,138,115,252,206,117,158,229,249,106,112,67,99,239,239,28,117,189,229,89,190,54,74,80,215,55,148,65,37,217,5,218,20,57,82,40,161,50,37,11,33,121,33,68,86,74,85,42,244,207,197,202,13,22,221,110,17,70,161,20,166,81,88, -105,197,37,128,81,185,150,56,150,227,93,165,37,23,168,94,164,90,163,176,253,124,70,139,128,162,184,12,229,68,174,233,116,161,10,46,243,66,40,145,9,52,144,230,152,150,170,235,85,109,67,133,56,41,248,122,64,75,235,155,239,245,154,35,56,79,242,11,145,150,169,200,242,18,5,209,44,6,151,101,201,101,129,130,138,235,148,203,85,213,215,24,118,43,116,42,99,197,2,124,100,200,28,177,209,25,71,195,66,22,40,153,115,41,241,170,85,145,175,130,37,70,134,222,223,223,93,127,127,153,46,211,165,208,250,138,194,75,132,23,82,73,169,178,82,241,84,162,12,114,40,194,43,75,193,41,215,162,88,109,77,64,205,65,17,184,17,85,78,130,2,1,178,208,18,165,51,188,128,92,12,40,129,141,40,85,33,101,145,174,170,198,132,240,12,160,107,26,146,243,132,243,139,156,112,213,82,168,146,192,145,2,0,139,76,151,28,8,235,76,165,98,229,237,111,163,243,182,181,29,32,118,208,200,250,76,207,172,71,52,51,233,81,36,92,64,145,58,203,82,194,75,67,21,66,106, -0,158,242,66,161,35,252,128,226,97,150,228,246,143,25,100,194,229,69,41,148,68,39,165,82,64,0,9,120,201,57,79,11,252,96,50,224,18,181,193,103,117,61,23,22,87,9,87,23,57,180,12,166,74,69,229,75,73,248,9,192,47,178,84,131,7,49,133,11,66,93,188,2,238,92,20,244,63,34,207,117,194,97,10,180,200,181,198,220,18,80,139,2,179,107,96,47,163,206,121,94,172,126,182,143,225,214,12,118,22,204,245,205,171,73,105,60,75,120,118,145,82,188,46,74,16,200,21,225,39,149,42,69,41,165,22,165,150,89,10,28,195,228,105,10,38,95,69,79,62,37,201,19,158,195,97,152,85,107,76,31,195,48,121,206,169,21,81,148,25,161,48,39,217,44,26,215,81,31,80,198,122,18,195,245,205,107,206,115,74,84,192,48,69,145,165,178,4,24,192,32,213,80,58,182,66,1,162,193,179,128,13,104,45,84,159,204,222,110,22,179,101,255,245,143,127,127,251,195,207,139,143,31,216,93,16,107,118,107,131,219,119,172,182,149,11,216,3,129,153,174,102,131,55,53,34, -250,221,46,124,119,127,23,210,181,131,15,214,91,41,215,239,210,53,123,51,176,225,96,89,219,147,80,18,246,104,89,24,124,223,237,155,19,219,153,135,222,227,163,25,92,197,208,249,39,215,237,89,191,99,31,55,175,55,175,217,220,74,88,178,31,119,172,235,135,3,253,213,54,193,38,204,13,172,53,159,108,152,79,154,227,49,176,96,155,221,102,81,245,221,96,128,65,205,46,135,126,111,81,217,179,71,55,28,88,56,5,240,76,217,151,141,57,197,190,151,174,109,216,206,53,54,92,197,207,166,9,61,107,199,234,128,198,112,216,179,161,103,77,111,106,230,58,246,147,235,198,207,236,242,159,99,24,88,213,183,144,42,205,97,60,134,115,45,26,161,174,127,237,125,61,23,195,176,236,175,183,63,48,178,37,158,225,15,155,197,209,247,149,13,161,247,87,75,246,225,128,4,53,219,142,174,169,3,48,65,54,215,30,155,104,38,60,111,49,2,240,65,125,60,245,253,131,157,78,206,181,28,17,176,29,247,192,180,182,203,23,32,191,121,255,145,29,76,160,248,173,101,214,69,20,26, -55,128,209,205,194,118,181,51,29,3,240,91,183,127,250,120,105,63,247,196,130,241,213,1,134,168,134,17,138,98,52,37,144,103,97,60,30,123,143,206,174,18,170,190,107,204,192,164,216,44,182,68,4,154,160,108,120,158,169,103,143,38,32,220,239,182,223,93,186,110,184,98,127,222,252,137,41,208,114,64,176,11,12,203,99,136,24,118,181,241,53,48,185,25,189,199,248,52,183,13,132,2,141,241,117,63,14,171,51,97,111,222,222,102,10,111,191,188,141,212,189,239,129,225,251,155,255,5,6,29,33,214,192,181,143,73,226,64,68,13,32,154,135,99,111,129,179,217,54,22,45,250,209,178,29,102,50,221,137,237,171,138,29,49,48,62,183,49,209,219,15,127,191,153,100,71,204,53,205,213,75,85,127,181,209,36,245,84,2,158,233,81,21,37,131,219,58,48,113,34,193,108,190,233,199,129,124,179,89,180,182,237,253,105,243,13,179,159,43,27,175,216,201,90,222,86,232,202,159,162,7,158,196,222,184,202,208,25,182,239,73,122,227,64,217,166,20,209,27,129,180,116,98,71,15,220, -67,116,159,245,30,227,64,60,1,142,154,76,107,125,235,58,108,45,248,235,111,7,240,241,68,201,209,155,125,27,45,9,200,251,102,140,149,54,11,212,241,104,239,104,189,179,93,101,233,252,68,229,51,54,161,234,122,178,82,215,245,39,242,43,134,55,96,208,66,194,190,223,194,61,29,122,96,7,18,60,157,67,112,69,103,7,18,170,183,141,3,1,103,254,151,236,13,12,153,64,77,240,220,153,129,48,233,234,193,249,97,52,205,60,52,158,53,13,236,27,79,238,188,181,191,91,24,23,213,183,118,71,184,255,23,204,152,176,7,207,45,171,65,51,177,3,207,117,193,161,197,35,161,19,30,1,49,122,135,34,251,174,131,244,192,161,11,1,103,1,66,61,125,3,155,21,117,60,225,165,195,62,27,43,220,220,127,248,197,52,13,4,25,169,31,14,190,127,124,78,43,124,50,17,121,73,196,64,149,45,224,245,214,4,188,125,125,126,130,234,209,132,175,134,64,225,218,209,145,171,153,192,198,181,110,152,116,17,241,136,136,182,144,79,92,96,187,145,44,68,24,163,20,72,127,65, -179,111,205,103,215,142,45,235,198,118,11,159,64,83,118,218,72,177,105,242,194,211,110,62,175,89,204,12,115,87,205,88,19,217,127,249,248,227,83,72,130,126,62,217,103,185,48,86,204,115,235,251,227,79,46,96,33,160,103,113,183,97,146,179,123,32,203,25,246,195,221,183,105,186,72,83,134,111,12,42,79,240,37,37,201,84,190,188,127,161,89,170,133,4,1,117,97,89,160,102,113,9,213,4,5,52,89,147,47,136,136,214,98,183,157,250,241,172,178,154,22,124,51,56,220,111,115,68,76,20,47,16,244,16,215,251,24,160,24,90,191,125,119,78,76,196,64,248,113,5,196,243,211,62,105,199,142,156,56,239,186,158,214,108,128,52,77,220,211,30,158,176,16,205,37,86,193,126,36,213,15,196,82,139,59,169,39,65,225,146,193,221,103,118,54,174,153,71,115,122,113,143,76,112,63,205,67,189,189,251,176,89,192,184,164,215,71,87,227,142,139,14,182,241,210,56,11,137,150,215,48,187,250,153,5,167,243,81,240,126,103,42,27,55,117,195,122,72,173,133,155,40,202,155,163,171, -33,243,7,219,244,71,98,114,74,222,208,0,88,43,88,148,166,27,206,101,206,59,32,150,194,8,243,50,136,119,40,78,184,233,14,165,171,250,172,27,143,21,136,171,112,118,243,146,189,235,226,126,138,216,97,125,116,117,194,110,14,166,133,138,144,62,224,11,65,71,194,154,47,239,121,12,64,49,141,223,244,253,167,205,119,59,107,155,4,87,46,37,242,113,47,153,249,178,35,206,42,235,30,226,86,175,221,14,88,199,213,69,115,226,222,35,52,125,4,29,223,108,238,255,3,174,207,47,212, +120,156,133,86,107,111,27,199,21,253,43,131,200,9,36,121,73,236,188,246,65,162,69,12,41,40,130,198,177,17,215,205,7,65,45,135,187,67,114,234,125,176,51,187,150,152,162,254,237,61,119,118,169,8,181,138,90,48,41,174,230,190,206,227,14,239,4,123,245,42,77,210,139,244,255,252,91,221,218,157,25,155,225,254,174,17,69,177,118,121,170,214,134,231,235,119,229,250,203,151,47,203,178,20,107,74,197,145,138,167,74,114,193,185,74,83,37,114,174,203,180,212,5,47,82,153,43,161,243,84,175,142,198,155,246,254,206,20,114,125,253,75,134,40,145,232,11,201,37,79,121,38,20,78,165,50,21,138,11,205,139,66,241,92,23,178,204,178,85,101,142,131,235,187,251,187,45,197,81,49,137,176,52,47,50,197,17,164,180,144,185,86,8,86,138,115,252,206,117,158,229,249,106,112,67,99,239,239,28,117,189,229,89,190,54,74,80,215,55,148,65,37,217,5,218,20,57,82,40,161,50,37,11,33,121,33,68,86,74,85,42,244,207,197,202,13,22,221,110,17,70,161,20,166,81,88, +105,197,37,128,81,185,150,56,150,227,93,165,37,23,168,94,164,90,163,176,125,60,163,69,64,81,92,134,114,34,215,116,186,80,5,151,121,33,148,200,4,26,72,115,76,75,213,245,170,182,161,66,156,20,124,61,160,165,245,205,247,122,205,17,156,39,249,133,72,203,84,100,121,137,130,104,22,131,203,178,228,178,64,65,197,117,202,229,170,234,107,12,187,21,58,149,177,98,1,62,50,100,142,216,232,140,163,97,33,11,148,204,185,148,120,213,170,200,87,193,18,35,67,239,239,239,174,191,191,76,151,233,82,104,125,69,225,37,194,11,169,164,84,89,169,120,42,81,6,57,20,225,149,165,224,148,107,81,172,182,38,160,230,160,8,220,136,42,39,65,129,0,89,104,137,210,25,94,64,46,6,148,192,70,148,170,144,178,72,87,85,99,66,120,6,208,53,13,201,121,194,249,69,78,184,106,41,84,73,224,72,1,128,69,166,75,14,132,117,166,82,177,242,246,159,163,243,182,181,29,32,118,208,200,250,76,207,172,71,52,51,233,81,36,92,64,145,58,203,82,194,75,67,21,66,106, +0,158,242,66,161,35,252,128,226,97,150,228,246,247,25,100,194,229,69,41,148,68,39,165,82,64,0,9,120,201,57,79,11,252,96,50,224,18,181,193,103,117,61,23,22,87,9,87,23,57,180,12,166,74,69,229,75,73,248,9,192,47,178,84,131,7,49,133,11,66,93,188,2,238,92,20,244,63,34,207,117,194,97,10,180,200,181,198,220,18,80,139,2,179,107,96,47,163,206,121,94,172,126,182,15,225,214,12,118,22,204,245,205,171,73,105,60,75,120,118,145,82,188,46,74,16,200,21,225,39,149,42,69,41,165,22,165,150,89,10,28,195,228,105,10,38,95,69,79,62,37,201,19,158,195,97,152,85,107,76,31,195,48,121,206,169,21,81,148,25,161,48,39,217,44,26,215,81,31,80,198,122,18,195,245,205,107,206,115,74,84,192,48,69,145,165,178,4,24,192,32,213,80,58,182,66,1,162,193,179,128,13,104,45,84,159,204,222,110,22,179,101,255,245,247,127,127,251,195,207,139,143,31,216,93,16,107,118,107,131,219,119,172,182,149,11,216,3,129,153,174,102,131,55,53,34, +250,221,46,124,119,127,23,210,181,131,15,214,91,41,215,239,210,53,123,51,176,225,96,89,219,147,80,18,246,96,89,24,124,223,237,155,19,219,153,207,189,199,71,51,184,138,161,243,79,174,219,179,126,199,62,110,94,111,94,179,185,149,176,100,63,238,88,215,15,7,250,171,109,130,77,152,27,88,107,62,217,48,159,52,199,99,96,193,54,187,205,162,234,187,193,0,131,154,93,14,253,222,162,178,103,15,110,56,176,112,10,224,153,178,47,27,115,138,125,47,93,219,176,157,107,108,184,138,159,77,19,122,214,142,213,1,141,225,176,103,67,207,154,222,212,204,117,236,39,215,141,143,236,242,31,99,24,88,213,183,144,42,205,97,60,134,115,45,26,161,174,127,237,125,61,23,195,176,236,207,183,63,48,178,37,158,225,15,155,197,209,247,149,13,161,247,87,75,246,225,128,4,53,219,142,174,169,3,48,65,54,215,30,155,104,38,60,111,49,2,240,65,125,60,245,253,103,59,157,156,107,57,34,96,59,238,129,105,109,151,47,64,126,243,254,35,59,152,64,241,91,203,172,139,40,52, +110,0,163,155,133,237,106,103,58,6,224,183,110,255,244,241,210,62,246,196,130,241,213,1,134,168,134,17,138,98,52,37,144,103,97,60,30,123,143,206,174,18,170,190,107,204,192,164,216,44,182,68,4,154,160,108,120,158,169,103,143,38,32,220,111,182,223,93,186,110,184,98,127,220,252,129,41,208,114,64,176,11,12,203,99,136,24,118,181,241,53,48,185,25,189,199,248,52,183,13,132,2,141,241,117,63,14,171,51,97,111,222,222,102,10,111,191,188,141,212,189,239,129,225,251,155,255,5,6,29,33,214,192,181,143,73,226,64,68,13,32,154,135,99,111,129,179,217,54,22,45,250,209,178,29,102,50,221,137,237,171,138,29,49,48,62,183,49,209,219,15,127,189,153,100,71,204,53,205,213,75,85,127,181,209,36,245,84,2,158,233,81,21,37,131,219,58,48,113,34,193,108,190,233,199,129,124,179,89,180,182,237,253,105,243,13,179,143,149,141,87,236,100,45,111,43,116,229,79,209,3,79,98,111,92,101,232,12,219,247,36,189,113,160,108,83,138,232,141,64,90,58,177,163,7,238, +33,186,207,122,143,113,32,158,0,71,77,166,181,190,117,29,182,22,252,245,151,3,248,120,162,228,232,205,190,141,150,4,228,125,51,198,74,155,5,234,120,180,119,180,222,217,174,178,116,126,162,242,25,155,80,117,61,89,169,235,250,19,249,21,195,27,48,104,33,97,223,111,225,158,14,61,176,3,9,158,206,33,184,162,179,3,9,213,219,198,129,128,51,255,75,246,6,134,76,160,38,120,238,204,64,152,116,245,217,249,97,52,205,60,52,158,53,13,236,27,79,238,188,181,191,89,24,23,213,183,118,71,184,255,23,204,152,176,7,207,45,171,65,51,177,3,207,117,193,161,197,35,161,19,30,0,49,122,135,34,251,174,131,244,192,161,11,1,103,1,66,61,125,3,155,21,117,60,225,165,195,62,27,43,220,220,191,251,197,52,13,4,25,169,31,14,190,127,120,78,43,124,50,17,121,73,196,64,149,45,224,245,214,4,188,125,125,126,130,234,193,132,175,134,64,225,218,209,145,171,153,192,198,181,110,152,116,17,241,136,136,182,144,79,92,96,187,145,44,68,24,163,20,72,127,65, +179,111,205,163,107,199,150,117,99,187,133,79,160,41,59,109,164,216,52,121,225,105,55,159,215,44,102,134,185,171,102,172,137,236,63,125,252,241,41,36,65,63,159,236,179,92,24,43,230,185,245,253,241,39,23,176,16,208,179,216,252,237,110,195,36,103,247,192,150,51,108,136,187,111,211,116,145,166,12,223,25,84,158,224,107,74,146,169,124,121,255,66,187,84,13,41,2,42,195,180,192,205,226,26,170,9,12,168,178,38,103,16,21,173,197,118,59,245,227,89,103,53,173,248,102,112,184,225,230,136,152,40,94,33,232,33,46,248,49,64,51,180,128,251,238,156,152,168,129,244,227,18,136,231,167,141,210,142,29,121,113,222,118,61,45,218,0,113,154,184,169,61,92,97,33,155,75,44,131,253,72,186,31,136,167,22,183,82,79,146,194,53,131,219,207,236,108,92,52,15,230,244,226,38,153,0,127,154,135,122,123,247,97,179,128,117,73,177,15,174,198,45,23,61,108,227,181,113,150,18,173,175,97,246,245,51,19,78,231,163,228,253,206,84,54,238,234,134,245,16,91,11,63,81,148,55, +71,87,67,232,159,109,211,31,137,203,41,121,67,3,96,177,96,85,154,110,56,151,57,111,129,88,10,35,204,235,32,222,162,56,225,166,91,148,46,235,179,114,60,150,32,46,195,217,207,75,246,174,139,27,42,98,135,5,210,213,9,187,57,152,22,58,66,250,128,175,4,29,73,107,190,190,231,49,0,197,52,126,211,247,159,54,223,237,172,109,18,92,186,148,200,199,205,100,230,235,142,56,171,172,251,28,247,122,237,118,192,58,46,47,154,19,55,31,161,233,103,208,217,253,127,0,51,64,48,144, diff --git a/uppsrc/Core/srcdoc.tpp/all.i b/uppsrc/Core/srcdoc.tpp/all.i index c5ef6af36..013c0a0f5 100644 --- a/uppsrc/Core/srcdoc.tpp/all.i +++ b/uppsrc/Core/srcdoc.tpp/all.i @@ -1,7 +1,31 @@ +TOPIC("BRC$en-us") +#include "BRC$en-us.tpp" +END_TOPIC + +TOPIC("Caveats$en-us") +#include "Caveats$en-us.tpp" +END_TOPIC + +TOPIC("Charset$en-us") +#include "Charset$en-us.tpp" +END_TOPIC + TOPIC("Configuration$en-us") #include "Configuration$en-us.tpp" END_TOPIC +TOPIC("CoreTutorial$en-us") +#include "CoreTutorial$en-us.tpp" +END_TOPIC + +TOPIC("Decisions$en-us") +#include "Decisions$en-us.tpp" +END_TOPIC + +TOPIC("DLI$en-us") +#include "DLI$en-us.tpp" +END_TOPIC + TOPIC("i18n$en-us") #include "i18n$en-us.tpp" END_TOPIC @@ -18,6 +42,14 @@ TOPIC("NTLvsSTL$en-us") #include "NTLvsSTL$en-us.tpp" END_TOPIC +TOPIC("Packages$en-us") +#include "Packages$en-us.tpp" +END_TOPIC + +TOPIC("PickTypes$en-us") +#include "PickTypes$en-us.tpp" +END_TOPIC + TOPIC("pick_$en-us") #include "pick_$en-us.tpp" END_TOPIC @@ -26,47 +58,15 @@ TOPIC("std$en-us") #include "std$en-us.tpp" END_TOPIC -TOPIC("UserValue$en-us") -#include "UserValue$en-us.tpp" -END_TOPIC - -TOPIC("PickTypes$en-us") -#include "PickTypes$en-us.tpp" -END_TOPIC - -TOPIC("Decisions$en-us") -#include "Decisions$en-us.tpp" -END_TOPIC - -TOPIC("Charset$en-us") -#include "Charset$en-us.tpp" -END_TOPIC - -TOPIC("BRC$en-us") -#include "BRC$en-us.tpp" -END_TOPIC - -TOPIC("DLI$en-us") -#include "DLI$en-us.tpp" -END_TOPIC - -TOPIC("Packages$en-us") -#include "Packages$en-us.tpp" +TOPIC("Translating$en-us") +#include "Translating$en-us.tpp" END_TOPIC TOPIC("Tutorial$en-us") #include "Tutorial$en-us.tpp" END_TOPIC -TOPIC("CoreTutorial$en-us") -#include "CoreTutorial$en-us.tpp" -END_TOPIC - -TOPIC("Caveats$en-us") -#include "Caveats$en-us.tpp" -END_TOPIC - -TOPIC("Translating$en-us") -#include "Translating$en-us.tpp" +TOPIC("UserValue$en-us") +#include "UserValue$en-us.tpp" END_TOPIC diff --git a/uppsrc/CtrlCore/X11App.cpp b/uppsrc/CtrlCore/X11App.cpp index c82877017..b6ca44a50 100644 --- a/uppsrc/CtrlCore/X11App.cpp +++ b/uppsrc/CtrlCore/X11App.cpp @@ -178,6 +178,9 @@ static void sPanicMessageBox(const char *title, const char *text) XFreeFont(display, font_info); XFreeGC(display, gc); XCloseDisplay(display); + #ifdef _DEBUG + __BREAK__; + #endif return; case Expose: int y = 20; diff --git a/uppsrc/CtrlCore/X11DHCtrl.cpp b/uppsrc/CtrlCore/X11DHCtrl.cpp index 39742cd70..f6c56aa3f 100644 --- a/uppsrc/CtrlCore/X11DHCtrl.cpp +++ b/uppsrc/CtrlCore/X11DHCtrl.cpp @@ -294,9 +294,9 @@ void DHCtrl::Terminate(void) // State handler void DHCtrl::State(int reason) { - Window dummy; - int x, y; - unsigned int width, height, border, depth; +// Window dummy; +// int x, y; +// unsigned int width, height, border, depth; Rect r; // No handling if in error state diff --git a/uppsrc/CtrlCore/X11DnD.cpp b/uppsrc/CtrlCore/X11DnD.cpp index 6bc883dd4..e19a58c7a 100644 --- a/uppsrc/CtrlCore/X11DnD.cpp +++ b/uppsrc/CtrlCore/X11DnD.cpp @@ -136,14 +136,13 @@ void DnDLoop::Sync() XSendEvent(Xdisplay, target, XFalse, 0, &e); XFlush(Xdisplay); Xdnd_waiting_status = true; - int timeout = GetTickCount() + 200; + dword timeout = GetTickCount(); LLOG("Waiting for XdndStatus"); - TimeStop tm; - while(Xdnd_waiting_status && GetTickCount() < timeout) { + while(Xdnd_waiting_status && GetTickCount() - timeout < 200) { GuiSleep(0); ProcessEvents(); } - LLOG("Waiting status " << tm << "ms"); + LLOG("Waiting status " << GetTickCount() - timeout << "ms"); if(Xdnd_waiting_status) { LLOG("XdndStatus timeout"); Xdnd_status = DND_NONE; @@ -193,14 +192,13 @@ void DnDLoop::LeftUp(Point, dword) XSendEvent(Xdisplay, target, XFalse, 0, &e); XFlush(Xdisplay); Xdnd_waiting_finished = true; - int timeout = GetTickCount() + 200; + int timeout = GetTickCount(); LLOG("Waiting for XdndFinished"); - TimeStop tm; - while(Xdnd_waiting_finished && GetTickCount() < timeout) { + while(Xdnd_waiting_finished && GetTickCount() - timeout < 200) { GuiSleep(0); ProcessEvents(); } - LLOG("Waiting finished " << tm << "ms"); + LLOG("Waiting finished " << GetTickCount() - timeout << "ms"); if(Xdnd_waiting_status) { LLOG("XdndFinished timeout"); Xdnd_status = DND_NONE; diff --git a/uppsrc/CtrlCore/X11Wnd.cpp b/uppsrc/CtrlCore/X11Wnd.cpp index 437ef574a..701f53c93 100644 --- a/uppsrc/CtrlCore/X11Wnd.cpp +++ b/uppsrc/CtrlCore/X11Wnd.cpp @@ -977,7 +977,7 @@ void Ctrl::SyncNativeWindows(void) Rect r = xw.ctrl->GetRectInParentWindow(); if( (x != r.left || y != r.top) && ((int)width == r.Width() && (int)height == r.Height())) XMoveWindow(Xdisplay, w, r.left, r.top); - else if( (x == r.left || y == r.top) && ((int)width != r.Width() || (int)height != r.Height())) + else if( (x == r.left && y == r.top) && ((int)width != r.Width() || (int)height != r.Height())) XResizeWindow(Xdisplay, w, r.Width(), r.Height()); else if( x != r.left || y != r.top || (int)width != r.Width() || (int)height != r.Height()) XMoveResizeWindow(Xdisplay, w, r.left, r.top, r.Width(), r.Height()); diff --git a/uppsrc/CtrlLib/MenuBar.cpp b/uppsrc/CtrlLib/MenuBar.cpp index df952d1c2..f8662d999 100644 --- a/uppsrc/CtrlLib/MenuBar.cpp +++ b/uppsrc/CtrlLib/MenuBar.cpp @@ -6,7 +6,7 @@ NAMESPACE_UPP -#define LLOG(x) // LOG(x) +#define LLOG(x) LOG(x) #define LTIMING(x) // RTIMING(x) static ColorF xpmenuborder[] = { @@ -199,7 +199,7 @@ void MenuBar::SetupRestoreFocus() q = q->submenu; } restorefocus = GetFocusCtrl(); - LLOG("SetupRestoreFocus -> " << ::Name(restorefocus)); + LLOG("SetupRestoreFocus -> " << UPP::Name(restorefocus)); } void MenuBar::PostDeactivate() @@ -287,10 +287,11 @@ INITBLOCK bool MenuBar::Key(dword key, int count) { + LLOG("KEY " << GetKeyDesc(key)); bool horz = IsChild(); if((horz ? key == K_RIGHT : key == K_DOWN)) { Ctrl *ctrl = GetFocusChildDeep(); - LLOG("MenuBar::Key(" << key << ") -> IterateFocusForward for " << ::Name(ctrl) << ", pane " << ::Name(&pane)); + LLOG("MenuBar::Key(" << key << ") -> IterateFocusForward for " << UPP::Name(ctrl) << ", pane " << UPP::Name(&pane)); if(HasMouseDeep()) GetMouseCtrl()->Refresh(); if(ctrl && IterateFocusForward(ctrl, &pane, false, false, true)) @@ -306,7 +307,7 @@ bool MenuBar::Key(dword key, int count) else if((horz ? key == K_LEFT : key == K_UP)) { Ctrl *ctrl = GetFocusChildDeep(); - LLOG("MenuBar::Key(" << key << ") -> IterateFocusBackward for " << ::Name(ctrl) << ", pane " << ::Name(&pane)); + LLOG("MenuBar::Key(" << key << ") -> IterateFocusBackward for " << UPP::Name(ctrl) << ", pane " << UPP::Name(&pane)); if(HasMouseDeep()) GetMouseCtrl()->Refresh(); if(ctrl && IterateFocusBackward(ctrl, &pane, false, true)) @@ -342,6 +343,7 @@ bool MenuBar::Key(dword key, int count) parentmenu->pane.GetFirstChild() && parentmenu->submenuitem) { Ctrl *smi = parentmenu->submenuitem; Ctrl *q = smi; + q->Refresh(); if(key == K_RIGHT) for(;;) { q = q->GetNext(); @@ -350,6 +352,7 @@ bool MenuBar::Key(dword key, int count) if(q == smi) break; if(PullMenu(q)) { + q->Refresh(); SyncState(); return true; } @@ -362,6 +365,7 @@ bool MenuBar::Key(dword key, int count) if(q == smi) break; if(PullMenu(q)) { + q->Refresh(); SyncState(); return true; } @@ -485,7 +489,7 @@ void MenuBar::PopUp(Ctrl *owner, Point p, Size rsz) } Rect r = GetWorkArea(); restorefocus = GetFocusCtrl(); - LLOG("PopUp " << ::Name(this) << " set restorefocus:" << ::Name(restorefocus)); + LLOG("PopUp " << UPP::Name(this) << " set restorefocus:" << UPP::Name(restorefocus)); DistributeAccessKeys(); frame.Set(style->popupframe); if(GUI_GlobalStyle() >= GUISTYLE_XP) @@ -563,7 +567,7 @@ MenuBar::~MenuBar() { lock++; LLOG("~MenuBar " << Name()); - LLOG("Parent menu " << ::Name(parentmenu)); + LLOG("Parent menu " << UPP::Name(parentmenu)); if(parentmenu) parentmenu->SetActiveSubmenu(NULL, NULL); LLOG("~MenuBar 1"); diff --git a/uppsrc/CtrlLib/MenuImp.h b/uppsrc/CtrlLib/MenuImp.h index 9194763e7..50d855407 100644 --- a/uppsrc/CtrlLib/MenuImp.h +++ b/uppsrc/CtrlLib/MenuImp.h @@ -140,6 +140,8 @@ public: virtual void Paint(Draw& w); virtual void MouseEnter(Point, dword); virtual void MouseLeave(); + virtual void GotFocus(); + virtual void LostFocus(); virtual void LeftDown(Point, dword); virtual void SyncState(); virtual Size GetMinSize() const; diff --git a/uppsrc/CtrlLib/MenuItem.cpp b/uppsrc/CtrlLib/MenuItem.cpp index 17e4c7889..a01155816 100644 --- a/uppsrc/CtrlLib/MenuItem.cpp +++ b/uppsrc/CtrlLib/MenuItem.cpp @@ -491,6 +491,16 @@ bool TopSubMenuItem::Key(dword key, int) { return false; } +void TopSubMenuItem::GotFocus() +{ + Refresh(); +} + +void TopSubMenuItem::LostFocus() +{ + Refresh(); +} + bool TopSubMenuItem::HotKey(dword key) { if(BarCtrl::Scan(proc, key)) diff --git a/uppsrc/CtrlLib/PrinterJob.cpp b/uppsrc/CtrlLib/PrinterJob.cpp index 2ca21557f..b31dc3425 100644 --- a/uppsrc/CtrlLib/PrinterJob.cpp +++ b/uppsrc/CtrlLib/PrinterJob.cpp @@ -153,6 +153,8 @@ String System(const char *cmd, const String& in) c << " <" << ifn; system(c); String q = LoadFile(ofn); + FileDelete(ofn); + FileDelete(ifn); return q; } diff --git a/uppsrc/CtrlLib/PushCtrl.h b/uppsrc/CtrlLib/PushCtrl.h index 29525e2c1..a3b5b2a7c 100644 --- a/uppsrc/CtrlLib/PushCtrl.h +++ b/uppsrc/CtrlLib/PushCtrl.h @@ -39,10 +39,13 @@ protected: public: Pusher& SetFont(Font fnt); Pusher& SetLabel(const char *text); + + Font GetFont() const { return font; } + String GetLabel() const { return label; } void PseudoPush(); - int GetVisualState() const; + int GetVisualState() const; Callback WhenPush; Callback WhenRepeat; diff --git a/uppsrc/CtrlLib/TreeCtrl.cpp b/uppsrc/CtrlLib/TreeCtrl.cpp index 8912c47e1..9dac3e596 100644 --- a/uppsrc/CtrlLib/TreeCtrl.cpp +++ b/uppsrc/CtrlLib/TreeCtrl.cpp @@ -46,7 +46,7 @@ TreeCtrl::Node::Node(const Image& img, Ctrl& ctrl, int cx, int cy) Init(); SetCtrl(ctrl); image = img; - size = ctrl.GetMinSize(); + size = Null; if(cx > 0) size.cx = cx; if(cy > 0) @@ -128,34 +128,6 @@ Size TreeCtrl::Item::GetSize() const return sz; } -/* -Size TreeCtrl::Item::GetValueSize() const -{ - if(IsNull(size)) - if(ctrl) - return ctrl->GetMinSize(); - else - return display ? display->GetStdSize(value) : StdDisplay().GetStdSize(value); - else - return size; -} - -Size TreeCtrl::Item::GetCtrlSize() const -{ - return size; -} - -Size TreeCtrl::Item::GetSize() const -{ - Size sz = GetValueSize(); - sz += Size(2 * margin, 2 * margin); - Size isz = image.GetSize(); - sz.cx += isz.cx; - sz.cy = max(sz.cy, isz.cy); - return sz; -} -*/ - void TreeCtrl::SetRoot(const TreeCtrl::Node& n) { (TreeCtrl::Node &)item[0] = n; diff --git a/uppsrc/CtrlLib/TreeCtrl.h b/uppsrc/CtrlLib/TreeCtrl.h index b5a8d1641..4ab152054 100644 --- a/uppsrc/CtrlLib/TreeCtrl.h +++ b/uppsrc/CtrlLib/TreeCtrl.h @@ -317,8 +317,9 @@ public: int Add(int parent, Option& option, const char *text = NULL); int Add(int parent, const Image& img, const char *text); int Add(int parent, const char *text); - - void SetLabel(int id, const char *text); + + void SetLabel(int id, const char *text); + String GetLabel(int id) const { return option[id]->GetLabel(); } int Get(int id) const { return option[id]->Get(); } diff --git a/uppsrc/MySql/MySql.upp b/uppsrc/MySql/MySql.upp index a367e9b55..f83210063 100644 --- a/uppsrc/MySql/MySql.upp +++ b/uppsrc/MySql/MySql.upp @@ -40,3 +40,4 @@ file Copying, Copying-plain, Authors; + diff --git a/uppsrc/Report/Report.t b/uppsrc/Report/Report.t index 5ce80d667..5776d9510 100644 --- a/uppsrc/Report/Report.t +++ b/uppsrc/Report/Report.t @@ -64,4 +64,4 @@ csCZ("Storno") huHU("Mégsem") itIT("Annulla") ruRU("Отмена") -plPL("Anuluj") \ No newline at end of file +plPL("Anuluj") diff --git a/uppsrc/SqlCtrl/SqlConsole.cpp b/uppsrc/SqlCtrl/SqlConsole.cpp index 86481dd85..1b3ec1624 100644 --- a/uppsrc/SqlCtrl/SqlConsole.cpp +++ b/uppsrc/SqlCtrl/SqlConsole.cpp @@ -1,8 +1,6 @@ #include "SqlCtrl.h" #include -#pragma hdrstop - NAMESPACE_UPP #define IMAGEFILE @@ -120,7 +118,6 @@ bool MacroSet::Define(const char *s) { } String MacroSet::Expand(const char *s, Index& used) const { - bool again = false; String text; while(*s) if(IsId(*s)) { diff --git a/uppsrc/SqlCtrl/SqlObjectTree.cpp b/uppsrc/SqlCtrl/SqlObjectTree.cpp index a367bbdca..37c5d3e95 100644 --- a/uppsrc/SqlCtrl/SqlObjectTree.cpp +++ b/uppsrc/SqlCtrl/SqlObjectTree.cpp @@ -1,12 +1,8 @@ #include "SqlCtrl.h" -#pragma hdrstop - #include "SqlDlg.h" NAMESPACE_UPP -static bool StringLessNoCase(String a, String b) { return CompareNoCase(a, b) < 0; } - class DlgSqlExport : public WithSqlExportLayout { public: diff --git a/uppsrc/ide/Help.cpp b/uppsrc/ide/Help.cpp index e84d4195f..77c994b69 100644 --- a/uppsrc/ide/Help.cpp +++ b/uppsrc/ide/Help.cpp @@ -348,6 +348,90 @@ void TopicCtrl::OpenTopic() WhenTopic(); } +struct SlideShow : TopWindow { + virtual bool Key(dword key, int count); + + RichTextView text; + Vector path; + int page; + int rp; + + void SetPage(); + + SlideShow(); +}; + +bool SlideShow::Key(dword key, int count) +{ + switch(key) { + case K_ESCAPE: + Break(); + break; + case K_LEFT: + case K_UP: + case K_PAGEUP: + page--; + SetPage(); + break; + case K_RIGHT: + case K_DOWN: + case K_PAGEDOWN: + page++; + SetPage(); + break; + } + return true; +} + +void SlideShow::SetPage() +{ + page = minmax(page, 0, path.GetCount() - 1); + if(page != rp) { + rp = page; + text <<= ReadTopic(LoadFile(path[page])).text; + } +} + +SlideShow::SlideShow() +{ + FullScreen(); + Add(text.SizePos()); + text.NoHyperlinkDecoration(); + text.NoSb(); + text.VCenter(); + text.SetZoom(Zoom(1, 5)); + text.Margins(8); + rp = -1; +} + +void TopicCtrl::SShow() +{ + SlideShow ss; + TopicLink tl = ParseTopicLink(GetCurrent()); + if(IsNull(tl.package)) + return; + String folder = AppendFileName(PackageDirectory(tl.package), tl.group + ".tpp"); + FindFile ff(AppendFileName(folder, "*.tpp")); + Array l; + while(ff) { + if(ff.IsFile()) + l.Add(GetFileTitle(ff.GetName())); + ff.Next(); + } + if(l.GetCount() == 0) + return; + Sort(l); + for(int i = 0; i < l.GetCount(); i++) { + if(tl.topic == l[i]) + ss.page = i; + ss.path.Add(AppendFileName(folder, l[i] + ".tpp")); + } + ss.SetPage(); + ss.Run(); + tl.topic = l[ss.page]; + GoTo(TopicLinkString(tl)); +} + void TopicCtrl::Search() { if(issearch) { @@ -411,6 +495,8 @@ void TopicCtrl::BarEx(Bar& bar) .Check(issearch); bar.Add("Highlight search keywords in topic", IdeImg::ShowWords(), THISBACK(ShowWords)) .Check(showwords); + bar.Add(!internal && GetCurrent().StartsWith("topic:"), + IdeImg::show(), THISBACK(SShow)); bar.GapRight(); bar.Separator(); bar.Add(!internal && GetCurrent().StartsWith("topic:"), diff --git a/uppsrc/ide/Host.cpp b/uppsrc/ide/Host.cpp index d29ca9e1f..41ca24a52 100644 --- a/uppsrc/ide/Host.cpp +++ b/uppsrc/ide/Host.cpp @@ -216,8 +216,6 @@ void LocalHost::Launch(const char *_cmdline, bool console) << "echo \"<--- Finished, press any key to close the window --->\"\nread\n"; cmdline = LinuxHostConsole + " bash " + script; } - DUMP(LoadFile(script)); - SaveFile(GetHomeDirFile("test"), LoadFile(script)); Buffer cmd_buf(strlen(cmdline) + 1); char *cmd_out = cmd_buf; Vector args; diff --git a/uppsrc/ide/Valgrind.cpp b/uppsrc/ide/Valgrind.cpp index 71d9c077b..4f6155d25 100644 --- a/uppsrc/ide/Valgrind.cpp +++ b/uppsrc/ide/Valgrind.cpp @@ -31,11 +31,9 @@ void Ide::Valgrind() String cmdline; String fn = GetTempFileName(); cmdline << "valgrind --xml=yes --num-callers=40 " << ValgrindLogFile << fn << ' '; - // 2008/06/01 -- add valgrind suppression file String ValgSupp = ConfigFile("valgrind.supp"); if(!IsNull(LoadFile(ValgSupp))) cmdline << "--suppressions=" << ValgSupp << ' '; - // 2008/06/01 -- END cmdline << '\"' << h->GetHostPath(target) << "\" "; cmdline << runarg; ConsoleClear(); diff --git a/uppsrc/ide/app.tpp/all.i b/uppsrc/ide/app.tpp/all.i index 72fb20147..508eb4adc 100644 --- a/uppsrc/ide/app.tpp/all.i +++ b/uppsrc/ide/app.tpp/all.i @@ -93,3 +93,4 @@ END_TOPIC TOPIC("Topic$en-us") #include "Topic$en-us.tpp" END_TOPIC + diff --git a/uppsrc/ide/ide.h b/uppsrc/ide/ide.h index eabbe7725..78cca8b96 100644 --- a/uppsrc/ide/ide.h +++ b/uppsrc/ide/ide.h @@ -265,6 +265,7 @@ private: void ShowWords(); void All(); void Lang(); + void SShow(); Label search_label; WithDropChoice search; @@ -409,7 +410,7 @@ struct AssistEditor : CodeEditor { String IdBack(int& qq); void SwapSContext(Parser& p); - + void CreateIndex(); void SyncIndex(); @@ -420,7 +421,7 @@ struct AssistEditor : CodeEditor { bool IndexKey(dword key); bool IsIndex(); void ShowIndex(bool b); - + void SerializeIndex(Stream& s); typedef AssistEditor CLASSNAME; @@ -704,7 +705,7 @@ public: TopicCtrl doc; int state_icon; - + String export_name; String export_outdir; bool export_usedonly; diff --git a/uppsrc/ide/ide.iml b/uppsrc/ide/ide.iml index d3d250156..8e899ef7e 100644 --- a/uppsrc/ide/ide.iml +++ b/uppsrc/ide/ide.iml @@ -63,6 +63,7 @@ IMAGE_ID(HelpSearch) IMAGE_ID(HelpAll) IMAGE_ID(sponsor) IMAGE_ID(index) +IMAGE_ID(show) IMAGE_BEGIN_DATA IMAGE_DATA(120,156,237,153,77,178,155,48,12,199,125,129,206,188,93,103,186,234,117,122,43,159,168,103,200,57,114,132,46,219,101,23) @@ -3839,9 +3840,11 @@ IMAGE_DATA(140,172,235,169,228,243,54,200,196,40,92,138,207,132,9,19,38,76,152,4 IMAGE_END_DATA(5088, 20) IMAGE_BEGIN_DATA -IMAGE_DATA(120,156,99,16,96,16,96,160,38,40,236,92,246,159,28,140,172,255,255,127,6,20,188,106,213,170,255,248,0,86,253,207) -IMAGE_DATA(129,184,3,136,11,17,250,235,235,235,225,24,198,199,170,31,164,55,18,136,181,80,245,147,100,63,200,110,71,76,253,216) -IMAGE_DATA(220,128,213,126,144,221,11,200,244,127,7,84,63,200,29,231,201,240,191,22,3,2,47,32,195,126,71,136,189,96,253,207) -IMAGE_DATA(49,245,163,187,3,67,255,121,164,240,35,55,254,29,161,102,252,39,51,254,181,160,126,32,199,254,5,72,225,143,197,126) -IMAGE_DATA(244,112,64,215,79,73,254,161,4,0,0,124,78,86,154,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0) -IMAGE_END_DATA(160, 1) +IMAGE_DATA(120,156,189,148,193,17,132,32,12,69,83,130,117,112,165,2,202,216,50,172,128,61,186,93,112,218,3,205,88,134,101,68) +IMAGE_DATA(88,17,17,193,129,196,217,239,252,3,51,60,126,18,84,24,96,128,39,53,126,190,72,113,202,35,194,201,214,90,188,83) +IMAGE_DATA(145,95,156,39,231,241,224,181,214,209,251,186,200,123,246,229,44,206,124,87,190,207,86,87,190,84,67,49,223,103,27,98) +IMAGE_DATA(255,83,224,125,29,51,161,127,1,135,13,33,95,109,185,63,126,185,242,121,29,23,126,78,230,71,189,127,21,206,64,226) +IMAGE_DATA(253,139,208,3,37,223,36,243,47,228,231,115,200,121,206,247,195,210,211,63,3,39,36,58,242,189,42,241,16,30,47,41) +IMAGE_DATA(101,213,45,60,55,127,219,243,142,110,225,185,253,239,186,235,251,31,249,20,158,249,254,228,170,157,223,42,14,95,219,219) +IMAGE_DATA(122,6,151,239,210,10,36,118,222,142,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0) +IMAGE_END_DATA(224, 2) diff --git a/uppsrc/ide/ide.lay b/uppsrc/ide/ide.lay index 870af9046..74743d6a8 100644 --- a/uppsrc/ide/ide.lay +++ b/uppsrc/ide/ide.lay @@ -401,7 +401,7 @@ LAYOUT(SetupEditorLayout, 488, 280) ITEM(DropList, charset, LeftPosZ(112, 104).TopPosZ(76, 19)) ITEM(Option, showtabs, SetLabel(t_("Show tabs")).LeftPosZ(12, 72).TopPosZ(100, 18)) ITEM(Option, indent_spaces, SetLabel(t_("Indent using spaces")).LeftPosZ(12, 118).TopPosZ(120, 18)) - ITEM(Option, no_parenthesis_indent, SetLabel(t_("No indent after parenthesis")).LeftPosZ(12, 148).TopPosZ(140, 18)) + ITEM(Option, no_parenthesis_indent, SetLabel(t_("No indent after parenthesis")).LeftPosZ(12, 176).TopPosZ(140, 18)) ITEM(Option, numbers, SetLabel(t_("Show line numbers")).LeftPosZ(12, 112).TopPosZ(160, 18)) ITEM(Option, bookmark_pos, SetLabel(t_("Bookmarks restore position")).LeftPosZ(12, 152).TopPosZ(180, 18)) ITEM(Option, filetabs, SetLabel(t_("File tabs")).LeftPosZ(12, 64).TopPosZ(200, 18)) diff --git a/uppsrc/ide/idewin.cpp b/uppsrc/ide/idewin.cpp index 8e62f8df7..303ea9413 100644 --- a/uppsrc/ide/idewin.cpp +++ b/uppsrc/ide/idewin.cpp @@ -610,7 +610,7 @@ Ide::Ide() doc_serial = -1; showtime = true; - + export_outdir = GetHomeDirFile("export++"); export_usedonly = true; } diff --git a/uppsrc/ide/version.h b/uppsrc/ide/version.h index 5337e4f35..08483cc77 100644 --- a/uppsrc/ide/version.h +++ b/uppsrc/ide/version.h @@ -1 +1 @@ -#define IDE_VERSION "807.r126" +#define IDE_VERSION "807.r127" diff --git a/uppsrc/plugin/sqlite3/Sqlite3Schema.h b/uppsrc/plugin/sqlite3/Sqlite3Schema.h index dd8b30fab..4432c6d80 100644 --- a/uppsrc/plugin/sqlite3/Sqlite3Schema.h +++ b/uppsrc/plugin/sqlite3/Sqlite3Schema.h @@ -23,10 +23,10 @@ #define DATE_(x) COLUMN_("date", Date, x, 0, 0) #define DATE_ARRAY_(x, items) COLUMN_ARRAY_("date", Date, x, 0, 0, items) -#define TIME(x) COLUMN("date", Time, x, 0, 0) -#define TIME_ARRAY(x, items) COLUMN_ARRAY("date", Time, x, 0, 0, items) -#define TIME_(x) COLUMN_("date", Time, x, 0, 0) -#define TIME_ARRAY_(x, items) COLUMN_ARRAY_("date", Time, x, 0, 0, items) +#define TIME(x) COLUMN("datetime", Time, x, 0, 0) +#define TIME_ARRAY(x, items) COLUMN_ARRAY("datetime", Time, x, 0, 0, items) +#define TIME_(x) COLUMN_("datetime", Time, x, 0, 0) +#define TIME_ARRAY_(x, items) COLUMN_ARRAY_("datetime", Time, x, 0, 0, items) #define BOOL(x) COLUMN("text", bool, x, 0, 0) #define BOOL_ARRAY(x, items) COLUMN_ARRAY("text", bool, x, 0, 0, items) diff --git a/uppsrc/usvn/Console.cpp b/uppsrc/usvn/Console.cpp new file mode 100644 index 000000000..0d7dbd8da --- /dev/null +++ b/uppsrc/usvn/Console.cpp @@ -0,0 +1,56 @@ +#include "usvn.h" + +SysConsole::SysConsole() +{ + CtrlLayoutExit(*this, "System Console"); + list.NoHeader().NoGrid().NoCursor().AddColumn(); + font = Courier(Ctrl::VertLayoutZoom(12)); + list.SetLineCy(font.Info().GetHeight()); +} + +void SysConsole::AddResult(const String& out) +{ + DUMP(out); + Vector h = Split(out, '\n'); + for(int i = 0; i < h.GetCount(); i++) { + String s = " " + h[i]; + list.Add(AttrText(s).SetFont(font), s); + } + list.GoEnd(); +} + +int SysConsole::System(const char *cmd) +{ + DLOG("=== System ======================================="); + DDUMP(cmd); + if(!IsOpen()) + Open(); + list.Add(AttrText(cmd).SetFont(font().Bold()).Ink(LtBlue)); + int ii = list.GetCount(); + LocalProcess p; + if(!p.Start(cmd)) + return -1; + String out; + while(p.IsRunning()) { + DLOG("Get1"); + out.Cat(p.Get()); + int lf = out.ReverseFind('\n'); + if(lf >= 0) { + AddResult(out.Mid(0, lf + 1)); + out = out.Mid(lf + 1); + } + ProcessEvents(); + Sleep(1); // p.Wait would be much better here! + } + DLOG("Get2"); + out.Cat(p.Get()); + AddResult(out); + ProcessEvents(); + int code = p.GetExitCode(); + if(code) + while(ii < list.GetCount()) { + list.Set(ii, 0, AttrText(list.Get(ii, 1)).SetFont(font).Ink(LtRed)); + ii++; + } + return code; +} diff --git a/uppsrc/usvn/SlaveProcess.cpp b/uppsrc/usvn/SlaveProcess.cpp new file mode 100644 index 000000000..e6e9deb88 --- /dev/null +++ b/uppsrc/usvn/SlaveProcess.cpp @@ -0,0 +1,404 @@ +#include "SlaveProcess.h" + +NAMESPACE_UPP + +#ifdef PLATFORM_POSIX +//#BLITZ_APPROVE +#include +#include +#include +#endif + +#define LLOG(x) LOG(x) + +void LocalProcess::Init() { +#ifdef PLATFORM_WIN32 + hProcess = hOutputRead = hInputWrite = NULL; +#endif +#ifdef PLATFORM_POSIX + pid = 0; + rpipe[0] = rpipe[1] = wpipe[0] = wpipe[1] = -1; + output_read = false; +#endif + exit_code = Null; +} + +void LocalProcess::Free() { +#ifdef PLATFORM_WIN32 + if(hProcess) { + CloseHandle(hProcess); + hProcess = NULL; + } + if(hOutputRead) { + CloseHandle(hOutputRead); + hOutputRead = NULL; + } + if(hInputWrite) { + CloseHandle(hInputWrite); + hInputWrite = NULL; + } +#endif +#ifdef PLATFORM_POSIX + LLOG("\nLocalProcess::Free, pid = " << (int)getpid()); + LLOG("rpipe[" << rpipe[0] << ", " << rpipe[1] << "]"); + LLOG("wpipe[" << wpipe[0] << ", " << wpipe[1] << "]"); + if(rpipe[0] >= 0) { close(rpipe[0]); rpipe[0] = -1; } + if(rpipe[1] >= 0) { close(rpipe[1]); rpipe[1] = -1; } + if(wpipe[0] >= 0) { close(wpipe[0]); wpipe[0] = -1; } + if(wpipe[1] >= 0) { close(wpipe[1]); wpipe[1] = -1; } + if(pid) waitpid(pid, 0, WNOHANG | WUNTRACED); + pid = 0; + output_read = false; +#endif +} + +bool LocalProcess::Start(const char *command, const char *envptr) +{ + LLOG("LocalProcess::Start(\"" << command << "\")"); + + Kill(); + + while(*command && (byte)*command <= ' ') + command++; + +#ifdef PLATFORM_WIN32 + HANDLE hOutputReadTmp, hInputRead; + HANDLE hInputWriteTmp, hOutputWrite; + HANDLE hErrorWrite; + SECURITY_ATTRIBUTES sa; + + sa.nLength = sizeof(SECURITY_ATTRIBUTES); + sa.lpSecurityDescriptor = NULL; + sa.bInheritHandle = TRUE; + + HANDLE hp = GetCurrentProcess(); + + CreatePipe(&hOutputReadTmp, &hOutputWrite, &sa, 0); + DuplicateHandle(hp, hOutputWrite, hp, &hErrorWrite, 0, TRUE, DUPLICATE_SAME_ACCESS); + CreatePipe(&hInputRead, &hInputWriteTmp, &sa, 0); + DuplicateHandle(hp, hOutputReadTmp, hp, &hOutputRead, 0, FALSE, DUPLICATE_SAME_ACCESS); + DuplicateHandle(hp, hInputWriteTmp, hp, &hInputWrite, 0, FALSE, DUPLICATE_SAME_ACCESS); + CloseHandle(hOutputReadTmp); + CloseHandle(hInputWriteTmp); + + PROCESS_INFORMATION pi; + STARTUPINFO si; + ZeroMemory(&si, sizeof(STARTUPINFO)); + si.cb = sizeof(STARTUPINFO); + si.dwFlags = STARTF_USESTDHANDLES | STARTF_USESHOWWINDOW; + si.wShowWindow = SW_HIDE; + si.hStdInput = hInputRead; + si.hStdOutput = hOutputWrite; + si.hStdError = hErrorWrite; + int n = (int)strlen(command) + 1; + Buffer cmd(n); + memcpy(cmd, command, n); + bool h = CreateProcess(NULL, cmd, &sa, &sa, TRUE, + NORMAL_PRIORITY_CLASS, (void *)envptr, NULL, &si, &pi); + LLOG("CreateProcess " << (h ? "succeeded" : "failed")); + CloseHandle(hErrorWrite); + CloseHandle(hInputRead); + CloseHandle(hOutputWrite); + if(h) { + hProcess = pi.hProcess; + CloseHandle(pi.hThread); + } + else { + Free(); + return false; +// throw Exc(NFormat("Error running process: %s\nCommand: %s", GetErrorMessage(GetLastError()), command)); + } +#endif +#ifdef PLATFORM_POSIX + // parse command line for execve + cmd_buf.Alloc(strlen(command) + 1); + char *cmd_out = cmd_buf; + const char *p = command; + const char *b = p; + while(*p && (byte)*p > ' ') + if(*p++ == '\"') + while(*p && *p++ != '\"') + ; + const char *app = cmd_out; + args.Add(cmd_out); + memcpy(cmd_out, b, p - b); + cmd_out += p - b; + *cmd_out++ = '\0'; + + while(*p) + if((byte)*p <= ' ') + p++; + else { + args.Add(cmd_out); + while(*p && (byte)*p > ' ') + if(*p == '\\') { + if(*++p) + *cmd_out++ = *p++; + } + else if(*p == '\"') { + p++; + while(*p && *p != '\"') + if(*p == '\\') { + if(*++p) + *cmd_out++ = *p++; + } + else + *cmd_out++ = *p++; + if(*p == '\"') + p++; + } + else + *cmd_out++ = *p++; + *cmd_out++ = '\0'; + } + + args.Add(NULL); + + String app_full = GetFileOnPath(app, getenv("PATH"), true); + if(IsNull(app_full)) + return false; +// throw Exc(Format("Cannot find executable '%s'\n", app)); + + if(pipe(rpipe) || pipe(wpipe)) + return false; +// throw Exc(NFormat(t_("pipe() error; error code = %d"), errno)); + + LLOG("\nLocalProcess::Start"); + LLOG("rpipe[" << rpipe[0] << ", " << rpipe[1] << "]"); + LLOG("wpipe[" << wpipe[0] << ", " << wpipe[1] << "]"); + pid = fork(); + LLOG("\tfork, pid = " << (int)pid << ", getpid = " << (int)getpid()); + if(pid < 0) + return false; +// throw Exc(NFormat(t_("fork() error; error code = %d"), errno)); + + if(pid) { + LLOG("parent process - continue"); + return true; + } + LLOG("child process - execute application"); +// rpipe[1] = wpipe[0] = -1; + dup2(rpipe[0], 0); + dup2(wpipe[1], 1); + dup2(wpipe[1], 2); + +#if DO_LLOG + LLOG(args.GetCount() << "arguments:"); + for(int a = 0; a < args.GetCount(); a++) + LLOG("[" << a << "]: <" << (args[a] ? args[a] : "NULL") << ">"); +#endif//DO_LLOG + + LLOG("running execve, app = " << app << ", #args = " << args.GetCount()); + if(envptr) { + const char *from = envptr; + Vector env; + while(*from) { + env.Add(from); + from += strlen(from) + 1; + } + env.Add(NULL); + execve(app_full, args.Begin(), (char *const *)env.Begin()); + } + else + execv(app_full, args.Begin()); + LLOG("execve failed, errno = " << errno); +// printf("Error running '%s', error code %d\n", command, errno); + exit(-errno); +#endif +} + +#ifdef PLATFORM_POSIX +bool LocalProcess::DecodeExitCode(int status) +{ + if(WIFEXITED(status)) { + exit_code = (byte)WEXITSTATUS(status); + return true; + } + else if(WIFSIGNALED(status) || WIFSTOPPED(status)) { + static const struct { + const char *name; + int code; + } + signal_map[] = { +#define SIGDEF(s) { #s, s }, +SIGDEF(SIGHUP) SIGDEF(SIGINT) SIGDEF(SIGQUIT) SIGDEF(SIGILL) SIGDEF(SIGABRT) +SIGDEF(SIGFPE) SIGDEF(SIGKILL) SIGDEF(SIGSEGV) SIGDEF(SIGPIPE) SIGDEF(SIGALRM) +SIGDEF(SIGPIPE) SIGDEF(SIGTERM) SIGDEF(SIGUSR1) SIGDEF(SIGUSR2) SIGDEF(SIGTRAP) +SIGDEF(SIGURG) SIGDEF(SIGVTALRM) SIGDEF(SIGXCPU) SIGDEF(SIGXFSZ) SIGDEF(SIGIOT) +SIGDEF(SIGIO) SIGDEF(SIGWINCH) +#ifndef PLATFORM_FREEBSD +//SIGDEF(SIGCLD) SIGDEF(SIGPWR) +#endif +//SIGDEF(SIGSTKFLT) SIGDEF(SIGUNUSED) // not in Solaris, make conditional if needed +#undef SIGDEF + }; + + int sig = (WIFSIGNALED(status) ? WTERMSIG(status) : WSTOPSIG(status)); + exit_code = (WIFSIGNALED(status) ? 1000 : 2000) + sig; + exit_string << "\nProcess " << (WIFSIGNALED(status) ? "terminated" : "stopped") << " on signal " << sig; + for(int i = 0; i < __countof(signal_map); i++) + if(signal_map[i].code == sig) + { + exit_string << " (" << signal_map[i].name << ")"; + break; + } + exit_string << "\n"; + return true; + } + return false; +} +#endif//PLATFORM_POSIX + +void LocalProcess::Kill() { +#ifdef PLATFORM_WIN32 + if(hProcess && IsRunning()) { + TerminateProcess(hProcess, (DWORD)-1); + exit_code = 255; + } +#endif +#ifdef PLATFORM_POSIX + if(IsRunning()) { + LLOG("\nLocalProcess::Kill, pid = " << (int)pid); + exit_code = 255; + kill(pid, SIGTERM); + GetExitCode(); + int status; + if(pid && waitpid(pid, &status, 0) == pid) + DecodeExitCode(status); + exit_string = "Child process has been killed.\n"; + } +#endif + Free(); +} + +void LocalProcess::Detach() +{ + Free(); +} + +bool LocalProcess::IsRunning() { +#ifdef PLATFORM_WIN32 + dword exitcode; + if(!hProcess) + return false; + if(GetExitCodeProcess(hProcess, &exitcode) && exitcode == STILL_ACTIVE) + return true; + dword n; + if(PeekNamedPipe(hOutputRead, NULL, 0, NULL, &n, NULL) && n) + return true; + exit_code = exitcode; + return false; +#endif +#ifdef PLATFORM_POSIX + if(!pid || !IsNull(exit_code)) { + LLOG("IsRunning() -> no"); + return false; + } + int status = 0, wp; + if((wp = waitpid(pid, &status, WNOHANG | WUNTRACED)) != pid || !DecodeExitCode(status)) + return true; + LLOG("IsRunning() -> no, just exited, exit code = " << exit_code); + return false; +#endif +} + +int LocalProcess::GetExitCode() { +#ifdef PLATFORM_WIN32 + return IsRunning() ? (int)Null : exit_code; +#endif +#ifdef PLATFORM_POSIX + if(!IsRunning()) + return Nvl(exit_code, -1); + int status; + if(waitpid(pid, &status, WNOHANG | WUNTRACED) != pid || !DecodeExitCode(status)) { + LLOG("GetExitCode() -> -1 (waitpid would hang)"); + return -1; + } + exit_code = WEXITSTATUS(status); + LLOG("GetExitCode() -> " << exit_code << " (just exited)"); + return exit_code; +#endif +} + +bool LocalProcess::Read(String& res) { + LLOG("LocalProcess::Read"); + res = Null; +#ifdef PLATFORM_WIN32 + if(!hOutputRead) return false; + dword n; + if(!PeekNamedPipe(hOutputRead, NULL, 0, NULL, &n, NULL) || n == 0) + return IsRunning(); + char buffer[1024]; + if(!ReadFile(hOutputRead, buffer, sizeof(buffer), &n, NULL)) + return false; + res.Cat(buffer, n); + return true; +#endif +#ifdef PLATFORM_POSIX +//??! + DDUMP(wpipe[0]); + if(wpipe[0] < 0) return false; + bool was_running = IsRunning(); + LLOG("output_read = " << (output_read ? "yes" : "no")); + if(!was_running && output_read) { + if(exit_string.IsEmpty()) + return false; + res = exit_string; + exit_string = Null; + return true; + } + fd_set set[1]; + FD_ZERO(set); + FD_SET(wpipe[0], set); + timeval tval = { 0, 0 }; + int sv; + while((sv = select(wpipe[0] + 1, set, NULL, NULL, &tval)) > 0) { + LLOG("Read() -> select"); + char buffer[1024]; + int done = read(wpipe[0], buffer, sizeof(buffer)); + LLOG("Read(), read -> " << done << ": " << String(buffer, done)); + if(done > 0) + res.Cat(buffer, done); + } + DDUMP(res); + if(sv < 0) { + LLOG("select -> " << sv); + } + if(!was_running) + output_read = true; + return !IsNull(res) || was_running; +#endif +} + +void LocalProcess::Write(String s) +{ +#ifdef PLATFORM_WIN32 + dword n; + WriteFile(hInputWrite, s, s.GetLength(), &n, NULL); +#endif +#ifdef PLATFORM_POSIX + write(rpipe[1], s, s.GetLength()); +#endif +} + +int Sys(const char *cmd, String& out) +{ + out.Clear(); + LocalProcess p; + if(!p.Start(cmd)) + return -1; + while(p.IsRunning()) { + out.Cat(p.Get()); + Sleep(1); // p.Wait would be much better here! + } + out.Cat(p.Get()); + return p.GetExitCode(); +} + +String Sys(const char *cmd) +{ + String r; + return Sys(cmd, r) ? String::GetVoid() : r; +} + +END_UPP_NAMESPACE diff --git a/uppsrc/usvn/SlaveProcess.h b/uppsrc/usvn/SlaveProcess.h new file mode 100644 index 000000000..5b88059ad --- /dev/null +++ b/uppsrc/usvn/SlaveProcess.h @@ -0,0 +1,73 @@ +#ifndef _usvn_SlaveProcess_h_ +#define _usvn_SlaveProcess_h_ + +#include + +NAMESPACE_UPP + +class SlaveProcess { + SlaveProcess(const SlaveProcess& sp); + void operator = (const SlaveProcess& sp); + +public: + virtual void Kill() = 0; + virtual bool IsRunning() = 0; + virtual void Write(String s) = 0; + virtual bool Read(String& s) = 0; + virtual int GetExitCode() = 0; + virtual void Detach() {}; + + String Get() { String x; if(Read(x)) return x; return String::GetVoid(); } + + SlaveProcess() {} + virtual ~SlaveProcess() {} +}; + +class LocalProcess : public SlaveProcess { +public: + virtual void Kill(); + virtual bool IsRunning(); + virtual void Write(String s); + virtual bool Read(String& s); + virtual int GetExitCode(); + virtual void Detach(); + +private: + void Init(); + void Free(); +#ifdef PLATFORM_POSIX + bool DecodeExitCode(int code); +#endif + +private: +#ifdef PLATFORM_WIN32 + HANDLE hProcess; + HANDLE hOutputRead; + HANDLE hInputWrite; +#endif +#ifdef PLATFORM_POSIX + Buffer cmd_buf; + Vector args; + pid_t pid; + int rpipe[2], wpipe[2]; + String exit_string; + bool output_read; +#endif + int exit_code; + +public: + typedef LocalProcess CLASSNAME; + + bool Start(const char *cmdline, const char *envptr = NULL); + + LocalProcess() { Init(); } + LocalProcess(const char *cmdline, const char *envptr = NULL) { Init(); Start(cmdline, envptr); } + virtual ~LocalProcess() { Kill(); } +}; + +int Sys(const char *cmd, String& output); +String Sys(const char *cmd); + +END_UPP_NAMESPACE + +#endif diff --git a/uppsrc/usvn/SvnSync.cpp b/uppsrc/usvn/SvnSync.cpp new file mode 100644 index 000000000..4682b8fcb --- /dev/null +++ b/uppsrc/usvn/SvnSync.cpp @@ -0,0 +1,56 @@ +#include "usvn.h" + +SvnSync::SvnSync() +{ + CtrlLayoutOKCancel(*this, "SvnSynchronize SVN repositories"); + list.AddIndex(); + list.AddIndex(); + list.AddColumn("Action"); + list.AddColumn("Path"); + list.ColumnWidths("153 619"); + list.NoCursor().EvenRowColor(); + Sizeable().Zoomable(); +} + +void SvnSync::Add(const char *working) +{ + String path = GetFullPath(working); + list.Add(REPOSITORY, path, + AttrText("Working directory").SetFont(StdFont().Bold()).Ink(White).Paper(Blue), + AttrText(path).SetFont(Arial(20).Bold()).Paper(Blue).Ink(White)); + list.SetLineCy(list.GetCount() - 1, 26); + Vector ln = Split(Sys("svn status " + path), '\n'); + bool actions = false; + for(int i = 0; i < ln.GetCount(); i++) { + String h = ln[i]; + if(h.GetCount() > 7) { + String file = h.Mid(7); + if(IsFullPath(file)) { + h.Trim(7); + int action = h.Mid(1, 6) == " " ? String("MC?!").Find(h[0]) : -1; + String an; + Color color; + if(action < 0) + color = Gray; + else { + static const char *as[] = { "Modify", "Conflict resolved", "Add", "Remove" }; + static Color c[] = { LtBlue, Magenta, Green, LtRed }; + an = as[action]; + color = c[action]; + actions = true; + } + int ii = list.GetCount(); + list.Add(action, file, + action < 0 ? Value(AttrText("Unknown: " + h.Mid(0, 7)).Ink(color)) : Value(true), + AttrText(" " + file.Mid(path.GetCount() + 1)).Ink(color)); + if(action >= 0) + list.SetCtrl(ii, 0, confirm.Add().SetLabel(an).NoWantFocus()); + } + } + } + if(actions) { + list.Add(MESSAGE, Null, AttrText("Commit message:").SetFont(StdFont().Bold())); + list.SetLineCy(list.GetCount() - 1, EditField::GetStdHeight() + 4); + list.SetCtrl(list.GetCount() - 1, 1, message.Add()); + } +} diff --git a/uppsrc/usvn/SvnWorks.cpp b/uppsrc/usvn/SvnWorks.cpp new file mode 100644 index 000000000..a3116180c --- /dev/null +++ b/uppsrc/usvn/SvnWorks.cpp @@ -0,0 +1,157 @@ +#include "usvn.h" + +FileSel& sSD() { + static FileSel fs; + ONCELOCK { + fs.AllFilesType(); + } + return fs; +} + +String NormalizePathNN(const String& path) +{ + return IsNull(path) ? path : NormalizePath(path); +} + +static void sSetFolder(EditField *f) +{ + if(!sSD().ExecuteSelectDir()) return; + *f <<= NormalizePathNN(~sSD()); +} + +void SvnWorks::DirSel(EditField& f) +{ + f.AddFrame(dirsel); + dirsel <<= callback1(&sSetFolder, &f); + dirsel.SetImage(CtrlImg::smallright()).NoWantFocus(); +} + + +void SvnWorks::Add(const String& working, const String& user, const String& data) +{ + list.Add(working, user, data); + Sync(); +} + +void SvnWorks::New() +{ + WithSvnFolderLayout dlg; + CtrlLayoutOKCancel(dlg, "Add SVN working directory"); + DirSel(dlg.working); + if(dlg.Execute() != IDOK) + return; + Add(~dlg.working, ~dlg.user, ~dlg.password); +} + +void SvnWorks::Edit() +{ + if(!list.IsCursor()) + return; + WithSvnFolderLayout dlg; + CtrlLayoutOKCancel(dlg, "Edit SVN working directory item"); + DirSel(dlg.working); + dlg.working <<= list.Get(0); + dlg.user <<= list.Get(1); + dlg.password <<= list.Get(2); + if(dlg.Execute() != IDOK) + return; + list.Set(0, ~dlg.working); + list.Set(1, ~dlg.user); + list.Set(2, ~dlg.password); + Sync(); +} + +void SvnWorks::Checkout() +{ + WithSvnCheckoutLayout dlg; + CtrlLayoutOKCancel(dlg, "Checkout SVN repository"); + DirSel(dlg.working); + if(dlg.Execute() != IDOK) + return; + String working = ~dlg.working; + working = GetFullPath(working); + if(working.GetCount() == 0) { + Exclamation("Empty working directory"); + return; + } + RealizeDirectory(working); + Add(~dlg.working, ~dlg.user, ~dlg.password); + String cmd; + cmd << "svn checkout --non-interactive"; + if(!IsNull(dlg.user)) + cmd << " --user \"" << ~dlg.user << "\""; + if(!IsNull(dlg.password)) + cmd << " --user \"" << ~dlg.password << "\""; + cmd << ' ' << ~dlg.repository << ' ' << ~dlg.working; + SysConsole con; + con.System(cmd); + con.Execute(); +} + +void SvnWorks::Remove() +{ + if(list.IsCursor() && PromptYesNo("Remove the item?")) + list.Remove(list.GetCursor()); + Sync(); +} + +void SvnWorks::Sync() +{ + edit.Enable(list.IsCursor()); + remove.Enable(list.IsCursor()); +} + +int SvnWorks::GetCount() const +{ + return list.GetCount(); +} + +SvnWork SvnWorks::operator[](int i) const +{ + SvnWork w; + w.working = list.Get(i, 0); + w.user = list.Get(i, 1); + w.password = list.Get(i, 2); + return w; +} + +void SvnWorks::Clear() +{ + list.Clear(); + Sync(); +} + +void SvnWorks::Load(const String& text) +{ + list.Clear(); + Vector ln = Split(text, '\n'); + for(int i = 0; i < ln.GetCount(); i++) { + Vector q = Split(ln[i], ';'); + if(q.GetCount() >= 1) + Add(q[0], q.At(1), q.At(2)); + } + Sync(); +} + +String SvnWorks::Save() const +{ + String h; + for(int i = 0; i < list.GetCount(); i++) + h << list.Get(i, 0) << ';' << list.Get(i, 1) << ';' << list.Get(i, 2) << '\n'; + return h; +} + +SvnWorks::SvnWorks() +{ + CtrlLayoutExit(*this, "SVN Working directories"); + list.AddColumn("Working directory"); + list.AddColumn("User"); + list.AddColumn("Password"); + list.Moving(); + list.ColumnWidths("364 100 100"); + add <<= THISBACK(New); + remove <<= THISBACK(Remove); + checkout <<= THISBACK(Checkout); + edit <<= THISBACK(Edit); + Sync(); +} diff --git a/uppsrc/usvn/init b/uppsrc/usvn/init new file mode 100644 index 000000000..64977b789 --- /dev/null +++ b/uppsrc/usvn/init @@ -0,0 +1,4 @@ +#ifndef _usvn_icpp_init_stub +#define _usvn_icpp_init_stub +#include "CtrlLib/init" +#endif diff --git a/uppsrc/usvn/main.cpp b/uppsrc/usvn/main.cpp new file mode 100644 index 000000000..6726ef1f6 --- /dev/null +++ b/uppsrc/usvn/main.cpp @@ -0,0 +1,28 @@ +#include "usvn.h" + +GUI_APP_MAIN +{ +/* SysConsole con; + for(int i = 0; i < 5; i++) + con.System("ls"); + con.System("svn"); +// con.System("ls /usr/lib"); +// con.System("ls /usr/bin"); + con.System("ls *.wert"); + con.Execute(); + return;*/ + SvnWorks works; + works.Load(LoadFile(ConfigFile("svnworks"))); + works.Execute(); + SaveFile(ConfigFile("svnworks"), works.Save()); + return; + SvnSync sync; + sync.Add("/home/cxl/uppsrc.svn/upp"); + sync.Add("/home/cxl/centrum/SocNet"); + sync.Run(); + return; + DUMP(Sys("ls")); + DUMP(Sys("svn status /home/cxl/centrum/SocNet")); + DUMP(Sys("svn update /home/cxl/centrum/SocNet")); + return; +} diff --git a/uppsrc/usvn/notes.txt b/uppsrc/usvn/notes.txt new file mode 100644 index 000000000..953ca6cb2 --- /dev/null +++ b/uppsrc/usvn/notes.txt @@ -0,0 +1,48 @@ +* /home/cxl/uppout/GCC.Debug.Debug_full.Gui.Shared/usvn 31.07.2008 15:53:12, user: cxl + +Sys("ls") = +Sys("svn status /home/cxl/centrum/SocNet") = M /home/cxl/centrum/SocNet/BACKEND/UPP/pb/pb.cpp +M /home/cxl/centrum/SocNet/BACKEND/UPP/asv/asv.txt +M /home/cxl/centrum/SocNet/BACKEND/UPP/asw/asw.h +M /home/cxl/centrum/SocNet/BACKEND/UPP/asw/Worker.cpp +M /home/cxl/centrum/SocNet/BACKEND/UPP/asw/Request.cpp + +Sys("svn update /home/cxl/centrum/SocNet") = U /home/cxl/centrum/SocNet/frontend/trunk/ajax/views.py +U /home/cxl/centrum/SocNet/frontend/trunk/views.py +U /home/cxl/centrum/SocNet/frontend/trunk/static/search-field.gif +A /home/cxl/centrum/SocNet/frontend/trunk/static/gallery-r-bg.png +U /home/cxl/centrum/SocNet/frontend/trunk/static/js/jquery/jquery.iMenu.0.1.js +U /home/cxl/centrum/SocNet/frontend/trunk/static/js/wall.js +U /home/cxl/centrum/SocNet/frontend/trunk/static/js/boxes.js +A /home/cxl/centrum/SocNet/frontend/trunk/static/img/user-empty.png +D /home/cxl/centrum/SocNet/frontend/trunk/static/img/friend-empty.png +U /home/cxl/centrum/SocNet/frontend/trunk/static/select-l.gif +A /home/cxl/centrum/SocNet/frontend/trunk/static/badge-select.gif +U /home/cxl/centrum/SocNet/frontend/trunk/static/css/blueprint/screen.css +U /home/cxl/centrum/SocNet/frontend/trunk/static/css/layout.css +U /home/cxl/centrum/SocNet/frontend/trunk/static/css/profile.css +U /home/cxl/centrum/SocNet/frontend/trunk/static/search-btn.gif +A /home/cxl/centrum/SocNet/frontend/trunk/static/arrow-bull.gif +A /home/cxl/centrum/SocNet/frontend/trunk/static/login-icon.gif +A /home/cxl/centrum/SocNet/frontend/trunk/static/imenu-bg.gif +A /home/cxl/centrum/SocNet/frontend/trunk/static/gallery-l-bg.png +U /home/cxl/centrum/SocNet/frontend/trunk/templates/groups/index.html +U /home/cxl/centrum/SocNet/frontend/trunk/templates/profile/panel.html +U /home/cxl/centrum/SocNet/frontend/trunk/templates/profile/index.html +U /home/cxl/centrum/SocNet/frontend/trunk/templates/profile/friends.html +A /home/cxl/centrum/SocNet/frontend/trunk/templates/registr.html +U /home/cxl/centrum/SocNet/frontend/trunk/templates/activate.html +U /home/cxl/centrum/SocNet/frontend/trunk/templates/events/index.html +U /home/cxl/centrum/SocNet/frontend/trunk/templates/search.html +A /home/cxl/centrum/SocNet/frontend/trunk/templates/maintainance.html +U /home/cxl/centrum/SocNet/frontend/trunk/templates/login.html +U /home/cxl/centrum/SocNet/frontend/trunk/templates/logout.html +U /home/cxl/centrum/SocNet/frontend/trunk/templates/base.html +U /home/cxl/centrum/SocNet/frontend/trunk/locale/cs/LC_MESSAGES/django.po +U /home/cxl/centrum/SocNet/frontend/trunk/profile/admin.py +U /home/cxl/centrum/SocNet/frontend/trunk/profile/views.py +U /home/cxl/centrum/SocNet/frontend/trunk/profile/models.py +U /home/cxl/centrum/SocNet/frontend/trunk/urls.py +U /home/cxl/centrum/SocNet/frontend/trunk/forms.py +U /home/cxl/centrum/SocNet/redmine/report/assets/stylesheets/default.css +Updated to revision 631. diff --git a/uppsrc/usvn/usvn.h b/uppsrc/usvn/usvn.h new file mode 100644 index 000000000..959778af4 --- /dev/null +++ b/uppsrc/usvn/usvn.h @@ -0,0 +1,89 @@ +#ifndef _usvn_usvn_h_ +#define _usvn_usvn_h_ + +#include + +using namespace Upp; + +#include "SlaveProcess.h" + +#define LAYOUTFILE +#include + +struct Repo { + String repo; + String work; + String user; + String pswd; + + void Save(String& s); + void Load(CParser& p); +}; + +struct SvnWork { + String working; + String user; + String password; +}; + +class SvnWorks : public WithSvnWorksLayout { + void New(); + void Edit(); + void Remove(); + void Checkout(); + void Sync(); + + FrameRight