From ef83423017e83c69532f922822129d832968d322 Mon Sep 17 00:00:00 2001 From: Jean Privat Date: Thu, 27 Nov 2014 20:46:08 -0500 Subject: [PATCH] all: fix broken markdown comments with missing or unwanted code blocks Signed-off-by: Jean Privat --- contrib/jwrapper/src/javap_visitor.nit | 1 + lib/pnacl.nit | 6 +-- lib/string_experimentations/utf8.nit | 2 + lib/string_experimentations/utf8_noindex.nit | 2 + lib/trees/bintree.nit | 4 ++ lib/trees/rbtree.nit | 18 ++++----- src/compiler/coloring.nit | 32 +++++++++------ src/model/model.nit | 18 ++++++--- src/vm.nit | 56 +++++++++++++------------- 9 files changed, 80 insertions(+), 59 deletions(-) diff --git a/contrib/jwrapper/src/javap_visitor.nit b/contrib/jwrapper/src/javap_visitor.nit index 45edb3d..1ede6f0 100644 --- a/contrib/jwrapper/src/javap_visitor.nit +++ b/contrib/jwrapper/src/javap_visitor.nit @@ -300,6 +300,7 @@ end # # # C L A S S H E A D E R # # # + redef class Nclass_header redef fun accept_visitor(v) do diff --git a/lib/pnacl.nit b/lib/pnacl.nit index bc876c0..4008422 100644 --- a/lib/pnacl.nit +++ b/lib/pnacl.nit @@ -13,15 +13,13 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -# -# Targets the PNaCl platform + +# Provides PNaCl support for Nit. # # To use this module and compile for PNaCl, you must install the # NaCl SDK (This file is based on Pepper 33). # If NACL_SDK_ROOT is not set in your PATH, you have to work in # 'nacl_sdk/pepper_your_pepper_version/getting_started/your_project_folder'. -# -# Provides PNaCl support for Nit. module pnacl is platform import standard diff --git a/lib/string_experimentations/utf8.nit b/lib/string_experimentations/utf8.nit index b7a74ce..34edd00 100644 --- a/lib/string_experimentations/utf8.nit +++ b/lib/string_experimentations/utf8.nit @@ -47,6 +47,7 @@ extern class UnicodeChar `{ UTF8Char* `} # # As per the specification : # + # ~~~raw # Length | UTF-8 octet sequence # | (binary) # ---------+------------------------------------------------- @@ -54,6 +55,7 @@ extern class UnicodeChar `{ UTF8Char* `} # 2 | 110xxxxx 10xxxxxx # 3 | 1110xxxx 10xxxxxx 10xxxxxx # 4 | 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx + # ~~~ private fun len: Int `{ char* ns = recv->ns; int pos = recv->pos; diff --git a/lib/string_experimentations/utf8_noindex.nit b/lib/string_experimentations/utf8_noindex.nit index db51f0a..547cbf7 100644 --- a/lib/string_experimentations/utf8_noindex.nit +++ b/lib/string_experimentations/utf8_noindex.nit @@ -53,6 +53,7 @@ extern class UnicodeChar `{ uint32_t* `} # # As per the specification : # + # ~~~raw # Length | UTF-8 octet sequence # | (binary) # ---------+------------------------------------------------- @@ -60,6 +61,7 @@ extern class UnicodeChar `{ uint32_t* `} # 2 | 110xxxxx 10xxxxxx # 3 | 1110xxxx 10xxxxxx 10xxxxxx # 4 | 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx + # ~~~ fun len: Int `{ uint32_t s = *recv; if(s <= 127) {return 1;} diff --git a/lib/trees/bintree.nit b/lib/trees/bintree.nit index 4c647b3..feb9671 100644 --- a/lib/trees/bintree.nit +++ b/lib/trees/bintree.nit @@ -244,11 +244,13 @@ class BinTreeMap[K: Comparable, E] # Perform left rotation on `node` # + # ~~~raw # N Y # / \ > / \ # a Y N c # / \ < / \ # b c a b + # ~~~ # protected fun rotate_left(node: N) do var y = node.right @@ -270,11 +272,13 @@ class BinTreeMap[K: Comparable, E] # Perform right rotation on `node` # + # ~~~raw # N Y # / \ > / \ # a Y N c # / \ < / \ # b c a b + # ~~~ # protected fun rotate_right(node: N) do var y = node.left diff --git a/lib/trees/rbtree.nit b/lib/trees/rbtree.nit index e1fe413..51ddfc0 100644 --- a/lib/trees/rbtree.nit +++ b/lib/trees/rbtree.nit @@ -32,17 +32,17 @@ import bintree # Red-Black Tree Map # Properties of a Red-Black tree map: -# * every node is either red or black -# * root is black -# * every leaf (null) is black -# * if a node is red, then both its children are black -# * for each node, all simple path from the node to descendant -# leaves contain the same number of black nodes +# * every node is either red or black +# * root is black +# * every leaf (null) is black +# * if a node is red, then both its children are black +# * for each node, all simple path from the node to descendant +# leaves contain the same number of black nodes # # Operations: -# * search average O(lg n) worst O(lg n) -# * insert average O(lg n) worst O(lg n) -# * delete average O(lg n) worst O(lg n) +# * search average O(lg n) worst O(lg n) +# * insert average O(lg n) worst O(lg n) +# * delete average O(lg n) worst O(lg n) class RBTreeMap[K: Comparable, E] super BinTreeMap[K, E] diff --git a/src/compiler/coloring.nit b/src/compiler/coloring.nit index bf8dc30..b2f4837 100644 --- a/src/compiler/coloring.nit +++ b/src/compiler/coloring.nit @@ -124,6 +124,8 @@ end # Two elements from a POSet cannot have the same color if they share common subelements # # Example: +# +# ~~~raw # A # / | \ # / | \ @@ -134,22 +136,26 @@ end # E F G # | # H +# ~~~ +# # Conflicts: -# A: {B, C, D, E, F, G, H} -# B: {A, C, E, H} -# C: {A, E, H, F} -# D: {A, G} -# E: {A, B, C, H} -# F: {A, C} -# G: {A, D} -# H: {A, B, C, E} +# +# * A: {B, C, D, E, F, G, H} +# * B: {A, C, E, H} +# * C: {A, E, H, F} +# * D: {A, G} +# * E: {A, B, C, H} +# * F: {A, C} +# * G: {A, D} +# * H: {A, B, C, E} +# # Possible colors: -# A:0, B:1, C: 2, D: 1, E: 3, F:3, G:2, H:4 # -# see: -# Ducournau, R. (2011). -# Coloring, a versatile technique for implementing object-oriented languages. -# Software: Practice and Experience, 41(6), 627–659. +# * A:0, B:1, C: 2, D: 1, E: 3, F:3, G:2, H:4 +# +# see: Ducournau, R. (2011). +# Coloring, a versatile technique for implementing object-oriented languages. +# Software: Practice and Experience, 41(6), 627–659. class POSetColorer[E: Object] # Is the poset already colored? diff --git a/src/model/model.nit b/src/model/model.nit index f5582d8..e709a6f 100644 --- a/src/model/model.nit +++ b/src/model/model.nit @@ -732,6 +732,7 @@ abstract class MType # types to their bounds. # # Example + # # class A end # class B super A end # class X end @@ -743,6 +744,7 @@ abstract class MType # super G[B] # redef type U: Y # end + # # Map[T,U] anchor_to H #-> Map[B,Y] # # Explanation of the example: @@ -880,11 +882,15 @@ abstract class MType # class B[F] # end # - # * E.can_resolve_for(A[Int]) #-> true, E make sense in A - # * E.can_resolve_for(B[Int]) #-> false, E does not make sense in B - # * B[E].can_resolve_for(A[F], B[Object]) #-> true, - # B[E] is a red hearing only the E is important, - # E make sense in A + # ~~~nitish + # E.can_resolve_for(A[Int]) #-> true, E make sense in A + # + # E.can_resolve_for(B[Int]) #-> false, E does not make sense in B + # + # B[E].can_resolve_for(A[F], B[Object]) #-> true, + # # B[E] is a red hearing only the E is important, + # # E make sense in A + # ~~~ # # REQUIRE: `anchor != null implies not anchor.need_anchor` # REQUIRE: `mtype.need_anchor implies anchor != null and mtype.can_resolve_for(anchor, null, mmodule)` @@ -1254,12 +1260,14 @@ end # directly to the parameter types of the super-classes. # # Example: +# # class A[E] # fun e: E is abstract # end # class B[F] # super A[Array[F]] # end +# # In the class definition B[F], `F` is a valid type but `E` is not. # However, `self.e` is a valid method call, and the signature of `e` is # declared `e: E`. diff --git a/src/vm.nit b/src/vm.nit index 9e9c778..75868c6 100644 --- a/src/vm.nit +++ b/src/vm.nit @@ -242,11 +242,11 @@ class VirtualMachine super NaiveInterpreter end # Return the attribute value in `instance` with a sequence of perfect_hashing - # `instance` is the attributes array of the receiver - # `vtable` is the pointer to the virtual table of the class (of the receiver) - # `mask` is the perfect hashing mask of the class - # `id` is the identifier of the class - # `offset` is the relative offset of this attribute + # * `instance` is the attributes array of the receiver + # * `vtable` is the pointer to the virtual table of the class (of the receiver) + # * `mask` is the perfect hashing mask of the class + # * `id` is the identifier of the class + # * `offset` is the relative offset of this attribute private fun read_attribute_ph(instance: Pointer, vtable: Pointer, mask: Int, id: Int, offset: Int): Instance `{ // Perfect hashing position int hv = mask & id; @@ -273,12 +273,12 @@ class VirtualMachine super NaiveInterpreter end # Replace the value of an attribute in an instance - # `instance` is the attributes array of the receiver - # `vtable` is the pointer to the virtual table of the class (of the receiver) - # `mask` is the perfect hashing mask of the class - # `id` is the identifier of the class - # `offset` is the relative offset of this attribute - # `value` is the new value for this attribute + # * `instance` is the attributes array of the receiver + # * `vtable` is the pointer to the virtual table of the class (of the receiver) + # * `mask` is the perfect hashing mask of the class + # * `id` is the identifier of the class + # * `offset` is the relative offset of this attribute + # * `value` is the new value for this attribute private fun write_attribute_ph(instance: Pointer, vtable: Pointer, mask: Int, id: Int, offset: Int, value: Instance) `{ // Perfect hashing position int hv = mask & id; @@ -378,11 +378,11 @@ redef class MClass end # Allocate a single vtable - # `ids : Array of superclasses identifiers - # `nb_methods : Array which contain the number of introduced methods for each class in ids - # `nb_attributes : Array which contain the number of introduced attributes for each class in ids - # `offset_attributes : Offset from the beginning of the table of the group of attributes - # `offset_methods : Offset from the beginning of the table of the group of methods + # * `ids : Array of superclasses identifiers + # * `nb_methods : Array which contain the number of introduced methods for each class in ids + # * `nb_attributes : Array which contain the number of introduced attributes for each class in ids + # * `offset_attributes : Offset from the beginning of the table of the group of attributes + # * `offset_methods : Offset from the beginning of the table of the group of methods private fun allocate_vtable(v: VirtualMachine, ids: Array[Int], nb_methods: Array[Int], nb_attributes: Array[Int], offset_attributes: Int, offset_methods: Int) do @@ -437,8 +437,8 @@ redef class MClass end # Fill the vtable with methods of `self` class - # `v` : Current instance of the VirtualMachine - # `table` : the table of self class, will be filled with its methods + # * `v` : Current instance of the VirtualMachine + # * `table` : the table of self class, will be filled with its methods private fun fill_vtable(v:VirtualMachine, table: VTable, cl: MClass) do var methods = new Array[MMethodDef] @@ -456,8 +456,8 @@ redef class MClass # Computes delta for each class # A delta represents the offset for this group of attributes in the object - # `nb_attributes` : number of attributes for each class (classes are linearized from Object to current) - # return deltas for each class + # *`nb_attributes` : number of attributes for each class (classes are linearized from Object to current) + # * return deltas for each class private fun calculate_delta(nb_attributes: Array[Int]): Array[Int] do var deltas = new Array[Int] @@ -491,8 +491,8 @@ redef class MClass end # A kind of Depth-First-Search for superclasses ordering - # `v` : the current executed instance of VirtualMachine - # `res` : Result Array, ie current superclasses ordering + # *`v` : the current executed instance of VirtualMachine + # * `res` : Result Array, ie current superclasses ordering private fun dfs(v: VirtualMachine, res: Array[MClass]): Array[MClass] do # Add this class at the beginning @@ -548,8 +548,8 @@ redef class MClass end # Update positions of self class in `parent` - # `attributes_offset`: absolute offset of introduced attributes - # `methods_offset`: absolute offset of introduced methods + # * `attributes_offset`: absolute offset of introduced attributes + # * `methods_offset`: absolute offset of introduced methods private fun update_positions(attributes_offsets: Int, methods_offset:Int, parent: MClass) do parent.positions_attributes[self] = attributes_offsets @@ -682,10 +682,10 @@ class MemoryManager `} # Put implementation of methods of a class in `vtable` - # `vtable` : Pointer to the C-virtual table - # `mask` : perfect-hashing mask of the class corresponding to the vtable - # `id` : id of the target class - # `methods` : array of MMethodDef of the target class + # * `vtable` : Pointer to the C-virtual table + # * `mask` : perfect-hashing mask of the class corresponding to the vtable + # * `id` : id of the target class + # * `methods` : array of MMethodDef of the target class fun put_methods(vtable: Pointer, mask: Int, id: Int, methods: Array[MMethodDef]) import Array[MMethodDef].length, Array[MMethodDef].[] `{ -- 1.7.9.5