Fix for SF bug #1908890: window title not updated.
[nedit.git] / util / utils.h
blob78d842b89b75700a21a30d44fffe69e6bee033e9
1 /* $Id: utils.h,v 1.17 2008/01/04 22:11:05 yooden Exp $ */
2 /*******************************************************************************
3 * *
4 * utils.h -- Nirvana Editor Utilities Header File *
5 * *
6 * Copyright 2002 The NEdit Developers *
7 * *
8 * This is free software; you can redistribute it and/or modify it under the *
9 * terms of the GNU General Public License as published by the Free Software *
10 * Foundation; either version 2 of the License, or (at your option) any later *
11 * version. In addition, you may distribute versions of this program linked to *
12 * Motif or Open Motif. See README for details. *
13 * *
14 * This software is distributed in the hope that it will be useful, but WITHOUT *
15 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or *
16 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for *
17 * more details. *
18 * *
19 * You should have received a copy of the GNU General Public License along with *
20 * software; if not, write to the Free Software Foundation, Inc., 59 Temple *
21 * Place, Suite 330, Boston, MA 02111-1307 USA *
22 * *
23 * Nirvana Text Editor *
24 * July 31, 2001 *
25 * *
26 *******************************************************************************/
28 #ifndef NEDIT_UTILS_H_INCLUDED
29 #define NEDIT_UTILS_H_INCLUDED
31 #include <sys/utsname.h>
33 #ifdef VMS
34 #include "vmsparam.h"
35 #else
36 #include <sys/param.h>
37 #endif /*VMS*/
39 const char *GetCurrentDir(void);
40 const char *GetHomeDir(void);
41 char *PrependHome(const char *filename, char *buf, size_t buflen);
42 const char *GetUserName(void);
43 const char *GetNameOfHost(void);
44 int Min(int i1, int i2);
45 const char* GetRCFileName(int type);
48 ** Simple stack implementation which only keeps void pointers.
49 ** The stack must already be allocated and initialised:
51 ** Stack* stack = (Stack*) XtMalloc(sizeof(Stack));
52 ** stack->top = NULL;
53 ** stack->size = 0;
55 ** NULL is not allowed to pass in, as it is used to signal an empty stack.
57 ** The user should only ever care about Stack, stackObject is an internal
58 ** object. (So it should really go in utils.c. A forward reference was
59 ** refused by my compiler for some reason though.)
61 typedef struct _stackObject {
62 void* value;
63 struct _stackObject* next;
64 } stackObject;
66 typedef struct {
67 unsigned size;
68 stackObject* top;
69 } Stack;
71 void Push(Stack* stack, const void* value);
72 void* Pop(Stack* stack);
74 /* N_FILE_TYPES must be the last entry!! This saves us from counting. */
75 enum {NEDIT_RC, AUTOLOAD_NM, NEDIT_HISTORY, N_FILE_TYPES};
77 /* If anyone knows where to get this from system include files (in a machine
78 independent way), please change this (L_cuserid is apparently not ANSI) */
79 #define MAXUSERNAMELEN 32
81 /* Ditto for the maximum length for a node name. SYS_NMLN is not available
82 on most systems, and I don't know what the portable alternative is. */
83 #ifdef SYS_NMLN
84 #define MAXNODENAMELEN SYS_NMLN
85 #else
86 #define MAXNODENAMELEN (MAXPATHLEN+2)
87 #endif
89 #endif /* NEDIT_UTILS_H_INCLUDED */