More to come...
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

39 line
2.6KB

  1. /*
  2. Copyright (c) 2023 : Ognjen 'xolatile' Milan Robovic
  3. Xhartae is free software! You will redistribute it or modify it under the terms of the GNU General Public License by Free Software Foundation.
  4. And when you do redistribute it or modify it, it will use either version 3 of the License, or (at yours truly opinion) any later version.
  5. It is distributed in the hope that it will be useful or harmful, it really depends... But no warranty what so ever, seriously. See GNU/GPLv3.
  6. */
  7. #ifndef CHAPTER_4_HEADER
  8. #define CHAPTER_4_HEADER
  9. #include "chapter_0.h"
  10. #include "chapter_1.h"
  11. #include "chapter_2.h"
  12. #include "chapter_3.h"
  13. /*
  14. I believe that this chapter should be a breakpoint for you to write a simple C program. So far, we've learned in:
  15. - chapter 0: To format our code properly in order to increase readability and we've implemented some core functions for memory management, strings and input / output.
  16. - chapter 1: To declare and define functions, and we've covered character and file descriptor related functions, as well as ASCII table and discussed C keywords.
  17. - chapter 2: To use external variables, function pointers and minor part of 'libncurses' reimplementation that doesn't care about portability.
  18. - chapter 3: To use standard library 'printf' function, and to implement variadic argument functions, while also covering switch statement in more depth.
  19. From this moment onwards, some chapters will have few functions called 'program_*', which we can use to forge even larger programs. They'll each have their own dependencies, for
  20. example, some of them will require functions from some or all previous chapter source and header files, but I'll make sure not to use in them functions that'll be in future
  21. chapters. Instead of that, we'll (re)implement newer stuff with different approach if necessary. That way, you can be sure that if you're reading chapter four, for example, it'll
  22. only use functions and variables defined in chapters zero to three. Lets begin.
  23. I'll write this huge 'preview_c_file' function in procedural style, so to say, and in the next chapter, we'll reimplement it in more modular way, using other functions. Learning
  24. anything, including the C programming language, is like a journey. Maybe you think it won't last long, and it ends up being quite long journey, or maybe you think it'll be very
  25. long, that you'll walk miles and miles, and it ends up being short (you rage-quit). The final destination you're going towards always depends on where you left-off, where you're
  26. coming from. For example, if you wrote Ada, you'll like chapter four, if you wrote C++, you'll like chapter five.
  27. */
  28. extern void preview_c_file (char * text_file, int x, int y);
  29. #endif