Commit a4ae62c2 authored by Gianluca Roveda's avatar Gianluca Roveda
Browse files

Merge branch 'master' into 'master'

# Conflicts:
#   Dockerfile
#   README.md
#   jupyter_c_kernel_pvcheck/kernel.py
#   setup.py
Showing with 190 additions and 4 deletions
+190 -4
......@@ -21,4 +21,3 @@ RUN jupyter-kernelspec install jupyter_c_kernel_pvcheck/c_spec/
RUN chmod 777 -R /home/jovyan/
WORKDIR /home/$NB_USER/
......@@ -55,4 +55,4 @@ If the code compiles and runs without errors, pvcheck is optionally run. Input a
- Block the output diplay in case of massive amounts of lines written, i.e. in infinite loops, to avoid browser crashes √ USE EXT LIMIT_OUTPUT
- Find a way to allow interactive input (through pty and select() maybe?)
- Find a fix for the syntax highlighting not working on new cells √ REFRESH THE PAGE, this is something related to the javascript front-end
- Manage extension
- Manage extension
\ No newline at end of file
%% Cell type:markdown id: tags:
# Valid code
%% Cell type:code id: tags:
``` c
#include <stdio.h>
int main() {
printf("Hello world\n");
}
```
%% Output
Hello world
%% Cell type:markdown id: tags:
But the kernel will also display compilations warnings and errors if we have some. Let's try to remove the `#include <stdio.h>` statement, which if necessary for `printf` to work.
%% Cell type:markdown id: tags:
# Code generating warnings during compilation
%% Cell type:code id: tags:
``` c
int main() {
printf("Hello world\n");
}
```
%% Output
/var/folders/31/qct57s856n5f0b2r4tgbmn1c0000gn/T/tmp0Qan0v.c:2:5: warning: implicitly declaring library function 'printf' with type 'int (const char *, ...)' [-Wimplicit-function-declaration]
printf("Hello world\n");
^
/var/folders/31/qct57s856n5f0b2r4tgbmn1c0000gn/T/tmp0Qan0v.c:2:5: note: include the header <stdio.h> or explicitly provide a declaration for 'printf'
1 warning generated.
Hello world
%% Cell type:markdown id: tags:
You can see that the warning are displayed, but the code is still executed.
%% Cell type:markdown id: tags:
# Code generating errors during compilation
%% Cell type:code id: tags:
``` c
int main() {
printf("Hello world")
}
```
%% Output
/var/folders/31/qct57s856n5f0b2r4tgbmn1c0000gn/T/tmpw4Kz3c.c:2:5: warning: implicitly declaring library function 'printf' with type 'int (const char *, ...)' [-Wimplicit-function-declaration]
printf("Hello world")
^
/var/folders/31/qct57s856n5f0b2r4tgbmn1c0000gn/T/tmpw4Kz3c.c:2:5: note: include the header <stdio.h> or explicitly provide a declaration for 'printf'
/var/folders/31/qct57s856n5f0b2r4tgbmn1c0000gn/T/tmpw4Kz3c.c:2:26: error: expected ';' after expression
printf("Hello world")
^
;
1 warning and 1 error generated.
[C kernel] GCC exited with code 1, the executable will not be executed
%% Cell type:markdown id: tags:
You can see that the errors and warnings are shown, but the code is not executed. The retcode is also added to the end of `stderr`
example-notebook.png

316 KB

install.sh 0 → 100755
echo " ___ _ _____ _ __ _ "
echo " |_ | | | / __ \ | | / / | |"
echo " | |_ _ _ __ _ _| |_ ___ _ __ | / \/ | |/ / ___ _ __ _ __ ___| |"
echo " | | | | | '_ \| | | | __/ _ \ '__| | | | \ / _ \ '__| '_ \ / _ \ |"
echo "/\__/ / |_| | |_) | |_| | || __/ | | \__/\ | |\ \ __/ | | | | | __/ |"
echo "\____/ \__._| .__/ \__. |\__\___|_| \____/ \_| \_/\___|_| |_| |_|\___|_|"
echo " | | __/ | "
echo " |_| |___/ "
repository="https://rlabgw0.unipv.it/tutorato_jupyterhub/jupyter-c-kernel-pvcheck"
repo_name="jupyter-c-kernel-pvcheck"
set -x
# echo ":: Installing python module C kernel."
#pip install git+$repository; echo "Done. "
cd /opt/
echo ":: Cloning Jupyter C-kernel... "
git clone $repository $repo_name; echo "Done. "
echo ":: Installing python module C kernel."
ls
pip install -e ./$repo_name
cd $repo_name
echo ":: Installing kernel specification"
jupyter-kernelspec install c_spec/ ; echo "Done."
echo ":: Removing repository"
echo "Completed! Installation successful. You can type jupyter-notebook and be happy"
cd $OLDPWD
\ No newline at end of file
......@@ -412,4 +412,4 @@ class CKernel(Kernel):
def do_shutdown(self, restart):
"""Cleanup the created source code files and executables when shutting down the kernel"""
self.cleanup_files()
self.cleanup_files()
\ No newline at end of file
......@@ -8,4 +8,4 @@ setup(name='jupyter_c_kernel_pvcheck',
download_url='https://lstanzani@rlabgw0.unipv.it/lstanzani/jupyter-c-kernel-pvcheck/repository/archive.tar?ref=master',
packages=['jupyter_c_kernel_pvcheck'],
keywords=['jupyter', 'kernel', 'c', 'pvcheck']
)
)
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment