Mercurial > vim
comparison src/memline.c @ 2823:8bd38abda314 v7.3.187
updated for version 7.3.187
Problem: The RISC OS port has obvious errors and is not being maintained.
Solution: Remove the RISC OS files and code.
author | Bram Moolenaar <bram@vim.org> |
---|---|
date | Tue, 10 May 2011 16:41:25 +0200 |
parents | 47a0dcad7216 |
children | eb6c70460702 |
comparison
equal
deleted
inserted
replaced
2822:7b62cd406330 | 2823:8bd38abda314 |
---|---|
746 fname = findswapname(buf, &dirp, NULL); /* allocates fname */ | 746 fname = findswapname(buf, &dirp, NULL); /* allocates fname */ |
747 if (fname == NULL) | 747 if (fname == NULL) |
748 continue; | 748 continue; |
749 if (mf_open_file(mfp, fname) == OK) /* consumes fname! */ | 749 if (mf_open_file(mfp, fname) == OK) /* consumes fname! */ |
750 { | 750 { |
751 #if defined(MSDOS) || defined(MSWIN) || defined(RISCOS) | 751 #if defined(MSDOS) || defined(MSWIN) |
752 /* | 752 /* |
753 * set full pathname for swap file now, because a ":!cd dir" may | 753 * set full pathname for swap file now, because a ":!cd dir" may |
754 * change directory without us knowing it. | 754 * change directory without us knowing it. |
755 */ | 755 */ |
756 mf_fullname(mfp); | 756 mf_fullname(mfp); |
931 | 931 |
932 if (buf->b_ffname == NULL) | 932 if (buf->b_ffname == NULL) |
933 b0p->b0_fname[0] = NUL; | 933 b0p->b0_fname[0] = NUL; |
934 else | 934 else |
935 { | 935 { |
936 #if defined(MSDOS) || defined(MSWIN) || defined(AMIGA) || defined(RISCOS) | 936 #if defined(MSDOS) || defined(MSWIN) || defined(AMIGA) |
937 /* Systems that cannot translate "~user" back into a path: copy the | 937 /* Systems that cannot translate "~user" back into a path: copy the |
938 * file name unmodified. Do use slashes instead of backslashes for | 938 * file name unmodified. Do use slashes instead of backslashes for |
939 * portability. */ | 939 * portability. */ |
940 vim_strncpy(b0p->b0_fname, buf->b_ffname, B0_FNAME_SIZE_CRYPT - 1); | 940 vim_strncpy(b0p->b0_fname, buf->b_ffname, B0_FNAME_SIZE_CRYPT - 1); |
941 # ifdef BACKSLASH_IN_FILENAME | 941 # ifdef BACKSLASH_IN_FILENAME |
1101 fname = curbuf->b_fname; | 1101 fname = curbuf->b_fname; |
1102 if (fname == NULL) /* When there is no file name */ | 1102 if (fname == NULL) /* When there is no file name */ |
1103 fname = (char_u *)""; | 1103 fname = (char_u *)""; |
1104 len = (int)STRLEN(fname); | 1104 len = (int)STRLEN(fname); |
1105 if (len >= 4 && | 1105 if (len >= 4 && |
1106 #if defined(VMS) || defined(RISCOS) | 1106 #if defined(VMS) |
1107 STRNICMP(fname + len - 4, "_s" , 2) | 1107 STRNICMP(fname + len - 4, "_s" , 2) |
1108 #else | 1108 #else |
1109 STRNICMP(fname + len - 4, ".s" , 2) | 1109 STRNICMP(fname + len - 4, ".s" , 2) |
1110 #endif | 1110 #endif |
1111 == 0 | 1111 == 0 |
1771 if (fname == NULL) | 1771 if (fname == NULL) |
1772 { | 1772 { |
1773 #ifdef VMS | 1773 #ifdef VMS |
1774 names[0] = vim_strsave((char_u *)"*_sw%"); | 1774 names[0] = vim_strsave((char_u *)"*_sw%"); |
1775 #else | 1775 #else |
1776 # ifdef RISCOS | |
1777 names[0] = vim_strsave((char_u *)"*_sw#"); | |
1778 # else | |
1779 names[0] = vim_strsave((char_u *)"*.sw?"); | 1776 names[0] = vim_strsave((char_u *)"*.sw?"); |
1780 # endif | |
1781 #endif | 1777 #endif |
1782 #if defined(UNIX) || defined(WIN3264) | 1778 #if defined(UNIX) || defined(WIN3264) |
1783 /* For Unix names starting with a dot are special. MS-Windows | 1779 /* For Unix names starting with a dot are special. MS-Windows |
1784 * supports this too, on some file systems. */ | 1780 * supports this too, on some file systems. */ |
1785 names[1] = vim_strsave((char_u *)".*.sw?"); | 1781 names[1] = vim_strsave((char_u *)".*.sw?"); |
1802 if (fname == NULL) | 1798 if (fname == NULL) |
1803 { | 1799 { |
1804 #ifdef VMS | 1800 #ifdef VMS |
1805 names[0] = concat_fnames(dir_name, (char_u *)"*_sw%", TRUE); | 1801 names[0] = concat_fnames(dir_name, (char_u *)"*_sw%", TRUE); |
1806 #else | 1802 #else |
1807 # ifdef RISCOS | |
1808 names[0] = concat_fnames(dir_name, (char_u *)"*_sw#", TRUE); | |
1809 # else | |
1810 names[0] = concat_fnames(dir_name, (char_u *)"*.sw?", TRUE); | 1803 names[0] = concat_fnames(dir_name, (char_u *)"*.sw?", TRUE); |
1811 # endif | |
1812 #endif | 1804 #endif |
1813 #if defined(UNIX) || defined(WIN3264) | 1805 #if defined(UNIX) || defined(WIN3264) |
1814 /* For Unix names starting with a dot are special. MS-Windows | 1806 /* For Unix names starting with a dot are special. MS-Windows |
1815 * supports this too, on some file systems. */ | 1807 * supports this too, on some file systems. */ |
1816 names[1] = concat_fnames(dir_name, (char_u *)".*.sw?", TRUE); | 1808 names[1] = concat_fnames(dir_name, (char_u *)".*.sw?", TRUE); |
1875 { | 1867 { |
1876 struct stat st; | 1868 struct stat st; |
1877 char_u *swapname; | 1869 char_u *swapname; |
1878 | 1870 |
1879 swapname = modname(fname_res, | 1871 swapname = modname(fname_res, |
1880 #if defined(VMS) || defined(RISCOS) | 1872 #if defined(VMS) |
1881 (char_u *)"_swp", FALSE | 1873 (char_u *)"_swp", FALSE |
1882 #else | 1874 #else |
1883 (char_u *)".swp", TRUE | 1875 (char_u *)".swp", TRUE |
1884 #endif | 1876 #endif |
1885 ); | 1877 ); |
2174 * Form the normal swap file name pattern by appending ".sw?". | 2166 * Form the normal swap file name pattern by appending ".sw?". |
2175 */ | 2167 */ |
2176 #ifdef VMS | 2168 #ifdef VMS |
2177 names[num_names] = concat_fnames(path, (char_u *)"_sw%", FALSE); | 2169 names[num_names] = concat_fnames(path, (char_u *)"_sw%", FALSE); |
2178 #else | 2170 #else |
2179 # ifdef RISCOS | |
2180 names[num_names] = concat_fnames(path, (char_u *)"_sw#", FALSE); | |
2181 # else | |
2182 names[num_names] = concat_fnames(path, (char_u *)".sw?", FALSE); | 2171 names[num_names] = concat_fnames(path, (char_u *)".sw?", FALSE); |
2183 # endif | |
2184 #endif | 2172 #endif |
2185 if (names[num_names] == NULL) | 2173 if (names[num_names] == NULL) |
2186 goto end; | 2174 goto end; |
2187 if (num_names >= 1) /* check if we have the same name twice */ | 2175 if (num_names >= 1) /* check if we have the same name twice */ |
2188 { | 2176 { |
2205 */ | 2193 */ |
2206 curbuf->b_shortname = TRUE; | 2194 curbuf->b_shortname = TRUE; |
2207 #ifdef VMS | 2195 #ifdef VMS |
2208 names[num_names] = modname(path, (char_u *)"_sw%", FALSE); | 2196 names[num_names] = modname(path, (char_u *)"_sw%", FALSE); |
2209 #else | 2197 #else |
2210 # ifdef RISCOS | |
2211 names[num_names] = modname(path, (char_u *)"_sw#", FALSE); | |
2212 # else | |
2213 names[num_names] = modname(path, (char_u *)".sw?", FALSE); | 2198 names[num_names] = modname(path, (char_u *)".sw?", FALSE); |
2214 # endif | |
2215 #endif | 2199 #endif |
2216 if (names[num_names] == NULL) | 2200 if (names[num_names] == NULL) |
2217 goto end; | 2201 goto end; |
2218 | 2202 |
2219 /* | 2203 /* |
3203 if (count == 1) | 3187 if (count == 1) |
3204 { | 3188 { |
3205 mf_free(mfp, hp); /* free the data block */ | 3189 mf_free(mfp, hp); /* free the data block */ |
3206 buf->b_ml.ml_locked = NULL; | 3190 buf->b_ml.ml_locked = NULL; |
3207 | 3191 |
3208 for (stack_idx = buf->b_ml.ml_stack_top - 1; stack_idx >= 0; --stack_idx) | 3192 for (stack_idx = buf->b_ml.ml_stack_top - 1; stack_idx >= 0; |
3193 --stack_idx) | |
3209 { | 3194 { |
3210 buf->b_ml.ml_stack_top = 0; /* stack is invalid when failing */ | 3195 buf->b_ml.ml_stack_top = 0; /* stack is invalid when failing */ |
3211 ip = &(buf->b_ml.ml_stack[stack_idx]); | 3196 ip = &(buf->b_ml.ml_stack[stack_idx]); |
3212 idx = ip->ip_index; | 3197 idx = ip->ip_index; |
3213 if ((hp = mf_get(mfp, ip->ip_bnum, 1)) == NULL) | 3198 if ((hp = mf_get(mfp, ip->ip_bnum, 1)) == NULL) |
3954 #ifdef SHORT_FNAME | 3939 #ifdef SHORT_FNAME |
3955 TRUE, | 3940 TRUE, |
3956 #else | 3941 #else |
3957 (buf->b_p_sn || buf->b_shortname), | 3942 (buf->b_p_sn || buf->b_shortname), |
3958 #endif | 3943 #endif |
3959 #ifdef RISCOS | |
3960 /* Avoid problems if fname has special chars, eg <Wimp$Scrap> */ | |
3961 ffname, | |
3962 #else | |
3963 fname_res, | 3944 fname_res, |
3964 #endif | |
3965 (char_u *) | 3945 (char_u *) |
3966 #if defined(VMS) || defined(RISCOS) | 3946 #if defined(VMS) |
3967 "_swp", | 3947 "_swp", |
3968 #else | 3948 #else |
3969 ".swp", | 3949 ".swp", |
3970 #endif | 3950 #endif |
3971 #ifdef SHORT_FNAME /* always 8.3 file name */ | 3951 #ifdef SHORT_FNAME /* always 8.3 file name */ |
4425 #endif | 4405 #endif |
4426 } | 4406 } |
4427 } | 4407 } |
4428 close(fd); | 4408 close(fd); |
4429 } | 4409 } |
4430 #ifdef RISCOS | |
4431 else | |
4432 /* Can't open swap file, though it does exist. | |
4433 * Assume that the user is editing two files with | |
4434 * the same name in different directories. No error. | |
4435 */ | |
4436 differ = TRUE; | |
4437 #endif | |
4438 | 4410 |
4439 /* give the ATTENTION message when there is an old swap file | 4411 /* give the ATTENTION message when there is an old swap file |
4440 * for the current file, and the buffer was not recovered. */ | 4412 * for the current file, and the buffer was not recovered. */ |
4441 if (differ == FALSE && !(curbuf->b_flags & BF_RECOVERED) | 4413 if (differ == FALSE && !(curbuf->b_flags & BF_RECOVERED) |
4442 && vim_strchr(p_shm, SHM_ATTENTION) == NULL) | 4414 && vim_strchr(p_shm, SHM_ATTENTION) == NULL) |