[Top] [Prev] [Next] [Index] [TOC]


Appendix A: Platform Specific Information


This appendix documents the platform specific commands to be executed when setting up and using the examples provided in the tutorial sections of each chapter, especially Chapter 2, ATAC: A Tutorial.

A.1 UNIX platform

When running on a UNIX system, the following command will copy the contents of the `ataclib'/tutorial directory to the current (working) directory:
	prompt:> cp `ataclib`/tutorial/* .
To compile the wordcount program from the Makefile:
	prompt:> make
The output from make should look approximately like this:
        cc -g -c wc.c
	cc -g -c main.c
	cc -g -o wordcount wc.o main.o
If you wish to compile the program manually, in one step:
	prompt:> cc -g -o wordcount main.c wc.c
The complete source listings of the main.c, wc.c, and Makefile files are listed in Figure A- 1 through Figure A-3.

To remove the previously created object files and the executable file:

	prompt:> make clean
To compile the wordcount program with atac by prefixing the standard C compiler, cc:
	prompt:> make CC="atac cc"
The output generated by make should look something like this:
        atac cc -g -c wc.c   
        atac cc -g -c main.c 
        atac cc -g -o wordcount wc.o main.o



/*
 * main.c
 *
 * Modified from ``The C Programming Language'' 
 *     by Kernighan & Ritchie, 1978.
 * page 18.
 *
 */

#include <stdio.h>

main(argc,argv)
  int argc;
  char **argv;
{
 char	*p;
 int	linect, wordct, charct;
 long	tlinect = 0;
 long	twordct = 0;
 long	tcharct = 0;
 int	doline = 0;
 int	doword = 0;
 int	dochar = 0;
 FILE	*file;

 if (argc > 1 && argv[1][0] == `-') {
    for (p = argv[1] + 1; *p; ++p)
         switch(*p) {
         case `l':
            doline = 1;
            break;
         case `w':
            doword = 1;
            break;
         case `c':
            dochar = 1;
            break;
         default:
            fprintf(stderr, "invalid option: -%c\n",
                    *p);
         case `?':
            fputs("usage: wc [-lwc] [files]\n",
                  stderr);
            return 1;
         }
    argv += 2;
 }


 else {
    ++argv;
    doline = 1;
    doword = 1;
    dochar = 1;
 }
 do {
    if (!*argv) {
        count(stdin, &linect, &wordct, &charct);
        print(doline, doword, dochar, linect, 
              wordct, charct, "");
        return;
    }
    else {
        file = fopen(*argv, "r");
        if (file == NULL) {
        perror(*argv);
        return 1;
    }
    count(file, &linect, &wordct, &charct);
    fclose(file);
    print(doline, doword, dochar, linect, wordct, 
          charct, *argv);
    }
    tlinect += linect;
    twordct += wordct;
    tcharct += charct;
 } while(*++argv);

 print(doline, doword, dochar, tlinect, twordct, 
       tcharct, "total");
 return 0;
}

static print(doline, doword, dochar, linect, 
             wordct, charct, file)
   int  doline, doword, dochar;
   int  linect, wordct, charct;
   char *file;    
{
   if (doline)
       printf(" %7ld", linect);
   if (doword)
       printf(" %7ld", wordct);
   if (dochar)
       printf(" %7ld", charct);
   printf(" %s\n", file);
}

Figure A-1 The source listing of the file main.c



/*
 * wc.c
 *
 * Modified from ``The C Programming Language'' 
 *     by Kernighan & Ritchie, 1978.
 * page 18.
 *
 */

#include <stdio.h>

#define IN1   /* inside a word */
#define OUT0  /* outside a word */

/* count lines, words and characters in input */

count(file, p_nl, p_nw, p_nc)
FILE *file;
int  *p_nl, *p_nw, *p_nc;
{

 int c, nl, nw, nc, state;
 state = OUT;
 nl = 0;
 nw = 0;
 nc = 0;
 while (EOF != (c = getc(file))) {
    ++nc;
    if (c == `\n')
        ++nl;
    if (c == ` ` || c == `\n' || c == `\t')
        state = OUT;
    else if (state == OUT) {
        state = IN;
        ++nw;
    }
 }
 *p_nl = nl;
 *p_nw = nw;
 *p_nc = nc;
}

Figure A-2 The source listing of the file wc.c




CFLAGS=-g

wordcount:	wc.o main.o
		$(CC) -g -o wordcount wc.o main.o

wc_err:		wc.o main_err.o
		$(CC) -g -o wc_err wc.o main_err.o

clean:
		-@atactm wordcount.trace
		-@atactm wc_err.trace
		rm -f *.o wordcount wc_err
		rm -f *.atac *.trace *.dif *.features tests_log

Figure A-3 The UNIX source listing of Makefile
If you do not wish to use make, you may compile the program under ATAC by entering the following command yourself:
	prompt:> atac cc -g -o wordcount main.c wc.c
In Section 13.2, A Tutorial, you are instructed to compile the wc_err program with atac. Do this by:
	prompt:> make wc_err CC="atac cc"

A.2 Windows NT/ Windows 95 platforms

When running on a Windows NT or 95 system, if you installed into the default installation directory, the following command will copy the contents of the tutorial directory to the current (working) directory:
	prompt:> xcopy /I "C:\Program Files\Cleanscape\xSuds\tutorial\*" .
If you installed into a different directory, use the path you chose for your installation in this command.

To compile the wordcount program from the Makefile:

If you use the IBM C compiler:

		prompt:> nmake -f makefile_ibm 
If you use the Microsoft C compiler:

		prompt:> nmake -f makefile_msc
If you use the IBM C compiler Figure A-4 shows about how the output from nmake will appear.



prompt:> nmake -f makefile_ibm

IBM(R) Program Maintenance Utility for Windows(R)
Version 3.50.000 Feb 13 1996
Copyright (C) IBM Corporation 1988-1995
Copyright (C) Microsoft Corp. 1988-1991
All rights reserved.

        icc /W0 /Q /c wc.c
        icc /W0 /Q /c main.c
        icc /W0 /Q wc.obj main.obj  /Fe wordcount.exe.

Figure A-4 The output of nmake with the IBM compiler

If you use the Microsoft C compiler, it will look something like Figure A-5.



prompt:> nmake -f makefile_msc

Microsoft (R) Program Maintenance Utility  Version 1.61.6038
Copyright (C) Microsoft Corp 1988-1996. All rights reserved.

        cl /nologo /w /c wc.c
wc.c
        cl /nologo /w /c main.c
main.c
        cl /nologo /w wc.obj main.obj  /link /out:wordcount.exe

Figure A-5 The output of nmake with the Microsoft compiler

The complete source listings of the main.c and wc.c files are in Figure A-1 and Figure A- 2. The Makefile file is listed in Figure A-6 for the IBM compiler and Figure A-7 for the Microsoft compiler.


CFLAGS=/W0 /Q

wordcount.exe:	wc.obj main.obj
		$(CC) $(CFLAGS) wc.obj main.obj  /Fe wordcount.exe

wc_err.exe:	wc.obj main_err.obj
		$(CC) $(CFLAGS) wc.obj main_err.obj /Fe wc_err.exe

clean:
	del wc.obj main.obj main_err.obj wordcount.exe wc_err.exe 
	del wc.atac main.atac main_err.atac wordcount.trace wc_err.trace
	del main.dif wc.dif wc.features tests_log.txt

Figure A-6 Makefile source listing for IBM compiler


CFLAGS=/nologo /w

wordcount.exe:	wc.obj main.obj
		$(CC) $(CFLAGS) wc.obj main.obj  /link /out:wordcount.exe

wc_err.exe:	wc.obj main_err.obj
		$(CC) $(CFLAGS) wc.obj main_err.obj /link /out:wc_err.exe

clean:
	del wc.obj main.obj main_err.obj wordcount.exe wc_err.exe 
        del wc.atac main.atac main_err.atac wordcount.trace wc_err.trace
	del main.dif wc.dif wc.features tests_log.txt

Figure A-7 Makefile source listing for Microsoft compiler

To remove the previously created object files and the executable file:

If you use the IBM C compiler:

		prompt:> nmake -f makefile_ibm clean 
If you use the Microsoft C compiler:

		prompt:> nmake -f makefile_msc clean
To see the approximate output of these commands, refer to Figure A-8 or Figure A-9, according to the compiler you are using.


prompt:> nmake -f makefile_ibm clean

IBM(R) Program Maintenance Utility for Windows(R)
Version 3.50.000 Feb 13 1996
Copyright (C) IBM Corporation 1988-1995
Copyright (C) Microsoft Corp. 1988-1991
All rights reserved.

        del wc.obj main.obj main_err.obj wordcount.exe wc_err.exe
Could Not Find D:\tutorial\main_err.obj
Could Not Find D:\tutorial\wc_err.exe
        del wc.atac main.atac main_err.atac wordcount.trace wc_err.trace
Could Not Find D:\USERS\JLA\tutorial\wc.atac
Could Not Find D:\tutorial\main.atac
Could Not Find D:\tutorial\main_err.atac
Could Not Find D:\tutorial\wordcount.trace
Could Not Find D:\tutorial\wc_err.trace
        del main.dif wc.dif wc.features tests_log.txt
Could Not Find D:\tutorial\main.dif
Could Not Find D:\tutorial\wc.dif
Could Not Find D:\tutorial\wc.features
Could Not Find D:\tutorial\tests_log.txt

Figure A-8 The clean command and it's output with the IBM compiler


prompt:> nmake -f makefile_msc clean

Microsoft (R) Program Maintenance Utility   Version 1.61.6038
Copyright (C) Microsoft Corp 1988-1996. All rights reserved.

        del wc.obj main.obj main_err.obj wordcount.exe wc_err.exe
Could Not Find D:\tutorial\main_err.obj
Could Not Find D:\tutorial\wc_err.exe
        del wc.atac main.atac main_err.atac wordcount.trace wc_err.trace
Could Not Find D:\tutorial\main_err.atac
Could Not Find D:\tutorial\wordcount.trace
Could Not Find D:\tutorial\wc_err.trace
        del main.dif wc.dif wc.features tests_log.txt
Could Not Find D:\tutorial\main.dif
Could Not Find D:\tutorial\wc.dif
Could Not Find D:\tutorial\wc.features
Could Not Find D:\tutorial\tests_log.txt

Figure A-9 The clean command and it's output with the Microsoft compiler

To compile the wordcount program with ATAC:

If you use the IBM C compiler:
		prompt:> nmake -f makefile_ibm CC=atacICC wordcount.exe
If you use the Microsoft C compiler:
		prompt:> nmake -f makefile_msc CC=atacCL wordcount.exe
The output generated by nmake should look something like :

Figure A-10 if you use the IBM compiler.



prompt:> nmake -f makefile_ibm CC=atacICC wordcount.exe

IBM(R) Program Maintenance Utility for Windows(R)
Version 3.50.000 Feb 13 1996
Copyright (C) IBM Corporation 1988-1995
Copyright (C) Microsoft Corp. 1988-1991
All rights reserved.

        atacICC /W0 /Q /c wc.c
        atacICC /W0 /Q /c main.c
        atacICC /W0 /Q wc.obj main.obj  /Fe wordcount.exe

Figure A-10 Compiling with atac - IBM compiler
Figure A-11 if you use the Microsoft compiler.



prompt:> nmake -f makefile_msc CC=atacCL wordcount.exe

Microsoft (R) Program Maintenance Utility   Version 1.61.6038
Copyright (C) Microsoft Corp 1988-1996. All rights reserved.

        atacCL /nologo /w /c wc.c
wc.c
wc.c
        atacCL /nologo /w /c main.c
main.c
main.c
        atacCL /nologo /w wc.obj main.obj  /link /out:wordcount.exe

Figure A-11 Compiling with atac - Microsoft compiler

In Section 13.2, A Tutorial, you are instructed to compile the wc_err program with ATAC. Do this by:

If you use the IBM C compiler:
		prompt:> nmake -f makefile_ibm wc_err.exe
If you use the Microsoft C compiler:
		prompt:> nmake -f makefile_msc wc_err.exe


[Top] [Prev] [Next] [Index] [TOC]