# HG changeset patch # User Josef 'Jeff' Sipek # Date 1688172455 14400 # Fri Jun 30 20:47:35 2023 -0400 # Node ID e31b1300d4dfbfb9ea08fda96dc93a395c5488d7 # Parent 95b0a1cb0ec7de9540b71c31e7b71e7e52ab0db7 common: add ARRL/RAC section to qso_side Signed-off-by: Josef 'Jeff' Sipek diff --git a/common/adif.c b/common/adif.c --- a/common/adif.c +++ b/common/adif.c @@ -111,6 +111,7 @@ { "my_itu_zone", "ituz", qso_get_zone_itu }, { "my_cq_zone", "cqz", qso_get_zone_cqz }, { "stx", "srx", qso_get_seq }, + { "my_arrl_sect", "arrl_sect", qso_get_section_val }, }; static const struct side_field strict_mode_fields[] = { diff --git a/common/include/hlog/qso.h b/common/include/hlog/qso.h --- a/common/include/hlog/qso.h +++ b/common/include/hlog/qso.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020-2021 Josef 'Jeff' Sipek + * Copyright (c) 2020-2021,2023 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 @@ -52,6 +52,7 @@ struct val *itu; struct val *cqz; struct val *seq; /* contest qso seq # */ + struct val *section; /* ARRL/RAC section name */ }; struct qso { @@ -144,6 +145,9 @@ extern int qso_set_seq(struct qso_side *side, uint64_t seq); extern int qso_set_seq_user(struct qso_side *side, const char *seq); extern int qso_set_seq_val(struct qso_side *side, struct val *val); +extern int qso_set_section(struct qso_side *side, const char *section); +extern int qso_set_section_str(struct qso_side *side, struct str *section); +extern int qso_set_section_val(struct qso_side *side, struct val *val); /* * Clear the various parts of a QSO. @@ -171,6 +175,7 @@ extern void qso_clear_zone_itu(struct qso_side *side); extern void qso_clear_zone_cqz(struct qso_side *side); extern void qso_clear_seq(struct qso_side *side); +extern void qso_clear_section(struct qso_side *side); /* * Get the various parts of a QSO. @@ -211,5 +216,7 @@ extern struct val *qso_get_zone_itu(const struct qso_side *side); extern struct val *qso_get_zone_cqz(const struct qso_side *side); extern struct val *qso_get_seq(const struct qso_side *side); +extern struct str *qso_get_section(const struct qso_side *side); +extern struct val *qso_get_section_val(const struct qso_side *side); #endif diff --git a/common/qso-pack.c b/common/qso-pack.c --- a/common/qso-pack.c +++ b/common/qso-pack.c @@ -57,6 +57,7 @@ { "itu", 0, qso_get_zone_itu, qso_set_zone_itu_val }, { "cqz", 0, qso_get_zone_cqz, qso_set_zone_cqz_val }, { "seq", 0, qso_get_seq, qso_set_seq_val }, + { "section", 1, qso_get_section_val, qso_set_section_val }, }; /* diff --git a/common/qso.c b/common/qso.c --- a/common/qso.c +++ b/common/qso.c @@ -69,6 +69,7 @@ val_putref(side->itu); val_putref(side->cqz); val_putref(side->seq); + val_putref(side->section); } void qso_free(struct qso *qso) @@ -142,6 +143,7 @@ qso_clear_zone_itu(side); qso_clear_zone_cqz(side); qso_clear_seq(side); + qso_clear_section(side); } void qso_reset(struct qso *qso) @@ -183,6 +185,7 @@ dst->itu = val_getref(src->itu); dst->cqz = val_getref(src->cqz); dst->seq = val_getref(src->seq); + dst->section = val_getref(src->section); } void qso_copy(struct qso *dst, struct qso *src) @@ -825,6 +828,11 @@ GEN_GSC(seq, seq, VT_INT); GEN_ALIAS(seq) +/* section */ +GEN_GSC(section, section, VT_STR); +GET_STR(section, section); +SET_STR(section, section); + /* band - derived from freq, no set/clear */ struct val *qso_get_band(const struct qso_side *side) { diff --git a/xlua/qso.c b/xlua/qso.c --- a/xlua/qso.c +++ b/xlua/qso.c @@ -123,6 +123,9 @@ qso_clear_zone_cqz } }, { "seq", T_SIDE, .side = { qso_get_seq, qso_set_seq_user, qso_clear_seq } }, + { "section", T_SIDE, + .side = { qso_get_section_val, qso_set_section, + qso_clear_section } }, }; struct field qso_fields[] = {