comparison src/insdel.c @ 149:538048ae2ab8 r20-3b1

Import from CVS: tag r20-3b1
author cvs
date Mon, 13 Aug 2007 09:36:16 +0200
parents cca96a509cfe
children 59463afc5666
comparison
equal deleted inserted replaced
148:f659db2a1f73 149:538048ae2ab8
1137 1137
1138 /* Flags for the functions below are: 1138 /* Flags for the functions below are:
1139 1139
1140 GB_ALLOW_PAST_ACCESSIBLE 1140 GB_ALLOW_PAST_ACCESSIBLE
1141 1141
1142 The allowable range for the position is the entire buffer 1142 Allow positions to range over the entire buffer (BUF_BEG to BUF_Z),
1143 (BEG and Z), rather than the accessible portion. For strings, 1143 rather than just the accessible portion (BUF_BEGV to BUF_ZV).
1144 this flag has no effect. 1144 For strings, this flag has no effect.
1145 1145
1146 GB_COERCE_RANGE 1146 GB_COERCE_RANGE
1147 1147
1148 If the position is outside the allowable range, return 1148 If the position is outside the allowable range, return the lower
1149 the lower or upper bound of the range, whichever is closer 1149 or upper bound of the range, whichever is closer to the specified
1150 to the specified position. 1150 position.
1151 1151
1152 GB_NO_ERROR_IF_BAD 1152 GB_NO_ERROR_IF_BAD
1153 1153
1154 If the position is outside the allowable range, return -1. 1154 If the position is outside the allowable range, return -1.
1155 1155
1196 Bufpos ind; 1196 Bufpos ind;
1197 Bufpos min_allowed, max_allowed; 1197 Bufpos min_allowed, max_allowed;
1198 1198
1199 CHECK_INT_COERCE_MARKER (pos); 1199 CHECK_INT_COERCE_MARKER (pos);
1200 ind = XINT (pos); 1200 ind = XINT (pos);
1201 min_allowed = (flags & GB_ALLOW_PAST_ACCESSIBLE) ? 1201 min_allowed = flags & GB_ALLOW_PAST_ACCESSIBLE ? BUF_BEG (b) : BUF_BEGV (b);
1202 BUF_BEG (b) : BUF_BEGV (b); 1202 max_allowed = flags & GB_ALLOW_PAST_ACCESSIBLE ? BUF_Z (b) : BUF_ZV (b);
1203 max_allowed = (flags & GB_ALLOW_PAST_ACCESSIBLE) ?
1204 BUF_Z (b) : BUF_ZV (b);
1205 1203
1206 if (ind < min_allowed || ind > max_allowed) 1204 if (ind < min_allowed || ind > max_allowed)
1207 { 1205 {
1208 if (flags & GB_COERCE_RANGE) 1206 if (flags & GB_COERCE_RANGE)
1209 ind = ind < min_allowed ? min_allowed : max_allowed; 1207 ind = ind < min_allowed ? min_allowed : max_allowed;