Skip to content

Commit 63d4a41

Browse files
authored
Fix PF_NO_SHELL build (#217)
Move convertDictionaryInfoRead() out of conditional so it can be called by pfLoadDictionary().
1 parent daad339 commit 63d4a41

2 files changed

Lines changed: 29 additions & 27 deletions

File tree

csrc/pf_cglue.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,4 +100,6 @@ Err CreateGlueToC( const char *CName, ucell_t Index, cell_t ReturnMode, int32_t
100100

101101
return 0;
102102
}
103+
#else
104+
#warning "CreateGlueToC() not compiled. OK"
103105
#endif

csrc/pf_save.c

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -299,6 +299,33 @@ int IsHostLittleEndian( void )
299299
return (int) (*bp); /* Return byte pointed to by address. If LSB then == 1 */
300300
}
301301

302+
/* Convert dictionary info chunk between native and on-disk (big-endian). */
303+
static void
304+
convertDictionaryInfoWrite (DictionaryInfoChunk *sd)
305+
{
306+
/* Convert all fields in DictionaryInfoChunk from Native to BigEndian.
307+
* This assumes they are all 32-bit integers.
308+
*/
309+
int i;
310+
uint32_t *p = (uint32_t *) sd;
311+
for (i=0; i<((int)(sizeof(*sd)/sizeof(uint32_t))); i++)
312+
{
313+
Write32BigEndian( (uint8_t *)&p[i], p[i] );
314+
}
315+
}
316+
317+
static void
318+
convertDictionaryInfoRead (DictionaryInfoChunk *sd)
319+
{
320+
/* Convert all fields in structure from BigEndian to Native. */
321+
int i;
322+
uint32_t *p = (uint32_t *) sd;
323+
for (i=0; i<((int)(sizeof(*sd)/sizeof(uint32_t))); i++)
324+
{
325+
p[i] = Read32BigEndian( (uint8_t *)&p[i] );
326+
}
327+
}
328+
302329
#if defined(PF_NO_FILEIO) || defined(PF_NO_SHELL)
303330

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

350-
/* Convert dictionary info chunk between native and on-disk (big-endian). */
351-
static void
352-
convertDictionaryInfoWrite (DictionaryInfoChunk *sd)
353-
{
354-
/* Convert all fields in DictionaryInfoChunk from Native to BigEndian.
355-
* This assumes they are all 32-bit integers.
356-
*/
357-
int i;
358-
uint32_t *p = (uint32_t *) sd;
359-
for (i=0; i<((int)(sizeof(*sd)/sizeof(uint32_t))); i++)
360-
{
361-
Write32BigEndian( (uint8_t *)&p[i], p[i] );
362-
}
363-
}
364-
365-
static void
366-
convertDictionaryInfoRead (DictionaryInfoChunk *sd)
367-
{
368-
/* Convert all fields in structure from BigEndian to Native. */
369-
int i;
370-
uint32_t *p = (uint32_t *) sd;
371-
for (i=0; i<((int)(sizeof(*sd)/sizeof(uint32_t))); i++)
372-
{
373-
p[i] = Read32BigEndian( (uint8_t *)&p[i] );
374-
}
375-
}
376-
377377
/****************************************************************
378378
** Save Dictionary in File.
379379
** If EntryPoint is NULL, save as development environment.

0 commit comments

Comments
 (0)