Lines Matching refs:it8
358 static void* AllocChunk(cmsIT8* it8, cmsUInt32Number size);
458 cmsBool SynError(cmsIT8* it8, const char *Txt, ...) in SynError() argument
468 …snprintf(ErrMsg, 1023, "%s: Line %d, %s", it8->FileStack[it8 ->IncludeSP]->FileName, it8->lineno, … in SynError()
470 it8->sy = SSYNERROR; in SynError()
471 cmsSignalError(it8 ->ContextID, cmsERROR_CORRUPTION_DETECTED, "%s", ErrMsg); in SynError()
477 cmsBool Check(cmsIT8* it8, SYMBOL sy, const char* Err) in Check() argument
479 if (it8 -> sy != sy) in Check()
480 return SynError(it8, NoMeta(Err)); in Check()
486 void NextCh(cmsIT8* it8) in NextCh() argument
488 if (it8 -> FileStack[it8 ->IncludeSP]->Stream) { in NextCh()
490 it8 ->ch = fgetc(it8 ->FileStack[it8 ->IncludeSP]->Stream); in NextCh()
492 if (feof(it8 -> FileStack[it8 ->IncludeSP]->Stream)) { in NextCh()
494 if (it8 ->IncludeSP > 0) { in NextCh()
496 fclose(it8 ->FileStack[it8->IncludeSP--]->Stream); in NextCh()
497 it8 -> ch = ' '; // Whitespace to be ignored in NextCh()
500 it8 ->ch = 0; // EOF in NextCh()
504 it8->ch = *it8->Source; in NextCh()
505 if (it8->ch) it8->Source++; in NextCh()
541 void ReadReal(cmsIT8* it8, int inum) in ReadReal() argument
543 it8->dnum = (cmsFloat64Number) inum; in ReadReal()
545 while (isdigit(it8->ch)) { in ReadReal()
547 it8->dnum = it8->dnum * 10.0 + (it8->ch - '0'); in ReadReal()
548 NextCh(it8); in ReadReal()
551 if (it8->ch == '.') { // Decimal point in ReadReal()
556 NextCh(it8); // Eats dec. point in ReadReal()
558 while (isdigit(it8->ch)) { in ReadReal()
560 frac = frac * 10.0 + (it8->ch - '0'); in ReadReal()
562 NextCh(it8); in ReadReal()
565 it8->dnum = it8->dnum + (frac / xpow10(prec)); in ReadReal()
569 if (toupper(it8->ch) == 'E') { in ReadReal()
574 NextCh(it8); sgn = 1; in ReadReal()
576 if (it8->ch == '-') { in ReadReal()
578 sgn = -1; NextCh(it8); in ReadReal()
581 if (it8->ch == '+') { in ReadReal()
584 NextCh(it8); in ReadReal()
588 while (isdigit(it8->ch)) { in ReadReal()
591 e = e * 10 + (it8->ch - '0'); in ReadReal()
593 NextCh(it8); in ReadReal()
597 it8 -> dnum = it8 -> dnum * xpow10(e); in ReadReal()
683 void InSymbol(cmsIT8* it8) in InSymbol() argument
692 while (isseparator(it8->ch)) in InSymbol()
693 NextCh(it8); in InSymbol()
695 if (isfirstidchar(it8->ch)) { // Identifier in InSymbol()
698 idptr = it8->id; in InSymbol()
702 if (++k < MAXID) *idptr++ = (char) it8->ch; in InSymbol()
704 NextCh(it8); in InSymbol()
706 } while (isidchar(it8->ch)); in InSymbol()
711 key = BinSrchKey(it8->id); in InSymbol()
712 if (key == SNONE) it8->sy = SIDENT; in InSymbol()
713 else it8->sy = key; in InSymbol()
717 if (isdigit(it8->ch) || it8->ch == '.' || it8->ch == '-' || it8->ch == '+') in InSymbol()
721 if (it8->ch == '-') { in InSymbol()
723 NextCh(it8); in InSymbol()
726 it8->inum = 0; in InSymbol()
727 it8->sy = SINUM; in InSymbol()
729 if (it8->ch == '0') { // 0xnnnn (Hexa) or 0bnnnn (Binary) in InSymbol()
731 NextCh(it8); in InSymbol()
732 if (toupper(it8->ch) == 'X') { in InSymbol()
736 NextCh(it8); in InSymbol()
737 while (isxdigit(it8->ch)) in InSymbol()
739 it8->ch = toupper(it8->ch); in InSymbol()
740 if (it8->ch >= 'A' && it8->ch <= 'F') j = it8->ch -'A'+10; in InSymbol()
741 else j = it8->ch - '0'; in InSymbol()
743 if ((long) it8->inum * 16L > (long) INT_MAX) in InSymbol()
745 SynError(it8, "Invalid hexadecimal number"); in InSymbol()
749 it8->inum = it8->inum * 16 + j; in InSymbol()
750 NextCh(it8); in InSymbol()
755 if (toupper(it8->ch) == 'B') { // Binary in InSymbol()
759 NextCh(it8); in InSymbol()
760 while (it8->ch == '0' || it8->ch == '1') in InSymbol()
762 j = it8->ch - '0'; in InSymbol()
764 if ((long) it8->inum * 2L > (long) INT_MAX) in InSymbol()
766 SynError(it8, "Invalid binary number"); in InSymbol()
770 it8->inum = it8->inum * 2 + j; in InSymbol()
771 NextCh(it8); in InSymbol()
778 while (isdigit(it8->ch)) { in InSymbol()
780 if ((long) it8->inum * 10L > (long) INT_MAX) { in InSymbol()
781 ReadReal(it8, it8->inum); in InSymbol()
782 it8->sy = SDNUM; in InSymbol()
783 it8->dnum *= sign; in InSymbol()
787 it8->inum = it8->inum * 10 + (it8->ch - '0'); in InSymbol()
788 NextCh(it8); in InSymbol()
791 if (it8->ch == '.') { in InSymbol()
793 ReadReal(it8, it8->inum); in InSymbol()
794 it8->sy = SDNUM; in InSymbol()
795 it8->dnum *= sign; in InSymbol()
799 it8 -> inum *= sign; in InSymbol()
803 if (isidchar(it8 ->ch)) { in InSymbol()
805 if (it8 ->sy == SINUM) { in InSymbol()
807 sprintf(it8->id, "%d", it8->inum); in InSymbol()
811 sprintf(it8->id, it8 ->DoubleFormatter, it8->dnum); in InSymbol()
814 k = (int) strlen(it8 ->id); in InSymbol()
815 idptr = it8 ->id + k; in InSymbol()
818 if (++k < MAXID) *idptr++ = (char) it8->ch; in InSymbol()
820 NextCh(it8); in InSymbol()
822 } while (isidchar(it8->ch)); in InSymbol()
825 it8->sy = SIDENT; in InSymbol()
831 switch ((int) it8->ch) { in InSymbol()
835 NextCh(it8); in InSymbol()
841 it8->sy = SEOF; in InSymbol()
847 NextCh(it8); in InSymbol()
848 if (it8 ->ch == '\n') in InSymbol()
849 NextCh(it8); in InSymbol()
850 it8->sy = SEOLN; in InSymbol()
851 it8->lineno++; in InSymbol()
855 NextCh(it8); in InSymbol()
856 it8->sy = SEOLN; in InSymbol()
857 it8->lineno++; in InSymbol()
862 NextCh(it8); in InSymbol()
863 while (it8->ch && it8->ch != '\n' && it8->ch != '\r') in InSymbol()
864 NextCh(it8); in InSymbol()
866 it8->sy = SCOMMENT; in InSymbol()
872 idptr = it8->str; in InSymbol()
873 sng = it8->ch; in InSymbol()
875 NextCh(it8); in InSymbol()
877 while (k < MAXSTR && it8->ch != sng) { in InSymbol()
879 if (it8->ch == '\n'|| it8->ch == '\r') k = MAXSTR+1; in InSymbol()
881 *idptr++ = (char) it8->ch; in InSymbol()
882 NextCh(it8); in InSymbol()
887 it8->sy = SSTRING; in InSymbol()
889 NextCh(it8); in InSymbol()
894 SynError(it8, "Unrecognized character: 0x%x", it8 ->ch); in InSymbol()
898 } while (it8->sy == SCOMMENT); in InSymbol()
902 if (it8 -> sy == SINCLUDE) { in InSymbol()
906 if(it8 -> IncludeSP >= (MAXINCLUDE-1)) { in InSymbol()
908 SynError(it8, "Too many recursion levels"); in InSymbol()
912 InSymbol(it8); in InSymbol()
913 if (!Check(it8, SSTRING, "Filename expected")) return; in InSymbol()
915 FileNest = it8 -> FileStack[it8 -> IncludeSP + 1]; in InSymbol()
918 … FileNest = it8 ->FileStack[it8 -> IncludeSP + 1] = (FILECTX*)AllocChunk(it8, sizeof(FILECTX)); in InSymbol()
923 if (BuildAbsolutePath(it8->str, in InSymbol()
924 it8->FileStack[it8->IncludeSP]->FileName, in InSymbol()
926 SynError(it8, "File path too long"); in InSymbol()
933 SynError(it8, "File %s not found", FileNest->FileName); in InSymbol()
936 it8->IncludeSP++; in InSymbol()
938 it8 ->ch = ' '; in InSymbol()
939 InSymbol(it8); in InSymbol()
946 cmsBool CheckEOLN(cmsIT8* it8) in CheckEOLN() argument
948 if (!Check(it8, SEOLN, "Expected separator")) return FALSE; in CheckEOLN()
949 while (it8 -> sy == SEOLN) in CheckEOLN()
950 InSymbol(it8); in CheckEOLN()
958 void Skip(cmsIT8* it8, SYMBOL sy) in Skip() argument
960 if (it8->sy == sy && it8->sy != SEOF) in Skip()
961 InSymbol(it8); in Skip()
967 void SkipEOLN(cmsIT8* it8) in SkipEOLN() argument
969 while (it8->sy == SEOLN) { in SkipEOLN()
970 InSymbol(it8); in SkipEOLN()
977 cmsBool GetVal(cmsIT8* it8, char* Buffer, cmsUInt32Number max, const char* ErrorTitle) in GetVal() argument
979 switch (it8->sy) { in GetVal()
984 case SIDENT: strncpy(Buffer, it8->id, max); in GetVal()
987 case SINUM: snprintf(Buffer, max, "%d", it8 -> inum); break; in GetVal()
988 case SDNUM: snprintf(Buffer, max, it8->DoubleFormatter, it8 -> dnum); break; in GetVal()
989 case SSTRING: strncpy(Buffer, it8->str, max); in GetVal()
995 return SynError(it8, "%s", ErrorTitle); in GetVal()
1005 TABLE* GetTable(cmsIT8* it8) in GetTable() argument
1007 if ((it8 -> nTable >= it8 ->TablesCount)) { in GetTable()
1009 SynError(it8, "Table %d out of sequence", it8 -> nTable); in GetTable()
1010 return it8 -> Tab; in GetTable()
1013 return it8 ->Tab + it8 ->nTable; in GetTable()
1022 cmsIT8* it8 = (cmsIT8*) hIT8; in cmsIT8Free() local
1024 if (it8 == NULL) in cmsIT8Free()
1027 if (it8->MemorySink) { in cmsIT8Free()
1032 for (p = it8->MemorySink; p != NULL; p = n) { in cmsIT8Free()
1035 if (p->Ptr) _cmsFree(it8 ->ContextID, p->Ptr); in cmsIT8Free()
1036 _cmsFree(it8 ->ContextID, p); in cmsIT8Free()
1040 if (it8->MemoryBlock) in cmsIT8Free()
1041 _cmsFree(it8 ->ContextID, it8->MemoryBlock); in cmsIT8Free()
1043 _cmsFree(it8 ->ContextID, it8); in cmsIT8Free()
1049 void* AllocBigBlock(cmsIT8* it8, cmsUInt32Number size) in AllocBigBlock() argument
1052 void* ptr = _cmsMallocZero(it8->ContextID, size); in AllocBigBlock()
1056 ptr1 = (OWNEDMEM*) _cmsMallocZero(it8 ->ContextID, sizeof(OWNEDMEM)); in AllocBigBlock()
1060 _cmsFree(it8 ->ContextID, ptr); in AllocBigBlock()
1065 ptr1-> Next = it8 -> MemorySink; in AllocBigBlock()
1066 it8 -> MemorySink = ptr1; in AllocBigBlock()
1075 void* AllocChunk(cmsIT8* it8, cmsUInt32Number size) in AllocChunk() argument
1077 cmsUInt32Number Free = it8 ->Allocator.BlockSize - it8 ->Allocator.Used; in AllocChunk()
1084 if (it8 -> Allocator.BlockSize == 0) in AllocChunk()
1086 it8 -> Allocator.BlockSize = 20*1024; in AllocChunk()
1088 it8 ->Allocator.BlockSize *= 2; in AllocChunk()
1090 if (it8 ->Allocator.BlockSize < size) in AllocChunk()
1091 it8 ->Allocator.BlockSize = size; in AllocChunk()
1093 it8 ->Allocator.Used = 0; in AllocChunk()
1094 it8 ->Allocator.Block = (cmsUInt8Number*) AllocBigBlock(it8, it8 ->Allocator.BlockSize); in AllocChunk()
1097 ptr = it8 ->Allocator.Block + it8 ->Allocator.Used; in AllocChunk()
1098 it8 ->Allocator.Used += size; in AllocChunk()
1107 char *AllocString(cmsIT8* it8, const char* str) in AllocString() argument
1113 ptr = (char *) AllocChunk(it8, Size); in AllocString()
1160 KEYVALUE* AddToList(cmsIT8* it8, KEYVALUE** Head, const char *Key, const char *Subkey, const char* … in AddToList() argument
1179 p = (KEYVALUE*) AllocChunk(it8, sizeof(KEYVALUE)); in AddToList()
1182 SynError(it8, "AddToList: out of memory"); in AddToList()
1187 p->Keyword = AllocString(it8, Key); in AddToList()
1188 p->Subkey = (Subkey == NULL) ? NULL : AllocString(it8, Subkey); in AddToList()
1218 p->Value = AllocString(it8, xValue); in AddToList()
1228 KEYVALUE* AddAvailableProperty(cmsIT8* it8, const char* Key, WRITEMODE as) in AddAvailableProperty() argument
1230 return AddToList(it8, &it8->ValidKeywords, Key, NULL, NULL, as); in AddAvailableProperty()
1235 KEYVALUE* AddAvailableSampleID(cmsIT8* it8, const char* Key) in AddAvailableSampleID() argument
1237 return AddToList(it8, &it8->ValidSampleID, Key, NULL, NULL, WRITE_UNCOOKED); in AddAvailableSampleID()
1242 void AllocTable(cmsIT8* it8) in AllocTable() argument
1246 t = it8 ->Tab + it8 ->TablesCount; in AllocTable()
1252 it8 ->TablesCount++; in AllocTable()
1258 cmsIT8* it8 = (cmsIT8*) IT8; in cmsIT8SetTable() local
1260 if (nTable >= it8 ->TablesCount) { in cmsIT8SetTable()
1262 if (nTable == it8 ->TablesCount) { in cmsIT8SetTable()
1264 AllocTable(it8); in cmsIT8SetTable()
1267 SynError(it8, "Table %d is out of sequence", nTable); in cmsIT8SetTable()
1272 it8 ->nTable = nTable; in cmsIT8SetTable()
1282 cmsIT8* it8; in cmsIT8Alloc() local
1285 it8 = (cmsIT8*) _cmsMallocZero(ContextID, sizeof(cmsIT8)); in cmsIT8Alloc()
1286 if (it8 == NULL) return NULL; in cmsIT8Alloc()
1288 AllocTable(it8); in cmsIT8Alloc()
1290 it8->MemoryBlock = NULL; in cmsIT8Alloc()
1291 it8->MemorySink = NULL; in cmsIT8Alloc()
1293 it8 ->nTable = 0; in cmsIT8Alloc()
1295 it8->ContextID = ContextID; in cmsIT8Alloc()
1296 it8->Allocator.Used = 0; in cmsIT8Alloc()
1297 it8->Allocator.Block = NULL; in cmsIT8Alloc()
1298 it8->Allocator.BlockSize = 0; in cmsIT8Alloc()
1300 it8->ValidKeywords = NULL; in cmsIT8Alloc()
1301 it8->ValidSampleID = NULL; in cmsIT8Alloc()
1303 it8 -> sy = SNONE; in cmsIT8Alloc()
1304 it8 -> ch = ' '; in cmsIT8Alloc()
1305 it8 -> Source = NULL; in cmsIT8Alloc()
1306 it8 -> inum = 0; in cmsIT8Alloc()
1307 it8 -> dnum = 0.0; in cmsIT8Alloc()
1309 it8->FileStack[0] = (FILECTX*)AllocChunk(it8, sizeof(FILECTX)); in cmsIT8Alloc()
1310 it8->IncludeSP = 0; in cmsIT8Alloc()
1311 it8 -> lineno = 1; in cmsIT8Alloc()
1313 strcpy(it8->DoubleFormatter, DEFAULT_DBL_FORMAT); in cmsIT8Alloc()
1314 cmsIT8SetSheetType((cmsHANDLE) it8, "CGATS.17"); in cmsIT8Alloc()
1319 AddAvailableProperty(it8, PredefinedProperties[i].id, PredefinedProperties[i].as); in cmsIT8Alloc()
1322 AddAvailableSampleID(it8, PredefinedSampleID[i]); in cmsIT8Alloc()
1325 return (cmsHANDLE) it8; in cmsIT8Alloc()
1345 cmsIT8* it8 = (cmsIT8*) hIT8; in cmsIT8SetComment() local
1350 return AddToList(it8, &GetTable(it8)->HeaderList, "# ", NULL, Val, WRITE_UNCOOKED) != NULL; in cmsIT8SetComment()
1356 cmsIT8* it8 = (cmsIT8*) hIT8; in cmsIT8SetPropertyStr() local
1361 return AddToList(it8, &GetTable(it8)->HeaderList, Key, NULL, Val, WRITE_STRINGIFY) != NULL; in cmsIT8SetPropertyStr()
1366 cmsIT8* it8 = (cmsIT8*) hIT8; in cmsIT8SetPropertyDbl() local
1369 sprintf(Buffer, it8->DoubleFormatter, Val); in cmsIT8SetPropertyDbl()
1371 return AddToList(it8, &GetTable(it8)->HeaderList, cProp, NULL, Buffer, WRITE_UNCOOKED) != NULL; in cmsIT8SetPropertyDbl()
1376 cmsIT8* it8 = (cmsIT8*) hIT8; in cmsIT8SetPropertyHex() local
1381 … return AddToList(it8, &GetTable(it8)->HeaderList, cProp, NULL, Buffer, WRITE_HEXADECIMAL) != NULL; in cmsIT8SetPropertyHex()
1386 cmsIT8* it8 = (cmsIT8*) hIT8; in cmsIT8SetPropertyUncooked() local
1388 return AddToList(it8, &GetTable(it8)->HeaderList, Key, NULL, Buffer, WRITE_UNCOOKED) != NULL; in cmsIT8SetPropertyUncooked()
1393 cmsIT8* it8 = (cmsIT8*) hIT8; in cmsIT8SetPropertyMulti() local
1395 return AddToList(it8, &GetTable(it8)->HeaderList, Key, SubKey, Buffer, WRITE_PAIR) != NULL; in cmsIT8SetPropertyMulti()
1401 cmsIT8* it8 = (cmsIT8*) hIT8; in cmsIT8GetProperty() local
1404 if (IsAvailableOnList(GetTable(it8) -> HeaderList, Key, NULL, &p)) in cmsIT8GetProperty()
1423 cmsIT8* it8 = (cmsIT8*) hIT8; in cmsIT8GetPropertyMulti() local
1426 if (IsAvailableOnList(GetTable(it8) -> HeaderList, Key, SubKey, &p)) { in cmsIT8GetPropertyMulti()
1436 void AllocateDataFormat(cmsIT8* it8) in AllocateDataFormat() argument
1438 TABLE* t = GetTable(it8); in AllocateDataFormat()
1442 t -> nSamples = (int) cmsIT8GetPropertyDbl(it8, "NUMBER_OF_FIELDS"); in AllocateDataFormat()
1446 SynError(it8, "AllocateDataFormat: Unknown NUMBER_OF_FIELDS"); in AllocateDataFormat()
1450 … t -> DataFormat = (char**) AllocChunk (it8, ((cmsUInt32Number) t->nSamples + 1) * sizeof(char *)); in AllocateDataFormat()
1453 SynError(it8, "AllocateDataFormat: Unable to allocate dataFormat array"); in AllocateDataFormat()
1459 const char *GetDataFormat(cmsIT8* it8, int n) in GetDataFormat() argument
1461 TABLE* t = GetTable(it8); in GetDataFormat()
1470 cmsBool SetDataFormat(cmsIT8* it8, int n, const char *label) in SetDataFormat() argument
1472 TABLE* t = GetTable(it8); in SetDataFormat()
1475 AllocateDataFormat(it8); in SetDataFormat()
1478 SynError(it8, "More than NUMBER_OF_FIELDS fields."); in SetDataFormat()
1483 t->DataFormat[n] = AllocString(it8, label); in SetDataFormat()
1492 cmsIT8* it8 = (cmsIT8*) h; in cmsIT8SetDataFormat() local
1493 return SetDataFormat(it8, n, Sample); in cmsIT8SetDataFormat()
1497 void AllocateDataSet(cmsIT8* it8) in AllocateDataSet() argument
1499 TABLE* t = GetTable(it8); in AllocateDataSet()
1503 t-> nSamples = atoi(cmsIT8GetProperty(it8, "NUMBER_OF_FIELDS")); in AllocateDataSet()
1504 t-> nPatches = atoi(cmsIT8GetProperty(it8, "NUMBER_OF_SETS")); in AllocateDataSet()
1506 …t-> Data = (char**)AllocChunk (it8, ((cmsUInt32Number) t->nSamples + 1) * ((cmsUInt32Number) t->nP… in AllocateDataSet()
1509 SynError(it8, "AllocateDataSet: Unable to allocate data array"); in AllocateDataSet()
1515 char* GetData(cmsIT8* it8, int nSet, int nField) in GetData() argument
1517 TABLE* t = GetTable(it8); in GetData()
1529 cmsBool SetData(cmsIT8* it8, int nSet, int nField, const char *Val) in SetData() argument
1531 TABLE* t = GetTable(it8); in SetData()
1534 AllocateDataSet(it8); in SetData()
1540 … return SynError(it8, "Patch %d out of range, there are %d patches", nSet, t -> nPatches); in SetData()
1544 … return SynError(it8, "Sample %d out of range, there are %d samples", nField, t ->nSamples); in SetData()
1548 t->Data [nSet * t -> nSamples + nField] = AllocString(it8, Val); in SetData()
1614 void WriteHeader(cmsIT8* it8, SAVESTREAM* fp) in WriteHeader() argument
1617 TABLE* t = GetTable(it8); in WriteHeader()
1645 if (!IsAvailableOnList(it8-> ValidKeywords, p->Keyword, NULL, NULL)) { in WriteHeader()
1653 AddAvailableProperty(it8, p->Keyword, WRITE_UNCOOKED); in WriteHeader()
1681 default: SynError(it8, "Unknown write mode %d", p ->WriteAs); in WriteHeader()
1694 void WriteDataFormat(SAVESTREAM* fp, cmsIT8* it8) in WriteDataFormat() argument
1697 TABLE* t = GetTable(it8); in WriteDataFormat()
1703 nSamples = atoi(cmsIT8GetProperty(it8, "NUMBER_OF_FIELDS")); in WriteDataFormat()
1717 void WriteData(SAVESTREAM* fp, cmsIT8* it8) in WriteData() argument
1720 TABLE* t = GetTable(it8); in WriteData()
1726 t->nPatches = atoi(cmsIT8GetProperty(it8, "NUMBER_OF_SETS")); in WriteData()
1763 cmsIT8* it8 = (cmsIT8*) hIT8; in cmsIT8SaveToFile() local
1770 for (i=0; i < it8 ->TablesCount; i++) { in cmsIT8SaveToFile()
1773 WriteHeader(it8, &sd); in cmsIT8SaveToFile()
1774 WriteDataFormat(&sd, it8); in cmsIT8SaveToFile()
1775 WriteData(&sd, it8); in cmsIT8SaveToFile()
1789 cmsIT8* it8 = (cmsIT8*) hIT8; in cmsIT8SaveToMem() local
1804 for (i=0; i < it8 ->TablesCount; i++) { in cmsIT8SaveToMem()
1807 WriteHeader(it8, &sd); in cmsIT8SaveToMem()
1808 WriteDataFormat(&sd, it8); in cmsIT8SaveToMem()
1809 WriteData(&sd, it8); in cmsIT8SaveToMem()
1826 cmsBool DataFormatSection(cmsIT8* it8) in DataFormatSection() argument
1829 TABLE* t = GetTable(it8); in DataFormatSection()
1831 InSymbol(it8); // Eats "BEGIN_DATA_FORMAT" in DataFormatSection()
1832 CheckEOLN(it8); in DataFormatSection()
1834 while (it8->sy != SEND_DATA_FORMAT && in DataFormatSection()
1835 it8->sy != SEOLN && in DataFormatSection()
1836 it8->sy != SEOF && in DataFormatSection()
1837 it8->sy != SSYNERROR) { in DataFormatSection()
1839 if (it8->sy != SIDENT) { in DataFormatSection()
1841 return SynError(it8, "Sample type expected"); in DataFormatSection()
1844 if (!SetDataFormat(it8, iField, it8->id)) return FALSE; in DataFormatSection()
1847 InSymbol(it8); in DataFormatSection()
1848 SkipEOLN(it8); in DataFormatSection()
1851 SkipEOLN(it8); in DataFormatSection()
1852 Skip(it8, SEND_DATA_FORMAT); in DataFormatSection()
1853 SkipEOLN(it8); in DataFormatSection()
1856 … SynError(it8, "Count mismatch. NUMBER_OF_FIELDS was %d, found %d\n", t ->nSamples, iField); in DataFormatSection()
1867 cmsBool DataSection (cmsIT8* it8) in DataSection() argument
1872 TABLE* t = GetTable(it8); in DataSection()
1874 InSymbol(it8); // Eats "BEGIN_DATA" in DataSection()
1875 CheckEOLN(it8); in DataSection()
1878 AllocateDataSet(it8); in DataSection()
1880 while (it8->sy != SEND_DATA && it8->sy != SEOF) in DataSection()
1888 if (it8->sy != SEND_DATA && it8->sy != SEOF) { in DataSection()
1890 if (!GetVal(it8, Buffer, 255, "Sample data expected")) in DataSection()
1893 if (!SetData(it8, iSet, iField, Buffer)) in DataSection()
1898 InSymbol(it8); in DataSection()
1899 SkipEOLN(it8); in DataSection()
1903 SkipEOLN(it8); in DataSection()
1904 Skip(it8, SEND_DATA); in DataSection()
1905 SkipEOLN(it8); in DataSection()
1910 … return SynError(it8, "Count mismatch. NUMBER_OF_SETS was %d, found %d\n", t ->nPatches, iSet+1); in DataSection()
1919 cmsBool HeaderSection(cmsIT8* it8) in HeaderSection() argument
1925 while (it8->sy != SEOF && in HeaderSection()
1926 it8->sy != SSYNERROR && in HeaderSection()
1927 it8->sy != SBEGIN_DATA_FORMAT && in HeaderSection()
1928 it8->sy != SBEGIN_DATA) { in HeaderSection()
1931 switch (it8 -> sy) { in HeaderSection()
1934 InSymbol(it8); in HeaderSection()
1935 if (!GetVal(it8, Buffer, MAXSTR-1, "Keyword expected")) return FALSE; in HeaderSection()
1936 if (!AddAvailableProperty(it8, Buffer, WRITE_UNCOOKED)) return FALSE; in HeaderSection()
1937 InSymbol(it8); in HeaderSection()
1942 InSymbol(it8); in HeaderSection()
1943 if (!GetVal(it8, Buffer, MAXSTR-1, "Keyword expected")) return FALSE; in HeaderSection()
1944 if (!AddAvailableSampleID(it8, Buffer)) return FALSE; in HeaderSection()
1945 InSymbol(it8); in HeaderSection()
1950 strncpy(VarName, it8->id, MAXID-1); in HeaderSection()
1953 if (!IsAvailableOnList(it8-> ValidKeywords, VarName, NULL, &Key)) { in HeaderSection()
1956 return SynError(it8, "Undefined keyword '%s'", VarName); in HeaderSection()
1958 Key = AddAvailableProperty(it8, VarName, WRITE_UNCOOKED); in HeaderSection()
1963 InSymbol(it8); in HeaderSection()
1964 if (!GetVal(it8, Buffer, MAXSTR-1, "Property data expected")) return FALSE; in HeaderSection()
1967 AddToList(it8, &GetTable(it8)->HeaderList, VarName, NULL, Buffer, in HeaderSection()
1968 (it8->sy == SSTRING) ? WRITE_STRINGIFY : WRITE_UNCOOKED); in HeaderSection()
1973 if (it8->sy != SSTRING) in HeaderSection()
1974 … return SynError(it8, "Invalid value '%s' for property '%s'.", Buffer, VarName); in HeaderSection()
1989 return SynError(it8, "Invalid value for property '%s'.", VarName); in HeaderSection()
2004 return SynError(it8, "Invalid value for property '%s'.", VarName); in HeaderSection()
2005 … AddToList(it8, &GetTable(it8)->HeaderList, VarName, Subkey, Value, WRITE_PAIR); in HeaderSection()
2009 InSymbol(it8); in HeaderSection()
2016 return SynError(it8, "expected keyword or identifier"); in HeaderSection()
2019 SkipEOLN(it8); in HeaderSection()
2028 void ReadType(cmsIT8* it8, char* SheetTypePtr) in ReadType() argument
2032 while (isseparator(it8->ch)) in ReadType()
2033 NextCh(it8); in ReadType()
2035 while (it8->ch != '\r' && it8 ->ch != '\n' && it8->ch != '\t' && it8 -> ch != -1) { in ReadType()
2037 *SheetTypePtr++= (char) it8 ->ch; in ReadType()
2038 NextCh(it8); in ReadType()
2046 cmsBool ParseIT8(cmsIT8* it8, cmsBool nosheet) in ParseIT8() argument
2048 char* SheetTypePtr = it8 ->Tab[0].SheetType; in ParseIT8()
2051 ReadType(it8, SheetTypePtr); in ParseIT8()
2054 InSymbol(it8); in ParseIT8()
2056 SkipEOLN(it8); in ParseIT8()
2058 while (it8-> sy != SEOF && in ParseIT8()
2059 it8-> sy != SSYNERROR) { in ParseIT8()
2061 switch (it8 -> sy) { in ParseIT8()
2064 if (!DataFormatSection(it8)) return FALSE; in ParseIT8()
2069 if (!DataSection(it8)) return FALSE; in ParseIT8()
2071 if (it8 -> sy != SEOF) { in ParseIT8()
2073 AllocTable(it8); in ParseIT8()
2074 it8 ->nTable = it8 ->TablesCount - 1; in ParseIT8()
2081 if (it8 ->sy == SIDENT) { in ParseIT8()
2085 while (isseparator(it8->ch)) in ParseIT8()
2086 NextCh(it8); in ParseIT8()
2089 if (it8 ->ch == '\n' || it8->ch == '\r') { in ParseIT8()
2091 cmsIT8SetSheetType(it8, it8 ->id); in ParseIT8()
2092 InSymbol(it8); in ParseIT8()
2097 cmsIT8SetSheetType(it8, ""); in ParseIT8()
2102 if (it8 ->sy == SSTRING) { in ParseIT8()
2103 cmsIT8SetSheetType(it8, it8 ->str); in ParseIT8()
2104 InSymbol(it8); in ParseIT8()
2112 SkipEOLN(it8); in ParseIT8()
2116 if (!HeaderSection(it8)) return FALSE; in ParseIT8()
2121 return (it8 -> sy != SSYNERROR); in ParseIT8()
2129 void CookPointers(cmsIT8* it8) in CookPointers() argument
2134 cmsUInt32Number nOldTable = it8 ->nTable; in CookPointers()
2136 for (j=0; j < it8 ->TablesCount; j++) { in CookPointers()
2138 TABLE* t = it8 ->Tab + j; in CookPointers()
2141 it8 ->nTable = j; in CookPointers()
2146 SynError(it8, "Undefined DATA_FORMAT"); in CookPointers()
2160 char *Data = GetData(it8, i, idField); in CookPointers()
2170 SetData(it8, i, idField, Buffer); in CookPointers()
2184 char *Label = GetData(it8, i, idField); in CookPointers()
2193 for (k=0; k < it8 ->TablesCount; k++) { in CookPointers()
2195 TABLE* Table = it8 ->Tab + k; in CookPointers()
2208 SetData(it8, i, idField, Buffer); in CookPointers()
2223 it8 ->nTable = nOldTable; in CookPointers()
2297 cmsIT8* it8; in cmsIT8LoadFromMem() local
2309 it8 = (cmsIT8*) hIT8; in cmsIT8LoadFromMem()
2310 it8 ->MemoryBlock = (char*) _cmsMalloc(ContextID, len + 1); in cmsIT8LoadFromMem()
2312 strncpy(it8 ->MemoryBlock, (const char*) Ptr, len); in cmsIT8LoadFromMem()
2313 it8 ->MemoryBlock[len] = 0; in cmsIT8LoadFromMem()
2315 strncpy(it8->FileStack[0]->FileName, "", cmsMAX_PATH-1); in cmsIT8LoadFromMem()
2316 it8-> Source = it8 -> MemoryBlock; in cmsIT8LoadFromMem()
2318 if (!ParseIT8(it8, type-1)) { in cmsIT8LoadFromMem()
2324 CookPointers(it8); in cmsIT8LoadFromMem()
2325 it8 ->nTable = 0; in cmsIT8LoadFromMem()
2327 _cmsFree(ContextID, it8->MemoryBlock); in cmsIT8LoadFromMem()
2328 it8 -> MemoryBlock = NULL; in cmsIT8LoadFromMem()
2340 cmsIT8* it8; in cmsIT8LoadFromFile() local
2349 it8 = (cmsIT8*) hIT8; in cmsIT8LoadFromFile()
2353 it8 ->FileStack[0]->Stream = fopen(cFileName, "rt"); in cmsIT8LoadFromFile()
2355 if (!it8 ->FileStack[0]->Stream) { in cmsIT8LoadFromFile()
2361 strncpy(it8->FileStack[0]->FileName, cFileName, cmsMAX_PATH-1); in cmsIT8LoadFromFile()
2362 it8->FileStack[0]->FileName[cmsMAX_PATH-1] = 0; in cmsIT8LoadFromFile()
2364 if (!ParseIT8(it8, type-1)) { in cmsIT8LoadFromFile()
2366 fclose(it8 ->FileStack[0]->Stream); in cmsIT8LoadFromFile()
2371 CookPointers(it8); in cmsIT8LoadFromFile()
2372 it8 ->nTable = 0; in cmsIT8LoadFromFile()
2374 if (fclose(it8 ->FileStack[0]->Stream)!= 0) { in cmsIT8LoadFromFile()
2385 cmsIT8* it8 = (cmsIT8*) hIT8; in cmsIT8EnumDataFormat() local
2390 t = GetTable(it8); in cmsIT8EnumDataFormat()
2400 cmsIT8* it8 = (cmsIT8*) hIT8; in cmsIT8EnumProperties() local
2408 t = GetTable(it8); in cmsIT8EnumProperties()
2418 Props = (char **) AllocChunk(it8, sizeof(char *) * n); in cmsIT8EnumProperties()
2432 cmsIT8* it8 = (cmsIT8*) hIT8; in cmsIT8EnumPropertyMulti() local
2441 t = GetTable(it8); in cmsIT8EnumPropertyMulti()
2457 Props = (const char **) AllocChunk(it8, sizeof(char *) * n); in cmsIT8EnumPropertyMulti()
2471 int LocatePatch(cmsIT8* it8, const char* cPatch) in LocatePatch() argument
2475 TABLE* t = GetTable(it8); in LocatePatch()
2479 data = GetData(it8, i, t->SampleID); in LocatePatch()
2494 int LocateEmptyPatch(cmsIT8* it8) in LocateEmptyPatch() argument
2498 TABLE* t = GetTable(it8); in LocateEmptyPatch()
2502 data = GetData(it8, i, t->SampleID); in LocateEmptyPatch()
2513 int LocateSample(cmsIT8* it8, const char* cSample) in LocateSample() argument
2517 TABLE* t = GetTable(it8); in LocateSample()
2521 fld = GetDataFormat(it8, i); in LocateSample()
2533 cmsIT8* it8 = (cmsIT8*) hIT8; in cmsIT8FindDataFormat() local
2537 return LocateSample(it8, cSample); in cmsIT8FindDataFormat()
2544 cmsIT8* it8 = (cmsIT8*) hIT8; in cmsIT8GetDataRowCol() local
2548 return GetData(it8, row, col); in cmsIT8GetDataRowCol()
2566 cmsIT8* it8 = (cmsIT8*) hIT8; in cmsIT8SetDataRowCol() local
2570 return SetData(it8, row, col, Val); in cmsIT8SetDataRowCol()
2576 cmsIT8* it8 = (cmsIT8*) hIT8; in cmsIT8SetDataRowColDbl() local
2581 sprintf(Buff, it8->DoubleFormatter, Val); in cmsIT8SetDataRowColDbl()
2583 return SetData(it8, row, col, Buff); in cmsIT8SetDataRowColDbl()
2590 cmsIT8* it8 = (cmsIT8*) hIT8; in cmsIT8GetData() local
2595 iField = LocateSample(it8, cSample); in cmsIT8GetData()
2600 iSet = LocatePatch(it8, cPatch); in cmsIT8GetData()
2605 return GetData(it8, iSet, iField); in cmsIT8GetData()
2609 cmsFloat64Number CMSEXPORT cmsIT8GetDataDbl(cmsHANDLE it8, const char* cPatch, const char* cSample) in cmsIT8GetDataDbl() argument
2613 Buffer = cmsIT8GetData(it8, cPatch, cSample); in cmsIT8GetDataDbl()
2622 cmsIT8* it8 = (cmsIT8*) hIT8; in cmsIT8SetData() local
2628 t = GetTable(it8); in cmsIT8SetData()
2630 iField = LocateSample(it8, cSample); in cmsIT8SetData()
2637 AllocateDataFormat(it8); in cmsIT8SetData()
2638 AllocateDataSet(it8); in cmsIT8SetData()
2639 CookPointers(it8); in cmsIT8SetData()
2644 iSet = LocateEmptyPatch(it8); in cmsIT8SetData()
2646 return SynError(it8, "Couldn't add more patches '%s'\n", cPatch); in cmsIT8SetData()
2652 iSet = LocatePatch(it8, cPatch); in cmsIT8SetData()
2658 return SetData(it8, iSet, iField, Val); in cmsIT8SetData()
2666 cmsIT8* it8 = (cmsIT8*) hIT8; in cmsIT8SetDataDbl() local
2671 snprintf(Buff, 255, it8->DoubleFormatter, Val); in cmsIT8SetDataDbl()
2679 cmsIT8* it8 = (cmsIT8*) hIT8; in cmsIT8GetPatchName() local
2685 t = GetTable(it8); in cmsIT8GetPatchName()
2686 Data = GetData(it8, nPatch, t->SampleID); in cmsIT8GetPatchName()
2705 cmsIT8* it8 = (cmsIT8*) hIT8; in cmsIT8TableCount() local
2709 return it8 ->TablesCount; in cmsIT8TableCount()
2749 cmsIT8* it8 = (cmsIT8*) hIT8; in cmsIT8SetIndexColumn() local
2754 pos = LocateSample(it8, cSample); in cmsIT8SetIndexColumn()
2758 it8->Tab[it8->nTable].SampleID = pos; in cmsIT8SetIndexColumn()
2765 cmsIT8* it8 = (cmsIT8*) hIT8; in cmsIT8DefineDblFormat() local
2770 strcpy(it8->DoubleFormatter, DEFAULT_DBL_FORMAT); in cmsIT8DefineDblFormat()
2772 strncpy(it8->DoubleFormatter, Formatter, sizeof(it8->DoubleFormatter)); in cmsIT8DefineDblFormat()
2774 it8 ->DoubleFormatter[sizeof(it8 ->DoubleFormatter)-1] = 0; in cmsIT8DefineDblFormat()