david@linc.cis.upenn.edu (David Feldman) (10/05/87)
Fellow programmers, I am writing a specialized editor, and I need to save its data structures to a file to make it restartable of course. The data structures are not very nice. The first is a doubly linked list. Easy? Well, add a third link to each cell such that this third link can point to any other cell in the list. To make it worse, some cells have pointers to the ends of other lists. Obviously what I need is a mapping function from cell addresses to reasonable integers. The problem is how to represent this mapping when writing the data structures out to the file. If I keep the unique number in the cell, then deletion causes gaps in the series which makes reading in the cells harder. When reading in, just malloc an array of cells and convert unique indexes into addresses of array elements that correspond to those indexes. However, I want this to run on PCs with segmented data blocks, so I may not be able to malloc the whole array in one chunk. Does anyone have a way around these problems? I want the mapping information to be as space efficient as possible. Similarly, I need to save open hash tables. The hash tables in question are multiply hashed, that is there are n sets of hash domains, and each hash table pointer entry has n pointers, one for each domain. Each hash table entry itself has n pointers to point to the next entry at that hash value for each of n hash systems. Thus a program label entry can have data describing its string value, and its index. N would thus be two since there would be two ways to search the hash table. There must be an easier way of doing these things than the way I have in mind. Please send ideas via E-mail. I will post any really neat ideas. Thanx in advance. David P. Feldman david@linc.cis.upen.edu.ARPA david@128.91.2.8