The Trunk: EToys-eem.290.mcz

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

The Trunk: EToys-eem.290.mcz

commits-2
Eliot Miranda uploaded a new version of EToys to project The Trunk:
http://source.squeak.org/trunk/EToys-eem.290.mcz

==================== Summary ====================

Name: EToys-eem.290
Author: eem
Time: 4 April 2017, 5:25:34.811493 pm
UUID: 225c2132-0e40-4ed9-9134-9621442c5a2b
Ancestors: EToys-eem.289

Eliminate some VMMaker-speciasif cruft from EToys.  Have primitiveFindSubstring:in:startingAt:matchTable: declare vars using the pragma form to avoid dependency on the (obsolete) empty Object method.

=============== Diff against EToys-eem.289 ===============

Item was changed:
  ----- Method: ByteString>>primitiveFindSubstring:in:startingAt:matchTable: (in category '*Etoys-Squeakland-comparing') -----
  primitiveFindSubstring: key in: body startingAt: start matchTable: matchTable
  "Answer the index in the string body at which the substring key first occurs, at or beyond start.  The match is determined using matchTable, which can be used to effect, eg, case-insensitive matches.  If no match is found, zero will be returned.
 
  The algorithm below is not optimum -- it is intended to be translated to C which will go so fast that it wont matter."
  | index |
  <primitive: 'primitiveFindSubstring' module: 'MiscPrimitivePlugin'>
+ <var: #key declareC: 'unsigned char *key'>
+ <var: #body declareC: 'unsigned char *body'>
+ <var: #matchTable declareC: 'unsigned char *matchTable'>
- self var: #key declareC: 'unsigned char *key'.
- self var: #body declareC: 'unsigned char *body'.
- self var: #matchTable declareC: 'unsigned char *matchTable'.
 
  key size = 0 ifTrue: [^ 0].
  start to: body size - key size + 1 do:
  [:startIndex |
  index := 1.
  [(matchTable at: (body at: startIndex+index-1) asciiValue + 1)
  = (matchTable at: (key at: index) asciiValue + 1)]
  whileTrue:
  [index = key size ifTrue: [^ startIndex].
  index := index+1]].
  ^ 0
  "
  ' ' findSubstring: 'abc' in: 'abcdefabcd' startingAt: 1 matchTable: CaseSensitiveOrder 1
  ' ' findSubstring: 'abc' in: 'abcdefabcd' startingAt: 2 matchTable: CaseSensitiveOrder 7
  ' ' findSubstring: 'abc' in: 'abcdefabcd' startingAt: 8 matchTable: CaseSensitiveOrder 0
  ' ' findSubstring: 'abc' in: 'abcdefABcd' startingAt: 2 matchTable: CaseSensitiveOrder 0
  ' ' findSubstring: 'abc' in: 'abcdefABcd' startingAt: 2 matchTable: CaseInsensitiveOrder 7
  "!

Item was removed:
- ----- Method: Object>>var:declareC: (in category '*Etoys-Squeakland-translation support') -----
- var: varSymbol declareC: declString
- "For translation only; noop when running in Smalltalk."!

Item was removed:
- ----- Method: String class>>ccg:prolog:expr:index: (in category '*Etoys-Squeakland-plugin generation') -----
- ccg: cg prolog: aBlock expr: aString index: anInteger
-
- ^cg
- ccgLoad: aBlock
- expr: aString
- asCharPtrFrom: anInteger
- andThen: (cg ccgValBlock: 'isBytes')
- !

Item was removed:
- ----- Method: String class>>ccgDeclareCForVar: (in category '*Etoys-Squeakland-plugin generation') -----
- ccgDeclareCForVar: aSymbolOrString
-
- ^'char *', aSymbolOrString
- !