diff options
author | Henry Stiles <henry.stiles@artifex.com> | 1999-01-04 14:40:31 +0000 |
---|---|---|
committer | Henry Stiles <henry.stiles@artifex.com> | 1999-01-04 14:40:31 +0000 |
commit | 5e530234ec5b212cc793d5fea7ffe98280600791 (patch) | |
tree | 80b16bd338312ba50bb104fc69c17d26bd167ebe | |
parent | 66248eb3a85eff502b380d14727af0491fcfff23 (diff) |
Version number and build date for PCL.
git-svn-id: http://svn.ghostscript.com/ghostpcl/trunk/ghostpcl@622 06663e23-700e-0410-b217-a244a6096597
-rw-r--r-- | pcl/pcl_top.mak | 23 | ||||
-rw-r--r-- | pcl/pcmain.c | 3 | ||||
-rw-r--r-- | pl/plmain.c | 13 | ||||
-rw-r--r-- | pl/plmain.h | 10 | ||||
-rw-r--r-- | pxl/pxmain.c | 2 |
5 files changed, 42 insertions, 9 deletions
diff --git a/pcl/pcl_top.mak b/pcl/pcl_top.mak index f0ca62fcd..5f0f09ca9 100644 --- a/pcl/pcl_top.mak +++ b/pcl/pcl_top.mak @@ -32,6 +32,28 @@ config-clean: pl.config-clean pcl.config-clean #### Main program +PCLVERSION=1.04 + +# build a temporary c program _dt_temp.c to generate the time. +$(PCLGEN)_dt_temp.c: pcl_top.mak + echo "#include <time.h>" > $(PCLGEN)_dt_temp.c + echo "#include <stdio.h>" >> $(PCLGEN)_dt_temp.c + echo "int main(int argc, char **argv)" >> $(PCLGEN)_dt_temp.c + echo "{ time_t t0; char buf[100];" >> $(PCLGEN)_dt_temp.c + echo "time(&t0);" >> $(PCLGEN)_dt_temp.c + echo "strftime(buf, sizeof buf, \"%c\", localtime(&t0));" >> $(PCLGEN)_dt_temp.c + echo "fprintf(stdout, \"#define PCLBUILDATE \\\"%s\\\"\", buf); return 0; }" >> $(PCLGEN)_dt_temp.c + +$(PCLGEN)_dt_temp: $(PCLGEN)_dt_temp.c + +$(PCLSRC)pclver.h: $(PCLGEN)_dt_temp + echo "#define PCLVERSION \"$(PCLVERSION)\"" > $(PCLSCRC)pclver.h + $(PCLGEN)_dt_temp >> $(PCLSRC)pclver.h + $(RM_) $(PCLGEN)_dt_temp.c + $(RM_) $(PCLGEN)_dt_temp + +pclver_h=$(PCLSRC)pclver.h + $(PCLOBJ)pcmain.$(OBJ): $(PCLSRC)pcmain.c \ $(AK) \ $(malloc__h) \ @@ -61,6 +83,7 @@ $(PCLOBJ)pcmain.$(OBJ): $(PCLSRC)pcmain.c \ $(gxdevice_h) \ $(gxstate_h) \ $(gdevbbox_h) \ + $(pclver_h) \ $(pjparse_h) \ $(pgmand_h) \ $(plmain_h) \ diff --git a/pcl/pcmain.c b/pcl/pcmain.c index 65e5865f8..f1e65e687 100644 --- a/pcl/pcmain.c +++ b/pcl/pcmain.c @@ -33,6 +33,7 @@ #include "gdevbbox.h" #include "pjparse.h" #include "pgmand.h" +#include "pclver.h" #include "plmain.h" /*#define BUFFER_SIZE 1024*/ /* minimum is 17 */ @@ -160,7 +161,7 @@ main( imem = ialloc_alloc_state((gs_raw_memory_t *)&gs_memory_default, 20000); imem->space = 0; /****** WRONG ******/ pl_main_init(&inst, mem); - pl_main_process_options(&inst, &args, argv, argc); + pl_main_process_options(&inst, &args, argv, argc, PCLVERSION, PCLBUILDATE); /****** SHOULD HAVE A STRUCT DESCRIPTOR ******/ pcls = (pcl_state_t *)gs_alloc_bytes( mem, sizeof(pcl_state_t), diff --git a/pl/plmain.c b/pl/plmain.c index c1416e732..dc8824612 100644 --- a/pl/plmain.c +++ b/pl/plmain.c @@ -99,7 +99,7 @@ pl_main_arg_fopen(const char *fname, void *ignore_data) #define arg_heap_copy(str) arg_copy(str, &gs_memory_default) int pl_main_process_options(pl_main_instance_t *pmi, arg_list *pal, char **argv, - int argc) + int argc, char *version, char *build_date) { gs_memory_t *mem = pmi->memory; const gx_device **dev_list; int num_devs = gs_lib_device_list((const gx_device * const **)&dev_list, NULL); @@ -254,9 +254,16 @@ out: if ( arg == 0 || help ) arg_finit(pal); gs_c_param_list_release(¶ms); fprintf(gs_stderr, pl_usage, argv[0]); + if (version) + fprintf(gs_stderr, "Version: %s\n", version); + if (build_date) + fprintf(gs_stderr, "Build date: %s\n", build_date); fputs("Devices:", gs_stderr); - for ( i = 0; i < num_devs; ++i ) - fprintf(gs_stderr, " %s", gs_devicename(dev_list[i])); + for ( i = 0; i < num_devs; ++i ) { + if ( ( (i + 1) ) % 9 == 0 ) + fputs("\n", gs_stderr); + fprintf(gs_stderr, " %s", gs_devicename(dev_list[i])); + } fputs("\n", gs_stderr); exit(1); } diff --git a/pl/plmain.h b/pl/plmain.h index fb5548387..4f1c0a88c 100644 --- a/pl/plmain.h +++ b/pl/plmain.h @@ -39,10 +39,12 @@ void pl_main_init_standard_io(void); /* Initialize the instance parameters. */ void pl_main_init(P2(pl_main_instance_t *pmi, gs_memory_t *memory)); -/* Process the options on the command line, */ -/* including making the initial device and setting its parameters. */ -int pl_main_process_options(P4(pl_main_instance_t *pmi, arg_list *pal, - char **argv, int argc)); +/* Process the options on the command line, including making the + initial device and setting its parameters. Clients can also pass + in a version number and build date that will be printed as part of + the "usage" statement */ +int pl_main_process_options(P6(pl_main_instance_t *pmi, arg_list *pal, + char **argv, int argc, char *version, char *build_date)); /* Allocate and initialize the first graphics state. */ #ifndef gs_state_DEFINED diff --git a/pxl/pxmain.c b/pxl/pxmain.c index 4e3583bd7..593105ba3 100644 --- a/pxl/pxmain.c +++ b/pxl/pxmain.c @@ -130,7 +130,7 @@ main(int argc, char *argv[]) imem = ialloc_alloc_state((gs_raw_memory_t *)&gs_memory_default, 20000); imem->space = 0; /****** WRONG ******/ pl_main_init(&inst, mem); - pl_main_process_options(&inst, &args, argv, argc); + pl_main_process_options(&inst, &args, argv, argc, NULL, NULL); pl_main_make_gstate(&inst, &pgs); st = px_process_alloc(mem); pxs = px_state_alloc(mem); |