AppleLink
APPLE II DEVELOPEMENT FORUM CONFERENCE LOG
July 25, 1989  10:00 p.m. eastern time
Topic:  Pascal and C Programming
Forum Leader:  Dave Sugar  (AFL Dyfet)

AFL Dyfet  Okay, LISTEN UP...we will be using PROTOCOL STARTING NOW
          :)....Good evening and
AFL Dyfet  welcome to the Apple II Development Forum.  Tonight's topic is
          Pascal and C,
Windrider5 what's does "expressing" mean?
Imcreator  I WANT 5.0
JimLaz     (CMS is suppossed to be working on a native SCSI driver for their
          card.
AFL Dyfet  and we ARE using PROTOCOL, which means we WILL get to everyone's
          QUESTION in
AFL Dyfet  turn.  Our first question this evening is from Windrider.  GA
          Windrider.
Windrider5  What does "expressing" mean?
Dave Lyons a lot of information is consolidated into one segment at the
          beginning of the
Dave Lyons load file so ExpressLoad can load the file faster.  Applications,
          DAs, setup
Dave Lyons files, tools, EXE files, & any other load files I missed can all
          be expressed.
Windrider5 does this work for program written in higher languages?
Dave Lyons (Stuff that ships on 5.0 already comes expressed.)  Oh, drivers
          too.  ga
Dave Lyons Yes, any S16 or EXE file can be expressed.  Any "load file".
Dave Lyons (ga)
AFL Dyfet  Some applications may not work after being expressed.  In
          particular, an
AFL Dyfet  application that calls the loader directly to bring it's own
          segments in will
AFL Dyfet  not work correctly.
Dave Lyons !
Dave Lyons Right, an application that loads its dynamic segments *by number*
          rather than
Dave Lyons name will not work after it's been expressed, when you try to run
          it under
Dave Lyons  *earlier* system software.  It *will* work under 5.0, since
          ExpressLoad knows
Dave Lyons how to translate pre-expressed segment numbers into new segment
          numbers; but
Dave Lyons for maximum compatibility we recommend applications load segments
          by *name*
Dave Lyons only, not number.  Another reason an application could break after
          being
Dave Lyons expressed is that it stores data (configuration choices, for
          example) into
Dave Lyons hard-coded places in the file.  That's a bad idea.  (A Good Idea
          is to request
Dave Lyons a Configuration filetype/auxtype assignment from Developer
          Technical Support.
Dave Lyons Mail stop is now 75-3T!)  ga
AFL Dyfet  I was not aware myself that the loader was revised for expressload
          support :)
AFL Dyfet  Okay, I see that our next question is from BillP.  GA Bill.
Dave Lyons It wasn't; ExpressLoad gets first whack at all Loader calls that
          are made,
Dave Lyons assuming that it's around.  ga
BillP      I have recently been working with a company doing Apple II
          development and they are using...
BillP      Aztec C....   is it used often?
BillP      In AII development that is.
BillP      ga
AFL Dyfet  Hmm...I used to putter around with Aztec C myself, but that was a
          long time
BillP      I assume that it is not the best environment but the only C
          available for 8 bits?   yes?
Windrider5 ?
AFL Floyd  !
AFL Dyfet  ago.  There is also Hyper C, but it could not genorate stand alone
          appl.
AFL Dyfet  easily.
AFL Dyfet
AFL Dyfet
AFA Gary J Hmmm...  It seems that Dave has a malfunction.  GA with your
          comment, Floyd.
AFL Floyd  From people I've talked to who have used it for // use, one must
          write your own std libraries since
AFL Floyd  the supplied ones stink.  Bill, you might want to send mail to
          WalkerA (Walker Archer of Quality
AFL Dyfet  Okay...I think I was frozen out...
AFL Floyd  computers) he has much experience with it.
AFL Floyd  ga
BillP      ok  kinda what I thought   thanks
AFL Dyfet  I can things commming in again!  Okay...I believe our next
          question is from
Morentis   Greetings, and good evening.
AFL Dyfet  WindRider again.  GA Windrider...
Windrider5 I have some problems when I compact programs which I have written
          in APWC
Windrider5 Should compacting higher level programs be any problem?
Dave Lyons !
AFL Dyfet  GA Dave...
Dave Lyons Shouldn't be a problem--what is going wrong for you?  Compacts
          without error,
Dave Lyons but crashes, hangs, etc when you run the compacted application?
          Or what?
Windrider5 my programs does not expect input into editlines in my dialogs
Windrider5 except that is
Dave Lyons You type keys and the program behaves as if you didn't type any
          keys?  But
Dave Lyons no other noticable effects?
Windrider5 Yes
Dave Lyons Is there a blinking insertion point in the edit line item?
AFL Dyfet  <Scott: Received>
Windrider5 Yes
AFL Scott  <Thanks!>
Dave Lyons Can't think of anything directly related to the compacting that
          would cause
AFL Dyfet  <Get flash I sent?>
Dave Lyons that, Windrider.  Maybe something random is going on that just
          happens to let
AFL Scott  <Yep!>
AFL Scott  ?
Dave Lyons your program work most or all of the time when it's not compacted.
           If you can
Dave Lyons send me the object code by email, I'll take a look at it.  ga
Windrider5 thanks ga
AFL Dyfet  Hmm...Well, Dave is very good at tearing into object modules
          :)...I believe
AFL Dyfet  our next question is from Scott.  You have the floor now, Scott.
AFL Scott  I have a rather strange question concerning fread and fwrite using
          stdin and
AFL Scott  stdout as the stream qualifier... Are there known bugs in the
          shell that cause
AFL Scott  stdin and stdout to be messed up in such a way that causes a file
          to be written
AFL Scott  twice the size as required?
Dave Lyons !
AFL Dyfet  GA Dave...
Dave Lyons Are you trying to write single bytes?  Not sure if fwrite()
          supports writing
Dave Lyons odd lengths.  ga
AFL Scott  No, trying to write 1 unit of 200 bytes, Dave.
Coach101   !
AFL Dyfet  GA Coach...
Coach101   I looked at your code segments Scott, and the first thing I
          would
Coach101   do is put in printfs just in front of the fread and fwrite to
          verify
AFL Floyd  !
Coach101   the the "count" variables are not getting messed up.  You could
          possibly
AFL Scott  Done... still no go
Coach101   Drat....   Oh well.....  Sorry,  ga
AFL Dyfet  GA Floyd...
AFL Scott  No problem Coach, Thanks!:)
AFL Floyd  I uploaded two IDENTICAL source files to Scott.  THe only
          difference was one used stdin/stdout and
Ransomdawn ?
AFL Floyd  the other used regular file (fopen, fclose, etc).  The
          stdin/stdout one didn't work and the other
AFL Floyd  one did.  Most strange.
AFL Floyd  The fread and fwrite calls were identical except for the different
          stream.
AFL Floyd  fread(buf, cols, 1, stdin) vs fread (buf, cols, 1, in_file)
AFL Floyd  ga
AFL Dyfet  Thought: Perhaps stdin/stdout is handled through text tools and
          NOT via GS/OS!
AFL Scott  That's what I think I need to find out... if there are any known
          bugs in the
AFL Scott  piping/redirection stuff in the APW or ORCA shells.  Thanks!
AFL Dyfet  A good place to start is to see if you can do any seek calls on
          stdio, since
AFL Dyfet  you cannot, of course, through text tools itself...:)
AFL Scott  Thanks! GA
AFL Floyd  (testing that right now. :)
AFL Scott  Thanks Floyd!  It must be nice to have two computers!:))
AFL Dyfet  Basically, try writing 100 bytes to stdout, seek -50, and write
          again.  If it
AFL Dyfet  works, you get 150, if not, you get 200 :)
AFL Dyfet  Well, while floyd is tinkering, we can move onto the next
          question, unless
AFL Dyfet  somebody else wishes to make a comment here.
AFL Dyfet  Okay, RansomDawn, you now have the floor, GA.
Ransomdawn As a relative programming newcomer, I am wondering what
          differences...
Ransomdawn ..may exist in the graphics power of pascal versus C?
AFL Dyfet  In both cases, it's entirely a matter of the support routines and
          libraries
AFL Dyfet  provided with the product, and not the language itself, which
          dictates the
AFL Dyfet  quality and level of graphics support.
AFL Dyfet  There is no part of either Pascal or C, in of itself, that
          specifies any
AFL Dyfet  graphics capabilities.  I hope that was clear...
AFL Scott  !
AFL Dyfet  GA Scott.
AFL Scott  You'll find out that most graphics text books use Pascal as the
          language of
AFL Scott  choice.. Foley, Van Dam, and other titles... But there is no
          difference as
AFL Scott  Dave said...  Pascal is chosen for text books because it's easier
          to read.
Pest II    ?
AFL Dyfet  In the case of the IIgs, both languages have support added to take
          advantage
AFL Scott  The power is all depending on the implementation.  GA
AFL Dyfet  of quickdraw.  It's entirely a matter of which language you find
          easier to
Ransomdawn O.k. Thanks
AFL Dyfet  write in.  Okay, I believe our next question is from Pest.  GA
          Pest.
Pest II    I heard recently that the 2 devices per slot limitation in Apple
          II's was
Pest II    tied to the hardware...is this true even for the GS??
Dave Lyons !
AFL Dyfet  GA Dave...
Dave Lyons Two devices per slot is a limitation of ProDOS 8, not of the
          hardware.  GS/OS
Dave Lyons lets you have plenty of devices (and therefore volumes) per slot,
          although
Dave Lyons there are still some hardware limitations (you can't *actually*
          daisy-chain
Dave Lyons 127 drives off the SmartPort connector without melting something),
          and
Dave Lyons individual drivers may limit the number of devices they manage.
          You can
Dave Lyons have 32 partitions off of one slot with the SCSI.MANAGER in 5.0.
          ga
Pest II    but does a SCSI chain work, and does a CD ROM under GS/OS need the
          funny
Pest II    partitioning?
Pest II    or can it be seen as one volume
Dave Lyons A CD ROM daisy-chained after my hard drive works just fine, with
          no special
Dave Lyons fiddling.  ProDOS partitions are still limited to 32 Megs, of
          course, but if
Dave Lyons you have an ISO 9660 / High Sierra CD, the ISO 9660 / High Sierra
          FST can read
Dave Lyons it with no problem.
AFL Dyfet  Okay, are there any additional comments?  Floyd, any news?
Pest II    !BTW: AApple Direct owned up to their CD SCSI error...thanx, ga
Dave Lyons (ga)
AFL Floyd  Checking now.  I had a phone call.
AFL Dyfet  Okay, feel free to fill up that question que while we're
          waiting.
AFA Gary J <wait wait....>
AFA Parik  ?
MrJayDee   What's the topic du jour???
AFL Dyfet  GA Parik, you have the floor now...
AFA Parik  will deleting CDEVS and CDEVS.INIT have any awful effects upon
          5.0?
AFL Dyfet  Yes, you will be told to sit in a corner and repeat "I will buy an
          IBM" 500
AFL Dyfet  times if you do that :)
AFA Parik  also - EXPRESS *can* be used in orca or apw v1.0.2, right?  or 2.0
          ONLY?
AFA Parik  :P
Dave Lyons !
AFL Dyfet  GA Dave...
AFA Parik  (I still can't figure out why most of the programs i express don't
          work  :((
Dave Lyons Yes: you won't be able to use the CDevs.  :-)    But if you don't
          want to use
Dave Lyons them, that's okay.  ga
AFL Floyd  (fseek doesn't work with STDOUT!)
AFL Dyfet  Just as I suspected...the stdio library is gimmied up to work with
          text tools.
AFL Scott  !
Coach101   I wonder about its behaviour under Apw 2.0?
AFL Floyd  I wrote out 200 bytes, seeked to 50 bytes from the beginning and
          wrote out 200 again.  Got 400 bytes
AFL Floyd  written to the file.
AFL Dyfet  GA Scott...
JSchober   (sheesh!)
AFL Scott  I wonder if this relates to the fact that all the descriptions in
          the text
AFL Scott  tools say "Characters", and I'm trying to use functions written to
          handle
AFL Scott  binary streams?  This doesn't make sense tho, since text in a
          computer is
AFL Scott  binary.
AFL Dyfet  But text tools really only knows about text...it may strip the hi
          bits or do
AFL Dyfet  other horrible things...:)
AFL Scott  Oh boy!  Looks like it's time to use other means... and forget
          about pipes
AFL Scott  and redirection.
AFL Scott  Thanks Floyd, you've been very helpful!  Now I owe you more than I
          did before!
AFL Scott  :)
AFL Scott  Thanks!  Done
AFL Floyd  (I'll send ya a bill ;)
AFA Gary J :)
AFL Scott  (LOL!:)
AFL Dyfet  You may want to send a letter to Mike Westerfield on this matter
          for further
AFL Dyfet  comments, especially in regards to what orca/c may be doing...
AFL Scott  ?
AFL Floyd  My test was with Orca/C.
AFL Floyd  It's the shell, not the language.
Coach101   !
AFL Dyfet  GA Coach...
AFL Floyd  (Oh, sorry, I didn't know protocol was still in effect)
Coach101   From an architectural point of view, does it really make sense
Pest II    ?
Coach101   for seek to work on the STDOUT stream?  Given the *standard* use
          of
Coach101   pipes seeking on the output seems a somewhat non-standard?
Coach101   ga
Dave Lyons !
AFL Dyfet  GA Dave...
Dave Lyons No, I don't think it makes much sense.  STDOUT could be the
          console or printer;
Dave Lyons on a system with concurrent processes it could be a pipe to
          another process
Dave Lyons that could munch your output before you fseek() back to "retract"
          it.  Doesn't
Dave Lyons make sense except for a file.  ga
AFL Floyd  !
AFL Dyfet  I'll let Floyd jump in..GA Floyd...
AFL Floyd  That's not the point, the original test case didn't use fseek,
          just standard fread and fwrite and
AFL Floyd  it didn't work correctly with stdin/stdout, but worked fine with
          regular file. ga
Coach101   OK, I got confused as to why we were testing with fseek...  Why
          were we
Coach101   testing with fseek?
AFL Dyfet  Okay, we did drift from the original issue...part of why fseek was
          used was
AFL Floyd  To see if maybe the shell was using the text tools instead of
          operating system.
AFL Dyfet  to determine if stdio was handled by different routines than
          'normal' file I/O.
AFL Floyd  (Sorry, I'll sit on my hands. ;)
AFL Dyfet  Or, as Floyd summed up.  Since stdin/stdout is a handle, it SHOULD
          support
AFL Dyfet  fseek when stdin/stdout is pointing to a file, for consistancy
          with the rest of
AFL Dyfet  the standard file library, in my opinion.
AFL Floyd  !
AFL Dyfet  GA Floyd.
AFL Floyd  fseek, fread, fwrite, etc. are supposed to work with all STREAMS,
          whether they are stdin, or other.
AFL Floyd  ga
Coach101   !
AFL Dyfet  GA Coach...
Coach101   But, that would be impossible in a multi-tasking system where
          you
Coach101   were piping to another process that, as Dave pointed out, could
          eat
Coach101   your output (i.e., process it) before you *recalled* it.  I think
          that
Coach101   if you intend to support piping of your output you had better
          not
Coach101   use fseek on stdout.  ga
AFL Dyfet  Any stream, and NOT just stdin/stdout, can be pointed to a pipe,
          virtual
AFL Scott  (Gary kill my question an put me in for a comment!:))
AFL Dyfet  circut, or device, coach...however, when it's pointing to a file
          it will seek,
AFA Gary J :)
AFL Dyfet  and stdin/stdout are just streams, like any other file stream, or
          should be,
AFL Dyfet  in my opinion.
Dave Lyons (Off to the msg base...flash me if I'm needed!)
Coach101   !
AFL Dyfet  The great debate continues :)...GA Coach.
AFL Scott  Basically what we are dealing with in this case is not a proper
          handling of
AFL Floyd  !!!
AFL Scott  stream data, period.
Coach101   Ok, but if we have a strict implementation that allows fseek at
          all
Coach101   times irregardles of where the output *might* go, then we
          preclude
Coach101   any overlapped processing by cooperating tasks in a
          multi-tasking
AFL Scott  Wait.. change that to improper handling of stream data... Sorry to
          butt in.. :)
Coach101   environment.  My basic point is that if your program wants to
          support
Coach101   piping of an output stream it has to be prepared for certian
          things
Coach101   not functioning the same as with a file.    ga
AFL Dyfet  fseek should return an error if the stream is not seakable...but
          again, I feel
AFL Dyfet  stdin/stdout are supposed to be 'standard' file streams in their
          behavior.
Coach101   Agreed on the error that should be returned.  And agreed that what
          we
Coach101   have found here is a bug.  My whole point was on an architectural
          ground
AFL Scott  This really is not a good situation.  It is restricting _any_
          program working
Coach101   and not on what had happened Scott.  .....  Geez Scott you are a
          trouble maker
AFL Scott  on stream data to working with TEXT only.  Not good, at all!
AFL Dyfet  Yes, Scott, you are :)
AFL Floyd  I just tested the same thing with THINK C on the Mac and it
          properly seeks with stdout.  BTW, the
AFL Floyd  original test code that didn't work with the GS shell worked fine
          on the Mac.
Pest II    -?
AFL Dyfet  Floyd, you will find that unix and MS-DOS will do so correctly
          also :)
Coach101   Three computers Floyd!!!!
AFL Floyd  No, MultiFinder. ;)
AFL Dyfet  Sorry if we lost your question in this debate, Pest...
Pest II    that's OK
AFL Dyfet  There are a number of script interpreters written in unix, with
          the idea that
AFL Scott  I like being a trouble maker on occasion!  It makes me feel good
          that I'm not
AFL Scott  the one who's crazy!:)
AFL Dyfet  goto branching can be done by seeking on stdin when it's
          redirected from a
AFL Dyfet  file...these, I see, will also fail to work.
Pest II    and they call me the Pest!?...:)
AFL Dyfet  AFL Pest :)
Coach101   fseek on stdin is a totally different issue!  I have not problems
          there.
Pest II    that has a nice ring to it...
AFA Gary J I don't think Scott want's to change his name to that  :)  It
          goes without
AFA Gary J saying  :)
AFA Gary J (heheh)
AFL Scott  LOL!
Coach101   :)
AFL Dyfet  But coach, you can't have it one way on one side of the pipe and
          another on
AFL Dyfet  the other :):)
Coach101   Not true.  The problem with fseeking on the output side is that it
          prohibits
AFL Floyd  (I'm outta here.  Later peoples!)
Coach101   multiporcessing.  Fseeking on the input side does not carry such a
          penalty.
JSchober   (night Floyd!)
Coach101   On System-V Unix systems the piped to process will kick off
          before
AFA Gary J Goodnight, Floyd
Coach101   completion of the piping process!    e.g.,  ls -l | pg
Coach101   ga
AFL Dyfet  Let's table this to the message board, coach, before we scare the
          rest away :)
AFA Gary J I think we ARE the rest :)
Coach101   Fine....
Pest II    I'm scared :)
AFL Dyfet  By the way, Pest, what was your question?
Coach101   Your supposed to show respect and awe Pest :)
AFL Scott  I can finally get some sleep!:)
Pest II    nothing really...hardly as exciting as fseek and piping...or even
          dogcows
AFL Scott  ps -ef|grep -i sleep