Assignment #10: Unix, C, and LIP

In the operating systems and later courses, you will need to write code in C, probably on Unix, that interfaces with some old libraries.This assignment is intended to get you a little Unix practice. You will work with a Large Integer Package. If you look at the code you will see it is optimized to death and extremely tricky. Almost nobody in the world would be able to understand the code because it uses extremely sophisticated algorithms. It is not the kind of code you would expect to see immediately in Java. So folks that are doing intensive numerical work, such as prime number searchs, have to program in C.

For this assignment you MUST use one of the AUL's Unix machines. Even if you have no Unix experience, I expect you to be able to figure out how to do minimal Unix work at this stage of your academic career. Don't ask for help. There are documents available in PC and probably in the AUL that will help you with Unix, but I do not expect you to need them.

Steps

  1. Transfer the file /home/aul1/cop3530/freelip_1.1.tar.gz to your ocelot account (cop3530 is not a mistake)
  2. Uncompress it with the gunzip command
  3. Untar it with tar xvf freelip_1.1.tar (notice the similarity to jar?)
  4. You will now have several files. Run the following command:  ( make lip.o ) > & liptimer.out
  5. Using pico, or any text editior you like, create a file called ex1.c, with the following contents:
  6. #include "lip.h"

    int main()
    {
        verylong a = 0;
        verylong b = 0;
        verylong c = 0;

        zstrtoz( "11111111111111111", &a );
        zstrtoz( "3", &b );
        zmul( a, b, &c );
        zwriteln( c );
    }

  7. Compile it with gcc -O2 -o ex1 ex1.c lip.o -lm
  8. And then run it with ./ex1 (notice the .); you should get lots of 3s as the answer.

The Assignment

The assignment is to write a program that computes the value of and then sorts the following three numbers: 27630,33329, and 3746. The functions that are supported in LIP (in addtion to the obvious multiplication above), and the protocols are described in the lipdoc.ps file that was extracted from the tar distribution. You should be able to print it in the AUL. If not, here it is in PDF format:  LIP Doc (PDF)

What to Submit

Submit your source code and sample output. You do not need to submit any soft copies for this assignment.