mirror of
https://github.com/cosinekitty/astronomy.git
synced 2026-05-19 06:17:03 -04:00
Separated generating planet models and generating source code.
This allows me to very quickly and easily test changes that don't affect the planet models or how code is generated.
This commit is contained in:
@@ -71,8 +71,8 @@ static short int de_number;
|
||||
|
||||
static int OpenEphem(void);
|
||||
static int PrintUsage(void);
|
||||
static int GenerateAllSource(void);
|
||||
static int FastGenerate(void);
|
||||
static int GeneratePlanets(void);
|
||||
static int GenerateSource(void);
|
||||
static int TestVsopModel(vsop_model_t *model, int body, double threshold, double *max_arcmin, int *trunc_terms);
|
||||
static int SaveVsopFile(const vsop_model_t *model);
|
||||
static int PositionArcminError(int body, double jd, const double a[3], const double b[3], double *arcmin);
|
||||
@@ -122,11 +122,11 @@ const double ErrorRadius[] =
|
||||
|
||||
int main(int argc, const char *argv[])
|
||||
{
|
||||
if (argc == 2 && !strcmp(argv[1], "all"))
|
||||
return GenerateAllSource();
|
||||
if (argc == 2 && !strcmp(argv[1], "planets"))
|
||||
return GeneratePlanets();
|
||||
|
||||
if (argc == 2 && !strcmp(argv[1], "fast"))
|
||||
return FastGenerate();
|
||||
if (argc == 2 && !strcmp(argv[1], "source"))
|
||||
return GenerateSource();
|
||||
|
||||
if (argc == 3 && !strcmp(argv[1], "check"))
|
||||
return CheckTestOutput(argv[2]);
|
||||
@@ -140,14 +140,14 @@ static int PrintUsage(void)
|
||||
"\n"
|
||||
"USAGE:\n"
|
||||
"\n"
|
||||
"generate all\n"
|
||||
" Generate astronomy source code for all target languages.\n"
|
||||
"generate planets\n"
|
||||
" Generate predictive models for all planets.\n"
|
||||
"\n"
|
||||
"generate check testfile\n"
|
||||
" Verify the calculations in the testfile generated by a unit test.\n"
|
||||
"\n"
|
||||
"generate fast\n"
|
||||
" Generate source code, re-using existing search data from 'generate all'.\n"
|
||||
"generate source\n"
|
||||
" Generate source code after running 'generate planets'.\n"
|
||||
"\n"
|
||||
);
|
||||
|
||||
@@ -383,21 +383,20 @@ static int BuildVsopData(void)
|
||||
return error;
|
||||
}
|
||||
|
||||
static int GenerateAllSource(void)
|
||||
static int GeneratePlanets(void)
|
||||
{
|
||||
int error;
|
||||
|
||||
CHECK(OpenEphem());
|
||||
CHECK(BuildVsopData());
|
||||
CHECK(ManualResample(8, 19, 7, MIN_YEAR, MAX_YEAR));
|
||||
CHECK(FastGenerate());
|
||||
|
||||
fail:
|
||||
ephem_close();
|
||||
return error;
|
||||
}
|
||||
|
||||
static int FastGenerate(void)
|
||||
static int GenerateSource(void)
|
||||
{
|
||||
return GenerateCode("../source/js/astronomy.js", "template/astronomy.js", "output");
|
||||
}
|
||||
|
||||
@@ -55,10 +55,10 @@ echo "Building C source code for 'generate' program."
|
||||
./build || Fail "Could not build 'generate' program from source."
|
||||
|
||||
echo ""
|
||||
echo "Running the target code generator."
|
||||
echo "Generating planet models."
|
||||
mkdir -pv output temp || Fail "Error creating directories."
|
||||
rm -f output/vsop_*.txt temp/*
|
||||
./generate all || Fail "Could not generate target code."
|
||||
./generate planets || Fail "Could not generate planet models."
|
||||
|
||||
./unit_test || exit $?
|
||||
|
||||
|
||||
@@ -94,7 +94,10 @@ for %%d in (output temp) do (
|
||||
)
|
||||
if exist output\vsop_*.txt (del /q output\vsop_*.txt)
|
||||
if exist temp\* (del /q temp\*)
|
||||
!GENEXE! all
|
||||
!GENEXE! planets
|
||||
if errorlevel 1 (exit /b 1)
|
||||
|
||||
!GENEXE! source
|
||||
if errorlevel 1 (exit /b 1)
|
||||
|
||||
echo.
|
||||
|
||||
@@ -5,6 +5,10 @@ Fail()
|
||||
exit 1
|
||||
}
|
||||
|
||||
echo ""
|
||||
echo "Generating target code."
|
||||
./generate source || Fail "Problem generating target code."
|
||||
|
||||
echo ""
|
||||
echo "Running astro_check."
|
||||
node astro_check.js > temp/check.txt || Fail "Problem running JavaScript unit test."
|
||||
|
||||
Reference in New Issue
Block a user