gostpadi 1.0.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,4 @@
1
+ __pycache__/
2
+ *.pyc
3
+ *.png
4
+ !docs/*.png
gostpadi-1.0.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 sehaxe
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,126 @@
1
+ Metadata-Version: 2.5
2
+ Name: gostpadi
3
+ Version: 1.0.0
4
+ Summary: Flowchart generator: feed it C code, get a clean diagram
5
+ Project-URL: Repository, https://github.com/sehaxe/gostpadi
6
+ Project-URL: Issues, https://github.com/sehaxe/gostpadi/issues
7
+ Author: sehaxe
8
+ License: MIT License
9
+
10
+ Copyright (c) 2026 sehaxe
11
+
12
+ Permission is hereby granted, free of charge, to any person obtaining a copy
13
+ of this software and associated documentation files (the "Software"), to deal
14
+ in the Software without restriction, including without limitation the rights
15
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
16
+ copies of the Software, and to permit persons to whom the Software is
17
+ furnished to do so, subject to the following conditions:
18
+
19
+ The above copyright notice and this permission notice shall be included in all
20
+ copies or substantial portions of the Software.
21
+
22
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
23
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
24
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
25
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
26
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
27
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
28
+ SOFTWARE.
29
+ License-File: LICENSE
30
+ Keywords: c,code2chart,diagram,flowchart,svg,visualization
31
+ Classifier: Development Status :: 5 - Production/Stable
32
+ Classifier: Environment :: Console
33
+ Classifier: Intended Audience :: Developers
34
+ Classifier: Intended Audience :: Education
35
+ Classifier: Operating System :: OS Independent
36
+ Classifier: Programming Language :: Python :: 3
37
+ Classifier: Programming Language :: Python :: 3.9
38
+ Classifier: Programming Language :: Python :: 3.10
39
+ Classifier: Programming Language :: Python :: 3.11
40
+ Classifier: Programming Language :: Python :: 3.12
41
+ Classifier: Programming Language :: Python :: 3.13
42
+ Classifier: Topic :: Multimedia :: Graphics :: Graphics Conversion
43
+ Classifier: Topic :: Software Development :: Documentation
44
+ Requires-Python: >=3.9
45
+ Requires-Dist: matplotlib>=3.5
46
+ Description-Content-Type: text/markdown
47
+
48
+ # gostpadi
49
+
50
+ Рисовалка блок-схем. Скармливаешь `main.c` — получаешь готовую схему:
51
+ все линии под 90° и одной толщины, `if` и `switch` расходятся ветками,
52
+ `return` уводит стрелку в «End». Рисовать руками не приходится.
53
+
54
+ ![схема из кода C](docs/scheme-from-c.png)
55
+
56
+ Работает и в обратную сторону: короткий текстовый файл `.gvn` —
57
+ и та же схема без кода.
58
+
59
+ ![switch](docs/scheme-switch.png)
60
+
61
+ ## Установка
62
+
63
+ Достаточно [uv](https://docs.astral.sh/uv/), ничего ставить не нужно:
64
+
65
+ ```bash
66
+ curl -LsSf https://astral.sh/uv/install.sh | sh # Linux / macOS
67
+ ```
68
+
69
+ Схема из кода одной командой, без клонирования:
70
+
71
+ ```bash
72
+ uv run https://raw.githubusercontent.com/sehaxe/gostpadi/main/gostpadi.py main.c
73
+ ```
74
+
75
+ Классический вариант:
76
+
77
+ ```bash
78
+ git clone https://github.com/sehaxe/gostpadi && cd gostpadi
79
+ pip install matplotlib
80
+ python gostpadi.py main.c
81
+ ```
82
+
83
+ ## Как пользоваться
84
+
85
+ ```bash
86
+ gostpadi main.c # -> main.png, вписано в А4
87
+ gostpadi main.c --show # показать схему в терминале
88
+ gostpadi main.c -o scheme.svg # векторный SVG для Word/LaTeX
89
+ gostpadi main.c --auto # размер по схеме, без ужимания
90
+ gostpadi main.c --gvn # сохранить текст схемы (можно править)
91
+ ```
92
+
93
+ Понимает: `printf`/`scanf` (сами параллелограммы), присваивания, `if/else`,
94
+ `switch/case/default` (кейсы висят на линии из нижнего угла ромба),
95
+ `return` (ветка уходит в «End»). Объявления переменных выбрасываются.
96
+ Циклов и `else if` пока нет — утилита скажет сама.
97
+
98
+ Хочешь управлять каждой строкой — пиши `.gvn` руками: строка = блок,
99
+ ветки — отступ в 4 пробела. Примеры в `examples/`.
100
+
101
+ ## Опции
102
+
103
+ | опция | что делает |
104
+ |---|---|
105
+ | `-o ФАЙЛ` | имя результата (`.png` или `.svg`) |
106
+ | `--show` | нарисовать схему прямо в терминале |
107
+ | `--auto` | канвас по размеру схемы, без ужимания |
108
+ | `--gvn` | сохранить текст схемы |
109
+ | `--scale=N` | масштаб |
110
+ | `--font=N` | кегль (12) |
111
+ | `--lw=N` | толщина всех линий (1.4) |
112
+ | `--dpi=N` | плотность пикселей (200) |
113
+ | `--template` | заготовка схемы |
114
+
115
+ ## Проверка
116
+
117
+ ```bash
118
+ uv run --with matplotlib python selftest.py
119
+ ```
120
+
121
+ Прогоняет все вариации и сверяет геометрию с эталоном
122
+ (`tests/baseline.json`).
123
+
124
+ ## Лицензия
125
+
126
+ MIT — [LICENSE](LICENSE).
@@ -0,0 +1,79 @@
1
+ # gostpadi
2
+
3
+ Рисовалка блок-схем. Скармливаешь `main.c` — получаешь готовую схему:
4
+ все линии под 90° и одной толщины, `if` и `switch` расходятся ветками,
5
+ `return` уводит стрелку в «End». Рисовать руками не приходится.
6
+
7
+ ![схема из кода C](docs/scheme-from-c.png)
8
+
9
+ Работает и в обратную сторону: короткий текстовый файл `.gvn` —
10
+ и та же схема без кода.
11
+
12
+ ![switch](docs/scheme-switch.png)
13
+
14
+ ## Установка
15
+
16
+ Достаточно [uv](https://docs.astral.sh/uv/), ничего ставить не нужно:
17
+
18
+ ```bash
19
+ curl -LsSf https://astral.sh/uv/install.sh | sh # Linux / macOS
20
+ ```
21
+
22
+ Схема из кода одной командой, без клонирования:
23
+
24
+ ```bash
25
+ uv run https://raw.githubusercontent.com/sehaxe/gostpadi/main/gostpadi.py main.c
26
+ ```
27
+
28
+ Классический вариант:
29
+
30
+ ```bash
31
+ git clone https://github.com/sehaxe/gostpadi && cd gostpadi
32
+ pip install matplotlib
33
+ python gostpadi.py main.c
34
+ ```
35
+
36
+ ## Как пользоваться
37
+
38
+ ```bash
39
+ gostpadi main.c # -> main.png, вписано в А4
40
+ gostpadi main.c --show # показать схему в терминале
41
+ gostpadi main.c -o scheme.svg # векторный SVG для Word/LaTeX
42
+ gostpadi main.c --auto # размер по схеме, без ужимания
43
+ gostpadi main.c --gvn # сохранить текст схемы (можно править)
44
+ ```
45
+
46
+ Понимает: `printf`/`scanf` (сами параллелограммы), присваивания, `if/else`,
47
+ `switch/case/default` (кейсы висят на линии из нижнего угла ромба),
48
+ `return` (ветка уходит в «End»). Объявления переменных выбрасываются.
49
+ Циклов и `else if` пока нет — утилита скажет сама.
50
+
51
+ Хочешь управлять каждой строкой — пиши `.gvn` руками: строка = блок,
52
+ ветки — отступ в 4 пробела. Примеры в `examples/`.
53
+
54
+ ## Опции
55
+
56
+ | опция | что делает |
57
+ |---|---|
58
+ | `-o ФАЙЛ` | имя результата (`.png` или `.svg`) |
59
+ | `--show` | нарисовать схему прямо в терминале |
60
+ | `--auto` | канвас по размеру схемы, без ужимания |
61
+ | `--gvn` | сохранить текст схемы |
62
+ | `--scale=N` | масштаб |
63
+ | `--font=N` | кегль (12) |
64
+ | `--lw=N` | толщина всех линий (1.4) |
65
+ | `--dpi=N` | плотность пикселей (200) |
66
+ | `--template` | заготовка схемы |
67
+
68
+ ## Проверка
69
+
70
+ ```bash
71
+ uv run --with matplotlib python selftest.py
72
+ ```
73
+
74
+ Прогоняет все вариации и сверяет геометрию с эталоном
75
+ (`tests/baseline.json`).
76
+
77
+ ## Лицензия
78
+
79
+ MIT — [LICENSE](LICENSE).
Binary file
Binary file
@@ -0,0 +1,5 @@
1
+ # Linear scheme: one block per line, arrows down
2
+ action a = 5
3
+ action b = 17
4
+ action c = a + b
5
+ output printf("c = %d", c)
@@ -0,0 +1,10 @@
1
+ # Branch: yes goes left, no goes right, both merge below
2
+ output printf(a)
3
+ input scanf("%d", &a)
4
+ output printf(b)
5
+ input scanf("%d", &b)
6
+ action c = a + b
7
+ output printf(c)
8
+ if c > 5
9
+ yes: printf(c)
10
+ no: c = 0
@@ -0,0 +1,7 @@
1
+ # Switch: one column per case, all cases hang
2
+ # on the horizontal line from the bottom corner
3
+ input scanf("%d", &a)
4
+ if switch (a)
5
+ 1: printf(y); break
6
+ 2: printf(z); break
7
+ default: a = 10; break
@@ -0,0 +1,10 @@
1
+ #gostpadi 1
2
+ # Идеальный минимум: одна строка = один блок, отступ = ветка.
3
+ input scanf("%d", &x)
4
+ if scanf != 1
5
+ yes -> end: printf("bad input"); return 1
6
+ y = x * 2
7
+ if y > 10
8
+ yes: printf("big")
9
+ no: printf("small")
10
+ output printf("done")
@@ -0,0 +1,21 @@
1
+ #include <stdio.h>
2
+
3
+ // Определение времени года по номеру месяца
4
+ int main(void) {
5
+ int month;
6
+
7
+ printf("Введите номер месяца (1-12): ");
8
+ if (scanf("%d", &month) != 1 || month < 1 || month > 12) {
9
+ printf("Ошибка ввода\n");
10
+ return 1;
11
+ }
12
+
13
+ switch (month / 3) {
14
+ case 1: printf("Весна\n"); break;
15
+ case 2: printf("Лето\n"); break;
16
+ case 3: printf("Осень\n"); break;
17
+ default: printf("Зима\n");
18
+ }
19
+
20
+ return 0;
21
+ }
@@ -0,0 +1,7 @@
1
+ output printf("Введите катеты...")
2
+ input scanf("%f %f", &a, &b)
3
+ if scanf != 2 || a <= 0 || b <= 0
4
+ yes -> end: printf("Ошибка..."); return 1
5
+ no:
6
+ output printf("Гипотенуза...")
7
+ output printf("Площадь...")
@@ -0,0 +1,9 @@
1
+ input scanf("%d", &a)
2
+ if a < 100000 || ...
3
+ yes -> end: printf("Ошибка..."); return 1
4
+ no:
5
+ action b = a / 100000 + ...
6
+ action c = a % 10 + ...
7
+ if b == c
8
+ yes: printf("БИЛЕТ СЧАСТЛИВЫЙ...")
9
+ no: printf("Вам не повезло...")
@@ -0,0 +1,12 @@
1
+ input scanf("%f %f %f", ...)
2
+ if scanf(...) != 3
3
+ yes -> end: printf("Ошибка..."); return 1
4
+ no:
5
+ if fmodf(a, 1) == 0
6
+ yes: printf("Число 1...")
7
+ if fmodf(b, 1) == 0
8
+ yes: printf("Число 2...")
9
+ if fmodf(c, 1) == 0
10
+ yes: printf("Число 3...")
11
+ if fmodf(a, 1) != 0 && ...
12
+ yes: printf("Ни одно...")
@@ -0,0 +1,10 @@
1
+ input scanf("%d", &status)
2
+ if status <= 0 || ...
3
+ yes -> end: printf("ТЫ НЕ ПРОЙ..."); return 1
4
+ no:
5
+ if switch (status)
6
+ 1: printf("Декабрь...")
7
+ 2: printf("Март...")
8
+ 3: printf("Июнь...")
9
+ 4: printf("Сентябрь...")
10
+ default: printf("Как ты...")