This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
haas:spring2016:cprog:projects:cbf0 [2016/03/21 23:10] – [30 line throttled display (on a 217 byte file)] wedge | haas:spring2016:cprog:projects:cbf0 [2016/03/22 19:56] (current) – [Unthrottled display (512 bytes)] wedge | ||
---|---|---|---|
Line 57: | Line 57: | ||
* 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). | ||
- | * If a second command-line argument | + | * The second command-line argument is a sizing throttle (controlling the number of lines your program will display). If a **0** is given, assume autosize (use the detected height to be your maximum in your calculations). |
* Display an ASCII header identifying the various fields (offset, hex, ascii), surrounded by dashed lines, running 79 characters in width. See below for more details. | * Display an ASCII header identifying the various fields (offset, hex, ascii), surrounded by dashed lines, running 79 characters in width. See below for more details. | ||
* Each row after the header will display: | * Each row after the header will display: | ||
Line 110: | Line 110: | ||
<cli> | <cli> | ||
- | lab46: | + | lab46: |
------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- | ||
offset | offset | ||
Line 205: | Line 205: | ||
lab46: | lab46: | ||
</ | </ | ||
+ | |||
+ | =====Bonus Opportunities===== | ||
+ | The following can be considered a bonus point opportunity: | ||
+ | |||
+ | * Enhance the program to accept up to 6 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. | ||
+ | |||
+ | ====Sample output==== | ||
+ | |||
+ | As an example, running the program with the following arguments could produce results like this: | ||
+ | |||
+ | <cli> | ||
+ | lab46: | ||
+ | </ | ||
+ | |||
+ | {{: | ||
+ | ====ANSI escape sequences for color==== | ||
+ | This probably isn't very portable, and depending on the terminal, it may not work for some people. | ||
+ | |||
+ | It may be most convenient to set up preprocessor #define statements near the top of your code, as follows: | ||
+ | |||
+ | <code c> | ||
+ | # | ||
+ | # | ||
+ | # | ||
+ | # | ||
+ | # | ||
+ | # | ||
+ | # | ||
+ | # | ||
+ | # | ||
+ | # | ||
+ | # | ||
+ | # | ||
+ | # | ||
+ | # | ||
+ | # | ||
+ | # | ||
+ | # | ||
+ | # | ||
+ | </ | ||
+ | |||
+ | To use, you output them: | ||
+ | |||
+ | < | ||
+ | fprintf(stdout, | ||
+ | fprintf(stdout, | ||
+ | fprintf(stdout, | ||
+ | </ | ||
+ | |||
+ | You have to remember to turn the color or setting off (resetting it) to revert back to the original color. | ||
+ | |||
+ | You can mix and match as well: | ||
+ | |||
+ | < | ||
+ | fprintf(stdout, | ||
+ | fprintf(stdout, | ||
+ | fprintf(stdout, | ||
+ | fprintf(stdout, | ||
+ | fprintf(stdout, | ||
+ | </ | ||
+ | |||
+ | While there are 8 available foreground colors, bolding can double that range to 16. | ||
=====Submission===== | =====Submission===== | ||
To successfully complete this project, the following criteria must be met: | To successfully complete this project, the following criteria must be met: | ||
Line 212: | Line 275: | ||
* 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/ | ||
- | * Output must match the specifications presented above (when given the same inputs) | + | * Output |
* Code must be commented | * Code must be commented | ||
* have a properly filled-out comment banner at the top | * have a properly filled-out comment banner at the top |