Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
cloogle.org
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Cloogle
cloogle.org
Commits
c661da9c
Verified
Commit
c661da9c
authored
Jan 31, 2017
by
Camil Staps
🚀
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added is_core property for modules (
#63
,
#71
)
parent
c49b8bc8
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
136 additions
and
73 deletions
+136
-73
README.md
README.md
+1
-0
backend/Cloogle.dcl
backend/Cloogle.dcl
+1
-0
backend/Cloogle.icl
backend/Cloogle.icl
+2
-1
backend/CloogleServer.icl
backend/CloogleServer.icl
+22
-8
backend/TypeDB.dcl
backend/TypeDB.dcl
+7
-2
backend/TypeDB.icl
backend/TypeDB.icl
+17
-3
backend/builddb.icl
backend/builddb.icl
+50
-42
frontend/api.js
frontend/api.js
+27
-11
frontend/api.php
frontend/api.php
+7
-5
frontend/index.html
frontend/index.html
+2
-1
No files found.
README.md
View file @
c661da9c
...
...
@@ -129,6 +129,7 @@ JSON request with at least one of the following fields:
*
`typeName`
, the name of the type to search for.
*
`libraries`
, a list of names of libraries to search in.
*
`include_builtins`
, a boolean, whether language builtins should be searched or not.
*
`include_core`
, a boolean, whether library cores should be searched or not.
*
`modules`
, a list of names of modules to search in.
*
`page`
: 0 for the first
*n*
results, 1 for the next
*n*
, etc.
...
...
backend/Cloogle.dcl
View file @
c661da9c
...
...
@@ -13,6 +13,7 @@ from Text.JSON import generic JSONEncode, generic JSONDecode, :: JSONNode
,
modules
::
Maybe
[
String
]
,
libraries
::
Maybe
[
String
]
,
include_builtins
::
Maybe
Bool
,
include_core
::
Maybe
Bool
,
page
::
Maybe
Int
}
...
...
backend/Cloogle.icl
View file @
c661da9c
...
...
@@ -17,7 +17,8 @@ where
,
typeName
=
Nothing
,
modules
=
Nothing
,
libraries
=
Nothing
,
include_builtins
=
Nothing
,
include_builtins
=
Nothing
,
include_core
=
Nothing
,
page
=
Nothing
}
...
...
backend/CloogleServer.icl
View file @
c661da9c
...
...
@@ -8,7 +8,7 @@ import StdOrdList
import
StdOverloaded
import
StdString
import
StdTuple
from
StdFunc
import
o
,
flip
,
const
,
seq
from
StdFunc
import
const
,
flip
,
id
,
o
,
seq
from
StdMisc
import
abort
from
TCPIP
import
::
IPAddress
,
::
Port
,
instance
toString
IPAddress
...
...
@@ -37,6 +37,9 @@ import Cloogle
MAX_RESULTS
:==
15
CACHE_PREFETCH
:==
5
DEFAULT_INCLUDE_BUILTINS
:==
True
DEFAULT_INCLUDE_CORE
:==
False
::
RequestCacheKey
=
{
c_unify
::
Maybe
Type
,
c_name
::
Maybe
String
...
...
@@ -45,6 +48,7 @@ CACHE_PREFETCH :== 5
,
c_modules
::
Maybe
[
String
]
,
c_libraries
::
Maybe
[
String
]
,
c_include_builtins
::
Bool
,
c_include_core
::
Bool
,
c_page
::
Int
}
...
...
@@ -60,7 +64,8 @@ toRequestCacheKey r =
,
c_typeName
=
r
.
typeName
,
c_modules
=
sort
<$>
r
.
modules
,
c_libraries
=
sort
<$>
r
.
libraries
,
c_include_builtins
=
fromJust
(
r
.
include_builtins
<|>
Just
True
)
,
c_include_builtins
=
fromJust
(
r
.
include_builtins
<|>
Just
DEFAULT_INCLUDE_BUILTINS
)
,
c_include_core
=
fromJust
(
r
.
include_core
<|>
Just
DEFAULT_INCLUDE_CORE
)
,
c_page
=
fromJust
(
r
.
page
<|>
Just
0
)
}
...
...
@@ -155,14 +160,23 @@ where
suggs
_
_
_
=
Nothing
search
::
!
Request
!
TypeDB
->
[
Result
]
search
{
unify
,
name
,
className
,
typeName
,
modules
,
libraries
,
page
,
include_builtins
}
db
#
include_builtins
=
fromJust
(
include_builtins
<|>
Just
True
)
search
{
unify
,
name
,
className
,
typeName
,
modules
,
libraries
,
page
,
include_builtins
,
include_core
}
db
#
include_builtins
=
fromJust
(
include_builtins
<|>
Just
DEFAULT_INCLUDE_BUILTINS
)
#
include_core
=
fromJust
(
include_core
<|>
Just
DEFAULT_INCLUDE_CORE
)
#
db
=
case
libraries
of
(
Just
ls
)
=
filterLocations
(
isLibMatch
include_builtins
ls
)
db
(
Just
ls
)
=
filterLocations
(
isLibMatch
ls
)
db
Nothing
=
db
#
db
=
case
modules
of
(
Just
ms
)
=
filterLocations
(
isModMatch
ms
)
db
Nothing
=
db
#
db
=
if
include_builtins
id
(
filterLocations
(
not
o
isBuiltin
))
db
#
db
=
if
include_core
id
(
filterLocations
(
not
o
isCore
))
db
with
isCore
::
Location
->
Bool
isCore
(
Builtin
_)
=
False
isCore
(
Location
lib
mod
_
_
_)
=
case
getModule
lib
mod
db
of
Nothing
=
False
(
Just
b
)
=
b
.
is_core
|
isJust
className
#
className
=
fromJust
className
#
classes
=
findClass
className
db
...
...
@@ -390,9 +404,9 @@ where
isModMatch
mods
(
Location
_
mod
_
_
_)
=
isMember
mod
mods
isModMatch
_
(
Builtin
_)
=
False
isLibMatch
::
!
Bool
!
[
String
]
Location
->
Bool
isLibMatch
_
libs
(
Location
lib
_
_
_
_)
=
any
(\
l
->
indexOf
l
lib
==
0
)
libs
isLibMatch
blti
_
(
Builtin
_)
=
blti
isLibMatch
::
![
String
]
Location
->
Bool
isLibMatch
libs
(
Location
lib
_
_
_
_)
=
any
(\
l
->
indexOf
l
lib
==
0
)
libs
isLibMatch
_
(
Builtin
_)
=
True
loc
::
Location
->
LocationResult
loc
(
Location
lib
mod
ln
iln
_)
=
(
lib
,
mod
,
ln
,
iln
)
...
...
backend/TypeDB.dcl
View file @
c661da9c
...
...
@@ -31,20 +31,22 @@ from Type import ::Type, ::TypeVar, ::TVAssignment, ::TypeDef, class print(..),
::
Location
=
Location
Library
Module
LineNr
LineNr
Name
|
Builtin
Name
::
ModuleInfo
=
{
is_core
::
Bool
}
::
Name
:==
String
::
Library
:==
String
::
Module
:==
String
::
Class
:==
String
::
LineNr
:==
Maybe
Int
derive
gEq
TypeDB
instance
zero
TypeDB
instance
zero
TypeExtras
instance
zero
ModuleInfo
instance
print
(
Name
,
ExtendedType
)
getName
::
Location
->
Name
isBuiltin
::
Location
->
Bool
functionCount
::
TypeDB
->
Int
macroCount
::
TypeDB
->
Int
...
...
@@ -100,6 +102,9 @@ putDerivation :: Name Type Location TypeDB -> TypeDB
putDerivations
::
Name
[(
Type
,
Location
)]
TypeDB
->
TypeDB
putDerivationss
::
[(
Name
,
[(
Type
,
Location
)])]
TypeDB
->
TypeDB
getModule
::
Library
Module
TypeDB
->
Maybe
ModuleInfo
putModule
::
Library
Module
ModuleInfo
TypeDB
->
TypeDB
searchExact
::
Type
TypeDB
->
[(
Location
,
ExtendedType
)]
getTypeInstances
::
Name
TypeDB
->
[(
Class
,
[
Type
],
[
Location
])]
...
...
backend/TypeDB.icl
View file @
c661da9c
...
...
@@ -23,6 +23,7 @@ import Type
,
instancemap
::
Map
Class
[([
Type
],
[
Location
])]
,
typemap
::
Map
Location
TypeDef
,
derivemap
::
Map
Name
[(
Type
,
[
Location
])]
,
modulemap
::
Map
(
Library
,
Module
)
ModuleInfo
// Derived maps
,
instancemap`
::
Map
Name
[(
Class
,
[
Type
],
[
Location
])]
,
derivemap`
::
Map
Name
[(
Name
,
[
Location
])]
...
...
@@ -34,14 +35,14 @@ printersperse ia a bs = intercalate (print False a) (map (print ia) bs)
(--)
infixr
5
::
a
b
->
[
String
]
|
print
a
&
print
b
(--)
a
b
=
print
False
a
++
print
False
b
derive
gEq
ClassOrGeneric
,
Location
,
Type
,
Type
DB
,
Type
Extras
,
Priority
,
derive
gEq
ClassOrGeneric
,
Location
,
Type
,
TypeExtras
,
Priority
,
ExtendedType
,
TypeDef
,
TypeDefRhs
,
RecordField
,
Constructor
,
Kind
,
Macro
derive
JSONEncode
ClassOrGeneric
,
Location
,
Type
,
TypeDB
,
TypeExtras
,
Priority
,
ExtendedType
,
TypeDef
,
TypeDefRhs
,
RecordField
,
Constructor
,
Kind
,
Macro
Kind
,
Macro
,
ModuleInfo
derive
JSONDecode
ClassOrGeneric
,
Location
,
Type
,
TypeDB
,
TypeExtras
,
Priority
,
ExtendedType
,
TypeDef
,
TypeDefRhs
,
RecordField
,
Constructor
,
Kind
,
Macro
Kind
,
Macro
,
ModuleInfo
instance
zero
TypeDB
where
...
...
@@ -51,6 +52,7 @@ where
,
instancemap
=
newMap
,
typemap
=
newMap
,
derivemap
=
newMap
,
modulemap
=
newMap
,
instancemap`
=
newMap
,
derivemap`
=
newMap
}
...
...
@@ -75,6 +77,8 @@ where
,
te_representation
=
Nothing
}
instance
zero
ModuleInfo
where
zero
=
{
is_core
=
False
}
instance
print
TypeExtras
where
print
b
{
te_priority
=
Just
p
}
=
print
b
p
--
" "
...
...
@@ -96,6 +100,10 @@ getName :: Location -> Name
getName
(
Location
_
_
_
_
name
)
=
name
getName
(
Builtin
name
)
=
name
isBuiltin
::
Location
->
Bool
isBuiltin
(
Builtin
_)
=
True
isBuiltin
_
=
False
functionCount
::
TypeDB
->
Int
functionCount
{
functionmap
}
=
mapSize
functionmap
...
...
@@ -268,6 +276,12 @@ getTypeInstances n db = case get n db.instancemap` of (Just cs) = cs; _ = []
getTypeDerivations
::
Name
TypeDB
->
[(
Name
,
[
Location
])]
getTypeDerivations
n
db
=
case
get
n
db
.
derivemap`
of
(
Just
gs
)
=
gs
;
_
=
[]
getModule
::
Library
Module
TypeDB
->
Maybe
ModuleInfo
getModule
lib
mod
{
modulemap
}
=
get
(
lib
,
mod
)
modulemap
putModule
::
Library
Module
ModuleInfo
TypeDB
->
TypeDB
putModule
lib
mod
info
db
=
{
db
&
modulemap
=
put
(
lib
,
mod
)
info
db
.
modulemap
}
newDb
::
TypeDB
newDb
=
zero
...
...
backend/builddb.icl
View file @
c661da9c
...
...
@@ -2,15 +2,18 @@ module builddb
// Project libraries
import
qualified
TypeDB
as
DB
from
TypeDB
import
::
TypeExtras
{..},
instance
zero
TypeExtras
,
::
Macro
{..}
from
TypeDB
import
::
TypeExtras
{..},
::
Macro
{..},
::
ModuleInfo
{..},
instance
zero
TypeExtras
,
instance
zero
ModuleInfo
// StdEnv
from
StdFunc
import
const
,
flip
import
StdFile
,
StdList
,
StdMisc
,
StdArray
,
StdBool
,
StdString
,
StdTuple
// CleanPlatform
import
Data
.
Maybe
,
Data
.
Either
,
Data
.
Error
,
Data
.
Func
,
Data
.
Tuple
,
Data
.
Functor
import
Control
.
Applicative
,
Control
.
Monad
from
Text
import
class
Text
(
concat
,
replaceSubString
,
indexOf
),
instance
Text
String
from
Text
import
class
Text
(
concat
,
replaceSubString
,
indexOf
,
startsWith
),
instance
Text
String
import
System
.
Directory
,
System
.
CommandLine
// CleanTypeUnifier
...
...
@@ -48,7 +51,7 @@ from parse import wantModule
::
CLI
=
{
help
::
Bool
,
version
::
Bool
,
root
::
String
,
libs
::
[
String
]
,
libs
::
[
(
String
,
String
->
Bool
)
]
,
exclude
::
[
String
]
}
...
...
@@ -56,33 +59,33 @@ instance zero CLI where
zero
=
{
version
=
False
,
help
=
False
,
root
=
"/opt/clean/lib/"
,
libs
=
[
"StdEnv"
,
"StdLib"
,
"ArgEnv"
,
"Directory"
,
"Dynamics"
,
"Gast"
,
"Generics"
,
"MersenneTwister"
,
"TCPIP"
,
"clean-platform/OS-Independent"
,
"clean-platform/OS-Linux"
,
"clean-platform/OS-Linux-32"
,
"clean-platform/OS-Linux-64"
,
"clean-platform/OS-Mac"
,
"clean-platform/OS-Posix"
,
"clean-platform/OS-Windows"
,
"clean-platform/OS-Windows-32"
,
"clean-platform/OS-Windows-64"
,
"iTasks-SDK/Dependencies/graph_copy"
,
"iTasks-SDK/Dependencies/clean-sapl/src"
,
"iTasks-SDK/Server"
,
"iTasks-SDK/Tests"
,
"SoccerFun/Game"
,
"SoccerFun/Gui"
,
"SoccerFun/StdLibExt"
,
"SoccerFun/StdReferee"
,
"SoccerFun/StdTeam"
,
libs
=
[
(
"StdEnv"
,
const
False
)
,
(
"StdLib"
,
const
False
)
,
(
"ArgEnv"
,
const
False
)
,
(
"Directory"
,
const
False
)
,
(
"Dynamics"
,
const
False
)
,
(
"Gast"
,
const
False
)
,
(
"Generics"
,
const
False
)
,
(
"MersenneTwister"
,
const
False
)
,
(
"TCPIP"
,
const
False
)
,
(
"clean-platform/OS-Independent"
,
const
False
)
,
(
"clean-platform/OS-Linux"
,
const
False
)
,
(
"clean-platform/OS-Linux-32"
,
const
False
)
,
(
"clean-platform/OS-Linux-64"
,
const
False
)
,
(
"clean-platform/OS-Mac"
,
const
False
)
,
(
"clean-platform/OS-Posix"
,
const
False
)
,
(
"clean-platform/OS-Windows"
,
const
False
)
,
(
"clean-platform/OS-Windows-32"
,
const
False
)
,
(
"clean-platform/OS-Windows-64"
,
const
False
)
,
(
"iTasks-SDK/Dependencies/graph_copy"
,
const
False
)
,
(
"iTasks-SDK/Dependencies/clean-sapl/src"
,
const
False
)
,
(
"iTasks-SDK/Server"
,
startsWith
"iTasks._Framework"
)
,
(
"iTasks-SDK/Tests"
,
const
False
)
,
(
"SoccerFun/Game"
,
const
False
)
,
(
"SoccerFun/Gui"
,
const
False
)
,
(
"SoccerFun/StdLibExt"
,
const
False
)
,
(
"SoccerFun/StdReferee"
,
const
False
)
,
(
"SoccerFun/StdTeam"
,
const
False
)
]
,
exclude
=
[
"StdEnv/_startup"
,
"StdEnv/_system"
...
...
@@ -110,7 +113,7 @@ Start w
(
Right
cli
)
|
cli
.
help
=
fclose
(
f
<<<
USAGE
)
w
|
cli
.
version
=
fclose
(
f
<<<
VERSION
)
w
#
(
modss
,
w
)
=
mapSt
(
\
l
->
findModules
cli
.
exclude
cli
.
root
l
""
)
cli
.
libs
w
#
(
modss
,
w
)
=
mapSt
(
flip
(
uncurry
$
findModules
cli
.
exclude
cli
.
root
)
""
)
cli
.
libs
w
#
mods
=
flatten
modss
#
(
st
,
w
)
=
init_identifiers
newHeap
w
#
cache
=
empty_cache
st
...
...
@@ -127,10 +130,11 @@ Start w
|
not
ok
=
abort
"Couldn't close stdio"
=
w
where
loop
::
String
[(
String
,
String
)]
'
DB
'.
TypeDB
*
DclCache
*
World
->
*('
DB
'.
TypeDB
,
*
World
)
loop
::
String
[(
String
,
String
,
Bool
)]
'
DB
'.
TypeDB
*
DclCache
*
World
->
*('
DB
'.
TypeDB
,
*
World
)
loop
_
[]
db
_
w
=
(
db
,
w
)
loop
root
[(
lib
,
mod
):
list
]
db
cache
w
#
(
db
,
cache
,
w
)
=
getModuleTypes
root
mod
lib
cache
db
w
loop
root
[(
lib
,
mod
,
iscore
):
list
]
db
cache
w
#
(
db
,
cache
,
w
)
=
getModuleTypes
root
mod
lib
iscore
cache
db
w
#
w
=
snd
(
fclose
(
stderr
<<<
lib
<<<
": "
<<<
mod
<<<
"
\n
"
)
w
)
=
loop
root
list
db
cache
w
...
...
@@ -142,7 +146,7 @@ where
(
"-l"
,
[])
=
Left
"'-l' requires an argument"
(
"-r"
,
[])
=
Left
"'-r' requires an argument"
(
"-r"
,
[
x
:
xs
])
=
(\
c
->{
c
&
root
=
x
})
<$>
parseCLI
xs
(
"-l"
,
[
x
:
xs
])
=
(\
c
->{
c
&
libs
=[
x
:
c
.
libs
]})
<$>
parseCLI
xs
(
"-l"
,
[
x
:
xs
])
=
(\
c
->{
c
&
libs
=[
(
x
,
const
False
)
:
c
.
libs
]})
<$>
parseCLI
xs
(
x
,
_)
=
Left
$
"Unknown option '"
+++
x
+++
"'"
printStats
::
!'
DB
'.
TypeDB
!*
File
->
*
File
...
...
@@ -207,15 +211,17 @@ where
deft
=
{'
Type
'.
td_name
=
""
,
'
Type
'.
td_uniq
=
False
,
'
Type
'.
td_args
=[],
'
Type
'.
td_rhs
=
'T'
.
TDRAbstract
}
defc
=
{'
Type
'.
cons_name
=
""
,
'
Type
'.
cons_args
=[],
'
Type
'.
cons_exi_vars
=[],
'
Type
'.
cons_context
=[],
'
Type
'.
cons_priority
=
Nothing
}
// Exclude Root Library Base module Library Module
findModules
::
![
String
]
!
String
!
String
!
String
!*
World
->
*(![(
String
,
String
)],
!*
World
)
findModules
ex
root
lib
base
w
// Exclude Root Library Check for core Base module
findModules
::
![
String
]
!
String
!'
DB
'.
Library
('
DB
'.
Module
->
Bool
)
!
String
!*
World
->
*(![('
DB
'.
Library
,
'
DB
'.
Module
,
Bool
)],
!*
World
)
findModules
ex
root
lib
iscore
base
w
|
any
(\
e
->
indexOf
e
path
<>
-1
)
ex
=
([],
w
)
#!
(
fps
,
w
)
=
readDirectory
path
w
|
isError
fps
=
([],
w
)
#!
fps
=
fromOk
fps
#!
mods
=
map
(\
s
->
(
lib
,
basedot
+++
s
%
(
0
,
size
s
-
5
)))
$
filter
included
$
filter
isDclModule
fps
#!
(
moremodss
,
w
)
=
mapSt
(\
d
->
findModules
ex
root
lib
(
basedot
+++
d
))
(
filter
isDirectory
fps
)
w
#!
mods
=
map
(\
s
->
let
mod
=
basedot
+++
s
%
(
0
,
size
s
-
5
)
in
(
lib
,
mod
,
iscore
mod
))
$
filter
included
$
filter
isDclModule
fps
#!
(
moremodss
,
w
)
=
mapSt
(\
d
->
findModules
ex
root
lib
iscore
(
basedot
+++
d
))
(
filter
isDirectory
fps
)
w
=
(
removeDup
(
mods
++
flatten
moremodss
),
w
)
where
path
=
root
+++
"/"
+++
lib
+++
if
(
base
==
""
)
""
"/"
+++
replaceSubString
"."
"/"
base
...
...
@@ -230,8 +236,9 @@ where
isDirectory
::
String
->
Bool
isDirectory
s
=
not
$
isMember
'.'
$
fromString
s
getModuleTypes
::
String
String
String
*
DclCache
'
DB
'.
TypeDB
*
World
->
*('
DB
'.
TypeDB
,
*
DclCache
,
*
World
)
getModuleTypes
root
mod
lib
cache
db
w
getModuleTypes
::
String
'
DB
'.
Module
'
DB
'.
Library
Bool
*
DclCache
'
DB
'.
TypeDB
*
World
->
*('
DB
'.
TypeDB
,
*
DclCache
,
*
World
)
getModuleTypes
root
mod
lib
iscore
cache
db
w
#
(
Right
dcl
,
cache
,
w
)
=
readModule
False
cache
w
#
(
icl
,
cache
,
w
)
=
readModule
True
cache
w
#
icl
=
case
icl
of
(
Left
_)
=
Nothing
;
(
Right
x
)
=
Just
x
...
...
@@ -247,6 +254,7 @@ getModuleTypes root mod lib cache db w
#
db
=
'
DB
'.
putFunctions
(
pd_generics
lib
mod
dcl
.
mod_defs
)
db
#
db
=
'
DB
'.
putDerivationss
(
pd_derivations
lib
mod
dcl
.
mod_defs
)
db
#
db
=
'
DB
'.
putMacros
(
pd_macros
lib
mod
dcl
.
mod_defs
)
db
#
db
=
'
DB
'.
putModule
lib
mod
{
zero
&
is_core
=
iscore
}
db
=
(
db
,
cache
,
w
)
where
mkdir
::
String
->
String
...
...
frontend/api.js
View file @
c661da9c
...
...
@@ -3,10 +3,14 @@ var form_libs = document.getElementsByClassName('search_libs');
var
sform
=
document
.
getElementById
(
'
search_form
'
);
var
sresults
=
document
.
getElementById
(
'
search_results
'
);
var
advanced_checkbox
=
document
.
getElementById
(
'
search_advanced
'
);
var
include_builtins_checkbox
=
document
.
getElementById
(
'
include_builtins
'
);
var
include_core_checkbox
=
document
.
getElementById
(
'
include_core
'
);
var
refresh_on_hash
=
true
;
var
old_str
=
null
;
var
old_libs
=
null
;
var
old_include_builtins
=
null
;
var
old_include_core
=
null
;
function
toggle
(
name
)
{
var
e
=
document
.
getElementById
(
name
);
...
...
@@ -53,17 +57,25 @@ function highlightCallback(span, cls, str) {
var
instancesIdCounter
=
0
;
var
derivationsIdCounter
=
0
;
function
getResults
(
str
,
libs
,
page
)
{
function
getResults
(
str
,
libs
,
include_builtins
,
include_core
,
page
)
{
if
(
str
==
null
)
str
=
old_str
;
if
(
libs
==
null
)
libs
=
old_libs
;
if
(
include_builtins
==
null
)
include_builtins
=
old_include_builtins
;
if
(
include_core
==
null
)
include_core
=
old_include_core
;
old_str
=
str
;
old_libs
=
libs
;
old_include_builtins
=
include_builtins
;
old_include_core
=
include_core
;
var
url
=
'
api.php
'
+
'
?str=
'
+
encodeURIComponent
(
str
)
+
(
libs
.
length
>
0
?
(
'
&lib=
'
+
encodeURIComponent
(
libs
[
0
]))
:
''
)
+
(
libs
.
length
>
0
?
(
'
&libs_builtin=
'
+
encodeURIComponent
(
libs
[
1
]))
:
''
)
+
(
libs
!=
-
1
?
(
'
&lib=
'
+
encodeURIComponent
(
libs
))
:
''
)
+
(
include_builtins
!=
-
1
?
'
&include_builtins=
'
+
encodeURIComponent
(
include_builtins
)
:
''
)
+
(
include_core
!=
-
1
?
'
&include_core=
'
+
encodeURIComponent
(
include_core
)
:
''
)
+
'
&page=
'
+
page
;
var
xmlHttp
=
new
XMLHttpRequest
();
...
...
@@ -321,7 +333,7 @@ function getResults(str, libs, page) {
var
par
=
elem
.
parentNode
if
(
responsedata
[
'
more_available
'
]
!=
0
)
{
par
.
innerHTML
+=
'
<div id="page-
'
+
(
page
+
1
)
+
'
">
'
+
'
<p id="more"><a href="javascript:getResults(null,null,
'
+
(
page
+
1
)
+
'
<p id="more"><a href="javascript:getResults(null,null,
null,null,
'
+
(
page
+
1
)
+
'
)">
'
+
responsedata
[
'
more_available
'
]
+
'
more...</a></p>
'
+
'
</div>
'
;
}
...
...
@@ -362,20 +374,17 @@ function makeUnifier(ufr) {
function
getLibs
()
{
if
(
!
advanced_checkbox
.
checked
)
return
[]
;
return
-
1
;
var
builtin
=
false
;
var
libs
=
[];
for
(
var
i
=
0
;
i
<
form_libs
.
length
;
i
++
)
{
if
(
form_libs
[
i
].
checked
)
{
if
(
form_libs
[
i
].
value
==
'
__builtin
'
)
builtin
=
true
;
else
if
(
form_libs
[
i
].
value
!=
'
__builtin
'
)
libs
.
push
(
form_libs
[
i
].
value
);
}
}
return
[
libs
,
builtin
]
;
return
libs
;
}
function
formsubmit
()
{
...
...
@@ -395,8 +404,15 @@ function formsubmit() {
}
var
libs
=
getLibs
();
var
include_builtins
=
-
1
;
var
include_core
=
-
1
;
if
(
advanced_checkbox
.
checked
)
{
var
include_builtins
=
include_builtins_checkbox
.
checked
;
var
include_core
=
include_core_checkbox
.
checked
;
}
sresults
.
innerHTML
+=
'
<div id="page-0"></div>
'
;
getResults
(
q
,
libs
,
0
);
getResults
(
q
,
libs
,
include_builtins
,
include_core
,
0
);
}
return
false
;
};
...
...
frontend/api.php
View file @
c661da9c
...
...
@@ -92,13 +92,15 @@ if($_SERVER['REQUEST_METHOD'] !== 'GET'){
}
if
(
isset
(
$_GET
[
'lib'
]))
{
$command
[
'libraries'
]
=
[
explode
(
','
,
$_GET
[
'lib'
]),
false
]
;
$command
[
'libraries'
]
=
explode
(
','
,
$_GET
[
'lib'
])
;
}
if
(
isset
(
$_GET
[
'libs_builtin'
]))
{
if
(
!
isset
(
$command
[
'libraries'
][
0
]))
$command
[
'libraries'
][
0
]
=
[];
$command
[
'libraries'
][
1
]
=
$_GET
[
'libs_builtin'
]
==
'true'
;
if
(
isset
(
$_GET
[
'include_builtins'
]))
{
$command
[
'include_builtins'
]
=
$_GET
[
'include_builtins'
]
==
'true'
;
}
if
(
isset
(
$_GET
[
'include_core'
]))
{
$command
[
'include_core'
]
=
$_GET
[
'include_core'
]
==
'true'
;
}
if
(
isset
(
$_GET
[
'mod'
]))
{
...
...
frontend/index.html
View file @
c661da9c
...
...
@@ -74,6 +74,8 @@
<label><input
type=
"checkbox"
id=
"search_advanced"
/>
advanced
</label>
<div
id=
"advanced"
style=
"display:none;"
>
<label><input
type=
"checkbox"
id=
"include_builtins"
checked=
"checked"
/>
Include language builtins
</label><br/>
<label><input
type=
"checkbox"
id=
"include_core"
/>
Include library cores
</label><br/>
<table
id=
"lib_selection"
>
<tr>
<th><a
title=
"Toggle selection"
href=
"javascript:toggleLibSelection('libs-clean-2.4')"
>
Clean 2.4
</a></th>
...
...
@@ -83,7 +85,6 @@
</tr>
<tr>
<td
id=
"libs-clean-2.4"
>
<label><input
type=
"checkbox"
class=
"search_libs"
checked=
"checked"
value=
"__builtin"
/>
Language builtins
</label><br/>
<label><input
type=
"checkbox"
class=
"search_libs"
checked=
"checked"
value=
"StdEnv"
/>
StdEnv
</label><br/>
<label><input
type=
"checkbox"
class=
"search_libs"
checked=
"checked"
value=
"StdLib"
/>
StdLib
</label><br/>
<label><input
type=
"checkbox"
class=
"search_libs"
checked=
"checked"
value=
"ArgEnv"
/>
ArgEnv
</label><br/>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment