or
or
By clicking below, you agree to our terms of service.
New to HackMD? Sign up
Syntax | Example | Reference | |
---|---|---|---|
# Header | Header | 基本排版 | |
- Unordered List |
|
||
1. Ordered List |
|
||
- [ ] Todo List |
|
||
> Blockquote | Blockquote |
||
**Bold font** | Bold font | ||
*Italics font* | Italics font | ||
~~Strikethrough~~ | |||
19^th^ | 19th | ||
H~2~O | H2O | ||
++Inserted text++ | Inserted text | ||
==Marked text== | Marked text | ||
[link text](https:// "title") | Link | ||
 | Image | ||
`Code` | Code |
在筆記中貼入程式碼 | |
```javascript var i = 0; ``` |
|
||
:smile: | ![]() |
Emoji list | |
{%youtube youtube_id %} | Externals | ||
$L^aT_eX$ | LaTeX | ||
:::info This is a alert area. ::: |
This is a alert area. |
On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?
Please give us some advice and help us improve HackMD.
Do you want to remove this version name and description?
Syncing
xxxxxxxxxx
42sh Wiki
SCL structure
\
'
"
Tips
1) Utilities
tree -I 'venv|build'
: display all directories execptvenv
andbuild
.alias ccg="gcc -Wall -Wextra -Werror -pedantic -std=c99 -g -fsanitize=address -o out"
2) Shell
A) To check if command is POSIX-compliant
bash --posix
in terminal.command
3) Cmake
A) General
_XOPEN_SOURCE >= 500
)gcc -Isrc
)B) Run Pytest
conftest.py
(Renamed if needed) and move it to test folder. (not needed as pierre did it for us)python -m venv venv
to create env. ( in root of dir)source venv/bin/activate
pip install pytest pyyaml
pip install cmake-format
(cmake-format -i CMakeLists.txt
)pytest
.yaml
file (seeconftest.py
for syntax).deactivate
source venv/bin/activate
pytest
deactivate
C) Run criterion tests
CMakeLists.txt (1)
, make sure to have:add_subdirectory(src/lexer)
CMakeLists.txt (2)
, make sure to have:target_link_libraries(42sh PRIVATE ${READLINE_LIB} common_options lexer)
CMakeLists.txt (3)
, make sure to have:CMakeLists.txt (4)
, make sure to have:lexer/lexer_1.c
, only need to include#include "token.h"
4) Git
A)
.git/config
git tree
: view commit in tree-like view.git config --global pull.rebase true
: Enable pull rebase.B) branching
git branch
: Display all existing branches.git checkout <branch>
: switch branchgit checkout -b <branch>
: create branch + switch branchgit push --set-upstream origin <branch>
: Tells git to push to<branch>
and not master.C) Merge
git checkout master
git pull
git merge <name_branch>
5) Debugging
Test(....)
byint main(void)
make debug
, an executable namedutest_criterion
will be created.gdb utest_criterion
.make clean
+rm utest_criterion
utest_criterion
at the root is a copy from the one in test. Thusmake clean
won't see it.Valgrind
mkdir build/
cd build
cmake .. -DCMAKE_BUILD_TYPE=Release
(This should run version without fsanitize=address)fsanitize=address
mkdir debug/
cd debug
cmake .. -DCMAKE_BUILD_TYPE=Debug
(This should run version with fsanitize=address)6) Static library linking
-Wl,--start-group
and-Wl,--end-group
to stop worrying about libraries ordering.7) Doxygen (manpage)
groff -man -Tascii doc/42sh.man | less
Miscellaneous
Token Recogntion
&&Shell Grammar
sectionsConferences