home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Professional
/
OS2PRO194.ISO
/
os2
/
prgramer
/
mltiscop
/
tutor.c
< prev
next >
Wrap
C/C++ Source or Header
|
1989-07-28
|
2KB
|
112 lines
/* Logitech MultiScope Debugger Tutorial Program
* Copyright (C) 1989 Logitech, Inc.
*
* This is the main 'C' module for TUTOR.C.
*/
#include <stdio.h>
#include <malloc.h>
#include <string.h>
#include <os2def.h>
#define INCL_DOS
#include <bse.h>
struct DataRec {
struct DataRec far *left, far *right;
int value;
int uc;
char dataString[129];
}
/* import binary tree structure functions */
extern InitInsert();
extern Insert(struct DataRec far *);
extern Print();
extern unsigned int Fibonacci(unsigned int);
/* import graphical data & functions */
extern llrasmain();
VOID FAR thread_1();
static int count=0;
struct ArrayRec {
int data;
double realval;
} array[128];
main()
{
int val, max, i;
PBYTE th1Stack, th2Stack;
TID tidTh1, tidTh2;
printf("Logitech MultiScope Tutorial Program\n");
printf("Enter \"MSDEMO\" to begin!\n");
th1Stack = malloc(4000); /* create a new thread */
th1Stack += 4000;
DosCreateThread((PFNTHREAD)thread_1, &tidTh1, th1Stack);
/* make graphical data structure */
llrasmain();
/* init sort tree */
InitInsert();
DosSleep(500L);
/* build sort tree */
ChooseMe(1,"MultiScope",3);
ChooseMe(7,"DBX",3);
ChooseMe(4,"SYMDEB",3);
ChooseMe(100,"GDBX",3);
ChooseMe(12,"GDB",3);
ChooseMe(55,"CodeView",3);
ChooseMe(99,"Turbo Debugger",3);
ChooseMe(43,"DEBUG",3);
/* print result */
Print();
/* exit */
exit(0);
}
ChooseMe(i, s, j)
int i;
char *s;
int j;
{
struct DataRec *new;
float d;
d = j / 2;
new = malloc(sizeof(struct DataRec));
new->value = i;
strcpy(new->dataString, s);
Insert(new);
array[count].realval = d;
array[count].data = i;
BreakMe();
}
BreakMe()
{
++count;
}
VOID FAR thread_1()
{
int val;
while (1) {
val = Fibonacci(500); /* calculate Fibonacci numbers below 500 */
DosSleep(50L);
}
}