File: util.h

package info (click to toggle)
twin 0.4.0-4
  • links: PTS
  • area: main
  • in suites: woody
  • size: 3,804 kB
  • ctags: 23,904
  • sloc: ansic: 61,860; cpp: 1,023; makefile: 777; sh: 552; lex: 302; yacc: 231
file content (61 lines) | stat: -rw-r--r-- 1,983 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#ifndef _TWIN_UTIL_H
#define _TWIN_UTIL_H

extern udat ErrNo;
extern byte CONST * ErrStr;
extern uldat unixSlot;
extern int unixFd;

void *CloneMem(CONST void *From, uldat Size);
byte *CloneStr(CONST byte *From);
byte *CloneStrL(CONST byte *From, uldat Size);
byte **CloneStrList(byte **FromList);
hwfont *CloneStr2HWFont(CONST byte *From, uldat Size);

byte Error(udat Code_Error);

void NormalizeTime(timevalue *Time);
timevalue *InstantNow(timevalue *Now);
dat CmpTime(timevalue *T1, timevalue *T2);
timevalue *SumTime(timevalue *Result, timevalue *Time, timevalue *Incr);
timevalue *SubTime(timevalue *Result, timevalue *Time, timevalue *Decr);
timevalue *IncrTime(timevalue *Time, timevalue *Incr);
timevalue *DecrTime(timevalue *Time, timevalue *Decr);
void SortMsgPortByCallTime(msgport Port);
void SortAllMsgPortsByCallTime(void);
byte SendControlMsg(msgport MsgPort, udat Code, udat Len, CONST byte *Data);

byte Minimum(byte MaxIndex, CONST uldat *Array);

void SetArgv_0(byte * CONST * argv, CONST byte * src);

#define SelectionAppend(Len, Data) SelectionStore(SEL_APPEND, NULL, Len, Data)
byte SelectionStore(uldat Magic, CONST byte MIME[MAX_MIMELEN], uldat Len, CONST byte *Data);
byte SetSelectionFromWindow(window Window);
void doSelectionSetOwner(obj Owner, time_t Time, frac_t Frac);
#define SEL_CURRENTTIME ((time_t)0)

byte CreateXTermMouseEvent(event_mouse *Event, byte buflen, byte *buf);

void ResetBorderPattern(void);
void FallBackKeyAction(window W, event_keyboard *EventK);

byte **TokenizeStringVec(uldat len, byte *text);
byte **TokenizeHWFontVec(uldat len, hwfont *text);
void FreeStringVec(byte **argv);

byte InitTWDisplay(void);
void QuitTWDisplay(void);

extern uid_t Uid, EUid;
byte CheckPrivileges(void);
void GainPrivileges(void);
byte SetServerUid(uldat uid, byte privileges);

byte AssignId(CONST fn_obj Fn_Obj, obj Obj);
void DropId(obj Obj);
obj  Id2Obj(byte i, uldat Id);
#define Obj2Id(o) ((o) ? (o)->Id : NOID)

#endif /* _TWIN_UTIL_H */