Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source
Source file duplicate.ml
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140(**************************************************************************)(* *)(* Copyright (C) Johannes Kanig, Stephane Lescuyer *)(* Jean-Christophe Filliatre, Romain Bardou and Francois Bobot *)(* *)(* This software is free software; you can redistribute it and/or *)(* modify it under the terms of the GNU Library General Public *)(* License version 2.1, with the special exception on linking *)(* described in file LICENSE. *)(* *)(* This software is distributed in the hope that it will be useful, *)(* but WITHOUT ANY WARRANTY; without even the implied warranty of *)(* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *)(* *)(**************************************************************************)openTypesopenHashcons(* A duplicate analysis - find out the number of times a node is used *)moduleMetaPath=structtypet=metapath_nodehash_consedletequal=(==)lethashx=x.hkeyendmodulePath=structtypet=path_nodehash_consedletequal=(==)lethashx=x.hkeyendmodulePicture=structtypet=picture_nodehash_consedletequal=(==)lethashx=x.hkeyendmoduleMPthM=Hashtbl.Make(MetaPath)modulePthM=Hashtbl.Make(Path)modulePicM=Hashtbl.Make(Picture)letpath_map=PthM.create257letpicture_map=PicM.create257lettest_and_incr_pathn=tryincr(PthM.findpath_mapn);truewithNot_found->PthM.addpath_mapn(ref1);falselettest_and_incr_picn=tryincr(PicM.findpicture_mapn);truewithNot_found->PicM.addpicture_mapn(ref1);falseletoption_countf=functionNone->()|Somex->fxletrecmetapathp=matchp.Hashcons.nodewith|MPAConcat(_,_,p)->metapathp|MPAAppend(p1,_,p2)->metapathp1;metapathp2|MPAKnot_->()|MPAofPAp->pathpandpath'=function|PAofMPAp->metapathp|MPACycle(_,_,p)->metapathp|PATransformed(p,_)->pathp|PACutAfter(p1,p2)|PACutBefore(p1,p2)->pathp1;pathp2|PABuildCyclepl->List.iterpathpl|PASub(_,_,p)->pathp|PABBoxp->commandpicp|PAUnitSquare|PAQuarterCircle|PAHalfCircle|PAFullCircle->()andpathp=(* Format.printf "%a@." Print.path p; *)iftest_and_incr_pathpthen()elsepath'p.nodeandpicture'=function|PITransformed(p,_)->commandpicp|PITex_->()|PIClip(pic,pth)->commandpicpic;pathpthandpicturep=iftest_and_incr_picpthen()elsepicture'p.nodeandcommandc=matchc.nodewith|CDraw(p,b)->pathp;brushb|CFill(p,_)->pathp|CDotLabel(pic,_,_)->commandpicpic|CLabel(pic,_,_)->commandpicpic|CExternalImage_->()andbrushb=letb=b.Hashcons.nodeinoption_countpenb.pen;option_countdashb.dashandpenp=matchp.Hashcons.nodewith|PenCircle|PenSquare->()|PenFromPathp->pathp|PenTransformed(p,_)->penpanddashd=matchd.Hashcons.nodewith|DEvenly|DWithdots->()|DScaled(_,d)->dashd|DShifted(_,d)->dashd|DPatternl->List.iterdash_patternlanddash_pattern_=()andcommandpicp=matchp.nodewith|Picturep->picturep|Commandc->commandc|Seql->List.itercommandpicl