From fec69cfdfb86a12e0aadf599f6e6bd5d0ffc6035 Mon Sep 17 00:00:00 2001 From: yutian Date: Thu, 9 Jan 2025 03:43:40 +0800 Subject: [PATCH] Break lines in minted code. --- tex/ch10x.tex | 14 +++++++------- tex/ch1x.tex | 2 +- tex/ch2x.tex | 2 +- tex/ch3x.tex | 2 +- tex/ch5x.tex | 4 ++-- tex/ch6x.tex | 2 +- tex/ch9x.tex | 8 ++++---- 7 files changed, 17 insertions(+), 17 deletions(-) diff --git a/tex/ch10x.tex b/tex/ch10x.tex index 80e4b23..4323aca 100644 --- a/tex/ch10x.tex +++ b/tex/ch10x.tex @@ -21,7 +21,7 @@ \subsection{CHAPTER 10: Pointers to bubble\_1.c, which follows: ----------- Program 10.1 ----------------------------------- -\inputminted{c}{../src/ch10-1.c} +\inputminted[breaklines]{c}{../src/ch10-1.c} --------- end program 10.1 ----------------------------------- The bubble sort is one of the simpler sorts. The algorithm scans the @@ -49,7 +49,7 @@ \subsection{CHAPTER 10: Pointers to bubble\_2.c: ----------- Program 10.2 ----------------------------------- -\inputminted{c}{../src/ch10-2.c} +\inputminted[breaklines]{c}{../src/ch10-2.c} --------- end program 10.2 ----------------------------------- If our goal is to make our sort routine data type independent, one way @@ -59,7 +59,7 @@ \subsection{CHAPTER 10: Pointers to begin with, we'll stick with pointers to type integer. ----------- Program 10.3 ----------------------------------- -\inputminted{c}{../src/ch10-3.c} +\inputminted[breaklines]{c}{../src/ch10-3.c} --------- end program 10.3 ----------------------------------- Note the changes. We are now passing a pointer to an integer (or array @@ -72,7 +72,7 @@ \subsection{CHAPTER 10: Pointers to become more type insensitive. This is shown in bubble\_4. ----------- Program 10.4 ----------------------------------- -\inputminted{c}{../src/ch10-4.c} +\inputminted[breaklines]{c}{../src/ch10-4.c} --------- end program 10.4 ----------------------------------- Note that, in doing this, in \textbf{compare()} we had to introduce the @@ -105,7 +105,7 @@ \subsection{CHAPTER 10: Pointers to modules carefully for differences. ----------- Program 10.5 ----------------------------------- -\inputminted{c}{../src/ch10-5.c} +\inputminted[breaklines]{c}{../src/ch10-5.c} --------- end program 10.5 ----------------------------------- Note that I have changed the data type of the array from \textbf{int} to @@ -134,7 +134,7 @@ \subsection{CHAPTER 10: Pointers to were commented out in bubble5.c. ----------- Program 10.6 ----------------------------------- -\inputminted{c}{../src/ch10-6.c} +\inputminted[breaklines]{c}{../src/ch10-6.c} --------- end program 10.6 ----------------------------------- But, the fact that \textbf{bubble()} was unchanged from that used in @@ -182,7 +182,7 @@ \subsection{CHAPTER 10: Pointers to different types of data. ----------- Program 10.7 ----------------------------------- -\inputminted{c}{../src/ch10-7.c} +\inputminted[breaklines]{c}{../src/ch10-7.c} --------- end program 10.7 ----------------------------------- References for Chapter 10: diff --git a/tex/ch1x.tex b/tex/ch1x.tex index 2d7f876..a17214b 100644 --- a/tex/ch1x.tex +++ b/tex/ch1x.tex @@ -196,7 +196,7 @@ \subsection{CHAPTER 1: What is a following program and then review the code and the output carefully. ----------- Program 1.1 ----------------------------------- -\inputminted{c}{../src/ch1-1.c} +\inputminted[breaklines]{c}{../src/ch1-1.c} --------- end program 1.1 ----------------------------------- Note: We have yet to discuss those aspects of C which require the use of diff --git a/tex/ch2x.tex b/tex/ch2x.tex index 4de8976..3870d86 100644 --- a/tex/ch2x.tex +++ b/tex/ch2x.tex @@ -77,7 +77,7 @@ \subsection{CHAPTER 2: Pointer types and by dereferencing our pointer. The following code illustrates this: ----------- Program 2.1 ----------------------------------- -\inputminted{c}{../src/ch2-1.c} +\inputminted[breaklines]{c}{../src/ch2-1.c} --------- end program 2.1 ----------------------------------- Compile and run the above program and carefully note lines A and B and diff --git a/tex/ch3x.tex b/tex/ch3x.tex index b8a6337..7c93ff1 100644 --- a/tex/ch3x.tex +++ b/tex/ch3x.tex @@ -60,7 +60,7 @@ \subsection{CHAPTER 3: Pointers and Now, consider the following program: ----------- Program 3.1 ----------------------------------- -\inputminted{c}{../src/ch3-1.c} +\inputminted[breaklines]{c}{../src/ch3-1.c} --------- end program 3.1 ----------------------------------- diff --git a/tex/ch5x.tex b/tex/ch5x.tex index 5deb8b9..8ad82dc 100644 --- a/tex/ch5x.tex +++ b/tex/ch5x.tex @@ -28,7 +28,7 @@ \subsection{CHAPTER 5: Pointers and operator as in: ----------- Program 5.1 ----------------------------------- -\inputminted{c}{../src/ch5-1.c} +\inputminted[breaklines]{c}{../src/ch5-1.c} --------- end program 5.1 ----------------------------------- Now, this particular structure is rather small compared to many used in @@ -107,7 +107,7 @@ \subsection{CHAPTER 5: Pointers and With that in mind, look at the following program: ----------- Program 5.2 ----------------------------------- -\inputminted{c}{../src/ch5-2.c} +\inputminted[breaklines]{c}{../src/ch5-2.c} --------- end program 5.2 ------------------------------------- Again, this is a lot of information to absorb at one time. The reader diff --git a/tex/ch6x.tex b/tex/ch6x.tex index e426cb9..12b5443 100644 --- a/tex/ch6x.tex +++ b/tex/ch6x.tex @@ -175,7 +175,7 @@ \subsection{CHAPTER 6: Some more on Strings, and Arrays of character arrays. ----------- Program 2.1 ----------------------------------- -\inputminted{c}{../src/ch2-1.c} +\inputminted[breaklines]{c}{../src/ch2-1.c} --------- end program 2.1 ----------------------------------- Because of the double de-referencing required in the pointer version, diff --git a/tex/ch9x.tex b/tex/ch9x.tex index b7d45f1..6bf33e7 100644 --- a/tex/ch9x.tex +++ b/tex/ch9x.tex @@ -106,7 +106,7 @@ \subsection{CHAPTER 9: Pointers and Dynamic Allocation of Consider now: ----------- Program 9.1 ----------------------------------- -\inputminted{c}{../src/ch9-1.c} +\inputminted[breaklines]{c}{../src/ch9-1.c} --------- end program 9.1 ----------------------------------- Here I have assumed an ANSI compiler so a cast on the void pointer @@ -163,7 +163,7 @@ \subsection{CHAPTER 9: Pointers and Dynamic Allocation of each row and point these pointers at each row. Consider: ----------- Program 9.2 ----------------------------------- -\inputminted{c}{../src/ch9-2.c} +\inputminted[breaklines]{c}{../src/ch9-2.c} --------- end program 9.2 ----------------------------------- In the above code \textbf{rowptr} is a pointer to pointer to type @@ -207,7 +207,7 @@ \subsection{CHAPTER 9: Pointers and Dynamic Allocation of memory is contiguous. The code looks like this: ----------- Program 9.3 ----------------------------------- -\inputminted{c}{../src/ch9-3.c} +\inputminted[breaklines]{c}{../src/ch9-3.c} --------- end program 9.3 ----------------------------------- Consider again, the number of calls to malloc() @@ -235,7 +235,7 @@ \subsection{CHAPTER 9: Pointers and Dynamic Allocation of two. Consider the following code: ----------- Program 9.4 ----------------------------------- -\inputminted{c}{../src/ch9-4.c} +\inputminted[breaklines]{c}{../src/ch9-4.c} --------- end program 9.4 ----------------------------------- If you have followed this tutorial up to this point you should have no