[comp.sys.mac.hypercard] Hypercard stack structure? Corrupted Stack.

A.Stenhouse@massey.ac.nz (Alan Stenhouse) (10/01/89)

Hi, I hope someone can help me.

Our department has a bibliographic Hypercard stack which contains all the
journals, articles, and theses that are contained in our small library.
Unfortunately, this stack has become corrupted:

It comes up with an error message of:

"Can't read card or background ID 44289 at location 5112".

I have tried writing a script that will copy each individual card from the
corrupted stack to a new stack. Ideally this would stop when it came to the
corrupted card. Then I could go to the next card and copy the rest.

Unfortunately, the error message comes up as soon as I try to do anything
within the stack. So I cannot go to any card within the stack once it's open,
nor can I copy any card.

What I've been doing now is having a look at the structure of the stack itself.
I cannot find the card with an ID of 44289 (Hex AD01). I can find something
with an ID of 44289 though. It is preceded by PAGE within the stack structure.
It isn't a card - is it a background? I don't think it is because there are
many occurrences of PAGE within the stack, but only two backgrounds. Can
anyone tell me what PAGE signifies?

Also, can anyone give me the structure of Hypercard stacks - i.e. the
representation used for a card, background etc., so that I can attempt to fix
it, or suggest a good way to fix it. We have a (dated :-() backup, and we
don't really want to enter the rest of the data again!

Thanks in advance, Alan.

* Alan Stenhouse	| Phone     0064 63 69099 ext. 8745
* Computer Science Dept | Fax.      0064 63 505611
* Massey University	| Internet: A.Stenhouse@massey.ac.nz
* Palmerston North      | Janet:    A.Stenhouse@nz.ac.massey
* New Zealand           | DON'T PANIC!
*------------------------------------------------------------*

dan@Apple.COM (Dan Allen) (10/04/89)

In article <144cs-sunb@massey.ac.nz> A.Stenhouse@massey.ac.nz writes:
>Unfortunately, this stack has become corrupted:
>It comes up with an error message of:
>"Can't read card or background ID 44289 at location 5112".
>It is preceded by PAGE within the stack structure.
>Also, can anyone give me the structure of Hypercard stacks - i.e. the

The number one cause of stack corruption, according to the best results
that we can gather, is due to shutdown XCMDs and other ways of turning
the computer off while HyperCard is updating the disk.  HyperCard will
normally write everything to disk while idling so that this occurs
rarely, but shutdown XCMDs often corrupt stacks anyway.

When you get an error message like the one mentioned, you are
temporarily out of luck.  That's the bad news.  The good news is that we
are working on a utility that we hope to release someday that will fix
corrupted stacks.  In the meantime, you can use FEdit or some other disk
editor to see the actual text stored in fields.

The PAGE object in a HyperCard stack is used internally by HyperCard and
does not contain any user data on it.  User data is stored on CARDs and
graphics are stored in BMAPs.  The full structure of HyperCard stacks is
not available to the public at this time.  If you are really interested
in obtaining the file format to HyperCard stacks, contact Apple's Legal
department which will, in special circumstances, license the file format
at its discretion.

Here are ways to prevent getting corrupted stacks:

* Do not use ShutDown XCMDs
* Backup up stacks often, preferably to hard disks, as floppies wear out
  quickly when used with HyperCard stacks, since HyperCard is so disk
  intensive.  (Floppies that are used often--several times a day--only
  last a few months at a time anyway)
* Quit HyperCard normally, i.e., without pulling the plug, turning off
  the Mac while still in HyperCard, etc.
* Do not use just any XCMD, as improperly written XCMDs can trash things
  quite easily.  Make sure the XCMDs you use (or write!) are robust.

* Use the latest version of HyperCard, which is currently 1.2.2 for most
  of the older Macs and 1.2.5 for the Portable and IIci.  If you are
  using 1.2.2 on a Plus, SE, SE/30, II, or IIcx, you do not need
  to upgrade to 1.2.5 unless you have huge stacks (8 MB or larger in
  size and more than 8000 cards).  Remember that 1.2.5 requires System
  6.0.4 as well.

Hope this helps.

Dan Allen
HyperCard Team
Apple Computer

gft_robert@gsbacd.uchicago.edu (10/05/89)

In article <35236@apple.Apple.COM>, dan@Apple.COM (Dan Allen) writes...
[discussion of hypercard corruption]
> 
>When you get an error message like the one mentioned, you are
>temporarily out of luck.  That's the bad news.  The good news is that we
>are working on a utility that we hope to release someday that will fix
>corrupted stacks.  In the meantime, you can use FEdit or some other disk
>editor to see the actual text stored in fields.


Well, I got a similar message to the one mentioned above in a month old
project.  But I can still open a very recent backup, which may or may not be
corrupted (I've been crashing all along during my development, since I'm
beta-ing a product which works with HC, and my project is not always stable).

The $64,000 question is: if I copy all the objects from my old (corrupted)
stack to a new one, and I copy the background and stack scripts, will that give
me a new, uncorrupted stack?    (I know I could copy all the scripts of the
buttons, but talk about a pain...)

Any info _very_ much appreciated.

Robert

============================================================================
= gft_robert@gsbacd.uchicago.edu * generic disclaimer: * "It's more fun to =
= crsp_ra@gsbacd.uchicago.edu    * all my opinions are *  compute"         =
=                                * mine                *  -Kraftwerk       =
============================================================================

dan@Apple.COM (Dan Allen) (10/10/89)

In article <5675@tank.uchicago.edu> gft_robert@gsbacd.uchicago.edu writes:
>The $64,000 question is: if I copy all the objects from my old (corrupted)
>stack to a new one, and I copy the background and stack scripts, will that give
>me a new, uncorrupted stack?    (I know I could copy all the scripts of the
>buttons, but talk about a pain...)

Probably.  Oftentimes you cannot copy one of the objects because it has
been corrupted, but if you can copy them all and successfully do a
compact stack, then you probably (99 44/100%) have a clean stack.

Sorry that I cannot be more exact, but software projects as big as
HyperCard still have many unknowns in them.

Dan Allen
HyperCard Team