This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
haas:fall2017:discrete:projects:bdt0 [2017/09/16 15:24] – created wedge | haas:fall2017:discrete:projects:bdt0 [2017/10/03 14:25] (current) – [Experiencing xxd] wedge | ||
---|---|---|---|
Line 28: | Line 28: | ||
I have prepared some files to assist in our endeavors, which can be obtained through the use of the special **grabit** tool found on lab46: | I have prepared some files to assist in our endeavors, which can be obtained through the use of the special **grabit** tool found on lab46: | ||
+ | <cli> | ||
+ | lab46: | ||
+ | make: Entering directory '/ | ||
+ | ‘/ | ||
+ | ‘/ | ||
+ | ‘/ | ||
+ | ‘/ | ||
+ | ‘/ | ||
+ | ‘/ | ||
+ | make: Leaving directory '/ | ||
+ | lab46: | ||
+ | </ | ||
=====Experiencing xxd===== | =====Experiencing xxd===== | ||
If we don't know what it is we are implementing, | If we don't know what it is we are implementing, | ||
<cli> | <cli> | ||
- | lab46: | + | lab46: |
> | > | ||
[abcdefghijklmnopqrstuvwxyz] | [abcdefghijklmnopqrstuvwxyz] | ||
Line 49: | Line 61: | ||
<cli> | <cli> | ||
- | lab46: | + | lab46: |
0000000: 3e41 4243 4445 4647 4849 4a4b 4c4d 4e4f > | 0000000: 3e41 4243 4445 4647 4849 4a4b 4c4d 4e4f > | ||
0000010: 5051 5253 5455 5657 5859 5a3c 0a5b 6162 PQRSTUVWXYZ< | 0000010: 5051 5253 5455 5657 5859 5a3c 0a5b 6162 PQRSTUVWXYZ< | ||
Line 88: | Line 100: | ||
* error message should be of the form: **Error: Terminal height is less than 20 lines!** | * error message should be of the form: **Error: Terminal height is less than 20 lines!** | ||
* Unlike the width, the height can impact program output (taller terminals, if not otherwise throttled by a second command-line argument, can auto-expand if there is more room and data to display). | * Unlike the width, the height can impact program output (taller terminals, if not otherwise throttled by a second command-line argument, can auto-expand if there is more room and data to display). | ||
- | * The second command-line argument is a sizing throttle (controlling the number of lines your program will display). If no argument, or a **0** is given, | + | * The second command-line argument is a sizing throttle (controlling the number of lines your program will display). If no argument, or a **0** is given, |
* Each row will display: | * Each row will display: | ||
* a 7-digit hex offset (referring to the first data byte on a given line) | * a 7-digit hex offset (referring to the first data byte on a given line) | ||
Line 100: | Line 112: | ||
* The hex values and rendered ASCII displayed will be sourced from the file specified on the command-line. While the target files for this project are less than 512 bytes, your program should be able to handle larger and smaller files, and update its display accordingly. | * The hex values and rendered ASCII displayed will be sourced from the file specified on the command-line. While the target files for this project are less than 512 bytes, your program should be able to handle larger and smaller files, and update its display accordingly. | ||
* If a line throttle is given, your program is to stop output of data and ASCII rendering at that line, once it completes. | * If a line throttle is given, your program is to stop output of data and ASCII rendering at that line, once it completes. | ||
- | * Once the data in the file has been exhausted, you need to wrap up as appropriate; | + | * Once the data in the file has been exhausted, you need to wrap up as appropriate; |
* Don't forget to **fclose()** any open file pointers! And **free()** any **malloc()**' | * Don't forget to **fclose()** any open file pointers! And **free()** any **malloc()**' | ||
+ | * If provided (via command-line arguments), highlight the offset field and the specified address + length (see below). | ||
+ | * If the last pair is not complete (ie only an address given), ignore that request. | ||
=====Detecting Terminal Size===== | =====Detecting Terminal Size===== | ||
Line 130: | Line 144: | ||
Compile and run the above code to see how it works. Try it in different size terminals. Then incorporate the logic into your hex viewer for this project. | Compile and run the above code to see how it works. Try it in different size terminals. Then incorporate the logic into your hex viewer for this project. | ||
- | =====Bonus Opportunities===== | + | =====Selection highlighting===== |
- | The following | + | The following |
- | * Enhance the program to accept | + | * Enhance the program to accept pairs of additional values (offset followed by its length), where each offset through length will be colored using ANSI text escape sequences |
* For any line containing this colorized text, highlight the address in bold white. | * For any line containing this colorized text, highlight the address in bold white. | ||
Line 139: | Line 153: | ||
As an example, running the program with the following arguments could produce results like this: | As an example, running the program with the following arguments could produce results like this: | ||
- | |||
- | <cli> | ||
- | lab46: | ||
- | </ | ||
{{: | {{: | ||
Line 194: | Line 204: | ||
While there are 8 available foreground colors, bolding can double that range to 16. | While there are 8 available foreground colors, bolding can double that range to 16. | ||
- | =====Implementation Restrictions===== | + | =====Verification===== |
+ | I'm working on an **eval** script that should aid you in verifying how compliant your implementation is against project specifications. | ||
+ | ====make check==== | ||
+ | I've tied in the running of the verification script into the Makefile. To utilize it, all you have to do is type " | ||
+ | |||
+ | It may stop to prompt you after completing each category of tests so that you can better analyze the results (or hit CTRL-c to exit out of the script and address any issues). | ||
+ | |||
+ | For example, let's say there' | ||
+ | |||
+ | <cli> | ||
+ | lab46: | ||
+ | =================================== | ||
+ | = discrete/ | ||
+ | =================================== | ||
+ | [Part 0]: Compliance with xxd output ... | ||
+ | |||
+ | ----[ | ||
+ | | ||
+ | bdt0: 17194 char, 257 lines, md5: 63376e4205135c2d0e520884a6e861ff | ||
+ | ---------------------------------------------------------------------- | ||
+ | | ||
+ | ---------------------------------------------------------------------- | ||
+ | |||
+ | ----[ data ]--------------------------------------------------- | ||
+ | | ||
+ | bdt0: 1269 char, 19 lines, md5: 1a9bab04b8ebdb523c1d3e722845a6c5 | ||
+ | ---------------------------------------------------------------------- | ||
+ | | ||
+ | ---------------------------------------------------------------------- | ||
+ | |||
+ | ----[ | ||
+ | | ||
+ | bdt0: 6564 char, 98 lines, md5: 24895128bce7a041f553226c7981c0d4 | ||
+ | ---------------------------------------------------------------------- | ||
+ | | ||
+ | ---------------------------------------------------------------------- | ||
+ | |||
+ | ----[ sample0.txt ]--------------------------------------------------- | ||
+ | | ||
+ | bdt0: 661 char, 10 lines, md5: 4e01dda9d62c98781664f9fed8d494ff | ||
+ | ---------------------------------------------------------------------- | ||
+ | | ||
+ | ---------------------------------------------------------------------- | ||
+ | Tally: 9/12 | Press ENTER to continue | ||
+ | lab46: | ||
+ | </ | ||
+ | |||
+ | With the individual char and line counts, we can get some impression of things being off in more significant ways (and of course the MD5sums will not match). | ||
+ | |||
+ | You can then run things manually to see the end results. | ||
+ | |||
+ | =====Implementation Restrictions===== | ||
As our goal is not only to explore the more subtle concepts of computing but to promote different methods of thinking (and arriving at solutions seemingly in different ways), one of the themes I have been harping on is the stricter adherence to the structured programming philosophy. It isn't just good enough to be able to crank out a solution if you remain blind to the many nuances of the tools we are using, so we will at times be going out of our way to emphasize focus on certain areas that may see less exposure (or avoidance due to it being less familiar). | As our goal is not only to explore the more subtle concepts of computing but to promote different methods of thinking (and arriving at solutions seemingly in different ways), one of the themes I have been harping on is the stricter adherence to the structured programming philosophy. It isn't just good enough to be able to crank out a solution if you remain blind to the many nuances of the tools we are using, so we will at times be going out of our way to emphasize focus on certain areas that may see less exposure (or avoidance due to it being less familiar). | ||
As such, the following implementation restrictions are also in place: | As such, the following implementation restrictions are also in place: | ||
- | * absolutely **NO** switch/ | + | * absolutely **NO** switch/ |
* absolutely **NO** infinite loops (**while(1)**, | * absolutely **NO** infinite loops (**while(1)**, | ||
* no forced redirection of the flow of the process (no seeking to the end of the file to grab a max size only to zip back somewhere else: deal with the data in as you are naturally encountering it). | * no forced redirection of the flow of the process (no seeking to the end of the file to grab a max size only to zip back somewhere else: deal with the data in as you are naturally encountering it). | ||
+ | * With the exception of any negative values, all numbers should be transacted in hexadecimal (as in the values you assign and compare and manipulate in your code). | ||
+ | * No line must exceed 80 characters in width. | ||
+ | * All " | ||
+ | * For the highlighted address and lengths, store them in an array of structs (containing the //address// and //length// members). | ||
+ | * **NO** logic shunts (ie having an if statement nested inside a loop to bypass an undesirable iteration)- this should be handled by the loop condition! | ||
=====Submission===== | =====Submission===== | ||
Line 208: | Line 274: | ||
* Code must compile cleanly (no warnings or errors) | * Code must compile cleanly (no warnings or errors) | ||
- | * Use the **-Wall** and **--std=c99** flags when compiling. | + | * Use the **-Wall** and **--std=c99** flags when compiling |
* Code must be nicely and consistently indented (you may use the **indent** tool) | * Code must be nicely and consistently indented (you may use the **indent** tool) | ||
* Code must utilize the algorithm/ | * Code must utilize the algorithm/ | ||
+ | * Implementation must be free from stated restrictions above | ||
* Output **must** match the specifications presented above (when given the same inputs) | * Output **must** match the specifications presented above (when given the same inputs) | ||
* Code must be commented | * Code must be commented | ||
* be sure your comments reflect the **how** and **why** of what you are doing, not merely the **what**. | * be sure your comments reflect the **how** and **why** of what you are doing, not merely the **what**. | ||
* Track/ | * Track/ | ||
- | * Submit a copy of your source code to me using the **submit** | + | * Submit a copy of your source code to me by running |
- | To submit this program to me using the **submit** | + | To submit this program to me using the Makefile tool (**make submit**), run the following: |
<cli> | <cli> | ||
- | $ submit | + | lab46: |
+ | removed ‘bdt0’ | ||
+ | removed ‘errors’ | ||
+ | |||
+ | Project backup process commencing | ||
+ | |||
+ | Taking snapshot of current project (bdt0) ... OK | ||
+ | Compressing snapshot of bdt0 project archive | ||
+ | Setting secure permissions on bdt0 archive | ||
+ | |||
+ | Project backup process complete | ||
Submitting discrete project " | Submitting discrete project " | ||
- | -> bdt0.c(OK) | + | -> ../bdt0-20170925-05.tar.gz(OK) |
SUCCESSFULLY SUBMITTED | SUCCESSFULLY SUBMITTED | ||
+ | lab46: | ||
</ | </ | ||
You should get some sort of confirmation indicating successful submission if all went according to plan. If not, check for typos and or locational mismatches. | You should get some sort of confirmation indicating successful submission if all went according to plan. If not, check for typos and or locational mismatches. |