# HG changeset patch # User Josef 'Jeff' Sipek # Date 1727288973 14400 # Wed Sep 25 14:29:33 2024 -0400 # Node ID 1f84d3e4b15d49242ddd2eb4ebe410333ce50528 # Parent a74adc418fc1c82172ee8b28b028deb60b7f1a42 xlua: add cabrillo print_header stub & print_footer The header should have way more, but this is the sane minimum. Signed-off-by: Josef 'Jeff' Sipek diff --git a/docs/lua-hlog-module.md b/docs/lua-hlog-module.md --- a/docs/lua-hlog-module.md +++ b/docs/lua-hlog-module.md @@ -30,6 +30,19 @@ hlog.cabrillo ------------- +### `print_footer()` +Prints a cabrillo footer. + +### `print_header(contest, station_call, ops, score)` +Prints a minimal cabrillo header. It consists of: + +* `CONTEST` - the contest id; taken from the `contest` argument +* `CALLSIGN` - the callsign used in the contest; taken from `station_call` + argument +* `OPERATORS` - the list of operators at the station; taken from the `ops` + array argument +* `CLAIMED-SCORE` - the calculated score; taken from the `score` argument + ### `print_qso(qso, tx, rx, x)` Prints a qso line in cabrillo format to stdout. The frequency, the mode, the (start) time, and the two station callsigns are taken from the qso diff --git a/xlua/scripts/cabrillo.lua b/xlua/scripts/cabrillo.lua --- a/xlua/scripts/cabrillo.lua +++ b/xlua/scripts/cabrillo.lua @@ -1,5 +1,5 @@ -- --- Copyright (c) 2023 Josef 'Jeff' Sipek +-- Copyright (c) 2023-2024 Josef 'Jeff' Sipek -- -- Permission is hereby granted, free of charge, to any person obtaining a copy -- of this software and associated documentation files (the "Software"), to deal @@ -55,6 +55,21 @@ qso.rx.station_call, rx)) end +local function print_header(contest, station_call, ops, score) + print("START-OF-LOG: 3.0") + print("CONTEST: " .. contest) + print("CALLSIGN: " .. station_call) + print("OPERATORS: " .. hlog.utils.join_ipairs(ops, ",")) + print("CLAIMED-SCORE: " .. score) + print("CREATED-BY: hlog " .. hlog.version) +end + +local function print_footer() + print("END-OF-LOG:") +end + return { print_qso = print_qso, + print_header = print_header, + print_footer = print_footer, }