Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add direct formatting option to ImageKeyword struct with tests #63

Open
wants to merge 2 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions ImCreate_cube.c
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,10 @@ int main()
strncpy(imarray.kw[2].value.valstr, "ImCreate_cube", KEYWORD_MAX_STRING-1);
strncpy(imarray.kw[2].comment, "source value", KEYWORD_MAX_COMMENT-1);

strcpy(imarray.kw[3].name, "keyword_custom");
imarray.kw[3].type = 'F';
strcpy(imarray.kw[3].format, "%6.2f");
imarray.kw[3].value.numf = 12.335;

free(imsize);

Expand Down
6 changes: 6 additions & 0 deletions ImCreate_img.c
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,12 @@ int main()
imarray.kw[2].type = 'S';
strcpy(imarray.kw[2].value.valstr, "Hello!");

strcpy(imarray.kw[3].name, "keyword_custom");
imarray.kw[3].type = 'F';
strcpy(imarray.kw[3].format, "%6.2f");
imarray.kw[3].value.numf = 12.335;


float angle;
float r;
float r1;
Expand Down
8 changes: 5 additions & 3 deletions ImageStruct.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,15 @@
#ifndef _IMAGESTRUCT_H
#define _IMAGESTRUCT_H

#define IMAGESTRUCT_VERSION "2.00"
#define IMAGESTRUCT_VERSION "2.01"

#define STRINGMAXLEN_IMAGE_NAME 80
#define STRINGMAXLEN_FILE_NAME 200
#define STRINGMAXLEN_DIR_NAME 800

#define KEYWORD_MAX_STRING 16 /**< maximun size of the keyword's name */
#define KEYWORD_MAX_COMMENT 80 /**< maximun size of a keyword's comment */
#define KEYWORD_MAX_FORMAT 8 /**< maximun size of a keyword's format */

// comment if no write history
//#define IMAGESTRUCT_WRITEHISTORY
Expand Down Expand Up @@ -165,13 +166,14 @@ extern "C" {
* The IMAGE_KEYWORD structure includes :
* - name
* - type
* - (optional) formatter string
* - value
*/
typedef struct
{
char name[KEYWORD_MAX_STRING]; /**< keyword name */
char type; /**< N: unused, L: long, D: double, S: 16-char string */
uint64_t : 0; // align array to 8-byte boundary for speed
char type; /**< N: unused, L: long, D: double, S: 16-char string, F: formatted */
char format[KEYWORD_MAX_FORMAT]; // String formatter for card when type is F

union
{
Expand Down