Skip to content

Commit

Permalink
enable preencode by default for savejson and saveubjson
Browse files Browse the repository at this point in the history
  • Loading branch information
fangq committed Oct 22, 2019
1 parent 0f870c0 commit 650b5ec
Show file tree
Hide file tree
Showing 8 changed files with 70 additions and 67 deletions.
6 changes: 3 additions & 3 deletions examples/jsonlab_basictest.matlab
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ ans =

[
"a",
1,
true,
[
[2],
[3]
Expand Down Expand Up @@ -1242,6 +1242,7 @@ ans =
"Names",
"Age"
],
"_TableRows_": [],
"_TableRecords_": [
[
"Andy",
Expand All @@ -1255,8 +1256,7 @@ ans =
"Om",
22
]
],
"_TableRows_": []
]
}
}

Expand Down
4 changes: 2 additions & 2 deletions examples/jsonlab_selftest.matlab
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@
>> >> ===============================================
>> example1.json
{Udata{U firstNameSUJohnUlastNameSUSmithUageiUaddress{UstreetAddressSU21 2nd StreetUcitySUNew YorkUstateSUNYU
{Udata{U firstNameSUJohnUlastNameSUSmithUageUUaddress{UstreetAddressSU21 2nd StreetUcitySUNew YorkUstateSUNYU
postalCodeSU10021}U phoneNumber[{UtypeSUhomeUnumberSU 212 555-1234}{UtypeSUfaxUnumberSU 646 555-4567}]}}
===============================================
>> example2.json
Expand All @@ -150,5 +150,5 @@ GlossEntry{UIDSUSGMLUSortAsSUSGMLU GlossTermSU$Standard Generalized Markup L
CloseDoc()}]}}}}
===============================================
>> example4.json
{Udata[{Usample{Urhoi}}{Usample{Urhoi}}[[$i#U[$i#U[$i#U][SUPaperSUScissorsSUStone][CaSUb\SUc"SUd\"SUe"[SUf\"[SUg[\SUh[\"]]}
{Udata[{Usample{UrhoU}}{Usample{UrhoU}}[[$U#U[$U#U[$U#U][SUPaperSUScissorsSUStone][CaSUb\SUc"SUd\"SUe"[SUf\"[SUg[\SUh[\"]]}
>>
Expand Down
70 changes: 29 additions & 41 deletions examples/jsonlab_ubjson_basictest.matlab
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ data2json =
>>
ans =

[$i#U
[$U#U

>>
json2data =
Expand All @@ -107,7 +107,7 @@ data2json =
>>
ans =

[$i#[$U#U
[$U#[$U#U

>>
json2data =
Expand Down Expand Up @@ -172,12 +172,12 @@ data2json =
>>
ans =

[CaT[$i#[$U#U]
[CaT[$U#[$U#U]

>>
json2data =

'a' [1] [2x1 int8]
'a' [1] [2x1 uint8]

>> >>
%=================================================
Expand All @@ -187,8 +187,8 @@ json2data =
>> >> >>
ans =

[[[ii iii!i)][iiiii#i+][iiiii%i-][iiiii'i/]][[ii
iii"i*][iiiii$i,][iiiii&i.][iiii i(i0]]]
[[[UU UUU!U)][UUUUU#U+][UUUUU%U-][UUUUU'U/]][[UU
UUU"U*][UUUUU$U,][UUUUU&U.][UUUU U(U0]]]

>>
json2data =
Expand All @@ -203,7 +203,7 @@ json2data =
>> >> >>
ans =

{U_ArrayType_SUdoubleU_ArraySize_[$U#UU_ArrayData_[$i#U0 !)#+%-'/
{U_ArrayType_SUdoubleU_ArraySize_[$U#UU_ArrayData_[$U#U0 !)#+%-'/
"* $,&. (0}

>>
Expand Down Expand Up @@ -250,7 +250,7 @@ json2data(:,:,6) =
>> >> >>
ans =

{U_ArrayType_SUdoubleU_ArraySize_[$U#UU_ArrayData_[$i#U0 !)#+%-'/
{U_ArrayType_SUdoubleU_ArraySize_[$U#UU_ArrayData_[$U#U0 !)#+%-'/
"* $,&. (0}
>>
Expand Down Expand Up @@ -297,8 +297,8 @@ json2data(:,:,3,2) =
>> >> >>
ans =
[[[ii][ii][ii][ii]][[i i
][ii][ii][ii]][[ii][ii][ii][ii]][[ii][ii][ii][ii ]][[i!i"][i#i$][i%i&][i'i(]][[i)i*][i+i,][i-i.][i/i0]]]
[[[UU][UU][UU][UU]][[U U
][UU][UU][UU]][[UU][UU][UU][UU]][[UU][UU][UU][UU ]][[U!U"][U#U$][U%U&][U'U(]][[U)U*][U+U,][U-U.][U/U0]]]

>> >>
%=================================================
Expand All @@ -308,7 +308,7 @@ ans =
>> >> >>
ans =

{U_ArrayType_SUdoubleU_ArraySize_[$U#UU_ArrayData_[$i#U0
{U_ArrayType_SUdoubleU_ArraySize_[$U#UU_ArrayData_[$U#U0
 !"#$%&'()*+,-./0}

>> >>
Expand All @@ -324,7 +324,7 @@ data2json =
>>
ans =

{U_ArrayType_SUdoubleU_ArraySize_[$U#UU_ArrayIsComplex_TU_ArrayData_[$i#[$U#U}
{U_ArrayType_SUdoubleU_ArraySize_[$U#UU_ArrayIsComplex_TU_ArrayData_[$U#[$U#U}

>>
json2data =
Expand All @@ -349,7 +349,7 @@ data2json =
>>
ans =

{U_ArrayType_SUdoubleU_ArraySize_[$U#UU_ArrayIsComplex_TU_ArrayData_[$i#[$U#U#
{U_ArrayType_SUdoubleU_ArraySize_[$U#UU_ArrayIsComplex_TU_ArrayData_[$U#[$U#U#
! "$ }

>>
Expand Down Expand Up @@ -405,13 +405,7 @@ ans =

{Usparse{U _ArrayType_SUdoubleU _ArraySize_[$U#U

U_ArrayIsSparse_TU _ArrayData_[[$i#U  


[$i#U 


[$D#U ?äûÓë12?è?h:öl;?ë,8Ù±?çǽ½æ'#?Ù?[`o€?å¸2ɘNé?¢HÍpà?íãEι¶P?äù¬Ä² ¶]}}
U_ArrayIsSparse_TU _ArrayData_[$D#[$U#U ?ð @ ?äûÓë12@" @ ?è?h:öl;@ @ ?ë,8Ù±@$ @ ?çǽ½æ'#@$ @ ?Ù?[`o€@ @" ?å¸2ɘNé@ @$ ?¢HÍpà@ @$ ?íãEι¶P@$ @$ ?äù¬Ä² ¶}}

>>
json2data =
Expand Down Expand Up @@ -441,13 +435,7 @@ ans =

{Ucomplex_sparse{U _ArrayType_SUdoubleU _ArraySize_[$U#U

U_ArrayIsComplex_TU_ArrayIsSparse_TU _ArrayData_[[$i#U  


[$i#U 


[$D#U ?äûÓë12?è?h:öl;?ë,8Ù±?çǽ½æ'#?Ù?[`o€?å¸2ɘNé?¢HÍpà?íãEι¶P?äù¬Ä² ¶[$D#U ¿äûÓë12¿è?h:öl;¿ë,8Ù±¿çǽ½æ'#¿Ù?[`o€¿å¸2ɘNé¿¢HÍpà¿íãEι¶P¿äù¬Ä² ¶]}}
U_ArrayIsComplex_TU_ArrayIsSparse_TU _ArrayData_[$D#[$U#U ?ð @ ?äûÓë12¿äûÓë12@" @ ?è?h:öl;¿è?h:öl;@ @ ?ë,8Ù±¿ë,8Ù±@$ @ ?çǽ½æ'#¿çǽ½æ'#@$ @ ?Ù?[`o€¿Ù?[`o€@ @" ?å¸2ɘNé¿å¸2ɘNé@ @$ ?¢HÍpà¿¢HÍpà@ @$ ?íãEι¶P¿íãEι¶P@$ @$ ?äù¬Ä² ¶¿äù¬Ä² ¶}}

>>
json2data =
Expand All @@ -462,7 +450,7 @@ json2data =
>> >> >>
ans =

{Uall_zero_sparse{U_ArrayType_SUdoubleU_ArraySize_[$U#UU_ArrayIsSparse_TU_ArrayData_[ZZZ]}}
{Uall_zero_sparse{U_ArrayType_SUdoubleU_ArraySize_[$U#UU_ArrayIsSparse_TU_ArrayData_Z}}

>>
json2data =
Expand Down Expand Up @@ -522,7 +510,7 @@ json2data =
>> >> >>
ans =

{Usparse_column_vector{U_ArrayType_SUdoubleU_ArraySize_[$U#UU_ArrayIsSparse_TU_ArrayData_[[$i#U[$i#U]}}
{Usparse_column_vector{U_ArrayType_SUdoubleU_ArraySize_[$U#UU_ArrayIsSparse_TU_ArrayData_[$U#[$U#U}}

>>
json2data =
Expand All @@ -537,7 +525,7 @@ json2data =
>> >> >>
ans =

{Ucomplex_sparse_column_vector{U_ArrayType_SUdoubleU_ArraySize_[$U#UU_ArrayIsComplex_TU_ArrayIsSparse_TU_ArrayData_[[$i#U[$i#U[$i#Uýÿü]}}
{Ucomplex_sparse_column_vector{U_ArrayType_SUdoubleU_ArraySize_[$U#UU_ArrayIsComplex_TU_ArrayIsSparse_TU_ArrayData_[$i#[$U#Uýÿü}}

>>
json2data =
Expand All @@ -552,7 +540,7 @@ json2data =
>> >> >>
ans =

{Usparse_row_vector{U_ArrayType_SUdoubleU_ArraySize_[$U#UU_ArrayIsSparse_TU_ArrayData_[[$i#U[$i#U]}}
{Usparse_row_vector{U_ArrayType_SUdoubleU_ArraySize_[$U#UU_ArrayIsSparse_TU_ArrayData_[$U#[$U#U}}

>>
json2data =
Expand All @@ -567,7 +555,7 @@ json2data =
>> >> >>
ans =

{Ucomplex_sparse_row_vector{U_ArrayType_SUdoubleU_ArraySize_[$U#UU_ArrayIsComplex_TU_ArrayIsSparse_TU_ArrayData_[[$i#U[$i#U[$i#Uýÿü]}}
{Ucomplex_sparse_row_vector{U_ArrayType_SUdoubleU_ArraySize_[$U#UU_ArrayIsComplex_TU_ArrayIsSparse_TU_ArrayData_[$i#[$U#Uýÿü}}

>>
json2data =
Expand All @@ -591,7 +579,7 @@ data2json =
>>
ans =

{Uastruct{UnameSUThink DifferentUyearIÍUmagic[$i#[$U#U Umisfits[$D#Uð ÿø Uembedded{UleftTUrightF}}}
{Uastruct{UnameSUThink DifferentUyearIÍUmagic[$U#[$U#U Umisfits[$D#Uð ÿø Uembedded{UleftTUrightF}}}

>>
json2data =
Expand All @@ -611,7 +599,7 @@ logical
>> >> >> >> >>
ans =

{USupreme Commander[{UnameSUNexus PrimeUranki }{UnameSUSentinel PrimeUranki }{UnameSUOptimus PrimeUranki }]}
{USupreme Commander[{UnameSUNexus PrimeUrankU }{UnameSUSentinel PrimeUrankU }{UnameSUOptimus PrimeUrankU }]}

>>
json2data =
Expand All @@ -633,7 +621,7 @@ data2json =
>>
ans =

{Udebian[[{UbuzzD?ñ™™™™™šUrexD?ó333333UboD?ôÌÌÌÌÌÍUhammiUslinkD@ ÌÌÌÌÌÍUpotatoD@™™™™™šUwoodyiUsargeD@ÌÌÌÌÌÍUetchiUlennyiUsqueezeiUwheezyi}{UUbuntu[SUKubuntuSUXubuntuSULubuntu]}[$D#U@$záG®@$333333@&záG®@&333333]]}
{Udebian[[{UbuzzD?ñ™™™™™šUrexD?ó333333UboD?ôÌÌÌÌÌÍUhammUUslinkD@ ÌÌÌÌÌÍUpotatoD@™™™™™šUwoodyUUsargeD@ÌÌÌÌÌÍUetchUUlennyUUsqueezeUUwheezyU}{UUbuntu[SUKubuntuSUXubuntuSULubuntu]}[$D#U@$záG®@$333333@&záG®@&333333]]}

>>
json2data =
Expand All @@ -651,7 +639,7 @@ json2data =
ValidName: 1
x0x5F_InvalidName: 2
x0x3A_Field_0x3A_: 3
x0xEFBFBD__0xEFBFBD_: '绝密'
x0xE9A1B9__0xE79BAE_: '绝密'

>> >>
%=================================================
Expand Down Expand Up @@ -681,7 +669,7 @@ json2data =
>> >> >>
ans =

{U data2json[[[[i][[i][i]]][[i][i]][[i]]][[[i]][[i][i ]][[i
{U data2json[[[[U][[U][U]]][[U][U]][[U]]][[[U]][[U][U ]][[U
]]]]}

>>
Expand All @@ -705,7 +693,7 @@ data2json =
>> >>
ans =

{U data2json[[{UidxiUdataSUstructs}{UidxiUdataSUstructs}][{UidxiUdataSUstructs}{UidxiUdataSUstructs}][{UidxiUdataSUstructs}{UidxiUdataSUstructs}]]}
{U data2json[[{UidxUUdataSUstructs}{UidxUUdataSUstructs}][{UidxUUdataSUstructs}{UidxUUdataSUstructs}][{UidxUUdataSUstructs}{UidxUUdataSUstructs}]]}

>>
json2data =
Expand All @@ -725,7 +713,7 @@ data2json =

ans =

[{UFormatSUdd-MMM-uuuuUTimeZoneSU UYearIßUMonthiUDayiUHouri UMinutei USecondi USystemTimeZoneSUAmerica/New_York}{UFormatSUdd-MMM-uuuuUTimeZoneSU UYearIßUMonthiUDayi UHouri UMinutei USecondi USystemTimeZoneSUAmerica/New_York}]
[{UFormatSUdd-MMM-uuuuUTimeZoneSU UYearIßUMonthUUDayUUHourU UMinuteU USecondU USystemTimeZoneSUAmerica/New_York}{UFormatSUdd-MMM-uuuuUTimeZoneSU UYearIßUMonthUUDayU UHourU UMinuteU USecondU USystemTimeZoneSUAmerica/New_York}]


json2data =
Expand All @@ -749,7 +737,7 @@ data2json =

ans =

{UAndyiUOmiUWilliami}
{UAndyUUOmUUWilliamU}


json2data =
Expand All @@ -776,7 +764,7 @@ data2json =

ans =

{Utable{U_TableCols_[SUNamesSUAge]U_TableRecords_[[SUAndy[i]][SUWilliam[i]][SUOm[i]]]U_TableRows_Z}}
{Utable{U_TableCols_[SUNamesSUAge]U_TableRows_ZU_TableRecords_[[SUAndy[U]][SUWilliam[U]][SUOm[U]]]}}


json2data =
Expand Down
2 changes: 1 addition & 1 deletion fast_match_bracket.m
Original file line number Diff line number Diff line change
Expand Up @@ -56,4 +56,4 @@
flag=cumsum(count==brackets(1))-cumsum(count==brackets(2))+1;
endpos = find(flag==0,1);
maxlevel=max([1,max(flag(1:endpos))]);
endpos = pos(endpos + startpos-1);
endpos = pos(endpos + startpos-1);
Loading

0 comments on commit 650b5ec

Please sign in to comment.