Fix our use of $em_tab_dist after it was changed to 0 for 'turned of'.
[nedit.git] / util / utils.h
bloba1caff6e7c658d37b9ced26c20dc76609f8c262b
1 /* $Id: utils.h,v 1.18 2009/09/19 09:17:59 edg 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>
32 #include <sys/types.h>
34 #ifdef VMS
35 #include "vmsparam.h"
36 #else
37 #include <sys/param.h>
38 #endif /*VMS*/
40 const char *GetCurrentDir(void);
41 const char *GetHomeDir(void);
42 char *PrependHome(const char *filename, char *buf, size_t buflen);
43 const char *GetUserName(void);
44 const char *GetNameOfHost(void);
45 int Min(int i1, int i2);
46 const char* GetRCFileName(int type);
49 ** Simple stack implementation which only keeps void pointers.
50 ** The stack must already be allocated and initialised:
52 ** Stack* stack = (Stack*) XtMalloc(sizeof(Stack));
53 ** stack->top = NULL;
54 ** stack->size = 0;
56 ** NULL is not allowed to pass in, as it is used to signal an empty stack.
58 ** The user should only ever care about Stack, stackObject is an internal
59 ** object. (So it should really go in utils.c. A forward reference was
60 ** refused by my compiler for some reason though.)
62 typedef struct _stackObject {
63 void* value;
64 struct _stackObject* next;
65 } stackObject;
67 typedef struct {
68 unsigned size;
69 stackObject* top;
70 } Stack;
72 void Push(Stack* stack, const void* value);
73 void* Pop(Stack* stack);
75 /* N_FILE_TYPES must be the last entry!! This saves us from counting. */
76 enum {NEDIT_RC, AUTOLOAD_NM, NEDIT_HISTORY, N_FILE_TYPES};
78 /* If anyone knows where to get this from system include files (in a machine
79 independent way), please change this (L_cuserid is apparently not ANSI) */
80 #define MAXUSERNAMELEN 32
82 /* Ditto for the maximum length for a node name. SYS_NMLN is not available
83 on most systems, and I don't know what the portable alternative is. */
84 #ifdef SYS_NMLN
85 #define MAXNODENAMELEN SYS_NMLN
86 #else
87 #define MAXNODENAMELEN (MAXPATHLEN+2)
88 #endif
90 #endif /* NEDIT_UTILS_H_INCLUDED */