- Create my own branch for tutorials and stuff like that

- Added vector example
- Added threading example
- Added glibmm source (for the examples)
- temp defines.h hack
master
Steve Clement 2013-07-20 18:14:54 +02:00
parent 52669ecd51
commit 6f154e80ab
5 changed files with 56 additions and 0 deletions

View File

@ -37,6 +37,8 @@ struct frame_t
unsigned char z;
unsigned char windows[HEIGHT][WIDTH][CHANNELS];
unsigned char segments[SEGWIDTH][SEGNUM][SEGCHANNELS];
// int windows[HEIGHT][WIDTH][CHANNELS];
// int segments[SEGWIDTH][SEGNUM][SEGCHANNELS];
};
#endif

1
frameserver/glibmm Submodule

@ -0,0 +1 @@
Subproject commit 53596ab1de401a084fffaf7cd181dd1663d14630

25
frameserver/vector.cc Normal file
View File

@ -0,0 +1,25 @@
// constructing vectors
#include <iostream>
#include <vector>
int main ()
{
unsigned int i;
// constructors used in the same order as described above:
std::vector<int> first; // empty vector of ints
std::vector<int> second (4,100); // four ints with value 100
std::vector<int> third (second.begin(),second.end()); // iterating through second
std::vector<int> fourth (third); // a copy of third
// the iterator constructor can also be used to construct from arrays:
int myints[] = {16,2,77,29};
std::vector<int> fifth (myints, myints + sizeof(myints) / sizeof(int) );
std::cout << "The contents of fifth are:";
for (std::vector<int>::iterator it = fifth.begin(); it != fifth.end(); ++it)
std::cout << ' ' << *it;
std::cout << '\n';
return 0;
}

BIN
tutorial/countch Executable file

Binary file not shown.

28
tutorial/countch.cpp Normal file
View File

@ -0,0 +1,28 @@
#include <map>
#include <iostream>
using namespace std;
int main() {
map<char, int> freqs;
char ch;
while (cin .get(ch))
freqs[ch]++;
int i;
map<char,int>::iterator it;
for (i=1, it = freqs.begin(); it != freqs.end(); ++it,++i) {
switch (it->first)
{
case '\r': cout << "\\r"; break;
case '\t': cout << "\\t"; break;
case '\n': cout << "\\n"; break;
case ' ' : cout << "Space"; break;
default: cout << it->first;
}
cout << "\t" << it->second << ((i%4) ? "\t" : "\n");
}
// cout << freqs;
}