4 Original GPL release version 4.12
5 Copyright 1993-2000 Jonathan Potter
7 This program is free software; you can redistribute it and/or
8 modify it under the terms of the GNU General Public License
9 as published by the Free Software Foundation; either version 2
10 of the License, or (at your option) any later version.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
21 All users of Directory Opus 4 (including versions distributed
22 under the GPL) are entitled to upgrade to the latest version of
23 Directory Opus version 5 at a reduced price. Please see
24 http://www.gpsoft.com.au for more information.
26 The release of Directory Opus 4 under the GPL in NO WAY affects
27 the existing commercial status of Directory Opus 5.
34 bigint
bytes(name
,total
,block
)
39 long long bytes(name
,total
,block
)
45 struct InfoData __aligned infodata
;
48 bigint free
, temp1
, ret
;
50 free
= i64_atoi( "-1" );
55 if (!(mylock
=Lock(name
,ACCESS_READ
))) {
57 *total
= i64_atoi( "0" );
59 ret
= i64_atoi( "0" );
68 Info(mylock
,&infodata
);
70 testlock
=DupLock(mylock
);
71 testlock
=getrootlock(testlock
);
72 if (CompareLock(testlock
,ramdisk_lock
)==LOCK_SAME
)
74 free
= i64_uset( AvailMem( 0 ) );
80 temp1
= i64_atoi( "-1" );
82 if ( i64_cmp( free
, temp1
) == I64_GREATER
)
88 temp1
= i64_set( infodata
.id_BytesPerBlock
);
90 // *block=free/infodata.id_BytesPerBlock;
91 i64_udiv( free
, temp1
, "
, &rema
);
101 *total
= i64_uumul( infodata
.id_NumBlocks
, infodata
.id_BytesPerBlock
);
102 // *total=((long long)infodata.id_BytesPerBlock)*infodata.id_NumBlocks;
104 temp1
= i64_uumul( infodata
.id_NumBlocksUsed
, infodata
.id_BytesPerBlock
);
106 free
= i64_sub( *total
, temp1
);
107 // free=*total-(infodata.id_BytesPerBlock*((long long)infodata.id_NumBlocksUsed));
112 *block
=free
/infodata
.id_BytesPerBlock
;
117 *total
=((long long)infodata
.id_BytesPerBlock
)*infodata
.id_NumBlocks
;
118 free
=*total
-(infodata
.id_BytesPerBlock
*((long long)infodata
.id_NumBlocksUsed
));
120 *block
=infodata
.id_NumBlocks
-infodata
.id_NumBlocksUsed
;
125 struct TagItem obtain_tags
[]={
126 {OBP_Precision
,PRECISION_EXACT
},
127 {OBP_FailIfBad
,TRUE
},
130 void get_colour_table()
137 screen_pens
[a
].red
=config
->new_palette
[(a
*3)];
138 screen_pens
[a
].green
=config
->new_palette
[(a
*3)+1];
139 screen_pens
[a
].blue
=config
->new_palette
[(a
*3)+2];
140 // screen_pens[a].pen=a;
141 screen_pens
[a
].alloc
=0;
144 num
=1<<((config
->scrdepth
> 4) ? 4 : config
->scrdepth
);
145 cm
=Window
->WScreen
->ViewPort
.ColorMap
;
147 for (a
=0;a
<num
;a
++) {
148 pen
= ObtainBestPenA(cm
,
150 screen_pens
[a
].green
,
152 (MainScreen
)?obtain_tags
:NULL
);
153 if (pen
== -1) screen_pens
[a
].pen
=FindColor(cm
,
155 screen_pens
[a
].green
,
160 screen_pens
[a
].pen
=pen
;
161 screen_pens
[a
].alloc
=1;
163 //D(bug("pen[%lu] = %lu\n",(int)a,(int)screen_pens[a].pen));
167 void free_colour_table()
169 /* if (system_version2>=OSVER_39)*/ {
173 cm
=Window
->WScreen
->ViewPort
.ColorMap
;
176 if (screen_pens
[a
].alloc
) {
177 ReleasePen(cm
,screen_pens
[a
].pen
);
178 screen_pens
[a
].alloc
=0;
184 void SetDrawModes(r
,fg
,bg
,mode
)
188 // if (system_version2>=OSVER_39) {
195 SetAPen(r,screen_pens[fg].pen);
196 SetBPen(r,screen_pens[bg].pen);
201 void do3dbox(r
,x
,y
,w
,h
)
205 Do3DBox(r
,x
,y
,w
,h
,screen_pens
[config
->gadgettopcol
].pen
,screen_pens
[config
->gadgetbotcol
].pen
);