Update documentation, clean up

This commit is contained in:
Přemysl Eric Janouch 2022-09-26 12:39:26 +02:00
parent f891e5ca63
commit 5863040f93
Signed by: p
GPG Key ID: A0420B94F92B9493
10 changed files with 41 additions and 17 deletions

2
NEWS
View File

@ -29,6 +29,8 @@
* Added a web frontend for xC called xP * Added a web frontend for xC called xP
* Added a Go port of xD called xS
1.5.0 (2021-12-21) "The Show Must Go On" 1.5.0 (2021-12-21) "The Show Must Go On"

View File

@ -47,8 +47,9 @@ What it notably doesn't support is online changes to configuration, any limits
besides the total number of connections and mode `+l`, or server linking besides the total number of connections and mode `+l`, or server linking
(which also means no services). (which also means no services).
This program has been https://git.janouch.name/p/haven/src/branch/master/hid[ xS
ported to Go] in a different project, and development continues over there. --
The IRC daemon again, this time ported to Go, additionally supporting WEBIRC.
xB xB
-- --

View File

@ -2,14 +2,14 @@
BEGIN { BEGIN {
# The message catalog is a by-product # The message catalog is a by-product
msg = "xD.msg" msg = "xD.msg"
print "$quote \"" > msg; print "$quote \"" > msg
print "$set 1" > msg; print "$set 1" > msg
} }
/^[0-9]+ *IRC_(ERR|RPL)_[A-Z]+ *".*"$/ { /^[0-9]+ *IRC_(ERR|RPL)_[A-Z]+ *".*"$/ {
match($0, /".*"/); match($0, /".*"/)
ids[$1] = $2; ids[$1] = $2
texts[$2] = substr($0, RSTART, RLENGTH); texts[$2] = substr($0, RSTART, RLENGTH)
print $1 " " texts[$2] > msg print $1 " " texts[$2] > msg
} }

View File

@ -1,5 +1,6 @@
.POSIX: .POSIX:
.SUFFIXES: .SUFFIXES:
AWK = env LC_ALL=C awk
outputs = xP proto.go public/proto.js public/mithril.js outputs = xP proto.go public/proto.js public/mithril.js
all: $(outputs) public/ircfmt.woff2 all: $(outputs) public/ircfmt.woff2
@ -7,11 +8,11 @@ all: $(outputs) public/ircfmt.woff2
xP: xP.go proto.go xP: xP.go proto.go
go build -o $@ go build -o $@
proto.go: ../xC-gen-proto.awk ../xC-gen-proto-go.awk ../xC-proto proto.go: ../xC-gen-proto.awk ../xC-gen-proto-go.awk ../xC-proto
awk -f ../xC-gen-proto.awk -f ../xC-gen-proto-go.awk ../xC-proto > $@ $(AWK) -f ../xC-gen-proto.awk -f ../xC-gen-proto-go.awk ../xC-proto > $@
public/proto.js: ../xC-gen-proto.awk ../xC-gen-proto-js.awk ../xC-proto public/proto.js: ../xC-gen-proto.awk ../xC-gen-proto-js.awk ../xC-proto
awk -f ../xC-gen-proto.awk -f ../xC-gen-proto-js.awk ../xC-proto > $@ $(AWK) -f ../xC-gen-proto.awk -f ../xC-gen-proto-js.awk ../xC-proto > $@
public/ircfmt.woff2: gen-ircfmt.awk public/ircfmt.woff2: gen-ircfmt.awk
awk -v Output=$@ -f gen-ircfmt.awk $(AWK) -v Output=$@ -f gen-ircfmt.awk
public/mithril.js: public/mithril.js:
curl -Lo $@ https://unpkg.com/mithril/mithril.js curl -Lo $@ https://unpkg.com/mithril/mithril.js
clean: clean:

2
xS/.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
/xS
/xS-replies.go

13
xS/Makefile Normal file
View File

@ -0,0 +1,13 @@
.POSIX:
.SUFFIXES:
AWK = env LC_ALL=C awk
outputs = xS xS-replies.go
all: $(outputs)
xS: xS.go xS-replies.go
go build -o $@
xS-replies.go: xS-gen-replies.awk xS-replies
$(AWK) -f xS-gen-replies.awk xS-replies > $@
clean:
rm -f $(outputs)

3
xS/go.mod Normal file
View File

@ -0,0 +1,3 @@
module janouch.name/xK/xS
go 1.19

View File

@ -1,15 +1,19 @@
#!/usr/bin/awk -f #!/usr/bin/awk -f
/^[0-9]+ *(ERR|RPL)_[A-Z]+ *".*"$/ { /^[0-9]+ *(ERR|RPL)_[A-Z]+ *".*"$/ {
match($0, /".*"/); match($0, /".*"/)
ids[$1] = $2; ids[$1] = $2
texts[$2] = substr($0, RSTART, RLENGTH); texts[$2] = substr($0, RSTART, RLENGTH)
} }
END { END {
print "package " ENVIRON["GOPACKAGE"] "\n\nconst (" print "package main"
print ""
print "const ("
for (i in ids) for (i in ids)
printf("\t%s = %s\n", ids[i], i) printf("\t%s = %s\n", ids[i], i)
print ")\n\nvar defaultReplies = map[int]string{" print ")"
print ""
print "var defaultReplies = map[int]string{"
for (i in ids) for (i in ids)
print "\t" ids[i] ": " texts[ids[i]] "," print "\t" ids[i] ": " texts[ids[i]] ","
print "}" print "}"

View File

@ -460,8 +460,6 @@ func (fd *floodDetector) check() bool {
// --- IRC protocol ------------------------------------------------------------ // --- IRC protocol ------------------------------------------------------------
//go:generate sh -c "LC_ALL=C awk -f xS-gen-replies.awk > xS-replies.go < xS-replies"
func ircToLower(c byte) byte { func ircToLower(c byte) byte {
switch c { switch c {
case '[': case '[':