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 <jeffpc@josefsipek.net>
2 files changed, 29 insertions(+), 1 deletions(-)

M docs/lua-hlog-module.md
M xlua/scripts/cabrillo.lua
M docs/lua-hlog-module.md +13 -0
@@ 30,6 30,19 @@ the ADIF mode field (strict=false).
 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

          
M xlua/scripts/cabrillo.lua +16 -1
@@ 1,5 1,5 @@ 
 --
--- Copyright (c) 2023 Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
+-- Copyright (c) 2023-2024 Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
 --
 -- 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 @@ local function print_qso(qso, tx, rx, x)
 			    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,
 }