Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 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 VIEW_FILE |
| 84 | # define VIEW_FILE "/View" |
| 85 | #endif |
| 86 | #ifndef USR_VIMRC_FILE |
| 87 | # define USR_VIMRC_FILE "Vim:Evim" |
| 88 | #endif |
| 89 | #ifndef SESSION_FILE |
| 90 | # define SESSION_FILE "/Session.vim" |
| 91 | #endif |
| 92 | #ifndef USR_VIMRC_FILE |
| 93 | # define USR_VIMRC_FILE "Choices:Vim.VimRC" |
| 94 | #endif |
| 95 | #ifndef USR_GVIMRC_FILE |
| 96 | # define USR_GVIMRC_FILE "Choices:Vim.GVimRC" |
| 97 | #endif |
| 98 | #ifndef USR_EXRC_FILE |
| 99 | # define USR_EXRC_FILE "Choices:Vim.ExRC" |
| 100 | #endif |
| 101 | #ifndef SYS_VIMRC_FILE |
| 102 | # define SYS_VIMRC_FILE "Vim:VimRC" |
| 103 | #endif |
| 104 | #ifndef SYS_GVIMRC_FILE |
| 105 | # define SYS_GVIMRC_FILE "Vim:GVimRC" |
| 106 | #endif |
| 107 | #ifndef SYS_MENU_FILE |
| 108 | # define SYS_MENU_FILE "Vim:Menu" |
| 109 | #endif |
| 110 | #ifndef SYS_OPTWIN_FILE |
| 111 | # define SYS_OPTWIN_FILE "Vim:Optwin" |
| 112 | #endif |
| 113 | #ifndef FILETYPE_FILE |
| 114 | # define FILETYPE_FILE "Vim:Filetype" |
| 115 | #endif |
| 116 | #ifndef FTPLUGIN_FILE |
| 117 | # define FTPLUGIN_FILE "Vim:Ftplugin/vim" |
| 118 | #endif |
| 119 | #ifndef INDENT_FILE |
| 120 | # define INDENT_FILE "Vim:Indent/vim" |
| 121 | #endif |
| 122 | #ifndef FTOFF_FILE |
| 123 | # define FTOFF_FILE "Vim:Ftoff" |
| 124 | #endif |
| 125 | #ifndef FTPLUGOF_FILE |
| 126 | # define FTPLUGOF_FILE "Vim:Ftplugof" |
| 127 | #endif |
| 128 | #ifndef INDOFF_FILE |
| 129 | # define INDOFF_FILE "Vim:Indoff" |
| 130 | #endif |
| 131 | |
| 132 | #define DFLT_ERRORFILE "errors/vim" |
| 133 | #define DFLT_RUNTIMEPATH "Choices:Vim,Vim:,Choices:Vim.after" |
| 134 | |
| 135 | /* |
| 136 | * RISC PCs have plenty of memory, use large buffers |
| 137 | */ |
| 138 | #define CMDBUFFSIZE 1024 /* size of the command processing buffer */ |
| 139 | #define MAXPATHL 256 /* paths are always quite short though */ |
| 140 | |
| 141 | #ifndef DFLT_MAXMEM |
| 142 | # define DFLT_MAXMEM (5*1024) /* use up to 5 Mbyte for a buffer */ |
| 143 | #endif |
| 144 | |
| 145 | #ifndef DFLT_MAXMEMTOT |
| 146 | # define DFLT_MAXMEMTOT (10*1024) /* use up to 10 Mbyte for Vim */ |
| 147 | #endif |
| 148 | |
| 149 | #ifdef HAVE_SIGSET |
| 150 | # define signal sigset |
| 151 | #endif |
| 152 | |
| 153 | #define n_flag (1<<31) |
| 154 | #define z_flag (1<<30) |
| 155 | #define c_flag (1<<29) |
| 156 | #define v_flag (1<<28) |
| 157 | |
| 158 | /* These take r0-r7 as inputs, returns r0-r7 in global variables. */ |
| 159 | void swi(int swinum, ...); /* Handles errors itself */ |
| 160 | int xswi(int swinum, ...); /* Returns errors using v flag */ |
| 161 | extern int r0, r1, r2, r3, r4, r5, r6, r7; /* For return values */ |
| 162 | |
| 163 | #include <kernel.h> |
| 164 | #include <swis.h> |
| 165 | |
| 166 | #define mch_memmove(to, from, len) memmove((char *)(to), (char *)(from), len) |
| 167 | #define mch_rename(src, dst) rename(src, dst) |
| 168 | #define mch_getenv(x) (char_u *)getenv((char *)x) |
| 169 | #define mch_setenv(name, val, x) setenv(name, val, x) |