-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Matthias Gatto <[email protected]>
- Loading branch information
1 parent
7148a5a
commit 57191fe
Showing
2 changed files
with
59 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,29 @@ | ||
# Do You Want To Know More? | ||
|
||
*Info that will be useful if you want to Hack COGNAC* | ||
*Essential Information for Hacking COGNAC* | ||
|
||
## Unix philosophy, and COGNAC Paradigms. | ||
## Unix Philosophy and COGNAC Paradigms. | ||
|
||
Most peoples have hear the sentence "Do One Thing and Do It Well", and heard that's how Unix is and how Unix should be. | ||
Most people have heard the phrase "Do One Thing and Do It Well" and associate it with the Unix philosophy. It’s said that this is how Unix operates and how it should be. | ||
|
||
I personally don't know how much this is true nor a good idea, and like most peoples I use to pretend to understand this, but did not, I don't know if I got it now, but I have a far better understand of what it uses to. | ||
Personally, I used to wonder how much truth there was to this statement, or whether it was even a good idea. Like many others, I would nod along, pretending to understand it, but I didn’t really get it. Now, though, I feel I have a much better understanding of what it truly means. | ||
|
||
How so ? You didn't ask. By reading source from some Unix OS. | ||
When I read a complete [shell](https://github.com/dspinellis/unix-history-repo/blob/BSD-1-Snapshot-Development/s1/sh.c), the whole source of [ls](https://github.com/dspinellis/unix-history-repo/blob/BSD-1-Snapshot-Development/s6/ls.c), or a fully running [cat](https://github.com/klange/toaruos/blob/master/apps/cat.c), I got hit by the realisation that most of those programmes take less line of code, that I would need to write half of an object interface in any language. | ||
ow, you ask? By reading the source code of some Unix-based OSes. | ||
When I read a complete [shell](https://github.com/dspinellis/unix-history-repo/blob/BSD-1-Snapshot-Development/s1/sh.c), the whole source of [ls](https://github.com/dspinellis/unix-history-repo/blob/BSD-1-Snapshot-Development/s6/ls.c), or a fully running [cat](https://github.com/klange/toaruos/blob/master/apps/cat.c), I had a realization: most of these programs are written in far fewer lines of code than I would need just to write half of an object interface in a modern language. | ||
|
||
But it kind of made sense, programmes were made to interact together, and where we tend to see a program as a whole project, a program on Unix use to do only one thing, and do it well. | ||
You don't need modularity in your program if writing a whole program anew is faster than creating an interface, and as program are made to interact together, it's not completely wrong to see cat/grep/wc or any Unix program as an object, inheriting some text handling class. | ||
It started to make sense. These programs were built to interact with each other. While we tend to view programs as entire projects nowadays, in Unix, a program was designed to do just one thing—and do it well. Modularity wasn’t a priority. Why create a complex interface when writing an entirely new program could be faster? In Unix, programs like cat, grep, and wc are almost like objects in an object-oriented system, inheriting basic text-handling class. | ||
|
||
COGNAC is bash, and as sure try to follow this idea. | ||
COGNAC is based on Bash, and it follows a similar philosophy. | ||
|
||
It use lot of small program interactive together, and is complet by a few utilities in bin/ that do some text handling. | ||
It uses a lot of small programs that interact with each other and is supplemented by a few utilities in the bin/ directory that handle text processing tasks. | ||
|
||
Makefile was create to... make files, and so Makefile is use that way. | ||
The Makefile was originally created to "make" files, and COGNAC uses it in that way. | ||
|
||
Scripts use by the makefile, do the job of creating the file, and the makefile check that they have been created, and that there's no need to rebuild them. | ||
The scripts used by the Makefile handle the actual file creation, while the Makefile itself checks if files need to be rebuilt or not. | ||
|
||
## Templating | ||
|
||
the templating system cognac is homemade, it read SRC file and generate DEST file | ||
it uses multiple keyword, each surrounded by 4 underscore (example: `____api_version____`) | ||
as an example, you can look at [lib.h](./lib.h) or [main_tpl.c](./main_tpl.c) | ||
COGNAC’s templating system is homemade. It reads SRC files and generates DEST files. It uses several keywords, each surrounded by four underscores (e.g., `____api_version____`). | ||
For example, you can check out [lib.h](./lib.h) or [main_tpl.c](./main_tpl.c) | ||
|
||
Some rules support multiples languages sure as `____func_code____`, which will generate functions calls, | ||
and some are not. (like `____functions_proto____` which for now support only C) | ||
Some rules support multiple languages, like `____func_code____`, which generates function calls. Others, like `____functions_proto____`, currently support only C. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters