gensequences (935205e2307611615ed5a7fe0a32b225ffd8c19c) | gensequences (8dcd2ed3c92d5fcaca7da3d2669b7ed3bd510ac9) |
---|---|
1#!/usr/bin/awk -f 2 3#- 4# Copyright (c) 2008-2009 Ed Schouten <ed@FreeBSD.org> 5# All rights reserved. 6# 7# Redistribution and use in source and binary forms, with or without 8# modification, are permitted provided that the following conditions --- 21 unchanged lines hidden (view full) --- 30function die(msg) { 31 print msg; 32 exit 1; 33} 34 35function cchar(str) { 36 if (str == "^[") 37 return "\\x1B"; | 1#!/usr/bin/awk -f 2 3#- 4# Copyright (c) 2008-2009 Ed Schouten <ed@FreeBSD.org> 5# All rights reserved. 6# 7# Redistribution and use in source and binary forms, with or without 8# modification, are permitted provided that the following conditions --- 21 unchanged lines hidden (view full) --- 30function die(msg) { 31 print msg; 32 exit 1; 33} 34 35function cchar(str) { 36 if (str == "^[") 37 return "\\x1B"; |
38 if (str == "SP") 39 return " "; |
|
38 39 return str; 40} 41 | 40 41 return str; 42} 43 |
44function csequence(str) { 45 if (str == "SP") 46 return " "; 47 48 return str; 49} 50 |
|
42BEGIN { 43FS = "\t+" 44 45while (getline > 0) { 46 if (NF == 0 || $1 ~ /^#/) 47 continue; 48 49 if (NF != 3 && NF != 4) 50 die("Invalid line layout: " NF " columns"); 51 52 split($3, sequence, " +"); 53 nsequences = 0; 54 for (s in sequence) 55 nsequences++; 56 57 prefix = ""; 58 l_prefix_name[""] = "teken_state_init"; 59 for (i = 1; i < nsequences; i++) { | 51BEGIN { 52FS = "\t+" 53 54while (getline > 0) { 55 if (NF == 0 || $1 ~ /^#/) 56 continue; 57 58 if (NF != 3 && NF != 4) 59 die("Invalid line layout: " NF " columns"); 60 61 split($3, sequence, " +"); 62 nsequences = 0; 63 for (s in sequence) 64 nsequences++; 65 66 prefix = ""; 67 l_prefix_name[""] = "teken_state_init"; 68 for (i = 1; i < nsequences; i++) { |
60 n = prefix sequence[i]; | 69 n = prefix csequence(sequence[i]); |
61 l_prefix_parent[n] = prefix; 62 l_prefix_suffix[n] = sequence[i]; 63 if (!l_prefix_name[n]) 64 l_prefix_name[n] = "teken_state_" ++npr; 65 prefix = n; 66 } 67 68 suffix = sequence[nsequences]; --- 89 unchanged lines hidden --- | 70 l_prefix_parent[n] = prefix; 71 l_prefix_suffix[n] = sequence[i]; 72 if (!l_prefix_name[n]) 73 l_prefix_name[n] = "teken_state_" ++npr; 74 prefix = n; 75 } 76 77 suffix = sequence[nsequences]; --- 89 unchanged lines hidden --- |