[comp.sys.mac.programmer] Think C Request

kent@sunfs3.camex.uucp (Kent Borg) (10/21/89)

Request for a very simple feature in Think C:

When the resource file for a project is not available (because I have
it open ResEdit), Think C should complain instead simply letting my
program die.

Now that I have been bitten by this problem enough to complain, I
suspect that I won't make this mistake any longer, but fix it anyway.
A lot of other people are making the same mistake.  Make their lives
easier.

Thanks for producing such a great product in general.
-- 
Kent Borg				"Then again I could be foolish 
kent@lloyd.uucp				 not to quit while I'm ahead..."
or					     -from Evita (sung by Juan Peron)
...!husc6!lloyd!kent			 

macgyver@banana.cis.ohio-state.edu (wilson m liaw) (10/22/89)

In article <541@sunfs3.camex.uucp> kent@lloyd.UUCP (Kent Borg) writes:
>
>Request for a very simple feature in Think C:
>
>When the resource file for a project is not available (because I have
>it open ResEdit), Think C should complain instead simply letting my
>program die.
>....

	The thing is, THINK C doesn't know if it should look for it. I 
am assuming that everytime you run a project, THINK C tries to open a file
which is called <project-name>.rsrc, and if the process fails THINK C assums
that there is no rsrc file needed for this project. 

				Mac

Disclaimer:I speak for no one!


-=-
Wilson "Mac" Liaw                     Internet   : macgyver@cis.ohio-state.edu
CompuServe : 71310,1653               GEnie : W.Liaw
===============================================================================
When the going gets tough, the tough quits. :) 

beard@ux1.lbl.gov (Patrick C Beard) (10/23/89)

In article <69099@tut.cis.ohio-state.edu> wilson m liaw <macgyver@cis.ohio-state.edu> writes:
>In article <541@sunfs3.camex.uucp> kent@lloyd.UUCP (Kent Borg) writes:
>>
>>Request for a very simple feature in Think C:
>>When the resource file for a project is not available (because I have
>>it open ResEdit), Think C should complain instead simply letting my
>>program die.
>
>	The thing is, THINK C doesn't know if it should look for it. I 
>am assuming that everytime you run a project, THINK C tries to open a file
>which is called <project-name>.rsrc, and if the process fails THINK C assums
>that there is no rsrc file needed for this project. 
>

Ah, but THINK C can certainly check for the existence of such a file,
a la PBHGetFInfo, to see if the file exists, and is already open from
another application.  Other applications seem to be able to do it (including
ResEdit!).

THINK C should definitely be changed to work this way.

While we're on the subject, how about project specific pre-processor 
variables?  While it's great that we can check for THINK_C to see if
that's the current environment, I would also like to be able to check
for A4 vs. A5 relative global generation, 68020 code generation, and
any arbitray thing I want!  For example, I would like to be able to
parallel development of code resources, apps, and da's, sharing sources
whereever possible, but I can't because I generally have to do slightly
differnt things depending on the code/globals generation.

So, a dialog box that let's me create #define's specific to a project.
Please Rich, please!



-------------------------------------------------------------------------------
-  Patrick Beard, Macintosh Programmer                        (beard@lbl.gov) -
-  Berkeley Systems, Inc.  ".......<dead air>.......Good day!" - Paul Harvey  -
-------------------------------------------------------------------------------

pollock@ziggy.EDU (Wayne Pollock) (10/24/89)

>In article <541@sunfs3.camex.uucp> kent@lloyd.UUCP (Kent Borg) writes:
=>...  Request for a very simple feature in Think C:
=>
=>When the resource file for a project is not available (because I have
=>it open ResEdit), Think C should complain instead simply letting my
=>program die.
=>....
>	The thing is, THINK C doesn't know if it should look for it. I 
>am assuming that everytime you run a project, THINK C tries to open a file
>which is called <project-name>.rsrc, and if the process fails THINK C assums
>that there is no rsrc file needed for this project. 

This is probably correct; however, there is no reason that Think C can't
first look for the file, then only try to open it if it exists.  If it
exists but can't be opened, Think C should issue a warning message.

Wayne Pollock (The MAD Scientist)	pollock@usfvax2.csee.usf.edu
Usenet:		...!{gatech!uflorida!}usfvax2!pollock
GEnie:		W.POLLOCK

siegel@endor.harvard.edu (Rich Siegel) (10/24/89)

In article <541@sunfs3.camex.uucp> kent@lloyd.UUCP (Kent Borg) writes:
>
>Request for a very simple feature in Think C:
>
>When the resource file for a project is not available (because I have
>it open ResEdit), Think C should complain instead simply letting my
>program die.

	A more flexible way to do it would be to have a check box in
the "Set Project Type" dialog indicating that a resource file should be
used, as THINK Pascal does it.

	Not everybody uses resource files, so giving an error when there
isn't one is not correct behavior.

R.
~~~~~~~~~~~~~~~
 Rich Siegel
 Staff Software Developer
 Symantec Corporation, Language Products Group
 Internet: siegel@endor.harvard.edu
 UUCP: ..harvard!endor!siegel

"There is no personal problem which cannot be solved by sufficient
application of high explosives."

~~~~~~~~~~~~~~~

)) (10/24/89)

In article <2937@husc6.harvard.edu> siegel@endor.UUCP (Rich Siegel) writes:

>>When the resource file for a project is not available (because I have
>>it open ResEdit), Think C should complain instead simply letting my
>>program die.

>	A more flexible way to do it would be to have a check box in
>the "Set Project Type" dialog indicating that a resource file should be
>used, as THINK Pascal does it.
>	Not everybody uses resource files, so giving an error when there
>isn't one is not correct behavior.

No, but I don't think that's the point. OK, I had to actually
look ain the index and READ how to get resource files into
your project short of pasting the resources into the project
file, but the point here is that if you have specified a
resource file, and it can't be opened, the environment should
warn you and give you a chance to bail out.

After all, "File not found" and "File busy" are different
error conditions both on the IBM PC, under UNIX, and on the
Mac 8)

Happy Hacking !

						h+@nada.kth.se
-- 
$400,000,000,000 is a large sum of money.

cy@dbase.UUCP (Cy Shuster) (10/24/89)

In article <4001@helios.ee.lbl.gov> beard@ux1.lbl.gov (Patrick C Beard) writes:
>While we're on the subject, how about project specific pre-processor 
>variables? 

Amen to that!

It would also be nice to be able to save your environment: status of
open source windows (size and location), breakpoints, and data window
contents.  This is about the only area where SADE is superior, IMHO.

--Cy--

tim@hoptoad.uucp (Tim Maroney) (10/24/89)

In article <541@sunfs3.camex.uucp> kent@lloyd.UUCP (Kent Borg) writes:
>When the resource file for a project is not available (because I have
>it open ResEdit), Think C should complain instead simply letting my
>program die.

In article <2937@husc6.harvard.edu> siegel@endor.UUCP (Rich Siegel) writes:
>	A more flexible way to do it would be to have a check box in
>the "Set Project Type" dialog indicating that a resource file should be
>used, as THINK Pascal does it.
>	Not everybody uses resource files, so giving an error when there
>isn't one is not correct behavior.

That wasn't the complaint at all, Rich.  If you have the resource file
open in ResEdit and you launch your project, Think C says "out of
memory" and that's all.  This is not good bug reporting (and it has
nothing to do with the very different non-error case when the resource
file does not exist).  All that's needed is to check ResError() against
the file already open error and show a correct error message instead of
"out of memory" when this happens.  This is one of those two-minute
changes.
-- 
Tim Maroney, Mac Software Consultant, sun!hoptoad!tim, tim@toad.com

"Gorbachev is returning to the heritage of the great Lenin" - Ronald Reagan

kent@sunfs3.camex.uucp (Kent Borg) (10/26/89)

In article <69099@tut.cis.ohio-state.edu> wilson m liaw <macgyver@cis.ohio-state.edu> writes:
.>In article <541@sunfs3.camex.uucp> kent@lloyd.UUCP (Kent Borg) writes:
.>>
.>>Request for a very simple feature in Think C:
.>>
.>>When the resource file for a project is not available (because I have
.>>it open ResEdit), Think C should complain instead simply letting my
.>>program die.
.>>....
.>
.>	The thing is, THINK C doesn't know if it should look for it. I 
.>am assuming that everytime you run a project, THINK C tries to open a file
.>which is called <project-name>.rsrc, and if the process fails THINK C assums
.>that there is no rsrc file needed for this project. 

I almost bought your answer, but I think not.

Think C shouldn't assume so much, it should look at the error.
Couldn't it notice the difference between "fnfErr -43 /*File not
found*/" and "opWrErr -49 /*file already open with with write
permission*/"?

If the file is not found, forget it, but if I already have it open in
ResEdit, please make some noise.

-- 
Kent Borg				"Wouldn't it be fun not to be famous?
kent@lloyd.uucp				 Wouldn't it be fun not to be rich?"
or					     -Cole Porter lyric (from Aladdin)
...!husc6!lloyd!kent			 

macgyver@banana.cis.ohio-state.edu (wilson m liaw) (10/27/89)

In article <545@sunfs3.camex.uucp> kent@lloyd.UUCP (Kent Borg) writes:
[stuffed]
>I almost bought your answer, but I think not.
>
>Think C shouldn't assume so much, it should look at the error.
>Couldn't it notice the difference between "fnfErr -43 /*File not
>found*/" and "opWrErr -49 /*file already open with with write
>permission*/"?
>
>If the file is not found, forget it, but if I already have it open in
>ResEdit, please make some noise.

	I guessed that Think C assumed so much from Think C's behavior. 
I don't really know how this is done in the source level, as I am in no mood
to disassembly Think C. (Though it would be educational.) I do agree that
Think C shouldn't assume so much if my guess is right..

				Mac



-=-
Wilson "Mac" Liaw                     Internet   : macgyver@cis.ohio-state.edu
CompuServe : 71310,1653               GEnie : W.Liaw
===============================================================================
When the going gets tough, the tough quits. :)