Contents of the README.TXT file
This package is a port of CTask from C to C++, hence the name CPPTask. Since
this is a spare time (and until now for personal use only) activity, I have
not documented the changes that I have made.
For the most part, all of the changes that I have made were for converting
CTask to a class-based system. The original package was largely "object-
oriented" anyway. The interesting areas surfaced in the C++ to assembly
language interface (different linkage, etc.), and in the area of dynamic
allocation of tasks, pipes, etc. The first problem was solved by creating
C-linkage functions that invoked member functions. These functions are
used by the assembly language routines. For example, in several of the
assmbly language routines the function "inc_counter(counterptr)" was used.
Since that function became "counter::inc_counter(void)", I created a
function called "asm_inc_counter(counterptr)" with C-linkage. That function
simply invokes the member function:
void asm_inc_counter(counterptr ptr)
I'm not sure if this is the best way, but it works. Also, several of the
assembly language routines created objects, and since constructors cannot
be invoked directly, I moved the creation of the objects to the C++ code
and used the objects as described earlier.
The biggest problem was the dynamic creation of objects. The C version of
the create_??? routines checked for a NULL pointer and allocated memory if
necessary. I redefined the new operator to perform the same processing.
I am not sure if I have done everything that is necessary in the new "new".
The file TSKALLOC.CPP contains the code. Also, I created "task::operator new"
and "task::operator delete" to perform some processing previously done
elsewhere. One final change in this area concerns the deletion of tasks
that are enqueued on a timer queue. The original version merely set a
flag in the tlink structure that indicated that this entry could be deleted.
Unfortunately, the statement:
could be disasterous if a timer queue was pointing to it. My solution was
to change the task definition to include a pointer to a tlink structure
instead of having the structure nested. This would allow the parent task
to be deleted and the tlink structure to be marked for deletion when it was
removed from the timer queue.
I also removed the Named object processing (I was to lazy to convert it),
and the support for other compilers. Since I was converting it to Turbo C++
and I have no access to any other, I would be unable to test any conditional
compilations anyway. Finally, I have not yet ported the parallel port
interface or the AT-BIOS interface.
Other than added some comments and rearranging some of the files, that is
all I changed (funny it doesn't sound like much now.) I also changed the
name of a couple of the structures, (so they made more sense to me) I hope
this doesn't cause to much confusion.
I am still not convinced that I have covered everything in the area of
dynamic allocation and deallocation. I have tried some very minor variations
on the original test programs, and it seems to work , but...
P.S. Here is a list of the files included in the archive:
tskmain.cpp - some of the main routines, and the declaration of
the static objects
tsksub.cpp - some support routines
tsktask.cpp - task object routines
tsktimer.cpp - timer object routines
tskalloc.cpp - memory allocation routines
tskrsc.cpp - resource object routines
tskcnt.cpp - counter object routines
tskflg.cpp - flag object routines
tskmsg.cpp - mailbox object routines
tskpip.cpp - pipe object routines
tskwpip.cpp - word pipe class routines
tskbuf.cpp - buffer class routines
tsksio.cpp - comm port class routines
conout.cpp - sample use of console output
test.cpp - simple test program
tsio.cpp - simple serial I/O test program
conout.hpp - header file for sample console output
sio.hpp - header file for comm port class
task.hpp - header file for all other classes
tskconf.hpp - header file containing configuration definitions
tsklocal.hpp - header file used internally by CPPTask
tskasm.asm - scheduler
tskbios.asm - BIOS support (NOT PORTED!!!)
tskdos.asm - DOS support
tskkbd.asm - keyboard support
tsktim.asm - timer interrupt support
tsk.mac - include file for assembly language
test.prj - sample project file
tsio.prj - sample project file