From f98fa73353a56af879ad76e787096ba87ea3be3b Mon Sep 17 00:00:00 2001 From: schnetter Date: Sat, 29 Jan 2005 18:11:53 +0000 Subject: Use CCTK_BYTE instead of CCTK_CHAR. Store CCTK_BYTE as UINT8 instead of CHAR. git-svn-id: http://svn.cactuscode.org/arrangements/CactusPUGHIO/IOFlexIO/trunk@334 ebee0441-1374-4afa-a3b5-247f3ba15b9a --- src/DumpGH.c | 4 ++-- src/DumpVar.c | 8 ++++---- src/RecoverGH.c | 4 ++-- src/RestoreFile.c | 10 +++++----- src/Write.c | 4 ++-- src/Write2D.c | 10 +++++----- src/ioFlexGH.h | 2 +- 7 files changed, 21 insertions(+), 21 deletions(-) (limited to 'src') diff --git a/src/DumpGH.c b/src/DumpGH.c index 008a6ae..3b75071 100644 --- a/src/DumpGH.c +++ b/src/DumpGH.c @@ -204,7 +204,7 @@ void IOFlexIOi_DumpParameters (const cGH *GH, int all, IOFile file) if (parameters) { - FLEXIO_ERROR (IOwriteAttribute (file, GLOBAL_PARAMETERS, FLEXIO_CHAR, + FLEXIO_ERROR (IOwriteAttribute (file, GLOBAL_PARAMETERS, CHAR, strlen (parameters) + 1, parameters)); free (parameters); } @@ -258,7 +258,7 @@ void IOFlexIOi_DumpGHExtensions (const cGH *GH, IOFile file) FLEXIO_ERROR (IOwriteAttribute (file, "GH$time", FLEXIO_REAL, 1, &dtmp)); version = CCTK_FullVersion (); - FLEXIO_ERROR (IOwriteAttribute (file, "Cactus version", FLEXIO_CHAR, + FLEXIO_ERROR (IOwriteAttribute (file, "Cactus version", CHAR, strlen (version) + 1, version)); } diff --git a/src/DumpVar.c b/src/DumpVar.c index d81a71e..11e69dc 100644 --- a/src/DumpVar.c +++ b/src/DumpVar.c @@ -136,7 +136,7 @@ int IOFlexIO_DataType (int cctk_type) switch (cctk_type) { - case CCTK_VARIABLE_CHAR: retval = FLEXIO_CHAR; break; + case CCTK_VARIABLE_BYTE: retval = FLEXIO_BYTE; break; case CCTK_VARIABLE_INT: retval = FLEXIO_INT; break; case CCTK_VARIABLE_REAL: retval = FLEXIO_REAL; break; #ifdef CCTK_INT1 @@ -563,12 +563,12 @@ static void AddCommonAttributes (const cGH *GH, const ioRequest *request, itmp = malloc ((request->hdim+1) * sizeof (CCTK_INT4)); name = CCTK_FullName (request->vindex); - FLEXIO_ERROR (IOwriteAttribute (file, "name", FLEXIO_CHAR, + FLEXIO_ERROR (IOwriteAttribute (file, "name", CHAR, strlen (name) + 1, name)); free (name); name = CCTK_GroupNameFromVarI (request->vindex); - FLEXIO_ERROR (IOwriteAttribute (file, "groupname", FLEXIO_CHAR, + FLEXIO_ERROR (IOwriteAttribute (file, "groupname", CHAR, strlen (name) + 1, name)); coord_system_handle = Coord_GroupSystem (GH, name); free (name); @@ -713,7 +713,7 @@ static void AddChunkAttributes (const cGH *GH, const ioRequest *request, FLEXIO_ERROR (IOwriteAttribute (file, "chunk_dataset", FLEXIO_INT4, 1, itmp)); fullname = CCTK_FullName (request->vindex); - FLEXIO_ERROR (IOwriteAttribute (file, "name", FLEXIO_CHAR, + FLEXIO_ERROR (IOwriteAttribute (file, "name", CHAR, strlen (fullname)+1, fullname)); free (fullname); free (itmp); diff --git a/src/RecoverGH.c b/src/RecoverGH.c index be1a3a4..aa1f4dd 100644 --- a/src/RecoverGH.c +++ b/src/RecoverGH.c @@ -367,7 +367,7 @@ static int OpenFile (cGH *GH, const char *basefilename, int called_from, /* determine whether data was written using the old timelevel naming scheme. New files contain a Cactus version string attribute... */ i = IOreadAttributeInfo (file->fid, "Cactus version", &type, &dim); - file->has_version = i >= 0 && type == FLEXIO_CHAR; + file->has_version = i >= 0 && type == CHAR; if (! file->has_version) { CCTK_WARN (4, "Unable to restore 'Cactus version' attribute. " @@ -582,7 +582,7 @@ static int RecoverParameters (fileinfo_t *file) /* get the parameters attribute. */ i = IOreadAttributeInfo (file->fid, GLOBAL_PARAMETERS, &atype, &asize); - if (i >= 0 && atype == FLEXIO_CHAR && asize > 0) + if (i >= 0 && atype == CHAR && asize > 0) { parameterSize = (CCTK_INT4) asize; parameters = malloc (parameterSize + 1); diff --git a/src/RestoreFile.c b/src/RestoreFile.c index 16cd117..579576a 100644 --- a/src/RestoreFile.c +++ b/src/RestoreFile.c @@ -421,7 +421,7 @@ static int GetCommonAttributes (cGH *GH, IOFile fid, int unchunked, int *vindex, /* retrieve the name attribute */ i = IOreadAttributeInfo (fid, "name", &atype, &asize); - if (i < 0 || atype != FLEXIO_CHAR || asize >= (int) sizeof (fullname)) + if (i < 0 || atype != CHAR || asize >= (int) sizeof (fullname)) { CCTK_WARN (2, "Can't read name attribute"); return (-1); @@ -439,7 +439,7 @@ static int GetCommonAttributes (cGH *GH, IOFile fid, int unchunked, int *vindex, /* read and verify the group name */ i = IOreadAttributeInfo (fid, "groupname", &atype, &asize); - if (i < 0 || atype != FLEXIO_CHAR || + if (i < 0 || atype != CHAR || (unsigned int) asize >= sizeof (groupname_stored)) { CCTK_VWarn (2, __LINE__, __FILE__, CCTK_THORNSTRING, @@ -536,8 +536,8 @@ static int GetCommonAttributes (cGH *GH, IOFile fid, int unchunked, int *vindex, group_static_data.vartype == CCTK_VARIABLE_REAL) || (vartype_stored == FLEXIO_INT && group_static_data.vartype == CCTK_VARIABLE_INT) || - (vartype_stored == FLEXIO_CHAR && - group_static_data.vartype == CCTK_VARIABLE_CHAR) || + (vartype_stored == FLEXIO_BYTE && + group_static_data.vartype == CCTK_VARIABLE_BYTE) || #if 0 /* FIXME: Don't know how to support COMPLEX type too !! */ (vartype_stored == FLEXIO_REAL && @@ -647,7 +647,7 @@ static int GetChunkAttributes (IOFile fid, int vindex) /* retrieve the name attribute */ i = IOreadAttributeInfo (fid, "name", &atype, &asize); - if (i < 0 || atype != FLEXIO_CHAR || asize >= (int) sizeof (fullname)) + if (i < 0 || atype != CHAR || asize >= (int) sizeof (fullname)) { CCTK_WARN (2, "Can't read name attribute"); return (-1); diff --git a/src/Write.c b/src/Write.c index d06c743..232a4f4 100644 --- a/src/Write.c +++ b/src/Write.c @@ -130,7 +130,7 @@ int IOFlexIO_Write (const cGH *GH, int vindex, const char *alias) buffer[0] = 0; CCTK_ParameterFilename (sizeof (buffer), buffer); FLEXIO_ERROR (IOwriteAttribute (file->iofile, "parameter file", - FLEXIO_CHAR, + CHAR, strlen (buffer) + 1, buffer)); } if (CCTK_Equals (out_fileinfo, "creation date") || @@ -142,7 +142,7 @@ int IOFlexIO_Write (const cGH *GH, int vindex, const char *alias) buffer[len-1] = ' '; Util_CurrentTime (sizeof (buffer) - len, buffer + len); FLEXIO_ERROR (IOwriteAttribute (file->iofile, "creation date", - FLEXIO_CHAR, + CHAR, strlen (buffer) + 1, buffer)); } } diff --git a/src/Write2D.c b/src/Write2D.c index 4101c90..31f0390 100644 --- a/src/Write2D.c +++ b/src/Write2D.c @@ -108,9 +108,9 @@ int IOFlexIO_Write2D (const cGH *GH, int vindex, const char *alias) myproc = CCTK_MyProc (GH); /* get the appropriate FlexIO data type */ - if (groupinfo.vartype == CCTK_VARIABLE_CHAR) + if (groupinfo.vartype == CCTK_VARIABLE_BYTE) { - ioflex_type = FLEXIO_CHAR; + ioflex_type = FLEXIO_BYTE; } else if (groupinfo.vartype == CCTK_VARIABLE_INT) { @@ -180,7 +180,7 @@ int IOFlexIO_Write2D (const cGH *GH, int vindex, const char *alias) buffer[0] = 0; CCTK_ParameterFilename (sizeof (buffer), buffer); FLEXIO_ERROR (IOwriteAttribute (IEEEfile_2D[dir], - "parameter file", FLEXIO_CHAR, + "parameter file", CHAR, strlen (buffer) + 1, buffer)); } if (CCTK_Equals (out_fileinfo, "creation date") || @@ -192,7 +192,7 @@ int IOFlexIO_Write2D (const cGH *GH, int vindex, const char *alias) buffer[len-1] = ' '; Util_CurrentTime (sizeof (buffer) - len, buffer + len); FLEXIO_ERROR (IOwriteAttribute (IEEEfile_2D[dir], - "creation date", FLEXIO_CHAR, + "creation date", CHAR, strlen (buffer) + 1, buffer)); } } @@ -324,7 +324,7 @@ int IOFlexIO_Write2D (const cGH *GH, int vindex, const char *alias) delta_attr[0] = GH->cctk_delta_space[dir_i]; delta_attr[1] = GH->cctk_delta_space[dir_j]; - FLEXIO_ERROR (IOwriteAttribute (IEEEfile_2D[dir], "name", FLEXIO_CHAR, + FLEXIO_ERROR (IOwriteAttribute (IEEEfile_2D[dir], "name", CHAR, strlen (fullname) + 1, fullname)); itmp = GH->cctk_iteration; FLEXIO_ERROR (IOwriteAttribute (IEEEfile_2D[dir], "iteration", diff --git a/src/ioFlexGH.h b/src/ioFlexGH.h index d707288..a772233 100644 --- a/src/ioFlexGH.h +++ b/src/ioFlexGH.h @@ -18,7 +18,7 @@ /* define the IOFlexIO datatypes according to CCTK_??? datatypes */ -#define FLEXIO_CHAR CHAR +#define FLEXIO_BYTE UINT8 #ifdef CCTK_INT1 #define FLEXIO_INT1 INT8 -- cgit v1.2.3