Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

improved helper functions inspired by ruby.

  • Loading branch information...
commit e6c0e648a5a11f7035a2a568bd000ead22207e54 1 parent 3dae527
Satoshi Nakagawa authored
307 framework/CocoaOniguruma.xcodeproj/project.pbxproj
@@ -30,12 +30,34 @@
30 30 7807AC500E2FBB8600A5AB6A /* regversion.c in Sources */ = {isa = PBXBuildFile; fileRef = 7807AC340E2FBB8600A5AB6A /* regversion.c */; };
31 31 7807AC510E2FBB8600A5AB6A /* st.c in Sources */ = {isa = PBXBuildFile; fileRef = 7807AC350E2FBB8600A5AB6A /* st.c */; };
32 32 7807AC520E2FBB8600A5AB6A /* st.h in Headers */ = {isa = PBXBuildFile; fileRef = 7807AC360E2FBB8600A5AB6A /* st.h */; };
33   - 78B1D1AB0E2FBEA100C857D5 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 78B1D1AA0E2FBEA100C857D5 /* Cocoa.framework */; };
  33 + 78C5E1CD0E39CE5F00F62F5D /* OnigRegexpTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 78C5E1B70E39CDEE00F62F5D /* OnigRegexpTest.m */; };
  34 + 78C5E21F0E39CF7300F62F5D /* CocoaOniguruma.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8DC2EF5B0486A6940098B216 /* CocoaOniguruma.framework */; };
  35 + 78C5E2310E39CFEA00F62F5D /* SenTestingKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 78C5E2300E39CFEA00F62F5D /* SenTestingKit.framework */; };
  36 + 78C5E26C0E39D0BD00F62F5D /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 78C5E26B0E39D0BD00F62F5D /* Foundation.framework */; };
  37 + 78C5E3B10E39E38C00F62F5D /* CocoaOniguruma.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8DC2EF5B0486A6940098B216 /* CocoaOniguruma.framework */; };
  38 + 78C5E3D00E39E42000F62F5D /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 78C5E3C00E39E3D900F62F5D /* main.m */; };
  39 + 78C5E3EC0E39E4B800F62F5D /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 78C5E26B0E39D0BD00F62F5D /* Foundation.framework */; };
34 40 8DC2EF530486A6940098B216 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 089C1666FE841158C02AAC07 /* InfoPlist.strings */; };
35 41 /* End PBXBuildFile section */
36 42
  43 +/* Begin PBXContainerItemProxy section */
  44 + 78C5E1F70E39CF1A00F62F5D /* PBXContainerItemProxy */ = {
  45 + isa = PBXContainerItemProxy;
  46 + containerPortal = 0867D690FE84028FC02AAC07 /* Project object */;
  47 + proxyType = 1;
  48 + remoteGlobalIDString = 8DC2EF4F0486A6940098B216;
  49 + remoteInfo = CocoaOniguruma;
  50 + };
  51 + 78C5E3E50E39E4A100F62F5D /* PBXContainerItemProxy */ = {
  52 + isa = PBXContainerItemProxy;
  53 + containerPortal = 0867D690FE84028FC02AAC07 /* Project object */;
  54 + proxyType = 1;
  55 + remoteGlobalIDString = 8DC2EF4F0486A6940098B216;
  56 + remoteInfo = CocoaOniguruma;
  57 + };
  58 +/* End PBXContainerItemProxy section */
  59 +
37 60 /* Begin PBXFileReference section */
38   - 0867D69BFE84028FC02AAC07 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = /System/Library/Frameworks/Foundation.framework; sourceTree = "<absolute>"; };
39 61 089C1667FE841158C02AAC07 /* English */ = {isa = PBXFileReference; fileEncoding = 10; lastKnownFileType = text.plist.strings; name = English; path = English.lproj/InfoPlist.strings; sourceTree = "<group>"; };
40 62 32DBCF5E0370ADEE00C91783 /* CocoaOniguruma_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CocoaOniguruma_Prefix.pch; sourceTree = "<group>"; };
41 63 7807AC1A0E2FBB8600A5AB6A /* OnigRegexp.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OnigRegexp.h; sourceTree = "<group>"; };
@@ -61,17 +83,42 @@
61 83 7807AC340E2FBB8600A5AB6A /* regversion.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = regversion.c; sourceTree = "<group>"; };
62 84 7807AC350E2FBB8600A5AB6A /* st.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = st.c; sourceTree = "<group>"; };
63 85 7807AC360E2FBB8600A5AB6A /* st.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = st.h; sourceTree = "<group>"; };
64   - 78B1D1AA0E2FBEA100C857D5 /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = /System/Library/Frameworks/Cocoa.framework; sourceTree = "<absolute>"; };
  86 + 78C5E1B10E39CDCE00F62F5D /* UnitTest.octest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = UnitTest.octest; sourceTree = BUILT_PRODUCTS_DIR; };
  87 + 78C5E1B60E39CDEE00F62F5D /* OnigRegexpTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = OnigRegexpTest.h; path = tests/OnigRegexpTest.h; sourceTree = "<group>"; };
  88 + 78C5E1B70E39CDEE00F62F5D /* OnigRegexpTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = OnigRegexpTest.m; path = tests/OnigRegexpTest.m; sourceTree = "<group>"; };
  89 + 78C5E1E70E39CEBD00F62F5D /* UnitTest-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "UnitTest-Info.plist"; sourceTree = "<group>"; };
  90 + 78C5E2300E39CFEA00F62F5D /* SenTestingKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SenTestingKit.framework; path = /Developer/Library/Frameworks/SenTestingKit.framework; sourceTree = "<absolute>"; };
  91 + 78C5E26B0E39D0BD00F62F5D /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = /System/Library/Frameworks/Foundation.framework; sourceTree = "<absolute>"; };
  92 + 78C5E3A90E39E37F00F62F5D /* TestCommand */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = TestCommand; sourceTree = BUILT_PRODUCTS_DIR; };
  93 + 78C5E3C00E39E3D900F62F5D /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = main.m; path = testcommand/main.m; sourceTree = "<group>"; };
65 94 8DC2EF5A0486A6940098B216 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
66 95 8DC2EF5B0486A6940098B216 /* CocoaOniguruma.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = CocoaOniguruma.framework; sourceTree = BUILT_PRODUCTS_DIR; };
67 96 /* End PBXFileReference section */
68 97
69 98 /* Begin PBXFrameworksBuildPhase section */
  99 + 78C5E1AE0E39CDCE00F62F5D /* Frameworks */ = {
  100 + isa = PBXFrameworksBuildPhase;
  101 + buildActionMask = 2147483647;
  102 + files = (
  103 + 78C5E21F0E39CF7300F62F5D /* CocoaOniguruma.framework in Frameworks */,
  104 + 78C5E2310E39CFEA00F62F5D /* SenTestingKit.framework in Frameworks */,
  105 + );
  106 + runOnlyForDeploymentPostprocessing = 0;
  107 + };
  108 + 78C5E3A70E39E37F00F62F5D /* Frameworks */ = {
  109 + isa = PBXFrameworksBuildPhase;
  110 + buildActionMask = 2147483647;
  111 + files = (
  112 + 78C5E3EC0E39E4B800F62F5D /* Foundation.framework in Frameworks */,
  113 + 78C5E3B10E39E38C00F62F5D /* CocoaOniguruma.framework in Frameworks */,
  114 + );
  115 + runOnlyForDeploymentPostprocessing = 0;
  116 + };
70 117 8DC2EF560486A6940098B216 /* Frameworks */ = {
71 118 isa = PBXFrameworksBuildPhase;
72 119 buildActionMask = 2147483647;
73 120 files = (
74   - 78B1D1AB0E2FBEA100C857D5 /* Cocoa.framework in Frameworks */,
  121 + 78C5E26C0E39D0BD00F62F5D /* Foundation.framework in Frameworks */,
75 122 );
76 123 runOnlyForDeploymentPostprocessing = 0;
77 124 };
@@ -82,6 +129,8 @@
82 129 isa = PBXGroup;
83 130 children = (
84 131 8DC2EF5B0486A6940098B216 /* CocoaOniguruma.framework */,
  132 + 78C5E1B10E39CDCE00F62F5D /* UnitTest.octest */,
  133 + 78C5E3A90E39E37F00F62F5D /* TestCommand */,
85 134 );
86 135 name = Products;
87 136 sourceTree = "<group>";
@@ -92,19 +141,19 @@
92 141 08FB77AEFE84172EC02AAC07 /* Classes */,
93 142 32C88DFF0371C24200C91783 /* Other Sources */,
94 143 089C1665FE841158C02AAC07 /* Resources */,
95   - 0867D69AFE84028FC02AAC07 /* External Frameworks and Libraries */,
  144 + 0867D69AFE84028FC02AAC07 /* Frameworks */,
96 145 034768DFFF38A50411DB9C8B /* Products */,
97 146 );
98 147 name = CocoaOniguruma;
99 148 sourceTree = "<group>";
100 149 };
101   - 0867D69AFE84028FC02AAC07 /* External Frameworks and Libraries */ = {
  150 + 0867D69AFE84028FC02AAC07 /* Frameworks */ = {
102 151 isa = PBXGroup;
103 152 children = (
104   - 0867D69BFE84028FC02AAC07 /* Foundation.framework */,
105   - 78B1D1AA0E2FBEA100C857D5 /* Cocoa.framework */,
  153 + 78C5E26B0E39D0BD00F62F5D /* Foundation.framework */,
  154 + 78C5E2300E39CFEA00F62F5D /* SenTestingKit.framework */,
106 155 );
107   - name = "External Frameworks and Libraries";
  156 + name = Frameworks;
108 157 sourceTree = "<group>";
109 158 };
110 159 089C1665FE841158C02AAC07 /* Resources */ = {
@@ -112,6 +161,7 @@
112 161 children = (
113 162 8DC2EF5A0486A6940098B216 /* Info.plist */,
114 163 089C1666FE841158C02AAC07 /* InfoPlist.strings */,
  164 + 78C5E1E70E39CEBD00F62F5D /* UnitTest-Info.plist */,
115 165 );
116 166 name = Resources;
117 167 sourceTree = "<group>";
@@ -120,6 +170,8 @@
120 170 isa = PBXGroup;
121 171 children = (
122 172 7807AC190E2FBB8600A5AB6A /* core */,
  173 + 78C5E1BA0E39CDFA00F62F5D /* tests */,
  174 + 78C5E3DD0E39E45200F62F5D /* testcommand */,
123 175 );
124 176 name = Classes;
125 177 sourceTree = "<group>";
@@ -178,6 +230,23 @@
178 230 path = enc;
179 231 sourceTree = "<group>";
180 232 };
  233 + 78C5E1BA0E39CDFA00F62F5D /* tests */ = {
  234 + isa = PBXGroup;
  235 + children = (
  236 + 78C5E1B60E39CDEE00F62F5D /* OnigRegexpTest.h */,
  237 + 78C5E1B70E39CDEE00F62F5D /* OnigRegexpTest.m */,
  238 + );
  239 + name = tests;
  240 + sourceTree = "<group>";
  241 + };
  242 + 78C5E3DD0E39E45200F62F5D /* testcommand */ = {
  243 + isa = PBXGroup;
  244 + children = (
  245 + 78C5E3C00E39E3D900F62F5D /* main.m */,
  246 + );
  247 + name = testcommand;
  248 + sourceTree = "<group>";
  249 + };
181 250 /* End PBXGroup section */
182 251
183 252 /* Begin PBXHeadersBuildPhase section */
@@ -199,6 +268,42 @@
199 268 /* End PBXHeadersBuildPhase section */
200 269
201 270 /* Begin PBXNativeTarget section */
  271 + 78C5E1B00E39CDCE00F62F5D /* UnitTest */ = {
  272 + isa = PBXNativeTarget;
  273 + buildConfigurationList = 78C5E1B50E39CDCF00F62F5D /* Build configuration list for PBXNativeTarget "UnitTest" */;
  274 + buildPhases = (
  275 + 78C5E1AC0E39CDCE00F62F5D /* Resources */,
  276 + 78C5E1AD0E39CDCE00F62F5D /* Sources */,
  277 + 78C5E1AE0E39CDCE00F62F5D /* Frameworks */,
  278 + 78C5E1AF0E39CDCE00F62F5D /* ShellScript */,
  279 + );
  280 + buildRules = (
  281 + );
  282 + dependencies = (
  283 + 78C5E1F80E39CF1A00F62F5D /* PBXTargetDependency */,
  284 + );
  285 + name = UnitTest;
  286 + productName = UnitTest;
  287 + productReference = 78C5E1B10E39CDCE00F62F5D /* UnitTest.octest */;
  288 + productType = "com.apple.product-type.bundle";
  289 + };
  290 + 78C5E3A80E39E37F00F62F5D /* TestCommand */ = {
  291 + isa = PBXNativeTarget;
  292 + buildConfigurationList = 78C5E3BC0E39E39300F62F5D /* Build configuration list for PBXNativeTarget "TestCommand" */;
  293 + buildPhases = (
  294 + 78C5E3A60E39E37F00F62F5D /* Sources */,
  295 + 78C5E3A70E39E37F00F62F5D /* Frameworks */,
  296 + );
  297 + buildRules = (
  298 + );
  299 + dependencies = (
  300 + 78C5E3E60E39E4A100F62F5D /* PBXTargetDependency */,
  301 + );
  302 + name = TestCommand;
  303 + productName = TestCommand;
  304 + productReference = 78C5E3A90E39E37F00F62F5D /* TestCommand */;
  305 + productType = "com.apple.product-type.tool";
  306 + };
202 307 8DC2EF4F0486A6940098B216 /* CocoaOniguruma */ = {
203 308 isa = PBXNativeTarget;
204 309 buildConfigurationList = 1DEB91AD08733DA50010E9CD /* Build configuration list for PBXNativeTarget "CocoaOniguruma" */;
@@ -232,11 +337,20 @@
232 337 projectRoot = "";
233 338 targets = (
234 339 8DC2EF4F0486A6940098B216 /* CocoaOniguruma */,
  340 + 78C5E1B00E39CDCE00F62F5D /* UnitTest */,
  341 + 78C5E3A80E39E37F00F62F5D /* TestCommand */,
235 342 );
236 343 };
237 344 /* End PBXProject section */
238 345
239 346 /* Begin PBXResourcesBuildPhase section */
  347 + 78C5E1AC0E39CDCE00F62F5D /* Resources */ = {
  348 + isa = PBXResourcesBuildPhase;
  349 + buildActionMask = 2147483647;
  350 + files = (
  351 + );
  352 + runOnlyForDeploymentPostprocessing = 0;
  353 + };
240 354 8DC2EF520486A6940098B216 /* Resources */ = {
241 355 isa = PBXResourcesBuildPhase;
242 356 buildActionMask = 2147483647;
@@ -247,7 +361,39 @@
247 361 };
248 362 /* End PBXResourcesBuildPhase section */
249 363
  364 +/* Begin PBXShellScriptBuildPhase section */
  365 + 78C5E1AF0E39CDCE00F62F5D /* ShellScript */ = {
  366 + isa = PBXShellScriptBuildPhase;
  367 + buildActionMask = 2147483647;
  368 + files = (
  369 + );
  370 + inputPaths = (
  371 + );
  372 + outputPaths = (
  373 + );
  374 + runOnlyForDeploymentPostprocessing = 0;
  375 + shellPath = /bin/sh;
  376 + shellScript = "# Run the unit tests in this test bundle.\n\"${SYSTEM_DEVELOPER_DIR}/Tools/RunUnitTests\"\n";
  377 + };
  378 +/* End PBXShellScriptBuildPhase section */
  379 +
250 380 /* Begin PBXSourcesBuildPhase section */
  381 + 78C5E1AD0E39CDCE00F62F5D /* Sources */ = {
  382 + isa = PBXSourcesBuildPhase;
  383 + buildActionMask = 2147483647;
  384 + files = (
  385 + 78C5E1CD0E39CE5F00F62F5D /* OnigRegexpTest.m in Sources */,
  386 + );
  387 + runOnlyForDeploymentPostprocessing = 0;
  388 + };
  389 + 78C5E3A60E39E37F00F62F5D /* Sources */ = {
  390 + isa = PBXSourcesBuildPhase;
  391 + buildActionMask = 2147483647;
  392 + files = (
  393 + 78C5E3D00E39E42000F62F5D /* main.m in Sources */,
  394 + );
  395 + runOnlyForDeploymentPostprocessing = 0;
  396 + };
251 397 8DC2EF540486A6940098B216 /* Sources */ = {
252 398 isa = PBXSourcesBuildPhase;
253 399 buildActionMask = 2147483647;
@@ -272,6 +418,19 @@
272 418 };
273 419 /* End PBXSourcesBuildPhase section */
274 420
  421 +/* Begin PBXTargetDependency section */
  422 + 78C5E1F80E39CF1A00F62F5D /* PBXTargetDependency */ = {
  423 + isa = PBXTargetDependency;
  424 + target = 8DC2EF4F0486A6940098B216 /* CocoaOniguruma */;
  425 + targetProxy = 78C5E1F70E39CF1A00F62F5D /* PBXContainerItemProxy */;
  426 + };
  427 + 78C5E3E60E39E4A100F62F5D /* PBXTargetDependency */ = {
  428 + isa = PBXTargetDependency;
  429 + target = 8DC2EF4F0486A6940098B216 /* CocoaOniguruma */;
  430 + targetProxy = 78C5E3E50E39E4A100F62F5D /* PBXContainerItemProxy */;
  431 + };
  432 +/* End PBXTargetDependency section */
  433 +
275 434 /* Begin PBXVariantGroup section */
276 435 089C1666FE841158C02AAC07 /* InfoPlist.strings */ = {
277 436 isa = PBXVariantGroup;
@@ -328,7 +487,7 @@
328 487 GCC_WARN_ABOUT_RETURN_TYPE = YES;
329 488 GCC_WARN_UNUSED_VARIABLE = YES;
330 489 PREBINDING = NO;
331   - SDKROOT = "$(DEVELOPER_SDK_DIR)/MacOSX10.5.sdk";
  490 + SDKROOT = "";
332 491 };
333 492 name = Debug;
334 493 };
@@ -344,7 +503,115 @@
344 503 GCC_WARN_UNUSED_VARIABLE = YES;
345 504 INSTALL_PATH = "";
346 505 PREBINDING = NO;
347   - SDKROOT = "$(DEVELOPER_SDK_DIR)/MacOSX10.5.sdk";
  506 + SDKROOT = "";
  507 + };
  508 + name = Release;
  509 + };
  510 + 78C5E1B30E39CDCE00F62F5D /* Debug */ = {
  511 + isa = XCBuildConfiguration;
  512 + buildSettings = {
  513 + ALWAYS_SEARCH_USER_PATHS = NO;
  514 + COPY_PHASE_STRIP = NO;
  515 + FRAMEWORK_SEARCH_PATHS = (
  516 + "$(DEVELOPER_LIBRARY_DIR)/Frameworks",
  517 + /Developer/Library/Frameworks,
  518 + "\"$(SRCROOT)/build/Debug\"",
  519 + );
  520 + GCC_DYNAMIC_NO_PIC = NO;
  521 + GCC_ENABLE_FIX_AND_CONTINUE = NO;
  522 + GCC_ENABLE_OBJC_EXCEPTIONS = YES;
  523 + GCC_MODEL_TUNING = G5;
  524 + GCC_OPTIMIZATION_LEVEL = 0;
  525 + GCC_PRECOMPILE_PREFIX_HEADER = YES;
  526 + GCC_PREFIX_HEADER = "$(SYSTEM_LIBRARY_DIR)/Frameworks/Cocoa.framework/Headers/Cocoa.h";
  527 + INFOPLIST_FILE = "UnitTest-Info.plist";
  528 + INSTALL_PATH = "$(USER_LIBRARY_DIR)/Bundles";
  529 + OTHER_LDFLAGS = (
  530 + "-framework",
  531 + Cocoa,
  532 + "-framework",
  533 + SenTestingKit,
  534 + );
  535 + PREBINDING = NO;
  536 + PRODUCT_NAME = UnitTest;
  537 + WRAPPER_EXTENSION = octest;
  538 + };
  539 + name = Debug;
  540 + };
  541 + 78C5E1B40E39CDCE00F62F5D /* Release */ = {
  542 + isa = XCBuildConfiguration;
  543 + buildSettings = {
  544 + ALWAYS_SEARCH_USER_PATHS = NO;
  545 + COPY_PHASE_STRIP = YES;
  546 + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
  547 + FRAMEWORK_SEARCH_PATHS = (
  548 + "$(DEVELOPER_LIBRARY_DIR)/Frameworks",
  549 + /Developer/Library/Frameworks,
  550 + "\"$(SRCROOT)/build/Debug\"",
  551 + );
  552 + GCC_ENABLE_FIX_AND_CONTINUE = NO;
  553 + GCC_ENABLE_OBJC_EXCEPTIONS = YES;
  554 + GCC_MODEL_TUNING = G5;
  555 + GCC_PRECOMPILE_PREFIX_HEADER = YES;
  556 + GCC_PREFIX_HEADER = "$(SYSTEM_LIBRARY_DIR)/Frameworks/Cocoa.framework/Headers/Cocoa.h";
  557 + INFOPLIST_FILE = "UnitTest-Info.plist";
  558 + INSTALL_PATH = "$(USER_LIBRARY_DIR)/Bundles";
  559 + OTHER_LDFLAGS = (
  560 + "-framework",
  561 + Cocoa,
  562 + "-framework",
  563 + SenTestingKit,
  564 + );
  565 + PREBINDING = NO;
  566 + PRODUCT_NAME = UnitTest;
  567 + WRAPPER_EXTENSION = octest;
  568 + ZERO_LINK = NO;
  569 + };
  570 + name = Release;
  571 + };
  572 + 78C5E3AB0E39E37F00F62F5D /* Debug */ = {
  573 + isa = XCBuildConfiguration;
  574 + buildSettings = {
  575 + ALWAYS_SEARCH_USER_PATHS = NO;
  576 + COPY_PHASE_STRIP = NO;
  577 + GCC_DYNAMIC_NO_PIC = NO;
  578 + GCC_ENABLE_FIX_AND_CONTINUE = YES;
  579 + GCC_MODEL_TUNING = G5;
  580 + GCC_OPTIMIZATION_LEVEL = 0;
  581 + GCC_PRECOMPILE_PREFIX_HEADER = YES;
  582 + GCC_PREFIX_HEADER = "$(SYSTEM_LIBRARY_DIR)/Frameworks/AppKit.framework/Headers/AppKit.h";
  583 + INSTALL_PATH = /usr/local/bin;
  584 + OTHER_LDFLAGS = (
  585 + "-framework",
  586 + Foundation,
  587 + "-framework",
  588 + AppKit,
  589 + );
  590 + PREBINDING = NO;
  591 + PRODUCT_NAME = TestCommand;
  592 + };
  593 + name = Debug;
  594 + };
  595 + 78C5E3AC0E39E37F00F62F5D /* Release */ = {
  596 + isa = XCBuildConfiguration;
  597 + buildSettings = {
  598 + ALWAYS_SEARCH_USER_PATHS = NO;
  599 + COPY_PHASE_STRIP = YES;
  600 + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
  601 + GCC_ENABLE_FIX_AND_CONTINUE = NO;
  602 + GCC_MODEL_TUNING = G5;
  603 + GCC_PRECOMPILE_PREFIX_HEADER = YES;
  604 + GCC_PREFIX_HEADER = "$(SYSTEM_LIBRARY_DIR)/Frameworks/AppKit.framework/Headers/AppKit.h";
  605 + INSTALL_PATH = /usr/local/bin;
  606 + OTHER_LDFLAGS = (
  607 + "-framework",
  608 + Foundation,
  609 + "-framework",
  610 + AppKit,
  611 + );
  612 + PREBINDING = NO;
  613 + PRODUCT_NAME = TestCommand;
  614 + ZERO_LINK = NO;
348 615 };
349 616 name = Release;
350 617 };
@@ -369,6 +636,24 @@
369 636 defaultConfigurationIsVisible = 0;
370 637 defaultConfigurationName = Release;
371 638 };
  639 + 78C5E1B50E39CDCF00F62F5D /* Build configuration list for PBXNativeTarget "UnitTest" */ = {
  640 + isa = XCConfigurationList;
  641 + buildConfigurations = (
  642 + 78C5E1B30E39CDCE00F62F5D /* Debug */,
  643 + 78C5E1B40E39CDCE00F62F5D /* Release */,
  644 + );
  645 + defaultConfigurationIsVisible = 0;
  646 + defaultConfigurationName = Release;
  647 + };
  648 + 78C5E3BC0E39E39300F62F5D /* Build configuration list for PBXNativeTarget "TestCommand" */ = {
  649 + isa = XCConfigurationList;
  650 + buildConfigurations = (
  651 + 78C5E3AB0E39E37F00F62F5D /* Debug */,
  652 + 78C5E3AC0E39E37F00F62F5D /* Release */,
  653 + );
  654 + defaultConfigurationIsVisible = 0;
  655 + defaultConfigurationName = Release;
  656 + };
372 657 /* End XCConfigurationList section */
373 658 };
374 659 rootObject = 0867D690FE84028FC02AAC07 /* Project object */;
20 framework/UnitTest-Info.plist
... ... @@ -0,0 +1,20 @@
  1 +<?xml version="1.0" encoding="UTF-8"?>
  2 +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
  3 +<plist version="1.0">
  4 +<dict>
  5 + <key>CFBundleDevelopmentRegion</key>
  6 + <string>English</string>
  7 + <key>CFBundleExecutable</key>
  8 + <string>${EXECUTABLE_NAME}</string>
  9 + <key>CFBundleIdentifier</key>
  10 + <string>net.limechat.CocoaOnigurumaTest</string>
  11 + <key>CFBundleInfoDictionaryVersion</key>
  12 + <string>6.0</string>
  13 + <key>CFBundlePackageType</key>
  14 + <string>BNDL</string>
  15 + <key>CFBundleSignature</key>
  16 + <string>????</string>
  17 + <key>CFBundleVersion</key>
  18 + <string>1.0</string>
  19 +</dict>
  20 +</plist>
24 framework/core/OnigRegexpUtility.h
@@ -11,19 +11,31 @@
11 11
12 12 @interface NSString (OnigRegexpUtility)
13 13
14   -// expression is OnigRegexp or NSString
  14 +// pattern is OnigRegexp or NSString
15 15
16   -- (NSRange)rangeOfRegexp:(id)expression;
17   -- (NSArray*)splitByRegexp:(id)expression;
  16 +- (NSRange)rangeOfRegexp:(id)pattern;
  17 +
  18 +// based on ruby's split
  19 +
  20 +- (NSArray*)split;
  21 +- (NSArray*)splitByRegexp:(id)pattern;
  22 +- (NSArray*)splitByRegexp:(id)pattern limit:(int)limit;
  23 +
  24 +// based on ruby's gsub
  25 +
  26 +- (NSString*)replaceByRegexp:(id)pattern with:(NSString*)string;
  27 +- (NSString*)replaceAllByRegexp:(id)pattern with:(NSString*)string;
18 28
19 29 @end
20 30
21 31
22 32 @interface NSMutableString (OnigRegexpUtility)
23 33
24   -// expression is OnigRegexp or NSString
  34 +// pattern is OnigRegexp or NSString
  35 +
  36 +// based on ruby's gsub
25 37
26   -- (BOOL)replaceByRegexp:(id)expression with:(NSString*)string;
27   -- (int)replaceAllByRegexp:(id)expression with:(NSString*)string;
  38 +- (NSMutableString*)replaceByRegexp:(id)pattern with:(NSString*)string;
  39 +- (NSMutableString*)replaceAllByRegexp:(id)pattern with:(NSString*)string;
28 40
29 41 @end
203 framework/core/OnigRegexpUtility.m
@@ -4,77 +4,200 @@
4 4 #import "OnigRegexpUtility.h"
5 5
6 6
7   -@implementation NSString (OnigRegexpUtility)
  7 +@interface NSString (OnigRegexpNSStringUtilityPrivate)
  8 +- (NSArray*)__split:(id)pattern limit:(NSNumber*)limit;
  9 +@end
  10 +
  11 +@implementation NSString (OnigRegexpNSStringUtility)
8 12
9   -- (NSRange)rangeOfRegexp:(id)expression
  13 +- (NSRange)rangeOfRegexp:(id)pattern
10 14 {
11   - if (![expression isKindOfClass:[OnigRegexp class]]) {
12   - expression = [OnigRegexp compile:(NSString*)expression];
  15 + if (![pattern isKindOfClass:[OnigRegexp class]]) {
  16 + pattern = [OnigRegexp compile:(NSString*)pattern];
13 17 }
14 18
15   - OnigResult* res = [expression search:self];
  19 + OnigResult* res = [pattern search:self];
16 20 return res ? [res bodyRange] : NSMakeRange(NSNotFound, 0);
17 21 }
18 22
19   -- (NSArray*)splitByRegexp:(id)expression
  23 +- (NSArray*)split
  24 +{
  25 + return [self splitByRegexp:@" "];
  26 +}
  27 +
  28 +- (NSArray*)splitByRegexp:(id)pattern
20 29 {
21   - if (![expression isKindOfClass:[OnigRegexp class]]) {
22   - expression = [OnigRegexp compile:(NSString*)expression];
  30 + return [self __split:pattern limit:nil];
  31 +}
  32 +
  33 +- (NSArray*)splitByRegexp:(id)pattern limit:(int)limit
  34 +{
  35 + return [self __split:pattern limit:[NSNumber numberWithInt:limit]];
  36 +}
  37 +
  38 +//
  39 +// This implementation is based on ruby 1.8.
  40 +//
  41 +
  42 +- (NSArray*)__split:(id)pattern limit:(NSNumber*)limitNum
  43 +{
  44 + NSString* target = self;
  45 +
  46 + if (![pattern isKindOfClass:[OnigRegexp class]]) {
  47 + if ([pattern isEqual:@" "]) {
  48 + // If the pattern is a single space,
  49 + // split by contiguous white spaces,
  50 + // where leading and trailing white spaces are ignored.
  51 +
  52 + NSRange r = [target rangeOfRegexp:@"^\\s+"];
  53 + if (r.location != NSNotFound) {
  54 + target = [target substringFromIndex:NSMaxRange(r)];
  55 + }
  56 + r = [target rangeOfRegexp:@"\\s+$"];
  57 + if (r.location != NSNotFound) {
  58 + target = [target substringToIndex:r.location];
  59 + }
  60 + pattern = [OnigRegexp compile:@"\\s+"];
  61 + } else {
  62 + pattern = [OnigRegexp compile:(NSString*)pattern];
  63 + }
  64 + }
  65 +
  66 + int i = 0;
  67 + int limit = 0;
  68 +
  69 + if (limitNum) {
  70 + limit = [limitNum intValue];
  71 + if (limit <=0) {
  72 + limitNum = nil;
  73 + } else if (limit == 1) {
  74 + if ([target length] == 0) return [NSArray array];
  75 + return [NSArray arrayWithObjects:[[target copy] autorelease], nil];
  76 + }
  77 + i = 1;
23 78 }
24 79
25 80 NSMutableArray* array = [NSMutableArray array];
26   - int n = 0;
  81 + int start = 0;
  82 + int begin = 0;
  83 + BOOL lastNull = NO;
  84 +
27 85 OnigResult* res;
28   - while (res = [expression search:self start:n]) {
  86 + while (res = [pattern search:target start:start]) {
29 87 NSRange range = [res bodyRange];
30   - [array addObject:[self substringWithRange:NSMakeRange(n, range.location - n)]];
31   - n = NSMaxRange(range);
  88 + int end = range.location;
  89 + int right = NSMaxRange(range);
  90 +
  91 + if (start == end && range.length == 0) {
  92 + if ([target length] == 0) {
  93 + [array addObject:@""];
  94 + break;
  95 + } else if (lastNull) {
  96 + [array addObject:[target substringWithRange:NSMakeRange(begin, 1)]];
  97 + begin = start;
  98 + } else {
  99 + start++;
  100 + lastNull = YES;
  101 + continue;
  102 + }
  103 + } else {
  104 + [array addObject:[target substringWithRange:NSMakeRange(begin, end-begin)]];
  105 + begin = start = right;
  106 + }
  107 + lastNull = NO;
  108 +
  109 + if (limitNum && limit <= ++i) break;
32 110 }
33   - if (n < [self length]) {
34   - [array addObject:[self substringFromIndex:n]];
  111 +
  112 + if ([target length] > 0 && (limitNum || [target length] > begin || limit < 0)) {
  113 + if ([target length] == begin) {
  114 + [array addObject:@""];
  115 + } else {
  116 + [array addObject:[target substringFromIndex:begin]];
  117 + }
  118 + }
  119 +
  120 + if (!limitNum && limit == 0) {
  121 + NSString* last;
  122 + while ((last = [array lastObject]) && [last length] == 0) {
  123 + [array removeLastObject];
  124 + }
35 125 }
  126 +
36 127 return array;
37 128 }
38 129
39   -@end
40   -
41   -
42   -@implementation NSMutableString (OnigRegexpUtility)
43   -
44   -- (BOOL)replaceByRegexp:(id)expression with:(NSString*)string
  130 +- (NSString*)replaceByRegexp:(id)pattern with:(NSString*)string
45 131 {
46   - if (![expression isKindOfClass:[OnigRegexp class]]) {
47   - expression = [OnigRegexp compile:(NSString*)expression];
  132 + if (![pattern isKindOfClass:[OnigRegexp class]]) {
  133 + pattern = [OnigRegexp compile:(NSString*)pattern];
48 134 }
49 135
50   - OnigResult* res = [expression search:self];
  136 + OnigResult* res = [pattern search:self];
51 137 if (res) {
52   - [self replaceCharactersInRange:[res bodyRange] withString:string];
53   - return YES;
  138 + NSMutableString* s = [[self mutableCopy] autorelease];
  139 + [s replaceCharactersInRange:[res bodyRange] withString:string];
  140 + return s;
54 141 } else {
55   - return NO;
  142 + return [[self mutableCopy] autorelease];
56 143 }
57 144 }
58 145
59   -- (int)replaceAllByRegexp:(id)expression with:(NSString*)string
  146 +//
  147 +// This implementation is based on ruby 1.8.
  148 +//
  149 +
  150 +- (NSString*)replaceAllByRegexp:(id)pattern with:(NSString*)string
60 151 {
61   - if (![expression isKindOfClass:[OnigRegexp class]]) {
62   - expression = [OnigRegexp compile:(NSString*)expression];
  152 + if (![pattern isKindOfClass:[OnigRegexp class]]) {
  153 + pattern = [OnigRegexp compile:(NSString*)pattern];
  154 + }
  155 +
  156 + OnigResult* res = [pattern search:self];
  157 + if (!res) {
  158 + return [[self mutableCopy] autorelease];
63 159 }
64 160
65   - OnigResult* res;
66   - int n = 0;
67   - int count = 0;
68   - while (res = [expression search:self start:n]) {
  161 + NSMutableString* s = [NSMutableString string];
  162 + int offset = 0;
  163 +
  164 + do {
69 165 NSRange range = [res bodyRange];
70   - [self replaceCharactersInRange:range withString:string];
71   - int next = range.location + [string length];
72   - if (n == next) next++;
73   - n = next;
74   - count++;
75   - if ([self length] <= n) break;
  166 + int len = range.location-offset;
  167 + if (len > 0) [s appendString:[self substringWithRange:NSMakeRange(offset, len)]];
  168 + [s appendString:string];
  169 +
  170 + offset = NSMaxRange(range);
  171 + if (range.length == 0) {
  172 + // consume 1 character at least
  173 + if ([self length] <= offset) break;
  174 + [s appendString:[self substringWithRange:NSMakeRange(offset, 1)]];
  175 + offset++;
  176 + }
  177 + if ([self length] < offset) break;
  178 +
  179 + } while (res = [pattern search:self start:offset]);
  180 +
  181 + if (offset < [self length]) {
  182 + [s appendString:[self substringFromIndex:offset]];
76 183 }
77   - return count;
  184 +
  185 + return s;
  186 +}
  187 +
  188 +@end
  189 +
  190 +
  191 +@implementation NSMutableString (OnigRegexpNSMutableStringUtility)
  192 +
  193 +- (NSMutableString*)replaceByRegexp:(id)pattern with:(NSString*)string
  194 +{
  195 + return (NSMutableString*)[super replaceByRegexp:pattern with:string];
  196 +}
  197 +
  198 +- (NSMutableString*)replaceAllByRegexp:(id)pattern with:(NSString*)string
  199 +{
  200 + return (NSMutableString*)[super replaceAllByRegexp:pattern with:string];
78 201 }
79 202
80 203 @end
37 framework/testcommand/main.m
... ... @@ -0,0 +1,37 @@
  1 +#import <Foundation/Foundation.h>
  2 +#import <CocoaOniguruma/OnigRegexp.h>
  3 +
  4 +int main()
  5 +{
  6 + NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
  7 +
  8 +/*
  9 + NSLog(@"%@", [@" now's the time" split]);
  10 + NSLog(@"%@", [@" now's the time" splitByRegexp:@" "]);
  11 + NSLog(@"%@", [@" now's the time" splitByRegexp:[OnigRegexp compile:@" "]]);
  12 + NSLog(@"%@", [@"1, 2.34,56, 7" splitByRegexp:@",\\s*"]);
  13 + NSLog(@"%@", [@"hello" splitByRegexp:@""]);
  14 + NSLog(@"%@", [@"hello" splitByRegexp:@"" limit:3]);
  15 + NSLog(@"%@", [@"hi mom" splitByRegexp:@"\\s*"]);
  16 + NSLog(@"%@", [@"mellow yellow" splitByRegexp:@"ello"]);
  17 + NSLog(@"%@", [@"1,2,,3,4,," splitByRegexp:@","]);
  18 + NSLog(@"%@", [@"1,2,,3,4,," splitByRegexp:@"," limit:4]);
  19 + NSLog(@"%@", [@"1,2,,3,4,," splitByRegexp:@"," limit:-4]);
  20 + NSLog(@"%@", [@"h ello" splitByRegexp:@"\\s*" limit:3]);
  21 + NSLog(@"%@", [@"a,b,c" splitByRegexp:@","]);
  22 + NSLog(@"%@", [@"a,b,,c" splitByRegexp:@","]);
  23 + NSLog(@"%@", [@"a,b, c" splitByRegexp:@",\\s*"]);
  24 + NSLog(@"%@", [@"abc" splitByRegexp:@""]);
  25 + NSLog(@"%@", [@"abc" splitByRegexp:@"^"]);
  26 + NSLog(@"%@", [@"abc" splitByRegexp:@"$"]);
  27 + NSLog(@"%@", [@"abc" splitByRegexp:@"^" limit:-1]);
  28 + NSLog(@"%@", [@"abc" splitByRegexp:@"$" limit:-1]);
  29 + NSLog(@"%@", [@"abc" splitByRegexp:@"."]);
  30 + NSLog(@"%@", [@"abc" splitByRegexp:@"." limit:-1]);
  31 + NSLog(@"%@", [@"abc" splitByRegexp:@""]);
  32 + NSLog(@"%@", [@"abc" splitByRegexp:@"" limit:-1]);
  33 +*/
  34 +
  35 + [pool release];
  36 + return 0;
  37 +}
4 framework/tests/OnigRegexpTest.h
... ... @@ -0,0 +1,4 @@
  1 +#import <SenTestingKit/SenTestingKit.h>
  2 +
  3 +@interface OnigRegexpTest : SenTestCase
  4 +@end
121 framework/tests/OnigRegexpTest.m
... ... @@ -0,0 +1,121 @@
  1 +#import "OnigRegexpTest.h"
  2 +#import "CocoaOniguruma/OnigRegexp.h"
  3 +
  4 +@implementation OnigRegexpTest
  5 +
  6 +- (void)testSurrogatePairs
  7 +{
  8 + OnigRegexp* e = [OnigRegexp compile:@"[^a-z0-9_\\s]"];
  9 + OnigResult* r = [e search:[NSString stringWithUTF8String:"012_\xf0\xa3\x8f\x90 abc"]];
  10 +
  11 + STAssertNotNil(r, nil);
  12 + STAssertEquals([r bodyRange], NSMakeRange(4,2), nil);
  13 + STAssertEqualObjects([r body], [NSString stringWithUTF8String:"\xf0\xa3\x8f\x90"], nil);
  14 + STAssertEqualObjects([r preMatch], @"012_", nil);
  15 + STAssertEqualObjects([r postMatch], @" abc", nil);
  16 +}
  17 +
  18 +- (void)testNamedCaptures
  19 +{
  20 + OnigRegexp* e = [OnigRegexp compile:@"(?<digits>\\d+)[^\\d]+(?<digits>\\d+)[^a-zA-Z\\d]*(?<letters>[a-zA-Z]+)"];
  21 + OnigResult* r = [e search:@" 012/345 \\t abc##"];
  22 +
  23 + STAssertNotNil(r, nil);
  24 + STAssertEquals(NSMakeRange(2,11), [r bodyRange], nil);
  25 + STAssertEquals([r count], 4, nil);
  26 + STAssertEquals([r indexForName:@"digits"], 1, nil);
  27 + STAssertEqualObjects([r indexesForName:@"digits"], [NSIndexSet indexSetWithIndexesInRange:NSMakeRange(1,2)], nil);
  28 + STAssertEquals([r indexForName:@"letters"], 3, nil);
  29 + STAssertEqualObjects([r indexesForName:@"letters"], [NSIndexSet indexSetWithIndexesInRange:NSMakeRange(3,1)], nil);
  30 + STAssertEqualObjects([r stringForName:@"digits"], @"012", nil);
  31 +
  32 + NSArray* ary = [r stringsForName:@"digits"];
  33 + NSArray* expected = [NSArray arrayWithObjects:@"012", @"345", nil];
  34 + STAssertEqualObjects(ary, expected, nil);
  35 +}
  36 +
  37 +- (void)testSearch
  38 +{
  39 + OnigRegexp* e = [OnigRegexp compile:@"[a-z]+"];
  40 + OnigResult* r = [e search:@" 012xyz abc789"];
  41 +
  42 + STAssertEquals([r bodyRange], NSMakeRange(4,3), nil);
  43 + STAssertEqualObjects([r body], @"xyz", nil);
  44 +}
  45 +
  46 +- (void)testMatch
  47 +{
  48 + OnigRegexp* e = [OnigRegexp compile:@"[a-z]+"];
  49 + OnigResult* r = [e match:@"abcABC"];
  50 +
  51 + STAssertEquals(NSMakeRange(0,3), [r bodyRange], nil);
  52 + STAssertEqualObjects(@"abc", [r body], nil);
  53 +}
  54 +
  55 +- (void)testRangeOfRegexp
  56 +{
  57 + STAssertEquals([@"" rangeOfRegexp:@"^"], NSMakeRange(0,0), nil);
  58 + STAssertEquals([@"" rangeOfRegexp:[OnigRegexp compile:@"^"]], NSMakeRange(0,0), nil);
  59 + STAssertEquals([@" 0 abc xyz" rangeOfRegexp:@"[a-z]+"], NSMakeRange(3,3), nil);
  60 + STAssertEquals([@" 0 abc xyz" rangeOfRegexp:[OnigRegexp compile:@"[a-z]+"]], NSMakeRange(3,3), nil);
  61 + STAssertEquals([@"abc" rangeOfRegexp:@"[^a-z]+"], NSMakeRange(NSNotFound,0), nil);
  62 + STAssertEquals([@"abc" rangeOfRegexp:[OnigRegexp compile:@"[^a-z]+"]], NSMakeRange(NSNotFound,0), nil);
  63 +}
  64 +
  65 +// These tests are based on ruby 1.8's source code.
  66 +
  67 +- (void)testSplit
  68 +{
  69 + NSArray* expected;
  70 +
  71 + expected = [NSArray arrayWithObjects:@"now's", @"the", @"time", nil];
  72 + STAssertEqualObjects([@" now's the time" split], expected, nil);
  73 + STAssertEqualObjects([@" now's the time" splitByRegexp:@" "], expected, nil);
  74 + expected = [NSArray arrayWithObjects:@"", @"now's", @"", @"the", @"time", nil];
  75 + STAssertEqualObjects([@" now's the time" splitByRegexp:[OnigRegexp compile:@" "]], expected, nil);
  76 +
  77 + expected = [NSArray arrayWithObjects:@"1", @"2.34", @"56", @"7", nil];
  78 + STAssertEqualObjects([@"1, 2.34,56, 7" splitByRegexp:@",\\s*"], expected, nil);
  79 +
  80 + expected = [NSArray arrayWithObjects:@"h", @"e", @"l", @"l", @"o", nil];
  81 + STAssertEqualObjects([@"hello" splitByRegexp:@""], expected, nil);
  82 +
  83 + expected = [NSArray arrayWithObjects:@"h", @"e", @"llo", nil];
  84 + STAssertEqualObjects([@"hello" splitByRegexp:@"" limit:3], expected, nil);
  85 +
  86 + expected = [NSArray arrayWithObjects:@"h", @"i", @"m", @"o", @"m", nil];
  87 + STAssertEqualObjects([@"hi mom" splitByRegexp:@"\\s*"], expected, nil);
  88 +
  89 + expected = [NSArray arrayWithObjects:@"m", @"w y", @"w", nil];
  90 + STAssertEqualObjects([@"mellow yellow" splitByRegexp:@"ello"], expected, nil);
  91 +
  92 + expected = [NSArray arrayWithObjects:@"1", @"2", @"", @"3", @"4", nil];
  93 + STAssertEqualObjects([@"1,2,,3,4,," splitByRegexp:@","], expected, nil);
  94 +
  95 + expected = [NSArray arrayWithObjects:@"1", @"2", @"", @"3,4,,", nil];
  96 + STAssertEqualObjects([@"1,2,,3,4,," splitByRegexp:@"," limit:4], expected, nil);
  97 +
  98 + expected = [NSArray arrayWithObjects:@"1", @"2", @"", @"3", @"4", @"", @"", nil];
  99 + STAssertEqualObjects([@"1,2,,3,4,," splitByRegexp:@"," limit:-4], expected, nil);
  100 +}
  101 +
  102 +- (void)testReplace
  103 +{
  104 + STAssertEqualObjects([@"" replaceByRegexp:@"" with:@""], @"", nil);
  105 + STAssertEqualObjects([@"" replaceByRegexp:@"" with:@"_"], @"_", nil);
  106 + STAssertEqualObjects([@"" replaceByRegexp:@"0" with:@"_"], @"", nil);
  107 + STAssertEqualObjects([@"abc" replaceByRegexp:@"" with:@"_"], @"_abc", nil);
  108 + STAssertEqualObjects([@"abc" replaceByRegexp:@"$" with:@"_"], @"abc_", nil);
  109 + STAssertEqualObjects([@"aa 00 aa 11" replaceByRegexp:@"\\d+" with:@"digits"], @"aa digits aa 11", nil);
  110 +}
  111 +
  112 +- (void)testReplaceAll
  113 +{
  114 + STAssertEqualObjects([@"abc" replaceAllByRegexp:@"" with:@"_"], @"_a_b_c_", nil);
  115 + STAssertEqualObjects([@"abc" replaceAllByRegexp:@"^" with:@"_"], @"_abc", nil);
  116 + STAssertEqualObjects([@"abc" replaceAllByRegexp:@"$" with:@"_"], @"abc_", nil);
  117 + STAssertEqualObjects([@"abc" replaceAllByRegexp:@"." with:@"_"], @"___", nil);
  118 + STAssertEqualObjects([@"aa 00 aa 11" replaceAllByRegexp:@"\\d+" with:@"digits"], @"aa digits aa digits", nil);
  119 +}
  120 +
  121 +@end
23 readme.txt
@@ -17,14 +17,16 @@ Follow the steps to use CocoaOniguruma in your project.
17 17
18 18 * How to use as a Framework
19 19
20   -1. Build CocoaOniguruma.xcodeproj by Xcode.
21   -2. Copy "build/Release/CocoaOniguruma.framework" into your project directory.
22   -3. Open your project by Xcode.
23   -4. Add the framework to your project under "Frameworks".
24   -5. Open "Targets" in the project tree.
25   -6. Right click on the application target to open context menu and add a "New Copy Files Build Phase".
26   -7. Drag "CocoaOniguruma.framework" into the new "Copy Files" phase.
27   -8. Import the header file, so you can use CocoaOniguruma.
  20 + 1. Open CocoaOniguruma.xcodeproj by Xcode.
  21 + 2. Select "CocoaOniguruma" for Active Target and "Release" for Active Build Configuration.
  22 + 3. Build it.
  23 + 4. Copy "build/Release/CocoaOniguruma.framework" into your project directory.
  24 + 5. Open your project by Xcode.
  25 + 6. Add the framework to your project under "Frameworks".
  26 + 7. Open "Targets" in the project tree.
  27 + 8. Right click on the application target to open context menu and add a "New Copy Files Build Phase".
  28 + 9. Drag "CocoaOniguruma.framework" into the new "Copy Files" phase.
  29 +10. Import the header file, so you can use CocoaOniguruma.
28 30 #import "CocoaOniguruma/OnigRegexp.h"
29 31
30 32 * The Author
@@ -33,6 +35,11 @@ Satoshi Nakagawa <psychs AT limechat DOT net>
33 35 http://d.hatena.ne.jp/Psychs/ (in Japanese)
34 36 #limechat on irc.freenode.net
35 37
  38 +* Thanks
  39 +
  40 +The specifications and implementations of split and replace functions are based on ruby 1.8.
  41 +Thanks to Matz.
  42 +
36 43 * License
37 44
38 45 CocoaOniguruma contains a part of Oniguruma 5.9.1 source code currently.

0 comments on commit e6c0e64

Please sign in to comment.
Something went wrong with that request. Please try again.