CS360 Lecture notes -- Libfdr: Jvals, Fields, Dllists, Red-Black Trees

  • Jim Plank
  • Directory: ~plank/cs360/notes/Libfdr
  • Lecture notes: http://www.cs.utk.edu/~plank/plank/classes/cs360/360/notes/Libfdr
  • Wed Aug 25 11:01:12 EDT 1999
  • Last change: Fri Mar 2 10:50:47 EST 2012
    We will be doing a lot of hacking in this class. There are a few basic data structures that we will be using. These are: Each of these has a set of lecture notes associated with them. You should read each of these to familiarize yourself with them. Lab 1 makes you use all of them.

    A few notes: The Dllist library is different from the one that I have used in CS360 in the past. The main difference is that it uses jvals rather than void stars for its value field. If you are not used to this, go over the lecture notes. The old library only had one `l' (``Dlist'' rather than ``Dllist''). Keep it in mind in case you see stuff with one `l'.

    The red-black tree library is new as of fall, 1999. I got rid of all those disgusting unions and bit fields, and I made the key and val fields jvals. The new name for everything is ``jrb'' rather than ``rb''.


    Obtaining the Source Code

    You can get the source code as a shar file in one of three ways: Or you can get it as a tar file in one of three ways:

    Roger Montgomery sent me a Zip file with Red Black tree code for C++ that he used for Windows development. I include it Here. I have not tried it, but if you're looking for C++ Red-Black tree code, give it a whirl (2011).


    Compilation and Linking

    To compile your code, you need to use the complier flag -I/home/plank/cs360/include. For example, if you have included ``fields.h'' and ``dllist.h'' in your program lab1.c, then your first compilation step is:
    gcc -g -I/home/plank/cs360/include -c lab1.c
    
    That will make lab1.o. Now, when you go to link lab1.o into an executable, you need to link with /home/plank/cs360/objs/libfdr.a:
    gcc -g -o lab1 lab1.o /home/plank/cs360/objs/libfdr.a
    
    As always, you can do all of this in a makefile to make your life easier. We will provide makefiles for the first few labs. After that, you'll probably be on your own.

    Using libfdr on other systems

    If you want to use libfdr.a on other systems, copy all the files from /home/plank/src/libfdr and type make. That should get you a libfdr.a for your system.