|
| 1 | +(****************************************************************************) |
| 2 | +(* The Diy toolsuite *) |
| 3 | +(* *) |
| 4 | +(* Jade Alglave, University College London, UK. *) |
| 5 | +(* Luc Maranget, INRIA Paris-Rocquencourt, France. *) |
| 6 | +(* *) |
| 7 | +(* Copyright 2023-present Institut National de Recherche en Informatique et *) |
| 8 | +(* en Automatique and the authors. All rights reserved. *) |
| 9 | +(* *) |
| 10 | +(* This software is governed by the CeCILL-B license under French law and *) |
| 11 | +(* abiding by the rules of distribution of free software. You can use, *) |
| 12 | +(* modify and/ or redistribute the software under the terms of the CeCILL-B *) |
| 13 | +(* license as circulated by CEA, CNRS and INRIA at the following URL *) |
| 14 | +(* "http://www.cecill.info". We also give a copy in LICENSE.txt. *) |
| 15 | +(****************************************************************************) |
| 16 | + |
| 17 | +(** Name handling for miaou and back *) |
| 18 | + |
| 19 | + |
| 20 | +let toalpha s = |
| 21 | + let buff = Buffer.create 10 in |
| 22 | + for k=0 to String.length s-1 do |
| 23 | + match s.[k] with |
| 24 | + | 'a'..'z'|'A'..'Z' as c -> |
| 25 | + Buffer.add_char buff c |
| 26 | + | _ -> () |
| 27 | + done ; |
| 28 | + Buffer.contents buff |
| 29 | + |
| 30 | +let vocabulary = |
| 31 | + StringMap.empty |
| 32 | + |> StringMap.add "dmb.full" "DMBFULL" |
| 33 | + |> StringMap.add "dmb.st" "DMBST" |
| 34 | + |> StringMap.add "dmb.ld" "DMBLD" |
| 35 | + |> StringMap.add "dsb.full" "DSBFULL" |
| 36 | + |> StringMap.add "dsb.st" "DSBST" |
| 37 | + |> StringMap.add "dsb.ld" "DSBLD" |
| 38 | + |> StringMap.add "iico_order" "iicoorder" |
| 39 | + |> StringMap.add "iico_data" "iicodata" |
| 40 | + |> StringMap.add "iico_ctrl" "iicoctrl" |
| 41 | + |> StringMap.add "iico_control" "iicoctrl" |
| 42 | + |> StringMap.add "hw-reqs" "hwreqs" |
| 43 | + |> StringMap.add "sca-class" "sca" |
| 44 | + |> StringMap.add "Instr-read-ordered-before" "Instrreadob" |
| 45 | + |> StringMap.add "L" "REL" |
| 46 | + |> StringMap.add "id" "sameEffect" |
| 47 | + |
| 48 | +let to_csname s = |
| 49 | + try StringMap.find s vocabulary |
| 50 | + with Not_found -> toalpha s |
0 commit comments