[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] doc: fix code snippets and typos in manual
From: |
Guillermo E. Martinez |
Subject: |
[PATCH] doc: fix code snippets and typos in manual |
Date: |
Wed, 29 Sep 2021 22:13:17 -0500 |
I done some changes in doc/poke.texi, I will appreciate your
feedback.
Thanks in advance!
Guillermo
* doc/poke.texi (Poking a SBM Image):
- Add in image_data l6.
- Fix number of lines in array to be mapped.
- Fix computing of size parameter to be written in 'p.sbm'.
- Fix output values: image_data'size, l0[1:4], l0[1:3].
- Fix image_data[] indexes.
- Fix error: using the same type in conditional operator.
---
doc/poke.texi | 34 ++++++++++++++++++----------------
1 file changed, 18 insertions(+), 16 deletions(-)
diff --git a/doc/poke.texi b/doc/poke.texi
index df3df7f2..ae6b9848 100644
--- a/doc/poke.texi
+++ b/doc/poke.texi
@@ -3506,7 +3506,7 @@ number of arrays-of levels that you can nest.
So, let's define our image as an array of the lines defined above:
@example
-(poke) var image_data = [l0,l1,l2,l3,l4,l5]
+(poke) var image_data = [l0,l1,l2,l3,l4,l5,l6]
(poke) image_data
[[[255UB,255UB,255UB],[255UB,99UB,71UB],[255UB,99UB,71UB]@dots{}]@dots{}]
@end example
@@ -3517,7 +3517,7 @@ of seven arrays of five arrays of three bytes each, in
other words
@code{byte[3][5][7]}. Let's poke the pixels:
@example
-(poke) byte[3][5][6] @@ 5#B = image_data
+(poke) byte[3][5][7] @@ 5#B = image_data
@end example
This is an example of how abstraction can simplify the handling of
@@ -3541,7 +3541,7 @@ pixel occupies 3 bytes, so calculating@dots{}
@example
(poke) var ppl = byte @@ 3#B
(poke) var lines = byte @@ 4#B
-(poke) save :from 0#B :size 5#B + ppl#B * lines#B :file "p.sbm"
+(poke) save :from 0#B :size (5 + ppl * 3 * lines)#B :file "p.sbm"
@end example
@noindent
@@ -3568,7 +3568,7 @@ size of the pixels in the image:
@example
(poke) image_data'size
-720UL#b
+840UL#b
@end example
@noindent
@@ -4032,7 +4032,7 @@ portion of it by issuing:
@example
(poke) l0[1:4]
-[[255UB,99UB,71UB],[255UB,99UB,71UB]]
+[[255UB,99UB,71UB],[255UB,99UB,71UB],[255UB,255UB,255UB]]
@end example
@noindent
@@ -4043,7 +4043,7 @@ trimming is always another array, which may be empty:
@example
(poke) l0[1:3]
-[[255UB,99UB,71UB]]
+[[255UB,99UB,71UB],[255UB,99UB,71UB]]
@end example
Armed with this new operation, we can very easily mount the sequence
@@ -4056,6 +4056,7 @@ of pixels for our cropped image:
(poke) var l3 = image_data[3]
(poke) var l4 = image_data[4]
(poke) var l5 = image_data[5]
+(poke) var l6 = image_data[6]
@end example
@noindent
@@ -4063,11 +4064,12 @@ And then update the lines in the mapped image data:
@example
(poke) image_data[0] = l0[1:4]
-(poke) image_data[0] = l1[1:4]
-(poke) image_data[1] = l2[1:4]
-(poke) image_data[2] = l3[1:4]
-(poke) image_data[3] = l4[1:4]
-(poke) image_data[4] = l5[1:4]
+(poke) image_data[1] = l1[1:4]
+(poke) image_data[2] = l2[1:4]
+(poke) image_data[3] = l3[1:4]
+(poke) image_data[4] = l4[1:4]
+(poke) image_data[5] = l5[1:4]
+(poke) image_data[6] = l6[1:4]
@end example
@subsection Updating the Header
@@ -4472,7 +4474,7 @@ type SBM_Header =
byte[3] magic;
uint<8> ppl;
uint<8> lines;
- @}
+ @};
@end example
Note how the struct has three named fields: @code{magic}, @code{ppl}
@@ -4665,8 +4667,8 @@ type Packet =
byte magic = 0xab;
byte size;
- byte[size == 0xff ? 0 : size] payload;
- byte[size == 0xff ? 0 : size] control;
+ byte[size == 0xff ? 0UB : size] payload;
+ byte[size == 0xff ? 0UB : size] control;
@};
@end example
@@ -4679,7 +4681,7 @@ type Packet =
byte magic = 0xab;
byte size;
- var real_size = (size == 0xff ? 0 : size);
+ var real_size = (size == 0xff ? 0UB : size);
byte[real_size] payload;
byte[real_size] control;
@@ -4703,7 +4705,7 @@ type Packet =
byte magic = 0xab;
byte size;
- var real_size = (size == packet_special ? 0 : size);
+ var real_size = (size == packet_special ? 0UB : size);
byte[real_size] payload;
byte[real_size] control;
--
2.33.0
- [PATCH] doc: fix code snippets and typos in manual,
Guillermo E. Martinez <=