forked from xolatile/xhartae
39 lines
2.7 KiB
C
39 lines
2.7 KiB
C
|
/*
|
||
|
Copyright (c) 2023 : Ognjen 'xolatile' Milan Robovic
|
||
|
|
||
|
Xhartae is free software! You will redistribute it or modify it under the terms of the GNU General Public License by Free Software Foundation.
|
||
|
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.
|
||
|
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.
|
||
|
*/
|
||
|
|
||
|
#ifndef CHAPTER_4_HEADER
|
||
|
#define CHAPTER_4_HEADER
|
||
|
|
||
|
#include "chapter_0.h"
|
||
|
#include "chapter_1.h"
|
||
|
#include "chapter_2.h"
|
||
|
#include "chapter_3.h"
|
||
|
|
||
|
/*
|
||
|
I believe that this chapter should be a breakpoint for you to write a simple C program. So far, we've learned in:
|
||
|
|
||
|
- chapter 0: To format our code properly in order to increase readability and we've implemented some core functions for memory, strings and input / output.
|
||
|
- 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.
|
||
|
- chapter 2: To use external variables, function pointers and minor part of 'libncurses' reimplementation that doesn't care about portability.
|
||
|
- chapter 3: To use standard library 'printf' function, and to implement variadic argument functions, while also covering switch statement in more depth.
|
||
|
|
||
|
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
|
||
|
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
|
||
|
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
|
||
|
only use functions and variables defined in chapters zero to three. Lets begin.
|
||
|
|
||
|
I'll write this huge 'program_view_c_file' function in procedural style, so to say, and in the next chapter, we'll reimplement it in more modular way, using other (sub)programs,
|
||
|
or simply, functions. Learning 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 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 coming from. For example, if you wrote Ada, you'll like chapter four, if you wrote C++, you'll like chapter five.
|
||
|
*/
|
||
|
|
||
|
extern void program_view_c_file (char * text_file, int width, int height, int x, int y);
|
||
|
|
||
|
#endif
|