Commit 179d4f3c0ce3fa45b963890c2b1998d6944e73e2

Authored by David René
1 parent 49bf6a63

add the add_* functions

Showing 1 changed file with 385 additions and 51 deletions   Show diff stats
anubis_dev/library/system/muscle.anubis
... ... @@ -48,7 +48,8 @@ type Muscle_object:
48 48 b_point(B_Point),
49 49 b_rect(B_Rect),
50 50 b_string(String),
51   - b_custom(ByteArray).
  51 + b_custom(ByteArray),
  52 + b_raw(ByteArray).
52 53  
53 54 type Muscle_type:
54 55 b_any_t,
... ... @@ -64,9 +65,9 @@ type Muscle_type:
64 65 b_point_t,
65 66 b_rect_t,
66 67 b_string_t,
67   - b_custom_t(Int32). /*,
68   - b_object,
69   - b_raw*/
  68 + b_custom_t(Int32), /*,
  69 + b_object,*/
  70 + b_raw_t.
70 71  
71 72 type Message_field:
72 73 message_field
... ... @@ -121,7 +122,8 @@ public define One
121 122 (
122 123 Message msg
123 124 )=
124   - print("Message: what = " + *msg.what + ", ASCII = \"" + to_ascii(*msg.what) + "\", Hexa = 0x" + to_hexa(*msg.what) + "\n").
  125 + print("Message: what = " + *msg.what + ", ASCII = \"" + to_ascii(*msg.what) + "\", Hexa = 0x" + to_hexa(*msg.what) +
  126 + "entry count=" + *msg.numField +"\n").
125 127  
126 128  
127 129 public define One
... ... @@ -403,7 +405,20 @@ define Maybe(Muscle_object)
403 405 {
404 406 failure then failure,
405 407 success(ba_custom) then
406   - success(b_custom(ba_custom)) //convert into Anubis String
  408 + success(b_custom(ba_custom))
  409 + }
  410 + }
  411 + //read one RAW field
  412 + b_raw_t then
  413 + if read_Int32(source) is
  414 + {
  415 + failure then failure,
  416 + success(size) then //get his size
  417 + if read_data(source, size) is //and read it
  418 + {
  419 + failure then failure,
  420 + success(ba_raw) then
  421 + success(b_raw(ba_raw))
407 422 }
408 423 }
409 424 }
... ... @@ -461,21 +476,26 @@ define Maybe(Message_field)
461 476 (
462 477 RAddr(Int8) source
463 478 )=
464   - //read length of the field name
  479 + //read length of the field name (4 bytes)
465 480 if read_Int32(source) is
466 481 {
467 482 failure then failure,
468 483 success(name_length) then
  484 + //read the field name itself
469 485 if read_data(source, name_length) is
470 486 {
471 487 failure then failure
472 488 success(ba_name) then
473 489 with field_name = to_string(ba_name),
474   - print("\nfield_name =\"" + field_name + "\"\n");
  490 + //read the type code of the field (4 bytes)
475 491 if read_Int32(source) is
476 492 {
477 493 failure then failure,
478 494 success(int32_type_code) then
  495 + //read the length of data depending on the type, the meaning of that length is different
  496 + // * for fixed size type_code, we can determine the number of data by dividing that number
  497 + // by datum size.
  498 + // * for non fixed size type_code it's only the total size of data independtly of number of data
479 499 if read_Int32(source) is
480 500 {
481 501 failure then failure
... ... @@ -586,14 +606,29 @@ define Maybe(Message_field)
586 606 success(field_items) then success(message_field(field_name, type_code, var(field_items)))
587 607 }
588 608 }
  609 + // read RAW
  610 + b_raw_t then
  611 + if read_Int32(source) is //get numbers items in that field
  612 + {
  613 + failure then failure,
  614 + success(nb_items) then
  615 + if read_field_items(source, type_code, nb_items) is
  616 + {
  617 + failure then failure,
  618 + success(field_items) then success(message_field(field_name, type_code, var(field_items)))
  619 + }
  620 + }
589 621 }
590 622 }
591 623 }
592 624 }
593 625 }
594 626 }.
595   -
596   -define Maybe(List(Message_field)) /* returns 'failure' if it cannot the required number of elements */
  627 +
  628 + /** Read each field
  629 + * @return 'failure' if it cannot read the required number of elements
  630 + */
  631 +define Maybe(List(Message_field))
597 632 read_fields
598 633 (
599 634 RAddr(Int8) source,
... ... @@ -660,7 +695,7 @@ define Maybe(Message)
660 695 failure
661 696 }
662 697 .
663   -/********************** Find collection ********************/
  698 +
664 699  
665 700 define Maybe(Message_field)
666 701 find_field
... ... @@ -687,7 +722,7 @@ define Maybe(Message_field)
687 722 }.
688 723  
689 724 define Maybe(Muscle_object)
690   - find_data_type
  725 + find_data
691 726 (
692 727 List(Message_field) fields,
693 728 Muscle_type type_code,
... ... @@ -704,20 +739,221 @@ define Maybe(Muscle_object)
704 739  
705 740  
706 741 define Maybe(Muscle_object)
707   - find_data_type
  742 + find_data
708 743 (
709 744 Muscle_type type_code,
710 745 Message msg,
711 746 String name,
712 747 Int32 index
713 748 )=
714   - find_data_type(*msg.fields, type_code, name, index).
  749 + find_data(*msg.fields, type_code, name, index).
  750 +
  751 +/********************** Add collection ********************/
  752 +
  753 + /** Generic method, capable of adding any type of data to the Message.
  754 + * @param message The message where the data to be add
  755 + * @param field_name Name of the field to add (or add to)
  756 + * @param type_code The _B_*_TYPE code indicating the type of data that will be added.
  757 + * @param m_object Muscle_object that contain the bytes of data to add. The data is copied out
  758 + * and exactly how it is interpreted depends on (type).
  759 + * @return success(One) on success, failure
  760 + */
  761 +
  762 +define Maybe(One)
  763 + add_data
  764 + (
  765 + Message msg,
  766 + String field_name,
  767 + Muscle_type type_code,
  768 + Muscle_object m_object
  769 + )=
  770 + if find_field(*msg.fields, type_code, field_name) is
  771 + {
  772 + failure then //we can't find a list of fields, then we create it
  773 + with new_field = message_field(field_name, type_code, var([m_object])),
  774 + msg.fields <- [ new_field . *msg.fields];
  775 + success(unique),
  776 + success(items_list) then
  777 + items_list.items <- [ m_object . *items_list.items];
  778 + success(unique)
  779 + }.
  780 +
  781 + /** Adds a new string to the Message.
  782 + * @param name Name of the field to add (or add to)
  783 + * @param value The string to add
  784 + * @return success(One) on success, failure
  785 + */
  786 +public define Maybe(One)
  787 + add_string
  788 + (
  789 + Message msg,
  790 + String name,
  791 + String value
  792 + )=
  793 + add_data(msg, name, b_string_t, b_string(value)).
  794 +
  795 + /** Adds a new Int8 to the Message.
  796 + * @param name Name of the field to add (or add to)
  797 + * @param value The Int8 to add
  798 + * @return success(One) on success, failure
  799 + */
  800 +public define Maybe(One)
  801 + add_int8
  802 + (
  803 + Message msg,
  804 + String name,
  805 + Int8 value
  806 + )=
  807 + add_data(msg, name, b_int8_t, b_int8(value)).
  808 +
  809 + /** Adds a new Int16 to the Message.
  810 + * @param name Name of the field to add (or add to)
  811 + * @param value The Int16 to add
  812 + * @return success(One) on success, failure
  813 + */
  814 +public define Maybe(One)
  815 + add_int16
  816 + (
  817 + Message msg,
  818 + String name,
  819 + Int16 value
  820 + )=
  821 + add_data(msg, name, b_int16_t, b_int16(value)).
  822 +
  823 + /** Adds a new Int32 to the Message.
  824 + * @param name Name of the field to add (or add to)
  825 + * @param value The Int32 to add
  826 + * @return success(One) on success, failure
  827 + */
  828 +public define Maybe(One)
  829 + add_int32
  830 + (
  831 + Message msg,
  832 + String name,
  833 + Int32 value
  834 + )=
  835 + add_data(msg, name, b_int32_t, b_int32(value)).
715 836  
716   - /** Retrieve a string value from the Message.
717   - * @param msg Message where we search the string
  837 + /** Adds a new string to the Message.
  838 + * @param name Name of the field to add (or add to)
  839 + * @param value The string to add
  840 + * @return success(One) on success, failure
  841 + */
  842 +public define Maybe(One)
  843 + add_int64
  844 + (
  845 + Message msg,
  846 + String name,
  847 + Int64 value
  848 + )=
  849 + add_data(msg, name, b_int64_t, b_int64(value)).
  850 +
  851 + /** Adds a new Bool to the Message.
  852 + * @param name Name of the field to add (or add to)
  853 + * @param value The Bool to add
  854 + * @return success(One) on success, failure
  855 + */
  856 +public define Maybe(One)
  857 + add_bool
  858 + (
  859 + Message msg,
  860 + String name,
  861 + Bool value
  862 + )=
  863 + add_data(msg, name, b_bool_t, b_bool(value)).
  864 +
  865 + /** Adds a new Float (Float32) to the Message.
  866 + * @param name Name of the field to add (or add to)
  867 + * @param value The Float (Float32) to add
  868 + * @return success(One) on success, failure
  869 + */
  870 +public define Maybe(One)
  871 + add_float
  872 + (
  873 + Message msg,
  874 + String name,
  875 + Float32 value
  876 + )=
  877 + add_data(msg, name, b_float_t, b_float(value)).
  878 +
  879 + /** Adds a new Double (Float64) to the Message.
  880 + * @param name Name of the field to add (or add to)
  881 + * @param value The Double (Float 64) to add
  882 + * @return success(One) on success, failure
  883 + */
  884 +public define Maybe(One)
  885 + add_double
  886 + (
  887 + Message msg,
  888 + String name,
  889 + Float value
  890 + )=
  891 + add_data(msg, name, b_double_t, b_double(value)).
  892 +
  893 + /** Adds a new Message to the Message.
  894 + * @param name Name of the field to add (or add to)
  895 + * @param value The Message to add
  896 + * @return success(One) on success, failure
  897 + */
  898 +public define Maybe(One)
  899 + add_message
  900 + (
  901 + Message msg,
  902 + String name,
  903 + Message value
  904 + )=
  905 + add_data(msg, name, b_message_t, b_message(value)).
  906 +
  907 + /** Adds a new B_Point to the Message.
  908 + * @param name Name of the field to add (or add to)
  909 + * @param value The B_Point to add
  910 + * @return success(One) on success, failure
  911 + */
  912 +public define Maybe(One)
  913 + add_point
  914 + (
  915 + Message msg,
  916 + String name,
  917 + B_Point value
  918 + )=
  919 + add_data(msg, name, b_point_t, b_point(value)).
  920 +
  921 + /** Adds a new B_Rect to the Message.
  922 + * @param name Name of the field to add (or add to)
  923 + * @param value The B_Rect to add
  924 + * @return success(One) on success, failure
  925 + */
  926 +public define Maybe(One)
  927 + add_rect
  928 + (
  929 + Message msg,
  930 + String name,
  931 + B_Rect value
  932 + )=
  933 + add_data(msg, name, b_rect_t, b_rect(value)).
  934 +
  935 + /** Adds a new ByteArray to the Message.
  936 + * @param name Name of the field to add (or add to)
  937 + * @param content The bytes array to add
  938 + * @return success(One) on success, failure
  939 + */
  940 +public define Maybe(One)
  941 + add_raw
  942 + (
  943 + Message msg,
  944 + String name,
  945 + ByteArray content
  946 + )=
  947 + add_data(msg, name, b_raw_t, b_raw(content)).
  948 +
  949 +
  950 +/********************** Find collection ********************/
  951 +
  952 + /** Retrieve a String value from the Message.
  953 + * @param msg Message where we search the String
718 954 * @param name The field name to look for the string value under.
719   - * @param index The index of the string item in its field entry.
720   - * @return 'success(String)' if the string value was found, or 'failure' if it wasn't.
  955 + * @param index The index of the String item in its field entry.
  956 + * @return 'success(String)' if the String value was found, or 'failure' if it wasn't.
721 957 */
722 958 public define Maybe(String)
723 959 find_string
... ... @@ -726,7 +962,7 @@ public define Maybe(String)
726 962 String name,
727 963 Int32 index
728 964 )=
729   - if find_data_type(b_string_t, msg, name, index) is success(mo) then
  965 + if find_data(b_string_t, msg, name, index) is success(mo) then
730 966 if mo is b_string(value) then
731 967 success(value)
732 968 else
... ... @@ -742,11 +978,11 @@ public define Maybe(String)
742 978 String name
743 979 )= find_string(msg, name, 0).
744 980  
745   - /** Retrieve an int8 value from the Message.
746   - * @param msg Message where we search the string
  981 + /** Retrieve an Int8 value from the Message.
  982 + * @param msg Message where we search the Int8
747 983 * @param name The field name to look for the int8 value under.
748   - * @param index The index of the int8 item in its field entry.
749   - * @return 'success(Int8)' if the int8 value was found, or 'failure' if it wasn't.
  984 + * @param index The index of the Int8 item in its field entry.
  985 + * @return 'success(Int8)' if the Int8 value was found, or 'failure' if it wasn't.
750 986 */
751 987 public define Maybe(Int8)
752 988 find_int8
... ... @@ -755,7 +991,7 @@ public define Maybe(Int8)
755 991 String name,
756 992 Int32 index
757 993 )=
758   - if find_data_type(b_int8_t, msg, name, index) is success(mo) then
  994 + if find_data(b_int8_t, msg, name, index) is success(mo) then
759 995 if mo is b_int8(value) then
760 996 success(value)
761 997 else
... ... @@ -771,11 +1007,11 @@ public define Maybe(Int8)
771 1007 String name
772 1008 )= find_int8(msg, name, 0).
773 1009  
774   - /** Retrieve an int16 value from the Message.
775   - * @param msg Message where we search the string
776   - * @param name The field name to look for the int16 value under.
777   - * @param index The index of the int16 item in its field entry.
778   - * @return 'success(Int16)' if the int16 value was found, or 'failure' if it wasn't.
  1010 + /** Retrieve an Int16 value from the Message.
  1011 + * @param msg Message where we search the Int16
  1012 + * @param name The field name to look for the Int16 value under.
  1013 + * @param index The index of the Int16 item in its field entry.
  1014 + * @return 'success(Int16)' if the Int16 value was found, or 'failure' if it wasn't.
779 1015 */
780 1016 public define Maybe(Int16)
781 1017 find_int16
... ... @@ -784,14 +1020,15 @@ public define Maybe(Int16)
784 1020 String name,
785 1021 Int32 index
786 1022 )=
787   - if find_data_type(b_int16_t, msg, name, index) is success(mo) then
  1023 + if find_data(b_int16_t, msg, name, index) is success(mo) then
788 1024 if mo is b_int16(value) then
789 1025 success(value)
790 1026 else
791 1027 failure
792 1028 else
793 1029 failure.
794   -
  1030 +
  1031 + /** As above, only (index) isn't specified. It is assumed to be zero. */
795 1032 public define Maybe(Int16)
796 1033 find_int16
797 1034 (
... ... @@ -799,11 +1036,11 @@ public define Maybe(Int16)
799 1036 String name
800 1037 )= find_int16(msg, name, 0).
801 1038  
802   - /** Retrieve an int32 value from the Message.
803   - * @param msg Message where we search the string
804   - * @param name The field name to look for the int32 value under.
805   - * @param index The index of the int32 item in its field entry.
806   - * @return 'success(Int32)' if the int32 value was found, or 'failure' if it wasn't.
  1039 + /** Retrieve an Int32 value from the Message.
  1040 + * @param msg Message where we search the Int32
  1041 + * @param name The field name to look for the Int32 value under.
  1042 + * @param index The index of the Int32 item in its field entry.
  1043 + * @return 'success(Int32)' if the Int32 value was found, or 'failure' if it wasn't.
807 1044 */
808 1045 public define Maybe(Int32)
809 1046 find_int32
... ... @@ -812,14 +1049,15 @@ public define Maybe(Int32)
812 1049 String name,
813 1050 Int32 index
814 1051 )=
815   - if find_data_type(b_int32_t, msg, name, index) is success(mo) then
  1052 + if find_data(b_int32_t, msg, name, index) is success(mo) then
816 1053 if mo is b_int32(value) then
817 1054 success(value)
818 1055 else
819 1056 failure
820 1057 else
821 1058 failure.
822   -
  1059 +
  1060 + /** As above, only (index) isn't specified. It is assumed to be zero. */
823 1061 public define Maybe(Int32)
824 1062 find_int32
825 1063 (
... ... @@ -827,11 +1065,11 @@ public define Maybe(Int32)
827 1065 String name
828 1066 )= find_int32(msg, name, 0).
829 1067  
830   - /** Retrieve an int64 value from the Message.
831   - * @param msg Message where we search the string
832   - * @param name The field name to look for the int64 value under.
833   - * @param index The index of the int64 item in its field entry.
834   - * @return 'success(Int64)' if the int16 value was found, or 'failure' if it wasn't.
  1068 + /** Retrieve an Int64 value from the Message.
  1069 + * @param msg Message where we search the Int64
  1070 + * @param name The field name to look for the Int64 value under.
  1071 + * @param index The index of the Int64 item in its field entry.
  1072 + * @return 'success(Int64)' if the Int64 value was found, or 'failure' if it wasn't.
835 1073 */
836 1074 public define Maybe(Int64)
837 1075 find_int64
... ... @@ -840,14 +1078,15 @@ public define Maybe(Int64)
840 1078 String name,
841 1079 Int32 index
842 1080 )=
843   - if find_data_type(b_int64_t, msg, name, index) is success(mo) then
  1081 + if find_data(b_int64_t, msg, name, index) is success(mo) then
844 1082 if mo is b_int64(value) then
845 1083 success(value)
846 1084 else
847 1085 failure
848 1086 else
849 1087 failure.
850   -
  1088 +
  1089 + /** As above, only (index) isn't specified. It is assumed to be zero. */
851 1090 public define Maybe(Int64)
852 1091 find_int64
853 1092 (
... ... @@ -856,7 +1095,7 @@ public define Maybe(Int64)
856 1095 )= find_int64(msg, name, 0).
857 1096  
858 1097 /** Retrieve an Bool value from the Message.
859   - * @param msg Message where we search the string
  1098 + * @param msg Message where we search the Bool
860 1099 * @param name The field name to look for the Bool value under.
861 1100 * @param index The index of the Bool item in its field entry.
862 1101 * @return 'success(Bool)' if the Bool value was found, or 'failure' if it wasn't.
... ... @@ -868,7 +1107,7 @@ public define Maybe(Bool)
868 1107 String name,
869 1108 Int32 index
870 1109 )=
871   - if find_data_type(b_bool_t, msg, name, index) is success(mo) then
  1110 + if find_data(b_bool_t, msg, name, index) is success(mo) then
872 1111 if mo is b_bool(value) then
873 1112 success(value)
874 1113 else
... ... @@ -876,6 +1115,7 @@ public define Maybe(Bool)
876 1115 else
877 1116 failure.
878 1117  
  1118 + /** As above, only (index) isn't specified. It is assumed to be zero. */
879 1119 public define Maybe(Bool)
880 1120 find_bool
881 1121 (
... ... @@ -896,7 +1136,7 @@ public define Maybe(Float32)
896 1136 String name,
897 1137 Int32 index
898 1138 )=
899   - if find_data_type(b_float_t, msg, name, index) is success(mo) then
  1139 + if find_data(b_float_t, msg, name, index) is success(mo) then
900 1140 if mo is b_float(value) then
901 1141 success(value)
902 1142 else
... ... @@ -904,6 +1144,7 @@ public define Maybe(Float32)
904 1144 else
905 1145 failure.
906 1146  
  1147 + /** As above, only (index) isn't specified. It is assumed to be zero. */
907 1148 public define Maybe(Float32)
908 1149 find_float32
909 1150 (
... ... @@ -924,7 +1165,7 @@ public define Maybe(Float)
924 1165 String name,
925 1166 Int32 index
926 1167 )=
927   - if find_data_type(b_double_t, msg, name, index) is success(mo) then
  1168 + if find_data(b_double_t, msg, name, index) is success(mo) then
928 1169 if mo is b_double(value) then
929 1170 success(value)
930 1171 else
... ... @@ -932,6 +1173,7 @@ public define Maybe(Float)
932 1173 else
933 1174 failure.
934 1175  
  1176 + /** As above, only (index) isn't specified. It is assumed to be zero. */
935 1177 public define Maybe(Float)
936 1178 find_float64
937 1179 (
... ... @@ -952,7 +1194,7 @@ public define Maybe(Message)
952 1194 String name,
953 1195 Int32 index
954 1196 )=
955   - if find_data_type(b_message_t, msg, name, index) is success(mo) then
  1197 + if find_data(b_message_t, msg, name, index) is success(mo) then
956 1198 if mo is b_message(value) then
957 1199 success(value)
958 1200 else
... ... @@ -960,6 +1202,7 @@ public define Maybe(Message)
960 1202 else
961 1203 failure.
962 1204  
  1205 + /** As above, only (index) isn't specified. It is assumed to be zero. */
963 1206 public define Maybe(Message)
964 1207 find_message
965 1208 (
... ... @@ -967,6 +1210,96 @@ public define Maybe(Message)
967 1210 String name
968 1211 )= find_message(msg, name, 0).
969 1212  
  1213 + /** Retrieve a B_Point from the Message.
  1214 + * @param msg Message where we search the Message
  1215 + * @param name The field name to look for the B_Point under.
  1216 + * @param index The index of the B_Point item in its field entry.
  1217 + * @return 'success(Message)' if the B_Point was found, or 'failure' if it wasn't.
  1218 + */
  1219 +public define Maybe(B_Point)
  1220 + find_point
  1221 + (
  1222 + Message msg,
  1223 + String name,
  1224 + Int32 index
  1225 + )=
  1226 + if find_data(b_point_t, msg, name, index) is success(mo) then
  1227 + if mo is b_point(value) then
  1228 + success(value)
  1229 + else
  1230 + failure
  1231 + else
  1232 + failure.
  1233 +
  1234 + /** As above, only (index) isn't specified. It is assumed to be zero. */
  1235 +public define Maybe(B_Point)
  1236 + find_point
  1237 + (
  1238 + Message msg,
  1239 + String name
  1240 + )= find_point(msg, name, 0).
  1241 +
  1242 + /** Retrieve a B_Rect from the Message.
  1243 + * @param msg Message where we search the Message
  1244 + * @param name The field name to look for the B_Rect under.
  1245 + * @param index The index of the B_Rect item in its field entry.
  1246 + * @return 'success(Message)' if the B_Rect was found, or 'failure' if it wasn't.
  1247 + */
  1248 +
  1249 +public define Maybe(B_Rect)
  1250 + find_rect
  1251 + (
  1252 + Message msg,
  1253 + String name,
  1254 + Int32 index
  1255 + )=
  1256 + if find_data(b_rect_t, msg, name, index) is success(mo) then
  1257 + if mo is b_rect(value) then
  1258 + success(value)
  1259 + else
  1260 + failure
  1261 + else
  1262 + failure.
  1263 +
  1264 + /** As above, only (index) isn't specified. It is assumed to be zero. */
  1265 +public define Maybe(B_Rect)
  1266 + find_rect
  1267 + (
  1268 + Message msg,
  1269 + String name
  1270 + )= find_rect(msg, name, 0).
  1271 +
  1272 + /** Retrieve a Raw (ByteArray) from the Message.
  1273 + * @param msg Message where we search the Message
  1274 + * @param name The field name to look for the Raw under.
  1275 + * @param index The index of the Raw item in its field entry.
  1276 + * @return 'success(Message)' if the B_Rect was found, or 'failure' if it wasn't.
  1277 + */
  1278 +
  1279 +public define Maybe(ByteArray)
  1280 + find_raw
  1281 + (
  1282 + Message msg,
  1283 + String name,
  1284 + Int32 index
  1285 + )=
  1286 + if find_data(b_raw_t, msg, name, index) is success(mo) then
  1287 + if mo is b_raw(value) then
  1288 + success(value)
  1289 + else
  1290 + failure
  1291 + else
  1292 + failure.
  1293 +
  1294 + /** As above, only (index) isn't specified. It is assumed to be zero. */
  1295 +public define Maybe(ByteArray)
  1296 + find_raw
  1297 + (
  1298 + Message msg,
  1299 + String name
  1300 + )= find_raw(msg, name, 0).
  1301 +
  1302 +
970 1303 /********************** TESTING SERVER *************************/
971 1304  
972 1305 define One
... ... @@ -1055,7 +1388,8 @@ global define One
1055 1388 {
1056 1389 failure then print("Can't find message \"message\" \n"),
1057 1390 success(sub_message) then
1058   - if find_string(sub_message, "string") is
  1391 + forget(add_string(sub_message, "toto", "tata"));
  1392 + if find_string(sub_message, "toto") is
1059 1393 {
1060 1394 failure then print("can't find string \"string\" \n"),
1061 1395 success(the_string) then print("the string found is [" + the_string + "] \n")
... ...