Skip to content
Merged
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
2 changes: 2 additions & 0 deletions csrc/pf_cglue.c
Original file line number Diff line number Diff line change
Expand Up @@ -100,4 +100,6 @@ Err CreateGlueToC( const char *CName, ucell_t Index, cell_t ReturnMode, int32_t

return 0;
}
#else
#warning "CreateGlueToC() not compiled. OK"
#endif
54 changes: 27 additions & 27 deletions csrc/pf_save.c
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,33 @@ int IsHostLittleEndian( void )
return (int) (*bp); /* Return byte pointed to by address. If LSB then == 1 */
}

/* Convert dictionary info chunk between native and on-disk (big-endian). */
static void
convertDictionaryInfoWrite (DictionaryInfoChunk *sd)
{
/* Convert all fields in DictionaryInfoChunk from Native to BigEndian.
* This assumes they are all 32-bit integers.
*/
int i;
uint32_t *p = (uint32_t *) sd;
for (i=0; i<((int)(sizeof(*sd)/sizeof(uint32_t))); i++)
{
Write32BigEndian( (uint8_t *)&p[i], p[i] );
}
}

static void
convertDictionaryInfoRead (DictionaryInfoChunk *sd)
{
/* Convert all fields in structure from BigEndian to Native. */
int i;
uint32_t *p = (uint32_t *) sd;
for (i=0; i<((int)(sizeof(*sd)/sizeof(uint32_t))); i++)
{
p[i] = Read32BigEndian( (uint8_t *)&p[i] );
}
}

#if defined(PF_NO_FILEIO) || defined(PF_NO_SHELL)

cell_t ffSaveForth( const char *FileName, ExecToken EntryPoint, cell_t NameSize, cell_t CodeSize)
Expand Down Expand Up @@ -347,33 +374,6 @@ static cell_t WriteChunkToFile( FileStream *fid, cell_t ID, char *Data, int32_t
return -1;
}

/* Convert dictionary info chunk between native and on-disk (big-endian). */
static void
convertDictionaryInfoWrite (DictionaryInfoChunk *sd)
{
/* Convert all fields in DictionaryInfoChunk from Native to BigEndian.
* This assumes they are all 32-bit integers.
*/
int i;
uint32_t *p = (uint32_t *) sd;
for (i=0; i<((int)(sizeof(*sd)/sizeof(uint32_t))); i++)
{
Write32BigEndian( (uint8_t *)&p[i], p[i] );
}
}

static void
convertDictionaryInfoRead (DictionaryInfoChunk *sd)
{
/* Convert all fields in structure from BigEndian to Native. */
int i;
uint32_t *p = (uint32_t *) sd;
for (i=0; i<((int)(sizeof(*sd)/sizeof(uint32_t))); i++)
{
p[i] = Read32BigEndian( (uint8_t *)&p[i] );
}
}

/****************************************************************
** Save Dictionary in File.
** If EntryPoint is NULL, save as development environment.
Expand Down