Initial git import
[sxemacs] / src / sunpro.c
1 /* Sunpro-specific routines.
2
3    Copyright (C) 1994 Sun Microsystems, Inc.
4
5 This file is part of SXEmacs
6
7 SXEmacs is free software: you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation, either version 3 of the License, or
10 (at your option) any later version.
11
12 SXEmacs 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.
16
17 You should have received a copy of the GNU General Public License
18 along with this program.  If not, see <http://www.gnu.org/licenses/>. */
19
20
21 /* Synched up with: Not in FSF. */
22
23 #include <config.h>
24 #include "lisp.h"
25
26 /* ####
27
28   The following junk used to be in lisp/prim/files.el.  It obviously
29   doesn't belong there, but should go somewhere.
30
31   (if (fboundp 'ut-log-text)    ;; #### Sun stuff; what is this?
32       (ut-log-text "Reading a file."))
33 */
34
35 /* Whether usage tracking is turned on (Sun only) */
36 Lisp_Object Vusage_tracking;
37 #ifdef USAGE_TRACKING
38 #include <ut.h>
39 #endif
40
41 DEFUN("ut-log-text", Fut_log_text, 1, MANY, 0,  /*
42 Log a usage-tracking message if `usage-tracking' is non-nil.
43 Args are the same as to `format'.  Returns whether the message was
44 actually logged.  If usage-tracking support was not compiled in, this
45 function has no effect and always returns `nil'.  See function
46 `has-usage-tracking-p'.
47 */
48       (int nargs, Lisp_Object * args))
49 {
50 #ifdef USAGE_TRACKING
51         Lisp_Object xs;
52         unsigned char *s;       /* #### Does not support I18N4. */
53
54         if (!NILP(Vusage_tracking)) {
55                 xs = Fformat(nargs, args);
56                 CHECK_STRING(xs);
57                 s = XSTRING_DATA(xs);
58                 ut_log_text((char *)s);
59         }
60         return Vusage_tracking;
61 #else
62         return Qnil;
63 #endif
64 }
65 \f
66 /************************************************************************/
67 /*                            initialization                            */
68 /************************************************************************/
69
70 void syms_of_sunpro(void)
71 {
72         DEFSUBR(Fut_log_text);
73 }
74
75 void vars_of_sunpro(void)
76 {
77         DEFVAR_LISP("usage-tracking", &Vusage_tracking  /*
78 Whether usage tracking is turned on (Sun internal use only).
79 Has no effect if usage tracking support has not been compiled in.
80                                                          */ );
81         Vusage_tracking = Qnil;
82
83         Fprovide(intern("sparcworks"));
84 #ifdef USAGE_TRACKING
85         Fprovide(intern("usage-tracking"));
86 #endif
87 }
88
89 void init_sunpro(void)
90 {
91         Vusage_tracking = Qnil;
92 #ifdef USAGE_TRACKING
93         if (!purify_flag) {     /* Enabled only when not dumping an executable */
94                 Vusage_tracking = Qt;
95                 ut_initialize("sxemacs", NULL, NULL);
96         }
97 #endif
98 }