Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Diff iso #121

Open
wants to merge 45 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
f4974d4
first commit
y-tsune Jun 15, 2018
17e8a6b
add convertedgraph.hpp
y-tsune Jun 16, 2018
73d4af4
add convertedgraph constructer
y-tsune Jun 16, 2018
08fb301
fix constructer
y-tsune Jun 16, 2018
5574d99
add convert_atoms
y-tsune Jun 16, 2018
6a21248
update convert_atom
y-tsune Jun 16, 2018
3f3dfdf
fix convert_atom
y-tsune Jun 16, 2018
d354ca7
add convertlink
y-tsune Jun 16, 2018
79d659c
add debug print of converted atoms
y-tsune Jun 18, 2018
64fe094
add convertedgraph.hpp
y-tsune Jun 16, 2018
8779f87
add convertedgraph constructer
y-tsune Jun 16, 2018
0251d80
fix constructer
y-tsune Jun 16, 2018
ede4181
add convert_atoms
y-tsune Jun 16, 2018
eb6cee0
update convert_atom
y-tsune Jun 16, 2018
673ed41
add convertlink
y-tsune Jun 16, 2018
b8fb023
add debug print of converted atoms
y-tsune Jun 18, 2018
a45d774
merging
y-tsune Jun 18, 2018
8e477c7
add input and output of convertedgraph
y-tsune Jun 27, 2018
135d5e7
gen input and output
y-tsune Jun 28, 2018
ffdf46f
add print for diffiso input
y-tsune Jun 28, 2018
d12fcaf
add trie check
y-tsune Jul 2, 2018
834cb54
add GraphInfo and Json module
y-tsune Jul 3, 2018
4564b3e
add graph to json string functions
y-tsune Jul 3, 2018
4371678
add json_parse
y-tsune Jul 3, 2018
4dea5e9
add json.cpp
y-tsune Jul 4, 2018
e90731c
fix mem_to_json
y-tsune Jul 4, 2018
40025b6
add graphinfo.cpp
y-tsune Jul 5, 2018
0eb8d81
fix convertedgraph
y-tsune Jul 5, 2018
ef1be82
add makeDynamicArray
y-tsune Jul 5, 2018
34e5932
add LMNtalData and LMNtalLink
y-tsune Jul 5, 2018
dcb1601
add DynamicArray constructor
y-tsune Jul 5, 2018
91b306b
add ConvertedGraph
y-tsune Jul 5, 2018
bb25dc7
add convertedgraph dump test
y-tsune Jul 5, 2018
4f10a3c
change test case
y-tsune Jul 5, 2018
18ba2de
add test script
y-tsune Jul 5, 2018
92dbb98
add js_input case
y-tsune Jul 5, 2018
5f8e1e9
add DiffInfo
y-tsune Jul 6, 2018
e4943e6
add diffInfoDump
y-tsune Jul 6, 2018
7da00f1
add diff test
y-tsune Jul 11, 2018
f59a60e
gen grpahinfo in commit instruction
y-tsune Jul 18, 2018
ee1f253
pass converted graph check
y-tsune Jul 20, 2018
8c8b3af
update diffinfo test
y-tsune Jul 20, 2018
b2e299a
add debug print
y-tsune Jul 23, 2018
bc776fe
delete output dir
y-tsune Jul 23, 2018
83acdef
diff dump
y-tsune Oct 29, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix mem_to_json
  • Loading branch information
y-tsune committed Jul 4, 2018
commit e90731c9d2160b168baa72a72f31633b5982408a
84 changes: 81 additions & 3 deletions src/verifier/graphinfo.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,16 @@
#ifndef LMN_GRAPHINFO_HPP
#define LMN_GRAPHINFO_HPP
#include "convertedgraph.hpp"
// #include "jsonValueDump.h"
#include "json.hpp"
#include "lmntal.h"
#include "vm/atomlist.hpp"
#include "vm/vm.h"
#include <string>

namespace GraphInfo {
void jsonDump(json_value * jVal);
int globalrootmem_id(json_value *jVal);
std::string mem_to_json(LmnMembraneRef mem);
std::string atom_to_json(LmnSymbolAtomRef atom);
std::string link_to_json(LmnSymbolAtomRef atom, int index);
Expand All @@ -59,9 +62,11 @@ struct Graphinfo {

Graphinfo(LmnMembraneRef mem) {
std::string json = mem_to_json(mem);
json_val = json_parse(json.c_str(), json.size()+1);
json_val = json_parse(json.c_str(), json.size() + 1);
state_id = -1;
printf("%s:%d\n", __FUNCTION__, __LINE__);
jsonDump(json_val);
globalRootMemID = globalrootmem_id(json_val);
// printf("%s:%d\n", __FUNCTION__, __LINE__);
}
};

Expand Down Expand Up @@ -93,9 +98,23 @@ std::string mem_to_json(LmnMembraneRef mem) {
}));
}));
}
std::cout << s << std::endl;
s+="],";
s+="\"membranes\":[";
LmnMembraneRef m;
BOOL needs_comma = FALSE;
for (m = lmn_mem_child_head(mem); m; m = lmn_mem_next(m)) {
if (needs_comma)
s+=",";
needs_comma = TRUE;
s+=mem_to_json(m);
}
s+="]";
s+="}";
return s;
}
int globalrootmem_id(json_value *jVal) {
return jVal->u.object.values[0].value->u.integer;
}

std::string atom_to_json(LmnSymbolAtomRef atom) {
std::string s = "";
Expand Down Expand Up @@ -169,6 +188,65 @@ std::string link_to_json(LmnSymbolAtomRef atom, int index) {
s += "}";
return s;
}

void jsonDump(json_value * jVal){
//printf("jVal is %0llx\n",jVal);
//printf("jVal->type is %d\n",jVal->type);
//printf("\n");
setvbuf( stdout, NULL, _IONBF, BUFSIZ );

switch(jVal->type){
case json_none:
printf("NONE");
break;
case json_object:
printf("object:[");
if(jVal->u.object.length>0){
int i;
printf("<name:\"%s\",value:",jVal->u.object.values[0].name);
jsonDump(jVal->u.object.values[0].value);
printf(">");
for(i=1;i<jVal->u.object.length;i++){
printf(", ");
printf("<name:\"%s\",value:",jVal->u.object.values[i].name);
jsonDump(jVal->u.object.values[i].value);
printf(">");
}
}
printf("]");
break;
case json_array:
printf("array:[");
if(jVal->u.array.length > 0){
jsonDump(jVal->u.array.values[0]);
int i;
for(i=1;i<jVal->u.array.length;i++){
printf(", ");
jsonDump(jVal->u.array.values[i]);
}
}
printf("]");
break;
case json_integer:
printf("integer:%lld",jVal->u.integer);
break;
case json_double:
printf("double:%f",jVal->u.dbl);
break;
case json_string:
printf("string:\"%s\"",jVal->u.string.ptr);
break;
case json_boolean:
printf("boolean:%s",jVal->u.boolean ? "TRUE" : "FALSE");
break;
case json_null:
printf("NULL");
break;
default:
break;
}
}

} // namespace GraphInfo

#endif
6 changes: 6 additions & 0 deletions src/verifier/json.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,7 @@ json_value * json_parse_ex (json_settings * settings,
size_t length,
char * error_buf)
{
printf("json=%s\n", json);
json_char error [json_error_max];
unsigned int cur_line;
const json_char * cur_line_begin, * i, * end;
Expand Down Expand Up @@ -247,6 +248,7 @@ json_value * json_parse_ex (json_settings * settings,

for (state.first_pass = 1; state.first_pass >= 0; -- state.first_pass)
{

json_uchar uchar;
unsigned char uc_b1, uc_b2, uc_b3, uc_b4;
json_char * string = 0;
Expand Down Expand Up @@ -775,6 +777,7 @@ json_value * json_parse_ex (json_settings * settings,
alloc = root;
}


return root;

e_unknown_value:
Expand Down Expand Up @@ -820,6 +823,9 @@ json_value * json_parse_ex (json_settings * settings,

json_value * json_parse (const json_char * json, size_t length)
{
// printf("%s:%d\n", __FUNCTION__, __LINE__);
// printf("json=%s\n", json);
// printf("length=%d\n", length);
json_settings settings = { 0 };
return json_parse_ex (&settings, json, length, 0);
}
Expand Down