gen_dash_array/5
gen_dash_array ([],_ ,_ ) --> ['100000' ]. % add a large gap at end, so that we have an even number of numbers gen_dash_array ([H |T ],PrevDash ,Span ) --> {get_number(H ,Next ,Span ), Delta is Next - PrevDash }, [Delta ], % there is a delta empty dash stroke since the last solid dash [' ' ], {scan_for_next(T ,Next ,Span ,NewT ,NH1 ), Delta2 is NH1-Next }, [Delta2 ], % there is a dash of length delta2 in the set [' ' ], gen_dash_array (NewT ,NH1 ,Span ).
gen_polygon/6
gen_polygon ([],_ ,_ ,_ ) --> []. gen_polygon ([TickMark |T ],XMultiplier ,H ,Span ) --> {get_number(TickMark ,TM ,Span ), XTick is TM *XMultiplier}, [XTick ], [',0 ' ], [XTick ], [','], [H], [' ' ], {scan_for_next(T ,TM ,Span ,TR ,TM1 ), XTickNxt is TM1 *XMultiplier}, [XTickNxt ], [','], [H], [' ' ], [XTickNxt ], [',0 ' ], gen_polygon (TR ,XMultiplier ,H ,Span ).
gen_ticks/6
gen_ticks ([],_ ,_ ,_ ) --> []. gen_ticks ([TickMark |T ],XMultiplier ,H2 ,Span ) --> {get_number(TickMark ,TM ,Span ), XTick is TM *XMultiplier}, [XTick ], [',0 ' ], [XTick ], [','], [H2], [' ' ], [XTick ], [',-'], [H2 ], [' ' ], [XTick ], [',0 ' ], gen_ticks (T ,XMultiplier ,H2 ,Span ).
get_number/3
Block: get_number(-,?,?)
get_number (int (I ),Res ,_ ) :- !, Res =I. get_number (Term ,Res ,_ ) :- is_real (Term ,Real ),!,Res =Real. get_number (Nr ,Res ,_ ) :- number (Nr ),!, Res =Nr. % convenience function for internal use in this module get_number (Term ,_ ,Span ) :- add_error (get_number ,'Illegal value for external function, is not a number:' ,Term ,Span ),fail .
get_pair/4
get_pair ((int (_ ),(V1 ,V2 )),V1 ,V2 ,_ ) :- !. % the predicate works with sequence of pairs get_pair ((V1 ,V2 ),V1 ,V2 ,_ ) :- !. % or with a set of pairs get_pair (Pair ,_ ,_ ,Span ) :- add_error (svg_dasharray_for_intervals ,'Element is not a pair:' ,Pair ,Span ),fail .
scan_for_next/5
scan_for_next ([Nxt |T ],XTick ,Span ,Res ,XTickNxt ) :- get_number (Nxt ,XTick1 ,Span ), XTick1 is XTick +1,!, scan_for_next (T ,XTick1 ,Span ,Res ,XTickNxt ). scan_for_next (List ,XTick ,_ ,List ,XTickNxt ) :- XTickNxt is XTick +1.
svg_axis/7
Block: svg_axis(-,?,?,?,?,?,?) svg_axis(?,-,?,?,?,?,?) svg_axis(?,?,-,?,?,?,?) svg_axis(?,?,?,-,?,?,?)
svg_axis (TickMarks ,XScale ,MaxX ,Height ,StrResult ,Span ,WF ) :- get_number (MaxX ,Max ,Span ), get_number (XScale ,XMultiplier ,Span ), get_number (Height ,H ,Span ), custom_explicit_sets :expand_custom_set_to_list_wf (TickMarks ,ESet ,Done ,'svg_axis' ,WF ), svg_axis_aux (Done ,ESet ,XMultiplier ,Max ,H ,StrResult ,Span ).
svg_axis_aux/7
Block: svg_axis_aux(-,?,?,?,?,?,?) svg_axis_aux(?,-,?,?,?,?,?) svg_axis_aux(?,?,-,?,?,?,?) svg_axis_aux(?,?,?,-,?,?,?) svg_axis_aux(?,?,?,?,-,?,?)
svg_axis_aux (_Done ,ESet ,XMultiplier ,Max ,H ,StrResult ,Span ) :- sort (ESet ,Sorted ), H2 is H / 2, Tail = [Max , ',0 ' ], gen_ticks (Sorted ,XMultiplier ,H2 ,Span ,List ,Tail ), ajoin (List ,ResStr ), StrResult = string (ResStr ).
svg_car/8
svg_car (Start ,Length ,XScale ,Slant ,Height ,StrResult ,Span ,_WF ) :- svg_vehicle (Start ,Length ,XScale ,Slant ,Height ,StrResult ,Span ,svg_car ).
svg_dasharray_for_intervals/4
Block: svg_dasharray_for_intervals(-,?,?,?)
svg_dasharray_for_intervals (Seq ,StrResult ,Span ,WF ) :- !, custom_explicit_sets :expand_custom_set_to_list_wf (Seq ,ESeq ,_Done ,'svg_dasharray_for_intervals' ,WF ), ground_value_check (ESeq ,Ground ), svg_intervals2str_aux (Ground ,ESeq ,StrResult ,Span ,WF ).
svg_intervals2str_aux/5
Block: svg_intervals2str_aux(-,?,?,?,?)
svg_intervals2str_aux (_Done ,ESeq ,StrResult ,Span ,_WF ) :- sort (ESeq ,Sorted ), translate_dasharray (Sorted ,Span ,List ,[]), ajoin (List ,ResStr ), StrResult = string (ResStr ).
svg_points/4
Block: svg_points(-,?,?,?)
svg_points (Seq ,StrResult ,Span ,WF ) :- !, custom_explicit_sets :expand_custom_set_to_list_wf (Seq ,ESeq ,_Done ,'svg_points' ,WF ), ground_value_check (ESeq ,Ground ), svg_points2str_aux (Ground ,ESeq ,StrResult ,Span ,WF ).
svg_points2str_aux/5
Block: svg_points2str_aux(-,?,?,?,?)
svg_points2str_aux (_Done ,ESeq ,StrResult ,Span ,_WF ) :- translate_b_pairs_list_for_svg (ESeq ,ResStr ,Span ), StrResult = string (ResStr ).
svg_set_dasharray/5
Block: svg_set_dasharray(-,?,?,?,?) svg_set_dasharray(?,-,?,?,?)
svg_set_dasharray (SetOfIntegers ,int (StartIndex ),StrResult ,Span ,WF ) :- custom_explicit_sets :expand_custom_set_to_list_wf (SetOfIntegers ,ESet ,Done ,'svg_set_dasharray' ,WF ), svg_set_dasharray_aux (Done ,ESet ,StartIndex ,StrResult ,Span ).
svg_set_dasharray_aux/5
Block: svg_set_dasharray_aux(-,?,?,?,?) svg_set_dasharray_aux(?,-,?,?,?)
svg_set_dasharray_aux (_ ,ESet ,StartIndex ,StrResult ,Span ) :- sort (ESet ,Sorted ), gen_dash_array (Sorted ,StartIndex ,Span ,List ,[]), ajoin (['0 ' |List ],ResStr ), % the first number in List is the length of a gap, dasharray starts with a dash StrResult = string (ResStr ).
svg_set_polygon/7
Block: svg_set_polygon(-,?,?,?,?,?,?) svg_set_polygon(?,-,?,?,?,?,?) svg_set_polygon(?,?,-,?,?,?,?) svg_set_polygon(?,?,?,-,?,?,?)
svg_set_polygon (TickMarks ,XScale ,MaxX ,Height ,StrResult ,Span ,WF ) :- (MaxX =auto -> Max =auto % do not add trailing line to maximum end point at right ; get_number (MaxX ,Max ,Span )), get_number (XScale ,XMultiplier ,Span ), get_number (Height ,H ,Span ), custom_explicit_sets :expand_custom_set_to_list_wf (TickMarks ,ESet ,Done ,'svg_set_polygon' ,WF ), svg_set_polygon_aux (Done ,ESet ,XMultiplier ,Max ,H ,StrResult ,Span ).
svg_set_polygon_auto/6
svg_set_polygon_auto (TickMarks ,XScale ,Height ,StrResult ,Span ,WF ) :- svg_set_polygon (TickMarks ,XScale ,auto ,Height ,StrResult ,Span ,WF ). % do not finish the polygon line to end
svg_set_polygon_aux/7
Block: svg_set_polygon_aux(-,?,?,?,?,?,?) svg_set_polygon_aux(?,-,?,?,?,?,?) svg_set_polygon_aux(?,?,-,?,?,?,?) svg_set_polygon_aux(?,?,?,-,?,?,?)
svg_set_polygon_aux (_Done ,ESet ,XMultiplier ,Max ,H ,StrResult ,Span ) :- sort (ESet ,Sorted ), (Max =auto -> Tail =[] ; Tail = [Max , ',0 ' ]), gen_polygon (Sorted ,XMultiplier ,H ,Span ,List ,Tail ), ajoin (List ,ResStr ), StrResult = string (ResStr ).
svg_train/8
svg_train (Start ,Length ,XScale ,Slant ,Height ,StrResult ,Span ,_WF ) :- svg_vehicle (Start ,Length ,XScale ,Slant ,Height ,StrResult ,Span ,svg_train ).
svg_vehicle/8
Block: svg_vehicle(-,?,?,?,?,?,?,?) svg_vehicle(?,-,?,?,?,?,?,?) svg_vehicle(?,?,-,?,?,?,?,?) svg_vehicle(?,?,?,-,?,?,?,?) svg_vehicle(?,?,?,?,-,?,?,?)
svg_vehicle (Start ,Length ,XScale ,Slant ,Height ,StrResult ,Span ,Vehicle ) :- get_number (Start ,St ,Span ), get_number (Length ,Len ,Span ), get_number (XScale ,XMultiplier ,Span ), get_number (Slant ,S ,Span ), get_number (Height ,H ,Span ), svg_vehicle_aux (Vehicle ,St ,Len ,XMultiplier ,S ,H ,StrResult ,Span ).
svg_vehicle_aux/8
Block: svg_vehicle_aux(?,-,?,?,?,?,?,?) svg_vehicle_aux(?,?,-,?,?,?,?,?) svg_vehicle_aux(?,?,?,-,?,?,?,?) svg_vehicle_aux(?,?,?,?,-,?,?,?) svg_vehicle_aux(?,?,?,?,?,-,?,?)
svg_vehicle_aux (svg_train ,St ,Len ,XMultiplier ,Slant ,Height ,StrResult ,Span ) :- X1 is St *XMultiplier, X2 is (St +Len)*XMultiplier, X2S is X2-Slant , translate_pairs ([(1,(X1 ,Height )), (2,(X2 ,Height )), (3,(X2S ,0)), (4,(X1 ,0)), (5,(X1 ,Height ))],Span ,List ,[]), ajoin (List ,ResStr ), StrResult = string (ResStr ). svg_vehicle_aux (svg_car ,St ,Len ,XMultiplier ,Slant ,Height ,StrResult ,Span ) :- X1 is St *XMultiplier, X2 is (St +Len)*XMultiplier, X2S is X2-Slant , X2SS is X2S-Slant , H2 is Height /2, translate_pairs ([(1,(X1 ,Height )), (2,(X2 ,Height )), (3, (X2 ,H2 )), (4,(X2S ,H2 )), (5,(X2SS ,0)), (6,(X1 ,0)), (7,(X1 ,Height ))],Span ,List ,[]), ajoin (List ,ResStr ), StrResult = string (ResStr ).
translate_dasharray/4
translate_dasharray ([],_ ) --> []. translate_dasharray ([Pair |T ],Span ) --> {get_pair(Pair ,V1 ,V2 ,Span )}, {get_number(V1 ,V1A ,Span )}, ({V1A =\= 0} -> ['0 ',V1A,' ' ] ; []), % if first number is /= 0 -> add 0 to avoid first number being interpreted as gap length {get_number(V2 ,V2A ,Span ), Diff is V2A - V1A }, [Diff ,' ' ], {Last is V1A + Diff }, translate_dasharray2 (T ,Last ,Span ).
translate_dasharray2/5
translate_dasharray2 ([],Last ,_ ) --> {Last < 100, LastLast is 100 - Last }, [LastLast ]. % fill dasharray to 100 with a gap translate_dasharray2 ([],Last ,_ ) --> {Last >= 100}, []. translate_dasharray2 ([Pair |T ],Last ,Span ) --> {get_pair(Pair ,V1 ,V2 ,Span )}, {get_number(V1 ,V1A ,Span ), get_number (V2 ,V2A ,Span ), (V1A =< Last -> (NextV1 = 0, NextV2 is V2A - Last ) ; (NextV1 is V1A - Last , NextV2 is V2A - V1A ))}, ({(V1A =< Last , V2A =< Last ) ; V2A =< V1A } -> ([], {NextLast is Last }) ; ([NextV1 ,' ',NextV2,' ' ], {NextLast is Last + NextV1 + NextV2 })), translate_dasharray2 (T ,NextLast ,Span ).
translate_pairs/4
translate_pairs ([],_ ) --> []. translate_pairs ([(_ ,(V1 ,V2 ))|T ],Span ) --> {get_number(V1 ,V1A ,Span )}, [V1A ], [',' ], {get_number(V2 ,V2A ,Span )}, [V2A ], [' ' ], translate_pairs (T ,Span ).
Determinacy Checker
Determinacy Checker: ! Existence error in argument 1 of absolute_file_name/3
! file probsrc(tools_strings) does not exist
! goal: absolute_file_name(probsrc(tools_strings),_261,[access(exist),file_type(source),relative_to('/builds/stups/prob/prolog_doc_gen/prolog-Doc/prob_prolog/src/extra/external_functions_svg.pl')])