mnodine@labs-b.bbn.com (Mark Nodine) (11/21/86)
[Info-Mac Archive: SUMACC-LISTMANAGER.SHAR]
A couple of weeks ago I asked if anybody had written glue for the List
Manager for SUMacC. I didn't get any response, so I wrote it myself.
In the spirit of SUMacC, I am posting this as public domain software
for anybody who wants to use it. The posting is in the form of a shell
archive. To unpack under Unix, type
sh listmgr.shar
If you are not using unix, use an editor to chop the files apart.
--Mark
---
#! /bin/sh
: This is a shar archive. Extract with sh, not csh.
echo x - liblist.c
cat > liblist.c << '10467!EOF!'
/* liblist.c 1.0 86/10/27 */
/*
* Package library for the List Manager.
*
* Copyright (C) 1984, Stanford Univ. SUMEX project.
* May be used but not sold without permission.
*/
/*
* history
* 10/27/86 Nodine Created.
*/
/* LINTLIBRARY */
#include "quickdraw.h"
#undef v
#undef h
#include "toolintf.h"
#include "osintf.h"
#include "listintf.h"
#include "libmac.h"
/* List Manager */
ListHandle LNew(rv,db,cs,p,w,d,hg,sh,sv) Rect *rv,db; Point *cs; WindowPtr w; { _macc9(RI,_lnew,L,L,L,SS,S,L,B,B,B,B)}
void LDispose(l) ListHandle l; { _macc1(RN,_ldispose,N,L)}
int LAddColumn(c,cn,l) ListHandle l; { _macc3(RI,_laddcolumn,S,S,S,L) }
int LAddRow(c,cn,l) ListHandle l; { _macc3(RI,_laddrow,S,S,S,L) }
void LDelColumn(c,cn,l) ListHandle l; { _macc3(RN,_ldelcolumn,N,S,S,L) }
void LDelRow(c,cn,l) ListHandle l; { _macc3(RN,_ldelrow,N,S,S,L) }
void LAddToCell(d,dl,c,l) Ptr d; Cell *c; ListHandle l; { _macc4(RN,_laddtocell,N,L,S,SS,L) }
void LClrCell(c,l) Cell *c; ListHandle l; { _macc2(RN,_lclrcell,N,SS,L) }
void LGetCell(d,dl,c,l) Ptr d; int *dl; Cell *c; ListHandle l;{ _macc4(RN,_lgetcell,N,L,VS,SS,L) }
void LSetCell(d,dl,c,l) Ptr d; Cell *c; ListHandle l; { _macc4(RN,_lsetcell,N,L,S,SS,L) }
void LCellSize(s,l) Point *s; ListHandle l; { _macc2(RN,_lcellsize,N,SS,L) }
int LGetSelect(n,c,l) Cell *c; ListHandle l; { _macc3(RI,_lgetselect,B,B,L,L) }
void LSetSelect(s,c,l) Cell *c; ListHandle l; { _macc3(RN,_lsetselect,N,B,SS,L) }
int LClick(p,m,l) Point *p; ListHandle l; { _macc3(RI,_lclick,B,SS,S,L) }
int LLastClick(l) ListHandle l; { _macc1(RI,_llastclick,L,L) }
void LFind(o,len,c,l) int *o,*len; Cell *c; ListHandle l; { _macc4(RN,_lfind,N,VS,VS,SS,L) }
int LNextCell(hn,vn,c,l) Cell *c; ListHandle l; { _macc4(RI,_lnextcell,B,B,B,L,L) }
void LRect(r,c,l) Rect *r; Cell *c; ListHandle l; { _macc3(RN,_lrect,N,L,SS,L) }
int LSearch(d,dl,p,c,l) Ptr d; ProcPtr p; Cell *c; ListHandle l; { _macc5(RI,_lsearch,B,L,S,L,SS,L) }
void LSize(lw,lh,l) ListHandle l; { _macc3(RN,_lsize,N,S,S,L) }
void LDraw(c,l) Cell *c; ListHandle l; { _macc2(RN,_ldraw,N,SS,L) }
void LDoDraw(d,l) ListHandle l; { _macc2(RN,_ldodraw,N,B,L) }
void LScroll(c,r,l) ListHandle l; { _macc3(RN,_lscroll,N,S,S,L) }
void LAutoScroll(l) ListHandle l; { _macc1(RN,_lautoscroll,N,L) }
void LUpdate(r,l) RgnHandle r; ListHandle l; { _macc2(RN,_lupdate,N,L,L) }
void LActivate(a,l) ListHandle l; { _macc2(RN,_lactivate,N,B,L) }
10467!EOF!
echo x - listintf.h
cat > listintf.h << '10467!EOF!'
/*
* List definitions.
*
*
* C language version (C) 1986, BBN
* May be used but not sold without permission.
*/
/* Constants for controlling autoscrolling in listFlags */
#define lDoVAutoScroll 2
#define lDoHAutoScroll 1
/* Constants for the selFlags byte */
#define lOnlyOne 0x80
#define lExtendDrag 64
#define lNoDisjoint 32
#define lNoExtend 16
#define lNoRect 8
#define lUseSense 4
#define lNoNilHilite 2
/* Messages to a list definition procedure */
#define lInitMsg 0
#define lDrawMsg 1
#define lHiliteMsg 2
#define lCloseMsg 3
/* Typedefs for the List Manager */
typedef struct { short row, col; } Cell;
typedef char DataArray[32000];
typedef DataArray *DataPtr;
typedef DataPtr *DataHandle;
typedef struct
{
Rect rView;
GrafPtr port;
Point indent;
Point cellSize;
Rect visible;
ControlHandle vScroll;
ControlHandle hScroll;
char selFlags;
char lActive;
char lReserved;
char listFlags;
long clikTime;
Point clikLoc;
Point mouseLoc;
Ptr lClikLoop;
Cell lastClick;
long refCon;
Handle listDefProc;
Handle userHandle;
Rect dataBounds;
DataHandle cells;
short maxIndex;
int cellArray[1];
} ListRec;
typedef ListRec *ListPtr;
typedef ListPtr *ListHandle;
/* Functions returning other than integer */
ListHandle LNew();
int LLastClick(); /* actually returns a Cell */
10467!EOF!
echo x - listpack.s
cat > listpack.s << '10467!EOF!'
|
| file packtraps.text
|
| implementation for the interface to packages
|
|
|procedure lnew(rview,databounds: rect| csize: point| theproc: integer|
| thewindow: windowptr| drawit,hasgrow,scrollhoriz,scrollvert: boolean):
| listhandle|
|
.text
.globl _lnew
_lnew:
moveq #68,d2 |stuff the opcode
golist: movl sp@+,a0 |get user's rts
movw d2,sp@- |the routine selector
movl a0,sp@- |push the rts back on
.word /ade7 |__pack0 w/autopop
|never gets here
|
|procedure ldispose(lhandle: listhandle)|
|
.text
.globl _ldispose
_ldispose:
moveq #40,d2
bra golist
|
|procedure laddcolumn(count,colnum: integer| lhandle: listhandle): integer|
|
.text
.globl _laddcolumn
_laddcolumn:
moveq #4,d2
bra golist
|
|procedure laddrow(count,rownum: integer| lhandle: listhandle): integer|
|
.text
.globl _laddrow
_laddrow:
moveq #8,d2
bra golist
|
|procedure ldelcolumn(count,colnum: integer| lhandle: listhandle): integer|
|
.text
.globl _ldelcolumn
_ldelcolumn:
moveq #32,d2 |stuff the opcode
bra golist
|
|procedure ldelrow(count,rownum: integer| lhandle: listhandle): integer|
|
.text
.globl _ldelrow
_ldelrow:
moveq #36,d2
bra golist
|
|function laddtocell (dataptr: ptr| datalen: integer| thecell: cell|
| lhandle: listhandle)|
|
.text
.globl _laddtocell
_laddtocell:
moveq #12,d2
bra golist
|
|function lclrcell (thecell: cell| lhandle: listhandle)|
|
.text
.globl _lclrcell
_lclrcell:
moveq #28,d2
bra golist
|
|function lgetcell (dataptr: ptr| var datalen: integer| thecell: cell|
| lhandle: listhandle)|
|
.text
.globl _lgetcell
_lgetcell:
movw #56,d2
bra golist
|
|function lsetcell (dataptr: ptr| datalen: integer| thecell: cell|
| lhandle: listhandle)|
|
.text
.globl _lsetcell
_lsetcell:
movw #88,d2
bra golist
|
|function lcellsize (csize, point| lhandle: listhandle)|
|
.text
.globl _lcellsize
_lcellsize:
moveq #20,d2 |stuff the opcode
bra golist
|
|procedure lgetselect (next: boolean| var thecell: cell|
| lhandle: listhandle): boolean|
|
.text
.globl _lgetselect
_lgetselect:
moveq #60,d2
bra golist
|
|procedure lsetselect (setit: boolean| thecell: cell| lhandle: listhandle)|
|
.text
.globl _lsetselect
_lsetselect:
moveq #92,d2
bra golist
|
|procedure lclick (pt: point| modifiers: integer| lhandle: listhandle):
| boolean|
|
.text
.globl _lclick
_lclick:
moveq #24,d2
bra golist
|
|procedure llastclick (lhandle: listhandle): cell|
|
.text
.globl _llastclick
_llastclick:
moveq #64,d2
bra golist
|
|procedure lfind (var offset, len: integer| thecell: cell|
| lhandle: listhandle)|
|
.text
.globl _lfind
_lfind:
moveq #52,d2
bra golist
|
|function lnextcell (hnext,vnext: boolean| var thecell: cell|
| lhandle: listhandle): boolean|
|
.text
.globl _lnextcell
_lnextcell:
moveq #72,d2
bra golist
|
|function lrect (var cellrect: rect| thecell: cell| lhandle: listhandle)|
|
.text
.globl _lrect
_lrect:
movw #76,d2 |the routine selector
bra golist
|
|function lsearch (dataptr: ptr| datalen: integer| searchproc: ptr|
| var thecell: cell| lhandle: listhandle): boolean|
|
.text
.globl _lsearch
_lsearch:
movw #84,2 |the routine selector
bra golist
|
|function lsize (listwidth,listheight: integer| lhandle: listhandle)|
|
.text
.globl _lsize
_lsize:
movw #96,d2 |the routine selector
bra golist
|
|function ldraw (thecell: cell| lhandle: listhandle)|
|
.text
.globl _ldraw
_ldraw:
movw #48,d2 |the routine selector
bra golist
|
| procedure ldodraw (drawit: boolean| lhandle: listhandle)|
|
.text
.globl _ldodraw
_ldodraw:
movw #44,d2
bra golist
|
| procedure lscroll (dcols,drows: integer| lhandle: listhandle)|
|
.text
.globl _lscroll
_lscroll:
movw #80,d2
bra golist
|
| procedure lautoscroll (lhandle: listhandle)|
|
.text
.globl _lautoscroll
_lautoscroll:
movw #16,d2
bra golist
|
| procedure lupdate (thergn: rgnhandle| lhandle: listhandle)|
|
.text
.globl _lupdate
_lupdate:
movw #100,d2
bra golist
|
| procedure lactivate (act: boolean| lhandle: listhandle)|
|
.text
.globl _lactivate
_lactivate:
movw #0,d2
bra golist
10467!EOF!
---