feat: a brand new hhss!#70
Conversation
|
파일수 뻥튀기돼서 이제 빌드할때 콘솔에 찍히는거 많아져서 빌드시간 오래걸려서 뭔가개쩌는 프로그램을 만든거같은 기분느낄수있음 ㅋ |
There was a problem hiding this comment.
Pull request overview
This PR performs a major refactor centered on a full rewrite of the hhss C implementation, introducing a more modular architecture (lex/parse/replace, DB loaders/parsers) and adding support for the new rt.db section-based replacement database with backwards compatibility for usr.dat. It also modularizes the build system (top-level recursive Makefile + vars.mk/defs.mk) and introduces a shared common/ C utility layer used across programs (wrappers, fatal handling, file loading, dynamic array, etc.).
Changes:
- Rewrote
hhssC implementation into modular components and addedrt.db/dat.dbsupport with fallback to legacyusr.dat/hsr.dat. - Introduced
common/shared C utilities (wrappers, fatal, readline/loadfile, string split, array ADT) and migrated some program-local code to use them. - Reworked build system into a top-level recursive Makefile with shared variables/definitions and automatic header dependency generation (
*.d).
Reviewed changes
Copilot reviewed 69 out of 71 changed files in this pull request and generated 9 comments.
Show a summary per file
| File | Description |
|---|---|
| .gitignore | Adjust ignore patterns (object/dependency files now targeted). |
| Makefile | Top-level build/install/test orchestration via recursive sub-makes + shared vars/defs. |
| defs.mk | Refactors install templates and adds shared color-string helper. |
| vars.mk | New shared build/install variable definitions. |
| test/.gitignore | Updates ignored artifacts for test build outputs. |
| common/array.adt.h | New dynamic array ADT public header. |
| common/array.adt.internals.h | New internal definitions for array ADT. |
| common/array.adt.c | New dynamic array ADT implementation. |
| common/colorcodes.h | New shared ANSI color code definitions. |
| common/fatal.h | New shared fatal error API/macros. |
| common/fatal.internals.h | New fatal implementation internals. |
| common/fatal.c | New shared fatal error implementation. |
| common/loadfile.h | New file-loading API producing line_t arrays. |
| common/loadfile.internals.h | New loadfile internals. |
| common/loadfile.c | New loadfile implementation using readln. |
| common/readline.h | New line-reading API. |
| common/readline.internals.h | New readline internals. |
| common/readline.c | New readln() implementation. |
| common/strutils.h | New string utilities API (split). |
| common/strutils.internals.h | New strutils internals. |
| common/strutils.c | New split() implementation for delimiter-based splitting. |
| common/utils.h | Refactors utils header (adds ESIZ macro, keeps prototypes). |
| common/utils.internals.h | New utils internals header. |
| common/utils.c | Updates utils implementation (seed/rand_range/mblen). |
| common/wrappers.h | Expands wrappers API (safe fopen/close + alloc helpers). |
| common/wrappers.internals.h | New wrappers internals. |
| common/wrappers.c | New shared wrappers implementation (stdio/stdlib/signal wrappers). |
| yandere/c/.gitignore | Adds *.d to ignored artifacts and normalizes patterns. |
| yandere/c/Makefile | Updated build to include common/ sources + auto .d dependency generation. |
| yandere/c/global.h | Removes program-local PROGNAME and sighandler_t typedef (migrated to common). |
| yandere/c/noise.h | Adds global.h include. |
| yandere/c/wrappers.c | Removed program-local wrappers implementation (migrated to common/). |
| yandere/c/fatal.h | Removed program-local fatal API (migrated to common/). |
| yandere/c/fatal.c | Removed program-local fatal implementation (migrated to common/). |
| yandere/c/colorcodes.h | Removed program-local colorcodes (migrated to common/). |
| yandere/c/yandere.types.h | Includes shared fatal.h from common/. |
| hhss/usr.dat | Minor formatting normalization. |
| hhss/rt.db | Adds new section-based replacement DB (rt.db). |
| hhss/dat.db | Adds new template/data DB (dat.db). |
| hhss/c/.gitignore | Ignores *.o and *.d artifacts. |
| hhss/c/Makefile | Updated build to include common/ + auto .d dependencies and install-path defines. |
| hhss/c/argv1parse.h | New argv parser API. |
| hhss/c/argv1parse.internals.h | New argv parser internals. |
| hhss/c/argv1parse.c | New argv count parsing/validation implementation. |
| hhss/c/dbload.h | New DB load API (choose new vs old file). |
| hhss/c/dbload.internals.h | New DB load internals. |
| hhss/c/dbload.c | New DB load selection implementation. |
| hhss/c/debug.h | New debug API. |
| hhss/c/debug.internals.h | New debug internals. |
| hhss/c/debug.c | New debug helpers for inspecting parsed structures. |
| hhss/c/dtdbparse.h | New dat.db / legacy hsr.dat parsing API. |
| hhss/c/dtdbparse.internals.h | New dtdb parser internals. |
| hhss/c/dtdbparse.c | New data DB parsing + sanity check + destructor. |
| hhss/c/global.h | New hhss global constants and DB path definitions. |
| hhss/c/hhss.internals.h | New internal wiring header for hhss modules. |
| hhss/c/hhss.c | Replaces monolithic implementation with modular pipeline (load → parse → replace → print). |
| hhss/c/lex.h | New lexer API. |
| hhss/c/lex.internals.h | New lexer internals. |
| hhss/c/lex.c | New lexer implementation tokenizing ${...} templates. |
| hhss/c/parse.h | New parser API (build parse trees of text/repl symbols). |
| hhss/c/parse.internals.h | New parser internals. |
| hhss/c/parse.c | New parser implementation converting token streams into symbol streams. |
| hhss/c/prelex.h | New pre-lex selection API. |
| hhss/c/prelex.internals.h | New pre-lex internals. |
| hhss/c/prelex.c | New random selection of data lines prior to lex/parse. |
| hhss/c/replace.h | New replacement API. |
| hhss/c/replace.internals.h | New replacement internals. |
| hhss/c/replace.c | New template replacement implementation using rt.db sections. |
| hhss/c/rtdbparse.h | New rt.db / legacy usr.dat parsing/querying API. |
| hhss/c/rtdbparse.internals.h | New rtdb parser internals. |
| hhss/c/rtdbparse.c | New replacement DB parser + checks + destructor. |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 69 out of 71 changed files in this pull request and generated 5 comments.
Comments suppressed due to low confidence (1)
yandere/c/Makefile:37
cleanis listed in.PHONY, but there is noclean:rule, somake -C yandere/c cleanfails. Either add acleantarget or remove it from.PHONY.
|
헤더 추가, 구조체 등 선언 추가할 때 다른 파일로 넘어가는게 번거로워서요 |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 76 out of 78 changed files in this pull request and generated 10 comments.
Comments suppressed due to low confidence (1)
lib/utils.h:10
STREQLexpands tostrcmp(...), but this header does not include<string.h>. Any translation unit that includesutils.hbut not<string.h>will get an implicitstrcmpdeclaration (or a hard error under stricter C modes).

공부안하고 며칠동안 열심히 개발했습니다요약: hhss를 중심으로 한 전면적인 재작성
*.c, 헤더파일=*.h, 소스파일에만 include되는 헤더파일=*.internals.h.adt포함되어있음lib디렉토리: 전체 프로젝트에서 공통으로 사용할 파일 모음집Makefile개선: 최상위Makefile이 하위Makefile을 재귀적으로 호출하는 방식으로 변경Makefile모듈화:vars.mk에 변수들 들어있고defs.mk에define정의 모아놨음*.d파일: 목적파일의 빌드가 소스파일뿐만 아니라 헤더파일의 변경에도 영향받도록 변경hhss
Q: 왜 재작성을 하셨나요
A: 2년전에 쓴 코드라 너무 못썼습니다. 돌아가긴 하지만 뭔가 코드가 이상함.
Q: 어떤식으로 재작성하셨나요
A:
hsr.dat,usr.dat를 한줄씩 읽어서 배열에 넣어놓은 뒤, 필요에 맞게 적절히 가공(lex, parse)하였습니다. 기존 코드는 아마도 그냥 파일 처음부터 끝까지 한글자씩 읽는 방식이라가지고 코드가 더러웠던거 같아요Q: 다른 기능은 없나요?
A: 재작성하는김에 2년전에 남겨놨던 도전과제도 클리어를 했습니다
Utils/hhss/SPECIFICATION.md
Lines 105 to 107 in e012275
Q: 그럼 이제 뭘 할수있죠?
A:
${}에 여러가지를 넣을수있습니다.rt.db는 기존의usr.dat을 대체하는 파일로, 아래와 같은 문법으로 작성합니다. (다른 구현체와의 호환성을 위해, C구현체는 rt.db를 먼저 탐색하고 없으면 usr.dat을 여는식으로 동작합니다.)[xxx]에서xxx와[]사이에는 공백이 있으면 안됩니다. (이부분에 대해 오류를 뱉지는 않습니다.)value앞에는 임의의 수의 공백이 올수있습니다. 아무튼 이 파일에 작성된 섹션명을${}에 넣을수있습니다. 그리고 해당 섹션에 속한 값들로 해당 replace template가 치환됩니다.한편,
${a|b|c}같은 식으로 여러개의 섹션명을|기호로 구분해서 작성하게 되면 a,b,c 섹션에 있는 값들중 하나로 바뀌게 됩니다.${xxx}에서,xxx와${}사이에 공백이 있으면 안됩니다.의의
좀 더 창의적인 헛소리 구성이 가능해졌습니다.
감사합니다.
근데 저 이제 진짜 코딩 그만해야될거같아요 공부 며칠째 안 함ㅋ 수능치고나서 후회할듯 그때놀지말걸 하고
관련 이슈: #55 #66
(위 두 이슈를 부분적으로 해결)