Commit cfceca27 authored by Arjan Oortgiese's avatar Arjan Oortgiese

Updated copy_graph_to_string.c with version from SVN...

Updated copy_graph_to_string.c with version from SVN (https://svn.cs.ru.nl/repos/clean-libraries/trunk/Libraries/graph_copy/)
parent 64369427
...@@ -129,8 +129,10 @@ Int *copy_graph_to_string (Int *node_p,void *begin_free_heap,void *end_free_heap ...@@ -129,8 +129,10 @@ Int *copy_graph_to_string (Int *node_p,void *begin_free_heap,void *end_free_heap
} else if (desc==(Int)&__ARRAY__+2){ } else if (desc==(Int)&__ARRAY__+2){
Int array_size,elem_desc; Int array_size,elem_desc;
if (heap_p+2>(Int*)stack_begin) if (heap_p+2>(Int*)stack_begin){
*node_p=desc;
return NULL; return NULL;
}
array_size=node_p[1]; array_size=node_p[1];
elem_desc=node_p[2]; elem_desc=node_p[2];
...@@ -147,8 +149,10 @@ Int *copy_graph_to_string (Int *node_p,void *begin_free_heap,void *end_free_heap ...@@ -147,8 +149,10 @@ Int *copy_graph_to_string (Int *node_p,void *begin_free_heap,void *end_free_heap
if (elem_desc==0){ if (elem_desc==0){
stack_p-=array_size; stack_p-=array_size;
if (stack_p<stack_begin){ if (stack_p<stack_begin){
if ((Int*)stack_p<heap_p) if ((Int*)stack_p<heap_p){
node_p[-3]=desc;
return NULL; return NULL;
}
stack_begin=stack_p; stack_begin=stack_p;
} }
...@@ -198,8 +202,10 @@ Int *copy_graph_to_string (Int *node_p,void *begin_free_heap,void *end_free_heap ...@@ -198,8 +202,10 @@ Int *copy_graph_to_string (Int *node_p,void *begin_free_heap,void *end_free_heap
if (n_field_pointers==0){ if (n_field_pointers==0){
array_size*=field_size; array_size*=field_size;
if (heap_p+array_size>(Int*)stack_begin) if (heap_p+array_size>(Int*)stack_begin){
node_p[-3]=desc;
return NULL; return NULL;
}
copy (heap_p,node_p,array_size); copy (heap_p,node_p,array_size);
heap_p+=array_size; heap_p+=array_size;
...@@ -209,8 +215,10 @@ Int *copy_graph_to_string (Int *node_p,void *begin_free_heap,void *end_free_heap ...@@ -209,8 +215,10 @@ Int *copy_graph_to_string (Int *node_p,void *begin_free_heap,void *end_free_heap
stack_p-=array_size; stack_p-=array_size;
if (stack_p<stack_begin){ if (stack_p<stack_begin){
if ((Int*)stack_p<heap_p) if ((Int*)stack_p<heap_p){
node_p[-3]=desc;
return NULL; return NULL;
}
stack_begin=stack_p; stack_begin=stack_p;
} }
...@@ -224,13 +232,17 @@ Int *copy_graph_to_string (Int *node_p,void *begin_free_heap,void *end_free_heap ...@@ -224,13 +232,17 @@ Int *copy_graph_to_string (Int *node_p,void *begin_free_heap,void *end_free_heap
n_array_pointers=n_field_pointers*array_size; n_array_pointers=n_field_pointers*array_size;
n_array_non_pointers=n_non_field_pointers*array_size; n_array_non_pointers=n_non_field_pointers*array_size;
if (heap_p+n_array_non_pointers>(Int*)stack_begin) if (heap_p+n_array_non_pointers>(Int*)stack_begin){
node_p[-3]=desc;
return NULL; return NULL;
}
stack_p-=n_array_pointers; stack_p-=n_array_pointers;
if (stack_p<stack_begin){ if (stack_p<stack_begin){
if ((Int*)stack_p<heap_p+n_array_non_pointers) if ((Int*)stack_p<heap_p+n_array_non_pointers){
node_p[-3]=desc;
return NULL; return NULL;
}
stack_begin=stack_p; stack_begin=stack_p;
} }
...@@ -256,8 +268,10 @@ Int *copy_graph_to_string (Int *node_p,void *begin_free_heap,void *end_free_heap ...@@ -256,8 +268,10 @@ Int *copy_graph_to_string (Int *node_p,void *begin_free_heap,void *end_free_heap
continue; continue;
} else if (arity==2){ } else if (arity==2){
if (stack_p<=stack_begin){ if (stack_p<=stack_begin){
if ((Int*)stack_p<=heap_p) if ((Int*)stack_p<=heap_p){
*node_p=desc;
return NULL; return NULL;
}
--stack_begin; --stack_begin;
} }
...@@ -272,8 +286,10 @@ Int *copy_graph_to_string (Int *node_p,void *begin_free_heap,void *end_free_heap ...@@ -272,8 +286,10 @@ Int *copy_graph_to_string (Int *node_p,void *begin_free_heap,void *end_free_heap
stack_p-=n_words; stack_p-=n_words;
if (stack_p<stack_begin){ if (stack_p<stack_begin){
if ((Int*)stack_p<heap_p) if ((Int*)stack_p<heap_p){
*node_p=desc;
return NULL; return NULL;
}
stack_begin=stack_p; stack_begin=stack_p;
} }
...@@ -320,8 +336,10 @@ Int *copy_graph_to_string (Int *node_p,void *begin_free_heap,void *end_free_heap ...@@ -320,8 +336,10 @@ Int *copy_graph_to_string (Int *node_p,void *begin_free_heap,void *end_free_heap
*heap_p++=node_p[2]; *heap_p++=node_p[2];
} else { } else {
if (stack_p<=stack_begin){ if (stack_p<=stack_begin){
if ((Int*)stack_p<=heap_p) if ((Int*)stack_p<=heap_p){
*node_p=desc;
return NULL; return NULL;
}
--stack_begin; --stack_begin;
} }
...@@ -367,8 +385,10 @@ Int *copy_graph_to_string (Int *node_p,void *begin_free_heap,void *end_free_heap ...@@ -367,8 +385,10 @@ Int *copy_graph_to_string (Int *node_p,void *begin_free_heap,void *end_free_heap
if (n_pointers>0){ if (n_pointers>0){
stack_p-=n_pointers; stack_p-=n_pointers;
if (stack_p<stack_begin){ if (stack_p<stack_begin){
if ((Int*)stack_p<heap_p) if ((Int*)stack_p<heap_p){
*node_p=desc;
return NULL; return NULL;
}
stack_begin=stack_p; stack_begin=stack_p;
} }
...@@ -393,8 +413,10 @@ Int *copy_graph_to_string (Int *node_p,void *begin_free_heap,void *end_free_heap ...@@ -393,8 +413,10 @@ Int *copy_graph_to_string (Int *node_p,void *begin_free_heap,void *end_free_heap
stack_p-=n_words; stack_p-=n_words;
if (stack_p<stack_begin){ if (stack_p<stack_begin){
if ((Int*)stack_p<heap_p) if ((Int*)stack_p<heap_p){
*node_p=desc;
return NULL; return NULL;
}
stack_begin=stack_p; stack_begin=stack_p;
} }
...@@ -430,8 +452,10 @@ Int *copy_graph_to_string (Int *node_p,void *begin_free_heap,void *end_free_heap ...@@ -430,8 +452,10 @@ Int *copy_graph_to_string (Int *node_p,void *begin_free_heap,void *end_free_heap
stack_p-=n_pointers; stack_p-=n_pointers;
if (stack_p<stack_begin){ if (stack_p<stack_begin){
if ((Int*)stack_p<heap_p) if ((Int*)stack_p<heap_p){
*node_p=desc;
return NULL; return NULL;
}
stack_begin=stack_p; stack_begin=stack_p;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment