| [421b7d2] | 1 | /* commands.h |
|---|
| [d1b1380] | 2 | * Header file for code for directives |
|---|
| [d624d86] | 3 | * Copyright (C) 1994-2024 Olly Betts |
|---|
| [846746e] | 4 | * |
|---|
| [89231c4] | 5 | * This program is free software; you can redistribute it and/or modify |
|---|
| 6 | * it under the terms of the GNU General Public License as published by |
|---|
| 7 | * the Free Software Foundation; either version 2 of the License, or |
|---|
| 8 | * (at your option) any later version. |
|---|
| [846746e] | 9 | * |
|---|
| 10 | * This program is distributed in the hope that it will be useful, |
|---|
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| [89231c4] | 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|---|
| 13 | * GNU General Public License for more details. |
|---|
| [846746e] | 14 | * |
|---|
| [89231c4] | 15 | * You should have received a copy of the GNU General Public License |
|---|
| 16 | * along with this program; if not, write to the Free Software |
|---|
| [ecbc6c18] | 17 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|---|
| [d1b1380] | 18 | */ |
|---|
| 19 | |
|---|
| [0532954] | 20 | #include "str.h" |
|---|
| 21 | |
|---|
| [725d3b1] | 22 | /* Fix station if not already fixed. |
|---|
| [98b705d] | 23 | * |
|---|
| 24 | * stn_offset gives column info - it should be the file offset (offset member |
|---|
| 25 | * of a filepos) or -1 for no column info. |
|---|
| [725d3b1] | 26 | * |
|---|
| 27 | * Returns: |
|---|
| 28 | * 0 if not already fixed |
|---|
| 29 | * 1 if already fixed at the same coordinates |
|---|
| 30 | * -1 if already fixed but at different coordinates |
|---|
| 31 | */ |
|---|
| [98b705d] | 32 | int fix_station(prefix *fix_name, const double* coords, long stn_offset); |
|---|
| [725d3b1] | 33 | |
|---|
| 34 | /* Fix station with variance. |
|---|
| 35 | * |
|---|
| 36 | * Multiple fixes for the same station are OK. |
|---|
| 37 | */ |
|---|
| [05b93bc0] | 38 | void fix_station_with_variance(prefix *fix_name, const double* coords, |
|---|
| [725d3b1] | 39 | real var_x, real var_y, real var_z, |
|---|
| 40 | #ifndef NO_COVARIANCES |
|---|
| 41 | real cxy, real cyz, real cza |
|---|
| 42 | #endif |
|---|
| 43 | ); |
|---|
| 44 | |
|---|
| [85c0078] | 45 | int get_length_units(int quantity); |
|---|
| 46 | int get_angle_units(int quantity); |
|---|
| 47 | |
|---|
| 48 | extern const real factor_tab[]; |
|---|
| 49 | extern const int units_to_msgno[]; |
|---|
| 50 | |
|---|
| 51 | #define get_units_factor(U) (factor_tab[(U)]) |
|---|
| 52 | #define get_units_string(U) (msg(units_to_msgno[(U)])) |
|---|
| 53 | |
|---|
| [a9f5117] | 54 | void handle_command(void); |
|---|
| 55 | void default_all(settings *s); |
|---|
| [d1b1380] | 56 | |
|---|
| [be97baf] | 57 | void default_units(settings *s); |
|---|
| 58 | void default_calib(settings *s); |
|---|
| 59 | |
|---|
| [da9163b] | 60 | void pop_settings(void); |
|---|
| [d624d86] | 61 | void invalidate_pj_cached(void); |
|---|
| [37d6b84] | 62 | void report_declination(settings *p); |
|---|
| [647407d] | 63 | |
|---|
| [b5a3219] | 64 | void copy_on_write_meta(settings *s); |
|---|
| 65 | |
|---|
| [0532954] | 66 | extern string token; |
|---|
| [725d3b1] | 67 | extern string uctoken; |
|---|
| [e1cbc0d] | 68 | |
|---|
| 69 | /* Read legacy token (letters only). This only exists so we can keep reading |
|---|
| 70 | * old data files which (presumably accidentally) are missing blanks between |
|---|
| 71 | * a token and a number which follows. Use get_token() in new code. |
|---|
| 72 | */ |
|---|
| 73 | void get_token_legacy(void); |
|---|
| 74 | void get_token_legacy_no_blanks(void); |
|---|
| 75 | |
|---|
| [71c9d78f] | 76 | // Issue warning if token not empty and ch not BLANK, COMM or EOL. |
|---|
| [05b9de76] | 77 | void do_legacy_token_warning(void); |
|---|
| 78 | |
|---|
| [e1cbc0d] | 79 | // Read a token, comprised of a letter followed by contiguous alphanumerics. |
|---|
| [a9f5117] | 80 | void get_token(void); |
|---|
| [f6bdb01] | 81 | void get_token_no_blanks(void); |
|---|
| [e1cbc0d] | 82 | |
|---|
| [2aa37a8] | 83 | // Read up to the next BLANK, COMM or end of line. |
|---|
| [725d3b1] | 84 | void get_word(void); |
|---|
| [d1b1380] | 85 | |
|---|
| [63c6b49] | 86 | typedef struct { const char *sz; int tok; } sztok; |
|---|
| [a9f5117] | 87 | int match_tok(const sztok *tab, int tab_size); |
|---|
| [d1b1380] | 88 | |
|---|
| [63c6b49] | 89 | #define TABSIZE(T) ((sizeof(T) / sizeof(sztok)) - 1) |
|---|
| [5d59477] | 90 | |
|---|
| 91 | void scan_compass_station_name(prefix *stn); |
|---|
| 92 | void update_output_separator(void); |
|---|