HDTenEightyP/NetNews huggingface dataset:
From: wilcox@cmns.think.com
Newsgroups: comp.lang.lisp.mcl
Subject: _numtostring
Date: 14 Aug 92 13:28:05 GMT
Original-To: berger@soe.berkeley.edu
Original-Cc: info-mcl@cambridge.apple.com


>I need to turn an integer into a string -
>
>Does anyone out there know how to make the trap _numtostring work?
>
>Format is too slow.  Without _numtostring it looks like I will have to iterate
>over the digits of an integer and then push the individual chars into
> a vector. 
>
>thanks
>Daniel

Hey, what timing! I just happened to have a similar need for speed yesterday.
You're right - format (and prin1-to-string) is much too slow on floats.
The following code is about 5 times faster. It uses #_NumToString via the
macro with-returned-pstrs. (I tried macro-expanding the code and hand-tuning it
since I knew that the number will always be 12 characters or less, but the
code actually got slower! Why...?) Note that this only works for numbers less
than 2^32; larger numbers are subjected to mod 2^32. 

  ;; "magnitude of the integer is converted modulo 2^32"
  ;; -- Inside Macintosh I-490
  ;; so result will never be longer than 12 characters

Also note that the definition of the trap _numtostring in packages.lisp
has a spelling error: thenum should be the-num (or vice versa).

I have not tested this code extensively yet; there may be bugs. No warrantees
expressed, implied, impressed, replied, etc. Enjoy!

(deftrap _numtostring ((thenum :signed-long) (thestring (:pointer (:string 255))))
   nil
   (:no-trap (ccl::%gen-trap #xA9EE :d0 the-num :a0 thestring :word 0)))
                                           ^ should be thenum

(defun integer-to-string (number)
  "Converts an integer to a string, using the toolbox."
  (with-returned-pstrs ((string ""))
    (#_numtostring number string)
    (%get-string string)
    ))

(defun float-to-string (number fractional-digits)
  "Converts a floating-point number to a string, ~
   with a given number of digits following the decimal point."
  (let* ((integral (floor number))
         (int-string (integer-to-string integral)))
    ;; dont mess around with fractions if you dont have to
    (if (zerop fractional-digits)
      (concatenate 'string int-string ".")
      (let* ((fractional (round (* (expt 10 fractional-digits)
                                   (- number integral))))
             (fract-string (integer-to-string fractional))
             ;; pad fraction with enough zeros to separate it from decimal
             (pad-string (make-string (- fractional-digits (length fract-string))
                                      :initial-element #\0)))
        (concatenate 'string int-string "." pad-string fract-string)
        ))))
From: jd05@gte.com (John Doleac)
Newsgroups: comp.lang.lisp.mcl
Subject: Interfacing to I/O boards
Date: 12 Aug 92 19:19:00 GMT
Original-To: info-mcl@cambridge.apple.com


I am using GW's MacADIOS I/O board to interface to sensors and 
motors which are part of a control algorithm testbed.  I want to 
call C functions compiled using Symantec's Think C development
system.  These C functions are used to get data from sensors and
to give commands to motors.

The manual tells how to use foreign function calls for code
compiled by MPW.  This does not work for Think C.  Can anyone
recommend a way to overcome this problem?

I asked this question at MacWorld last week in Boston.  No one in 
the Apple booth knew much about LISP nor could they provide
any recommendations for hardware interfaces for this kind of
application.  The most consistent recommendation I got for 
interfacing to sensors and motors from a mac was to use a 
serial connection to a PC outfitted with a good I/O board.  The
PC could be used as a co-processor.

If using a serial connection to a PC is a good solution, can 
anyone recommend examples of protocols I can use?

-- John Doleac
   GTE Laboratories, Incorporated
   Waltham, MA
From: bill@cambridge.apple.com (Bill St. Clair)
Newsgroups: comp.lang.lisp.mcl
Subject: Re: CLIM-MCL(final)
Date: 14 Aug 92 20:49:17 GMT
Full-Name: Bill St. Clair
Original-To: joswig@informatik.uni-hamburg.de,
        Peter Forster <Forster@informatik.uni-stuttgart.de>
Original-Cc: info-mcl

>>There is a fully functional demo version of CLIM 1.0 (binaries)
>>on the MCL 2.0 CD-ROM - maybe this will be helpful in the interim.
>
>Sadly ;-) this is a true demo version and not fully functional.
>These guys want to sell CLIM. Macros like DEFINE-APPLICATION-FRAME
>or DEFINE-PRESENTATION-METHOD are not working.

You might try asking about CLIM for MCL 2.0 on the main CLIM mailing list:

    clim@bbn.com
From: yost@adobe.COM (David Yost)
Newsgroups: comp.lang.lisp.mcl
Subject: Wanted: MCL (local) database interface
Date: 14 Aug 92 16:49:40 GMT
Reply-To: yost@adobe.COM
Organization: Adobe Systems Incorporated

Has anyone got an MCL interface to the C-Tree or DB-Vista or other
C libraries that provide database functionality?

Or is there some other native lisp code that I could use that works with MCL?

 --dave yost
From: 71501.1347@CompuServe.COM (Jim Hurd)
Newsgroups: comp.lang.lisp.mcl
Subject: Short float arrays
Date: 17 Aug 92 05:47:44 GMT
Original-To: MCL List <info-macl@cambridge.apple.com>

>Not necessary. Since SHORT-FLOAT's are immediate objects, storing
>them in an array with an element-type of T is as good as anything.

Wouldn't arrays of short-floats eliminate some masking of the tag bits?

Jim Hurd
From: straz@cambridge.apple.com (Steve Strassmann)
Newsgroups: comp.lang.lisp.mcl
Subject: Please use "-request" line
Date: 17 Aug 92 22:00:09 GMT
Full-Name: Steve Strassmann
Original-To: info-mcl

If you have administrative requests, such as being 
deleted from info-mcl, please do not send them to
the info-mcl list.

Instead, please send them to info-mcl-request@cambridge.apple.com.

Most internet mailing lists have such a "-request" line to 
prevent swamping the mailing list.

Thank you!
From: 72110.1107@CompuServe.COM (Bruce Lester)
Newsgroups: comp.lang.lisp.mcl
Subject: LISP - Oracle
Date: 18 Aug 92 13:57:26 GMT
Original-To: MCL bulletin board <info-macl@cambridge.apple.com>

I need to generate SQL in MCL 2.0, send it to a remote Oracle database server,
and parse the result in MCL.  I would like MCL to have control of this entire 
transaction.

Has anyone attempted to communicate with Oracle using MCL?

Did anyone attend Cris Kobryn's "Interfacing Lisp to SQL Databases" tutorial 
at the "Second International Lisp Users and Vendors Conference"?

Bruce Lester
The Pillsbury Company
Minneapolis, MN 55402
From: cornell@freya.cs.umass.edu
Newsgroups: comp.lang.lisp.mcl
Subject: Opening files from the finder after mclv2.0's started
Date: 15 Aug 92 21:04:54 GMT
Original-To: info-mcl@cambridge.apple.com

I'm interested in doing this and I don't remember if someone else's
posted a solution (I remember there was a recent request about it but
I spaced it). After a little exploring I determined
ccl::open-application-document is called when I open files from the
Finder that have ccl2 as their creator. Folling is a file that opens
one of my object files if the arg passed to
ccl::open-application-document is appropriate.

Issues:
- Is is the (or an) Apple/MCL-approved solution?
- What is the optional mystery arg?
- Is the application instance every different from *application* and
are there ever subclasses of it? (It seems defining methods on the
application class is somewhat useless; in fact the only method mcl
defines is on T, not APPLICATION.)


;;;
;;; finder-open-object-file.lisp
;;;

#|
================================================================
Purpose ========================================================
================================================================
Defines an ccl::open-application-document :after method that opens IKit
files.

|#


(defmethod ccl::open-application-document :after ((application t)
                                                  (pathname pathname)
                                                  &optional optional-mystery-arg)
  "An after method that calls open-object-file on pathname if it's an object file."
  (declare (optimize speed)
           (ignore optional-mystery-arg))
  ;;
  (let* ((kw-mac-file-type (mac-file-type pathname))
         (f-wood-file (eq kw-mac-file-type :|WOOD|))
         (f-object-file nil))
    ;; Set f-object-file.
    (when f-wood-file
      (with-open-pheap (pheap pathname)
        (setf f-object-file (ps::f-ikit-pheap pheap))))
    ;;
    (when f-object-file
      (ps::open-object-file pathname))))
From: straz@cambridge.apple.com (Steve Strassmann)
Newsgroups: comp.lang.lisp.mcl
Subject: Interfacing to I/O boards
Date: 13 Aug 92 15:28:32 GMT
Full-Name: Steve Strassmann
Original-To: John Doleac <jd05@gte.com>
Original-Cc: info-mcl

>Date: Wed, 12 Aug 1992 15:19-0400
>From: John Doleac <jd05@gte.com>
>Subject: Interfacing to I/O boards
>To: info-mcl@cambridge.apple.com
>
>The manual tells how to use foreign function calls for code
>compiled by MPW.  This does not work for Think C.  Can anyone
>recommend a way to overcome this problem?

One of our wonderful users, Guillaume Cartier, wrote a Think C
interface package. We've included a copy on the MCL 2.0 CD-ROM,
and a slightly newer version is available by anonymous ftp
from cambridge.apple.com:/pub/MCL2/contrib/Cartiers-Contribs.sit.hqx
From: hohmann@csmil.umich.edu (Luke Hohmann)
Newsgroups: comp.lang.lisp.mcl
Subject: delistifying lists...
Date: 17 Aug 92 11:49:04 GMT
Original-To: info-macl@cambridge.apple.com


I needed a function to "delistofy" lists. Here is the function I wrote
and some sample runs. My question to you is: can you submit a faster/better/
cleaner/more robust version of this function? THANKS!

? (defun delistify (l)
  (cond ((null l) nil)
        ((atom l) l)
        ((listp (car l))
         (delistify (append (car l) (cdr l))))
        (t
         (cons (delistify (car l))
               (delistify (cdr l))))))

delistify
? (delistify '(1 2 3))
(1 2 3)
? (delistify '((1 2 3) 4 5 6))
(1 2 3 4 5 6)
? (delistify '(1 2 3 (4 5 6)))
(1 2 3 4 5 6)
? (delistify '((1 2 3) 4 5 6 ((7 8 9))))
(1 2 3 4 5 6 7 8 9)
? 

  -- Luke
From: bill@cambridge.apple.com (Bill St. Clair)
Newsgroups: comp.lang.lisp.mcl
Subject: Re: BUG:  Second sequence doesn't scroll
Date: 17 Aug 92 22:14:53 GMT
Full-Name: Bill St. Clair
Original-To: lynch@ils.nwu.edu
Original-Cc: info-mcl

>Anybody remember a bug where the second of two sequence-dialog-items in
>different sub-views of a window wouldn't scroll?
>
>This is in 2.0 final, but maybe I missed a patch...

This bug is fixed by patch 1 for MCL 2.0, which we will be
making available soon. In case you're in a hurry, I'll send you the
patch for this particular problem to use until patch 1 is ready.
Ask for "table-scrolling-patch".
From: asimmons@BBN.COM
Newsgroups: comp.lang.lisp.mcl
Subject: leaving net
Date: 21 Aug 92 17:41:00 GMT
Original-To: info-mcl@cambridge.apple.com


Please remove me from the mailing list.

Thanks.

asimmons@cambridge.bbn.com
From: straz@cambridge.apple.com (Steve Strassmann)
Newsgroups: comp.lang.lisp.mcl
Subject: Mailing list vs News Group
Date: 17 Aug 92 21:13:54 GMT
Full-Name: Steve Strassmann
Original-To: cartier@math.uqam.ca (Guillaume Cartier)
Original-Cc: info-mcl

>Date: Mon, 17 Aug 92 16:00:30 -0400
>Sender: cartier@mipsmath.math.uqam.ca
>To: info-mcl@cambridge.apple.com (Macintosh Common Lisp)
>From: cartier@math.uqam.ca (Guillaume Cartier)
>Subject: Mailing list vs News Group
>
>A few weeks ago I got access to a usenet news reader
>and tried out the comp.lang.lisp.mcl group. After reading
>the news for a few weeks, I noticed that some messages
>appearing on the news group never make it to the mailing
>list. Did anyone else notice the same problem?
>


This is correct - messages posted to comp.lang.lisp.mcl
are not posted to the info-mcl mailing list (although
info-mcl messages are posted to the newsgroup). 

I am not aware of any system which would permit doing this
without creating the kinds of infinite loops (and duplicate
messages) we saw just recently on this list. If you have
a dependable solution in mind, feel free to let us know.
Newsgroups: comp.lang.lisp.mcl
From: pchu@jung.arc.nasa.gov (Philip Chu-Summer 92)
Subject: Re: Does CLIM use Mac UI Widgets?
Organization: /home/kronos/id3/pchu/.organization
Date: Thu, 13 Aug 1992 03:55:58 GMT

In article <1992Aug13.010545.10166@ntmtv> irvine@ntmtv.UUCP (Chuck Irvine) writes:
Path: kronos.arc.nasa.gov!ames!olivea!uunet!portal!ntmtv!irvine
   From: irvine@ntmtv.UUCP (Chuck Irvine)
   Newsgroups: comp.lang.lisp.mcl
   Keywords: CLIM, Mac UI Widgets
   Date: 13 Aug 92 01:05:45 GMT
   Sender: irvine@ntmtv (Chuck Irvine)
   Organization: Northern Telecom Inc, Mountain View, CA
   Lines: 8
   Nntp-Posting-Host: nmtvs318

   Regarding CLIM for MCL, does anyone know if it uses Mac user
   interface widgets or does it implement cooresponding widgets
   from scratch? Other implementations of CLIM that I've seen have
   taken the latter approach. Thanks

   Chuck Irvine
   Northern Telecom
   ames!ntmtv!irvine

If I remember correctly, CLIM 1.0 for MCL uses the Mac scrollbar and
and everything else is vanilla CLIM. However, CLIM 2.0 is supposed to
take advantage of various platform-specific toolkits. Does anyone know
the status of CLIM 2.0 for MCL?
--
Phil Chu
Artificial Intelligence Research Branch
NASA Ames Research Center
pchu@ptolemy.arc.nasa.gov
From: kab (Kim Barrett)
Newsgroups: comp.lang.lisp.mcl
Subject: Re: Apply
Date: 12 Aug 92 16:42:51 GMT
Full-Name: Kim Barrett
Original-To: Denis R Howlett <drh@world.std.com>
Original-Cc: MacLisp Info Line <info-macl@cambridge.apple.com>

> Much of this code is created with backquotes so that variables can be
> insterted, a simple example might be:
> 
> (defun make-menu-items (items)
>   (let (menu-items)
>     (dolist (item items)
>       (push (make-instance ...
>                            :attached-function
>                            `(lambda (window)
>         	              (declare (ignore window))
>                               (print ',item)))))))
> 
> I know the code isn't quite right but you get the idea, each lambda
> expression is created at run time.
> 
> The solution I have adopted (but don't like) is to make the function
> dispatcher more intelligent and do the following:
> 
> ;; attached-function & window are bound in preceding lines
>   (funcall (if (listp attached-function)
>               (eval `(function ,attached-function))
>               attached-function)
>            window)
> 
> This allows my dispatcher to deal with all the things that funcall (and
> apply used to deal with), but I always thought it was bad form to use eval
> in the middle of code? ...

Much better would be to flush that hacked up function dispatcher and instead 
either use closures, i.e.

  (defun make-menu-items (items)
    (let (menu-items)
      (dolist (item items)
        (let ((closed-item item))      ; ensure new binding for each item
          (push (make-instance ...
                  :attached-function #'(lambda (window)
                                         (declare (ignore window))
                                         (print closed-item)) ; close over item
                  ...)
                ...

or if you *really* need to be computing a lambda-expression, do the coercion 
once there rather than redoing it each time you try to invoke it.  Also, the 
"approved" way to do the coercion is

  (COERCE lambda-expression 'FUNCTION)

(see CLtL2, p.65).  One warning about this however; MCL2.0 final contains a 
buggy compiler-macro for this particular use of coerce.  I expect this will be 
fixed in some future patch, and in the meantime you can do what I did to work 
around the problem, i.e. use something like the following function

  ;; MCL2.0 compiler-macro for coerce to function is buggy, so declare
  ;; coerce notinline to inhibit the transformation.
  (defun coerce-lambda-expression-to-function (lambda-expression)
    (declare (notinline coerce))
    (coerce lambda-expression 'function))

ps. The line "(let ((closed-item item)) ..." is needed because you don't (in 
general) know whether dolist establishes a fresh binding for each iteration or 
uses the same binding repeatedly (by setq'ing it for each iteration).
From: markt@dgp.toronto.edu (Mark A. Tapia)
Newsgroups: comp.lang.lisp.mcl
Subject: Btree contribution to pub/MCL2/contrib
Date: 12 Aug 92 23:40:06 GMT
Full-Name: Steve Strassmann
Original-To: info-mcl


Here is the working version of a package for manipulating btrees with
added links (pointers) to the leftmost (min) and rightmost (max) nodes
in the tree (or subtree). The package is based on algorithms by Knuth:

Description:
Routines for manipulating binary (2,4) trees with user-defined full ordering.

Thanks,

mark


;;  The algorithms are based on the balanced tree algorithms in Knuth
;;  The Art of Computer Programming, Searching and Sorting Volume III
;;  sections 6.2.2 - 6.2.4 with modifications.
;; 
;;  The balanced trees are red-black trees augmented with points to
;;  allow fast reporting and updating. The representation is described in
;;  Cheng SW and Janardon R, "Efficient maintenance of the union intervals 
;;  on a line, with applications", Proceedings of the First Annual ACM-SIAM 
;;  Symposium on Discrete Algorithms, SIAM pp74-83.


[Archived as cambridge.apple.com:/pub/MCL2/contrib/btree.sit.hqx]
From: markt@dgp.toronto.edu ("Mark A. Tapia")
Newsgroups: comp.lang.lisp.mcl
Subject: Re:  Saving print-style-dialog
Date: 19 Aug 92 21:31:39 GMT
Original-To: lau@darpa.mil
Original-Cc: info-mcl@cambridge.apple.com

Lawrence Au (lau@darpa.mil) writes:
  There must be a hook into the print record which MCL uses to
  print fred-windows.  But I haven't been able to find it.  If I
  just knew where it is I could save it out to a resource in
  either MCL or each document and pull it back in later.

MCL keeps track of the print-record parameter for fred windows 
in a private area. Bill St. Clair discouraged me from using the
private print record for my generalized print package (print-u.lisp
in /pub/MCL2/contrib/).

The print-u package  allocates and maintains its own  separate 
print record. You can use the internal method 
   (get-print-record object) to retrieve the tprint record
You can use the hooks provided in the package print-u.lisp (in
/pub/MCL2/contrib/) to specialize the printing routines. The
get-print-record method only works for non-Fred window.

? (ccl::get-print-prec t)
#<A Mac Handle, Unlocked, Size 120 #x15C018>

You can retrieve (at your own risk), the internal fred print record:
? ccl::*hc-prec*
#<A Mac Handle, Unlocked, Size 120 #x15C06C>
?  (print-record ccl::*hc-prec* :tprint)
#<Record :TPRINT :IPRVERSION 3 
:PRINFO #<Record :TPRINFO :IDEV 0 :IVRES 72 :IHRES 72 
:RPAGE #<Record :RECT :TOP 0 :LEFT 0 :BOTTOM 730 :RIGHT 552>> 
:RPAPER #<Record :RECT :TOP -31 :LEFT -30 :BOTTOM 761 :RIGHT 582> 
:PRSTL #<Record :TPRSTL :WDEV 839 :IPAGEV 1320 :IPAGEH 1020 :BPORT 0 :FEED 2> 
:PRINFOPT #<Record :TPRINFO :IDEV 0 :IVRES 72 :IHRES 72 
:RPAGE #<Record :RECT :TOP 0 :LEFT 0 :BOTTOM 730 :RIGHT 552>> 
:PRXINFO #<Record :TPRXINFO :IROWBYTES 1 :IBANDV 0 :IBANDH 100 
:IDEVBYTES 0 :IBANDS 1 :BPATSCALE 0 :BULTHICK 1 :BULOFFSET 1 :BULSHADOW 1 
:SCAN 0 :BXINFOX 0> 
:PRJOB #<Record :TPRJOB :IFSTPAGE 1 :ILSTPAGE 9999 :ICOPIES 1 
:BJDOCLOOP 0 :FFROMUSR T :PIDLEPROC #<A Null Mac Pointer> 
:PFILENAME #<A Null Mac Pointer> :IFILEVOL 0 :BFILEVERS 0 :BJOBX 0> 
:PRINTX #<A Mac Non-zone Pointer #x19FB1A> 
:IZOOMMIN 25 :IZOOMMAX 400 :HDOCNAME #<A Null Mac Pointer>>
From: djskrien@COLBY.EDU (Dale Skrien)
Newsgroups: comp.lang.lisp.mcl
Subject: CANCEL: opening files from the Finder
Date: 13 Aug 92 15:55:32 GMT
Original-To: info-mcl@cambridge.apple.com

Please ignore my last request for help about opening files from the Finder.
I just found the definition of the open-documents-handler method on the CD
ROM and think I can get what I need by modifying that for my app.
From: cfry@MIT.EDU (Christopher Fry)
Newsgroups: comp.lang.lisp.mcl
Subject: Re: Re2: LISP - Oracle
Date: 19 Aug 92 20:41:55 GMT
Original-To: KLEIMAN@AppleLink.Apple.COM, shafto@aristotle.ils.nwu.edu
Original-Cc: KGRANT@US.ORACLE.COM, HARTLEY.AK@AppleLink.Apple.COM,
        info-mcl@cambridge.apple.com

> Date: 19 Aug 92 16:05 GMT
> From: KLEIMAN@AppleLink.Apple.COM (Kleiman, Ruben)
> Subject: Re2: LISP - Oracle
> To: CFRY@MIT.EDU,
>         INFO.MCL$@AppleLink.Apple.COM (Macintosh Common Lisp User's Group)
> Cc: KGRANT@US.ORACLE.COM, HARTLEY.AK@AppleLink.Apple.COM (Hartley, Alice)
> 
>  
> CFRY> At the conference, there was a movement to make some CL
> CFRY> industry-wide defact standards for: CLIM, Foreign Function Interface,
> CFRY> and SQL interface. The plan was not to go through the whole ansi
> CFRY> process at this time, but simply have a generally agreed
> CFRY> upon spec by the major Lisp vendors that would permit
> CFRY> users to port their code.
>  
> Chris,
>  
> I agree that a standard API for SQL (and FF access) is essential. However, I
> would NOT like to see it linked with CLIM (not because of any opinions I may
> have about it, but simply because CLIM's objectives are orthogonal, I think, to
> database and foreign function access).
I agree completely. CLIM and SQL should be totally orthogonal. Sorry if I implied 
otherwise. On the ohter hand, it may be easier to build a portable SQL interface on top of 
a portable FFI so seems to me that that makes sense but is by no means necessary.  
> Also, I would like a database-oriented API to also consider transactional
> (e.g., CICS, IMS) and object-oriented (e.g., ITASCA) database management
> systems as well as SQL. Since many of the issues are similar in all of these
> (e.g., security, transaction bracketing), it would at least be possible to
> design an SQL-specific version of the API that is architecturally extensible to
> the others.
This is a bigger project, though it is one that I'm also quite interested in.
In fact, the architecture for the program I'm working on is designed to be able
to use objects stored on several different kinds of databases [SQL, OO, 
an-invented-here-flat-file] without caring about which (most of the time).
Certainly to the extent that an SQL DB interface can be generalized, it should be.

shafto@aristotle.ils.nwu.edu (Eric Shafto) is interested in this issue. I know of
1 other MCLer in the Boston area [not on the net] too. Combined with Harlequin
[soon to be networked, their new US office is in New Hamshire] maybe we've got
critical mass!?!
From: jbk@world.std.com (Jeffrey B Kane)
Newsgroups: comp.lang.lisp.mcl
Subject: using Sequence-dialog-items
Date: 12 Aug 92 21:35:34 GMT
Original-To: info-mcl@cambridge.apple.com


I have a quick question, I'm trying to use a "sequence-dialog-item"
(as provided by the Interface Tool's palette).  The problem comes
when I try to figure out which cell the user has clicked in (i.e. 
which cell is selected).  While some of the table-dialog-item's 
methods work for this class (i.e. table-dimensions), other very
important ones (such as  cell-select, cell-selected-p, and 
cell-deselect) don't.  Although the docs indicate that this 
class is derived from table-dimensions, I can't figure out an 
easy way to query it to find which item is selected (let alone
responding to a double click)

      Jeffrey