Merge: More escaping
authorJean Privat <jean@pryen.org>
Thu, 13 Nov 2014 05:10:39 +0000 (00:10 -0500)
committerJean Privat <jean@pryen.org>
Thu, 13 Nov 2014 05:10:39 +0000 (00:10 -0500)
compiler is more robust.

The only issue seems to be the Makefile since there is no way to have an arbitrary named goal.

Pull-Request: #899
Reviewed-by: Lucas Bajolet <r4pass@hotmail.com>

131 files changed:
contrib/opportunity/src/opportunity_controller.nit
contrib/opportunity/src/opportunity_model.nit
contrib/opportunity/src/templates/meetup.nit
contrib/opportunity/src/templates/meetup_creation.nit
contrib/opportunity/tests/db_tests.nit
lib/java/java.nit
src/ffi/java.nit
tests/base_init_linext.nit
tests/base_init_linext2.nit
tests/cc.skip
tests/emscripten.skip
tests/error_prop_loc.nit
tests/nitg-e.skip
tests/nitg-g.skip
tests/nitg-s.skip
tests/nitg-sg.skip
tests/niti.skip
tests/nitvm.skip
tests/sav/base_init_inherit.res
tests/sav/base_init_inherit2_alt0.res
tests/sav/base_init_inherit2_alt1.res
tests/sav/base_init_inherit2_alt2.res
tests/sav/base_init_inherit2_alt3.res
tests/sav/base_init_inherit3_alt0.res
tests/sav/base_init_inherit3_alt1.res
tests/sav/base_init_inherit3_alt2.res
tests/sav/base_init_inherit3_alt3.res
tests/sav/base_init_inherit4_alt0.res
tests/sav/base_init_inherit4_alt1.res
tests/sav/base_init_inherit4_alt2.res
tests/sav/base_init_inherit4_alt3.res
tests/sav/base_init_inherit5.res
tests/sav/base_init_inherit6_alt1.res
tests/sav/base_init_inherit6_alt2.res
tests/sav/base_init_inherit_alt1.res
tests/sav/base_init_linext.res
tests/sav/base_init_linext2.res
tests/sav/base_init_linext2_alt1.res
tests/sav/base_init_linext2_alt2.res
tests/sav/base_init_linext2_alt3.res
tests/sav/base_init_linext2_alt4.res
tests/sav/base_init_linext2_alt5.res
tests/sav/base_init_linext_alt0.res
tests/sav/base_init_linext_alt1.res [deleted file]
tests/sav/base_init_linext_alt10.res [deleted file]
tests/sav/base_init_linext_alt11.res [deleted file]
tests/sav/base_init_linext_alt12.res [deleted file]
tests/sav/base_init_linext_alt13.res [deleted file]
tests/sav/base_init_linext_alt14.res [deleted file]
tests/sav/base_init_linext_alt15.res [deleted file]
tests/sav/base_init_linext_alt2.res [deleted file]
tests/sav/base_init_linext_alt3.res [deleted file]
tests/sav/base_init_linext_alt4.res [deleted file]
tests/sav/base_init_linext_alt5.res [deleted file]
tests/sav/base_init_linext_alt6.res [deleted file]
tests/sav/base_init_linext_alt7.res [deleted file]
tests/sav/base_init_linext_alt8.res [deleted file]
tests/sav/base_init_linext_alt9.res [deleted file]
tests/sav/base_init_linext_raf.res
tests/sav/error_prop_loc.res
tests/sav/error_prop_loc_alt1.res [new file with mode: 0644]
tests/sav/error_redef_1alt4_alt5.res
tests/sav/error_redef_1alt4_alt9.res
tests/sav/fixme/error_prop_loc.res [deleted file]
tests/sav/fixme/error_redef_1alt4_alt5.res [deleted file]
tests/sav/fixme/error_redef_1alt4_alt9.res [deleted file]
tests/sav/fixme/test_inheritance_raf.res [deleted file]
tests/sav/nitc/base_for_nullable.res [deleted file]
tests/sav/nitc/base_for_nullable_alt1.res [deleted file]
tests/sav/nitc/base_for_nullable_alt2.res [deleted file]
tests/sav/nitg-common/fixme/base_attr_init_val_int_alt1.res [moved from tests/sav/nitg-e/fixme/base_attr_init_val_int_alt1.res with 100% similarity]
tests/sav/nitg-common/fixme/base_attr_init_val_int_alt2.res [moved from tests/sav/nitg-e/fixme/base_attr_init_val_int_alt2.res with 100% similarity]
tests/sav/nitg-common/fixme/base_attr_init_val_int_alt3.res [moved from tests/sav/nitg-e/fixme/base_attr_init_val_int_alt3.res with 100% similarity]
tests/sav/nitg-common/fixme/base_attr_init_val_int_alt4.res [moved from tests/sav/nitg-e/fixme/base_attr_init_val_int_alt4.res with 100% similarity]
tests/sav/nitg-common/fixme/base_attr_init_val_raf_alt1.res [moved from tests/sav/nitg-e/fixme/base_attr_init_val_raf_alt1.res with 100% similarity]
tests/sav/nitg-common/fixme/base_attr_nullable_int_alt1.res [moved from tests/sav/nitg-e/fixme/base_attr_nullable_int_alt1.res with 100% similarity]
tests/sav/nitg-common/fixme/base_attr_nullable_int_alt2.res [moved from tests/sav/nitg-e/fixme/base_attr_nullable_int_alt2.res with 100% similarity]
tests/sav/nitg-common/fixme/base_attr_nullable_int_alt3.res [moved from tests/sav/nitg-e/fixme/base_attr_nullable_int_alt3.res with 100% similarity]
tests/sav/nitg-common/fixme/base_attr_nullable_int_alt4.res [moved from tests/sav/nitg-e/fixme/base_attr_nullable_int_alt4.res with 100% similarity]
tests/sav/nitg-common/fixme/base_attr_nullable_int_alt5.res [moved from tests/sav/nitg-e/fixme/base_attr_nullable_int_alt5.res with 100% similarity]
tests/sav/nitg-common/fixme/base_covar_int2_alt3.res [moved from tests/sav/nitg-e/fixme/base_covar_int2_alt3.res with 100% similarity]
tests/sav/nitg-common/fixme/base_covar_int2_alt5.res [moved from tests/sav/nitg-e/fixme/base_covar_int2_alt5.res with 100% similarity]
tests/sav/nitg-common/fixme/base_covar_int_alt3.res [moved from tests/sav/nitg-e/fixme/base_covar_int_alt3.res with 100% similarity]
tests/sav/nitg-common/fixme/base_for_finish.res [moved from tests/sav/nitg-e/fixme/base_for_finish.res with 100% similarity]
tests/sav/nitg-g/fixme/base_attr_init_val_int_alt1.res [deleted file]
tests/sav/nitg-g/fixme/base_attr_init_val_int_alt2.res [deleted file]
tests/sav/nitg-g/fixme/base_attr_init_val_int_alt3.res [deleted file]
tests/sav/nitg-g/fixme/base_attr_init_val_int_alt4.res [deleted file]
tests/sav/nitg-g/fixme/base_attr_init_val_raf_alt1.res [deleted file]
tests/sav/nitg-g/fixme/base_attr_nullable_int_alt1.res [deleted file]
tests/sav/nitg-g/fixme/base_attr_nullable_int_alt2.res [deleted file]
tests/sav/nitg-g/fixme/base_attr_nullable_int_alt3.res [deleted file]
tests/sav/nitg-g/fixme/base_attr_nullable_int_alt4.res [deleted file]
tests/sav/nitg-g/fixme/base_attr_nullable_int_alt5.res [deleted file]
tests/sav/nitg-g/fixme/base_covar_int2_alt3.res [deleted file]
tests/sav/nitg-g/fixme/base_covar_int2_alt5.res [deleted file]
tests/sav/nitg-g/fixme/base_covar_int_alt3.res [deleted file]
tests/sav/nitg-g/fixme/base_for_finish.res [deleted file]
tests/sav/nitg-s/fixme/base_attr_init_val_int_alt1.res [deleted file]
tests/sav/nitg-s/fixme/base_attr_init_val_int_alt2.res [deleted file]
tests/sav/nitg-s/fixme/base_attr_init_val_int_alt3.res [deleted file]
tests/sav/nitg-s/fixme/base_attr_init_val_int_alt4.res [deleted file]
tests/sav/nitg-s/fixme/base_attr_init_val_raf_alt1.res [deleted file]
tests/sav/nitg-s/fixme/base_attr_nullable_int_alt1.res [deleted file]
tests/sav/nitg-s/fixme/base_attr_nullable_int_alt2.res [deleted file]
tests/sav/nitg-s/fixme/base_attr_nullable_int_alt3.res [deleted file]
tests/sav/nitg-s/fixme/base_attr_nullable_int_alt4.res [deleted file]
tests/sav/nitg-s/fixme/base_attr_nullable_int_alt5.res [deleted file]
tests/sav/nitg-s/fixme/base_covar_int2_alt3.res [deleted file]
tests/sav/nitg-s/fixme/base_covar_int2_alt5.res [deleted file]
tests/sav/nitg-s/fixme/base_covar_int_alt3.res [deleted file]
tests/sav/nitg-s/fixme/base_for_finish.res [deleted file]
tests/sav/nitg-sg/fixme/base_attr_init_val_int_alt1.res [deleted file]
tests/sav/nitg-sg/fixme/base_attr_init_val_int_alt2.res [deleted file]
tests/sav/nitg-sg/fixme/base_attr_init_val_int_alt3.res [deleted file]
tests/sav/nitg-sg/fixme/base_attr_init_val_int_alt4.res [deleted file]
tests/sav/nitg-sg/fixme/base_attr_init_val_raf_alt1.res [deleted file]
tests/sav/nitg-sg/fixme/base_attr_nullable_int_alt1.res [deleted file]
tests/sav/nitg-sg/fixme/base_attr_nullable_int_alt2.res [deleted file]
tests/sav/nitg-sg/fixme/base_attr_nullable_int_alt3.res [deleted file]
tests/sav/nitg-sg/fixme/base_attr_nullable_int_alt4.res [deleted file]
tests/sav/nitg-sg/fixme/base_attr_nullable_int_alt5.res [deleted file]
tests/sav/nitg-sg/fixme/base_covar_int2_alt3.res [deleted file]
tests/sav/nitg-sg/fixme/base_covar_int2_alt5.res [deleted file]
tests/sav/nitg-sg/fixme/base_covar_int_alt3.res [deleted file]
tests/sav/nitg-sg/fixme/base_for_finish.res [deleted file]
tests/sav/nitg-sg/fixme/test_platform_android.res [new file with mode: 0644]
tests/sav/test_ffi_java_types.res
tests/sav/test_inheritance_raf.res
tests/test_ffi_java_types.nit
tests/tests.sh

index 831d90d..f52f07d 100644 (file)
@@ -60,13 +60,18 @@ class OpportunityWelcome
                        var mname = request.string_arg("meetup_name")
                        var mdate = request.string_arg("meetup_date")
                        var mplace = request.string_arg("meetup_place")
+                       var mmodestr = request.string_arg("meetup_mode")
+                       var mmode = 0
                        if mdate == null then mdate = ""
                        if mplace == null then mplace = ""
+                       if mmodestr != null then
+                               mmode = 1
+                       end
                        if mname == null then
                                mname = ""
                                var rsp = new HttpResponse(200)
                                var meetpage = new MeetupCreationPage
-                               var meet = new Meetup(mname, mdate, mplace)
+                               var meet = new Meetup(mname, mdate, mplace, mmode)
                                meetpage.ans = ansset
                                meetpage.meet = meet
                                meetpage.error = "'Meetup name' is a mandatory fields."
@@ -75,7 +80,7 @@ class OpportunityWelcome
 
                        end
                        var db = new OpportunityDB.open(db_path)
-                       var meet = new Meetup(mname, mdate, mplace)
+                       var meet = new Meetup(mname, mdate, mplace, mmode)
                        if ansset.is_empty then
                                db.close
                                var rsp = new HttpResponse(200)
@@ -176,7 +181,7 @@ class OpportunityAnswerREST
        redef fun answer(request, uri) do
                var persid = request.int_arg("pers_id")
                var ansid = request.int_arg("answer_id")
-               var ans = request.bool_arg("answer")
+               var ans = request.int_arg("answer")
                if persid == null or ansid == null or ans == null then return bad_req
                var db = new OpportunityDB.open(db_path)
                db.change_answer(ansid, persid, ans)
@@ -197,12 +202,11 @@ class OpportunityMeetupREST
                        var ans = request.string_arg("answers").split("&")
                        if name == null or m_id == null then return bad_req
                        print ans
-                       var ansmap = new HashMap[Int, Bool]
+                       var ansmap = new HashMap[Int, Int]
                        for i in ans do
                                var mp = i.split("=")
-                               var b = false
-                               if mp.last == "true" then b = true
                                var id = mp.first.split("_").last
+                               var b = mp.last.to_i
                                if not id.is_numeric then continue
                                ansmap[id.to_i] = b
                        end
@@ -220,7 +224,7 @@ class OpportunityMeetupREST
                        var p = new People(rname, rsurname)
                        for i in m.answers(db) do
                                if not ansmap.has_key(i.id) then
-                                       p.answers[i] = false
+                                       p.answers[i] = 0
                                else
                                        p.answers[i] = ansmap[i.id]
                                end
index aa9adec..7b5bde8 100644 (file)
@@ -31,7 +31,7 @@ class OpportunityDB
 
        # Creates the tables and triggers for Opportunity (SQLite3 DB)
        fun create_db do
-               assert create_table("IF NOT EXISTS meetups (id CHAR(40) PRIMARY KEY, name TEXT, date TEXT, place TEXT);") else
+               assert create_table("IF NOT EXISTS meetups (id CHAR(40) PRIMARY KEY, name TEXT, date TEXT, place TEXT, answer_mode INTEGER DEFAULT 0);") else
                        print error or else "?"
                end
                assert create_table("IF NOT EXISTS people(id INTEGER PRIMARY KEY AUTOINCREMENT, name TEXT, surname TEXT);") else
@@ -68,7 +68,16 @@ class OpportunityDB
        fun find_meetup_by_id(id: String): nullable Meetup do
                var req = select("* FROM meetups where id={id.to_sql_string};")
                for i in req do
-                       return new Meetup.from_db(i[0].to_s, i[1].to_s, i[2].to_s, i[3].to_s)
+                       return new Meetup.from_db(i[0].to_s, i[1].to_s, i[2].to_s, i[3].to_s, i[4].to_i)
+               end
+               return null
+       end
+
+       # Find an `Answer` by its `id` or `null` if it could not be found
+       fun find_answer_by_id(id: Int): nullable Answer do
+               var req = select("* FROM answers WHERE id={id};")
+               for i in req do
+                       return new Answer.from_db(i[0].to_i, i[2].to_s)
                end
                return null
        end
@@ -76,16 +85,20 @@ class OpportunityDB
        # Change an Answer `ansid` for someone with an id `pid` to `resp`
        #
        # Returns `true` if the request was sucessful, false otherwise
-       fun change_answer(pid: Int, ansid: Int, resp: Bool): Bool do
-               var rsp = 0
-               if resp then rsp = 1
-               var rq = execute("INSERT OR REPLACE INTO part_answers(id_part, id_ans, value) VALUES({pid},{ansid},{rsp});")
-               if not rq then
+       fun change_answer(pid: Int, ansid: Int, resp: Int): Bool do
+               var p = find_people_by_id(pid)
+               if p == null then
                        print "Error while updating answer {ansid}:{pid}"
-                       print error or else "Unknown error"
                        return false
                end
-               return true
+               var a = find_answer_by_id(ansid)
+               if a == null then
+                       print "Error while updating answer {ansid}:{pid}"
+                       return false
+               end
+               p.answers[a] = resp
+               if p.commit(self) then return true
+               return false
        end
 
        # Removes a person in the Database by its `id`
@@ -120,7 +133,10 @@ class People
        # Surname of the participant
        var surname: String
        # Map of the answers of a Meetup and the answers of the participant
-       var answers: Map[Answer, Bool] = new HashMap[Answer, Bool]
+       # 0 = No
+       # 1 = Maybe
+       # 2 = Yes
+       var answers: Map[Answer, Int] = new HashMap[Answer, Int]
 
        # To be used internally when fetching the `People` in Database
        private init from_db(id: Int, name, surname: String) do
@@ -129,7 +145,7 @@ class People
        end
 
        # Changes an answer `ans` (or adds it)
-       fun answer=(ans: Answer, resp: Bool) do
+       fun answer=(ans: Answer, resp: Int) do
                answers[ans] = resp
        end
 
@@ -137,12 +153,11 @@ class People
        #
        # NOTE: If `self` does not exist in the Database, no answers will be fetched
        fun load_answers(db: OpportunityDB, meetup: Meetup) do
-               self.answers = new HashMap[Answer, Bool]
-               var req = db.select("answers.id, answers.name, part_answers.value FROM part_answers, answers WHERE part_answers.id_part={id} AND answers.id=part_answers.id_ans AND answers.meetup_id={meetup.id.to_sql_string} GROUP BY answers.id;")
+               self.answers = new HashMap[Answer, Int]
+               var req = db.select("answers.id, answers.name, part_answers.value FROM part_answers, answers WHERE part_answers.id_part={id} AND answers.id=part_answers.id_ans AND answers.meetup_id={meetup.id.html_escape.to_sql_string} GROUP BY answers.id;")
                for i in req do
                        var ans = new Answer.from_db(i[0].to_i, i[1].to_s)
-                       answers[ans] = false
-                       if i[2].to_i == 1 then answers[ans] = true
+                       answers[ans] = i[2].to_i
                end
        end
 
@@ -150,14 +165,14 @@ class People
 
        redef fun commit(db) do
                if id == -1 then
-                       if not db.execute("INSERT INTO people (name,surname) VALUES ({name.to_sql_string}, {surname.to_sql_string});") then
+                       if not db.execute("INSERT INTO people (name,surname) VALUES ({name.html_escape.to_sql_string}, {surname.html_escape.to_sql_string});") then
                                print "Error while adding people {self}"
                                print db.error or else "Unknown error"
                                return false
                        end
                        id = db.last_insert_rowid
                else
-                       if not db.execute("UPDATE people SET name={name.to_sql_string}, surname={surname.to_sql_string} WHERE ID={id};") then
+                       if not db.execute("UPDATE people SET name={name.html_escape.to_sql_string}, surname={surname.html_escape.to_sql_string} WHERE ID={id};") then
                                print "Error while updating people {self}"
                                print db.error or else "Unknown error"
                                return false
@@ -165,10 +180,18 @@ class People
                end
                for i,j in answers do
                        if i.id == -1 then i.commit(db)
-                       var val = 0
-                       if j then val = 1
-                       if not db.execute("INSERT OR REPLACE INTO part_answers(id_part, id_ans, value) VALUES ({id},{i.id},{val});") then
-                               print("Error while adding/replacing part_answers {id}|{i.id}|{j}")
+                       var val = j
+                       var s = db.select("* FROM part_answers WHERE id_part={id} AND id_ans={i.id}")
+                       if s != null and s.iterator.is_ok then
+                               if not db.execute("UPDATE part_answers SET value={j} WHERE id_part={id} AND id_ans={i.id};") then
+                                       print "Error while updating part_answers {id}|{i.id} = {j}"
+                                       print db.error or else "Unknown error"
+                                       return false
+                               end
+                               continue
+                       end
+                       if not db.execute("INSERT INTO part_answers(id_part, id_ans, value) VALUES ({id},{i.id},{val});") then
+                               print("Error while adding part_answers {id}|{i.id}|{j}")
                                print db.error or else "Unknown error"
                                return false
                        end
@@ -189,13 +212,13 @@ class Meetup
        var date: String
        # Place of the meetup
        var place: String
+       # Mode of answering to the meetup (atm supports with or without Maybe)
+       var answer_mode: Int
 
        # Builds the object with all the informations found in the database
-       private init from_db(id, name, date, place: String) do
+       private init from_db(id, name, date, place: String, mode: Int) do
                self.id = id
-               self.name = name
-               self.date = date
-               self.place = place
+               init(name, date, place, mode)
        end
 
        # Gets the answers bound to the current `Meetup`
@@ -225,7 +248,7 @@ class Meetup
                if id == "" then
                        var time = get_time
                        var tmpid = (name + date + place + time.to_s).sha1_to_s
-                       if not db.execute("INSERT INTO meetups (id, name, date, place) VALUES({tmpid.to_sql_string}, {name.to_sql_string}, {date.to_sql_string}, {place.to_sql_string});") then
+                       if not db.execute("INSERT INTO meetups (id, name, date, place, answer_mode) VALUES({tmpid.to_sql_string}, {name.html_escape.to_sql_string}, {date.html_escape.to_sql_string}, {place.html_escape.to_sql_string}, {answer_mode});") then
                                print "Error recording entry Meetup {self}"
                                print db.error or else "Null error"
                                return false
@@ -233,7 +256,7 @@ class Meetup
                        id = tmpid
                        return true
                else
-                       return db.execute("UPDATE meetups (name, date, place) VALUES({name.to_sql_string}, {date.to_sql_string}, {place.to_sql_string}) WHERE ID={id.to_sql_string};")
+                       return db.execute("UPDATE meetups SET name={name.html_escape.to_sql_string}, date={date.html_escape.to_sql_string}, place={place.html_escape.to_sql_string}, answer_mode={answer_mode} WHERE ID={id.to_sql_string};")
                end
        end
 
@@ -259,6 +282,11 @@ class Answer
                self.id = id
        end
 
+       redef fun hash do
+               if id != -1 then return id
+               return super
+       end
+
        # Loads the Meetup associated to `self`
        #
        # REQUIRE: is loaded in database
@@ -266,12 +294,39 @@ class Answer
                assert id != -1
                var res = db.select("meetups.* FROM meetups, answers WHERE answers.id={id} AND answers.meetup_id=meetups.id;")
                for i in res do
-                       return new Meetup.from_db(i[0].to_s, i[1].to_s, i[2].to_s, i[3].to_s)
+                       return new Meetup.from_db(i[0].to_s, i[1].to_s, i[2].to_s, i[3].to_s, i[4].to_i)
                end
                # If no Meetup could be loaded, the contract was not respected
                abort
        end
 
+       # Counts the number of positive or maybe answers
+       fun count(db: OpportunityDB): Int do
+               if id == -1 then return -1
+               var count = 0
+               var res = db.select("part_answers.value FROM part_answers WHERE part_answers.id_ans={id};")
+               if meetup == null then meetup = load_meetup(db)
+               for i in res do
+                       if meetup.answer_mode == 0 then
+                               count += i[0].to_i
+                       else
+                               if i[0].to_i == 2 then count += 1
+                       end
+               end
+               return count
+       end
+
+       # Counts the score for this particular answer
+       fun score(db: OpportunityDB): Int do
+               if id == -1 then return -1
+               var score = 0
+               var res = db.select("part_answers.value FROM part_answers WHERE part_answers.id_ans={id};")
+               for i in res do
+                       score += i[0].to_i
+               end
+               return score
+       end
+
        redef fun commit(db) do
                var m = meetup
                if m == null then return false
@@ -282,14 +337,14 @@ class Answer
                        end
                end
                if id == -1 then
-                       if not db.execute("INSERT INTO answers (name, meetup_id) VALUES({name.to_sql_string}, {m.id.to_sql_string});") then
+                       if not db.execute("INSERT INTO answers (name, meetup_id) VALUES({name.html_escape.to_sql_string}, {m.id.to_sql_string});") then
                                print "Cannot create {self} in database"
                                print db.error or else "Unknown error"
                                return false
                        end
                        id = db.last_insert_rowid
                else
-                       if not db.execute("UPDATE answers (name) VALUES ({name.to_sql_string}) WHERE meetup_id={m.id.to_sql_string};") then
+                       if not db.execute("UPDATE answers SET name=({name.html_escape.to_sql_string}) WHERE meetup_id={m.id.to_sql_string};") then
                                print "Error updating {self} in database"
                                print db.error or else "Unknown error"
                                return false
index 72503cf..e5d1f56 100644 (file)
@@ -26,33 +26,107 @@ class OpportunityMeetupPage
 
        # Meetup the page is supposed to show
        var meetup: nullable Meetup = null
+       # Answer mode for the meetup
+       var mode = 0
 
        init from_id(id: String) do
                var db = new OpportunityDB.open("opportunity")
                meetup = db.find_meetup_by_id(id)
                db.close
+               if meetup != null then mode = meetup.answer_mode
+               init
        end
 
        init do
-               header.page_js = """
+               header.page_js = "mode = {mode};\n"
+               header.page_js += """
+               function update_scores(){
+                       var anss = $('.answer');
+                       var count = {};
+                       var scores = {};
+                       var answers = [];
+                       var maxscore = 0;
+                       for(i=0; i < anss.length; i++){
+                               var incscore = 0;
+                               var inccount = 0;
+                               var idparts = anss[i].id.split("_");
+                               var ansid = idparts[1];
+                               var html = anss[i].innerHTML;
+                               if(html === "<center>✔</center>"){
+                                       inccount = 1;
+                                       incscore = 2;
+                               }else if(html === "<center>❓</center>"){
+                                       incscore = 1;
+                               }
+                               var intansid = parseInt(ansid)
+                               if(answers.indexOf(intansid) == -1){
+                                       answers.push(intansid);
+                               }
+                               if(ansid in count){
+                                       count[ansid] += inccount;
+                               }else{
+                                       count[ansid] = inccount;
+                               }
+                               if(ansid in scores){
+                                       scores[ansid] += incscore;
+                               }else{
+                                       scores[ansid] = incscore;
+                               }
+                               if(scores[ansid] > maxscore){
+                                       maxscore = scores[ansid];
+                               }
+                       }
+                       for(i=0; i < answers.length; i++){
+                               var ansid = answers[i].toString();
+                               var el = $('#total'+ansid)[0];
+                               var ins = "<center>"+count[ansid];
+                               if(scores[ansid] >= maxscore){
+                                       ins += "<br/><span style=\\"color:blue\\">★</span>";
+                               }
+                               ins += "</center>";
+                               el.innerHTML = ins;
+                       }
+               }
                function change_answer(ele, id){
                        // modify only the currently selected entry
                        if (in_modification_id != id) return;
 
                        var e = document.getElementById(ele.id);
                        var i = e.innerHTML;
-                       var ans = true;
+                       var ans = true;"""
+               if mode == 0 then
+                       header.page_js += """
                        if(i === "<center>✔</center>"){
-                               ans = false;
+                               ans = 0;
                                e.innerHTML = "<center>✘</center>"
                                e.style.color = "red";
                        }else{
+                               ans = 1;
                                e.innerHTML = "<center>✔</center>";
                                e.style.color = "green";
-                       }
+                       }"""
+
+               else
+                       header.page_js += """
+                       if(i === "<center>✔</center>"){
+                               ans = 1;
+                               e.innerHTML = "<center>❓</center>"
+                               e.style.color = "#B8860B";
+                       }else if(i === "<center>❓</center>"){
+                               ans = 0;
+                               e.innerHTML = "<center>✘</center>"
+                               e.style.color = "red";
+                       }else{
+                               ans = 2;
+                               e.innerHTML = "<center>✔</center>";
+                               e.style.color = "green";
+                       }"""
+               end
+               header.page_js += """
                        var a = ele.id.split('_')
                        var pid = a[1]
                        var aid = a[2]
+                       update_scores();
                        $.ajax({
                                type: "POST",
                                url: "./rest/answer",
@@ -65,16 +139,33 @@ class OpportunityMeetupPage
                }
                function change_temp_answer(ele){
                        var e = document.getElementById(ele.id);
-                       var i = e.innerHTML;
-                       var ans = true;
+                       var i = e.innerHTML;"""
+               if mode == 0 then
+                       header.page_js += """
+                       if(i === "<center>✔</center>"){
+                               e.innerHTML = "<center>✘</center>"
+                               e.style.color = "red";
+                       }else{
+                               e.innerHTML = "<center>✔</center>";
+                               e.style.color = "green";
+                       }
+                       """
+               else
+                       header.page_js += """
                        if(i === "<center>✔</center>"){
-                               ans = false;
-                               e.innerHTML = "<center>✘</center>";
+                               e.innerHTML = "<center>❓</center>";
+                               e.style.color = "#B8860B";
+                       }else if(i === "<center>❓</center>"){
+                               e.innerHTML = "<center>✘</center>"
                                e.style.color = "red";
                        }else{
                                e.innerHTML = "<center>✔</center>";
                                e.style.color = "green";
                        }
+                       """
+               end
+               header.page_js += """
+                       update_scores();
                }
                function add_part(ele){
                        var e = document.getElementById(ele.id);
@@ -85,11 +176,25 @@ class OpportunityMeetupPage
                        ansmap = {};
                        for(i=0;i<ans.length;i++){
                                var curr = ans.eq(i)
+                       """
+               if mode == 0 then
+                       header.page_js += """
                                if(curr[0].innerHTML === "<center>✔</center>"){
-                                       ansmap[curr.attr('id')] = true
+                                       ansmap[curr.attr('id')] = 1
                                }else{
-                                       ansmap[curr.attr('id')] = false
-                               }
+                                       ansmap[curr.attr('id')] = 0
+                               }"""
+               else
+                       header.page_js += """
+                               if(curr[0].innerHTML === "<center>✔</center>"){
+                                       ansmap[curr.attr('id')] = 2
+                               }else if(curr[0].innerHTML === "<center>❓</center>"){
+                                       ansmap[curr.attr('id')] = 1
+                               }else{
+                                       ansmap[curr.attr('id')] = 0
+                               }"""
+               end
+               header.page_js += """
                        }
                        $.ajax({
                                type: "POST",
@@ -111,6 +216,7 @@ class OpportunityMeetupPage
                        var arr = ele.id.split("_")
                        var pid = arr[1]
                        $('#' + ele.id).parent().parent().parent().remove();
+                       update_scores();
                        $.ajax({
                                type: "POST",
                                url: "./rest/people",
@@ -120,7 +226,6 @@ class OpportunityMeetupPage
                                }
                        });
                }
-
                // ID of line currently open for modification
                var in_modification_id = null;
                function modify_people(ele, id){
@@ -192,18 +297,39 @@ redef class Meetup
                        t.add "<td>"
                        t.add i.to_s
                        t.add "</td>"
-                       for j,k in i.answers do
+                       for j, k in i.answers do
                                var color
-                               if k then
-                                       color = "green"
-                               else color = "red"
-
+                               if answer_mode == 0 then
+                                       if k == 1 then
+                                               color = "green"
+                                       else
+                                               color = "red"
+                                       end
+                               else
+                                       if k == 2 then
+                                               color = "green"
+                                       else if k == 1 then
+                                               color = "#B8860B"
+                                       else
+                                               color = "red"
+                                       end
+                               end
                                t.add """<td class="answer" onclick="change_answer(this, {{{i.id}}})" id="answer_{{{j.id}}}_{{{i.id}}}" style="color:{{{color}}}">"""
                                t.add "<center>"
-                               if k then
-                                       t.add "✔"
+                               if answer_mode == 0 then
+                                       if k == 1 then
+                                               t.add "✔"
+                                       else
+                                               t.add "✘"
+                                       end
                                else
-                                       t.add "✘"
+                                       if k == 2 then
+                                               t.add "✔"
+                                       else if k == 1 then
+                                               t.add "❓"
+                                       else
+                                               t.add "✘"
+                                       end
                                end
                                t.add "</center></td>"
                        end
@@ -221,6 +347,28 @@ redef class Meetup
                t.add """
        <td><center><span id="add_{{{id}}}" onclick="add_part(this)" style="color:green;" class="action"><button class="btn btn-xs btn-success" type="button">Done</button></span></center></td>"""
                t.add "</tr>"
+               # Compute score for each answer
+               var scores = new HashMap[Int, Int]
+               var maxsc = 0
+               for i in answers(db) do
+                       scores[i.id] = i.score(db)
+                       if scores[i.id] > maxsc then maxsc = scores[i.id]
+               end
+               t.add """
+<tr id="total">
+       <th>Total</th>
+               """
+               for i in answers(db) do
+                       t.add """<th id="total{{{i.id}}}"><center>{{{i.count(db)}}}"""
+                       if scores.has_key(i.id) and scores[i.id] >= maxsc then
+                               t.add """<br/><span style="color:blue">★</span>"""
+                       end
+                       t.add "</center></th>"
+               end
+               t.add "</th>"
+               t.add """
+               <th></th>
+</tr>"""
                t.add "</table>"
                t.add "</div>"
                return t
index 6f42561..5b1a048 100644 (file)
@@ -93,6 +93,12 @@ function new_answer(sender){
                                        <input name="meetup_place" id="meetup_place" type="text" class="form-control" placeholder="Place of the event" value="{{{if meet != null then meet.place else ""}}}">
                                </div>
                        </div>
+                       <div class = "form-group">
+                               <label for="meetup=maybe" class="col-sm-4 control-label">Add a Maybe option?</label>
+                               <div class="col-sm-8">
+                                       <input name="meetup_mode" id="meetup_mode" type="checkbox" class="form-control">
+                               </div>
+                       </div>
                                <h2>Opportunities</h2>
 <div id="answers">
 """
index cbec6f7..a5a39a7 100644 (file)
@@ -47,7 +47,7 @@ db = new OpportunityDB.open("opportunity")
 
 var hj = new People("Jack", "Handsome")
 
-var m = new Meetup("Awaken the warrior", "2024/05/28", "Vault of the Warrior")
+var m = new Meetup("Awaken the warrior", "2024/05/28", "Vault of the Warrior", 0)
 assert m.commit(db)
 
 var vh = new People("Hunter", "Vault")
@@ -66,17 +66,17 @@ var h = new Answer("I have no choice, I'm a hostage")
 h.meetup = m
 h.commit(db)
 
-hj.answer(y) = true
-hj.answer(n) = false
-hj.answer(h) = false
+hj.answer(y) = 1
+hj.answer(n) = 0
+hj.answer(h) = 0
 
-vh.answer(y) = true
-vh.answer(n) = false
-vh.answer(h) = false
+vh.answer(y) = 1
+vh.answer(n) = 0
+vh.answer(h) = 0
 
-ll.answer(y) = true
-ll.answer(n) = false
-ll.answer(h) = true
+ll.answer(y) = 1
+ll.answer(n) = 0
+ll.answer(h) = 1
 
 hj.commit db
 vh.commit db
index 389c6f6..0b6a652 100644 (file)
@@ -27,7 +27,7 @@
 # most of JNI functions. You can use it to further customize the behavior
 # of your code.
 module java is
-       c_compiler_option("-I $(JAVA_HOME)/include/")
+       c_compiler_option "-I $(JAVA_HOME)/include/ -I $(JAVA_HOME)/include/linux/"
        c_linker_option("-L $(JNI_LIB_PATH) -ljvm")
        new_annotation extra_java_files
 end
index fa3cc84..9191141 100644 (file)
@@ -242,7 +242,7 @@ redef class MModule
        # Tell the C compiler where to find jni.h and how to link with libjvm
        private fun insert_compiler_options
        do
-               c_compiler_options = "{c_compiler_options} -I $(JAVA_HOME)/include/"
+               c_compiler_options = "{c_compiler_options} -I $(JAVA_HOME)/include/ -I $(JAVA_HOME)/include/linux/"
                c_linker_options = "{c_linker_options} -L $(JNI_LIB_PATH) -ljvm"
        end
 
index ac93fb4..ac1d618 100644 (file)
@@ -31,7 +31,7 @@ class B
                'B'.output
                '1'.output
                ' '.output
-               inita
+               super
                'B'.output
                '2'.output
                ' '.output
@@ -45,7 +45,7 @@ class C
                'C'.output
                '1'.output
                ' '.output
-               inita
+               super
                'C'.output
                '2'.output
                ' '.output
@@ -58,52 +58,12 @@ class D
        super C
        init do
                'D'.output
-               '0'.output
-               ' '.output
-#alt1#         inita
-#alt3#         inita
-#alt5#         inita
-#alt7#         inita
-#alt9#         inita
-#alt11#                inita
-#alt13#                inita
-#alt15#                inita
-               'D'.output
                '1'.output
                ' '.output
-#alt2#         initb
-#alt3#         initb
-#alt6#         initb
-#alt7#         initb
-#alt10#                initb
-#alt11#                initb
-#alt14#                initb
-#alt15#                initb
+               super
                'D'.output
                '2'.output
                ' '.output
-#alt4#         initc
-#alt5#         initc
-#alt6#         initc
-#alt7#         initc
-#alt12#                initc
-#alt13#                initc
-#alt14#                initc
-#alt15#                initc
-               'D'.output
-               '3'.output
-               ' '.output
-#alt8#         inite
-#alt9#         inite
-#alt10#                inite
-#alt11#                inite
-#alt12#                inite
-#alt13#                inite
-#alt14#                inite
-#alt15#                inite
-               'D'.output
-               '4'.output
-               ' '.output
        end
 
        init inite do
index 7b5bfc4..aa032c0 100644 (file)
@@ -68,7 +68,7 @@ class C
                'C'.output
                '1'.output
                ' '.output
-               inita
+               super
                'C'.output
                '2'.output
                ' '.output
index 2e20b7e..93a2d8f 100644 (file)
@@ -1,10 +1,3 @@
 bcm2835
-gtk3_6
-gtk3_8
-posix_ext
-physical_interface_for_mpd_on_rpi
 blink
 input
-android_app
-android_assets
-opengles1
index c782ec0..e69de29 100644 (file)
@@ -1,2 +0,0 @@
-init_inherit
-init_linext
index b74fc3c..4872f08 100644 (file)
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-import end
-class Object
-end
+import kernel
 
 class A
-       fun toto do end
+       fun toto do 1.output
 end
 class B
        super A
-       redef fun toto do end
+       redef fun toto do 2.output
 end
 class C
        super A
-       redef fun toto do end
+       redef fun toto do 3.output
 end
 class D
        super B
        super C
 end
+
+(new A).toto
+(new B).toto
+(new C).toto
+#alt1#(new D).toto
index c782ec0..e69de29 100644 (file)
@@ -1,2 +0,0 @@
-init_inherit
-init_linext
index fb091a0..7175bb7 100644 (file)
@@ -1,3 +1,2 @@
-init_inherit
-init_linext
 nitg
+nitdoc
index c782ec0..e69de29 100644 (file)
@@ -1,2 +0,0 @@
-init_inherit
-init_linext
index 5f17ed8..e69de29 100644 (file)
@@ -1,3 +0,0 @@
-init_inherit
-init_linext
-android
index baf5b76..1fec913 100644 (file)
@@ -1,5 +1,3 @@
-init_inherit
-init_linext
 test_mem
 shoot_logic
 bench_
@@ -16,7 +14,6 @@ nitg_args6
 nitg_args8
 test_markdown_args1
 pep8analysis
-nitcc_parser_gen
 emscripten
 nitserial_args
 nitunit_args
index afed2b6..da1d367 100644 (file)
@@ -1,5 +1,3 @@
-init_inherit
-init_linext
 test_mem
 shoot_logic
 bench_
index 04165c5..2240200 100644 (file)
@@ -4,5 +4,5 @@ B{A}ba
 C{B{A}}cba
 Ama
 A2ma
-B{A}nbma
-O{C{B{A}}}onmcba
+B{A}nmba
+O{C{B{A}}}oncmba
index bf88578..863486b 100644 (file)
@@ -1 +1 @@
-alt/base_init_inherit2_alt3.nit:75,7: Error: Explicit constructor required in N since multiple inheritance of constructor is forbiden. Conflicting classes are B, C. Costructors are base_init_inherit2_alt3::B::cb, base_init_inherit2_alt3::A::ca, base_init_inherit2_alt3::C::cc.
+Aa
index 9a3590f..d25bc4f 100644 (file)
@@ -2,6 +2,6 @@ Aa
 Ama
 B{A}ba
 Ana
-B{A}omba
-B{A}pbna
-B{A}qmbna
+B{A}obma
+B{A}pnba
+B{A}qnbma
index 3a08969..3aef777 100644 (file)
@@ -2,6 +2,6 @@ Aa
 Ama
 B{A}ba
 Ana
-B{A}omba
-B{A}pbna
-B{A}qombna
+B{A}obma
+B{A}pnba
+B{A}qonbma
index 77e587f..340bcfd 100644 (file)
@@ -2,6 +2,6 @@ Aa
 Ama
 B{A}ba
 Ana
-B{A}omba
-B{A}pbna
-B{A}qmpbna
+B{A}obma
+B{A}pnba
+B{A}qpnbma
index 7293394..486e174 100644 (file)
@@ -2,6 +2,6 @@ Aa
 Ama
 B{A}ba
 Ana
-B{A}omba
-B{A}pbna
-B{A}qompbna
+B{A}obma
+B{A}pnba
+B{A}qponbma
index c67526f..246f558 100644 (file)
@@ -2,5 +2,5 @@ A1a
 B2{A1}ba
 C3{B2{A1}}cba
 A1ma
-B2{A1}nbma
-O4{C3{B2{A1}}}onmcba
+B2{A1}nmba
+O4{C3{B2{A1}}}oncmba
index 893493f..a912b09 100644 (file)
@@ -1 +1,5 @@
-alt/base_init_inherit6_alt1.nit:32,10--14: Error: init is not a constructor in B.
+1
+2
+1
+3
+1
index 900503c..ce7a77e 100644 (file)
@@ -1 +1,5 @@
-alt/base_init_inherit6_alt2.nit:33,10--18: Error: foo is not a constructor in B.
+1
+2
+1
+3
+2
index a63698b..1243025 100644 (file)
@@ -1,11 +1,19 @@
-alt/base_init_inherit_alt1.nit:95,2--9: Error: ca is not a constructor in B.
-alt/base_init_inherit_alt1.nit:96,2--10: Error: ca2 is not a constructor in B.
-alt/base_init_inherit_alt1.nit:98,2--9: Error: ca is not a constructor in C.
-alt/base_init_inherit_alt1.nit:99,2--10: Error: ca2 is not a constructor in C.
-alt/base_init_inherit_alt1.nit:100,2--9: Error: cb is not a constructor in C.
-alt/base_init_inherit_alt1.nit:104,2--9: Error: ca is not a constructor in N.
-alt/base_init_inherit_alt1.nit:105,2--10: Error: ca2 is not a constructor in N.
-alt/base_init_inherit_alt1.nit:107,2--9: Error: ca is not a constructor in O.
-alt/base_init_inherit_alt1.nit:108,2--10: Error: ca2 is not a constructor in O.
-alt/base_init_inherit_alt1.nit:109,2--9: Error: cb is not a constructor in O.
-alt/base_init_inherit_alt1.nit:110,2--9: Error: cc is not a constructor in O.
+Aa
+A2a
+B{A}ba
+Aba
+A2ba
+C{B{A}}cba
+Acba
+A2cba
+B{A}cba
+Ama
+A2ma
+B{A}nmba
+Anmba
+A2nmba
+O{C{B{A}}}oncmba
+Aoncmba
+A2oncmba
+B{A}oncmba
+C{B{A}}oncmba
index 6f74ed3..b0e29f8 100644 (file)
@@ -1 +1 @@
-B1 A B2 C1 C2 D0 D1 D2 D3 D4 
+D1 C1 B1 A B2 C2 D2 
index c12605c..daa73b2 100644 (file)
@@ -3,6 +3,6 @@ A2x
 B1 A B2 
 A B3 
 A B4y 
-C1 A C2 
+C1 C2 
 A2z C3z 
-D1 B1 A B2 C1 C2 D2 D3 
+D1 B1 A B2 D2 D3 
index 1b64c0f..fc63fc7 100644 (file)
@@ -1 +1 @@
-alt/base_init_linext2_alt1.nit:100,1--5: Error: No contructor named initd in superclasses.
+alt/base_init_linext2_alt1.nit:100,1--5: Error: No super method to call for initd.
index c7c14d4..fe7551d 100644 (file)
@@ -1 +1,8 @@
-alt/base_init_linext2_alt2.nit:99,2--5: Error: there is no available compatible constructor in B. Discarded candidates are base_init_linext2_alt2::B::initb, base_init_linext2_alt2::B::init_par, base_init_linext2_alt2::B::init_par2(c: Char).
+A 
+A2x 
+B1 A B2 
+A B3 
+A B4y 
+C1 C2 
+A2z C3z 
+C1 C2 D1 D2 D3 
index 924b31d..7eadb94 100644 (file)
@@ -3,6 +3,6 @@ A2x
 B1 A B2 
 A B3 
 A B4y 
-C1 A C2 
+C1 C2 
 A2z C3z 
 D1 B1 A B2 D2 C1 C2 D3 
index 1bd61e3..9bc59e1 100644 (file)
@@ -1 +1,8 @@
-alt/base_init_linext2_alt4.nit:99,2--5: Error: there is no available compatible constructor in B. Discarded candidates are base_init_linext2_alt4::B::initb, base_init_linext2_alt4::B::init_par, base_init_linext2_alt4::B::init_par2(c: Char).
+A 
+A2x 
+B1 A B2 
+A B3 
+A B4y 
+C1 C2 
+A2z C3z 
+D1 C1 C2 B1 A B2 D2 D3 
index d04a73a..bc59762 100644 (file)
@@ -1 +1,8 @@
-alt/base_init_linext2_alt5.nit:109,1--5: Error: Only one super constructor invocation of class B is allowed.
+A 
+A2x 
+B1 A B2 
+A B3 
+A B4y 
+C1 C2 
+A2z C3z 
+D1 B1 A B2 D2 B1 A B2 D3 
index 90938b0..6d4b14b 100644 (file)
@@ -1,5 +1,5 @@
 A 
 B1 A B2 
 C1 A C2 
-B1 A B2 C1 C2 D0 D1 D2 D3 D4 
-E1 A E2 B1 B2 E3 C1 C2 E4 
+D1 C1 B1 A B2 C2 D2 
+E1 D1 C1 B1 A B2 C2 D2 E2 D1 C1 B1 A B2 C2 D2 E3 D1 C1 B1 A B2 C2 D2 E4 
diff --git a/tests/sav/base_init_linext_alt1.res b/tests/sav/base_init_linext_alt1.res
deleted file mode 100644 (file)
index 04e3275..0000000
+++ /dev/null
@@ -1 +0,0 @@
-D0 A B1 B2 C1 C2 D1 D2 D3 D4 
diff --git a/tests/sav/base_init_linext_alt10.res b/tests/sav/base_init_linext_alt10.res
deleted file mode 100644 (file)
index 683e93c..0000000
+++ /dev/null
@@ -1 +0,0 @@
-D0 D1 B1 A B2 D2 D3 E1 E2 E3 C1 C2 E4 D4 
diff --git a/tests/sav/base_init_linext_alt11.res b/tests/sav/base_init_linext_alt11.res
deleted file mode 100644 (file)
index edef552..0000000
+++ /dev/null
@@ -1 +0,0 @@
-D0 A D1 B1 B2 D2 D3 E1 E2 E3 C1 C2 E4 D4 
diff --git a/tests/sav/base_init_linext_alt12.res b/tests/sav/base_init_linext_alt12.res
deleted file mode 100644 (file)
index a92a06b..0000000
+++ /dev/null
@@ -1 +0,0 @@
-D0 D1 D2 C1 A C2 D3 E1 E2 B1 B2 E3 E4 D4 
diff --git a/tests/sav/base_init_linext_alt13.res b/tests/sav/base_init_linext_alt13.res
deleted file mode 100644 (file)
index cea7bbd..0000000
+++ /dev/null
@@ -1 +0,0 @@
-D0 A D1 D2 C1 C2 D3 E1 E2 B1 B2 E3 E4 D4 
diff --git a/tests/sav/base_init_linext_alt14.res b/tests/sav/base_init_linext_alt14.res
deleted file mode 100644 (file)
index ce9cfc0..0000000
+++ /dev/null
@@ -1 +0,0 @@
-D0 D1 B1 A B2 D2 C1 C2 D3 E1 E2 E3 E4 D4 
diff --git a/tests/sav/base_init_linext_alt15.res b/tests/sav/base_init_linext_alt15.res
deleted file mode 100644 (file)
index d48d0e2..0000000
+++ /dev/null
@@ -1 +0,0 @@
-D0 A D1 B1 B2 D2 C1 C2 D3 E1 E2 E3 E4 D4 
diff --git a/tests/sav/base_init_linext_alt2.res b/tests/sav/base_init_linext_alt2.res
deleted file mode 100644 (file)
index 0d383df..0000000
+++ /dev/null
@@ -1 +0,0 @@
-D0 D1 B1 A B2 C1 C2 D2 D3 D4 
diff --git a/tests/sav/base_init_linext_alt3.res b/tests/sav/base_init_linext_alt3.res
deleted file mode 100644 (file)
index 539f8ad..0000000
+++ /dev/null
@@ -1 +0,0 @@
-D0 A D1 B1 B2 C1 C2 D2 D3 D4 
diff --git a/tests/sav/base_init_linext_alt4.res b/tests/sav/base_init_linext_alt4.res
deleted file mode 100644 (file)
index 2aa8b4e..0000000
+++ /dev/null
@@ -1 +0,0 @@
-B1 A B2 D0 D1 D2 C1 C2 D3 D4 
diff --git a/tests/sav/base_init_linext_alt5.res b/tests/sav/base_init_linext_alt5.res
deleted file mode 100644 (file)
index 7883af4..0000000
+++ /dev/null
@@ -1 +0,0 @@
-D0 A B1 B2 D1 D2 C1 C2 D3 D4 
diff --git a/tests/sav/base_init_linext_alt6.res b/tests/sav/base_init_linext_alt6.res
deleted file mode 100644 (file)
index ce5e04a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-D0 D1 B1 A B2 D2 C1 C2 D3 D4 
diff --git a/tests/sav/base_init_linext_alt7.res b/tests/sav/base_init_linext_alt7.res
deleted file mode 100644 (file)
index c075e86..0000000
+++ /dev/null
@@ -1 +0,0 @@
-D0 A D1 B1 B2 D2 C1 C2 D3 D4 
diff --git a/tests/sav/base_init_linext_alt8.res b/tests/sav/base_init_linext_alt8.res
deleted file mode 100644 (file)
index 305d19c..0000000
+++ /dev/null
@@ -1 +0,0 @@
-D0 D1 D2 D3 E1 A E2 B1 B2 E3 C1 C2 E4 D4 
diff --git a/tests/sav/base_init_linext_alt9.res b/tests/sav/base_init_linext_alt9.res
deleted file mode 100644 (file)
index 322c6ab..0000000
+++ /dev/null
@@ -1 +0,0 @@
-D0 A D1 D2 D3 E1 E2 B1 B2 E3 C1 C2 E4 D4 
index 2d4d642..27671d4 100644 (file)
@@ -1,4 +1,4 @@
 A 
 b1 B1 A B2 b2 
 c1 C1 A C2 c2 
-d1 b1 B1 A B2 b2 c1 C1 C2 c2 D0 D1 D2 D3 D4 d2 
+d1 D1 c1 C1 b1 B1 A B2 b2 C2 c2 D2 d2 
index 6a6e994..01e79c3 100644 (file)
@@ -1 +1,3 @@
-Property inheritance conflict in class D for `toto': conflicting properties are defined in B, C
+1
+2
+3
diff --git a/tests/sav/error_prop_loc_alt1.res b/tests/sav/error_prop_loc_alt1.res
new file mode 100644 (file)
index 0000000..ca9822e
--- /dev/null
@@ -0,0 +1,5 @@
+alt/error_prop_loc_alt1.nit:38,1--12: Warning: conflicting property definitions for property toto in D: error_prop_loc_alt1#B#toto error_prop_loc_alt1#C#toto
+1
+2
+3
+3
index 18f8f3d..e69de29 100644 (file)
@@ -1 +0,0 @@
-alt/error_redef_1alt4_alt5.nit:30,12--13: Redef error: The procedure B::f1 redefines the function A::f1.
index da892e9..e69de29 100644 (file)
@@ -1 +0,0 @@
-alt/error_redef_1alt4_alt9.nit:34,15: Syntax error: untyped parameter.
diff --git a/tests/sav/fixme/error_prop_loc.res b/tests/sav/fixme/error_prop_loc.res
deleted file mode 100644 (file)
index e69de29..0000000
diff --git a/tests/sav/fixme/error_redef_1alt4_alt5.res b/tests/sav/fixme/error_redef_1alt4_alt5.res
deleted file mode 100644 (file)
index e69de29..0000000
diff --git a/tests/sav/fixme/error_redef_1alt4_alt9.res b/tests/sav/fixme/error_redef_1alt4_alt9.res
deleted file mode 100644 (file)
index e69de29..0000000
diff --git a/tests/sav/fixme/test_inheritance_raf.res b/tests/sav/fixme/test_inheritance_raf.res
deleted file mode 100644 (file)
index dd8e78f..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-1
-1
-5
-5
-1
-2
-5
-2
-1
-1
-3
-7
-1
-2
-3
-4
diff --git a/tests/sav/nitc/base_for_nullable.res b/tests/sav/nitc/base_for_nullable.res
deleted file mode 100644 (file)
index a75893d..0000000
+++ /dev/null
@@ -1 +0,0 @@
-base_for_nullable.nit:21,10--13: Type error: 'for' on a nullable expression.
diff --git a/tests/sav/nitc/base_for_nullable_alt1.res b/tests/sav/nitc/base_for_nullable_alt1.res
deleted file mode 100644 (file)
index 1baed81..0000000
+++ /dev/null
@@ -1 +0,0 @@
-alt/base_for_nullable_alt1.nit:21,10--13: Type error: 'for' on a nullable expression.
diff --git a/tests/sav/nitc/base_for_nullable_alt2.res b/tests/sav/nitc/base_for_nullable_alt2.res
deleted file mode 100644 (file)
index 14de0ee..0000000
+++ /dev/null
@@ -1 +0,0 @@
-alt/base_for_nullable_alt2.nit:21,10--13: Type error: 'for' on a nullable expression.
diff --git a/tests/sav/nitg-g/fixme/base_attr_init_val_int_alt1.res b/tests/sav/nitg-g/fixme/base_attr_init_val_int_alt1.res
deleted file mode 100644 (file)
index c508d53..0000000
+++ /dev/null
@@ -1 +0,0 @@
-false
diff --git a/tests/sav/nitg-g/fixme/base_attr_init_val_int_alt2.res b/tests/sav/nitg-g/fixme/base_attr_init_val_int_alt2.res
deleted file mode 100644 (file)
index f76dd23..0000000
Binary files a/tests/sav/nitg-g/fixme/base_attr_init_val_int_alt2.res and /dev/null differ
diff --git a/tests/sav/nitg-g/fixme/base_attr_init_val_int_alt3.res b/tests/sav/nitg-g/fixme/base_attr_init_val_int_alt3.res
deleted file mode 100644 (file)
index 573541a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-0
diff --git a/tests/sav/nitg-g/fixme/base_attr_init_val_int_alt4.res b/tests/sav/nitg-g/fixme/base_attr_init_val_int_alt4.res
deleted file mode 100644 (file)
index 945da8f..0000000
+++ /dev/null
@@ -1 +0,0 @@
-0.000000
diff --git a/tests/sav/nitg-g/fixme/base_attr_init_val_raf_alt1.res b/tests/sav/nitg-g/fixme/base_attr_init_val_raf_alt1.res
deleted file mode 100644 (file)
index 2f1465d..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-1
-1
-0
diff --git a/tests/sav/nitg-g/fixme/base_attr_nullable_int_alt1.res b/tests/sav/nitg-g/fixme/base_attr_nullable_int_alt1.res
deleted file mode 100644 (file)
index 5625f1f..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-0
-0
-1
-2
-10
-20
-30
diff --git a/tests/sav/nitg-g/fixme/base_attr_nullable_int_alt2.res b/tests/sav/nitg-g/fixme/base_attr_nullable_int_alt2.res
deleted file mode 100644 (file)
index 2e8046c..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-1
-0
-1
-2
-10
-20
-30
diff --git a/tests/sav/nitg-g/fixme/base_attr_nullable_int_alt3.res b/tests/sav/nitg-g/fixme/base_attr_nullable_int_alt3.res
deleted file mode 100644 (file)
index f0c5f8f..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-0
-0
-0
-1
-2
-10
-20
-30
diff --git a/tests/sav/nitg-g/fixme/base_attr_nullable_int_alt4.res b/tests/sav/nitg-g/fixme/base_attr_nullable_int_alt4.res
deleted file mode 100644 (file)
index a12c8e0..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-10
-0
-1
-2
-10
-20
-30
diff --git a/tests/sav/nitg-g/fixme/base_attr_nullable_int_alt5.res b/tests/sav/nitg-g/fixme/base_attr_nullable_int_alt5.res
deleted file mode 100644 (file)
index f343f0e..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-10
-20
-0
-1
-2
-10
-20
-30
diff --git a/tests/sav/nitg-g/fixme/base_covar_int2_alt3.res b/tests/sav/nitg-g/fixme/base_covar_int2_alt3.res
deleted file mode 100644 (file)
index fbffc32..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-1
-1
-1
-aa
diff --git a/tests/sav/nitg-g/fixme/base_covar_int2_alt5.res b/tests/sav/nitg-g/fixme/base_covar_int2_alt5.res
deleted file mode 100644 (file)
index 5f6d34c..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-1
-1
-1
-1
-a
diff --git a/tests/sav/nitg-g/fixme/base_covar_int_alt3.res b/tests/sav/nitg-g/fixme/base_covar_int_alt3.res
deleted file mode 100644 (file)
index d3413ee..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-true
-true
-true
-false
-true
diff --git a/tests/sav/nitg-g/fixme/base_for_finish.res b/tests/sav/nitg-g/fixme/base_for_finish.res
deleted file mode 100644 (file)
index 390c4e4..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-1
-2
-3
-0
-
-1
-100
-2
-0
-
-1
-10
-20
-100
-2
-10
diff --git a/tests/sav/nitg-s/fixme/base_attr_init_val_int_alt1.res b/tests/sav/nitg-s/fixme/base_attr_init_val_int_alt1.res
deleted file mode 100644 (file)
index c508d53..0000000
+++ /dev/null
@@ -1 +0,0 @@
-false
diff --git a/tests/sav/nitg-s/fixme/base_attr_init_val_int_alt2.res b/tests/sav/nitg-s/fixme/base_attr_init_val_int_alt2.res
deleted file mode 100644 (file)
index f76dd23..0000000
Binary files a/tests/sav/nitg-s/fixme/base_attr_init_val_int_alt2.res and /dev/null differ
diff --git a/tests/sav/nitg-s/fixme/base_attr_init_val_int_alt3.res b/tests/sav/nitg-s/fixme/base_attr_init_val_int_alt3.res
deleted file mode 100644 (file)
index 573541a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-0
diff --git a/tests/sav/nitg-s/fixme/base_attr_init_val_int_alt4.res b/tests/sav/nitg-s/fixme/base_attr_init_val_int_alt4.res
deleted file mode 100644 (file)
index 945da8f..0000000
+++ /dev/null
@@ -1 +0,0 @@
-0.000000
diff --git a/tests/sav/nitg-s/fixme/base_attr_init_val_raf_alt1.res b/tests/sav/nitg-s/fixme/base_attr_init_val_raf_alt1.res
deleted file mode 100644 (file)
index 2f1465d..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-1
-1
-0
diff --git a/tests/sav/nitg-s/fixme/base_attr_nullable_int_alt1.res b/tests/sav/nitg-s/fixme/base_attr_nullable_int_alt1.res
deleted file mode 100644 (file)
index 5625f1f..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-0
-0
-1
-2
-10
-20
-30
diff --git a/tests/sav/nitg-s/fixme/base_attr_nullable_int_alt2.res b/tests/sav/nitg-s/fixme/base_attr_nullable_int_alt2.res
deleted file mode 100644 (file)
index 2e8046c..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-1
-0
-1
-2
-10
-20
-30
diff --git a/tests/sav/nitg-s/fixme/base_attr_nullable_int_alt3.res b/tests/sav/nitg-s/fixme/base_attr_nullable_int_alt3.res
deleted file mode 100644 (file)
index f0c5f8f..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-0
-0
-0
-1
-2
-10
-20
-30
diff --git a/tests/sav/nitg-s/fixme/base_attr_nullable_int_alt4.res b/tests/sav/nitg-s/fixme/base_attr_nullable_int_alt4.res
deleted file mode 100644 (file)
index a12c8e0..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-10
-0
-1
-2
-10
-20
-30
diff --git a/tests/sav/nitg-s/fixme/base_attr_nullable_int_alt5.res b/tests/sav/nitg-s/fixme/base_attr_nullable_int_alt5.res
deleted file mode 100644 (file)
index f343f0e..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-10
-20
-0
-1
-2
-10
-20
-30
diff --git a/tests/sav/nitg-s/fixme/base_covar_int2_alt3.res b/tests/sav/nitg-s/fixme/base_covar_int2_alt3.res
deleted file mode 100644 (file)
index fbffc32..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-1
-1
-1
-aa
diff --git a/tests/sav/nitg-s/fixme/base_covar_int2_alt5.res b/tests/sav/nitg-s/fixme/base_covar_int2_alt5.res
deleted file mode 100644 (file)
index 5f6d34c..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-1
-1
-1
-1
-a
diff --git a/tests/sav/nitg-s/fixme/base_covar_int_alt3.res b/tests/sav/nitg-s/fixme/base_covar_int_alt3.res
deleted file mode 100644 (file)
index d3413ee..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-true
-true
-true
-false
-true
diff --git a/tests/sav/nitg-s/fixme/base_for_finish.res b/tests/sav/nitg-s/fixme/base_for_finish.res
deleted file mode 100644 (file)
index 390c4e4..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-1
-2
-3
-0
-
-1
-100
-2
-0
-
-1
-10
-20
-100
-2
-10
diff --git a/tests/sav/nitg-sg/fixme/base_attr_init_val_int_alt1.res b/tests/sav/nitg-sg/fixme/base_attr_init_val_int_alt1.res
deleted file mode 100644 (file)
index c508d53..0000000
+++ /dev/null
@@ -1 +0,0 @@
-false
diff --git a/tests/sav/nitg-sg/fixme/base_attr_init_val_int_alt2.res b/tests/sav/nitg-sg/fixme/base_attr_init_val_int_alt2.res
deleted file mode 100644 (file)
index f76dd23..0000000
Binary files a/tests/sav/nitg-sg/fixme/base_attr_init_val_int_alt2.res and /dev/null differ
diff --git a/tests/sav/nitg-sg/fixme/base_attr_init_val_int_alt3.res b/tests/sav/nitg-sg/fixme/base_attr_init_val_int_alt3.res
deleted file mode 100644 (file)
index 573541a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-0
diff --git a/tests/sav/nitg-sg/fixme/base_attr_init_val_int_alt4.res b/tests/sav/nitg-sg/fixme/base_attr_init_val_int_alt4.res
deleted file mode 100644 (file)
index 945da8f..0000000
+++ /dev/null
@@ -1 +0,0 @@
-0.000000
diff --git a/tests/sav/nitg-sg/fixme/base_attr_init_val_raf_alt1.res b/tests/sav/nitg-sg/fixme/base_attr_init_val_raf_alt1.res
deleted file mode 100644 (file)
index 2f1465d..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-1
-1
-0
diff --git a/tests/sav/nitg-sg/fixme/base_attr_nullable_int_alt1.res b/tests/sav/nitg-sg/fixme/base_attr_nullable_int_alt1.res
deleted file mode 100644 (file)
index 5625f1f..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-0
-0
-1
-2
-10
-20
-30
diff --git a/tests/sav/nitg-sg/fixme/base_attr_nullable_int_alt2.res b/tests/sav/nitg-sg/fixme/base_attr_nullable_int_alt2.res
deleted file mode 100644 (file)
index 2e8046c..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-1
-0
-1
-2
-10
-20
-30
diff --git a/tests/sav/nitg-sg/fixme/base_attr_nullable_int_alt3.res b/tests/sav/nitg-sg/fixme/base_attr_nullable_int_alt3.res
deleted file mode 100644 (file)
index f0c5f8f..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-0
-0
-0
-1
-2
-10
-20
-30
diff --git a/tests/sav/nitg-sg/fixme/base_attr_nullable_int_alt4.res b/tests/sav/nitg-sg/fixme/base_attr_nullable_int_alt4.res
deleted file mode 100644 (file)
index a12c8e0..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-10
-0
-1
-2
-10
-20
-30
diff --git a/tests/sav/nitg-sg/fixme/base_attr_nullable_int_alt5.res b/tests/sav/nitg-sg/fixme/base_attr_nullable_int_alt5.res
deleted file mode 100644 (file)
index f343f0e..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-10
-20
-0
-1
-2
-10
-20
-30
diff --git a/tests/sav/nitg-sg/fixme/base_covar_int2_alt3.res b/tests/sav/nitg-sg/fixme/base_covar_int2_alt3.res
deleted file mode 100644 (file)
index fbffc32..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-1
-1
-1
-aa
diff --git a/tests/sav/nitg-sg/fixme/base_covar_int2_alt5.res b/tests/sav/nitg-sg/fixme/base_covar_int2_alt5.res
deleted file mode 100644 (file)
index 5f6d34c..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-1
-1
-1
-1
-a
diff --git a/tests/sav/nitg-sg/fixme/base_covar_int_alt3.res b/tests/sav/nitg-sg/fixme/base_covar_int_alt3.res
deleted file mode 100644 (file)
index d3413ee..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-true
-true
-true
-false
-true
diff --git a/tests/sav/nitg-sg/fixme/base_for_finish.res b/tests/sav/nitg-sg/fixme/base_for_finish.res
deleted file mode 100644 (file)
index 390c4e4..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-1
-2
-3
-0
-
-1
-100
-2
-0
-
-1
-10
-20
-100
-2
-10
diff --git a/tests/sav/nitg-sg/fixme/test_platform_android.res b/tests/sav/nitg-sg/fixme/test_platform_android.res
new file mode 100644 (file)
index 0000000..4ad3dc3
--- /dev/null
@@ -0,0 +1 @@
+UNDEFINED
index a007f82..dd8e78f 100644 (file)
@@ -1 +1,16 @@
-Property inheritance conflict in class B for `i': conflicting properties are defined in B, A
+1
+1
+5
+5
+1
+2
+5
+2
+1
+1
+3
+7
+1
+2
+3
+4
index 642abeb..19ca640 100644 (file)
@@ -27,11 +27,11 @@ extern class JavaArrayList in "Java" `{ java.util.ArrayList `}
                return new ArrayList();
        `}
 
-       fun add(o: Int) in "Java" `{ recv.add(o); `}
+       fun add(o: JavaString) in "Java" `{ recv.add(o); `}
 
        redef fun output in "Java" `{
                for (Object i: recv) {
-                       System.out.println((long)i);
+                       System.out.println((String)i);
                }
        `}
 
@@ -41,12 +41,12 @@ extern class JavaArrayList in "Java" `{ java.util.ArrayList `}
 end
 
 var ll = new JavaArrayList
-ll.add(1)
-ll.add(2)
-ll.add(1)
-ll.add(3)
-ll.add(20)
-ll.add(10)
+ll.add "1".to_java_string
+ll.add "2".to_java_string
+ll.add "1".to_java_string
+ll.add "3".to_java_string
+ll.add "20".to_java_string
+ll.add "10".to_java_string
 ll.output
 ll.sort
 ll.output
index e02eef2..8720ca3 100755 (executable)
@@ -27,13 +27,13 @@ unset NIT_DIR
 
 # Get the first Java lib available
 shopt -s nullglob
-paths=`echo /usr/lib/jvm/*/`
-paths=($paths) 
-JAVA_HOME=${paths[0]}
+JAVA_HOME=$(dirname $(dirname $(readlink -f $(which javac))))
 
 paths=`echo $JAVA_HOME/jre/lib/*/{client,server}/`
 paths=($paths) 
 JNI_LIB_PATH=${paths[0]}
+echo $JAVA_HOME
+echo $JNI_LIB_PATH
 shopt -u nullglob
 
 outdir="out"
@@ -380,22 +380,27 @@ case $engine in
                engine=nitg-s;
                enginebinname=nitg;
                OPT="--separate $OPT --compile-dir $compdir"
+               savdirs="sav/nitg-common/"
                ;;
        nitg-s)
                enginebinname=nitg;
                OPT="--separate $OPT --compile-dir $compdir"
+               savdirs="sav/nitg-common/"
                ;;
        nitg-e)
                enginebinname=nitg;
                OPT="--erasure $OPT --compile-dir $compdir"
+               savdirs="sav/nitg-common/"
                ;;
        nitg-sg)
                enginebinname=nitg;
                OPT="--semi-global $OPT --compile-dir $compdir"
+               savdirs="sav/nitg-common/"
                ;;
        nitg-g)
                enginebinname=nitg;
                OPT="--global $OPT --compile-dir $compdir"
+               savdirs="sav/nitg-common/"
                ;;
        nit)
                engine=niti