From 43a81a51a3efe855186cb969d8323d51e5e98990 Mon Sep 17 00:00:00 2001 From: "Zed A. Shaw" Date: Thu, 1 Sep 2011 15:41:59 -0700 Subject: [PATCH] More structure, getting the feel for it. --- book.tex | 1 - commands.tex | 8 ++++++++ ex0.tex | 4 ++-- ex1.tex | 24 +++++++++++++++--------- ex10.tex | 10 ++++++++++ ex11.tex | 10 ++++++++++ ex12.tex | 10 ++++++++++ ex13.tex | 10 ++++++++++ ex14.tex | 10 ++++++++++ ex15.tex | 10 ++++++++++ ex16.tex | 10 ++++++++++ ex17.tex | 10 ++++++++++ ex18.tex | 10 ++++++++++ ex19.tex | 10 ++++++++++ ex2.tex | 11 +++++++++++ ex20.tex | 10 ++++++++++ ex21.tex | 10 ++++++++++ ex22.tex | 10 ++++++++++ ex23.tex | 10 ++++++++++ ex24.tex | 10 ++++++++++ ex25.tex | 10 ++++++++++ ex26.tex | 10 ++++++++++ ex27.tex | 10 ++++++++++ ex28.tex | 10 ++++++++++ ex29.tex | 10 ++++++++++ ex3.tex | 10 ++++++++++ ex30.tex | 10 ++++++++++ ex31.tex | 10 ++++++++++ ex32.tex | 10 ++++++++++ ex33.tex | 10 ++++++++++ ex34.tex | 10 ++++++++++ ex35.tex | 10 ++++++++++ ex36.tex | 10 ++++++++++ ex37.tex | 10 ++++++++++ ex38.tex | 10 ++++++++++ ex39.tex | 10 ++++++++++ ex4.tex | 10 ++++++++++ ex40.tex | 10 ++++++++++ ex41.tex | 10 ++++++++++ ex42.tex | 10 ++++++++++ ex43.tex | 10 ++++++++++ ex44.tex | 10 ++++++++++ ex45.tex | 10 ++++++++++ ex46.tex | 10 ++++++++++ ex47.tex | 10 ++++++++++ ex48.tex | 10 ++++++++++ ex49.tex | 10 ++++++++++ ex5.tex | 10 ++++++++++ ex50.tex | 10 ++++++++++ ex51.tex | 10 ++++++++++ ex52.tex | 10 ++++++++++ ex6.tex | 10 ++++++++++ ex7.tex | 10 ++++++++++ ex8.tex | 10 ++++++++++ ex9.tex | 10 ++++++++++ introduction.tex | 10 +++++----- preamble.tex | 2 ++ preface.tex | 2 +- 58 files changed, 544 insertions(+), 18 deletions(-) diff --git a/book.tex b/book.tex index 7bcbebb..c3fbef8 100644 --- a/book.tex +++ b/book.tex @@ -17,7 +17,6 @@ \tableofcontents \include{preface} - \mainmatter \include{introduction} diff --git a/commands.tex b/commands.tex index 67d2b4f..2102bd4 100644 --- a/commands.tex +++ b/commands.tex @@ -38,6 +38,14 @@ } { \end{quote} \end{note} } +\newenvironment{Terminal}[1] +{ + \begin{source} + \caption{\hfill\it #1} + \sffamily\small +} +{\end{source}} + \newenvironment{code}[1] { \begin{source} diff --git a/ex0.tex b/ex0.tex index 236a974..a513299 100644 --- a/ex0.tex +++ b/ex0.tex @@ -36,9 +36,9 @@ \section{Linux} a few things using these commands: \begin{code}{Installing Requirements On Ubuntu} -\begin{Verbatim} +\begin{lstlisting} $ aptitude install build-essential -\end{Verbatim} +\end{lstlisting} \end{code} The above is an example of a command line prompt, so to get to where diff --git a/ex1.tex b/ex1.tex index 25f342b..55f3bb3 100644 --- a/ex1.tex +++ b/ex1.tex @@ -8,14 +8,20 @@ \chapter{Exercise 1: Dust Off That Compiler} You can put this into a \file{ex1.c} then type: -\begin{code}{Building ex1} -\begin{Verbatim} -make ex1 -./ex1 -\end{Verbatim} -\end{code} +\begin{Terminal}{Building ex1} +\begin{lstlisting} +$ make ex1 +$ ./ex1 +\end{lstlisting} +\end{Terminal} + +\section{What You Should See} + + +\section{How To Break It} + + +\section{Extra Credit} + -Try it and let me know if it worked. If you type this \verb|make ex1.c| then -you're doing it wrong and need to pay attention to what I typed. C does not -treat kindly those who lack attention to detail. diff --git a/ex10.tex b/ex10.tex index 7628241..a5a1062 100644 --- a/ex10.tex +++ b/ex10.tex @@ -1,3 +1,13 @@ \chapter{Exercise 10} +\section{What You Should See} + + +\section{How To Break It} + + +\section{Extra Credit} + + + diff --git a/ex11.tex b/ex11.tex index e34b9ff..b065586 100644 --- a/ex11.tex +++ b/ex11.tex @@ -1,3 +1,13 @@ \chapter{Exercise 11} +\section{What You Should See} + + +\section{How To Break It} + + +\section{Extra Credit} + + + diff --git a/ex12.tex b/ex12.tex index 611e87f..1eb5184 100644 --- a/ex12.tex +++ b/ex12.tex @@ -1,3 +1,13 @@ \chapter{Exercise 12} +\section{What You Should See} + + +\section{How To Break It} + + +\section{Extra Credit} + + + diff --git a/ex13.tex b/ex13.tex index 67b54a6..795949c 100644 --- a/ex13.tex +++ b/ex13.tex @@ -1,3 +1,13 @@ \chapter{Exercise 13} +\section{What You Should See} + + +\section{How To Break It} + + +\section{Extra Credit} + + + diff --git a/ex14.tex b/ex14.tex index 7521c4f..4ba58c8 100644 --- a/ex14.tex +++ b/ex14.tex @@ -1,3 +1,13 @@ \chapter{Exercise 14} +\section{What You Should See} + + +\section{How To Break It} + + +\section{Extra Credit} + + + diff --git a/ex15.tex b/ex15.tex index 38f6a15..800d2dd 100644 --- a/ex15.tex +++ b/ex15.tex @@ -1,3 +1,13 @@ \chapter{Exercise 15} +\section{What You Should See} + + +\section{How To Break It} + + +\section{Extra Credit} + + + diff --git a/ex16.tex b/ex16.tex index b43d11b..e481ca3 100644 --- a/ex16.tex +++ b/ex16.tex @@ -1,3 +1,13 @@ \chapter{Exercise 16} +\section{What You Should See} + + +\section{How To Break It} + + +\section{Extra Credit} + + + diff --git a/ex17.tex b/ex17.tex index 7cddc86..db6d98e 100644 --- a/ex17.tex +++ b/ex17.tex @@ -1,3 +1,13 @@ \chapter{Exercise 17} +\section{What You Should See} + + +\section{How To Break It} + + +\section{Extra Credit} + + + diff --git a/ex18.tex b/ex18.tex index ad57ba2..2f1d30e 100644 --- a/ex18.tex +++ b/ex18.tex @@ -1,3 +1,13 @@ \chapter{Exercise 18} +\section{What You Should See} + + +\section{How To Break It} + + +\section{Extra Credit} + + + diff --git a/ex19.tex b/ex19.tex index fed4fb9..2fff28b 100644 --- a/ex19.tex +++ b/ex19.tex @@ -1,3 +1,13 @@ \chapter{Exercise 19} +\section{What You Should See} + + +\section{How To Break It} + + +\section{Extra Credit} + + + diff --git a/ex2.tex b/ex2.tex index 37a1762..719ff07 100644 --- a/ex2.tex +++ b/ex2.tex @@ -23,3 +23,14 @@ \chapter{Exercise 2: Make Is Your Python Now} ... go into a simple makefile ... ... show how to run the simple makefile ... + +\section{What You Should See} + + +\section{How To Break It} + + +\section{Extra Credit} + + + diff --git a/ex20.tex b/ex20.tex index eb43714..2d586c8 100644 --- a/ex20.tex +++ b/ex20.tex @@ -1,3 +1,13 @@ \chapter{Exercise 20} +\section{What You Should See} + + +\section{How To Break It} + + +\section{Extra Credit} + + + diff --git a/ex21.tex b/ex21.tex index 10d1a3f..7cf8f2a 100644 --- a/ex21.tex +++ b/ex21.tex @@ -1,3 +1,13 @@ \chapter{Exercise 21} +\section{What You Should See} + + +\section{How To Break It} + + +\section{Extra Credit} + + + diff --git a/ex22.tex b/ex22.tex index 5d22f16..62055ae 100644 --- a/ex22.tex +++ b/ex22.tex @@ -1,3 +1,13 @@ \chapter{Exercise 22} +\section{What You Should See} + + +\section{How To Break It} + + +\section{Extra Credit} + + + diff --git a/ex23.tex b/ex23.tex index 5fdfabb..66c4dfa 100644 --- a/ex23.tex +++ b/ex23.tex @@ -1,3 +1,13 @@ \chapter{Exercise 23} +\section{What You Should See} + + +\section{How To Break It} + + +\section{Extra Credit} + + + diff --git a/ex24.tex b/ex24.tex index 8f0c98b..7c2dba6 100644 --- a/ex24.tex +++ b/ex24.tex @@ -1,3 +1,13 @@ \chapter{Exercise 24} +\section{What You Should See} + + +\section{How To Break It} + + +\section{Extra Credit} + + + diff --git a/ex25.tex b/ex25.tex index 915aa86..adc90f8 100644 --- a/ex25.tex +++ b/ex25.tex @@ -1,3 +1,13 @@ \chapter{Exercise 25} +\section{What You Should See} + + +\section{How To Break It} + + +\section{Extra Credit} + + + diff --git a/ex26.tex b/ex26.tex index 58bcd16..16b757b 100644 --- a/ex26.tex +++ b/ex26.tex @@ -1,3 +1,13 @@ \chapter{Exercise 26} +\section{What You Should See} + + +\section{How To Break It} + + +\section{Extra Credit} + + + diff --git a/ex27.tex b/ex27.tex index 3174ee9..e40f6ee 100644 --- a/ex27.tex +++ b/ex27.tex @@ -1,3 +1,13 @@ \chapter{Exercise 27} +\section{What You Should See} + + +\section{How To Break It} + + +\section{Extra Credit} + + + diff --git a/ex28.tex b/ex28.tex index b272363..906106d 100644 --- a/ex28.tex +++ b/ex28.tex @@ -1,3 +1,13 @@ \chapter{Exercise 28} +\section{What You Should See} + + +\section{How To Break It} + + +\section{Extra Credit} + + + diff --git a/ex29.tex b/ex29.tex index 57de747..70a627d 100644 --- a/ex29.tex +++ b/ex29.tex @@ -1,3 +1,13 @@ \chapter{Exercise 29} +\section{What You Should See} + + +\section{How To Break It} + + +\section{Extra Credit} + + + diff --git a/ex3.tex b/ex3.tex index 75dc9e5..3f58a73 100644 --- a/ex3.tex +++ b/ex3.tex @@ -16,3 +16,13 @@ \chapter{Exercise 3: Formatted Printing} ... explain this ... +\section{What You Should See} + + +\section{How To Break It} + + +\section{Extra Credit} + + + diff --git a/ex30.tex b/ex30.tex index c22cb79..7219c1e 100644 --- a/ex30.tex +++ b/ex30.tex @@ -1,3 +1,13 @@ \chapter{Exercise 30} +\section{What You Should See} + + +\section{How To Break It} + + +\section{Extra Credit} + + + diff --git a/ex31.tex b/ex31.tex index 75c7cbb..43398af 100644 --- a/ex31.tex +++ b/ex31.tex @@ -1,3 +1,13 @@ \chapter{Exercise 31} +\section{What You Should See} + + +\section{How To Break It} + + +\section{Extra Credit} + + + diff --git a/ex32.tex b/ex32.tex index 20fe052..0a5ea13 100644 --- a/ex32.tex +++ b/ex32.tex @@ -1,3 +1,13 @@ \chapter{Exercise 32} +\section{What You Should See} + + +\section{How To Break It} + + +\section{Extra Credit} + + + diff --git a/ex33.tex b/ex33.tex index a10392c..8086d89 100644 --- a/ex33.tex +++ b/ex33.tex @@ -1,3 +1,13 @@ \chapter{Exercise 33} +\section{What You Should See} + + +\section{How To Break It} + + +\section{Extra Credit} + + + diff --git a/ex34.tex b/ex34.tex index e5ed168..7a8a4c4 100644 --- a/ex34.tex +++ b/ex34.tex @@ -1,3 +1,13 @@ \chapter{Exercise 34} +\section{What You Should See} + + +\section{How To Break It} + + +\section{Extra Credit} + + + diff --git a/ex35.tex b/ex35.tex index 8b66a32..a5d1a70 100644 --- a/ex35.tex +++ b/ex35.tex @@ -1,3 +1,13 @@ \chapter{Exercise 35} +\section{What You Should See} + + +\section{How To Break It} + + +\section{Extra Credit} + + + diff --git a/ex36.tex b/ex36.tex index d0a88c9..f555262 100644 --- a/ex36.tex +++ b/ex36.tex @@ -1,3 +1,13 @@ \chapter{Exercise 36} +\section{What You Should See} + + +\section{How To Break It} + + +\section{Extra Credit} + + + diff --git a/ex37.tex b/ex37.tex index b9f844c..f7c94ad 100644 --- a/ex37.tex +++ b/ex37.tex @@ -1,3 +1,13 @@ \chapter{Exercise 37} +\section{What You Should See} + + +\section{How To Break It} + + +\section{Extra Credit} + + + diff --git a/ex38.tex b/ex38.tex index ce56fa2..09a2c38 100644 --- a/ex38.tex +++ b/ex38.tex @@ -1,3 +1,13 @@ \chapter{Exercise 38} +\section{What You Should See} + + +\section{How To Break It} + + +\section{Extra Credit} + + + diff --git a/ex39.tex b/ex39.tex index 7bbe5c8..c62cff1 100644 --- a/ex39.tex +++ b/ex39.tex @@ -1,3 +1,13 @@ \chapter{Exercise 39} +\section{What You Should See} + + +\section{How To Break It} + + +\section{Extra Credit} + + + diff --git a/ex4.tex b/ex4.tex index 1b955fe..c546cb7 100644 --- a/ex4.tex +++ b/ex4.tex @@ -1,3 +1,13 @@ \chapter{Exercise 4} +\section{What You Should See} + + +\section{How To Break It} + + +\section{Extra Credit} + + + diff --git a/ex40.tex b/ex40.tex index d3eca83..93440ee 100644 --- a/ex40.tex +++ b/ex40.tex @@ -1,3 +1,13 @@ \chapter{Exercise 40} +\section{What You Should See} + + +\section{How To Break It} + + +\section{Extra Credit} + + + diff --git a/ex41.tex b/ex41.tex index 7b82958..43aeec3 100644 --- a/ex41.tex +++ b/ex41.tex @@ -1,3 +1,13 @@ \chapter{Exercise 41} +\section{What You Should See} + + +\section{How To Break It} + + +\section{Extra Credit} + + + diff --git a/ex42.tex b/ex42.tex index 826b0c9..544330b 100644 --- a/ex42.tex +++ b/ex42.tex @@ -1,3 +1,13 @@ \chapter{Exercise 42} +\section{What You Should See} + + +\section{How To Break It} + + +\section{Extra Credit} + + + diff --git a/ex43.tex b/ex43.tex index 39a6bfa..5efa3d8 100644 --- a/ex43.tex +++ b/ex43.tex @@ -1,3 +1,13 @@ \chapter{Exercise 43} +\section{What You Should See} + + +\section{How To Break It} + + +\section{Extra Credit} + + + diff --git a/ex44.tex b/ex44.tex index a49f5d1..faa8638 100644 --- a/ex44.tex +++ b/ex44.tex @@ -1,3 +1,13 @@ \chapter{Exercise 44} +\section{What You Should See} + + +\section{How To Break It} + + +\section{Extra Credit} + + + diff --git a/ex45.tex b/ex45.tex index 14c7a6e..b93fe78 100644 --- a/ex45.tex +++ b/ex45.tex @@ -1,3 +1,13 @@ \chapter{Exercise 45} +\section{What You Should See} + + +\section{How To Break It} + + +\section{Extra Credit} + + + diff --git a/ex46.tex b/ex46.tex index 6e9c75b..f6fbfd2 100644 --- a/ex46.tex +++ b/ex46.tex @@ -1,3 +1,13 @@ \chapter{Exercise 46} +\section{What You Should See} + + +\section{How To Break It} + + +\section{Extra Credit} + + + diff --git a/ex47.tex b/ex47.tex index abd05d0..2583ea7 100644 --- a/ex47.tex +++ b/ex47.tex @@ -1,3 +1,13 @@ \chapter{Exercise 47} +\section{What You Should See} + + +\section{How To Break It} + + +\section{Extra Credit} + + + diff --git a/ex48.tex b/ex48.tex index 76c8509..bdada1c 100644 --- a/ex48.tex +++ b/ex48.tex @@ -1,3 +1,13 @@ \chapter{Exercise 48} +\section{What You Should See} + + +\section{How To Break It} + + +\section{Extra Credit} + + + diff --git a/ex49.tex b/ex49.tex index d22da0c..a2abcb6 100644 --- a/ex49.tex +++ b/ex49.tex @@ -1,3 +1,13 @@ \chapter{Exercise 49} +\section{What You Should See} + + +\section{How To Break It} + + +\section{Extra Credit} + + + diff --git a/ex5.tex b/ex5.tex index 94b9787..64fbcb0 100644 --- a/ex5.tex +++ b/ex5.tex @@ -1,3 +1,13 @@ \chapter{Exercise 5} +\section{What You Should See} + + +\section{How To Break It} + + +\section{Extra Credit} + + + diff --git a/ex50.tex b/ex50.tex index bb99989..d82a279 100644 --- a/ex50.tex +++ b/ex50.tex @@ -1,3 +1,13 @@ \chapter{Exercise 50} +\section{What You Should See} + + +\section{How To Break It} + + +\section{Extra Credit} + + + diff --git a/ex51.tex b/ex51.tex index 38ea398..dc57c51 100644 --- a/ex51.tex +++ b/ex51.tex @@ -1,3 +1,13 @@ \chapter{Exercise 51} +\section{What You Should See} + + +\section{How To Break It} + + +\section{Extra Credit} + + + diff --git a/ex52.tex b/ex52.tex index 133a544..f3936f1 100644 --- a/ex52.tex +++ b/ex52.tex @@ -1,3 +1,13 @@ \chapter{Exercise 52} +\section{What You Should See} + + +\section{How To Break It} + + +\section{Extra Credit} + + + diff --git a/ex6.tex b/ex6.tex index 56e61af..512a10a 100644 --- a/ex6.tex +++ b/ex6.tex @@ -1,3 +1,13 @@ \chapter{Exercise 6} +\section{What You Should See} + + +\section{How To Break It} + + +\section{Extra Credit} + + + diff --git a/ex7.tex b/ex7.tex index 64689be..e73e505 100644 --- a/ex7.tex +++ b/ex7.tex @@ -1,3 +1,13 @@ \chapter{Exercise 7} +\section{What You Should See} + + +\section{How To Break It} + + +\section{Extra Credit} + + + diff --git a/ex8.tex b/ex8.tex index a10d505..b36eb59 100644 --- a/ex8.tex +++ b/ex8.tex @@ -1,3 +1,13 @@ \chapter{Exercise 8} +\section{What You Should See} + + +\section{How To Break It} + + +\section{Extra Credit} + + + diff --git a/ex9.tex b/ex9.tex index 95211f3..b009df8 100644 --- a/ex9.tex +++ b/ex9.tex @@ -1,3 +1,13 @@ \chapter{Exercise 9} +\section{What You Should See} + + +\section{How To Break It} + + +\section{Extra Credit} + + + diff --git a/introduction.tex b/introduction.tex index 6361cf3..0f87aed 100644 --- a/introduction.tex +++ b/introduction.tex @@ -1,4 +1,4 @@ -\chapter{Introduction: The Cartesian Dream Of C} +\chapter*{Introduction: The Cartesian Dream Of C} \begin{quotation} @@ -29,7 +29,7 @@ \chapter{Introduction: The Cartesian Dream Of C} reality of abstraction and liberates you from stupidity. -\section{What You Will Learn} +\section*{What You Will Learn} The purpose of this book is to get you strong enough in C that you'll be able to write your own software in it, or modify @@ -52,7 +52,7 @@ \section{What You Will Learn} projects. -\section{How To Read This Book} +\section*{How To Read This Book} This book is intended for programmers who have learned at least one other programming language. I refer you to @@ -85,7 +85,7 @@ \section{How To Read This Book} code C then you at least tried. It's not for everyone, but the act of trying will make you a better programmer. -\section{About "The Hard Way"} +\section*{About "The Hard Way"} I wrote about the philosophy of "The Hard Way" in my first book using this method, but I'll paraphrase it again since I'm assuming you've @@ -115,7 +115,7 @@ \section{About "The Hard Way"} be able to write code for hours on end, lost in it. -\section{License} +\section*{License} This book is free for you to read, but until I'm done you can't distribute it or modify it. I need to make sure that unfinished copies of it do not get out diff --git a/preamble.tex b/preamble.tex index aa0b501..c624cb9 100644 --- a/preamble.tex +++ b/preamble.tex @@ -12,6 +12,8 @@ colorlinks,linkcolor=blue,citecolor=blue, urlcolor=red, ]{hyperref} +\setcounter{chapter}{1} +\usepackage{upquote} \usepackage{float} \usepackage{fancybox} %\usepackage{savetrees} diff --git a/preface.tex b/preface.tex index 0931b4b..9ac2093 100644 --- a/preface.tex +++ b/preface.tex @@ -1,4 +1,4 @@ -\chapter{Preface} +\chapter*{Preface} This is a rough in-progress dump of the book. The grammar will probably be bad, there will be sections missing, but you get to watch me write the book and see how I do things.