Updated PCI IDs to latest snapshot.
[tangerine.git] / workbench / libs / reqtools / misc.c
blobdf6d6b74d7d10cdf0949da510ee2ab62a3a2c249
1 #include "filereq.h"
3 #include <string.h>
5 #ifndef __AROS__
6 typedef void (*VOID_FUNC)();
7 #endif
9 /****************************************************************************************/
11 void StrCat(char *s, char *s2)
13 strcat(s, s2);
16 /****************************************************************************************/
18 static void filltable(char **table, char *buff, char fill)
20 static char c;
22 *table++ = buff;
24 for(;;)
26 c = *buff++;
27 if (c == '\0') break;
28 if (c == fill)
30 buff[-1] = '\0';
31 *table++ = buff;
36 /****************************************************************************************/
38 void FillNewLineTable (char **table, char *buff)
40 filltable(table, buff, '\n');
43 /****************************************************************************************/
45 void FillBarTable (char **table, char *buff)
47 filltable(table, buff, '|');
50 /****************************************************************************************/
52 #ifdef __AROS__
53 AROS_UFH2 (void, puttostr,
54 AROS_UFHA(UBYTE, chr, D0),
55 AROS_UFHA(STRPTR *,strPtrPtr,A3)
58 AROS_USERFUNC_INIT
59 #else
60 void puttostr(REGPARAM(d0, UBYTE, chr),
61 REGPARAM(a3, STRPTR *, strPtrPtr))
63 #endif
64 *(*strPtrPtr)= chr;
65 (*strPtrPtr) ++;
66 #ifdef __AROS__
67 AROS_USERFUNC_EXIT
68 #endif
71 /****************************************************************************************/
73 #ifdef __AROS__
74 AROS_UFH2 (void, CountBarsAndChars,
75 AROS_UFHA(UBYTE, chr, D0),
76 AROS_UFHA(ULONG *,ptr,A3)
79 AROS_USERFUNC_INIT
80 #else
81 void CountBarsAndChars(REGPARAM(d0, UBYTE, chr),
82 REGPARAM(a3, ULONG *, ptr))
84 #endif
85 if (chr == '|') (ptr[0])++;
86 (ptr[1])++;
87 #ifdef __AROS__
88 AROS_USERFUNC_EXIT
89 #endif
92 /****************************************************************************************/
94 #ifdef __AROS__
95 AROS_UFH2 (void, CountNewLinesAndChars,
96 AROS_UFHA(UBYTE, chr, D0),
97 AROS_UFHA(ULONG *,ptr,A3)
100 AROS_USERFUNC_INIT
101 #else
102 void CountNewLinesAndChars(REGPARAM(d0, UBYTE, chr),
103 REGPARAM(a3, ULONG *, ptr))
105 #endif
106 if (chr == '\n') (ptr[0])++;
107 (ptr[1])++;
108 #ifdef __AROS__
109 AROS_USERFUNC_EXIT
110 #endif
113 /****************************************************************************************/
115 APTR DofmtArgs (char *buff, char *fmt ,...)
117 char *str = buff;
119 #warning fix vararg stuff
121 return RawDoFmt(fmt, &fmt + 1, (VOID_FUNC)puttostr, &str);
124 /****************************************************************************************/
126 APTR Dofmt (char *buff, char *fmt, APTR args)
128 char *str = buff;
130 return RawDoFmt(fmt, args, (VOID_FUNC)puttostr, &str);
134 /****************************************************************************************/
136 APTR DofmtCount (char *fmt, APTR args, ULONG *ptr, int mode)
138 ptr[0] = ptr[1] = 1;
140 return RawDoFmt(fmt,
141 args,
142 (mode ? ((VOID_FUNC)CountBarsAndChars) : ((VOID_FUNC)CountNewLinesAndChars) ),
143 ptr);
146 /****************************************************************************************/
148 void ShortDelay(void)
150 Delay(5);
153 /****************************************************************************************/
155 ULONG LoopReqHandler(struct rtHandlerInfo *rthi)
157 ULONG handler_retval, sigs;
161 if (rthi->DoNotWait)
162 sigs = 0;
163 else
164 sigs = Wait(rthi->WaitMask);
166 handler_retval = (ULONG)rtReqHandlerA(rthi, sigs, NULL);
168 } while (handler_retval == CALL_HANDLER);
170 return handler_retval;
174 /****************************************************************************************/
176 void DoWaitPointer(struct Window *win, int doit, int setpointer)
178 if (win && doit)
180 if (setpointer)
181 rtSetWaitPointer(win);
182 else
183 ClearPointer(win);
188 /****************************************************************************************/
190 APTR DoLockWindow(struct Window *win, int doit, APTR lock, int lockit)
192 if (!doit || !win) return NULL;
194 if (lockit) return rtLockWindow(win);
196 rtUnlockWindow(win, lock);
198 return NULL;
201 /****************************************************************************************/
203 void SetWinTitleFlash(struct Window *win, char *str)
205 DisplayBeep(win->WScreen);
206 SetWindowTitles(win, str, (UBYTE *)-1);
209 /****************************************************************************************/
210 /****************************************************************************************/
211 /****************************************************************************************/
212 /****************************************************************************************/
213 /****************************************************************************************/
214 /****************************************************************************************/