[comp.sys.mac.programmer] TranSkel, TransEdit help...

henges@ingr.com (John Hengesbach) (09/08/89)

I am using Transkel, TransEdit, et al. and I have a couple of questions.

1)  Why is there a hard coded limit of 32K for a file to be editted?  I
    hvae seen this on DA's such as MockWrite (only its 28K there).  Is
    this just a "lazier" way of not worrying about whether there will
    be enough memory?  Shouldn't SetHandleSize() work for arbitrary
    lengths of memory, with some method for checking is it worked
    correctly?  Certainly it is possible to edit files (for instance)
    that are greater than some arbitrary limit near this 32K boundary.

2)  On the same thread of thought, once memory is allocated for the
    file in a text window, when/how does it get freed up again?

John (my eventLoop is anxiously awaiting) Hengesbach


-- 
John Hengesbach
   ..!uunet!ingr!henges				Intergraph
   henges@ingr.com 				1 Madison Industrial Park
   (205)772-2000 				Huntsville, Alabama 35807

earleh@eleazar.dartmouth.edu (Earle R. Horton) (09/09/89)

In article <6383@ingr.com> henges@ingr.com (John Hengesbach) writes:
>
>I am using Transkel, TransEdit, et al. and I have a couple of questions.
>
>1)  Why is there a hard coded limit of 32K for a file to be editted?

TransEdit uses TextEdit for editing text.  TextEdit uses short integers
in places that guarantee a serious error if the text being edited is
more than 32k characters in length.  When the average amount of RAM in
a Mac was 128k, and when 32k was a HUGE chunk of memory, then you might
have scraped by using TextEdit as the base for a RAM-based text editor.
Now, however, things are different and TextEdit is only useful as a
support module for the Dialog Manager.

****************************************************************************
* In my opinion, those who attempt to use TextEdit as the base for a       *
* serious text editor perpetuate the myth that the Mac is a toy.  Out of   *
* eighteen Sample Code packages on apple.com, three are attempts at a text *
* editor using TextEdit.  Phhht!                                           *
****************************************************************************

There is no rule that says you cannot write your own text handling
package.  Many people have done so.

>2)  On the same thread of thought, once memory is allocated for the
>    file in a text window, when/how does it get freed up again?

Wrfhf Shpxva Puevfg, lookit the code, willya?  It's in Clobber() in
TransEdit.c.

Earle R. Horton

omh@brunix (Owen M. Hartnett) (09/12/89)

In article <6383@ingr.com> henges@ingr.com (John Hengesbach) writes:
>1)  Why is there a hard coded limit of 32K for a file to be editted?  I
>    hvae seen this on DA's such as MockWrite (only its 28K there).  Is
>    this just a "lazier" way of not worrying about whether there will
>    be enough memory?  Shouldn't SetHandleSize() work for arbitrary
>    lengths of memory, with some method for checking is it worked
>    correctly?  Certainly it is possible to edit files (for instance)
>    that are greater than some arbitrary limit near this 32K boundary.
 The 32K limit is a limitation of TextEdit, Apple's text editing routines.
Think (Symantec) used to sell a variation of TextEdit called Capps' which
overcame the limit, but it's been discontinued (sob!).  Right now, the
only solution to overcome this is to write your own textediting routines
or patch Apple's.  Patching Apple's routines has been done by a few
people, but is not recommended, because every now and then they change
TextEdit and break your code.  (Unfortunately, they still can't overcome
the 32K barrier!  Also, they don't support tabs.  This would be one of
the first things I'd fix in System 7.0.  Really, when you think of the
Macintosh philosophy (the user should have control!) and then you look
at TE (the user is limited to a 32K file.  User: What does 32K mean?)
and it would be rather simple to put it right, at least as simple as
multitasking.)

>2)  On the same thread of thought, once memory is allocated for the
>    file in a text window, when/how does it get freed up again?
>

You can free it up with a TEDispose toolbox call.

-Owen

Owen Hartnett
Brown University Computer Science

omh@cs.brown.edu.CSNET