Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
dde8d4f
[vm-cpp] when a gc space is fully empty, no forwarding zone is alloc'…
melkyades May 2, 2025
84da879
[cpp-httplib] allow accessing headers
melkyades May 3, 2025
5acf85d
[webside] implement dialect, logo and colors
melkyades May 3, 2025
afc3e02
[webside] add logo support and png
melkyades May 4, 2025
fd2c17a
[webside] add vm support for basic file reading
melkyades May 4, 2025
f9ed388
[http-cpp] force use of a single threaded server, as egg does not sup…
melkyades May 4, 2025
c804482
[http-cpp] allow setting response status, reorder funcs
melkyades May 4, 2025
2537051
[http-cpp] FFI binding for setting response status, notFound helper, …
melkyades May 4, 2025
e70854c
[kernel] metaclass comment is class comment
melkyades May 4, 2025
b33de4a
[webside] add import of ByteArray to allow extending it
melkyades May 4, 2025
6c29ce2
[webside] assume a method returning nil means do not set response
melkyades May 4, 2025
512893a
[http-cpp] do not return pointer to temp in stack that is destroyed d…
melkyades May 5, 2025
4520251
[http-cpp] add C wrappers to allow accessing query params and request…
melkyades May 5, 2025
a5652bf
[webside] implement basic endpoints for browsing classes
melkyades May 5, 2025
39c1361
[vm-cpp] when inlining ifNil:ifNotNil:, args can be literals instead …
melkyades May 5, 2025
6755fc8
[http-cpp] add St glue to be able to query path and params before and…
melkyades May 5, 2025
29f2341
[vm-cpp] when calling ffi, check that the address of the symbol being…
melkyades May 5, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions modules/Development/BeginningCondition.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
"
Copyright (c) 2025, Guillermo Amaral, Javier Pimás.
See (MIT) license in root directory.
"

Class {
#name : #BeginningCondition,
#superclass : #CodeSearchCondition,
#category : #Development
}

{#category : #private}
BeginningCondition >> compare: aString [
^aString beginsWith: text
]

{#category : #private}
BeginningCondition >> proposition [
^'begins with'
]

19 changes: 19 additions & 0 deletions modules/Development/ClassSearch.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
"
Copyright (c) 2025, Guillermo Amaral, Javier Pimás.
See (MIT) license in root directory.
"

Class {
#name : #ClassSearch,
#superclass : #CodeSearch,
#category : #Development
}

{#category : #services}
ClassSearch >> search [
self reset.
Kernel namespace keysAndValuesDo: [:name :global |
(global isClass and: [self includes: name])
ifTrue: [results add: (CodeSearchResult class: global)]]
]

165 changes: 165 additions & 0 deletions modules/Development/CodeSearch.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,165 @@
"
Copyright (c) 2025, Guillermo Amaral, Javier Pimás.
See (MIT) license in root directory.
"

Class {
#name : #CodeSearch,
#superclass : #Object,
#instVars : [
'condition',
'results',
'sorter'
],
#category : #Development
}

{#category : #services}
CodeSearch class >> search: aString [
"
SelectorSearch search: 'abc'
"
^self new search: aString
]

{#category : #services}
CodeSearch class >> search: text in: type [
"
CodeSearch search: 'abc' in: 'all'
"
^self search: text in: type ignoreCase: false conditionType: #beginning
]

{#category : #services}
CodeSearch class >> search: text
in: type
ignoreCase: ignoreCase
conditionType: conditionType [
"
CodeSearch search: 'a' in: 'all' ignoreCase: true position: #beginning
"
^(self searchClassesFor: type) gather: [:c |
c new
ignoreCase: ignoreCase;
conditionType: conditionType;
search: text]
]

{#category : #private}
CodeSearch class >> searchClassesFor: type [
"
CodeSearch searchClassesFor: 'all'
CodeSearch searchClassesFor: 'implementors'
"
^type = 'all'
ifTrue: [{ClassSearch. SelectorSearch. ProjectSearch. PoolSearch}]
ifFalse: [self subclasses select: [:c | c type = type]]
]

{#category : #services}
CodeSearch class >> subclassesToSearch [
^subclasses copyWithout: ImplementorSearch
]

{#category : #private}
CodeSearch class >> type [
"
CodeSearch type => 'all'
ClassSearch type => 'classes'
"
^self == CodeSearch
ifTrue: ['all']
ifFalse: [(self name trimTail: 'Search') asLowercase]
]

{#category : #accessing}
CodeSearch >> condition [
^condition
]

{#category : #condition}
CodeSearch >> conditionType: aSymbol [
| case |
case := condition matchesCase.
condition := CodeSearchCondition perform: aSymbol asSymbol.
condition matchCase: case
]

{#category : #private}
CodeSearch >> defaultCondition [
^CodeSearchCondition beginning matchCase: true
]

{#category : #condition}
CodeSearch >> ignoreCase: aBoolean [
condition matchCase: aBoolean not
]

{#category : #private}
CodeSearch >> includes: aString [
^condition evaluateWith: aString
]

{#category : #initialization}
CodeSearch >> initialize [
super initialize.
condition := self defaultCondition.
results := OrderedCollection new.
self sortBySize
]

{#category : #condition}
CodeSearch >> matchCase: aBoolean [
condition matchCase: aBoolean
]

{#category : #condition}
CodeSearch >> pattern: aString [
condition := CodeSearchCondition matching: aString
]

{#category : #inquiries}
CodeSearch >> rawResults [
^results
]

{#category : #private}
CodeSearch >> reset [
results removeAll
]

{#category : #services}
CodeSearch >> search [
self subclassResponsibility
]

{#category : #services}
CodeSearch >> search: aString [
condition text: aString.
self reset; search.
condition isSimilarity
ifTrue: [sorter := [:r1 :r2 | (condition text editDistanceTo: r1 text)
<= (condition text editDistanceTo: r2 text)]].
^self sortedResults
]

{#category : #accessing}
CodeSearch >> sortAlphabetically [
sorter := [:r1 :r2 | r1 text <= r2 text]
]

{#category : #accessing}
CodeSearch >> sortBySize [
sorter := [:r1 :r2 | r1 text size <= r2 text size]
]

{#category : #inquiries}
CodeSearch >> sortedResults [
^sorter ifNil: [results] ifNotNil: [results sortBy: sorter]
]

{#category : #condition}
CodeSearch >> text: aString [
condition text: aString
]

124 changes: 124 additions & 0 deletions modules/Development/CodeSearchCondition.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
"
Copyright (c) 2025, Guillermo Amaral, Javier Pimás.
See (MIT) license in root directory.
"

Class {
#name : #CodeSearchCondition,
#superclass : #Object,
#instVars : [
'text',
'matchCase'
],
#category : #Development
}

{#category : #'instance creation'}
CodeSearchCondition class >> beginning [
^BeginningCondition new
]

{#category : #'instance creation'}
CodeSearchCondition class >> beginningWith: aString [
^self beginning text: aString
]

{#category : #'instance creation'}
CodeSearchCondition class >> ending [
^EndingCondition new
]

{#category : #'instance creation'}
CodeSearchCondition class >> endingWith: aString [
^self ending text: aString
]

{#category : #'instance creation'}
CodeSearchCondition class >> exact [
^ExactMatchCondition new
]

{#category : #'instance creation'}
CodeSearchCondition class >> including [
^IncludingCondition new
]

{#category : #'instance creation'}
CodeSearchCondition class >> including: aString [
^self including text: aString
]

{#category : #'instance creation'}
CodeSearchCondition class >> matching: aString [
^PatternCondition new text: aString
]

{#category : #'instance creation'}
CodeSearchCondition class >> similar [
^SimilarityCondition new
]

{#category : #private}
CodeSearchCondition >> compare: aString [
self subclassResponsibility
]

{#category : #evaluating}
CodeSearchCondition >> evaluateWith: aString [
| string |
string := matchCase ifTrue: [aString] ifFalse: [aString asLowercase].
^self compare: string
]

{#category : #initialization}
CodeSearchCondition >> initialize [
super initialize.
matchCase := true
]

{#category : #testing}
CodeSearchCondition >> isEmpty [
^text isEmptyOrNil
]

{#category : #testing}
CodeSearchCondition >> isExactMatch [
^false
]

{#category : #testing}
CodeSearchCondition >> isSimilarity [
^false
]

{#category : #accessing}
CodeSearchCondition >> matchCase: aBoolean [
matchCase := aBoolean
]

{#category : #testing}
CodeSearchCondition >> matchesCase [
^matchCase
]

{#category : #printing}
CodeSearchCondition >> printOn: aStream [
| case |
case := matchCase ifTrue: ['sensitive'] ifFalse: ['insensitive'].
aStream
nextPutAll: self proposition;
space;
nextPutAll: (text ifNil: '');
nextPutAll: ' (case ' , case , ')'
]

{#category : #accessing}
CodeSearchCondition >> text [
^text
]

{#category : #accessing}
CodeSearchCondition >> text: aString [
text := matchCase ifTrue: [aString] ifFalse: [aString asLowercase]
]

Loading