C Parser for the SATCAT Format.
ANSI C compliant and linkable with C++.
- SATCAT Format Documentation: https://www.celestrak.org/satcat/satcat-format.php
- SATCAT Data: https://www.celestrak.org/pub/satcat.txt
The demo program test/test.c can be compiled as follows:
cd test
gcc ../src/satcat.c ../src/satcat_code.c test.c -lm -ansi -I../src -o bin
./bin
Yielding the following output:
Parsed and Validated 52802 satellites in 0.066405s.
Found 51898 valid satellites and 904 invalid satellites.
First satellite:
Name: SL-1 R/B
Catalog Number: 1
Status: Decayed
Source: Commonwealth of Independent States (former USSR)
Launch Site: Tyuratam Missile and Space Center, Kazakhstan
By default, strings within struct SatCat are NOT NULL-terminated, and are right-padded with spaces. To enable NULL-terminated strings, define SC_CSTRING.
The SATCAT library consists of the following files:
Parses and validates SATCAT strings.
sc_parse: Parses a SATCAT-formatted string into astruct SatCatsc_validate: Validates if string is SATCAT-formatted
Provides description strings for SATCAT Operational Status, Source, and Launch Site Codes.
SC_STR5_TO_CODEmacro: converts a 5-character code (eitherchar source[5]orchar launch_site[5]instruct SatCat) into a numeric contant of typesc_code_t, equal to one ofSCSRC_*orSCSITE_*sc_source_str&sc_launch_site_str: takes asc_code_tcode and return a verbose description of the satellite's source or launch site.sc_status_str: takes an Operational Status Code (char opstatinstruct SatCat, orSCSTAT_*), and returns a description of the satellite's status.
These files can be regenerated using util/gen_code.py if the SATCAT Operational Status, Source, and Launch Site Codes are expanded.