#ifndef tu_blk_h #define tu_blk_h 1 /**** MODULE UNDER CONSTRUCTION (as off 2009/06/28) ****/ /*-------------------------------------------------------------------- | The purpose of this module (tu-blk.h .c, blk-test.c) is to allow you | to create blocks of memory and store stuff in them. Overtly, this | can be text, but there's no restriction on what goes in the blk. | There are DEF limits on the size of blks on various dos machines, | also, you might want to check on special considerations for | micro-controllers, etc. | | Note the notes under Deallocate_blk_struct(). | +------------------------------------------------------------------------*/ /*=====================*/ struct Blk_struct /*=====================*/ { char *Blk_name; /* the name assigned to by the program */ int Blk_size; /* ammount allocated ~~ [0] .. [Blk_size -1] */ int Blk_char_count; /* how much data is in it right now */ char *Blk_data; char *Blk_start, *Blk_end; /* Memory boundaries */ char *Next_read, *Last_written; struct Blk_struct *Prev, *Next; /* link list thingies */ }; #define BLK_STRUCT_SIZE sizeof(struct Blk_struct) NOTE the following was moved to TU.H /*------------- Following are flags for use with the Writeln_() funcs ----------*/ /* usually dos: cr/lf (mode=2) & unix: lf only (mode = 0) */ /* CR-ONLY is usually for over-print or plotter stuff (arcane if not archaic) */ /**************************************** | #define CRLF_MODE_NL_ONLY 0 | #define CRLF_MODE_CR_ONLY 1 | #define CRLF_MODE_CRLF 2 | | int GG_writeln_crlf_mode = CRLF_MODE_CRLF; /* set to DOS as std */ | +-------------------------------------------------------------------------*/ /*------------------------- Function prototypes -------------------------*/ void Init_tu_blk (void); struct Blk_struct *Allocate_blk_struct (char *Block_name, int Size); short Deallocate_blk_struct (struct Blk_struct *Blk); /** NOTE the notes for this func in the tu-blk.c file!!! ****/ void Show_blk_struct (struct Blk_struct *Blk); void Show_HEX_blk_struct (struct Blk_struct *Blk, char *Start_here, char *End_here); int Append_text_to_blk (struct Blk_struct *Blk, char *Xs); int Write_blk_to_outfile (struct Blk_struct *Blk); int Writeln_blk_to_outfile (struct Blk_struct *Blk, short Crlf_mode); #endif /* tu_blk_h */