...
 
Commits (1)
---
# Global Options Go Here
IndentWidth: 4
ColumnLimit: 80
---
Language: Cpp
BasedOnStyle: Google
AccessModifierOffset: -3 # to match cpplint
AllowShortIfStatementsOnASingleLine: false
AllowShortLoopsOnASingleLine: false
CommentPragmas: '^ NOLINT'
DerivePointerAlignment: false
ForEachMacros: []
IndentPPDirectives: AfterHash
IndentWidth: 4
MacroBlockBegin: "^JSNATIVE_TEST_FUNC_BEGIN$"
MacroBlockEnd: "^JSNATIVE_TEST_FUNC_END$"
PointerAlignment: Left # Google style allows both, but clang-format doesn't
SpacesBeforeTrailingComments: 2
---
# We should use eslint --fix instead, but we need to find a way to get that to
# operate on diffs like clang-format does.
Language: JavaScript
DisableFormat: true
...
installed-tests/js/jasmine.js
installed-tests/js/modules/overrides/WarnLib.js
modules/jsUnit.js
{
"env": {
"es6": true
},
"extends": "eslint:recommended",
"rules": {
"array-bracket-newline": [
"error",
"consistent"
],
"array-bracket-spacing": [
"error",
"never"
],
"arrow-spacing": "error",
"brace-style": "error",
"comma-spacing": [
"error",
{
"before": false,
"after": true
}
],
"indent": [
"error",
4,
{
"ignoredNodes": [
"CallExpression[callee.object.name=GObject][callee.property.name=registerClass] > ClassExpression:first-child"
],
"MemberExpression": "off"
}
],
"key-spacing": [
"error",
{
"beforeColon": false,
"afterColon": true
}
],
"keyword-spacing": [
"error",
{
"before": true,
"after": true
}
],
"linebreak-style": [
"error",
"unix"
],
"no-empty": [
"error",
{
"allowEmptyCatch": true
}
],
"no-implicit-coercion": [
"error",
{
"allow": ["!!"]
}
],
"no-restricted-properties": [
"error",
{
"object": "Lang",
"property": "bind",
"message": "Use arrow notation or Function.prototype.bind()"
},
{
"object": "Lang",
"property": "Class",
"message": "Use ES6 classes"
}
],
"nonblock-statement-body-position": [
"error",
"below"
],
"object-curly-newline": [
"error",
{
"consistent": true
}
],
"object-curly-spacing": "error",
"prefer-template": "error",
"quotes": [
"error",
"single",
{
"avoidEscape": true
}
],
"semi": [
"error",
"always"
],
"semi-spacing": [
"error",
{
"before": false,
"after": true
}
],
"space-before-blocks": "error",
"space-infix-ops": [
"error",
{
"int32Hint": false
}
]
},
"globals": {
"ARGV": false,
"Debugger": false,
"GIRepositoryGType": false,
"imports": false,
"Intl": false,
"log": false,
"logError": false,
"print": false,
"printerr": false,
"window": false
},
"parserOptions": {
"ecmaVersion": 2017
}
}
This diff is collapsed.
# System information #
What is your operating system and version? _(e.g. "Linux, Fedora 29" or "macOS 10.13")_
What is your version of GJS? _(e.g. "1.54.1-fc29.1" or "commit 4ab70ef")_
If the bug is related to GNOME Shell, what is your version of GNOME Shell? _(e.g. "3.30.1-2ubuntu1" or "commit b405ed64")_
# Bug information #
## Steps to reproduce ##
- Step by step, how can you make the problem appear?
- List those steps here.
- If the problem doesn't happen every time, note that as well.
Even better, if the problem can be observed by executing a standalone JS
file, paste that here instead of the steps.
Use code blocks (```js) to format it.
## Current behaviour ##
What happened that made it evident there was a problem?
Copy and paste the exact text of any error messages.
Use code blocks (```) to format them.
If the problem was with GNOME Shell, you may be able to find error
messages in the system journal (`sudo journalctl -xb`).
If GJS or GNOME Shell crashed, please include a stack trace.
For information on how to get a stack trace,
[read this wiki page](https://wiki.gnome.org/Community/GettingInTouch/Bugzilla/GettingTraces/Details).
## Expected behaviour ##
What did you expect to see instead?
/label ~"1. Bug"
# Description #
Explain why this feature should be added.
Specific use cases are best.
# Prior Art #
List any comparable features in other JavaScript environments that you
are aware of.
/label ~"1. Feature"
This diff is collapsed.
# This is the toplevel CPPLINT.cfg file
set noparent
# We give a limit to clang-format of 80, but we allow 100 here for cases where
# it really is more readable to have a longer line
linelength=100
This diff is collapsed.
This diff is collapsed.
README.md
\ No newline at end of file
[![Build Status](https://gitlab.gnome.org/GNOME/gjs/badges/master/build.svg)](https://gitlab.gnome.org/GNOME/gjs/pipelines)
[![Coverage report](https://gitlab.gnome.org/GNOME/gjs/badges/master/coverage.svg)](https://gnome.pages.gitlab.gnome.org/gjs/)
[![Contributors](https://img.shields.io/github/contributors/GNOME/gjs.svg)](https://gitlab.gnome.org/GNOME/gjs/graphs/master)
[![LoC](https://tokei.rs/b1/github/GNOME/gjs?category=code)](https://gnome.pages.gitlab.gnome.org/gjs/report.txt)
[![Last commit](https://img.shields.io/github/last-commit/GNOME/gjs.svg)](https://gitlab.gnome.org/GNOME/gjs/commits/master)
[![Search hit](https://img.shields.io/github/search/GNOME/gjs/goto.svg?label=github%20hits)](https://github.com/search?utf8=%E2%9C%93&q=gjs&type=)
[![License](https://img.shields.io/badge/License-LGPL%20v2%2B-blue.svg)](https://gitlab.gnome.org/GNOME/gjs/blob/master/COPYING)
[![License](https://img.shields.io/badge/License-MIT-blue.svg)](https://gitlab.gnome.org/GNOME/gjs/blob/master/COPYING)
JavaScript bindings for GNOME
=============================
Use the GNOME platform libraries in your JavaScript programs.
GJS powers GNOME Shell, Polari, GNOME Documents, and many other apps.
Under the hood it uses SpiderMonkey, Mozilla's JavaScript engine
originally developed for Firefox.
Wiki: https://gitlab.gnome.org/GNOME/gjs/wikis/Home
## Installation
Available as part of your GNOME distribution by default.
In most package managers the package will be called `gjs`.
## Usage
GJS includes a command-line interpreter, usually installed in
`/usr/bin/gjs`.
Type `gjs` to start it and test out your JavaScript statements
interactively.
Hit Ctrl+D to exit.
`gjs filename.js` runs a whole program.
`gjs -d filename.js` does that and starts a debugger as well.
There are also facilities for generating code coverage reports.
Type `gjs --help` for more information.
## Contributing
For instructions on how to get started contributing to GJS, please read
the contributing guide,
<https://gitlab.gnome.org/GNOME/gjs/blob/master/CONTRIBUTING.md>.
## History
GJS probably started in August 2008 with [this blog post][havocp] and
[this experimental code][gscript].
GJS in its current form was first developed in October 2008 at a company
called litl, for their [litl webbook] product.
It was soon adopted as the basis of [GNOME Shell]'s UI code and
extensions system and debuted as a fundamental component of GNOME 3.0.
In February 2013 at the GNOME Developer Experience Hackfest GJS was
declared the ['first among equals'][treitter] of languages for GNOME
application development.
That proved controversial for many, and was later abandoned.
At the time of writing (2018) GJS is used in many systems including
Endless OS's [framework for offline content][eos-knowledge-lib] and, as
a forked version, [Cinnamon].
## Reading material
### JavaScript & SpiderMonkey
* https://github.com/spidermonkey-embedders/spidermonkey-embedding-examples
### GNOME Contribution
* https://wiki.gnome.org/GitLab
* https://wiki.gnome.org/Newcomers/
## License
Dual licensed under LGPL 2.0+ and MIT.
## Thanks ##
The form of this README was inspired by [Nadia Odunayo][hospitable] on
the Greater Than Code podcast.
[havocp]: https://blog.ometer.com/2008/08/25/embeddable-languages/
[gscript]: https://gitlab.gnome.org/Archive/gscript/tree/master/gscript
[litl webbook]: https://en.wikipedia.org/wiki/Litl
[GNOME Shell]: https://wiki.gnome.org/Projects/GnomeShell
[treitter]: https://treitter.livejournal.com/14871.html
[eos-knowledge-lib]: http://endlessm.github.io/eos-knowledge-lib/
[Cinnamon]: https://en.wikipedia.org/wiki/Cinnamon_(software)
[hospitable]: http://www.greaterthancode.com/2017/11/08/054-code-hospitality-with-nadia-odunayo/
[![Build Status](https://gitlab.gnome.org/GNOME/gjs/badges/master/build.svg)](https://gitlab.gnome.org/GNOME/gjs/pipelines)
[![Coverage report](https://gitlab.gnome.org/GNOME/gjs/badges/master/coverage.svg)](https://gnome.pages.gitlab.gnome.org/gjs/)
[![Contributors](https://img.shields.io/github/contributors/GNOME/gjs.svg)](https://gitlab.gnome.org/GNOME/gjs/graphs/master)
[![LoC](https://tokei.rs/b1/github/GNOME/gjs?category=code)](https://gnome.pages.gitlab.gnome.org/gjs/report.txt)
[![Last commit](https://img.shields.io/github/last-commit/GNOME/gjs.svg)](https://gitlab.gnome.org/GNOME/gjs/commits/master)
[![Search hit](https://img.shields.io/github/search/GNOME/gjs/goto.svg?label=github%20hits)](https://github.com/search?utf8=%E2%9C%93&q=gjs&type=)
[![License](https://img.shields.io/badge/License-LGPL%20v2%2B-blue.svg)](https://gitlab.gnome.org/GNOME/gjs/blob/master/COPYING)
[![License](https://img.shields.io/badge/License-MIT-blue.svg)](https://gitlab.gnome.org/GNOME/gjs/blob/master/COPYING)
JavaScript bindings for GNOME
=============================
Use the GNOME platform libraries in your JavaScript programs.
GJS powers GNOME Shell, Polari, GNOME Documents, and many other apps.
Under the hood it uses SpiderMonkey, Mozilla's JavaScript engine
originally developed for Firefox.
Wiki: https://gitlab.gnome.org/GNOME/gjs/wikis/Home
## Installation
Available as part of your GNOME distribution by default.
In most package managers the package will be called `gjs`.
## Usage
GJS includes a command-line interpreter, usually installed in
`/usr/bin/gjs`.
Type `gjs` to start it and test out your JavaScript statements
interactively.
Hit Ctrl+D to exit.
`gjs filename.js` runs a whole program.
`gjs -d filename.js` does that and starts a debugger as well.
There are also facilities for generating code coverage reports.
Type `gjs --help` for more information.
## Contributing
For instructions on how to get started contributing to GJS, please read
the contributing guide,
<https://gitlab.gnome.org/GNOME/gjs/blob/master/CONTRIBUTING.md>.
## History
GJS probably started in August 2008 with [this blog post][havocp] and
[this experimental code][gscript].
GJS in its current form was first developed in October 2008 at a company
called litl, for their [litl webbook] product.
It was soon adopted as the basis of [GNOME Shell]'s UI code and
extensions system and debuted as a fundamental component of GNOME 3.0.
In February 2013 at the GNOME Developer Experience Hackfest GJS was
declared the ['first among equals'][treitter] of languages for GNOME
application development.
That proved controversial for many, and was later abandoned.
At the time of writing (2018) GJS is used in many systems including
Endless OS's [framework for offline content][eos-knowledge-lib] and, as
a forked version, [Cinnamon].
## Reading material
### JavaScript & SpiderMonkey
* https://github.com/spidermonkey-embedders/spidermonkey-embedding-examples
### GNOME Contribution
* https://wiki.gnome.org/GitLab
* https://wiki.gnome.org/Newcomers/
## License
Dual licensed under LGPL 2.0+ and MIT.
## Thanks ##
The form of this README was inspired by [Nadia Odunayo][hospitable] on
the Greater Than Code podcast.
[havocp]: https://blog.ometer.com/2008/08/25/embeddable-languages/
[gscript]: https://gitlab.gnome.org/Archive/gscript/tree/master/gscript
[litl webbook]: https://en.wikipedia.org/wiki/Litl
[GNOME Shell]: https://wiki.gnome.org/Projects/GnomeShell
[treitter]: https://treitter.livejournal.com/14871.html
[eos-knowledge-lib]: http://endlessm.github.io/eos-knowledge-lib/
[Cinnamon]: https://en.wikipedia.org/wiki/Cinnamon_(software)
[hospitable]: http://www.greaterthancode.com/2017/11/08/054-code-hospitality-with-nadia-odunayo/
This diff is collapsed.
#! /bin/sh
# Wrapper for compilers which do not understand '-c -o'.
scriptversion=2018-03-07.03; # UTC
# Copyright (C) 1999-2018 Free Software Foundation, Inc.
# Written by Tom Tromey <tromey@cygnus.com>.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that program.
# This file is maintained in Automake, please report
# bugs to <bug-automake@gnu.org> or send patches to
# <automake-patches@gnu.org>.
nl='
'
# We need space, tab and new line, in precisely that order. Quoting is
# there to prevent tools from complaining about whitespace usage.
IFS=" "" $nl"
file_conv=
# func_file_conv build_file lazy
# Convert a $build file to $host form and store it in $file
# Currently only supports Windows hosts. If the determined conversion
# type is listed in (the comma separated) LAZY, no conversion will
# take place.
func_file_conv ()
{
file=$1
case $file in
/ | /[!/]*) # absolute file, and not a UNC file
if test -z "$file_conv"; then
# lazily determine how to convert abs files
case `uname -s` in
MINGW*)
file_conv=mingw
;;
CYGWIN*)
file_conv=cygwin
;;
*)
file_conv=wine
;;
esac
fi
case $file_conv/,$2, in
*,$file_conv,*)
;;
mingw/*)
file=`cmd //C echo "$file " | sed -e 's/"\(.*\) " *$/\1/'`
;;
cygwin/*)
file=`cygpath -m "$file" || echo "$file"`
;;
wine/*)
file=`winepath -w "$file" || echo "$file"`
;;
esac
;;
esac
}
# func_cl_dashL linkdir
# Make cl look for libraries in LINKDIR
func_cl_dashL ()
{
func_file_conv "$1"
if test -z "$lib_path"; then
lib_path=$file
else
lib_path="$lib_path;$file"
fi
linker_opts="$linker_opts -LIBPATH:$file"
}
# func_cl_dashl library
# Do a library search-path lookup for cl
func_cl_dashl ()
{
lib=$1
found=no
save_IFS=$IFS
IFS=';'
for dir in $lib_path $LIB
do
IFS=$save_IFS
if $shared && test -f "$dir/$lib.dll.lib"; then
found=yes
lib=$dir/$lib.dll.lib
break
fi
if test -f "$dir/$lib.lib"; then
found=yes
lib=$dir/$lib.lib
break
fi
if test -f "$dir/lib$lib.a"; then
found=yes
lib=$dir/lib$lib.a
break
fi
done
IFS=$save_IFS
if test "$found" != yes; then
lib=$lib.lib
fi
}
# func_cl_wrapper cl arg...
# Adjust compile command to suit cl
func_cl_wrapper ()
{
# Assume a capable shell
lib_path=
shared=:
linker_opts=
for arg
do
if test -n "$eat"; then
eat=
else
case $1 in
-o)
# configure might choose to run compile as 'compile cc -o foo foo.c'.
eat=1
case $2 in
*.o | *.[oO][bB][jJ])
func_file_conv "$2"
set x "$@" -Fo"$file"
shift
;;
*)
func_file_conv "$2"
set x "$@" -Fe"$file"
shift
;;
esac
;;
-I)
eat=1
func_file_conv "$2" mingw
set x "$@" -I"$file"
shift
;;
-I*)
func_file_conv "${1#-I}" mingw
set x "$@" -I"$file"
shift
;;
-l)
eat=1
func_cl_dashl "$2"
set x "$@" "$lib"
shift
;;
-l*)
func_cl_dashl "${1#-l}"
set x "$@" "$lib"
shift
;;
-L)
eat=1
func_cl_dashL "$2"
;;
-L*)
func_cl_dashL "${1#-L}"
;;
-static)
shared=false
;;
-Wl,*)
arg=${1#-Wl,}
save_ifs="$IFS"; IFS=','
for flag in $arg; do
IFS="$save_ifs"
linker_opts="$linker_opts $flag"
done
IFS="$save_ifs"
;;
-Xlinker)
eat=1
linker_opts="$linker_opts $2"
;;
-*)
set x "$@" "$1"
shift
;;
*.cc | *.CC | *.cxx | *.CXX | *.[cC]++)
func_file_conv "$1"
set x "$@" -Tp"$file"
shift
;;
*.c | *.cpp | *.CPP | *.lib | *.LIB | *.Lib | *.OBJ | *.obj | *.[oO])
func_file_conv "$1" mingw
set x "$@" "$file"
shift
;;
*)
set x "$@" "$1"
shift
;;
esac
fi
shift
done
if test -n "$linker_opts"; then
linker_opts="-link$linker_opts"
fi
exec "$@" $linker_opts
exit 1
}
eat=
case $1 in
'')
echo "$0: No command. Try '$0 --help' for more information." 1>&2
exit 1;
;;
-h | --h*)
cat <<\EOF
Usage: compile [--help] [--version] PROGRAM [ARGS]
Wrapper for compilers which do not understand '-c -o'.
Remove '-o dest.o' from ARGS, run PROGRAM with the remaining
arguments, and rename the output as expected.
If you are trying to build a whole package this is not the
right script to run: please start by reading the file 'INSTALL'.
Report bugs to <bug-automake@gnu.org>.
EOF
exit $?
;;
-v | --v*)
echo "compile $scriptversion"
exit $?
;;
cl | *[/\\]cl | cl.exe | *[/\\]cl.exe | \
icl | *[/\\]icl | icl.exe | *[/\\]icl.exe )
func_cl_wrapper "$@" # Doesn't return...
;;
esac
ofile=
cfile=
for arg
do
if test -n "$eat"; then
eat=
else
case $1 in
-o)
# configure might choose to run compile as 'compile cc -o foo foo.c'.
# So we strip '-o arg' only if arg is an object.
eat=1
case $2 in
*.o | *.obj)
ofile=$2
;;
*)
set x "$@" -o "$2"
shift
;;
esac
;;
*.c)
cfile=$1
set x "$@" "$1"
shift
;;
*)
set x "$@" "$1"
shift
;;
esac
fi
shift
done
if test -z "$ofile" || test -z "$cfile"; then
# If no '-o' option was seen then we might have been invoked from a
# pattern rule where we don't need one. That is ok -- this is a
# normal compilation that the losing compiler can handle. If no
# '.c' file was seen then we are probably linking. That is also
# ok.
exec "$@"
fi
# Name of file we expect compiler to create.
cofile=`echo "$cfile" | sed 's|^.*[\\/]||; s|^[a-zA-Z]:||; s/\.c$/.o/'`
# Create the lock directory.
# Note: use '[/\\:.-]' here to ensure that we don't use the same name
# that we are using for the .o file. Also, base the name on the expected
# object file name, since that is what matters with a parallel build.
lockdir=`echo "$cofile" | sed -e 's|[/\\:.-]|_|g'`.d
while true; do
if mkdir "$lockdir" >/dev/null 2>&1; then
break
fi
sleep 1
done
# FIXME: race condition here if user kills between mkdir and trap.
trap "rmdir '$lockdir'; exit 1" 1 2 15
# Run the compile.
"$@"
ret=$?
if test -f "$cofile"; then
test "$cofile" = "$ofile" || mv "$cofile" "$ofile"
elif test -f "${cofile}bj"; then
test "${cofile}bj" = "$ofile" || mv "${cofile}bj" "$ofile"
fi
rmdir "$lockdir"
exit $ret
# Local Variables:
# mode: shell-script
# sh-indentation: 2
# eval: (add-hook 'before-save-hook 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-time-zone: "UTC0"
# time-stamp-end: "; # UTC"
# End:
This diff is collapsed.
/* config.h.in. Generated from configure.ac by autoheader. */
/* Define if you want to build with cairo support */
#undef ENABLE_CAIRO
/* Define if you want to build with GTK+ support */
#undef ENABLE_GTK
/* Define if the profiler should be built. */
#undef ENABLE_PROFILER
/* The name of the gettext domain */
#undef GETTEXT_PACKAGE
/* The gjs version as an integer */
#undef GJS_VERSION
/* define if the compiler supports basic C++14 syntax */
#undef HAVE_CXX14
/* Define to 1 if SpiderMonkey was compiled with --enable-debug */
#undef HAVE_DEBUG_SPIDERMONKEY
/* Define to 1 if you have the <dlfcn.h> header file. */
#undef HAVE_DLFCN_H
/* Define to 1 if using dtrace probes. */
#undef HAVE_DTRACE
/* Define to 1 if you have the <inttypes.h> header file. */
#undef HAVE_INTTYPES_H
/* Define to 1 if you have the <memory.h> header file. */
#undef HAVE_MEMORY_H
/* Define to 1 if printf() accepts '%Id' for alternative integer output */
#undef HAVE_PRINTF_ALTERNATIVE_INT
/* Define to 1 if you have the <readline/readline.h> header file. */
#undef HAVE_READLINE_READLINE_H
/* Define to 1 if you have the <stdint.h> header file. */
#undef HAVE_STDINT_H
/* Define to 1 if you have the <stdlib.h> header file. */
#undef HAVE_STDLIB_H
/* Define to 1 if you have the <strings.h> header file. */
#undef HAVE_STRINGS_H
/* Define to 1 if you have the <string.h> header file. */
#undef HAVE_STRING_H
/* Define to 1 if you have the <sys/stat.h> header file. */
#undef HAVE_SYS_STAT_H
/* Define to 1 if you have the <sys/syscall.h> header file. */
#undef HAVE_SYS_SYSCALL_H
/* Define to 1 if you have the <sys/types.h> header file. */
#undef HAVE_SYS_TYPES_H
/* Define to 1 if you have the `timer_settime' function. */
#undef HAVE_TIMER_SETTIME
/* Define to 1 if you have the <unistd.h> header file. */
#undef HAVE_UNISTD_H
/* Define to the sub-directory where libtool stores uninstalled libraries. */
#undef LT_OBJDIR
/* Name of package */
#undef PACKAGE
/* Define to the address where bug reports for this package should be sent. */
#undef PACKAGE_BUGREPORT
/* Define to the full name of this package. */
#undef PACKAGE_NAME
/* Define to the full name and version of this package. */
#undef PACKAGE_STRING
/* Define to the one symbol short name of this package. */
#undef PACKAGE_TARNAME
/* Define to the home page for this package. */
#undef PACKAGE_URL
/* Define to the version of this package. */
#undef PACKAGE_VERSION
/* Define to 1 if you have the ANSI C header files. */
#undef STDC_HEADERS
/* Enable extensions on AIX 3, Interix. */
#ifndef _ALL_SOURCE
# undef _ALL_SOURCE
#endif
/* Enable general extensions on macOS. */
#ifndef _DARWIN_C_SOURCE
# undef _DARWIN_C_SOURCE
#endif
/* Enable GNU extensions on systems that have them. */
#ifndef _GNU_SOURCE
# undef _GNU_SOURCE
#endif
/* Enable NetBSD extensions on NetBSD. */
#ifndef _NETBSD_SOURCE
# undef _NETBSD_SOURCE
#endif
/* Enable OpenBSD extensions on NetBSD. */
#ifndef _OPENBSD_SOURCE
# undef _OPENBSD_SOURCE
#endif
/* Enable threading extensions on Solaris. */
#ifndef _POSIX_PTHREAD_SEMANTICS
# undef _POSIX_PTHREAD_SEMANTICS
#endif
/* Enable extensions specified by ISO/IEC TS 18661-5:2014. */
#ifndef __STDC_WANT_IEC_60559_ATTRIBS_EXT__
# undef __STDC_WANT_IEC_60559_ATTRIBS_EXT__
#endif
/* Enable extensions specified by ISO/IEC TS 18661-1:2014. */
#ifndef __STDC_WANT_IEC_60559_BFP_EXT__
# undef __STDC_WANT_IEC_60559_BFP_EXT__
#endif
/* Enable extensions specified by ISO/IEC TS 18661-2:2015. */
#ifndef __STDC_WANT_IEC_60559_DFP_EXT__
# undef __STDC_WANT_IEC_60559_DFP_EXT__
#endif
/* Enable extensions specified by ISO/IEC TS 18661-4:2015. */
#ifndef __STDC_WANT_IEC_60559_FUNCS_EXT__
# undef __STDC_WANT_IEC_60559_FUNCS_EXT__
#endif
/* Enable extensions specified by ISO/IEC TS 18661-3:2015. */
#ifndef __STDC_WANT_IEC_60559_TYPES_EXT__
# undef __STDC_WANT_IEC_60559_TYPES_EXT__
#endif
/* Enable extensions specified by ISO/IEC TR 24731-2:2010. */
#ifndef __STDC_WANT_LIB_EXT2__
# undef __STDC_WANT_LIB_EXT2__
#endif
/* Enable extensions specified by ISO/IEC 24747:2009. */
#ifndef __STDC_WANT_MATH_SPEC_FUNCS__
# undef __STDC_WANT_MATH_SPEC_FUNCS__
#endif
/* Enable extensions on HP NonStop. */
#ifndef _TANDEM_SOURCE
# undef _TANDEM_SOURCE
#endif
/* Enable X/Open extensions if necessary. HP-UX 11.11 defines
mbstate_t only if _XOPEN_SOURCE is defined to 500, regardless of
whether compiling with -Ae or -D_HPUX_SOURCE=1. */
#ifndef _XOPEN_SOURCE
# undef _XOPEN_SOURCE
#endif
/* Enable general extensions on Solaris. */
#ifndef __EXTENSIONS__
# undef __EXTENSIONS__
#endif
/* Version number of package */
#undef VERSION
/* Define to 1 if on MINIX. */
#undef _MINIX
/* Define to 1 to make NetBSD features available. MINIX 3 needs this. */
#undef _NETBSD_SOURCE
/* Define to 2 if the system does not provide POSIX.1 features except with
this defined. */
#undef _POSIX_1_SOURCE
/* Define to 1 if you need to in order for 'stat' and other things to work. */
#undef _POSIX_SOURCE
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
In order to run those example scripts, do:
gjs-console script-filename.js
#!/usr/bin/env gjs
imports.gi.versions.Gtk = '3.0';
const {Gtk} = imports.gi;
Gtk.init(null);
var calc_val = '';
function update_display() {
label.set_markup(`<span size='30000'>${calc_val}</span>`);
if (calc_val === '') {
label.set_markup("<span size='30000'>0</span>");
}
}
function clear() {
calc_val = '';
update_display();
}
function backspace() {
calc_val = calc_val.substring(0, calc_val.length - 1);
update_display();
}
function pressed_equals() {
calc_val = calc_val.replace('sin', 'Math.sin');
calc_val = calc_val.replace('cos', 'Math.cos');
calc_val = calc_val.replace('tan', 'Math.tan');
calc_val = eval(calc_val);
// Avoid ridiculous amounts of precision from toString.
if (calc_val == Math.floor(calc_val))
calc_val = Math.floor(calc_val);
else // bizarrely gjs loses str.toFixed() somehow?!
calc_val = Math.floor(calc_val * 10000) / 10000;
label.set_markup(`<span size='30000'>${calc_val}</span>`);
}
function pressed_operator(button) {
calc_val += button.label;
update_display();
}
function pressed_number(button) {
calc_val = (((calc_val === 0) ? '' : calc_val) + button.label);
update_display();
}
function swap_sign() {
calc_val = ((calc_val[0] == '-') ?
calc_val.substring(1) : `-${calc_val}`);
update_display();
}
function random_num() {
calc_val = `${Math.floor(Math.random() * 1000)}`;
update_display();
}
function pack_buttons(buttons, vbox) {
var hbox = new Gtk.HBox();
hbox.homogeneous = true;
vbox.pack_start(hbox, true, true, 2);
for (let i = 0; i <= 4; i++) {
hbox.pack_start(buttons[i], true, true, 1);
}
}
function create_button(str, func) {
var btn = new Gtk.Button({label: str});
btn.connect('clicked', func);
return btn;
}
function create_buttons() {
var vbox = new Gtk.VBox({homogeneous: true});
pack_buttons([
create_button('(', pressed_number),
create_button('', backspace),
create_button('', random_num),
create_button('Clr', clear),
create_button('±', swap_sign)
], vbox);
pack_buttons([
create_button(')', pressed_number),
create_button('7', pressed_number),
create_button('8', pressed_number),
create_button('9', pressed_number),
create_button('/', pressed_operator)
], vbox);
pack_buttons([
create_button('sin(', pressed_number),
create_button('4', pressed_number),
create_button('5', pressed_number),
create_button('6', pressed_number),
create_button('*', pressed_operator)
], vbox);
pack_buttons([
create_button('cos(', pressed_number),
create_button('1', pressed_number),
create_button('2', pressed_number),
create_button('3', pressed_number),
create_button('-', pressed_operator)
], vbox);
pack_buttons([
create_button('tan(', pressed_number),
create_button('0', pressed_number),
create_button('.', pressed_number),
create_button('=', pressed_equals),
create_button('+', pressed_operator)
], vbox);
return vbox;
}
var win = new Gtk.Window({
title: 'Calculator',
resizable: false,
opacity: 0.6,
});
win.resize(250, 250);
win.connect('destroy', () => Gtk.main_quit());
var label = new Gtk.Label({label: ''});
label.set_alignment(1, 0);
update_display();
var mainvbox = new Gtk.VBox();
mainvbox.pack_start(label, false, true, 1);
mainvbox.pack_start(new Gtk.HSeparator(), false, true, 5);
mainvbox.pack_start(create_buttons(), true, true, 2);
win.add(mainvbox);
win.show_all();
Gtk.main();
\ No newline at end of file
imports.gi.versions.Gtk = '3.0';
const Gettext = imports.gettext;
const Gtk = imports.gi.Gtk;
Gettext.bindtextdomain('gnome-panel-3.0', '/usr/share/locale');
Gettext.textdomain('gnome-panel-3.0');
Gtk.init(null);
let w = new Gtk.Window({type: Gtk.WindowType.TOPLEVEL});
w.add(new Gtk.Label({label: Gettext.gettext('Panel')}));
w.show_all();
Gtk.main();
// See the note about Application.run() at the bottom of the script
const System = imports.system;
// Include this in case both GTK3 and GTK4 installed, otherwise an exception
// will be thrown
imports.gi.versions.Gtk = '3.0';
const Gio = imports.gi.Gio;
const GLib = imports.gi.GLib;
const GObject = imports.gi.GObject;
const Gtk = imports.gi.Gtk;
// An example GtkApplication with a few bells and whistles, see also:
// https://wiki.gnome.org/HowDoI/GtkApplication
var ExampleApplication = GObject.registerClass({
Properties: {
'exampleprop': GObject.ParamSpec.string(
'exampleprop', // property name
'ExampleProperty', // nickname
'An example read write property', // description
GObject.ParamFlags.READWRITE, // read/write/construct...
'' // implement defaults manually
)
},
Signals: {'examplesig': {param_types: [GObject.TYPE_INT]}},
}, class ExampleApplication extends Gtk.Application {
_init() {
super._init({
application_id: 'org.gnome.gjs.ExampleApplication',
flags: Gio.ApplicationFlags.FLAGS_NONE
});
}
// Example property getter/setter
get exampleprop() {
if (typeof this._exampleprop === 'undefined') {
return 'a default value';
}
return this._exampleprop;
}
set exampleprop(value) {
this._exampleprop = value;
// notify() has to be called, if you want it
this.notify('exampleprop');
}
// Example signal emission
emit_examplesig(number) {
this.emit('examplesig', number);
}
vfunc_startup() {
super.vfunc_startup();
// An example GAction, see: https://wiki.gnome.org/HowDoI/GAction
let exampleAction = new Gio.SimpleAction({
name: 'exampleAction',
parameter_type: new GLib.VariantType('s')
});
exampleAction.connect('activate', (action, param) => {
param = param.deep_unpack().toString();
if (param === 'exampleParameter') {
log('Yes!');
}
});
this.add_action(exampleAction);
}
vfunc_activate() {
super.vfunc_activate();
this.hold();
// Example ApplicationWindow
let window = new Gtk.ApplicationWindow({
application: this,
title: 'Example Application Window',
default_width: 300,
default_height: 200
});
let label = new Gtk.Label({label: this.exampleprop});
window.add(label);
window.connect('delete-event', () => {
this.quit();
});
window.show_all();
// Example GNotification, see: https://developer.gnome.org/GNotification/
let notif = new Gio.Notification();
notif.set_title('Example Notification');
notif.set_body('Example Body');
notif.set_icon(
new Gio.ThemedIcon({name: 'dialog-information-symbolic'})
);
// A default action for when the body of the notification is clicked
notif.set_default_action("app.exampleAction('exampleParameter')");
// A button for the notification
notif.add_button(
'Button Text',
"app.exampleAction('exampleParameter')"
);
// This won't actually be shown, since an application needs a .desktop
// file with a base name matching the application id
this.send_notification('example-notification', notif);
// Withdraw
this.withdraw_notification('example-notification');
}
});
// The proper way to run a Gtk.Application or Gio.Application is take ARGV and
// prepend the program name to it, and pass that to run()
let app = new ExampleApplication();
app.run([System.programInvocationName].concat(ARGV));
// Or a one-liner...
// (new ExampleApplication()).run([System.programInvocationName].concat(ARGV));
imports.gi.versions.Gtk = '3.0';
imports.gi.versions.WebKit2 = '4.0';
const Gtk = imports.gi.Gtk;
const WebKit = imports.gi.WebKit2;
Gtk.init(null);
let win = new Gtk.Window();
let view = new WebKit.WebView();
view.load_uri('http://www.google.com/');
win.add(view);
win.connect('destroy', () => {
Gtk.main_quit();
});
win.set_size_request(640, 480);
win.show_all();
Gtk.main();
This diff is collapsed.
<?xml version="1.0" encoding="UTF-8"?>
<Project xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
xmlns:foaf="http://xmlns.com/foaf/0.1/"
xmlns:gnome="http://api.gnome.org/doap-extensions#"
xmlns="http://usefulinc.com/ns/doap#">
<name>gjs</name>
<shortname>gjs</shortname>
<category rdf:resource="http://api.gnome.org/doap-extensions#core" />
<shortdesc xml:lang="en">GNOME JavaScript bindings</shortdesc>
<description xml:lang="en">GNOME JavaScript bindings</description>
<homepage rdf:resource="https://wiki.gnome.org/Projects/Gjs" />
<license rdf:resource="http://usefulinc.com/doap/licenses/gpl" />
<license rdf:resource="http://usefulinc.com/doap/licenses/lgpl" />
<license rdf:resource="http://usefulinc.com/doap/licenses/mpl" />
<bug-database rdf:resource="https://gitlab.gnome.org/GNOME/gjs/"/>
<download-page rdf:resource="http://download.gnome.org/sources/gjs/" />
<mailing-list rdf:resource="mailto:javascript-list@gnome.org" />
<programming-language>C++</programming-language>
<maintainer>
<foaf:Person>
<foaf:name>Philip Chimento</foaf:name>
<foaf:mbox rdf:resource="mailto:philip.chimento@gmail.com"/>
<foaf:nick>ptomato</foaf:nick>
<gnome:userid>pchimento</gnome:userid>
</foaf:Person>
</maintainer>
<maintainer>
<foaf:Person>
<foaf:name>Cosimo Cecchi</foaf:name>
<foaf:mbox rdf:resource="mailto:cosimoc@src.gnome.org"/>
<gnome:userid>cosimoc</gnome:userid>
</foaf:Person>
</maintainer>
<maintainer>
<foaf:Person>
<foaf:name>Giovanni Campagna</foaf:name>
<foaf:mbox rdf:resource="mailto:gcampagna@src.gnome.org"/>
<gnome:userid>gcampagna</gnome:userid>
</foaf:Person>
</maintainer>
</Project>
This diff is collapsed.
{
"rules": {
"no-debugger": "off"
}
}
run
if ($_exitcode == 0)
quit
end
{
"env": {
"jasmine": true
},
"globals": {
"clearInterval": false,
"clearTimeout": false,
"setInterval": false,
"setTimeout": false
}
}
\ No newline at end of file
{
"rules": {
"no-unused-vars": [
"error",
{
"varsIgnorePattern": "^_init$"
}
]
}
}
#!/bin/sh
if test "$GJS_USE_UNINSTALLED_FILES" = "1"; then
gjs="$LOG_COMPILER $LOG_FLAGS $TOP_BUILDDIR/gjs-console"
else
gjs="$LOG_COMPILER $LOG_FLAGS gjs-console"
fi
# Avoid interference in the profiler tests from stray environment variable
unset GJS_ENABLE_PROFILER
total=0
report () {
exit_code=$?
total=$((total + 1))
if test $exit_code -eq 0; then
echo "ok $total - $1"
else
echo "not ok $total - $1 [EXIT CODE: $exit_code]"
fi
}
report_timeout () {
exit_code=$?
total=$((total + 1))
if test $exit_code -eq 0 -o $exit_code -eq 124; then
echo "ok $total - $1"
else
echo "not ok $total - $1 [EXIT CODE: $exit_code]"
fi
}
report_xfail () {
exit_code=$?
total=$((total + 1))
if test $exit_code -ne 0; then
echo "ok $total - $1"
else
echo "not ok $total - $1"
fi
}
skip () {
total=$((total + 1))
echo "ok $total - $1 # SKIP $2"
}
#!/bin/bash
DIR="$( cd "$( dirname "${0}" )" && pwd )"
source "${DIR}"/common.sh
# Run the examples
$gjs examples/gio-cat.js Makefile
report "run the gio-cat.js example"
if [[ -n "${ENABLE_GTK}" ]]; then
export graphical_gjs="xvfb-run -a --server-args='-screen 0 1024x768x24' dbus-run-session -- $gjs"
eval timeout 5s $graphical_gjs examples/calc.js
report_timeout "run the calc.js example"
eval timeout 5s $graphical_gjs examples/gtk.js
report_timeout "run the gtk.js example"
eval timeout 5s $graphical_gjs examples/gtk-application.js
report_timeout "run the gtk-application.js example"
eval timeout 5s $graphical_gjs examples/gettext.js
report_timeout "run the gettext.js example"
eval timeout 15s $graphical_gjs examples/webkit.js
report_timeout "run the webkit.js example"
else
skip "run the calc.js example" "running without GTK"
skip "run the gtk.js example" "running without GTK"
skip "run the gtk-application.js example" "running without GTK"
skip "run the gettext.js example" "running without GTK"
skip "run the webkit.js example" "running without GTK"
fi
echo "1..$total"
This diff is collapsed.
#ifndef __RESOURCE_jsunit_resources_H__
#define __RESOURCE_jsunit_resources_H__
#include <gio/gio.h>
extern GResource *jsunit_resources_get_resource (void);
#endif
This diff is collapsed.
File added
File added
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
{
"rules": {
"no-unused-vars": [
"error",
{
"varsIgnorePattern": "^_init$"
}
]
}
}
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.