From fa756339d4204bff7f2820067f58214d32780d17 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Frings-F=C3=BCrst?= Date: Tue, 29 Sep 2015 22:17:28 +0200 Subject: Imported Upstream version 1.8.2 --- spectro/IntsLib_Readme.txt | 0 spectro/Jamfile | 0 spectro/License.txt | 0 spectro/License2.txt | 0 spectro/License3.txt | 0 spectro/LzmaDec.c | 0 spectro/LzmaDec.h | 0 spectro/LzmaTypes.h | 0 spectro/Makefile.OSX | 0 spectro/Makefile.SA | 0 spectro/Makefile.UNIX | 0 spectro/Makefile.WNT | 0 spectro/Readme.txt | 0 spectro/SOtele.sp | 0 spectro/afiles | 0 spectro/aglob.c | 0 spectro/aglob.h | 0 spectro/average.c | 0 spectro/base64.c | 0 spectro/base64.h | 0 spectro/ccwin.c | 0 spectro/ccwin.h | 0 spectro/ccxx.ti1 | 0 spectro/ccxxmake.c | 0 spectro/chartread.c | 0 spectro/colorhug.c | 0 spectro/colorhug.h | 0 spectro/conv.c | 5 +- spectro/conv.h | 0 spectro/cubecal.h | 0 spectro/dispcal.c | 0 spectro/dispread.c | 0 spectro/dispsup.c | 0 spectro/dispsup.h | 0 spectro/disptechs.c | 109 +++++++++++++++++------------- spectro/disptechs.h | 3 +- spectro/dispwin.c | 0 spectro/dispwin.h | 0 spectro/dtp20.c | 0 spectro/dtp20.h | 0 spectro/dtp22.c | 0 spectro/dtp22.h | 0 spectro/dtp41.c | 0 spectro/dtp41.h | 0 spectro/dtp51.c | 0 spectro/dtp51.h | 0 spectro/dtp92.c | 0 spectro/dtp92.h | 0 spectro/ex1.c | 0 spectro/ex1.h | 0 spectro/fakeread.c | 0 spectro/hcfr.c | 0 spectro/hcfr.h | 0 spectro/hidio.c | 0 spectro/hidio.h | 0 spectro/huey.c | 0 spectro/huey.h | 0 spectro/i1d3.c | 0 spectro/i1d3.h | 0 spectro/i1disp.c | 0 spectro/i1disp.h | 0 spectro/i1pro.c | 0 spectro/i1pro.h | 0 spectro/i1pro_imp.c | 0 spectro/i1pro_imp.h | 0 spectro/icoms.c | 0 spectro/icoms.h | 0 spectro/icoms_nt.c | 0 spectro/icoms_ux.c | 0 spectro/ifiles | 0 spectro/illumread.c | 0 spectro/inflate.c | 0 spectro/inst.c | 43 ++++++++++-- spectro/inst.h | 1 + spectro/instappsup.c | 0 spectro/instappsup.h | 0 spectro/instlib.ksh | 0 spectro/instlib.txt | 0 spectro/insttypeinst.h | 0 spectro/insttypes.c | 0 spectro/insttypes.h | 0 spectro/iusb.h | 0 spectro/kleink10.c | 0 spectro/kleink10.h | 0 spectro/linear.cal | 2 +- spectro/linear.sp | 0 spectro/madvrwin.c | 0 spectro/madvrwin.h | 0 spectro/mongoose.c | 0 spectro/mongoose.h | 0 spectro/munki.c | 0 spectro/munki.h | 0 spectro/munki_imp.c | 0 spectro/munki_imp.h | 0 spectro/oemarch.c | 0 spectro/oemarch.h | 0 spectro/oeminst.c | 0 spectro/pollem.c | 0 spectro/pollem.h | 0 spectro/rspec.c | 0 spectro/rspec.h | 0 spectro/smcube.c | 0 spectro/smcube.h | 0 spectro/spec2cie.c | 163 +++++++++++++++++++++++---------------------- spectro/specbos.c | 0 spectro/specbos.h | 0 spectro/spotread.c | 0 spectro/spyd2.c | 0 spectro/spyd2.h | 0 spectro/ss.c | 0 spectro/ss.h | 0 spectro/ss_imp.c | 0 spectro/ss_imp.h | 0 spectro/strange.cal | 2 +- spectro/synthcal.c | 0 spectro/synthread.c | 0 spectro/usbio.c | 0 spectro/usbio.h | 0 spectro/usbio_bsd.c | 0 spectro/usbio_lx.c | 0 spectro/usbio_nt.c | 0 spectro/usbio_ox.c | 0 spectro/vinflate.c | 0 spectro/webwin.c | 0 spectro/webwin.h | 0 spectro/xdg_bds.c | 0 spectro/xdg_bds.h | 0 127 files changed, 189 insertions(+), 139 deletions(-) mode change 100755 => 100644 spectro/IntsLib_Readme.txt mode change 100755 => 100644 spectro/Jamfile mode change 100755 => 100644 spectro/License.txt mode change 100755 => 100644 spectro/License2.txt mode change 100755 => 100644 spectro/License3.txt mode change 100755 => 100644 spectro/LzmaDec.c mode change 100755 => 100644 spectro/LzmaDec.h mode change 100755 => 100644 spectro/LzmaTypes.h mode change 100755 => 100644 spectro/Makefile.OSX mode change 100755 => 100644 spectro/Makefile.SA mode change 100755 => 100644 spectro/Makefile.UNIX mode change 100755 => 100644 spectro/Makefile.WNT mode change 100755 => 100644 spectro/Readme.txt mode change 100755 => 100644 spectro/SOtele.sp mode change 100755 => 100644 spectro/afiles mode change 100755 => 100644 spectro/aglob.c mode change 100755 => 100644 spectro/aglob.h mode change 100755 => 100644 spectro/average.c mode change 100755 => 100644 spectro/base64.c mode change 100755 => 100644 spectro/base64.h mode change 100755 => 100644 spectro/ccwin.c mode change 100755 => 100644 spectro/ccwin.h mode change 100755 => 100644 spectro/ccxx.ti1 mode change 100755 => 100644 spectro/ccxxmake.c mode change 100755 => 100644 spectro/chartread.c mode change 100755 => 100644 spectro/colorhug.c mode change 100755 => 100644 spectro/colorhug.h mode change 100755 => 100644 spectro/conv.c mode change 100755 => 100644 spectro/conv.h mode change 100755 => 100644 spectro/cubecal.h mode change 100755 => 100644 spectro/dispcal.c mode change 100755 => 100644 spectro/dispread.c mode change 100755 => 100644 spectro/dispsup.c mode change 100755 => 100644 spectro/dispsup.h mode change 100755 => 100644 spectro/disptechs.c mode change 100755 => 100644 spectro/disptechs.h mode change 100755 => 100644 spectro/dispwin.c mode change 100755 => 100644 spectro/dispwin.h mode change 100755 => 100644 spectro/dtp20.c mode change 100755 => 100644 spectro/dtp20.h mode change 100755 => 100644 spectro/dtp22.c mode change 100755 => 100644 spectro/dtp22.h mode change 100755 => 100644 spectro/dtp41.c mode change 100755 => 100644 spectro/dtp41.h mode change 100755 => 100644 spectro/dtp51.c mode change 100755 => 100644 spectro/dtp51.h mode change 100755 => 100644 spectro/dtp92.c mode change 100755 => 100644 spectro/dtp92.h mode change 100755 => 100644 spectro/ex1.c mode change 100755 => 100644 spectro/ex1.h mode change 100755 => 100644 spectro/fakeread.c mode change 100755 => 100644 spectro/hcfr.c mode change 100755 => 100644 spectro/hcfr.h mode change 100755 => 100644 spectro/hidio.c mode change 100755 => 100644 spectro/hidio.h mode change 100755 => 100644 spectro/huey.c mode change 100755 => 100644 spectro/huey.h mode change 100755 => 100644 spectro/i1d3.c mode change 100755 => 100644 spectro/i1d3.h mode change 100755 => 100644 spectro/i1disp.c mode change 100755 => 100644 spectro/i1disp.h mode change 100755 => 100644 spectro/i1pro.c mode change 100755 => 100644 spectro/i1pro.h mode change 100755 => 100644 spectro/i1pro_imp.c mode change 100755 => 100644 spectro/i1pro_imp.h mode change 100755 => 100644 spectro/icoms.c mode change 100755 => 100644 spectro/icoms.h mode change 100755 => 100644 spectro/icoms_nt.c mode change 100755 => 100644 spectro/icoms_ux.c mode change 100755 => 100644 spectro/ifiles mode change 100755 => 100644 spectro/illumread.c mode change 100755 => 100644 spectro/inflate.c mode change 100755 => 100644 spectro/inst.c mode change 100755 => 100644 spectro/inst.h mode change 100755 => 100644 spectro/instappsup.c mode change 100755 => 100644 spectro/instappsup.h mode change 100755 => 100644 spectro/instlib.ksh mode change 100755 => 100644 spectro/instlib.txt mode change 100755 => 100644 spectro/insttypeinst.h mode change 100755 => 100644 spectro/insttypes.c mode change 100755 => 100644 spectro/insttypes.h mode change 100755 => 100644 spectro/iusb.h mode change 100755 => 100644 spectro/kleink10.c mode change 100755 => 100644 spectro/kleink10.h mode change 100755 => 100644 spectro/linear.cal mode change 100755 => 100644 spectro/linear.sp mode change 100755 => 100644 spectro/madvrwin.c mode change 100755 => 100644 spectro/madvrwin.h mode change 100755 => 100644 spectro/mongoose.c mode change 100755 => 100644 spectro/mongoose.h mode change 100755 => 100644 spectro/munki.c mode change 100755 => 100644 spectro/munki.h mode change 100755 => 100644 spectro/munki_imp.c mode change 100755 => 100644 spectro/munki_imp.h mode change 100755 => 100644 spectro/oemarch.c mode change 100755 => 100644 spectro/oemarch.h mode change 100755 => 100644 spectro/oeminst.c mode change 100755 => 100644 spectro/pollem.c mode change 100755 => 100644 spectro/pollem.h mode change 100755 => 100644 spectro/rspec.c mode change 100755 => 100644 spectro/rspec.h mode change 100755 => 100644 spectro/smcube.c mode change 100755 => 100644 spectro/smcube.h mode change 100755 => 100644 spectro/spec2cie.c mode change 100755 => 100644 spectro/specbos.c mode change 100755 => 100644 spectro/specbos.h mode change 100755 => 100644 spectro/spotread.c mode change 100755 => 100644 spectro/spyd2.c mode change 100755 => 100644 spectro/spyd2.h mode change 100755 => 100644 spectro/ss.c mode change 100755 => 100644 spectro/ss.h mode change 100755 => 100644 spectro/ss_imp.c mode change 100755 => 100644 spectro/ss_imp.h mode change 100755 => 100644 spectro/strange.cal mode change 100755 => 100644 spectro/synthcal.c mode change 100755 => 100644 spectro/synthread.c mode change 100755 => 100644 spectro/usbio.c mode change 100755 => 100644 spectro/usbio.h mode change 100755 => 100644 spectro/usbio_bsd.c mode change 100755 => 100644 spectro/usbio_lx.c mode change 100755 => 100644 spectro/usbio_nt.c mode change 100755 => 100644 spectro/usbio_ox.c mode change 100755 => 100644 spectro/vinflate.c mode change 100755 => 100644 spectro/webwin.c mode change 100755 => 100644 spectro/webwin.h mode change 100755 => 100644 spectro/xdg_bds.c mode change 100755 => 100644 spectro/xdg_bds.h (limited to 'spectro') diff --git a/spectro/IntsLib_Readme.txt b/spectro/IntsLib_Readme.txt old mode 100755 new mode 100644 diff --git a/spectro/Jamfile b/spectro/Jamfile old mode 100755 new mode 100644 diff --git a/spectro/License.txt b/spectro/License.txt old mode 100755 new mode 100644 diff --git a/spectro/License2.txt b/spectro/License2.txt old mode 100755 new mode 100644 diff --git a/spectro/License3.txt b/spectro/License3.txt old mode 100755 new mode 100644 diff --git a/spectro/LzmaDec.c b/spectro/LzmaDec.c old mode 100755 new mode 100644 diff --git a/spectro/LzmaDec.h b/spectro/LzmaDec.h old mode 100755 new mode 100644 diff --git a/spectro/LzmaTypes.h b/spectro/LzmaTypes.h old mode 100755 new mode 100644 diff --git a/spectro/Makefile.OSX b/spectro/Makefile.OSX old mode 100755 new mode 100644 diff --git a/spectro/Makefile.SA b/spectro/Makefile.SA old mode 100755 new mode 100644 diff --git a/spectro/Makefile.UNIX b/spectro/Makefile.UNIX old mode 100755 new mode 100644 diff --git a/spectro/Makefile.WNT b/spectro/Makefile.WNT old mode 100755 new mode 100644 diff --git a/spectro/Readme.txt b/spectro/Readme.txt old mode 100755 new mode 100644 diff --git a/spectro/SOtele.sp b/spectro/SOtele.sp old mode 100755 new mode 100644 diff --git a/spectro/afiles b/spectro/afiles old mode 100755 new mode 100644 diff --git a/spectro/aglob.c b/spectro/aglob.c old mode 100755 new mode 100644 diff --git a/spectro/aglob.h b/spectro/aglob.h old mode 100755 new mode 100644 diff --git a/spectro/average.c b/spectro/average.c old mode 100755 new mode 100644 diff --git a/spectro/base64.c b/spectro/base64.c old mode 100755 new mode 100644 diff --git a/spectro/base64.h b/spectro/base64.h old mode 100755 new mode 100644 diff --git a/spectro/ccwin.c b/spectro/ccwin.c old mode 100755 new mode 100644 diff --git a/spectro/ccwin.h b/spectro/ccwin.h old mode 100755 new mode 100644 diff --git a/spectro/ccxx.ti1 b/spectro/ccxx.ti1 old mode 100755 new mode 100644 diff --git a/spectro/ccxxmake.c b/spectro/ccxxmake.c old mode 100755 new mode 100644 diff --git a/spectro/chartread.c b/spectro/chartread.c old mode 100755 new mode 100644 diff --git a/spectro/colorhug.c b/spectro/colorhug.c old mode 100755 new mode 100644 diff --git a/spectro/colorhug.h b/spectro/colorhug.h old mode 100755 new mode 100644 diff --git a/spectro/conv.c b/spectro/conv.c old mode 100755 new mode 100644 index 1f4d102..1a8c78b --- a/spectro/conv.c +++ b/spectro/conv.c @@ -130,11 +130,11 @@ int next_con_char(void) { return c; } -/* Horrible hack to poll stdin when we're not interactive */ +/* Horrible hack to poll stdin when we're not interactive. */ /* This has the drawback that the char and returm must be */ /* written in one operation for the character to be recognised - */ /* trying to do this manually typically doesn't work unless you are */ -/* very fast an lucky. */ +/* very fast and lucky. */ static int th_read_char(void *pp) { char *rp = (char *)pp; HANDLE stdinh; @@ -166,6 +166,7 @@ int poll_con_char(void) { /* any of MSWin's async file read functions, because we */ /* have no way of ensuring that the STD_INPUT_HANDLE has been */ /* opened with FILE_FLAG_OVERLAPPED. Used a thread instead... */ + /* ReOpenFile() would fix this, but it's not available in WinXP, only Visa+ :-( */ if ((getch_thread = new_athread(th_read_char, &c)) != NULL) { HANDLE stdinh; diff --git a/spectro/conv.h b/spectro/conv.h old mode 100755 new mode 100644 diff --git a/spectro/cubecal.h b/spectro/cubecal.h old mode 100755 new mode 100644 diff --git a/spectro/dispcal.c b/spectro/dispcal.c old mode 100755 new mode 100644 diff --git a/spectro/dispread.c b/spectro/dispread.c old mode 100755 new mode 100644 diff --git a/spectro/dispsup.c b/spectro/dispsup.c old mode 100755 new mode 100644 diff --git a/spectro/dispsup.h b/spectro/dispsup.h old mode 100755 new mode 100644 diff --git a/spectro/disptechs.c b/spectro/disptechs.c old mode 100755 new mode 100644 index d44519c..70e150f --- a/spectro/disptechs.c +++ b/spectro/disptechs.c @@ -56,7 +56,7 @@ /* We deliberately duplicate the selection characters, */ /* because it's not usual to offer the whole list, just */ -/* a sub-set, which may not clash. */ +/* a sub-set which may not clash. */ /* disptechs_set_sel() should be used to present */ /* unique selectors. */ static disptech_info disptech_info_array[] = { @@ -387,52 +387,72 @@ disptech_info *disptech_get_strid(char *strid) { so we need to do three passes through all the selections. */ -/* Set the selection characters. */ -/* Return NZ if we have not set all selectors */ -/* If a selector is set, its index will be set in usels[], */ -/* and any remaining selection characters deleted. */ -/* If flag == 0, set from just first suggested selector */ -/* If flag == 1, set from just suggested selector */ +/* Append the selection characters. */ +/* If a selector is set, its index will be set in usels[]. */ +/* Remove any used selectors from isel[]. */ +/* If flag == 0, set from just first suggested selector. */ +/* If flag == 1, set from just suggested selectors. */ /* If flag == 2, set from suggested and fallback selectors */ -/* If flag == 3, set from suggested and fallback selectors, and set unset to nul */ -int disptechs_set_sel( +/* If flag == 3, append from suggested selectors */ +void disptechs_set_sel( int flag, /* See above */ int ix, /* Index of entry being set */ - char *sel, /* Pointer to string list of suggested selectors, */ - /* return a single unique selector in string. */ + char *osel, /* Append unique selectors to this string. */ + char *isel, /* Pointer to string list of suggested selectors, */ char *usels, /* char[256] initially -1, to track used selector entry index */ int *k, /* Index of next available selector in asels */ char *asels /* String list of fallback selectors to choose from, in order. */ ) { - char *d, *s, i; + char *iisel = isel, i; -//a1logd(g_log, 1,"disptechs_set_sel: flag %d, ix %d, sel '%s', k %d\n",flag, ix,sel,*k); +//a1logd(g_log, 1,"disptechs_set_sel: flag %d, ix %d, osel '%s', isel '%s', k %d\n",flag, ix,osel,isel,*k); - /* See if this has already been allocated */ - if (usels[*sel] == ix) { -//a1logd(g_log, 1," set OK\n"); - return 0; /* Nothing to do */ + if (flag != 3) { + /* See if we already have a selecor character */ + if (osel[0] != '\000') { +//a1logd(g_log, 1," already set OK\n"); + return; + } + } else { + if (isel[0] == '\000') { +//a1logd(g_log, 1," nothing to set from\n"); + return; /* Nothing to set from */ + } + + /* Get ready to append */ + osel += strlen(osel); } - /* Set from the suggested selectors */ - for (i = 0, s = sel; *s != '\000'; s++, i++) { + /* Set or add from the first unsed suggested selectors */ + for (i = 0; *isel != '\000'; isel++, i++) { if (flag == 0 && i > 0) { //a1logd(g_log, 1," run out of primaries\n"); break; /* Looked at primary */ } - if (usels[*s] == ((char)-1)) { /* If this selector is not currently used */ -//a1logd(g_log, 1," set to '%c' at %d\n", *s, i); - sel[0] = *s; /* Use it */ - sel[1] = '\000'; - usels[*s] = ix; - return 0; + if (usels[*isel] == ((char)-1)) { /* If this selector is not currently used */ +//a1logd(g_log, 1," added to '%c' from %d\n", *isel, i); + osel[0] = *isel; /* Use it */ + osel[1] = '\000'; + usels[osel[0]] = ix; + + /* Remove all used/discarded from isel, in case we are called again. */ + for (isel++; ;isel++, iisel++) { + *iisel = *isel; + if (*isel == '\000') + break; + } + return; } -//a1logd(g_log, 1," sel '%c' at %d is used by ix %d\n", *s, i, usels[*s]); +//a1logd(g_log, 1," sel '%c' at %d is used by ix %d\n", *isel, i, usels[*isel]); } - if (flag <= 2) { -//a1logd(g_log, 1," returning unset\n"); - return 1; + /* If we get here, we haven't managed to add anything from the remaining */ + /* selectors, so mark the candidate list as empty: */ + iisel[0] = '\000'; + + if (flag != 2) { +//a1logd(g_log, 1," returning without add\n"); + return; } /* Get the next unused char in fallback list */ @@ -442,22 +462,16 @@ int disptechs_set_sel( } if (asels[*k] != '\000') { //a1logd(g_log, 1," set int to fallback '%c' at %d\n", asels[*k], *k); - sel[0] = asels[*k]; - sel[1] = '\000'; - usels[sel[0]] = ix; + osel[0] = asels[*k]; + osel[1] = '\000'; + usels[osel[0]] = ix; (*k)++; - return 0; - } - - /* Set any unset to nul */ - if (flag >= 3) { -//a1logd(g_log, 1," clearing\n"); - sel[0] = '\000'; + return; } -//a1logd(g_log, 1," failed\n"); - /* If we got here, we failed */ - return 1; +//a1logd(g_log, 1," returning after fallback without add\n"); + /* If we got here, we failed to add a selector */ + return; } /* Return the display tech list with unique lsel lectors */ @@ -474,18 +488,19 @@ disptech_info *disptech_get_list() { /* Add entries from the static list and their primary selectors */ for (i = 0; list[i].dtech != disptech_end; i++) { -//a1logd(1,"tech[%d] '%s' sels = '%s'\n",i,list[i].desc,list[i].sel); - strcpy(list[i].lsel, list[i].sel); - disptechs_set_sel(0, i, list[i].lsel, usels, &k, asels); +//a1logd(g_log,1,"tech[%d] '%s' sels = '%s'\n",i,list[i].desc,list[i].sel); + strcpy(list[i].isel, list[i].sel); + list[i].lsel[0] = '\000'; + disptechs_set_sel(0, i, list[i].lsel, list[i].isel, usels, &k, asels); } /* Set selectors from secondary */ for (i = 0; list[i].dtech != disptech_end; i++) - disptechs_set_sel(1, i, list[i].lsel, usels, &k, asels); + disptechs_set_sel(1, i, list[i].lsel, list[i].isel, usels, &k, asels); /* Set remainder from fallback */ for (i = 0; list[i].dtech != disptech_end; i++) - disptechs_set_sel(3, i, list[i].lsel, usels, &k, asels); + disptechs_set_sel(2, i, list[i].lsel, list[i].isel, usels, &k, asels); return list; } diff --git a/spectro/disptechs.h b/spectro/disptechs.h old mode 100755 new mode 100644 index 68245cf..9860eac --- a/spectro/disptechs.h +++ b/spectro/disptechs.h @@ -114,6 +114,7 @@ struct _disptech_info { /* Private: */ char lsel[10]; /* Unique list selector for ui */ + char isel[10]; /* Candidate selectors */ }; typedef struct _disptech_info disptech_info; @@ -137,7 +138,7 @@ disptech_info *disptech_select(disptech_info *list, char c); /* utility function, used by disptech_get_list & inst_creat_disptype_list() */ /* See disptechs.c for parameter description. */ -int disptechs_set_sel(int flag, int ix, char *sel, char *usels, int *k, char *asels); +void disptechs_set_sel(int flag, int ix, char *osel, char *isel, char *usels, int *k, char *asels); /* - - - - - - - - - - */ /* Display settling time model */ diff --git a/spectro/dispwin.c b/spectro/dispwin.c old mode 100755 new mode 100644 diff --git a/spectro/dispwin.h b/spectro/dispwin.h old mode 100755 new mode 100644 diff --git a/spectro/dtp20.c b/spectro/dtp20.c old mode 100755 new mode 100644 diff --git a/spectro/dtp20.h b/spectro/dtp20.h old mode 100755 new mode 100644 diff --git a/spectro/dtp22.c b/spectro/dtp22.c old mode 100755 new mode 100644 diff --git a/spectro/dtp22.h b/spectro/dtp22.h old mode 100755 new mode 100644 diff --git a/spectro/dtp41.c b/spectro/dtp41.c old mode 100755 new mode 100644 diff --git a/spectro/dtp41.h b/spectro/dtp41.h old mode 100755 new mode 100644 diff --git a/spectro/dtp51.c b/spectro/dtp51.c old mode 100755 new mode 100644 diff --git a/spectro/dtp51.h b/spectro/dtp51.h old mode 100755 new mode 100644 diff --git a/spectro/dtp92.c b/spectro/dtp92.c old mode 100755 new mode 100644 diff --git a/spectro/dtp92.h b/spectro/dtp92.h old mode 100755 new mode 100644 diff --git a/spectro/ex1.c b/spectro/ex1.c old mode 100755 new mode 100644 diff --git a/spectro/ex1.h b/spectro/ex1.h old mode 100755 new mode 100644 diff --git a/spectro/fakeread.c b/spectro/fakeread.c old mode 100755 new mode 100644 diff --git a/spectro/hcfr.c b/spectro/hcfr.c old mode 100755 new mode 100644 diff --git a/spectro/hcfr.h b/spectro/hcfr.h old mode 100755 new mode 100644 diff --git a/spectro/hidio.c b/spectro/hidio.c old mode 100755 new mode 100644 diff --git a/spectro/hidio.h b/spectro/hidio.h old mode 100755 new mode 100644 diff --git a/spectro/huey.c b/spectro/huey.c old mode 100755 new mode 100644 diff --git a/spectro/huey.h b/spectro/huey.h old mode 100755 new mode 100644 diff --git a/spectro/i1d3.c b/spectro/i1d3.c old mode 100755 new mode 100644 diff --git a/spectro/i1d3.h b/spectro/i1d3.h old mode 100755 new mode 100644 diff --git a/spectro/i1disp.c b/spectro/i1disp.c old mode 100755 new mode 100644 diff --git a/spectro/i1disp.h b/spectro/i1disp.h old mode 100755 new mode 100644 diff --git a/spectro/i1pro.c b/spectro/i1pro.c old mode 100755 new mode 100644 diff --git a/spectro/i1pro.h b/spectro/i1pro.h old mode 100755 new mode 100644 diff --git a/spectro/i1pro_imp.c b/spectro/i1pro_imp.c old mode 100755 new mode 100644 diff --git a/spectro/i1pro_imp.h b/spectro/i1pro_imp.h old mode 100755 new mode 100644 diff --git a/spectro/icoms.c b/spectro/icoms.c old mode 100755 new mode 100644 diff --git a/spectro/icoms.h b/spectro/icoms.h old mode 100755 new mode 100644 diff --git a/spectro/icoms_nt.c b/spectro/icoms_nt.c old mode 100755 new mode 100644 diff --git a/spectro/icoms_ux.c b/spectro/icoms_ux.c old mode 100755 new mode 100644 diff --git a/spectro/ifiles b/spectro/ifiles old mode 100755 new mode 100644 diff --git a/spectro/illumread.c b/spectro/illumread.c old mode 100755 new mode 100644 diff --git a/spectro/inflate.c b/spectro/inflate.c old mode 100755 new mode 100644 diff --git a/spectro/inst.c b/spectro/inst.c old mode 100755 new mode 100644 index ba12f9d..949e34f --- a/spectro/inst.c +++ b/spectro/inst.c @@ -875,9 +875,11 @@ int doccmx /* Add matching installed ccmx files */ usels[i] = ((char)-1); k = 0; /* Next selector index */ + /* First create a list of calibrations and their desired selectors: */ + /* Add entries from the static list and their primary selectors */ /* (We're currently assuming that calibrations that the instrument */ - /* returns are not custom) */ + /* returns are not custom.) */ /* Count the number in the static list. */ for (i = 0; !(sdtlist[i].flags & inst_dtflags_end); i++) { @@ -966,25 +968,52 @@ int doccmx /* Add matching installed ccmx files */ } } + /* Copy candidate selectors to private isel[] list */ + for (i = 0; i < nlist; i++) { + strcpy(list[i].isel, list[i].sel); + list[i].sel[0] = '\000'; + } + + /* Then allocate a slector for each calibration: */ + /* Set selectors from primary for cbid or custom first */ for (i = 0; i < nlist; i++) { if (list[i].cbid > 0 || (list[i].flags & inst_dtflags_custom) != 0) { - disptechs_set_sel(0, i, list[i].sel, usels, &k, asels); + disptechs_set_sel(0, i, list[i].sel, list[i].isel, usels, &k, asels); } } /* Set selectors from primary for rest */ for (i = 0; i < nlist; i++) - disptechs_set_sel(0, i, list[i].sel, usels, &k, asels); + disptechs_set_sel(0, i, list[i].sel, list[i].isel, usels, &k, asels); - /* Set remaining selectors from secondaries */ + /* Set remaining selectors from primaries or secondaries */ for (i = 0; i < nlist; i++) - disptechs_set_sel(1, i, list[i].sel, usels, &k, asels); + disptechs_set_sel(1, i, list[i].sel, list[i].isel, usels, &k, asels); - /* Set remaining from fallback (or give up and set to null) */ + /* Set remaining from fallback */ for (i = 0; i < nlist; i++) { - fail = disptechs_set_sel(3, i, list[i].sel, usels, &k, asels); + disptechs_set_sel(2, i, list[i].sel, list[i].isel, usels, &k, asels); + if (list[i].sel[0] == '\000') + fail = 1; + } + + /* Any calibrations that failed to find a character will be left as a nul string */ + + /* Add alternate selectors if they are free. */ + for (;;) { + int more = 0; + for (i = 0; i < nlist; i++) { + /* Add unused secondaries */ + disptechs_set_sel(3, i, list[i].sel, list[i].isel, usels, &k, asels); + + if (list[i].isel[0] != '\000') { /* Still more secondaries available */ + more = 1; + } + } + if (!more) + break; } if (pndtlist != NULL) diff --git a/spectro/inst.h b/spectro/inst.h old mode 100755 new mode 100644 index 00dd9b3..d47f7ea --- a/spectro/inst.h +++ b/spectro/inst.h @@ -390,6 +390,7 @@ typedef struct _inst_disptypesel { /* Private: */ int ix; /* Internal index, */ + char isel[INST_DTYPE_SEL_LEN]; /* String of potential selector characters */ // Stuff for ccss & ccmx char *path; /* Path to ccss or ccmx. NULL if not valid */ diff --git a/spectro/instappsup.c b/spectro/instappsup.c old mode 100755 new mode 100644 diff --git a/spectro/instappsup.h b/spectro/instappsup.h old mode 100755 new mode 100644 diff --git a/spectro/instlib.ksh b/spectro/instlib.ksh old mode 100755 new mode 100644 diff --git a/spectro/instlib.txt b/spectro/instlib.txt old mode 100755 new mode 100644 diff --git a/spectro/insttypeinst.h b/spectro/insttypeinst.h old mode 100755 new mode 100644 diff --git a/spectro/insttypes.c b/spectro/insttypes.c old mode 100755 new mode 100644 diff --git a/spectro/insttypes.h b/spectro/insttypes.h old mode 100755 new mode 100644 diff --git a/spectro/iusb.h b/spectro/iusb.h old mode 100755 new mode 100644 diff --git a/spectro/kleink10.c b/spectro/kleink10.c old mode 100755 new mode 100644 diff --git a/spectro/kleink10.h b/spectro/kleink10.h old mode 100755 new mode 100644 diff --git a/spectro/linear.cal b/spectro/linear.cal old mode 100755 new mode 100644 index ac93eb5..96cad93 --- a/spectro/linear.cal +++ b/spectro/linear.cal @@ -2,7 +2,7 @@ CAL DESCRIPTOR "Argyll Device Calibration Curves" ORIGINATOR "Argyll synthcal" -CREATED "Tue Aug 18 00:14:21 2015" +CREATED "Mon Sep 07 03:37:56 2015" DEVICE_CLASS "DISPLAY" COLOR_REP "RGB" diff --git a/spectro/linear.sp b/spectro/linear.sp old mode 100755 new mode 100644 diff --git a/spectro/madvrwin.c b/spectro/madvrwin.c old mode 100755 new mode 100644 diff --git a/spectro/madvrwin.h b/spectro/madvrwin.h old mode 100755 new mode 100644 diff --git a/spectro/mongoose.c b/spectro/mongoose.c old mode 100755 new mode 100644 diff --git a/spectro/mongoose.h b/spectro/mongoose.h old mode 100755 new mode 100644 diff --git a/spectro/munki.c b/spectro/munki.c old mode 100755 new mode 100644 diff --git a/spectro/munki.h b/spectro/munki.h old mode 100755 new mode 100644 diff --git a/spectro/munki_imp.c b/spectro/munki_imp.c old mode 100755 new mode 100644 diff --git a/spectro/munki_imp.h b/spectro/munki_imp.h old mode 100755 new mode 100644 diff --git a/spectro/oemarch.c b/spectro/oemarch.c old mode 100755 new mode 100644 diff --git a/spectro/oemarch.h b/spectro/oemarch.h old mode 100755 new mode 100644 diff --git a/spectro/oeminst.c b/spectro/oeminst.c old mode 100755 new mode 100644 diff --git a/spectro/pollem.c b/spectro/pollem.c old mode 100755 new mode 100644 diff --git a/spectro/pollem.h b/spectro/pollem.h old mode 100755 new mode 100644 diff --git a/spectro/rspec.c b/spectro/rspec.c old mode 100755 new mode 100644 diff --git a/spectro/rspec.h b/spectro/rspec.h old mode 100755 new mode 100644 diff --git a/spectro/smcube.c b/spectro/smcube.c old mode 100755 new mode 100644 diff --git a/spectro/smcube.h b/spectro/smcube.h old mode 100755 new mode 100644 diff --git a/spectro/spec2cie.c b/spectro/spec2cie.c old mode 100755 new mode 100644 index c9e570c..aa91ebb --- a/spectro/spec2cie.c +++ b/spectro/spec2cie.c @@ -514,8 +514,10 @@ main(int argc, char *argv[]) { int sidx; /* Sample ID index */ - int ti, ii, Xi, Yi, Zi, Li, ai, bi; + int ti, ii; + int Xi, Yi, Zi, Li, ai, bi; /* CGATS indexes for each field */ int spi[XSPECT_MAX_BANDS]; /* CGATS indexes for each wavelength */ + int oXi, oYi, oZi, oLi, oai, obi; /* CGATS indexes for each ouput field */ xsp2cie *sp2cie; /* Spectral conversion object */ xspect sp; double XYZ[3]; @@ -572,13 +574,17 @@ main(int argc, char *argv[]) /* copy fields to output file (except spectral if nospec) */ for (i = 0; i < icg->t[0].nfields; i++) { - /* See if this is a input spectral field */ - for (j = 0; nospec && j < sp.spec_n; j++) { - if (spi[j] == i) - break; /* Yes it is */ + + if (nospec) { + for (j = 0; nospec && j < sp.spec_n; j++) { + if (spi[j] == i) { + break; /* Yes it is */ + } + } + if (j < sp.spec_n) + continue; /* Skip it */ } - if (nospec == 0 || j >= sp.spec_n) - ocg->add_field (ocg, 0, icg->t[0].fsym[i], icg->t[0].ftype[i]); + ocg->add_field (ocg, 0, icg->t[0].fsym[i], icg->t[0].ftype[i]); } /* create field for XYZ and Lab if not present */ @@ -607,6 +613,13 @@ main(int argc, char *argv[]) if ((bi = ocg->add_field(ocg, 0, "LAB_B", r_t)) < 0) error ("Cannot add field to table"); + oXi = Xi; + oYi = Yi; + oZi = Zi; + oLi = Li; + oai = ai; + obi = bi; + /* allocate elements */ if ((elems = (cgats_set_elem *) @@ -746,25 +759,40 @@ main(int argc, char *argv[]) xspect corr_sp; /* copy all input colums to output (except spectral if nospec) */ - for (jj = j = 0; j < icg->t[0].nfields; j++) { - for (k = 0; nospec && k < sp.spec_n; k++) { - if (spi[k] == j) - break; - } - if (nospec == 0 || k >= sp.spec_n) { - switch (icg->t[0].ftype[j]) { - case r_t: - elems[jj].d = *((double *) icg->t[0].fdata[i][j]); - break; - case i_t: - elems[jj].i = *((int *) icg->t[0].fdata[i][j]); + + if (nospec) { + /* See if this is a spectral field */ + for (k = 0; nospec && k < sp.spec_n; k++) { + if (spi[k] == j) break; - default: - elems[jj].c = (char *) icg->t[0].fdata[i][j]; } - jj++; + + /* It is a spectral field */ + if (k < sp.spec_n) { + continue; /* Skip it */ + } } + + /* Correct the other fields location in output */ + if (j == Xi) oXi = jj; + if (j == Yi) oYi = jj; + if (j == Zi) oZi = jj; + if (j == Li) oLi = jj; + if (j == ai) oai = jj; + if (j == bi) obi = jj; + + switch (icg->t[0].ftype[j]) { + case r_t: + elems[jj].d = *((double *) icg->t[0].fdata[i][j]); + break; + case i_t: + elems[jj].i = *((int *) icg->t[0].fdata[i][j]); + break; + default: + elems[jj].c = (char *) icg->t[0].fdata[i][j]; + } + jj++; } /* Read the spectral values for this patch */ @@ -781,63 +809,16 @@ main(int argc, char *argv[]) /* Write the corrected spectral values for this patch */ if (nospec == 0) { for (j = 0; j < sp.spec_n; j++) { - elems[spi[j]].d = corr_sp.spec[j]; + elems[spi[j]].d = sp.spec[j] = corr_sp.spec[j]; } } -#ifdef ALLOW_PLOT - if (doplot) { - int ii; - double xx[XRES]; - double y1[XRES]; - double y2[XRES]; - double lab[3]; - - icmXYZ2Lab(&icmD50, lab, XYZ); - printf("Patch %d, XYZ = %f %f %f, Lab = %f %f %f\n",i, - XYZ[0], XYZ[1], XYZ[2], lab[0], lab[1], lab[2]); - - /* Plot spectrum out */ - for (ii = 0; ii < XRES; ii++) { - double ww; - - ww = (sp.spec_wl_long - sp.spec_wl_short) - * ((double)ii/(XRES-1.0)) + sp.spec_wl_short; - - xx[ii] = ww; - y1[ii] = value_xspect(&sp, ww); - y2[ii] = 100.0 * value_xspect(&corr_sp, ww); - } - do_plot(xx,y1,y2,NULL,ii); - } -#endif } + + /* No FWA comp */ else { /* Convert it to CIE space */ sp2cie->convert (sp2cie, XYZ, &sp); -#ifdef ALLOW_PLOT - if (doplot) { - int ii; - double xx[XRES]; - double y1[XRES]; - double lab[3]; - - icmXYZ2Lab(&icmD50, lab, XYZ); - printf("Patch %d, XYZ = %f %f %f, Lab = %f %f %f\n",i, - XYZ[0], XYZ[1], XYZ[2], lab[0], lab[1], lab[2]); - - /* Plot spectrum out */ - for (ii = 0; ii < XRES; ii++) { - double ww; - - ww = (sp.spec_wl_long - sp.spec_wl_short) - * ((double)ii/(XRES-1.0)) + sp.spec_wl_short; - - xx[ii] = ww; - y1[ii] = value_xspect(&sp, ww); - } - do_plot(xx,y1,NULL,NULL,ii); - } -#endif + } /* Could use sp2cie->get_cie_il() to get CIE white point */ @@ -846,13 +827,35 @@ main(int argc, char *argv[]) /* This won't work for emmisive though, since get_cie_il() will return 'E' */ icmXYZ2Lab(&icmD50, Lab, XYZ); - elems[Xi].d = XYZ[0] * 100.0; - elems[Yi].d = XYZ[1] * 100.0; - elems[Zi].d = XYZ[2] * 100.0; +#ifdef ALLOW_PLOT + if (doplot) { + int ii; + double xx[XRES]; + double y1[XRES]; + + printf("Patch %d, XYZ = %f %f %f, Lab = %f %f %f\n",i, + XYZ[0], XYZ[1], XYZ[2], Lab[0], Lab[1], Lab[2]); + + /* Plot spectrum out */ + for (ii = 0; ii < XRES; ii++) { + double ww; + + ww = (sp.spec_wl_long - sp.spec_wl_short) + * ((double)ii/(XRES-1.0)) + sp.spec_wl_short; + + xx[ii] = ww; + y1[ii] = value_xspect(&sp, ww); + } + do_plot(xx,y1,NULL,NULL,ii); + } +#endif + elems[oXi].d = XYZ[0] * 100.0; + elems[oYi].d = XYZ[1] * 100.0; + elems[oZi].d = XYZ[2] * 100.0; - elems[Li].d = Lab[0]; - elems[ai].d = Lab[1]; - elems[bi].d = Lab[2]; + elems[oLi].d = Lab[0]; + elems[oai].d = Lab[1]; + elems[obi].d = Lab[2]; ocg->add_setarr(ocg, 0, elems); } @@ -866,7 +869,7 @@ main(int argc, char *argv[]) ocg->del (ocg); /* Clean up */ icg->del (icg); /* Clean up */ - free (elems); + free (elems); } return 0; diff --git a/spectro/specbos.c b/spectro/specbos.c old mode 100755 new mode 100644 diff --git a/spectro/specbos.h b/spectro/specbos.h old mode 100755 new mode 100644 diff --git a/spectro/spotread.c b/spectro/spotread.c old mode 100755 new mode 100644 diff --git a/spectro/spyd2.c b/spectro/spyd2.c old mode 100755 new mode 100644 diff --git a/spectro/spyd2.h b/spectro/spyd2.h old mode 100755 new mode 100644 diff --git a/spectro/ss.c b/spectro/ss.c old mode 100755 new mode 100644 diff --git a/spectro/ss.h b/spectro/ss.h old mode 100755 new mode 100644 diff --git a/spectro/ss_imp.c b/spectro/ss_imp.c old mode 100755 new mode 100644 diff --git a/spectro/ss_imp.h b/spectro/ss_imp.h old mode 100755 new mode 100644 diff --git a/spectro/strange.cal b/spectro/strange.cal old mode 100755 new mode 100644 index 06725b0..406fba4 --- a/spectro/strange.cal +++ b/spectro/strange.cal @@ -2,7 +2,7 @@ CAL DESCRIPTOR "Argyll Device Calibration Curves" ORIGINATOR "Argyll synthcal" -CREATED "Tue Aug 18 00:14:21 2015" +CREATED "Mon Sep 07 03:37:56 2015" DEVICE_CLASS "DISPLAY" COLOR_REP "RGB" diff --git a/spectro/synthcal.c b/spectro/synthcal.c old mode 100755 new mode 100644 diff --git a/spectro/synthread.c b/spectro/synthread.c old mode 100755 new mode 100644 diff --git a/spectro/usbio.c b/spectro/usbio.c old mode 100755 new mode 100644 diff --git a/spectro/usbio.h b/spectro/usbio.h old mode 100755 new mode 100644 diff --git a/spectro/usbio_bsd.c b/spectro/usbio_bsd.c old mode 100755 new mode 100644 diff --git a/spectro/usbio_lx.c b/spectro/usbio_lx.c old mode 100755 new mode 100644 diff --git a/spectro/usbio_nt.c b/spectro/usbio_nt.c old mode 100755 new mode 100644 diff --git a/spectro/usbio_ox.c b/spectro/usbio_ox.c old mode 100755 new mode 100644 diff --git a/spectro/vinflate.c b/spectro/vinflate.c old mode 100755 new mode 100644 diff --git a/spectro/webwin.c b/spectro/webwin.c old mode 100755 new mode 100644 diff --git a/spectro/webwin.h b/spectro/webwin.h old mode 100755 new mode 100644 diff --git a/spectro/xdg_bds.c b/spectro/xdg_bds.c old mode 100755 new mode 100644 diff --git a/spectro/xdg_bds.h b/spectro/xdg_bds.h old mode 100755 new mode 100644 -- cgit v1.2.3