Giter VIP home page Giter VIP logo

softwaretools's Introduction

SoftwareTools

Copyright (c) 2013 by Robert L. Bocchino Jr.

1. Introduction

This is an implementation in C of the programs in the classic text Software Tools by Brian W. Kernighan and P.J. Plauger (Addison-Wesley 1976). So far I have implemented the programs from the first three chapters, except for the programs that drive line printers.

2. Code Organization and Style

Organization

The code lives in two directories:

  1. lib contains code that is (or potentially could be) reused across different tools.

  2. tools contains the tools themselves.

I used my judgment to decide which code to put where. I may change my mind as I work through more of the book.

Each of the directories lib and tools has a subdirectory tests containing tests.

Style

The code is not idiomatic C; instead, it attempts to mimic the style of the programs in the book (written in a Fortran dialect called Rational Fortran, or Ratfor) as closely as possible, while writing in C. For example:

  1. Arrays are indexed from 1, not 0.

  2. Pointers are used only where necessary to mimic the behavior of global variables in the original code.

  3. Control constructs are generally similar to C, but several (repeat, until, etc.) are different.

I have used C macros to assist the translation process.

I find this coding style natural for programs that don't require pointer manipulation.

3. Building and Running

Dependencies

To build and run the code, you'll need to install the following software:

  1. A UNIX command line and standard UNIX tools.

  2. The fish shell.

  3. The redo build tool.

If you are on a Mac and using MacPorts, you can get both by issuing the commands

sudo port install fish
sudo port install redo

on the command line.

Compiler

The build system assumes you have clang installed on your system. If you don't (or you'd rather use gcc), then edit params.fish in the top-level directory to replace clang with gcc.

Building

To build everything, issue the command redo from the top-level directory. You can also issue redo in the lib or tools directory to build just the library or the tools. However, you have to build the library before building the tools.

To remove the generated files, issue the command redo clean.

Running

To run the tests, issue the command redo test from the top-level directory. You can also issue redo test in the lib or tools directory to run just the library or tools tests.

softwaretools's People

Contributors

bocchino avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.