-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathoostubs_task3.patch
810 lines (800 loc) · 24.4 KB
/
oostubs_task3.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
>From 772447e904b1033a2efdfb0effa39bd3acc6f7ff Mon Sep 17 00:00:00 2001
From: Christoph Steup <[email protected]>
Date: Wed, 17 Nov 2010 17:27:06 +0100
Subject: [PATCH] Third task
---
include/device/keyboard.h | 96 ++++++++++++++++++++-----------------
include/device/panic.h | 71 +++++++++++++++-------------
include/guard/gate.h | 116 +++++++++++++++++++++++++++++++++------------
include/guard/guard.h | 61 +++++++++++++++++++++++
include/guard/locker.h | 69 +++++++++++++++++++++++++++
include/guard/secure.h | 42 ++++++++++++++++
include/object/chain.h | 23 +++++++++
include/object/queue.h | 59 +++++++++++++++++++++++
include/user/task3.h | 27 ++++++++++
src/guard/guard.cc | 9 ++++
src/main.cc | 5 +-
src/object/queue.cc | 54 +++++++++++++++++++++
src/user/task3.cc | 51 ++++++++++++++++++++
13 files changed, 574 insertions(+), 109 deletions(-)
create mode 100644 include/guard/guard.h
create mode 100644 include/guard/locker.h
create mode 100644 include/guard/secure.h
create mode 100644 include/object/chain.h
create mode 100644 include/object/queue.h
create mode 100644 include/user/task3.h
create mode 100644 src/guard/guard.cc
create mode 100644 src/object/queue.cc
create mode 100644 src/user/task3.cc
diff --git a/include/device/keyboard.h b/include/device/keyboard.h
index 58d5f76..0f8997f 100644
--- a/include/device/keyboard.h
+++ b/include/device/keyboard.h
@@ -1,43 +1,53 @@
-/*---------------------------------------------------------------------------*
- * Operating Systems I *
- *---------------------------------------------------------------------------*
- * *
- * K E Y B O A R D *
- * *
- *---------------------------------------------------------------------------*/
-
-#ifndef __Keyboard_include__
-#define __Keyboard_include__
-
-#include "machine/keyctrl.h"
-#include "guard/gate.h"
-#include "machine/key.h"
-
-/** \brief %Keyboard driver with interrupt support
- *
- * This class is a subclass of Gate and implements the interrupt routine used
- * for the keyboard.
- */
-class Keyboard : public Keyboard_Controller, public Gate {
-
-public:
-
- /** \brief enable the interrupt mechanism of the keyboard
- *
- * \todo write implementation
- *
- * Method plugin() enables all keyboard interrupts. After calling plugin()
- * interrupts activated by the keyboard are recognised.
- */
- void plugin ();
-
- /** \brief handle keyboard interrupt
- *
- * \todo write implementation
- *
- * **/
-
- virtual void trigger ();
-};
-
-#endif
+/*---------------------------------------------------------------------------*
+ * Operating Systems I *
+ *---------------------------------------------------------------------------*
+ * *
+ * K E Y B O A R D *
+ * *
+ *---------------------------------------------------------------------------*/
+
+#ifndef __Keyboard_include__
+#define __Keyboard_include__
+
+#include "machine/keyctrl.h"
+#include "guard/gate.h"
+
+/** \brief %Keyboard driver with interrupt support
+ *
+ * This class is a subclass of Gate and implements the interrupt routine used
+ * for the keyboard.
+ */
+class Keyboard : public Keyboard_Controller, public Gate {
+private:
+ /** \brief storage for fetched keys
+ *
+ * \todo write declaration
+ **/
+
+public:
+
+ /** \brief enable the interrupt mechanism of the keyboard
+ *
+ * \todo write implementation
+ *
+ * Method plugin() enables all keyboard interrupts. After calling plugin()
+ * interrupts activated by the keyboard are recognised.
+ **/
+ void plugin ();
+
+ /** \brief fetch the key from the controller
+ *
+ * \todo write implementation
+ *
+ * \return true if epilogue must be executed afterwards, false otherwise
+ **/
+ virtual bool prologue ();
+
+ /** \brief print the fetched key to the screen
+ *
+ * \todo write implementation
+ **/
+ virtual void epilogue();
+};
+
+#endif
diff --git a/include/device/panic.h b/include/device/panic.h
index 7455fe5..1f1c3ba 100644
--- a/include/device/panic.h
+++ b/include/device/panic.h
@@ -1,33 +1,38 @@
-/*---------------------------------------------------------------------------*
- * Operating Systems I *
- *---------------------------------------------------------------------------*
- * *
- * P A N I C *
- * *
- *---------------------------------------------------------------------------*/
-
-#ifndef __panic_include__
-#define __panic_include__
-
-/* INCLUDES */
-#include "guard/gate.h"
-
-/** \brief Default interrupt handler
- *
- * This class is a subclass of Gate and implements a standard interrupt routine
- * used as default for unknown/registered interrupts.
- */
-class Panic : public Gate {
-public:
-
- /** \brief handle unknown/unregistered interrupt
- *
- * \todo write implementation
- *
- * For debug purposes the cpu will be halted if an unknown interrupt occurs.
- **/
- virtual void trigger();
-
-};
-
-#endif
+/*---------------------------------------------------------------------------*
+ * Operating Systems I *
+ *---------------------------------------------------------------------------*
+ * *
+ * P A N I C *
+ * *
+ *---------------------------------------------------------------------------*/
+
+#ifndef __panic_include__
+#define __panic_include__
+
+/* INCLUDES */
+#include "guard/gate.h"
+
+/** \brief Default interrupt handler
+ *
+ * This class is a subclass of Gate and implements a standard interrupt routine
+ * used as default for interrupts.
+ */
+class Panic : public Gate {
+public:
+
+ /** handle unknown interrupt and halt system
+ *
+ * \todo write implementation
+ *
+ * \return always false, due to stopping of system
+ **/
+ virtual bool prologue ();
+
+ /** never called due to stopping of system
+ *
+ * \todo write implementation
+ **/
+ virtual void epilogue();
+};
+
+#endif
diff --git a/include/guard/gate.h b/include/guard/gate.h
index ff622dc..5a1ad0e 100644
--- a/include/guard/gate.h
+++ b/include/guard/gate.h
@@ -1,31 +1,85 @@
-/*---------------------------------------------------------------------------*
- * Operating Systems I *
- *---------------------------------------------------------------------------*
- * *
- * G A T E *
- * *
- *---------------------------------------------------------------------------*/
-
-#ifndef __Gate_include__
-#define __Gate_include__
-
-/** \brief Interrupt handling base class
- *
- * Superclass of a set of classes that are able to handle interrupts. Every
- * subclass of Gate has to implement method trigger() with appropriated
- * behavior.
- **/
-class Gate {
-
-public:
- /** \brief interrupt handling method
- *
- * This method is called after an interrupt occured. It is executed
- * asynchronous to other activities of the operation system. To enable
- * different behavior according to the occured interrupt this method has to
- * be implemented in a subclasses of Gate.
- **/
- virtual void trigger() = 0;
-};
-
-#endif
+/*---------------------------------------------------------------------------*
+ * Operating Systems I *
+ *---------------------------------------------------------------------------*
+ * *
+ * G A T E *
+ * *
+ *---------------------------------------------------------------------------*/
+
+#ifndef __Gate_include__
+#define __Gate_include__
+
+#include "object/chain.h"
+
+/** \brief Interrupt handling base class
+ *
+ * Class Gate is the superclass of a set of classes that are able to handle
+ * interrupts. Every subclass of Gate has to implement method trigger() that
+ * implements the appropriated behavior of the handler.
+ */
+
+class Gate : public Chain {
+private:
+ /** \brief current queue state
+ *
+ * \todo write declaration
+ * **/
+
+public:
+ /**\brief Default Constructor
+ *
+ * \todo write implementation
+ *
+ * Sets this gate to be unqueued
+ **/
+ Gate(){
+
+ }
+
+ /** \brief Destructor
+ *
+ * does nothing
+ **/
+ virtual ~Gate(){
+ }
+
+ /** \brief Immediate part of interrupt handling
+ *
+ * To enalbe different behavior according to the occured interrupt this
+ * method has to be implemented in subclasses of Gate.
+ *
+ * @return TRUE if method epilogue() has to be executed afterwards.
+ */
+ virtual bool prologue() = 0;
+
+ /**\brief schedulable part of interrupt handling
+ *
+ * Just as method prologue() it
+ * has to be implemented in the subclasses of Gate.
+ *
+ **/
+ virtual void epilogue() = 0;
+
+ /** \brief set queuing status
+ *
+ * \todo write implementation
+ *
+ * \param q new queuing state
+ **/
+ void queued(bool q){
+
+ }
+
+ /** \brief get queuing status
+ *
+ * \todo write implementation
+ *
+ * \return true if queued, false otherwise
+ **/
+ bool queued() const{
+ return false;
+ }
+};
+
+#endif
+>>>>>>> 9f4cccc... Third task of OOStuBs:
diff --git a/include/guard/guard.h b/include/guard/guard.h
new file mode 100644
index 0000000..c4a88f6
--- /dev/null
+++ b/include/guard/guard.h
@@ -0,0 +1,61 @@
+/*---------------------------------------------------------------------------*
+ * Operating Systems I *
+ *---------------------------------------------------------------------------*
+ * *
+ * G U A R D *
+ * *
+ *---------------------------------------------------------------------------*/
+
+#ifndef __Guard_include__
+#define __Guard_include__
+
+#include "guard/locker.h"
+#include "guard/gate.h"
+
+/** \brief Interrupt synchronisation handler
+ *
+ * Guard enables the operating system to synchroniste actions of interrupt
+ * handlers for critical sections that are secured using the lock of the
+ * Guard object.
+ */
+class Guard : public Locker {
+ /** \brief queue of waiting epilogues
+ *
+ * \todo write declaration
+ **/
+
+ /** \brief remove a queued epilogue from the queue
+ *
+ * This method has to be called secured to ensure that the structure of the
+ * queue stays consistent.
+ *
+ * \todo write implementation
+ *
+ * @return a pointer to the Gate object implementing the next epilogue, or
+ * NULL if queue is empty.
+ */
+ Gate* remove_epilogue();
+
+public:
+ /** \brief leave the critical section
+ *
+ * Waiting epilogues can be processed now.
+ *
+ * \todo write implementation
+ **/
+ void leave();
+
+ /** \brief try to execute epilogue
+ *
+ * If possible the epilogue is processed right away but if the critical
+ * section used for the epilogue is locke the epilogue has to be queued for
+ * later processing.
+ *
+ * \todo write implementation
+ *
+ * @param item pointer to the Gate object implementing the epilogue.
+ **/
+ void relay(Gate* item);
+};
+
+#endif
diff --git a/include/guard/locker.h b/include/guard/locker.h
new file mode 100644
index 0000000..aa153aa
--- /dev/null
+++ b/include/guard/locker.h
@@ -0,0 +1,69 @@
+/*---------------------------------------------------------------------------*
+ * Operating Systems I *
+ *---------------------------------------------------------------------------*
+ * *
+ * L O C K E R *
+ * *
+ *---------------------------------------------------------------------------*/
+
+#ifndef __Locker_include__
+#define __Locker_include__
+
+/** \brief Atomic locking variable
+ *
+ * Class Locker imlements a locking variable used to secure critical sections of
+ * the operating system. It is important to notice that the locking variable
+ * used, only shows if a critical section is occupied or free. Waiting for the
+ * locking variable and securing the variable has to implemented otherwise.
+ */
+class Locker {
+protected:
+ /** atomar locking variable
+ *
+ * \todo write declaration
+ **/
+
+public:
+ /** \brief Default constructor
+ *
+ * Initialises the locking variable (free).
+ *
+ * \todo write implementation
+ **/
+ Locker(){
+
+ }
+
+ /** \brief enter a critical section
+ *
+ * Locks the variable.
+ *
+ * \todo write implementation
+ **/
+ void enter(){
+
+ }
+
+ /** \brief return from a critical section
+ *
+ * Releases locking variable.
+ *
+ * \todo write implementation
+ **/
+ void retne(){
+
+ }
+
+ /** \brief test for critical section
+ *
+ * \todo write implementation
+ *
+ * @return the value of the locking variable indicating if the critical
+ * section is occupied or free.
+ */
+ bool avail(){
+ return true;
+ }
+};
+
+#endif
diff --git a/include/guard/secure.h b/include/guard/secure.h
new file mode 100644
index 0000000..e65ce21
--- /dev/null
+++ b/include/guard/secure.h
@@ -0,0 +1,42 @@
+/*---------------------------------------------------------------------------*
+ * Operating Systems I *
+ *---------------------------------------------------------------------------*
+ * *
+ * S E C U R E *
+ * *
+ *---------------------------------------------------------------------------*/
+
+#ifndef __Secure_include__
+#define __Secure_include__
+
+/** \brief RAII implemented critical section
+ *
+ * Class Secure is used as a simple interface to set and release the
+ * lockvariable we used for securing critical sections of the operating system.
+ * The constructor locks and the destructor releases the variable, so simply
+ * declaring the object is enough to secure the scope of the object.
+ */
+class Secure {
+public:
+ /** \brief Default constructor enters critical section
+ *
+ * Sets the lock through method guard.enter().
+ *
+ * \todo write implementation
+ **/
+ Secure(){
+
+ }
+
+ /** \brief Default destructor leaving critical section
+ *
+ * Unsets the lock through method guard.leave().
+ *
+ * \todo write implementation
+ **/
+ ~Secure(){
+
+ }
+};
+
+#endif
diff --git a/include/object/chain.h b/include/object/chain.h
new file mode 100644
index 0000000..b5c104c
--- /dev/null
+++ b/include/object/chain.h
@@ -0,0 +1,23 @@
+/*---------------------------------------------------------------------------*
+ * Operating Systems I *
+ *---------------------------------------------------------------------------*
+ * *
+ * C H A I N *
+ * *
+ *---------------------------------------------------------------------------*/
+
+#ifndef __chain_include__
+#define __chain_include__
+
+/** \brief Single linked list element
+ *
+ * Chain implements the pointer enableing us to insert an object into a simple
+ * linked list.
+ */
+class Chain {
+public:
+ /** \brief pointer to next element in the queue **/
+ Chain* next;
+};
+
+#endif
diff --git a/include/object/queue.h b/include/object/queue.h
new file mode 100644
index 0000000..9779023
--- /dev/null
+++ b/include/object/queue.h
@@ -0,0 +1,59 @@
+/*---------------------------------------------------------------------------*
+ * Operating Systems I *
+ *---------------------------------------------------------------------------*
+ * *
+ * Q U E U E *
+ * *
+ *---------------------------------------------------------------------------*/
+
+#ifndef __queue_include__
+#define __queue_include__
+
+#include "object/chain.h"
+
+/** \brief Simple linked list of %Chain objects.
+ *
+ * Unlike other implementations of linked lists tail is not pointing to the last
+ * item of the list but to the next pointer of the last item or as long as the
+ * list is empty to the head of the list. This saves the verification for
+ * existing items if an item is queued. If however an item is removed this
+ * verification has to be done.
+ */
+class Queue {
+protected:
+ /** \brief pointer to first element of the queue **/
+ Chain* head;
+
+ /** \brief pointer to the pointer of the last list element
+ *
+ * if the list is empty this points to head
+ **/
+ Chain** tail;
+
+public:
+ /** Default constructor
+ *
+ * Intializes tghe queue to be empty, sets head to NULL and tail to point to head
+ **/
+ Queue () { head = 0; tail = &head; }
+
+ /** \brief insert item to the end of the list
+ *
+ * \param item pointer to chain element to be inserted
+ **/
+ void enqueue (Chain* item);
+
+ /** \brief remove item from the front of the list
+ *
+ * \return pointer to the removed element, or NULL if empty
+ **/
+ Chain* dequeue ();
+
+ /** \brief remove an item from the list
+ *
+ * \param item pointer to the item, that should be removed
+ **/
+ void remove (Chain* item);
+};
+
+#endif
diff --git a/include/user/task3.h b/include/user/task3.h
new file mode 100644
index 0000000..d077db9
--- /dev/null
+++ b/include/user/task3.h
@@ -0,0 +1,27 @@
+#include "user/appl.h"
+
+/** \brief Third test application
+ *
+ * This application test the functionality of the implemented interrupt
+ * synchronization system. It prints the task identification and then
+ * repeatedly draws a line in a secured section. Interrupts from the keyboard
+ * are printed onto the screen to a fixed location. This should not disturb the
+ * drawing of the line anymore.
+ **/
+class Task3 : public Application{
+ public:
+ /** \brief Default constructor
+ *
+ * prints task information and enables interrupts
+ **/
+ Task3();
+
+ /** \brief Destructor
+ *
+ * disables interrupts, should never be called due to the endless loop
+ **/
+ virtual ~Task3();
+
+ /** \brief prints the line **/
+ virtual void action();
+};
diff --git a/src/guard/guard.cc b/src/guard/guard.cc
new file mode 100644
index 0000000..f855684
--- /dev/null
+++ b/src/guard/guard.cc
@@ -0,0 +1,9 @@
+/*---------------------------------------------------------------------------*
+ * Operating Systems I *
+ *---------------------------------------------------------------------------*
+ * *
+ * G U A R D *
+ * *
+ *---------------------------------------------------------------------------*/
+
+#include "guard/guard.h"
diff --git a/src/main.cc b/src/main.cc
index b687439..f9d4c18 100644
--- a/src/main.cc
+++ b/src/main.cc
@@ -9,6 +9,7 @@
/* INCLUDES */
#include "machine/multiboot.h"
+//#include "user/task3.h"
/* GLOBAL OBJECTS */
@@ -23,7 +24,7 @@ extern "C" void kernel(uint32_t magic, const Multiboot_Info* addr);
* This is the entry point of the operating system. If this function returns
* all interrupts will be disabled and the cpu will be halted.
*
- * \todo uncomment Task2
+ * \todo uncomment Task3
*
* \param magic bootloader magic value
* \param addr address of multiboot info structure
@@ -31,7 +32,7 @@ extern "C" void kernel(uint32_t magic, const Multiboot_Info* addr);
void kernel(uint32_t magic, const Multiboot_Info* addr){
-//Task2 task;
+//Task3 task;
//task.action();
diff --git a/src/object/queue.cc b/src/object/queue.cc
new file mode 100644
index 0000000..ef16460
--- /dev/null
+++ b/src/object/queue.cc
@@ -0,0 +1,54 @@
+/*---------------------------------------------------------------------------*
+ * Operating Systems I *
+ *---------------------------------------------------------------------------*
+ * *
+ * Q U E U E *
+ * *
+ *---------------------------------------------------------------------------*/
+
+#include "object/queue.h"
+
+void Queue::enqueue (Chain* item) {
+ item->next = 0; // new item has no following item
+ *tail = item; // insert the element at the end of the list
+ tail = &(item->next); // and set new tail-pointer
+}
+
+Chain* Queue::dequeue () {
+ Chain* item;
+
+ item = head; // head points to the first item of the list
+ if (item) { // head ist NULL if list is empty
+ head = item->next; // Das erste Element aus der Liste ausklinken.
+ if (!head) // if list is now empty tail has to point to head
+ tail = &head;
+ else // otherwise delete entry for following item
+ item->next = 0;
+ }
+ return item;
+}
+
+void Queue::remove (Chain* item) {
+ Chain* cur;
+
+ if (head) {
+ cur = head; // start search at the head of the linked list
+ if (item == cur) // if first element is what we are looking for
+ dequeue (); // dequeue is enough
+ else {
+ // go through linked list one item at a time until end of list is reachted
+ // or next item is the item we look for
+ while (cur->next && item != cur->next) {
+ cur = cur->next;
+ }
+
+ if (cur->next) {
+ cur->next = item->next; // delete item from list
+ item->next = 0; // delete entry for following item
+
+ if (!cur->next) // if cur has no following item tail has to be
+ tail = &(cur->next); // updated.
+ }
+ }
+ }
+}
diff --git a/src/user/task3.cc b/src/user/task3.cc
new file mode 100644
index 0000000..ff8293b
--- /dev/null
+++ b/src/user/task3.cc
@@ -0,0 +1,51 @@
+#include "user/task3.h"
+#include "device/cgastr.h"
+#include "machine/cpu.h"
+#include "guard/secure.h"
+
+extern CGA_Stream kout;
+extern CPU cpu;
+
+Task3::Task3(){
+ kout.setpos(31,1);
+ kout << "OOStuBs - Task 3" << endl << endl;
+
+ cpu.enable_int();
+}
+
+Task3::~Task3(){
+
+ cpu.disable_int();
+}
+
+void Task3::action(){
+ unsigned short x,y;
+ unsigned char i=0;
+
+ {
+ Secure s;
+ kout.getpos(x,y);
+ }
+ while(1)
+ {
+ Secure s;
+ kout.setpos(x,y);
+ for(unsigned short j=0;j<39;j++)
+ kout << "-";
+ kout.flush();
+ switch(i++%4)
+ {
+ case(0): kout << "//";
+ break;
+ case(1): kout << "--";
+ break;
+ case(2): kout << "\\\\";
+ break;
+ case(3): kout << "||";
+ break;
+ }
+ for(unsigned short j=0;j<39;j++)
+ kout << "-";
+ kout << endl;
+ }
+}
--
1.7.2.2