@@ -42,7 +42,7 @@ function Editor(root) {
4242 }
4343 ] ,
4444 default_id : 4 ,
45- opt : ' -O2 -Wall -Wextra -pedantic -pthread -pedantic-errors main.cpp ' ,
45+ opt : ' -O2 -Wall -Wextra -pedantic -pthread -pedantic-errors main.cpp -lm ' ,
4646 }
4747
4848 var cmd_info_c = {
@@ -51,11 +51,11 @@ function Editor(root) {
5151 { title : 'GCC 4.7' , cmd : 'gcc-4.7 -x c -std=c89 ' } ,
5252 { title : 'GCC 4.8' , cmd : 'gcc-4.8 -x c -std=c89 ' } ,
5353 { title : 'GCC 4.8 (C99)' , cmd : 'g++-4.8 -x c -std=c99 ' } ,
54- { title : 'clang 3.4' , cmd : 'clang -x c -std=c89 ' } ,
55- { title : 'clang 3.4 (C99)' , cmd : 'clang++ -x c -std=c99 ' }
54+ { title : 'clang 3.4' , cmd : 'clang -x c -std=c89 -Wno-newline-eof ' } ,
55+ { title : 'clang 3.4 (C99)' , cmd : 'clang++ -x c -std=c99 -Wno-newline-eof ' }
5656 ] ,
5757 default_id : 3 ,
58- opt : ' -O2 -Wall -Wextra -pedantic -pthread -pedantic-errors main.cpp ' ,
58+ opt : ' -O2 -Wall -Wextra -pedantic -pthread -pedantic-errors main.cpp -lm ' ,
5959 }
6060
6161 this . check_is_cxx = function ( ) {
@@ -438,7 +438,7 @@ function Editor(root) {
438438} ;
439439
440440function get_script_cached ( url , callback ) {
441- $ . ajax ( {
441+ return $ . ajax ( {
442442 type : "GET" ,
443443 url : url ,
444444 success : callback ,
@@ -467,35 +467,38 @@ window.jump_to_error = function(node, lineno) {
467467var editors = [ ] ;
468468
469469$ . when (
470- get_script_cached ( 'http://d1n0x3qji82z53.cloudfront.net/src-min-noconflict/ace.js' ) ,
471- get_script_cached ( 'http://d1n0x3qji82z53.cloudfront.net/src-min-noconflict/mode-c_cpp.js' ) ,
472- $ . Deferred ( function ( deferred ) {
473- $ ( deferred . resolve ) ;
474- } )
470+ get_script_cached ( 'http://d1n0x3qji82z53.cloudfront.net/src-min-noconflict/ace.js' )
475471) . done ( function ( ) {
476- $ ( '.t-example-live-link > a' ) . each ( function ( ) {
477- $ ( this ) . replaceWith ( '<div class="coliru-btn coliru-btn-run-init">Run this code</div>' ) ;
478- } ) ;
479- $ ( '.t-example > .mw-geshi:first' ) . each ( function ( ) {
480- $ ( this ) . addClass ( 't-example-code' ) ;
481- } ) ;
472+ $ . when (
473+ get_script_cached ( 'http://d1n0x3qji82z53.cloudfront.net/src-min-noconflict/mode-c_cpp.js' ) ,
474+ $ . Deferred ( function ( deferred ) {
475+ $ ( deferred . resolve ) ;
476+ } )
477+ ) . done ( function ( ) {
478+ $ ( '.t-example-live-link > a' ) . each ( function ( ) {
479+ $ ( this ) . replaceWith ( '<div class="coliru-btn coliru-btn-run-init">Run this code</div>' ) ;
480+ } ) ;
481+ $ ( '.t-example > .mw-geshi:first' ) . each ( function ( ) {
482+ $ ( this ) . addClass ( 't-example-code' ) ;
483+ } ) ;
482484
483- $ ( '.coliru-btn-run-init' ) . click ( function ( ) {
484- var root = $ ( this ) . parent ( ) . parent ( ) ;
485+ $ ( '.coliru-btn-run-init' ) . click ( function ( ) {
486+ var root = $ ( this ) . parent ( ) . parent ( ) ;
485487
486- // find the editor for this root element
487- var i ;
488- for ( i = 0 ; i < editors . length ; ++ i ) {
489- if ( editors [ i ] . el . root . is ( root ) ) {
490- break ;
488+ // find the editor for this root element
489+ var i ;
490+ for ( i = 0 ; i < editors . length ; ++ i ) {
491+ if ( editors [ i ] . el . root . is ( root ) ) {
492+ break ;
493+ }
494+ }
495+ if ( i == editors . length ) {
496+ editors [ i ] = new Editor ( root ) ;
491497 }
492- }
493- if ( i == editors . length ) {
494- editors [ i ] = new Editor ( root ) ;
495- }
496498
497- var editor = editors [ i ] ;
498- editor . replace_orig ( ) ;
499- editor . compile_now ( ) ;
499+ var editor = editors [ i ] ;
500+ editor . replace_orig ( ) ;
501+ editor . compile_now ( ) ;
502+ } ) ;
500503 } ) ;
501504} ) ;
0 commit comments