Warning: this is an htmlized version!
The original is here, and
the conversion rules are here.
-- This file:
--   http://anggtwu.net/LUA/Caepro2.lua.html
--   http://anggtwu.net/LUA/Caepro2.lua
--          (find-angg "LUA/Caepro2.lua")
-- Author: Eduardo Ochs <eduardoochs@gmail.com>
--
-- (defun c1 () (interactive) (find-angg "LUA/Caepro1.lua"))
-- (defun c2 () (interactive) (find-angg "LUA/Caepro2.lua"))
-- (defun c3 () (interactive) (find-angg "LUA/Caepro3.lua"))
-- (defun l1 () (interactive) (find-angg "LUA/LogsPdfizados1.lua"))
-- (find-angg ".emacs" "caepro2")

-- «.yys_to_letter»		(to "yys_to_letter")
-- «.yys_to_letter-tests»	(to "yys_to_letter-tests")
-- «.Jpg»			(to "Jpg")
-- «.Jpgs»			(to "Jpgs")
-- «.Jpgs-tests»		(to "Jpgs-tests")
-- «.Pdf»			(to "Pdf")
-- «.Pdfs»			(to "Pdfs")
-- «.Pdfs-tests»		(to "Pdfs-tests")
-- «.Bortolossi»		(to "Bortolossi")
-- «.Bortolossi-tests»		(to "Bortolossi-tests")
-- «.SaptSlides»		(to "SaptSlides")
-- «.SaptSlides-tests»		(to "SaptSlides-tests")
-- «.Html»			(to "Html")
-- «.Html-tests»		(to "Html-tests")
-- «.logs-pdfizados-tee»	(to "logs-pdfizados-tee")
-- «.LogPdf»			(to "LogPdf")
-- «.LogPdf-tests»		(to "LogPdf-tests")
-- «.LogPdf-cps»		(to "LogPdf-cps")
--
-- «.mletter_pdfzoes»		(to "mletter_pdfzoes")
-- «.mletter_quadros»		(to "mletter_quadros")
-- «.mletter_jpgs»		(to "mletter_jpgs")
-- «.mletter_tables_set»	(to "mletter_tables_set")
-- «.mletter_tables-tests»	(to "mletter_tables-tests")
-- «.mletter_tables-cp»		(to "mletter_tables-cp")
-- «.slow_html»			(to "slow_html")
--
-- «.Abbrev»			(to "Abbrev")
-- «.Abbrev-tests»		(to "Abbrev-tests")
-- «.AbbrevPlus»		(to "AbbrevPlus")
-- «.AbbrevPlus-tests»		(to "AbbrevPlus-tests")
-- «.errmeansnil»		(to "errmeansnil")
-- «.errmeansnil-tests»		(to "errmeansnil-tests")
-- «.args»			(to "args")
-- «.elisp»			(to "elisp")


--                     __   __    _      _   _            
--  _   _ _   _ ___   / /   \ \  | | ___| |_| |_ ___ _ __ 
-- | | | | | | / __| / /_____\ \ | |/ _ \ __| __/ _ \ '__|
-- | |_| | |_| \__ \ \ \_____/ / | |  __/ |_| ||  __/ |   
--  \__, |\__, |___/  \_\   /_/  |_|\___|\__|\__\___|_|   
--  |___/ |___/                                           
--
-- «yys_to_letter»  (to ".yys_to_letter")
yys_to_letter = VTable {
  ["991"] = "x",
  ["992"] = "y",
  ["201"] = "a",
  ["202"] = "b",
  ["211"] = "c",
  ["212"] = "d",
  ["221"] = "e",
  ["222"] = "f",
  ["231"] = "g",
}

letter_to_yys = VTable(transpose(yys_to_letter))

-- «yys_to_letter-tests»  (to ".yys_to_letter-tests")
--[[
* (eepitch-lua51)
* (eepitch-kill)
* (eepitch-lua51)
dofile "Caepro2.lua"
= letter_to_yys

--]]


--      _             
--     | |_ __   __ _ 
--  _  | | '_ \ / _` |
-- | |_| | |_) | (_| |
--  \___/| .__/ \__, |
--       |_|    |___/ 
--
-- «Jpg»  (to ".Jpg")
Jpg = Class {
  type = "Jpg",
  from = function (fname) return Jpg {fname=fname} end,
  __tostring = mytostringp,
  __index = {
    open_cmd = function (j) return "xzgv ~/"..j.fname end,
    open = function (j) getoutput(j:open_cmd()) end,
    url = function (j) return "http://anggtwu.net/"..j.fname end,
  },
}

-- «Jpgs»  (to ".Jpgs")
Jpgs = Class {
  type = "Jpgs",
  from = function (bigstr)
      local fnames = split(bigstr)
      local jpgs = map(Jpg.from, fnames)
      jpgs.bigstr = bigstr
      return Jpgs(jpgs)
    end,
  fromcmd = function (cmd)
      return Jpgs.from(getoutput(cmd))
    end,
  fromdir = function (dir, home)
      local cmd = format("cd %s; ls %s/*.jpg | sort", home or "~/", dir)
      return Jpgs.fromcmd(cmd)
    end,
  __tostring = function (js) return mytostringpv(js) end,
  __index = {
    jpg      = function (js, n) return js[n and n+0 or 1] end,
    fname    = function (js, n) return js:jpg(n).fname end,
    open_cmd = function (js, n) return js:jpg(n):open_cmd() end,
    open     = function (js, n) return js:jpg(n):open() end,
    url      = function (js, n) return js:jpg(n):url() end,
  },
}

-- «Jpgs-tests»  (to ".Jpgs-tests")
--[[
* (eepitch-lua51)
* (eepitch-kill)
* (eepitch-lua51)
dofile "Caepro2.lua"
-- (find-fline "~/2022.2-C2/")
-- (find-sh       "cd ~/; ls 2022.2-C2/*.jpg | sort")
js = Jpgs.fromcmd "cd ~/; ls 2022.2-C2/*.jpg | sort"
= js
js = Jpgs.fromdir "2022.2-C2"
= js
js = Jpgs.fromdir("2022.2-C2", "~/slow_html/")
= js
= js[3]
= js:open(3)
= js:open_cmd(3)
= js:url(3)

--]]


--  ____     _  __ 
-- |  _ \ __| |/ _|
-- | |_) / _` | |_ 
-- |  __/ (_| |  _|
-- |_|   \__,_|_|  
--                 
-- «Pdf»  (to ".Pdf")
Pdf = Class {
  type = "Pdf",
  from = function (fname, offset) return Pdf {fname=fname, offset=offset} end,
  __tostring = mytostringp,
  __index = {
    rp = function (p, pg) return (p.offset or 0)+(pg or 1) end,  -- real page
    open_cmd = function (p, pg) return "xpdf -fullscreen ~/"..p.fname.." "..p:rp(pg) end,
    open = function (p, pg) getoutput(p:open_cmd(pg)) end,
    url = function (p, pg) return "http://anggtwu.net/"..p.fname.."#page="..p:rp(pg) end,
  },
}

-- «Pdfs»  (to ".Pdfs")
Pdfs = Class {
  type = "Pdfs",
  from = function (bigstr)
      local fnames = split(bigstr)
      local pdfs = map(Pdf.from, fnames)
      pdfs.bigstr = bigstr
      return Pdfs(pdfs)
    end,
  fromcmd = function (cmd)
      return Pdfs.from(getoutput(cmd))
    end,
  --
  fromfmt = function (fmt)
      return Pdfs {fmt=fmt}
    end,
  --
  __tostring = mytostringpv,
  __index = {
    pdf = function (ps, n)
        if ps.fmt then return Pdf.from(format(ps.fmt, n)) end
        return ps[n]
      end,
    open_cmd = function (ps, n, pg) return ps:pdf(n):open_cmd(pg) end,
    open = function (ps, n, pg) return ps:pdf(n):open(pg) end,
    url = function (ps, n, pg) return ps:pdf(n):url(pg) end,
  },
}


-- «Pdfs-tests»  (to ".Pdfs-tests")
--[[
* (eepitch-lua52)
* (eepitch-kill)
* (eepitch-lua52)
dofile "Caepro2.lua"
p = Pdf.from "2022.2-C2/C2-quadros.pdf"
= p:url(4)
= p:open_cmd(4)
= p:open(4)

-- (find-sh       "cd ~/; ls 2021.1-C2/C2-E1*RCN-PURO*.pdf")
ps = Pdfs.fromcmd "cd ~/; ls 2021.1-C2/C2-E1*RCN-PURO*.pdf"
= ps
= ps[3]
= ps:pdf(3)
= ps:open(3, 4)
= ps:open_cmd(3, 4)
= ps:url(3, 4)

ps = Pdfs.fromfmt "logs-pdfizados/2021.1-C2-E1-%s.pdf"
= ps
= ps:pdf(2)
= ps:open(2, 4)
= ps:open_cmd(2, 4)
= ps:url(2, 4)

-- (find-fline "~/logs-pdfizados/")

--]]


-- «Bortolossi»  (to ".Bortolossi")
-- (find-books "__analysis/__analysis.el" "bortolossi")
Bortolossi = Pdfs {
   [3] = Pdf.from("2019.2-C3/Bortolossi/bortolossi-cap-3.pdf",   -78),
   [4] = Pdf.from("2019.2-C3/Bortolossi/bortolossi-cap-4.pdf",  -120),
   [5] = Pdf.from("2019.2-C3/Bortolossi/bortolossi-cap-5.pdf",  -162),
   [6] = Pdf.from("2019.2-C3/Bortolossi/bortolossi-cap-6.pdf",  -186),
   [7] = Pdf.from("2019.2-C3/Bortolossi/bortolossi-cap-7.pdf",  -238),
   [8] = Pdf.from("2019.2-C3/Bortolossi/bortolossi-cap-8.pdf",  -290),
  [10] = Pdf.from("2019.2-C3/Bortolossi/bortolossi-cap-10.pdf", -350),
  [11] = Pdf.from("2019.2-C3/Bortolossi/bortolossi-cap-11.pdf", -364),
  [12] = Pdf.from("2019.2-C3/Bortolossi/bortolossi-cap-12.pdf", -456),
}

-- «Bortolossi-tests»  (to ".Bortolossi-tests")
--[[
* (eepitch-lua51)
* (eepitch-kill)
* (eepitch-lua51)
dofile "Caepro2.lua"
= Bortolossi
Bortolossi:open( 3,  79)
Bortolossi:open( 4, 121)
Bortolossi:open( 5, 163)
Bortolossi:open( 6, 187)
Bortolossi:open( 7, 239)
Bortolossi:open( 8, 290)
Bortolossi:open(10, 351)
Bortolossi:open(11, 365)
Bortolossi:open(12, 457)

--]]


-- «SaptSlides»  (to ".SaptSlides")
SaptSlides = Pdf.from "LATEX/2021sobre-aulas-por-telegram.pdf"

-- «SaptSlides-tests»  (to ".SaptSlides-tests")
--[[
* (eepitch-lua51)
* (eepitch-kill)
* (eepitch-lua51)
dofile "Caepro2.lua"
SaptSlides:open(1)

--]]


--  _   _ _             _ 
-- | | | | |_ _ __ ___ | |
-- | |_| | __| '_ ` _ \| |
-- |  _  | |_| | | | | | |
-- |_| |_|\__|_| |_| |_|_|
--                        
-- «Html»  (to ".Html")
Html = Class {
  type    = "Html",
  from = function (stem) return Html {stem=stem} end,
  __tostring = mytostring,
  __index = {
    hasha = function (h,a) return a and "#"..a or "" end,
    htmla = function (h,a) return h.stem..".html"..h:hasha(a) end,
    open_cmd = function (h,a) return "google-chrome 'file:///home/edrx/TH/L/"..h:htmla(a).."'" end,
    open = function (h,a) getoutput(h:open_cmd(a)) end,
    url = function (h,a) return "http://anggtwu.net/"..h:htmla(a) end,
  },
}

-- «Html-tests»  (to ".Html-tests")
--[[
* (eepitch-lua51)
* (eepitch-kill)
* (eepitch-lua51)
dofile "Caepro2.lua"

sapt = Html.from "2021aulas-por-telegram"
= sapt:open_cmd()
= sapt:open_cmd "02:00"
= sapt:open()
= sapt:open "02:00"

--]]







-- «logs-pdfizados-tee»  (to ".logs-pdfizados-tee")
-- (find-es "ead" "logs-pdfizados")
-- (find-es "ead" "logs-pdfizados" "| tee /tmp/o")
logs_pdfizados_tee = [[
2020.1-C2/C2-C1-RCN-PURO-2020.1-2.pdf
2020.1-C2/C2-C1-RCN-PURO-2020.1-3.pdf
2020.1-C2/C2-C1-RCN-PURO-2020.1.pdf
2020.1-C2/C2-E1-RCN-PURO-2020.1-2.pdf
2020.1-C2/C2-E1-RCN-PURO-2020.1-3.pdf
2020.1-C2/C2-E1-RCN-PURO-2020.1.pdf
2020.1-C3/C3-M1-RCN-PURO-2020.1-2.pdf
2020.1-C3/C3-M1-RCN-PURO-2020.1-3.pdf
2020.1-C3/C3-M1-RCN-PURO-2020.1-4.pdf
2020.1-C3/C3-M1-RCN-PURO-2020.1.pdf
2020.2-C2/C2-C1-RCN-PURO-2020.2-2.pdf
2020.2-C2/C2-C1-RCN-PURO-2020.2.pdf
2020.2-C2/C2-E1-RCN-PURO-2020.2-2.pdf
2020.2-C2/C2-E1-RCN-PURO-2020.2-3.pdf
2020.2-C2/C2-E1-RCN-PURO-2020.2.pdf
2020.2-C3/C3-M1-RCN-PURO-2020.2-2.pdf
2020.2-C3/C3-M1-RCN-PURO-2020.2.pdf
2021.1-C2/C2-C1-RCN-PURO-2021.1-2.pdf
2021.1-C2/C2-C1-RCN-PURO-2021.1-3.pdf
2021.1-C2/C2-C1-RCN-PURO-2021.1.pdf
2021.1-C2/C2-E1-RCN-PURO-2021.1-2.pdf
2021.1-C2/C2-E1-RCN-PURO-2021.1-3.pdf
2021.1-C2/C2-E1-RCN-PURO-2021.1-4.pdf
2021.1-C2/C2-E1-RCN-PURO-2021.1-5.pdf
2021.1-C2/C2-E1-RCN-PURO-2021.1.pdf
2021.1-C3/C3-M1-RCN-PURO-2021.1-2.pdf
2021.1-C3/C3-M1-RCN-PURO-2021.1.pdf
2021.2-C2/C2-C1-RCN-PURO-2021.2-2.pdf
2021.2-C2/C2-C1-RCN-PURO-2021.2.pdf
2021.2-C2/C2-E1-RCN-PURO-2021.2-2.pdf
2021.2-C2/C2-E1-RCN-PURO-2021.2-3.pdf
2021.2-C2/C2-E1-RCN-PURO-2021.2.pdf
2021.2-C3/C3-M1-RCN-PURO-2021.2-2.pdf
2021.2-C3/C3-M1-RCN-PURO-2021.2-3.pdf
2021.2-C3/C3-M1-RCN-PURO-2021.2-4.pdf
2021.2-C3/C3-M1-RCN-PURO-2021.2.pdf
]]


--  _                ____     _  __ 
-- | |    ___   __ _|  _ \ __| |/ _|
-- | |   / _ \ / _` | |_) / _` | |_ 
-- | |__| (_) | (_| |  __/ (_| |  _|
-- |_____\___/ \__, |_|   \__,_|_|  
--             |___/                
--
-- (find-angg "LUA/LogsPdfizados1.lua" "PdfName")
-- «LogPdf»  (to ".LogPdf")

LogPdf = Class {
  type = "LogPdf",
  --
  parse_long = function (longfname)
      local pat_long = "20(..).(.)%-C(.)/...(.).................(.*)"
      local yy,s,m,T,rest = longfname:match(pat_long)
      local n0 = rest:match("[0-9]")
      local n = n0 or "1"
      return yy,s,m,T,rest,n0,n
    end,
  from_long = function (longfname)
      local yy,s,m,T,rest,n0,n = LogPdf.parse_long(longfname)
      return LogPdf {longfname=longfname, yy=yy, s=s, m=m, T=T, n=n}
    end,
  --
  parse_abbrev = function (abbr)
      local pat_abbrev = "^(.)(.)L(.)(.)([0-9]*)"
      local m,letter,n,t,pg = abbr:match(pat_abbrev)
      local yy,s = letter_to_yys[letter]:match("(..)(.)")
      local T = t:upper()
      return m,letter,n,t,pg,yy,s,T
    end,
  from_abbrev = function (abbr)
      local m,letter,n,t,pg,yy,s,T = LogPdf.parse_abbrev(abbr)
      return (LogPdf {abbr=abbr, yy=yy, s=s, m=m, T=T, n=n}), pg
    end,
  --
  __tostring = function (lp)
      return lp:abbrev() .. ": " .. (lp.longfname or lp:short2())
    end,
  __index = {
    letter = function (lp)
        return yys_to_letter[lp.yy .. lp.s]
      end,
    abbrev = function (lp)
        local letter = lp:letter()
        local Turma  = lp.T
        local turma  = Turma:lower()
        return lp.m .. letter .. "L" .. lp.n .. turma
      end,
    short2 = function (lp)
        local fmt = "20%s.%s-C%s-%s1-%s"
        return format(fmt, lp.yy, lp.s, lp.m, lp.T, lp.n)
      end,
    short2_fmt = function (lp)
        local fmt = "20%s.%s-C%s-%s1-%s"
        return format(fmt, lp.yy, lp.s, lp.m, lp.T, "%s")
      end,
    cp = function (lp, dir)
        local fmt = "cp -v ~/%-40s %s%s.pdf"
        return format(fmt, lp.longfname, dir or "~/logs-pdfizados/", lp:short2())
      end,
    cp_abbrev = function (lp, dir)
        local fmt = "cp -v ~/%-40s %s%s.pdf"
        return format(fmt, lp.longfname, dir or "~/logs-pdfizados/", lp:abbrev())
      end,
    --
    pdf = function (lp)
        local fname = "logs-pdfizados/"..lp:short2()..".pdf"
        return Pdf.from(fname)
      end,
    pdfs = function (lp)
        local fmt = "logs-pdfizados/"..lp:short2_fmt()..".pdf"
        return Pdfs.fromfmt(fmt)
      end,

  },
}

-- «LogPdf-tests»  (to ".LogPdf-tests")
--[[
* (eepitch-lua51)
* (eepitch-kill)
* (eepitch-lua51)
dofile "Caepro2.lua"
for _,fn in ipairs(split(logs_pdfizados_tee)) do
  lp = LogPdf.from_long(fn)
  print(lp)
end

for _,fn in ipairs(split(logs_pdfizados_tee)) do
  lp = LogPdf.from_long(fn)
  print(lp:cp("~/logs-pdfizados/"))
end

for _,fn in ipairs(split(logs_pdfizados_tee)) do
  lp = LogPdf.from_long(fn)
  print(lp:cp_abbrev())
end

= LogPdf.from_abbrev("2aL1e")
= LogPdf.from_abbrev("3dL2m")
= LogPdf.from_abbrev("3dL2m42")
= LogPdf.from_abbrev("3dL2m42"):pdf()
= LogPdf.from_abbrev("3dL2m42"):pdfs()
= LogPdf.from_abbrev("3dL2m42"):pdfs():pdf(2)
= LogPdf.from_abbrev("3dL2m42"):pdfs():open_cmd(2, 4)
= LogPdf.from_abbrev("3dL2m42"):pdfs():open(2, 4)
= LogPdf.from_abbrev("3dL2m42"):pdfs():open(2)

-- 2dL3e: 2021.2-C2/C2-E1-RCN-PURO-2021.2-3.pdf
-- 2dL1e: 2021.2-C2/C2-E1-RCN-PURO-2021.2.pdf
-- 3dL2m: 2021.2-C3/C3-M1-RCN-PURO-2021.2-2.pdf

--]]


-- «LogPdf-cps»  (to ".LogPdf-cps")
-- (find-es "ead" "logs-pdfizados-linode")
--[[
* (eepitch-shell)
* (eepitch-kill)
* (eepitch-shell)
# (find-fline "~/logs-pdfizados/")
cp -v ~/2020.1-C2/C2-C1-RCN-PURO-2020.1-2.pdf    ~/logs-pdfizados/2020.1-C2-C1-2.pdf
cp -v ~/2020.1-C2/C2-C1-RCN-PURO-2020.1-3.pdf    ~/logs-pdfizados/2020.1-C2-C1-3.pdf
cp -v ~/2020.1-C2/C2-C1-RCN-PURO-2020.1.pdf      ~/logs-pdfizados/2020.1-C2-C1-1.pdf
cp -v ~/2020.1-C2/C2-E1-RCN-PURO-2020.1-2.pdf    ~/logs-pdfizados/2020.1-C2-E1-2.pdf
cp -v ~/2020.1-C2/C2-E1-RCN-PURO-2020.1-3.pdf    ~/logs-pdfizados/2020.1-C2-E1-3.pdf
cp -v ~/2020.1-C2/C2-E1-RCN-PURO-2020.1.pdf      ~/logs-pdfizados/2020.1-C2-E1-1.pdf
cp -v ~/2020.1-C3/C3-M1-RCN-PURO-2020.1-2.pdf    ~/logs-pdfizados/2020.1-C3-M1-2.pdf
cp -v ~/2020.1-C3/C3-M1-RCN-PURO-2020.1-3.pdf    ~/logs-pdfizados/2020.1-C3-M1-3.pdf
cp -v ~/2020.1-C3/C3-M1-RCN-PURO-2020.1-4.pdf    ~/logs-pdfizados/2020.1-C3-M1-4.pdf
cp -v ~/2020.1-C3/C3-M1-RCN-PURO-2020.1.pdf      ~/logs-pdfizados/2020.1-C3-M1-1.pdf
cp -v ~/2020.2-C2/C2-C1-RCN-PURO-2020.2-2.pdf    ~/logs-pdfizados/2020.2-C2-C1-2.pdf
cp -v ~/2020.2-C2/C2-C1-RCN-PURO-2020.2.pdf      ~/logs-pdfizados/2020.2-C2-C1-1.pdf
cp -v ~/2020.2-C2/C2-E1-RCN-PURO-2020.2-2.pdf    ~/logs-pdfizados/2020.2-C2-E1-2.pdf
cp -v ~/2020.2-C2/C2-E1-RCN-PURO-2020.2-3.pdf    ~/logs-pdfizados/2020.2-C2-E1-3.pdf
cp -v ~/2020.2-C2/C2-E1-RCN-PURO-2020.2.pdf      ~/logs-pdfizados/2020.2-C2-E1-1.pdf
cp -v ~/2020.2-C3/C3-M1-RCN-PURO-2020.2-2.pdf    ~/logs-pdfizados/2020.2-C3-M1-2.pdf
cp -v ~/2020.2-C3/C3-M1-RCN-PURO-2020.2.pdf      ~/logs-pdfizados/2020.2-C3-M1-1.pdf
cp -v ~/2021.1-C2/C2-C1-RCN-PURO-2021.1-2.pdf    ~/logs-pdfizados/2021.1-C2-C1-2.pdf
cp -v ~/2021.1-C2/C2-C1-RCN-PURO-2021.1-3.pdf    ~/logs-pdfizados/2021.1-C2-C1-3.pdf
cp -v ~/2021.1-C2/C2-C1-RCN-PURO-2021.1.pdf      ~/logs-pdfizados/2021.1-C2-C1-1.pdf
cp -v ~/2021.1-C2/C2-E1-RCN-PURO-2021.1-2.pdf    ~/logs-pdfizados/2021.1-C2-E1-2.pdf
cp -v ~/2021.1-C2/C2-E1-RCN-PURO-2021.1-3.pdf    ~/logs-pdfizados/2021.1-C2-E1-3.pdf
cp -v ~/2021.1-C2/C2-E1-RCN-PURO-2021.1-4.pdf    ~/logs-pdfizados/2021.1-C2-E1-4.pdf
cp -v ~/2021.1-C2/C2-E1-RCN-PURO-2021.1-5.pdf    ~/logs-pdfizados/2021.1-C2-E1-5.pdf
cp -v ~/2021.1-C2/C2-E1-RCN-PURO-2021.1.pdf      ~/logs-pdfizados/2021.1-C2-E1-1.pdf
cp -v ~/2021.1-C3/C3-M1-RCN-PURO-2021.1-2.pdf    ~/logs-pdfizados/2021.1-C3-M1-2.pdf
cp -v ~/2021.1-C3/C3-M1-RCN-PURO-2021.1.pdf      ~/logs-pdfizados/2021.1-C3-M1-1.pdf
cp -v ~/2021.2-C2/C2-C1-RCN-PURO-2021.2-2.pdf    ~/logs-pdfizados/2021.2-C2-C1-2.pdf
cp -v ~/2021.2-C2/C2-C1-RCN-PURO-2021.2.pdf      ~/logs-pdfizados/2021.2-C2-C1-1.pdf
cp -v ~/2021.2-C2/C2-E1-RCN-PURO-2021.2-2.pdf    ~/logs-pdfizados/2021.2-C2-E1-2.pdf
cp -v ~/2021.2-C2/C2-E1-RCN-PURO-2021.2-3.pdf    ~/logs-pdfizados/2021.2-C2-E1-3.pdf
cp -v ~/2021.2-C2/C2-E1-RCN-PURO-2021.2.pdf      ~/logs-pdfizados/2021.2-C2-E1-1.pdf
cp -v ~/2021.2-C3/C3-M1-RCN-PURO-2021.2-2.pdf    ~/logs-pdfizados/2021.2-C3-M1-2.pdf
cp -v ~/2021.2-C3/C3-M1-RCN-PURO-2021.2-3.pdf    ~/logs-pdfizados/2021.2-C3-M1-3.pdf
cp -v ~/2021.2-C3/C3-M1-RCN-PURO-2021.2-4.pdf    ~/logs-pdfizados/2021.2-C3-M1-4.pdf
cp -v ~/2021.2-C3/C3-M1-RCN-PURO-2021.2.pdf      ~/logs-pdfizados/2021.2-C3-M1-1.pdf
cp -v ~/2020.1-C2/C2-C1-RCN-PURO-2020.1-2.pdf    ~/logs-pdfizados/2aL2c.pdf
cp -v ~/2020.1-C2/C2-C1-RCN-PURO-2020.1-3.pdf    ~/logs-pdfizados/2aL3c.pdf
cp -v ~/2020.1-C2/C2-C1-RCN-PURO-2020.1.pdf      ~/logs-pdfizados/2aL1c.pdf
cp -v ~/2020.1-C2/C2-E1-RCN-PURO-2020.1-2.pdf    ~/logs-pdfizados/2aL2e.pdf
cp -v ~/2020.1-C2/C2-E1-RCN-PURO-2020.1-3.pdf    ~/logs-pdfizados/2aL3e.pdf
cp -v ~/2020.1-C2/C2-E1-RCN-PURO-2020.1.pdf      ~/logs-pdfizados/2aL1e.pdf
cp -v ~/2020.1-C3/C3-M1-RCN-PURO-2020.1-2.pdf    ~/logs-pdfizados/3aL2m.pdf
cp -v ~/2020.1-C3/C3-M1-RCN-PURO-2020.1-3.pdf    ~/logs-pdfizados/3aL3m.pdf
cp -v ~/2020.1-C3/C3-M1-RCN-PURO-2020.1-4.pdf    ~/logs-pdfizados/3aL4m.pdf
cp -v ~/2020.1-C3/C3-M1-RCN-PURO-2020.1.pdf      ~/logs-pdfizados/3aL1m.pdf
cp -v ~/2020.2-C2/C2-C1-RCN-PURO-2020.2-2.pdf    ~/logs-pdfizados/2bL2c.pdf
cp -v ~/2020.2-C2/C2-C1-RCN-PURO-2020.2.pdf      ~/logs-pdfizados/2bL1c.pdf
cp -v ~/2020.2-C2/C2-E1-RCN-PURO-2020.2-2.pdf    ~/logs-pdfizados/2bL2e.pdf
cp -v ~/2020.2-C2/C2-E1-RCN-PURO-2020.2-3.pdf    ~/logs-pdfizados/2bL3e.pdf
cp -v ~/2020.2-C2/C2-E1-RCN-PURO-2020.2.pdf      ~/logs-pdfizados/2bL1e.pdf
cp -v ~/2020.2-C3/C3-M1-RCN-PURO-2020.2-2.pdf    ~/logs-pdfizados/3bL2m.pdf
cp -v ~/2020.2-C3/C3-M1-RCN-PURO-2020.2.pdf      ~/logs-pdfizados/3bL1m.pdf
cp -v ~/2021.1-C2/C2-C1-RCN-PURO-2021.1-2.pdf    ~/logs-pdfizados/2cL2c.pdf
cp -v ~/2021.1-C2/C2-C1-RCN-PURO-2021.1-3.pdf    ~/logs-pdfizados/2cL3c.pdf
cp -v ~/2021.1-C2/C2-C1-RCN-PURO-2021.1.pdf      ~/logs-pdfizados/2cL1c.pdf
cp -v ~/2021.1-C2/C2-E1-RCN-PURO-2021.1-2.pdf    ~/logs-pdfizados/2cL2e.pdf
cp -v ~/2021.1-C2/C2-E1-RCN-PURO-2021.1-3.pdf    ~/logs-pdfizados/2cL3e.pdf
cp -v ~/2021.1-C2/C2-E1-RCN-PURO-2021.1-4.pdf    ~/logs-pdfizados/2cL4e.pdf
cp -v ~/2021.1-C2/C2-E1-RCN-PURO-2021.1-5.pdf    ~/logs-pdfizados/2cL5e.pdf
cp -v ~/2021.1-C2/C2-E1-RCN-PURO-2021.1.pdf      ~/logs-pdfizados/2cL1e.pdf
cp -v ~/2021.1-C3/C3-M1-RCN-PURO-2021.1-2.pdf    ~/logs-pdfizados/3cL2m.pdf
cp -v ~/2021.1-C3/C3-M1-RCN-PURO-2021.1.pdf      ~/logs-pdfizados/3cL1m.pdf
cp -v ~/2021.2-C2/C2-C1-RCN-PURO-2021.2-2.pdf    ~/logs-pdfizados/2dL2c.pdf
cp -v ~/2021.2-C2/C2-C1-RCN-PURO-2021.2.pdf      ~/logs-pdfizados/2dL1c.pdf
cp -v ~/2021.2-C2/C2-E1-RCN-PURO-2021.2-2.pdf    ~/logs-pdfizados/2dL2e.pdf
cp -v ~/2021.2-C2/C2-E1-RCN-PURO-2021.2-3.pdf    ~/logs-pdfizados/2dL3e.pdf
cp -v ~/2021.2-C2/C2-E1-RCN-PURO-2021.2.pdf      ~/logs-pdfizados/2dL1e.pdf
cp -v ~/2021.2-C3/C3-M1-RCN-PURO-2021.2-2.pdf    ~/logs-pdfizados/3dL2m.pdf
cp -v ~/2021.2-C3/C3-M1-RCN-PURO-2021.2-3.pdf    ~/logs-pdfizados/3dL3m.pdf
cp -v ~/2021.2-C3/C3-M1-RCN-PURO-2021.2-4.pdf    ~/logs-pdfizados/3dL4m.pdf
cp -v ~/2021.2-C3/C3-M1-RCN-PURO-2021.2.pdf      ~/logs-pdfizados/3dL1m.pdf
cd ~/logs-pdfizados/
for i in ?????.pdf; do
  echo pdftotext -layout $i $(basename $i .pdf).txt
       pdftotext -layout $i $(basename $i .pdf).txt
done

# (code-c-d "logspdfizados" "~/logs-pdfizados/")
# (find-logspdfizadosfile "")
# (find-logspdfizadosgrep "grep --color=auto -nH --null -e apaga *.txt")

--]]




-- «mletter_pdfzoes»  (to ".mletter_pdfzoes")
mletter_line_pat = "  (..) ([!-~]+)([^\n]*)"

mletter_pdfzoes = {}
mletter_pdfzoes_bigstr = [[
  2y LATEX/2019-2-C2-tudo.pdf    Tests: 2yP1 2yT1
  3y LATEX/2019-2-C3-tudo.pdf           3yP1
  2a LATEX/2020-1-C2-tudo.pdf           2aP1
  3a LATEX/2020-1-C3-tudo.pdf           3aP1
  2b LATEX/2020-2-C2-tudo.pdf           2bP1
  3b LATEX/2020-2-C3-tudo.pdf           3bP1
  2c LATEX/2021-1-C2-tudo.pdf           2cP1
  3c LATEX/2021-1-C3-tudo.pdf           3cP1
  2d LATEX/2021-2-C2-tudo.pdf           2dP1
  3d LATEX/2021-2-C3-tudo.pdf           3dP1
  2e LATEX/2022-1-C2-tudo.pdf           2eP1
  3e LATEX/2022-1-C3-tudo.pdf           3eP1
  2f LATEX/2022-2-C2-tudo.pdf           2fP1
  3f LATEX/2022-2-C3-tudo.pdf           3fP1
  2g LATEX/2023-1-C2-tudo.pdf           2gP1
]]
-- «mletter_quadros»  (to ".mletter_quadros")
mletter_quadros = {}
mletter_quadros_bigstr = [[
  2x 2019.1-C2/2019.1-C2.pdf     Tests: 2xQ1
  3x 2019.1-C3/2019.1-C3.pdf            3xQ1
  2y 2019.2-C2/2019.2-C2.pdf            2yQ1
  3y 2019.2-C3/2019.2-C3.pdf            3yQ1
  2e 2022.1-C2/C2-quadros.pdf           2eQ1
  3e 2022.1-C3/C3-quadros.pdf           3eQ1
  2f 2022.2-C2/C2-quadros.pdf           2fQ1 2Q1
  3f 2022.2-C3/C3-quadros.pdf           3fQ1 3Q1 

  2g 2023.1-C2/C2-quadros.pdf           2gQ1
]]
-- «mletter_jpgs»  (to ".mletter_jpgs")
mletter_jpgs = {}
mletter_jpgs_bigstr = [[
  2x 2019.1-C2                   Tests: 2xJ1
  3x 2019.1-C3                          3xJ1
  2y 2019.2-C2                          2yJ1
  3y 2019.2-C3                          3yJ1
  2e 2022.1-C2                          2eJ1
  3e 2022.1-C3                          3eJ1
  2f 2022.2-C2                          2fJ1
  3f 2022.2-C3                          3fJ1
]]
for ml,fname in mletter_quadros_bigstr:gmatch(mletter_line_pat) do
  mletter_quadros[ml] = Pdf.from(fname)
end
for ml,fname in mletter_pdfzoes_bigstr:gmatch(mletter_line_pat) do
  mletter_pdfzoes[ml] = Pdf.from(fname)
end
mletter_tables_set = function ()
  for ml,dir in mletter_jpgs_bigstr:gmatch(mletter_line_pat) do
    mletter_jpgs[ml] = Jpgs.fromdir(dir, "~/slow_html/")
    -- print(ml, dir, #mletter_jpgs[ml])
  end
end

-- «mletter_tables_set»  (to ".mletter_tables_set")
-- Note that we only need to run mletter_tables_set() if we want to
-- make the links to jpgs work! When we don't need the links to jpgs
-- we don't need the getoutputs.

-- «mletter_tables-tests»  (to ".mletter_tables-tests")
--[[
  * (eepitch-lua51)
  * (eepitch-kill)
  * (eepitch-lua51)
  dofile "Caepro2.lua"
  = mletter_pdfzoes["3y"]
  = mletter_pdfzoes["3y"]:open(3)
  = mletter_quadros["3x"]
  = mletter_quadros["3x"]:open(3)

  = mletter_jpgs   ["2x"]   -- err: not loaded
  mletter_tables_set()

  = mletter_jpgs   ["2x"]
  = mletter_jpgs   ["2x"]:open(1)
  = mletter_jpgs   ["3x"]
  = mletter_jpgs   ["3x"]:open(3)

--]]

-- «mletter_tables-cp»  (to ".mletter_tables-cp")
-- (find-angg ".emacs" "logs-pdfizados" "*T.txt")
--[[
  * (eepitch-lua51)
  * (eepitch-kill)
  * (eepitch-lua51)
  dofile "Caepro2.lua"
  for ml,fname in mletter_pdfzoes_bigstr:gmatch(mletter_line_pat) do
  local fmt = "pdftotext -layout ~/%s ~/logs-pdfizados/%sT.txt"
  print(format(fmt, fname, ml))
  end

* (eepitch-shell)
* (eepitch-kill)
* (eepitch-shell)
pdftotext -layout ~/LATEX/2019-2-C2-tudo.pdf ~/logs-pdfizados/2yT.txt
pdftotext -layout ~/LATEX/2019-2-C3-tudo.pdf ~/logs-pdfizados/3yT.txt
pdftotext -layout ~/LATEX/2020-1-C2-tudo.pdf ~/logs-pdfizados/2aT.txt
pdftotext -layout ~/LATEX/2020-1-C3-tudo.pdf ~/logs-pdfizados/3aT.txt
pdftotext -layout ~/LATEX/2020-2-C2-tudo.pdf ~/logs-pdfizados/2bT.txt
pdftotext -layout ~/LATEX/2020-2-C3-tudo.pdf ~/logs-pdfizados/3bT.txt
pdftotext -layout ~/LATEX/2021-1-C2-tudo.pdf ~/logs-pdfizados/2cT.txt
pdftotext -layout ~/LATEX/2021-1-C3-tudo.pdf ~/logs-pdfizados/3cT.txt
pdftotext -layout ~/LATEX/2021-2-C2-tudo.pdf ~/logs-pdfizados/2dT.txt
pdftotext -layout ~/LATEX/2021-2-C3-tudo.pdf ~/logs-pdfizados/3dT.txt
pdftotext -layout ~/LATEX/2022-1-C2-tudo.pdf ~/logs-pdfizados/2eT.txt
pdftotext -layout ~/LATEX/2022-1-C3-tudo.pdf ~/logs-pdfizados/3eT.txt
pdftotext -layout ~/LATEX/2022-2-C2-tudo.pdf ~/logs-pdfizados/2fT.txt
pdftotext -layout ~/LATEX/2022-2-C3-tudo.pdf ~/logs-pdfizados/3fT.txt
pdftotext -layout ~/LATEX/2023-1-C2-tudo.pdf ~/logs-pdfizados/2gT.txt

--]]




-- «slow_html»  (to ".slow_html")
--[[
* (eepitch-shell)
* (eepitch-kill)
* (eepitch-shell)
mkdir -p ~/slow_html/
laf -s   ~/slow_html/20??.?-??
cd
cd       ~/slow_html/
rm -fv    2022.2-C3
ln -s  ../2022.2-C3 2022.2-C3
laf

for i in $(cd; echo 20??.?-??); do
  cd ~/slow_html/
  echo "rm -fv $i; ln -s ../$i $i"
        rm -fv $i; ln -s ../$i $i
done

--]]




--     _    _     _                    
--    / \  | |__ | |__  _ __ _____   __
--   / _ \ | '_ \| '_ \| '__/ _ \ \ / /
--  / ___ \| |_) | |_) | | |  __/\ V / 
-- /_/   \_\_.__/|_.__/|_|  \___| \_/  
--                                     
-- «Abbrev»  (to ".Abbrev")
Abbrev = Class {
  type  = "Abbrev",
  defaultletter = "f",
  parse = function (abbr)
      local pat1 = "^(%d)([xya-h]?)([TPQJL]?)(.*)"
      local m,letter,Type,rest = abbr:match(pat1)
      if letter == "" then letter = Abbrev.defaultletter end
      local yy,s = letter_to_yys[letter]:match("(..)(.)")
      local n,t,pg = rest:match("^([0-9])([a-z])(.*)")
      local T = t and t:upper()
      local MM = "C"..m
      pg = pg or rest
      return m,MM,letter,Type,yy,s,pg,t,T,n
    end,
  from = function (abbr)
      local m,MM,letter,Type,yy,s,pg,t,T,n = Abbrev.parse(abbr)
      return Abbrev {abbr=abbr, m=m, MM=MM, letter=letter, Type=Type, yy=yy, s=s, pg=pg, t=t, T=T, n=n}
    end,
  __tostring = function (ab) return mytostringpv(ab) end,
  __index = {
    mletter = function (ab) return ab.m..ab.letter end,
    quadros = function (ab) return mletter_quadros[ab:mletter()] end,
    jpgs    = function (ab) return mletter_jpgs   [ab:mletter()] end,
    pdfzao  = function (ab) return mletter_pdfzoes[ab:mletter()] end,
    dir     = function (ab) return format("20%s.%s-%s", ab.yy, ab.s, ab.MM) end,
    logpdf  = function (ab) return LogPdf.from_abbrev(ab.abbr):pdf() end,
    obj     = function (ab)
        if     ab.Type == "T" or ab.Type == "P" then return ab:pdfzao()
        elseif ab.Type == "Q" then return ab:quadros()
        elseif ab.Type == "J" then return ab:jpgs()
        elseif ab.Type == "L" then return ab:logpdf()
        end
      end,
    open_cmd = function (ab) return ab:obj():open_cmd(ab.pg) end,
    open     = function (ab) return ab:obj():open    (ab.pg) end,
    url      = function (ab) return ab:obj():url     (ab.pg) end,
  },
}

-- «Abbrev-tests»  (to ".Abbrev-tests")
--[[
* (eepitch-lua51)
* (eepitch-kill)
* (eepitch-lua51)
dofile "Caepro2.lua"
= Abbrev.parse("2xJ1")
= Abbrev.from ("2xJ1"):obj()
= Abbrev.from ("2xJ1"):obj():open()
= Abbrev.from ("2xJ1"):mletter()
= Abbrev.from ("2xJ1"):jpgs()
= Abbrev.from ("2yJ1"):jpgs()
= Abbrev.from ("2yJ1"):obj()
= Abbrev.from ("2yJ1"):obj():open()
= Abbrev.from ("2yJ1"):obj():open(1)
= Abbrev.from ("2yJ1"):obj():open(2)
= Abbrev.from ("2yJ1"):open(1)
= Abbrev.from ("2yJ1"):open(2)

= Abbrev.parse("3T")
= Abbrev.from ("3T")
= Abbrev.from ("3T") :dir()
= Abbrev.from ("3aT"):dir()
= Abbrev.from ("3T") :pdfzao()
= Abbrev.from ("3T") :obj()
= Abbrev.from ("3bT"):pdfzao()
= Abbrev.from ("3bT"):pdfzao()
= Abbrev.parse("3T42")
= Abbrev.parse("3aT42")
= Abbrev.parse("2dL2e30")
= Abbrev.from ("2dL2e30")
= Abbrev.from ("2dL2e30"):obj()
= Abbrev.from ("2dL2e30"):open_cmd()
= Abbrev.from ("2dL2e30"):url()
= Abbrev.from ("2dL2e30"):open()

-- 2aL1c1  2aL1e1  3aL1m1
-- 2bL1c1  2bL1e1  3bL1m1
-- 2cL1c1  2cL1e1  3cL1m1
-- 2dL1c1  2dL1e1  3dL1m1

-- (find-sh "ls ~/LATEX/*tudo.pdf")
-- (find-sh "ls -d ~/20??.?-??/")
-- (find-sh "ls    ~/20??.?-??/*.pdf")

--]]


--     _    _     _                    ____  _           
--    / \  | |__ | |__  _ __ _____   _|  _ \| |_   _ ___ 
--   / _ \ | '_ \| '_ \| '__/ _ \ \ / / |_) | | | | / __|
--  / ___ \| |_) | |_) | | |  __/\ V /|  __/| | |_| \__ \
-- /_/   \_\_.__/|_.__/|_|  \___| \_/ |_|   |_|\__,_|___/
--                                                       
-- «AbbrevPlus»  (to ".AbbrevPlus")
AbbrevPlus = Class {
  type = "AbbrevPlus",
  from = function (abbr)
    end,
  __index = {
  },
}

-- «AbbrevPlus-tests»  (to ".AbbrevPlus-tests")
--[[
* (eepitch-lua51)
* (eepitch-kill)
* (eepitch-lua51)
dofile "Caepro2.lua"

--]]



--                                                      _ _ 
--   ___ _ __ _ __ _ __ ___   ___  __ _ _ __  ___ _ __ (_) |
--  / _ \ '__| '__| '_ ` _ \ / _ \/ _` | '_ \/ __| '_ \| | |
-- |  __/ |  | |  | | | | | |  __/ (_| | | | \__ \ | | | | |
--  \___|_|  |_|  |_| |_| |_|\___|\__,_|_| |_|___/_| |_|_|_|
--                                                          
-- «errmeansnil»  (to ".errmeansnil")
errmeansnil = function (f)
  end

-- «errmeansnil-tests»  (to ".errmeansnil-tests")
--[[
* (eepitch-lua51)
* (eepitch-kill)
* (eepitch-lua51)
dofile "Caepro2.lua"

--]]



--                      
--   __ _ _ __ __ _ ___ 
--  / _` | '__/ _` / __|
-- | (_| | | | (_| \__ \
--  \__,_|_|  \__, |___/
--            |___/     
--
-- «args»  (to ".args")
-- (find-angg "LUA/Caepro1.lua" "args")
args = {...}
if args[1] == "-oc"  then
  mletter_tables_set()
  print(Abbrev.from(args[2]):open_cmd())
end
if args[1] == "-url" then
  mletter_tables_set()
  print(Abbrev.from(args[2]):url())
end



--  __  __       ___  _ 
-- |  \/  |     / _ \(_)
-- | |\/| |____| (_) | |
-- | |  | |_____\__, | |
-- |_|  |_|       /_// |
--                 |__/ 
--
-- «elisp»  (to ".elisp")
--[[
* (eepitch-shell)
* (eepitch-kill)
* (eepitch-shell)
lua5.1 Caepro2.lua
lua5.1 Caepro2.lua -oc 2yT2
lua5.1 Caepro2.lua -oc 2yQ2
lua5.1 Caepro2.lua -url 2yQ2

(defun ee-caepro-oc (str)
  (interactive (list 
  (find-sh0 (format "cd ~/LUA/; lua5.1 Caepro2.lua -oc %s" str)))

(defun ee-caepro-url (str)
  (interactive (list (ee-caepro-around-point)))
  (find-sh (format "cd ~/LUA/; lua5.1 Caepro2.lua -url %s" str)))

(defun ee-caepro-around-point () (ee-stuff-around-point "A-Za-z0-9"))

(defun ee-caepro-run (str)
  (interactive)
  (setq str (or str (ee-stuff-around-point "A-Za-z0-9")))
  (find-bgprocess (ee-caepro-oc str)))

(defun ee-caepro-debug (str)
  (interactive)
  (setq str (or str (ee-caepro-around-point)))
  (find-estring (ee-caepro-oc str)))

(defun ee-caepro-log-abbrev ()
  (format "%s%s" (file-name-sans-extension
                  (file-name-nondirectory
                   (buffer-file-name)))
                 (ee-current-page)))

(defalias 'cau 'ee-caepro-url)

(defun eejump-9   () (ee-caepro-run nil))
(defun eejump-99  () (find-estring (ee-caepro-log-abbrev)))
(defun eejump-999 () (ee-caepro-debug nil))

;; (ee-caepro-oc  "2yT2")
;; (ee-caepro-run "2yT2")
;; (ee-caepro-oc  "2yfoo")
;; (ee-caepro-oc  "2q4")
;; (ee-caepro-debug  "2q4")
;; (ee-caepro-run "2yfoo")

--]]






-- Local Variables:
-- coding:  utf-8-unix
-- End: