.tutorial

git-svn-id: svn://ultimatepp.org/upp/trunk@10561 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
cxl 2016-12-20 13:42:01 +00:00
parent ef1b94c4c2
commit 94cdcbc2c9
4 changed files with 29 additions and 16 deletions

View file

@ -4,7 +4,7 @@ void CoAlgoTutorial()
{
/// .Parallel algorithms
/// U++ provides a parallel version of algorithms where it makes sense. The naming scheme
/// U++ provides a parallel versions of algorithms where it makes sense. The naming scheme
/// is 'Co' prefix before the name of algorithm designates the parallel version.
/// So the parallel version of e.g. `FindIndex` is `CoFindIndex`, for 'Sort' it is 'CoSort':

View file

@ -9,15 +9,21 @@ int minor = 0;
String qtf =
"[ $$0,0#00000000000000000000000000000000:Default]"
"[a83;*R6 $$1,3#31310162474203024125188417583966:caption]"
"[H4;b83;*6 $$2,3#07864147445237544204411237157677:title]"
"[b83;*6 $$2,3#07864147445237544204411237157677:title]"
"[b42;a42 $$3,3#45413000475342174754091244180557:text]"
"[l100;C@5*;1 $$4,4#20902679421464641399138805415013:code]"
"[l100;*C$7;2 $$5,5#07531550463529505371228428965313:log]"
"[H4;b73;*5 $$2,3#07864147445237544204111237153677:subtitle]"
"[H6;b73;*7 $$6,3#07864147445237544204111237153677:section]"
;
#define OUT(x) out << x << '\n';
void Section(const String& title)
{
qtf << "[s6; " << AsString(++major) << "." << ' ' + TrimBoth(title) << "&]";
minor = 0;
}
void FlushDoc(String& docblock)
{
docblock = TrimBoth(docblock);
@ -29,16 +35,9 @@ void FlushDoc(String& docblock)
bool title = false;
String style = "[s3;";
if(docblock.StartsWith("..")) {
docblock = AsString(major) + "." + AsString(++minor) + ' ' + TrimBoth(docblock.Mid(2));
style = "[s7;";
title = true;
}
else
if(docblock.StartsWith(".")) {
docblock = AsString(++major) + "." + ' ' + TrimBoth(docblock.Mid(1));
minor = 0;
style = "[s2;";
docblock = AsString(major) + "." + AsString(++minor) + ' ' + TrimBoth(docblock.Mid(1));
style = minor == 1 ? "[s2;" : "[s2;H4";
title = true;
}
@ -135,11 +134,18 @@ void MakeTutorial()
line = atoi(ln) - 1;
}
else
if(ln.StartsWith("=-="))
logline.Add(String()).Add(MakeTuple(0, ln.Mid(4)));
else
if(path.GetCount())
logline.GetAdd(path).Add(MakeTuple(line, ln));
}
for(auto&& f : ~logline) {
if(IsNull(f.key)) {
Section(f.value[0].b);
continue;
}
Vector<String> src = Split(Filter(LoadFile(f.key), [] (int c) { return c == '\r' ? 0 : c; }), '\n', false);
int i = 0;
int logi = 0;

View file

@ -48,4 +48,6 @@ using namespace Upp;
#define DO(x) void x(); x();
#define SECTION(x) UPP::VppLog() << "=-= " << x << '\n';
void MakeTutorial();

View file

@ -2,6 +2,7 @@
GUI_APP_MAIN
{
SECTION("Basics");
DO(Logging);
DO(StringTutorial);
DO(StringBufferTutorial);
@ -11,6 +12,7 @@ GUI_APP_MAIN
DO(CombineHashTutorial);
DO(ComparableTutorial);
SECTION("Array containers");
DO(Vector1);
DO(Vector2);
DO(Transfer);
@ -18,7 +20,6 @@ GUI_APP_MAIN
DO(ArrayTutorial);
DO(PolyArray);
DO(Bidirectional);
DO(IndexTutorial);
DO(IndexClient);
DO(Map);
@ -28,18 +29,22 @@ GUI_APP_MAIN
DO(SortedMap);
DO(TupleTutorial);
SECTION("Ranges and algoritims");
DO(Range);
DO(Algo);
DO(Sorting);
DO(FunctionTutorial);
DO(CapturingContainers);
SECTION("Value");
DO(ValueTutorial);
DO(NullTutorial);
DO(Value2Tutorial);
DO(ValueArrayMap);
SECTION("Function and lambdas");
DO(FunctionTutorial);
DO(CapturingContainers);
SECTION("Multithreading");
DO(ThreadTutorial);
DO(MutexTutorial);
DO(ConditionVariableTutorial);