KCMS Application Developer's Guide

Example


Example 4-5 KcsGetAttribute()

#include "./kcms_utils.h"

 KcsProfileId								profileid;
 KcsAttributeValue								*attrValue;
 int								size;
 void print_header(icHeader *hdr);

 size = sizeof(KcsAttributeBase) + sizeof(icHeader);
 attrValue = (KcsAttributeValue *)malloc(size);

 /* Get the header */
 attrValue->base.type = icSigHeaderType;
 attrValue->base.sizeOfType = sizeof(icHeader);
 attrValue->base.countSupplied = 1;
 KcsGetAttribute(profileid, icSigHeaderTag, attrValue);
 ...
 print_header(&attrValue->val.icHeader);
 ...

 void
 print_header(icHeader *hdr)
 {
 	char			charstring[5];

 	printf("Size in bytes = %d\n", hdr->size);
 	printf("CMM Id = 0x%x\n", hdr->cmmId);
 	printf("Major version number = 0x%x\n", hdr->version>>24);
 	printf("Minor version number = 0x%x\n", (hdr->version&0x00FF0000)>>16);

     switch(hdr->deviceClass) {
     case icSigInputClass :
 			printf("deviceClass = input\n");
 			break;
 	case icSigDisplayClass :
 			printf("deviceClass = display\n");
 			break;
 	case icSigOutputClass :
 			printf("deviceClass = output\n");
 			break;
 	case icSigLinkClass :
 			printf("deviceClass = link\n");
 			break;
 	case icSigAbstractClass :
 			printf("deviceClass = abstract\n");
 			break;
 	case icSigColorSpaceClass :
 			printf("deviceClass = colorspace\n");
 			break;
 	default :
 			printf("Unknown\n");
 			break;
    
 	}

 	memset(charstring, 0 ,5);
 	memcpy(charstring, &hdr->colorSpace, 4);
 	printf("colorspace = %s\n", charstring);

 	memset(charstring, 0 ,5);
 	memcpy(charstring, &hdr->pcs, 4);
 	printf("profile connection space = %s\n", charstring);

 	printf("date = %d/%d/%d,  ", hdr->date.day,hdr->date.month,
 				hdr->date.year);
     printf("time = %d:%d:%d\n", hdr->date.hours,hdr->date.minutes,
 				hdr->date.seconds);

 	memset(charstring, 0 ,5);
 	memcpy(charstring, &hdr->magic, 4);
 	printf("magic number = %s\n", charstring);

 	switch(hdr->platform) {
 	case icSigMacintosh :
 			printf("platform = Macintosh\n");
 			break;
 	case icSigMicrosoft :
 			printf("platform = Microsoft\n");
 			break;
 	case icSigSolaris :
 			printf("platform = Solaris\n");
 			break;
 	case icSigSGI :
 			printf("platform = SGI\n");
 			break;
 	case icSigTaligent :
 			printf("platform = Taligent\n");
 			break;
 	default :
 			printf("Unknown\n");
 			break;
 	}

     if(hdr->flags && icEmbeddedProfileTrue)
 			printf("Embedded profile.\n");
     else
 			printf("Non-embedded profile\n");

     if(hdr->flags && icUseWithEmbeddedDataOnly)
 			printf("If this profile is embedded, it is not allowed to strip
 						it out and use it independently.\n");
     else
 			printf("OK to strip embedded profile out and use> > # end of Para