HDTenEightyP/NetNews huggingface dataset:
From: bpb9204@tamsun.tamu.edu (Brent)
Subject: Re: yacc/lex -like utilities for thinkC?
Organization: Texas A&M Univ., Inc.
Date: Thu, 27 Aug 1992 14:31:39 GMT

pollansw@cse.fau.edu (Warren Pollans) writes:
|Are there utilities like the unix yacc and lex available for use
|with thinkC?  I'm taking a compiler-writing course and would like
|to do as much as possible of the project (1000-1500 lines) at home
|on my SE (2.5M, probably expanded to 4M).  At worst, I can write
|and test modules at home and put the whole thing together on the
|unix system (sunOS).

Yes, there are a few.  For lex, there is GNU's Flex (fast lexer generator)
and for yacc there is MacYacc, GNU's bison, and Berkeley yacc (byacc).

MacYacc may not even be available anymore; it was free but some say it was
buggy.  I never used it for anything.

I have found that Bison works great.  While it produces huge C source files,
they compile to almost half of what an AT&T yacc parser would!  Also, bison
has been reengineered (not a port of AT&T yacc) so it's much more efficient.
AND, bison can be made compatible with yacc.

I have never used byacc.
GNU's flex works fine for me, also.

Now that I have the quick rundown of the available tools, I want to make some
comments.  First, if you use the GNU tools, be aware they come with certain
licenses and policies that you may not like.  See their Copyright files
(included with the programs) for details.  Personally, I didn't have a problem
with their policies.

Second, you can quickly develop a compiler with flex and bison.  For my
compiler design project, we had to write a compiler for a subset of pascal.
Within two hours I had a working flex/bison-based parser.  Unfortunately,
we had to hand-code everything (and we really learned how LL(1) & LALR(1)
parsers click!).  ;-)

If you have to hand-code your scanner ("lexer") and parser, you can still 
find flex and bison great for testing.  Use both tools in the beginning to
get a feel for the grammar you are parsing; it turned out our prof gave us
many ambiguities in our language, which added about 50% more rules to the
original grammar.  Once you have the grammar figured out, hand-code your
lexer and test it with the bison parser.  Finally, code the parser.

Hope this helps someone.

-Brent, N5VMG
 bpb9204@tamsun.tamu.edu
From: trimper@edsi.plexus.COM (Greg Trimper)
Newsgroups: comp.sys.mac.programmer
Subject: Re: MacApp 3.0 upgrade
Date: 28 Aug 92 06:01:33 GMT
Article-I.D.: edsi.1992Aug28.060133.6127
Organization: Enterprise Data Systems Incorporated, Appleton WI

simoneau@jupiter.regis.uqam.ca (Martin Simoneau) writes:

>I received the latest APDA Catalog, and I would like to
>upgrade to MacApp 3.0 from 2.0.1 (I'm not a ETO Member).
>In the requirement it's mentioned  that I need 16 mega.
>of RAM!! (page 43).
>I hope this is an error, does anybody know?


"Note: We reccomend you use a minumum 16Mb Macintosh System for
developing MacApp applications..."

Recommend.  Meaning I am either buying 4 4Mb SIMMS next week, or
am about to explore virtual memory as a day to day affair.

zGreg Trimper   trimper@edsi.plexus.com  
Newsgroups: comp.sys.mac.programmer
From: lawe@enea.se (Lars Westin)
Subject:  Help on `sortRange' in Alpha 5.0 Tcl
Organization: Enea Data AB
Date: Thu, 27 Aug 1992 22:02:42 GMT

   Has anyone out there managed to do something useful with the (built-in) Tcl
proc `sortRange' in Alpha 5.0?
   I suppose arguments `fromPos' and `toPos' indicate starting and ending lines
in the text to be sorted, is that right?
    All attempts to use this proc for sorting any text have resulted in Alpha
hanging, so far (Cmd-Shift-Option-<esc> helps, though). I'm running Sys7 with
TuneUp 1.0 on a SE30. Any help and/or tcl code snippets would be appreciated.
    Thank you!


-- 
-------------------------------------------------------------------------------
Lars Westin - ENEA Data, Stockholm - lawe@enea.se

Newsgroups: comp.sys.mac.programmer
From: davidr@mentorg.com (David Ransier)
Subject: Re: GNU C++ for the Macintosh?
Organization: engr
Date: Fri, 4 Sep 1992 16:41:25 GMT

In article <4SEP199200002780@rosie.uh.edu> englhp@rosie.uh.edu (Lester, Samuel H.) writes:
>In article <38357@unix.SRI.COM>, mxmora@unix.SRI.COM (Matt Mora) writes...
>>In article <15834.2AA3F783@zeus.ieee.org> Glen.Stewart@f175.n2240.z1.ieee.org (Glen Stewart) writes:
>>>I see that GNU C++ supports over 40 different processors and comes with source 
>>>code.  Is it avaiable as a running Macintosh program?
>> 
>>>If so, can you tell me what BBS would have it, or how much it would cost to
>>>ship by mail to me?
>> 
>> 
>>Check on ftp.apple.com. It should be there. 
>> 
>> 
>The gcc in mpw.gnu on ftp.apple.com has a script that allows you to 
>use C++, but requires MPW C++ to run (at least according to the docs).
>I assume that the version in the gnu dir has not been converted to work
>with MPW.  
>
>Are there any other sources for an MPW converted gnu C++?
>
>Thanks,
>		Samuel
>

I read something about this recently that explained the reason for needing
MPW C++ to run GNU G++.  Apparently, G++ does not have its own class libraries,
or maybe it was missing C-Front (pardon my lack of concise-ness here, I'm 
just starting down the C++ path).  In any case, G++ does not use MPW's C++
compiler, only it's class libraries.

David Raniser   davidr@pdx.mentorg.com
From: chuck@gte.com (Chuck Hoffman)
Newsgroups: comp.sys.mac.programmer
Subject: Sound Manager Callback
Date: 1 Sep 92 19:55:02 GMT
Followup-To: comp.sys.mac.programmer
Organization: GTE Laboratories

I'm just getting into the Sound Manager and am using the simple note
synthesizer.  I created a sound resource with ResEdit (created my own 'snd
' template) and the sound plays fine from ResEdit and my program.  Playing
asynchronously.  When the sound is done, I have a CallBackCmd to invoke my
callback routine which simply sets a flag so that I can later dispose of
the channel and release the sound resource.  I've done this by putting the
callback command at the end of the sound resource, and by using
SndDoCommand to insert into the buffer.  In both cases, it works correctly
about 2 of 3 times.  Can't set a THINK C debugger breakpoint in the
callback routine because of crashes (a conflict with the memory manager?),
but the main event loop sees the variable as if it has not been set.  I've
tried code updating the flag (in a global variable) directly, and I've
tried passing the address of the variable to the subroutine and getting at
it that way.  Same symptom no matter what.  Any ideas?


Chuck Hoffman
chuck@gte.com
GTE Laboratories, Waltham, Massachusetts, USA
(617) 466-2131
=====================================
I'm not sure why we're here, but I am sure that while we're here we're
supposed to help each other.
=====================================
Newsgroups: comp.sys.mac.programmer
Subject: Re: Still trying to get this stupid sound stuff to work...
From: jmatthews@desire.wright.edu
Date: 27 Aug 92 13:54:43 EST
Organization: Wright State University 

In article <1992Aug26.192610.14018@utkux1.utk.edu>, danny@utkux1.utk.edu (Danny W. McCampbell) writes:
> Will someone tell me what I can do to this code to cause the sound
> to play transparently.  What I mean is after the sound starts playing
> a modal dialog is brought up.  I want the user to be able to click
> in the dialog and when he/she does the sound stops and the dialog
> disappears.  What is happening now is the sound sound starts playing,
> the dialog comes up, but you cannot do anything until the sound 
> finishes.  Check it out:

When you call SndNewChannel, add a call back routine to let you know when
the sound is done:

  procedure SndEnd (sndPtr: SndChannelPtr; theCmd: SndCommand);
    var
      a5: LongInt;
  begin
    a5 := SetA5(theCmd.param2);
    sndDone := true; {a global variable}
    a5 := SetA5(a5)
  end;

  procedure PlaySound (sndID: Integer);
    var
      sndPtr: SndChannelPtr;
      sndHdl: Handle;
      sndErr: OSErr;
      sndCmd: SndCommand;
  begin
    with sndCmd do {prepare a call back command}
      begin
        cmd := callBackCmd;
        param1 := 0;
        param2 := SetCurrentA5 {needed at interrupt time}
      end;
    sndPtr := SndChannelPtr(NewPtrClear(SizeOf(SndChannel)));
    if sndPtr <> nil then
      begin
        sndPtr^.qLength := stdQLength; {just to be sure}
        sndHdl := GetResource('snd ', sndID);
        if sndHdl <> nil then
          begin
            if SndNewChannel(sndPtr, 0, initMono, @SndEnd) = noErr then
              begin
                sndErr := SndPlay(sndPtr, sndHdl, true);
        {add a call back cmd to this channel's queue}
                sndErr := SndDoCommand(sndPtr, sndCmd, false);
        {continue execution while snd plays}
                DoOtherStuff; {while polling sndDone}
                sndErr := SndDisposeChannel(sndPtr, false)
              end;
            ReleaseResource(sndHdl)
          end;
        DisposPtr(Ptr(sndPtr))
      end
  end;

If the user clicks on the ShutUp button before sndDone turns true, send 
a quietCmd (I think).

o----------------------------------------------------------------------------o
| John B. Matthews, jmatthews@desire.wright.edu, disclaimer:= myViews <> WSU |
| "I'm a commensal .sig virus, indistinguishable from an ordinary organelle."|
o----------------------------------------------------------------------------o
From: Eric.J.Baumgartner@dartmouth.edu (Eric J. Baumgartner)
Newsgroups: comp.sys.mac.programmer
Subject: Re: using oop for XCMD's
Date: 27 Aug 92 16:21:09 GMT
Organization: Dartmouth College, Hanover, NH
X-Posted-From: InterNews1.0d56@newshost.dartmouth.edu

In article <1992Aug26.231617.7145@kronos.arc.nasa.gov>
joshr@kronos.arc.nasa.gov (Joshua Rabinowitz-Summer-91) writes:

> Is it possible to use think c's object oriented class
> library to wirte XCMD's ?  My off the cuff answer is NO, as it uses globals
> which are OUTLAWED in XCMD's.

You can't use TCL or MacApp. You can use THINK C and OOP, but you have
to create your own classes and fiddle with A4. If you want a class for
an example external window, let me know.

Eric Baumgartner                   *  ebaum@dartmouth.edu
Interactive Media Lab              *  - When in danger or in doubt,
Dartmouth Medical School           *      run in circles, scream and
shout.
Newsgroups: comp.sys.mac.programmer
From: reed@snake.tc.cornell.edu (Michael G. Reed)
Subject: Re: Formatting a disk in the background
Followup-To: comp.sys.mac.programmer
Keywords: background, disk formatting
Reply-To: reed@Theory.TC.Cornell.EDU
Organization: Cornell National Supercomputing Facility
Date: Tue, 1 Sep 1992 12:12:35 GMT

In article <1992Aug31.223046.8274@microsoft.com>, peterbak@microsoft.com (Peter Bako) writes:
|> 
|> I have a small application that automatically formats disk, but
|> can only do so while it is in the foreground.  How can I make
|> the program be able to format a disk in the background?  Either
|> by running the program in the background, or to move it there once
|> it has started its process.
|> 
I don't think it can be done.  The problem is that reads/writes to floppy 
disks are VERY time critical.  Therefore, most OS's will disable interupts
and require the formatting code to run exclusively if you want a "properly"
formatted disk.  This happens on the mac (that's why the mouse "jumps" when
you are formatting disks...the mouse is interupt driven), so I don't think 
you're going to be able to get around it with Apple's routines...You could
always write your own disk I/O routines :) (just kidding).

-Michael

-----------------------------------------------------------------------------
Michael G. Reed                                  (reed@Theory.TC.Cornell.edu)
Cornell National Supercomputing Facility                       (607)/254-8806
-----------------------------------------------------------------------------
        Why be normal, it's boring; and boring people should be shot.

Note:  These are not the views of my employer (and probably not mine either).
From: d88-jwa@dront.nada.kth.se (Jon W{tte)
Newsgroups: comp.sys.mac.programmer
Subject: Re: Set/Get Cursor
Date: 2 Sep 92 12:38:55 GMT
Organization: Royal Institute of Technology, Stockholm, Sweden
Originator: d88-jwa@dront.nada.kth.se

> sbill@informix.com (Bill Stackhouse) writes:

   Why does the following cause EvenBetterBusError detect a NIL pointer
   problem?

      SetCursor(*GetCursor(iBeamCursor));



Because there's no iBeamCursor, OR you haven't locked the handle,
OR the handle has been purged.

Try:

	Handle h ;
	char state ;

	h = ( Handle ) GetCursor ( iBeamCursor ) ;
	if ( h ) {

		if ( ! * h ) {

			LoadResource ( h ) ;
		}
		state = HGetState ( h ) ;
		HLock ( h ) ;
		SetCursor ( ( Cursor * ) * h ) ;
		HSetState ( h , state ) ;
	}

Only 10xx longer than your code, but it's the way you've
gotta program these days. Don't whimp out.

-- 
Jon W{tte, h+@nada.kth.se, Sweden, Phone +46-8-107069
White, Literate, Employed, Higher-Educated, Male, Straight and Not Poor.
I must be a bad guy.
From: lai@Apple.COM (Ed Lai)
Newsgroups: comp.sys.mac.programmer
Subject: Re: AEDisposeDesc
Date: 27 Aug 92 16:34:01 GMT
Organization: Apple Computer Inc., Cupertino, CA

In article <w0bn2sb.mspace@netcom.com> mspace@netcom.com (Brian Hall) writes:
>Is it safe to call AEDisposeDesc on an AEDesc more than once?  I "<noticed
>that after the call, the AEDesc passed in had a type of "typeNull" and
>a datahandle of "NULL".  Does AEDisposeDesc know enough not to try and
>dispose of a record like that?

Whenever the dataHandle is NIL, AEDisposeDesc is a nop, since AEDisposeDesc
changes the AEDesc to typeNull dataHandle nil after disposing, accidential
calling AEDisposeDesc again would not hurt.

>
>On a related note, is it safe to call AEDisposeDesc when the AEDesc is
>{0, NULL} (essentially 0,0)) instead of { typeNull, NULL}?  This, of course,
>assumes that it is OK to call AEDisposeDesc on {typeNull, NULL} in
>the first place.
>

See above.

>If it is not OK, I think I will end up making a ForgetAEDesc along
>the lines of TCLs ForgetHandle routine.
>
>-- 
>
> \ | /   | Brian Hall                 mspace@netcom.com
> - : -   | Mark/Space Softworks       Applelink: markspace
>  /|\    |                            America Online: MarkSpace
> |-+-|   |
>/-\|/-\  | Stupidity is its own punishment.

/* Disclaimer: All statments and opinions expressed are my own */
/* Edmund K. Lai                                               */
/* Apple Computer, MS37-UP                                     */
/* 20525 Mariani Ave,                                          */
/* Cupertino, CA 95014                                         */
/* (408)974-6272                                               */
zW@h9cOi
Newsgroups: comp.sys.mac.programmer
From: dbb@well.sf.ca.us (David B. (Ben) Burch)
Subject: Using MacApp Streams for Serial I/O???
Organization: Whole Earth 'Lectronic Link
Date: Sat, 29 Aug 1992 19:19:41 GMT

Hello!  I am writing an application that does serial port I/O in MacApp 3.0.1.
Has anybody had success in adapting the iostream class to serial communications?

I would greatly appreciate code fragments or pointers to FTP-able code, as I
am charting some (to me) black waters.  Thanks!

-Ben Burch
dbb@well.sf.ca.us
From: cconstantine@galaxy.gov.bc.ca
Newsgroups: comp.sys.mac.programmer
Subject: Re: #pragma once whoes!!! Plea for help!
Date: 31 Aug 92 15:42:47 -0700
Organization: BC Systems Corporation

In article <1992Aug31.135459.935@galaxy.gov.bc.ca>, cconstantine@galaxy.gov.bc.ca writes:
> I have a rather interesting problem if I may impose on you THINK C 5 gurus out
> there.  The problem seems to be with the #pragma once directive.  I have this
> directive at the top of each of my header files (of which there are 5 or 6) an
> d I have 4 source files, 3 of which #include "AppGlobals.h".  I am _STILL_
> getting a Link Error of "Multiply defined: symbol (where symbol is my global
> var)" I have even tried using the #ifndef ... #endif set of things and still
> get this error.  I have trashed my project and recompiled, still the same
> thing.
> 
> Is there something I'm missing here.  I shouldn't be getting this.  BTW, I
> don't believe I've got this type of error before.
> 
> Any help would be _MUCHLY_ appreciated.
> 
> P.S. to Keith Rollin (a.k.a. the Phantom Programmer) I've bought your first
> book with Scott Knaster and am enjoying it thouroghly (sp?)!!!
> 

BTW the conflict is with the following section in my AppGlobals.h unit:

Boolean		gQuitting;
Boolean		gInBackground;
WindowPtr	gMessageWindow;
RgnHandle	gCursorRgn;

It is these 4 globals that I am getting the Multiply defined error on.  They
are in my AppGlobals.h file (as previously mentioned) and I've #included it in
3 files.  NO OTHER CONSTANTS OR STRUCTS OR ANYTHING IS GETTING THE ERROR, JUST
THESE 4 VARIABLES!!!!!!!

 Carl B. Constantine
 CCONSTANTINE@galaxy.gov.bc.ca
 	"Opinions are my own and are not necessarily those of my employer"
Newsgroups: comp.sys.mac.programmer
From: rjr@titan.ucc.umass.edu (Richard J. Resnick)
Subject: Event Loop
Organization: University of Massachusetts, Amherst
Date: Tue, 1 Sep 1992 15:27:20 GMT

Hello,

I don't know if it is "ok" protocol to post code questions here... I apologize
in advance for any annoyance I may create. I did check the faq, and it wasn't
any help. 

I am a beginning MAC programmer, and am working with the event loop thingy.
I am trying to write a simple program which brings up the text window, and
then just runs through the event loop until you click on the menu bar. But when
I run it, it just hangs on me, and the debugger says that isEvent is _never_
true! Will someone enlighten me as to why this code doesn't work? Thanks in 
advance.

begin

  repeat
    isEvent := GetNextEvent(everyEvent, thisEvent);

    case thisEvent.what of
        nullEvent: {Do nothing} 
           begin
           end;
        mouseDown: {where is the mouse clicked?}
           begin
              whereIsIt := FindWindow(thisEvent.where, thisWindow);

              case whereisIT of
                  0, 3: {In drawing window}
                     gameOver := false;
                  1: {in Menubar}
                     gameOver := true;
              end; {case whereIsit}

           end; {mouseDown}

        otherwise:
           begin
           end;

    end; {case thisEvent.What}
  until gameOver;

end.

*=====/=== ===^=====.==='========`============/==== = ^========~====/====^ =-=*
*        "I'll return your fire, if you take away your vultures..."           *
*                       - Prometheus, gaining leverage                        *
*===^==/=======\======= ===`====='===> ==========>====.===== =^=====/====*====*
                  Internet Address: rjr@titan.ucc.umass.edu



Newsgroups: comp.sys.mac.programmer
From: roy@alanine.phri.nyu.edu (Roy Smith)
Newsgroups: comp.sys.mac.programmer
Subject: Re: incrementation differences/THINK C 4.0 vs. 5.0
Date: 28 Aug 92 14:36:14 GMT
Organization: Public Health Research Institute (New York)

sdorner@qualcom.qualcomm.com (Steve Dorner) writes:
>It does *not* know where the missing ";" should go.  It knows where
>something is missing.  An '=' would be a perfectly good choice, too.

	I've been thinking about this for a day or so.  In the fragment
"a=b=c d=e;" the blank could be replaced with just about anything and make
a syntactically correct statement:

	Any alphanumeric would turn "c d" into a variable name.

	Any binary arithmentic operator (+, -, *, /)would be fine.

	Any relational operator (==, !=, <, >, <=, >=) would be fine.

	Any boolean operator (||, &&) would be fine.

	Any binary logical operator (&, |, etc) would be fine.

	Any assignment operator (=, =+, =-, =*, =/) would be fine.

	Deleting the space completely would give you the variable "cd".

	A comma would be fine, giving you two sequential assignments.

	All things considered, the a-priori probability that you need to
replace the space by a semicolon is pretty slim.
-- 
roy@wombat.phri.nyu.edu (Roy Smith)
Public Health Research Institute
455 First Avenue, New York, NY 10016, USA
"This never happened to Bart Simpson."
From: bowman@reed.edu (Eric Bowman (bobo))
Newsgroups: comp.sys.mac.programmer
Subject: Things I'd like to see: SourceBug
Date: 1 Sep 92 18:37:15 GMT
Article-I.D.: reed.1992Sep1.183715.22867
Organization: Reed College, Portland, OR

OK, SourceBug is written in MacApp, right?  And SourceBug, though lame 
compared to Think's debugger, is still not bad; it's nice having all classes
there in a nice TTextListView.  But what could be easier than adding a
TKeySelectionBehavior to a TTextListView?  And what could be easier than
typing the first few letters of the class you seek, rather than mindlessly
scrolling through the list?

OK, Mike Lockwood, how about it?  3 lines of code is all it would require,
and it would make me (am I alone out there?) so very hoppy.

later,
bobo
bowman@reed.edu
Newsgroups: comp.sys.mac.programmer
From: zben@ni.umd.edu (Charles B. Cranston)
Subject: Re: updating window text / getting text lines from buffer
Followup-To: comp.sys.mac.programmer
Organization: UM Home for the Terminally Analytical
Date: Fri, 28 Aug 1992 19:08:26 GMT

In article <1992Aug25.232449.12720@kronos.arc.nasa.gov>,
joshr@kronos.arc.nasa.gov (Joshua Rabinowitz-Summer-91) wrote:

> ...  there is a method of reading from 
> a file documented somewhere in IM for getting the filemanager to
> parse files into lines delimited by any desired char ('\n' in this case)
 
> If anyone has written a code snippet that does this, pls. inform me
> as to how this is done.  Posting here is okay, but mailing me a code snippet
> would be godly.

var
	junk:	Integer;
	Buff:	Packed Array[0..255] of SignedByte;
	PBRec:	ParamBlockRec;
begin		
	PBRec.ioRefNum := theFile;
	PBRec.ioBuffer := @Buff;
	PBRec.ioPosMode := $0D80;  <<----80 is read till EOL bit, 0D is CR!
	PBRec.ioPosOffset := 0;
	PBRec.ioReqCount := 256;
	junk := PBReadASync(@PBRec);
	UseText(PBRec.ioActCount,@Buff);

Yipe, I figured this out so long ago I was still doing Pascal...
Bear skins and stone knives...

zben@ni.umd.edu     -KA3ZDF
From: hp48sx@wupost.wustl.edu (HP48SX Archive Maintainer)
Newsgroups: comp.sys.mac.programmer
Subject: HighLevel AE, CountAppFiles, drag-n-drop
Date: 29 Aug 1992 18:43:23 -0500
Organization: Washington University in Saint Louis, MO USA
NNTP-Posting-Host: wuarchive.wustl.edu

I have a drag-n-drop application that currently uses CountAppFiles to
determine how many files it receives on startup, and uses GetAppFiles to
get them out. If there is no files opened at startup, then the program
stays open. Otherwise it exits after processing the files.

I am now converting it to use HighLevel Apple events. My problem is that
CountAppFiles does not work then. So I am going to call
GetSpecificcHighLevelEvent to look for 'odoc' events in the queue.
Can I do this before entering my event loop ? Or should I always process
the OpenApplication event before processing other events ?

If I do background processing, will WaitNextEvent then return the next
event every time ? Or will I get null-events ? If I do not want to
process the next event in the queue because I am not done with the
previous event, how do I then release CPU time to other jobs ? Is it
necesary to parse the events all the time, and then make my own queue
with all the info from the 'odoc' events to make it work as it should ?

-- 
Povl H. Pedersen             hp48sx@wuarchive.wustl.edu
HP48sx archive maintainer

All Opinions (C) Copyright the Intergalactic Thought Association