@@ -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
304331cell_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