Skip to content

feat: a brand new hhss!#70

Merged
logic-finder merged 59 commits into
mainfrom
feat/rewrite-hhss
Jun 11, 2026
Merged

feat: a brand new hhss!#70
logic-finder merged 59 commits into
mainfrom
feat/rewrite-hhss

Conversation

@logic-finder

@logic-finder logic-finder commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

공부안하고 며칠동안 열심히 개발했습니다

요약: hhss를 중심으로 한 전면적인 재작성

  • 모듈화: 기능별로 별도 파일에 작성
  • 파일 구성: 소스파일=*.c, 헤더파일=*.h, 소스파일에만 include되는 헤더파일=*.internals.h
  • 추상자료구조: 파일명에 .adt 포함되어있음
  • lib 디렉토리: 전체 프로젝트에서 공통으로 사용할 파일 모음집
  • Makefile 개선: 최상위 Makefile이 하위 Makefile을 재귀적으로 호출하는 방식으로 변경
  • Makefile 모듈화: vars.mk 에 변수들 들어있고 defs.mkdefine 정의 모아놨음
  • *.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

## Further Research
- It would be nice to support other replacement templates in addition to the current ${user}.

Q: 그럼 이제 뭘 할수있죠?
A: ${} 에 여러가지를 넣을수있습니다. rt.db 는 기존의 usr.dat 을 대체하는 파일로, 아래와 같은 문법으로 작성합니다. (다른 구현체와의 호환성을 위해, C구현체는 rt.db를 먼저 탐색하고 없으면 usr.dat을 여는식으로 동작합니다.)

[section_name_1]
value1
value2
[section_name_2]
...

[xxx] 에서 xxx[] 사이에는 공백이 있으면 안됩니다. (이부분에 대해 오류를 뱉지는 않습니다.) value 앞에는 임의의 수의 공백이 올수있습니다. 아무튼 이 파일에 작성된 섹션명을 ${}에 넣을수있습니다. 그리고 해당 섹션에 속한 값들로 해당 replace template가 치환됩니다.

한편, ${a|b|c} 같은 식으로 여러개의 섹션명을 | 기호로 구분해서 작성하게 되면 a,b,c 섹션에 있는 값들중 하나로 바뀌게 됩니다.

${xxx} 에서, xxx${} 사이에 공백이 있으면 안됩니다.

의의

좀 더 창의적인 헛소리 구성이 가능해졌습니다.
감사합니다.
근데 저 이제 진짜 코딩 그만해야될거같아요 공부 며칠째 안 함ㅋ 수능치고나서 후회할듯 그때놀지말걸 하고


관련 이슈: #55 #66
(위 두 이슈를 부분적으로 해결)

@logic-finder logic-finder requested a review from lshqqytiger June 8, 2026 16:46
@logic-finder logic-finder self-assigned this Jun 8, 2026
@logic-finder logic-finder added the enhancement New feature or request label Jun 8, 2026
@logic-finder

Copy link
Copy Markdown
Contributor Author

파일수 뻥튀기돼서 이제 빌드할때 콘솔에 찍히는거 많아져서 빌드시간 오래걸려서 뭔가개쩌는 프로그램을 만든거같은 기분느낄수있음 ㅋ

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 hhss C implementation into modular components and added rt.db/dat.db support with fallback to legacy usr.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.

Comment thread common/strutils.c Outdated
Comment thread lib/array.adt.c
Comment thread lib/array.adt.c
Comment thread hhss/c/parse.c
Comment thread hhss/c/dbload.c
Comment thread lib/fatal.h
Comment thread hhss/c/rtdbparse.c
Comment thread hhss/c/rtdbparse.c
Comment thread Makefile Outdated

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

  • clean is listed in .PHONY, but there is no clean: rule, so make -C yandere/c clean fails. Either add a clean target or remove it from .PHONY.

Comment thread hhss/c/dbload.c
Comment thread hhss/c/dtdbparse.c Outdated
Comment thread hhss/c/rtdbparse.c Outdated
Comment thread hhss/c/rtdbparse.c Outdated
Comment thread hhss/c/parse.c Outdated
@lshqqytiger

Copy link
Copy Markdown
Contributor

헤더 추가, 구조체 등 선언 추가할 때 다른 파일로 넘어가는게 번거로워서요
컨벤션이니까 통일성만 있으면 상관 없긴 합니다

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

  • STREQL expands to strcmp(...), but this header does not include <string.h>. Any translation unit that includes utils.h but not <string.h> will get an implicit strcmp declaration (or a hard error under stricter C modes).

Comment thread lib/strutils.c
Comment thread hhss/c/lex.c
Comment thread hhss/c/parse.c
Comment thread hhss/c/parse.c
Comment thread hhss/c/parse.c Outdated
Comment thread hhss/c/parse.c Outdated
Comment thread hhss/c/parse.c Outdated
Comment thread hhss/c/dtdbparse.c
Comment thread yandere/c/Makefile Outdated
Comment thread hhss/c/Makefile Outdated
@logic-finder

Copy link
Copy Markdown
Contributor Author
image

끄앙⋯! 아리스는 HP가 0이 되어버린 것입니다!!

Comment thread hhss/c/parse.c Outdated
Comment thread hhss/c/rtdbparse.c Outdated
Comment thread hhss/c/rtdbparse.c Outdated
@logic-finder logic-finder merged commit 279da49 into main Jun 11, 2026
6 checks passed
@github-project-automation github-project-automation Bot moved this to Done in Utils Jun 11, 2026
@logic-finder logic-finder deleted the feat/rewrite-hhss branch June 11, 2026 10:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants