1/* vi:set ts=8 sts=4 sw=4: 2 * 3 * VIM - Vi IMproved by Bram Moolenaar 4 * 5 * Do ":help uganda" in Vim to read copying and usage conditions. 6 * Do ":help credits" in Vim to see a list of people who contributed. 7 */ 8 9#include <sys/types.h> 10#include <sys/stat.h> 11#include <sys/ioctl.h> 12#include <termios.h> 13#include <stdlib.h> 14#include <unixlib/local.h> 15#include <errno.h> 16#include <fcntl.h> 17 18#define CASE_INSENSITIVE_FILENAME 19#define FEAT_MODIFY_FNAME 20#define FEAT_OSFILETYPE 21#define DFLT_OFT "Text" 22#define USE_TERM_CONSOLE 23#define HAVE_AVAIL_MEM 24 25/* Longer filenames now accessible to all */ 26#ifndef BASENAMELEN 27# define BASENAMELEN 64 /* Same length as unzip */ 28#endif 29 30#ifndef TEMNAME 31# define TEMPNAME "<Wimp$ScrapDir>.v?XXXXXX" 32# define TEMPNAMELEN 25 33#endif 34 35#ifndef DFLT_HELPFILE 36# define DFLT_HELPFILE "Vim:doc.help" 37#endif 38 39#ifndef DFLT_BDIR 40# define DFLT_BDIR ".,<Wimp$ScrapDir>." /* default for 'backupdir' */ 41#endif 42 43/* Paths to try putting swap file in. */ 44#ifndef DFLT_DIR 45# define DFLT_DIR "<Wimp$ScrapDir>.,." /* default for 'directory' */ 46#endif 47 48#ifndef DFLT_VDIR 49# define DFLT_VDIR "Choices:Vim.view" /* default for 'viewdir' */ 50#endif 51 52#ifndef TERMCAPFILE 53# define TERMCAPFILE "Vim:TermCap" 54#endif 55#define HAVE_TGETENT 56 57#ifndef SYNTAX_FNAME 58# define SYNTAX_FNAME "Vim:Syntax.%s" 59#endif 60 61#ifndef EVIM_FILE 62# define EVIM_FILE "Vim:Evim" 63#endif 64 65#define FEAT_VIMINFO 66 67#ifndef VIMINFO_FILE 68# define VIMINFO_FILE "<Choices$Write>.Vim.VimInfo" 69#endif 70#ifndef VIMINFO_FILE2 71# define VIMINFO_FILE2 "Choices:Vim.VimInfo" 72#endif 73 74#ifndef VIMRC_FILE 75# define VIMRC_FILE "/vimrc" 76#endif 77#ifndef EXRC_FILE 78# define EXRC_FILE "/exrc" 79#endif 80#ifndef GVIMRC_FILE 81# define GVIMRC_FILE "/gvimrc" 82#endif 83#ifndef USR_VIMRC_FILE 84# define USR_VIMRC_FILE "Vim:Evim" 85#endif 86#ifndef SESSION_FILE 87# define SESSION_FILE "/Session.vim" 88#endif 89#ifndef USR_VIMRC_FILE 90# define USR_VIMRC_FILE "Choices:Vim.VimRC" 91#endif 92#ifndef USR_GVIMRC_FILE 93# define USR_GVIMRC_FILE "Choices:Vim.GVimRC" 94#endif 95#ifndef USR_EXRC_FILE 96# define USR_EXRC_FILE "Choices:Vim.ExRC" 97#endif 98#ifndef SYS_VIMRC_FILE 99# define SYS_VIMRC_FILE "Vim:VimRC" 100#endif 101#ifndef SYS_GVIMRC_FILE 102# define SYS_GVIMRC_FILE "Vim:GVimRC" 103#endif 104#ifndef SYS_MENU_FILE 105# define SYS_MENU_FILE "Vim:Menu" 106#endif 107#ifndef SYS_OPTWIN_FILE 108# define SYS_OPTWIN_FILE "Vim:Optwin" 109#endif 110#ifndef FILETYPE_FILE 111# define FILETYPE_FILE "Vim:Filetype" 112#endif 113#ifndef FTPLUGIN_FILE 114# define FTPLUGIN_FILE "Vim:Ftplugin/vim" 115#endif 116#ifndef INDENT_FILE 117# define INDENT_FILE "Vim:Indent/vim" 118#endif 119#ifndef FTOFF_FILE 120# define FTOFF_FILE "Vim:Ftoff" 121#endif 122#ifndef FTPLUGOF_FILE 123# define FTPLUGOF_FILE "Vim:Ftplugof" 124#endif 125#ifndef INDOFF_FILE 126# define INDOFF_FILE "Vim:Indoff" 127#endif 128 129#define DFLT_ERRORFILE "errors/vim" 130#define DFLT_RUNTIMEPATH "Choices:Vim,Vim:,Choices:Vim.after" 131 132/* 133 * RISC PCs have plenty of memory, use large buffers 134 */ 135#define CMDBUFFSIZE 1024 /* size of the command processing buffer */ 136#define MAXPATHL 256 /* paths are always quite short though */ 137 138#ifndef DFLT_MAXMEM 139# define DFLT_MAXMEM (5*1024) /* use up to 5 Mbyte for a buffer */ 140#endif 141 142#ifndef DFLT_MAXMEMTOT 143# define DFLT_MAXMEMTOT (10*1024) /* use up to 10 Mbyte for Vim */ 144#endif 145 146#ifdef HAVE_SIGSET 147# define signal sigset 148#endif 149 150#define n_flag (1<<31) 151#define z_flag (1<<30) 152#define c_flag (1<<29) 153#define v_flag (1<<28) 154 155/* These take r0-r7 as inputs, returns r0-r7 in global variables. */ 156void swi(int swinum, ...); /* Handles errors itself */ 157int xswi(int swinum, ...); /* Returns errors using v flag */ 158extern int r0, r1, r2, r3, r4, r5, r6, r7; /* For return values */ 159 160#include <kernel.h> 161#include <swis.h> 162 163#define mch_memmove(to, from, len) memmove((char *)(to), (char *)(from), len) 164#define mch_rename(src, dst) rename(src, dst) 165#define mch_getenv(x) (char_u *)getenv((char *)x) 166#define mch_setenv(name, val, x) setenv(name, val, x) 167