├── .gitattributes ├── .github └── workflows │ └── ci.yml ├── .gitignore ├── .vscode └── settings.json ├── Cargo.toml ├── LICENSE-APACHE ├── LICENSE-MIT ├── cli ├── Cargo.toml ├── src │ └── bin │ │ └── texrs.rs ├── tests │ ├── auxiliary │ │ └── vfs.rs │ ├── initex.rs │ ├── plain.rs │ └── trip.rs └── tests_data │ ├── dvi_result │ └── plain_helloworld.dvi │ ├── plain │ ├── cmbsy10.tfm │ ├── cmbx10.tfm │ ├── cmbx5.tfm │ ├── cmbx6.tfm │ ├── cmbx7.tfm │ ├── cmbx8.tfm │ ├── cmbx9.tfm │ ├── cmcsc10.tfm │ ├── cmdunh10.tfm │ ├── cmex10.tfm │ ├── cmmi10.tfm │ ├── cmmi5.tfm │ ├── cmmi6.tfm │ ├── cmmi7.tfm │ ├── cmmi8.tfm │ ├── cmmi9.tfm │ ├── cmmib10.tfm │ ├── cmr10.tfm │ ├── cmr5.tfm │ ├── cmr6.tfm │ ├── cmr7.tfm │ ├── cmr8.tfm │ ├── cmr9.tfm │ ├── cmsl10.tfm │ ├── cmsl8.tfm │ ├── cmsl9.tfm │ ├── cmsltt10.tfm │ ├── cmss10.tfm │ ├── cmssbx10.tfm │ ├── cmssi10.tfm │ ├── cmssq8.tfm │ ├── cmssqi8.tfm │ ├── cmsy10.tfm │ ├── cmsy5.tfm │ ├── cmsy6.tfm │ ├── cmsy7.tfm │ ├── cmsy8.tfm │ ├── cmsy9.tfm │ ├── cmti10.tfm │ ├── cmti7.tfm │ ├── cmti8.tfm │ ├── cmti9.tfm │ ├── cmtt10.tfm │ ├── cmtt8.tfm │ ├── cmtt9.tfm │ ├── cmu10.tfm │ ├── hyphen.tex │ ├── manfnt.tfm │ └── plain.tex │ ├── plain_dmp │ └── plain.fmt │ └── trip │ ├── trip.dvi │ ├── trip.fot │ ├── trip.log │ ├── trip.pl │ ├── trip.tex │ ├── trip.tfm │ ├── trip.typ │ ├── tripin.fot │ ├── tripin.log │ └── tripos.tex ├── rust-toolchain └── src ├── configure.rs ├── info.rs ├── io_support.rs ├── latex_support.rs ├── lib.rs ├── pascal.rs ├── string_pool.rs ├── tex_the_program.rs ├── tex_the_program ├── section_0001.rs ├── section_0002.rs ├── section_0003.rs ├── section_0004.rs ├── section_0005.rs ├── section_0006.rs ├── section_0007.rs ├── section_0008.rs ├── section_0009_to_0010.rs ├── section_0011.rs ├── section_0012.rs ├── section_0013.rs ├── section_0014.rs ├── section_0015.rs ├── section_0016.rs ├── section_0017.rs ├── section_0018.rs ├── section_0019.rs ├── section_0020.rs ├── section_0021.rs ├── section_0022.rs ├── section_0023.rs ├── section_0024.rs ├── section_0025.rs ├── section_0026.rs ├── section_0027.rs ├── section_0028.rs ├── section_0029.rs ├── section_0030.rs ├── section_0031.rs ├── section_0032.rs ├── section_0033.rs ├── section_0034.rs ├── section_0035.rs ├── section_0036.rs ├── section_0037.rs ├── section_0038.rs ├── section_0039.rs ├── section_0040.rs ├── section_0041.rs ├── section_0042.rs ├── section_0043.rs ├── section_0044.rs ├── section_0045.rs ├── section_0046.rs ├── section_0047.rs ├── section_0048.rs ├── section_0049.rs ├── section_0050.rs ├── section_0051.rs ├── section_0052.rs ├── section_0053.rs ├── section_0054.rs ├── section_0055.rs ├── section_0056.rs ├── section_0057.rs ├── section_0058.rs ├── section_0059.rs ├── section_0060.rs ├── section_0061.rs ├── section_0062.rs ├── section_0063.rs ├── section_0064.rs ├── section_0065.rs ├── section_0066.rs ├── section_0067.rs ├── section_0068.rs ├── section_0069.rs ├── section_0070.rs ├── section_0071.rs ├── section_0072.rs ├── section_0073.rs ├── section_0074.rs ├── section_0075.rs ├── section_0076.rs ├── section_0077.rs ├── section_0078.rs ├── section_0079.rs ├── section_0080.rs ├── section_0081.rs ├── section_0082.rs ├── section_0083.rs ├── section_0084.rs ├── section_0085_to_0086.rs ├── section_0087.rs ├── section_0088.rs ├── section_0089.rs ├── section_0090.rs ├── section_0091.rs ├── section_0092.rs ├── section_0093.rs ├── section_0094.rs ├── section_0095.rs ├── section_0096.rs ├── section_0097.rs ├── section_0098.rs ├── section_0099.rs ├── section_0100.rs ├── section_0101.rs ├── section_0102.rs ├── section_0103.rs ├── section_0104.rs ├── section_0105.rs ├── section_0106.rs ├── section_0107.rs ├── section_0108.rs ├── section_0109.rs ├── section_0110.rs ├── section_0111.rs ├── section_0112.rs ├── section_0113.rs ├── section_0114.rs ├── section_0115.rs ├── section_0116.rs ├── section_0117.rs ├── section_0118.rs ├── section_0119.rs ├── section_0120.rs ├── section_0121.rs ├── section_0122.rs ├── section_0123.rs ├── section_0124.rs ├── section_0125.rs ├── section_0126.rs ├── section_0127.rs ├── section_0128.rs ├── section_0129.rs ├── section_0130.rs ├── section_0131.rs ├── section_0132.rs ├── section_0133.rs ├── section_0134.rs ├── section_0135.rs ├── section_0136.rs ├── section_0137.rs ├── section_0138.rs ├── section_0139.rs ├── section_0140.rs ├── section_0141.rs ├── section_0142.rs ├── section_0143.rs ├── section_0144.rs ├── section_0145.rs ├── section_0146.rs ├── section_0147.rs ├── section_0148.rs ├── section_0149.rs ├── section_0150.rs ├── section_0151.rs ├── section_0152.rs ├── section_0153.rs ├── section_0154.rs ├── section_0155.rs ├── section_0156.rs ├── section_0157.rs ├── section_0158.rs ├── section_0159.rs ├── section_0160.rs ├── section_0161.rs ├── section_0162.rs ├── section_0163.rs ├── section_0164.rs ├── section_0165.rs ├── section_0166.rs ├── section_0167.rs ├── section_0168.rs ├── section_0169.rs ├── section_0170.rs ├── section_0171_to_0172.rs ├── section_0173.rs ├── section_0174.rs ├── section_0175.rs ├── section_0176.rs ├── section_0177.rs ├── section_0178.rs ├── section_0179.rs ├── section_0180.rs ├── section_0181.rs ├── section_0182.rs ├── section_0183.rs ├── section_0184.rs ├── section_0185.rs ├── section_0186.rs ├── section_0187.rs ├── section_0188.rs ├── section_0189.rs ├── section_0190.rs ├── section_0191.rs ├── section_0192.rs ├── section_0193.rs ├── section_0194.rs ├── section_0195.rs ├── section_0196_to_0197.rs ├── section_0198.rs ├── section_0199.rs ├── section_0200.rs ├── section_0201.rs ├── section_0202.rs ├── section_0203.rs ├── section_0204.rs ├── section_0205.rs ├── section_0206.rs ├── section_0207.rs ├── section_0208.rs ├── section_0209.rs ├── section_0210.rs ├── section_0211.rs ├── section_0212.rs ├── section_0213.rs ├── section_0214.rs ├── section_0215.rs ├── section_0216.rs ├── section_0217.rs ├── section_0218.rs ├── section_0219.rs ├── section_0220.rs ├── section_0221.rs ├── section_0222.rs ├── section_0223.rs ├── section_0224.rs ├── section_0225.rs ├── section_0226.rs ├── section_0227.rs ├── section_0228.rs ├── section_0229.rs ├── section_0230.rs ├── section_0231.rs ├── section_0232.rs ├── section_0233.rs ├── section_0234.rs ├── section_0235.rs ├── section_0236.rs ├── section_0237.rs ├── section_0238.rs ├── section_0239.rs ├── section_0240.rs ├── section_0241.rs ├── section_0242.rs ├── section_0243.rs ├── section_0244.rs ├── section_0245.rs ├── section_0246.rs ├── section_0247.rs ├── section_0248.rs ├── section_0249.rs ├── section_0250.rs ├── section_0251.rs ├── section_0252.rs ├── section_0253.rs ├── section_0254.rs ├── section_0255.rs ├── section_0256.rs ├── section_0257.rs ├── section_0258.rs ├── section_0259.rs ├── section_0260.rs ├── section_0261.rs ├── section_0262.rs ├── section_0263.rs ├── section_0264.rs ├── section_0265.rs ├── section_0266.rs ├── section_0267.rs ├── section_0268.rs ├── section_0269.rs ├── section_0270.rs ├── section_0271.rs ├── section_0272.rs ├── section_0273.rs ├── section_0274.rs ├── section_0275.rs ├── section_0276.rs ├── section_0277.rs ├── section_0278.rs ├── section_0279.rs ├── section_0280.rs ├── section_0281.rs ├── section_0282.rs ├── section_0283.rs ├── section_0284.rs ├── section_0285.rs ├── section_0286.rs ├── section_0287.rs ├── section_0288.rs ├── section_0289.rs ├── section_0290.rs ├── section_0291.rs ├── section_0292.rs ├── section_0293.rs ├── section_0294.rs ├── section_0295.rs ├── section_0296.rs ├── section_0297.rs ├── section_0298.rs ├── section_0299.rs ├── section_0300.rs ├── section_0301.rs ├── section_0302.rs ├── section_0303.rs ├── section_0304.rs ├── section_0305.rs ├── section_0306.rs ├── section_0307.rs ├── section_0308.rs ├── section_0309.rs ├── section_0310.rs ├── section_0311.rs ├── section_0312.rs ├── section_0313.rs ├── section_0314.rs ├── section_0315.rs ├── section_0316.rs ├── section_0317.rs ├── section_0318.rs ├── section_0319.rs ├── section_0320.rs ├── section_0321.rs ├── section_0322.rs ├── section_0323.rs ├── section_0324.rs ├── section_0325.rs ├── section_0326.rs ├── section_0327.rs ├── section_0328.rs ├── section_0329.rs ├── section_0330.rs ├── section_0331.rs ├── section_0332.rs ├── section_0333.rs ├── section_0334.rs ├── section_0335.rs ├── section_0336.rs ├── section_0337_to_0340.rs ├── section_0341.rs ├── section_0342.rs ├── section_0343.rs ├── section_0344.rs ├── section_0345.rs ├── section_0346.rs ├── section_0347.rs ├── section_0348.rs ├── section_0349.rs ├── section_0350.rs ├── section_0351.rs ├── section_0352.rs ├── section_0353.rs ├── section_0354.rs ├── section_0355.rs ├── section_0356.rs ├── section_0357.rs ├── section_0358.rs ├── section_0359.rs ├── section_0360.rs ├── section_0361.rs ├── section_0362.rs ├── section_0363.rs ├── section_0364.rs ├── section_0365.rs ├── section_0366.rs ├── section_0367.rs ├── section_0368.rs ├── section_0369.rs ├── section_0370.rs ├── section_0371.rs ├── section_0372.rs ├── section_0373.rs ├── section_0374.rs ├── section_0375.rs ├── section_0376.rs ├── section_0377.rs ├── section_0378.rs ├── section_0379.rs ├── section_0380.rs ├── section_0381.rs ├── section_0382.rs ├── section_0383.rs ├── section_0384.rs ├── section_0385_to_0386.rs ├── section_0387.rs ├── section_0388.rs ├── section_0389.rs ├── section_0390.rs ├── section_0391.rs ├── section_0392.rs ├── section_0393.rs ├── section_0394.rs ├── section_0395_to_0396.rs ├── section_0397.rs ├── section_0398.rs ├── section_0399.rs ├── section_0400.rs ├── section_0401.rs ├── section_0402.rs ├── section_0403.rs ├── section_0404.rs ├── section_0405.rs ├── section_0406.rs ├── section_0407.rs ├── section_0408.rs ├── section_0409.rs ├── section_0410.rs ├── section_0411.rs ├── section_0412.rs ├── section_0413.rs ├── section_0414.rs ├── section_0415.rs ├── section_0416.rs ├── section_0417.rs ├── section_0418.rs ├── section_0419.rs ├── section_0420.rs ├── section_0421.rs ├── section_0422.rs ├── section_0423.rs ├── section_0424.rs ├── section_0425.rs ├── section_0426.rs ├── section_0427.rs ├── section_0428.rs ├── section_0429.rs ├── section_0430.rs ├── section_0431.rs ├── section_0432.rs ├── section_0433.rs ├── section_0434.rs ├── section_0435.rs ├── section_0436.rs ├── section_0437.rs ├── section_0438.rs ├── section_0439.rs ├── section_0440.rs ├── section_0441.rs ├── section_0442.rs ├── section_0443.rs ├── section_0444.rs ├── section_0445.rs ├── section_0446.rs ├── section_0447.rs ├── section_0448.rs ├── section_0449.rs ├── section_0450.rs ├── section_0451.rs ├── section_0452.rs ├── section_0453.rs ├── section_0454.rs ├── section_0455.rs ├── section_0456.rs ├── section_0457.rs ├── section_0458.rs ├── section_0459.rs ├── section_0460.rs ├── section_0461.rs ├── section_0462.rs ├── section_0463.rs ├── section_0464.rs ├── section_0465.rs ├── section_0466.rs ├── section_0467.rs ├── section_0468.rs ├── section_0469.rs ├── section_0470.rs ├── section_0471.rs ├── section_0472.rs ├── section_0473.rs ├── section_0474.rs ├── section_0475.rs ├── section_0476.rs ├── section_0477.rs ├── section_0478.rs ├── section_0479.rs ├── section_0480.rs ├── section_0481.rs ├── section_0482.rs ├── section_0483.rs ├── section_0484.rs ├── section_0485.rs ├── section_0486.rs ├── section_0487.rs ├── section_0488.rs ├── section_0489.rs ├── section_0490.rs ├── section_0491.rs ├── section_0492.rs ├── section_0493.rs ├── section_0494.rs ├── section_0495.rs ├── section_0496.rs ├── section_0497.rs ├── section_0498.rs ├── section_0499.rs ├── section_0500.rs ├── section_0501.rs ├── section_0502.rs ├── section_0503.rs ├── section_0504.rs ├── section_0505.rs ├── section_0506.rs ├── section_0507.rs ├── section_0508.rs ├── section_0509.rs ├── section_0510.rs ├── section_0511.rs ├── section_0512.rs ├── section_0513.rs ├── section_0514.rs ├── section_0515.rs ├── section_0516.rs ├── section_0517.rs ├── section_0518.rs ├── section_0519.rs ├── section_0520.rs ├── section_0521.rs ├── section_0522.rs ├── section_0523.rs ├── section_0524.rs ├── section_0525.rs ├── section_0526.rs ├── section_0527.rs ├── section_0528.rs ├── section_0529.rs ├── section_0530.rs ├── section_0531.rs ├── section_0532.rs ├── section_0533.rs ├── section_0534.rs ├── section_0535.rs ├── section_0536.rs ├── section_0537.rs ├── section_0538.rs ├── section_0539.rs ├── section_0540_to_0543.rs ├── section_0544.rs ├── section_0545.rs ├── section_0546.rs ├── section_0547.rs ├── section_0548.rs ├── section_0549.rs ├── section_0550.rs ├── section_0551.rs ├── section_0552.rs ├── section_0553.rs ├── section_0554.rs ├── section_0555.rs ├── section_0556.rs ├── section_0557.rs ├── section_0558.rs ├── section_0559.rs ├── section_0560.rs ├── section_0561.rs ├── section_0562.rs ├── section_0563.rs ├── section_0564.rs ├── section_0565.rs ├── section_0566.rs ├── section_0567.rs ├── section_0568.rs ├── section_0569.rs ├── section_0570.rs ├── section_0571.rs ├── section_0572.rs ├── section_0573.rs ├── section_0574.rs ├── section_0575.rs ├── section_0576.rs ├── section_0577.rs ├── section_0578.rs ├── section_0579.rs ├── section_0580.rs ├── section_0581.rs ├── section_0582.rs ├── section_0583.rs ├── section_0584.rs ├── section_0585.rs ├── section_0586.rs ├── section_0587.rs ├── section_0588.rs ├── section_0589.rs ├── section_0590.rs ├── section_0591.rs ├── section_0592.rs ├── section_0593.rs ├── section_0594.rs ├── section_0595.rs ├── section_0596.rs ├── section_0597.rs ├── section_0598.rs ├── section_0599.rs ├── section_0600.rs ├── section_0601.rs ├── section_0602.rs ├── section_0603.rs ├── section_0604.rs ├── section_0605.rs ├── section_0606.rs ├── section_0607.rs ├── section_0608.rs ├── section_0609.rs ├── section_0610.rs ├── section_0611.rs ├── section_0612.rs ├── section_0613.rs ├── section_0614.rs ├── section_0615.rs ├── section_0616.rs ├── section_0617.rs ├── section_0618.rs ├── section_0619.rs ├── section_0620.rs ├── section_0621.rs ├── section_0622.rs ├── section_0623.rs ├── section_0624.rs ├── section_0625.rs ├── section_0626.rs ├── section_0627.rs ├── section_0628.rs ├── section_0629.rs ├── section_0630.rs ├── section_0631.rs ├── section_0632.rs ├── section_0633.rs ├── section_0634.rs ├── section_0635.rs ├── section_0636.rs ├── section_0637.rs ├── section_0638.rs ├── section_0639.rs ├── section_0640.rs ├── section_0641.rs ├── section_0642.rs ├── section_0643.rs ├── section_0644.rs ├── section_0645.rs ├── section_0646.rs ├── section_0647.rs ├── section_0648.rs ├── section_0649.rs ├── section_0650.rs ├── section_0651.rs ├── section_0652.rs ├── section_0653.rs ├── section_0654.rs ├── section_0655.rs ├── section_0656.rs ├── section_0657.rs ├── section_0658.rs ├── section_0659.rs ├── section_0660.rs ├── section_0661.rs ├── section_0662.rs ├── section_0663.rs ├── section_0664.rs ├── section_0665.rs ├── section_0666.rs ├── section_0667.rs ├── section_0668.rs ├── section_0669.rs ├── section_0670.rs ├── section_0671.rs ├── section_0672.rs ├── section_0673.rs ├── section_0674.rs ├── section_0675.rs ├── section_0676.rs ├── section_0677.rs ├── section_0678.rs ├── section_0679.rs ├── section_0680.rs ├── section_0681.rs ├── section_0682.rs ├── section_0683.rs ├── section_0684.rs ├── section_0685.rs ├── section_0686.rs ├── section_0687.rs ├── section_0688.rs ├── section_0689.rs ├── section_0690.rs ├── section_0691_to_0693.rs ├── section_0694.rs ├── section_0695_to_0697.rs ├── section_0698.rs ├── section_0699.rs ├── section_0700.rs ├── section_0701.rs ├── section_0702.rs ├── section_0703.rs ├── section_0704.rs ├── section_0705.rs ├── section_0706.rs ├── section_0707.rs ├── section_0708.rs ├── section_0709.rs ├── section_0710.rs ├── section_0711.rs ├── section_0712.rs ├── section_0713.rs ├── section_0714.rs ├── section_0715.rs ├── section_0716.rs ├── section_0717.rs ├── section_0718.rs ├── section_0719.rs ├── section_0720.rs ├── section_0721.rs ├── section_0722.rs ├── section_0723.rs ├── section_0724.rs ├── section_0725.rs ├── section_0726.rs ├── section_0727.rs ├── section_0728.rs ├── section_0729.rs ├── section_0730.rs ├── section_0731.rs ├── section_0732.rs ├── section_0733.rs ├── section_0734.rs ├── section_0735.rs ├── section_0736.rs ├── section_0737.rs ├── section_0738.rs ├── section_0739.rs ├── section_0740.rs ├── section_0741.rs ├── section_0742.rs ├── section_0743.rs ├── section_0744.rs ├── section_0745.rs ├── section_0746.rs ├── section_0747.rs ├── section_0748.rs ├── section_0749.rs ├── section_0750.rs ├── section_0751.rs ├── section_0752.rs ├── section_0753.rs ├── section_0754.rs ├── section_0755.rs ├── section_0756.rs ├── section_0757.rs ├── section_0758.rs ├── section_0759.rs ├── section_0760.rs ├── section_0761.rs ├── section_0762.rs ├── section_0763.rs ├── section_0764.rs ├── section_0765.rs ├── section_0766.rs ├── section_0767.rs ├── section_0768.rs ├── section_0769.rs ├── section_0770.rs ├── section_0771.rs ├── section_0772.rs ├── section_0773.rs ├── section_0774.rs ├── section_0775.rs ├── section_0776.rs ├── section_0777.rs ├── section_0778.rs ├── section_0779.rs ├── section_0780.rs ├── section_0781.rs ├── section_0782.rs ├── section_0783.rs ├── section_0784.rs ├── section_0785.rs ├── section_0786.rs ├── section_0787.rs ├── section_0788.rs ├── section_0789.rs ├── section_0790.rs ├── section_0791.rs ├── section_0792.rs ├── section_0793.rs ├── section_0794.rs ├── section_0795.rs ├── section_0796.rs ├── section_0797.rs ├── section_0798.rs ├── section_0799.rs ├── section_0800.rs ├── section_0801.rs ├── section_0802.rs ├── section_0803.rs ├── section_0804.rs ├── section_0805.rs ├── section_0806.rs ├── section_0807.rs ├── section_0808.rs ├── section_0809.rs ├── section_0810.rs ├── section_0811.rs ├── section_0812.rs ├── section_0813.rs ├── section_0814.rs ├── section_0815.rs ├── section_0816.rs ├── section_0817.rs ├── section_0818.rs ├── section_0819.rs ├── section_0820.rs ├── section_0821.rs ├── section_0822.rs ├── section_0823.rs ├── section_0824.rs ├── section_0825.rs ├── section_0826.rs ├── section_0827.rs ├── section_0828.rs ├── section_0829.rs ├── section_0830.rs ├── section_0831.rs ├── section_0832.rs ├── section_0833.rs ├── section_0834.rs ├── section_0835.rs ├── section_0836.rs ├── section_0837.rs ├── section_0838.rs ├── section_0839.rs ├── section_0840.rs ├── section_0841.rs ├── section_0842.rs ├── section_0843.rs ├── section_0844.rs ├── section_0845.rs ├── section_0846.rs ├── section_0847.rs ├── section_0848.rs ├── section_0849.rs ├── section_0850.rs ├── section_0851.rs ├── section_0852.rs ├── section_0853.rs ├── section_0854.rs ├── section_0855.rs ├── section_0856.rs ├── section_0857.rs ├── section_0858.rs ├── section_0859.rs ├── section_0860.rs ├── section_0861.rs ├── section_0862.rs ├── section_0863.rs ├── section_0864.rs ├── section_0865.rs ├── section_0866.rs ├── section_0867.rs ├── section_0868.rs ├── section_0869.rs ├── section_0870.rs ├── section_0871.rs ├── section_0872.rs ├── section_0873.rs ├── section_0874.rs ├── section_0875.rs ├── section_0876.rs ├── section_0877.rs ├── section_0878.rs ├── section_0879.rs ├── section_0880.rs ├── section_0881.rs ├── section_0882.rs ├── section_0883.rs ├── section_0884.rs ├── section_0885.rs ├── section_0886.rs ├── section_0887.rs ├── section_0888.rs ├── section_0889.rs ├── section_0890.rs ├── section_0891.rs ├── section_0892.rs ├── section_0893.rs ├── section_0894.rs ├── section_0895.rs ├── section_0896.rs ├── section_0897.rs ├── section_0898.rs ├── section_0899.rs ├── section_0900.rs ├── section_0901.rs ├── section_0902.rs ├── section_0903.rs ├── section_0904.rs ├── section_0905.rs ├── section_0906.rs ├── section_0907.rs ├── section_0908.rs ├── section_0909.rs ├── section_0910.rs ├── section_0911.rs ├── section_0912.rs ├── section_0913.rs ├── section_0914.rs ├── section_0915.rs ├── section_0916.rs ├── section_0917.rs ├── section_0918.rs ├── section_0919.rs ├── section_0920.rs ├── section_0921.rs ├── section_0922.rs ├── section_0923.rs ├── section_0924.rs ├── section_0925.rs ├── section_0926.rs ├── section_0927_to_0929.rs ├── section_0930.rs ├── section_0931.rs ├── section_0932.rs ├── section_0933.rs ├── section_0934.rs ├── section_0935.rs ├── section_0936.rs ├── section_0937.rs ├── section_0938.rs ├── section_0939.rs ├── section_0940.rs ├── section_0941.rs ├── section_0942.rs ├── section_0943.rs ├── section_0944.rs ├── section_0945.rs ├── section_0946.rs ├── section_0947.rs ├── section_0948.rs ├── section_0949.rs ├── section_0950.rs ├── section_0951.rs ├── section_0952.rs ├── section_0953.rs ├── section_0954.rs ├── section_0955.rs ├── section_0956.rs ├── section_0957.rs ├── section_0958.rs ├── section_0959.rs ├── section_0960.rs ├── section_0961.rs ├── section_0962.rs ├── section_0963.rs ├── section_0964.rs ├── section_0965.rs ├── section_0966.rs ├── section_0967.rs ├── section_0968.rs ├── section_0969.rs ├── section_0970.rs ├── section_0971.rs ├── section_0972.rs ├── section_0973.rs ├── section_0974.rs ├── section_0975.rs ├── section_0976.rs ├── section_0977.rs ├── section_0978.rs ├── section_0979.rs ├── section_0980.rs ├── section_0981.rs ├── section_0982.rs ├── section_0983.rs ├── section_0984.rs ├── section_0985.rs ├── section_0986.rs ├── section_0987.rs ├── section_0988.rs ├── section_0989.rs ├── section_0990.rs ├── section_0991.rs ├── section_0992.rs ├── section_0993.rs ├── section_0994.rs ├── section_0995.rs ├── section_0996.rs ├── section_0997.rs ├── section_0998.rs ├── section_0999.rs ├── section_1000.rs ├── section_1001.rs ├── section_1002.rs ├── section_1003.rs ├── section_1004.rs ├── section_1005.rs ├── section_1006.rs ├── section_1007.rs ├── section_1008.rs ├── section_1009.rs ├── section_1010.rs ├── section_1011.rs ├── section_1012.rs ├── section_1013.rs ├── section_1014.rs ├── section_1015.rs ├── section_1016.rs ├── section_1017.rs ├── section_1018.rs ├── section_1019.rs ├── section_1020.rs ├── section_1021.rs ├── section_1022.rs ├── section_1023_to_1024.rs ├── section_1025.rs ├── section_1026.rs ├── section_1027.rs ├── section_1028.rs ├── section_1029.rs ├── section_1030.rs ├── section_1031.rs ├── section_1032.rs ├── section_1033.rs ├── section_1034.rs ├── section_1035.rs ├── section_1036.rs ├── section_1037.rs ├── section_1038.rs ├── section_1039.rs ├── section_1040.rs ├── section_1041.rs ├── section_1042.rs ├── section_1043.rs ├── section_1044.rs ├── section_1045.rs ├── section_1046.rs ├── section_1047.rs ├── section_1048.rs ├── section_1049.rs ├── section_1050.rs ├── section_1051.rs ├── section_1052.rs ├── section_1053.rs ├── section_1054.rs ├── section_1055.rs ├── section_1056.rs ├── section_1057.rs ├── section_1058.rs ├── section_1059.rs ├── section_1060.rs ├── section_1061.rs ├── section_1062.rs ├── section_1063.rs ├── section_1064.rs ├── section_1065.rs ├── section_1066.rs ├── section_1067.rs ├── section_1068.rs ├── section_1069.rs ├── section_1070.rs ├── section_1071.rs ├── section_1072.rs ├── section_1073.rs ├── section_1074.rs ├── section_1075.rs ├── section_1076.rs ├── section_1077.rs ├── section_1078.rs ├── section_1079.rs ├── section_1080.rs ├── section_1081.rs ├── section_1082.rs ├── section_1083.rs ├── section_1084.rs ├── section_1085.rs ├── section_1086.rs ├── section_1087.rs ├── section_1088.rs ├── section_1089.rs ├── section_1090.rs ├── section_1091.rs ├── section_1092.rs ├── section_1093.rs ├── section_1094.rs ├── section_1095.rs ├── section_1096.rs ├── section_1097.rs ├── section_1098.rs ├── section_1099.rs ├── section_1100.rs ├── section_1101.rs ├── section_1102.rs ├── section_1103.rs ├── section_1104.rs ├── section_1105.rs ├── section_1106.rs ├── section_1107.rs ├── section_1108.rs ├── section_1109.rs ├── section_1110.rs ├── section_1111.rs ├── section_1112.rs ├── section_1113.rs ├── section_1114.rs ├── section_1115.rs ├── section_1116.rs ├── section_1117.rs ├── section_1118.rs ├── section_1119.rs ├── section_1120.rs ├── section_1121.rs ├── section_1122.rs ├── section_1123.rs ├── section_1124.rs ├── section_1125.rs ├── section_1126.rs ├── section_1127.rs ├── section_1128.rs ├── section_1129.rs ├── section_1130.rs ├── section_1131.rs ├── section_1132.rs ├── section_1133.rs ├── section_1134_to_1135.rs ├── section_1136.rs ├── section_1137.rs ├── section_1138.rs ├── section_1139.rs ├── section_1140.rs ├── section_1141.rs ├── section_1142.rs ├── section_1143.rs ├── section_1144.rs ├── section_1145.rs ├── section_1146.rs ├── section_1147.rs ├── section_1148.rs ├── section_1149.rs ├── section_1150.rs ├── section_1151.rs ├── section_1152.rs ├── section_1153.rs ├── section_1154.rs ├── section_1155.rs ├── section_1156.rs ├── section_1157.rs ├── section_1158.rs ├── section_1159.rs ├── section_1160.rs ├── section_1161.rs ├── section_1162.rs ├── section_1163.rs ├── section_1164.rs ├── section_1165.rs ├── section_1166.rs ├── section_1167.rs ├── section_1168.rs ├── section_1169.rs ├── section_1170.rs ├── section_1171.rs ├── section_1172.rs ├── section_1173.rs ├── section_1174.rs ├── section_1175.rs ├── section_1176.rs ├── section_1177.rs ├── section_1178.rs ├── section_1179.rs ├── section_1180.rs ├── section_1181.rs ├── section_1182.rs ├── section_1183.rs ├── section_1184.rs ├── section_1185.rs ├── section_1186.rs ├── section_1187.rs ├── section_1188.rs ├── section_1189.rs ├── section_1190.rs ├── section_1191.rs ├── section_1192.rs ├── section_1193.rs ├── section_1194.rs ├── section_1195.rs ├── section_1196.rs ├── section_1197.rs ├── section_1198.rs ├── section_1199.rs ├── section_1200.rs ├── section_1201.rs ├── section_1202.rs ├── section_1203.rs ├── section_1204.rs ├── section_1205.rs ├── section_1206.rs ├── section_1207.rs ├── section_1208.rs ├── section_1209.rs ├── section_1210.rs ├── section_1211.rs ├── section_1212.rs ├── section_1213.rs ├── section_1214.rs ├── section_1215.rs ├── section_1216.rs ├── section_1217.rs ├── section_1218.rs ├── section_1219.rs ├── section_1220.rs ├── section_1221.rs ├── section_1222.rs ├── section_1223.rs ├── section_1224.rs ├── section_1225.rs ├── section_1226.rs ├── section_1227.rs ├── section_1228.rs ├── section_1229.rs ├── section_1230.rs ├── section_1231.rs ├── section_1232.rs ├── section_1233.rs ├── section_1234.rs ├── section_1235.rs ├── section_1236.rs ├── section_1237.rs ├── section_1238.rs ├── section_1239.rs ├── section_1240.rs ├── section_1241.rs ├── section_1242.rs ├── section_1243.rs ├── section_1244.rs ├── section_1245.rs ├── section_1246.rs ├── section_1247.rs ├── section_1248.rs ├── section_1249.rs ├── section_1250.rs ├── section_1251.rs ├── section_1252.rs ├── section_1253.rs ├── section_1254.rs ├── section_1255.rs ├── section_1256.rs ├── section_1257.rs ├── section_1258.rs ├── section_1259.rs ├── section_1260.rs ├── section_1261.rs ├── section_1262.rs ├── section_1263.rs ├── section_1264.rs ├── section_1265.rs ├── section_1266.rs ├── section_1267.rs ├── section_1268.rs ├── section_1269.rs ├── section_1270.rs ├── section_1271.rs ├── section_1272.rs ├── section_1273.rs ├── section_1274.rs ├── section_1275.rs ├── section_1276.rs ├── section_1277.rs ├── section_1278.rs ├── section_1279.rs ├── section_1280.rs ├── section_1281.rs ├── section_1282.rs ├── section_1283.rs ├── section_1284.rs ├── section_1285.rs ├── section_1286.rs ├── section_1287.rs ├── section_1288.rs ├── section_1289.rs ├── section_1290.rs ├── section_1291.rs ├── section_1292.rs ├── section_1293.rs ├── section_1294.rs ├── section_1295.rs ├── section_1296.rs ├── section_1297.rs ├── section_1298.rs ├── section_1299.rs ├── section_1300.rs ├── section_1301.rs ├── section_1302.rs ├── section_1303.rs ├── section_1304.rs ├── section_1305.rs ├── section_1306.rs ├── section_1307.rs ├── section_1308.rs ├── section_1309.rs ├── section_1310.rs ├── section_1311.rs ├── section_1312.rs ├── section_1313.rs ├── section_1314.rs ├── section_1315.rs ├── section_1316.rs ├── section_1317.rs ├── section_1318.rs ├── section_1319.rs ├── section_1320.rs ├── section_1321.rs ├── section_1322.rs ├── section_1323.rs ├── section_1324.rs ├── section_1325.rs ├── section_1326.rs ├── section_1327.rs ├── section_1328.rs ├── section_1329.rs ├── section_1330.rs ├── section_1331.rs ├── section_1332.rs ├── section_1333.rs ├── section_1334.rs ├── section_1335.rs ├── section_1336.rs ├── section_1337.rs ├── section_1338.rs ├── section_1339.rs ├── section_1340.rs ├── section_1341.rs ├── section_1342.rs ├── section_1343.rs ├── section_1344.rs ├── section_1345.rs ├── section_1346.rs ├── section_1347.rs ├── section_1348.rs ├── section_1349.rs ├── section_1350.rs ├── section_1351.rs ├── section_1352.rs ├── section_1353.rs ├── section_1354.rs ├── section_1355.rs ├── section_1356.rs ├── section_1357.rs ├── section_1358.rs ├── section_1359.rs ├── section_1360.rs ├── section_1361.rs ├── section_1362.rs ├── section_1363.rs ├── section_1364.rs ├── section_1365.rs ├── section_1366.rs ├── section_1367.rs ├── section_1368_to_1369.rs ├── section_1370.rs ├── section_1371.rs ├── section_1372.rs ├── section_1373.rs ├── section_1374.rs ├── section_1375.rs ├── section_1376.rs ├── section_1377.rs ├── section_1378.rs ├── section_1379.rs └── section_1380.rs └── unicode_support.rs /.gitattributes: -------------------------------------------------------------------------------- 1 | *.tex binary 2 | *.fmt binary 3 | *.tfm binary 4 | *.mf binary 5 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /target 2 | Cargo.lock 3 | -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "editor.formatOnSave": true, 3 | "editor.formatOnPaste": true 4 | } -------------------------------------------------------------------------------- /cli/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "tex-cli" 3 | version = "0.1.0" 4 | edition = "2021" 5 | 6 | [features] 7 | unicode_support = ['tex/unicode_support'] 8 | debugging = ['tex/debugging'] 9 | trace = ['tex/trace', 'tracing', 'tracing-subscriber', 'tracing-tree'] 10 | statistics = ['tex/statistics'] 11 | 12 | [dependencies] 13 | structopt = "0.3" 14 | tex = {path = ".."} 15 | tracing = { version = "0.1.26", optional = true } 16 | tracing-subscriber = { version = "0.2", optional = true } 17 | tracing-tree = { version = "0.1.10", optional = true } 18 | 19 | [dev-dependencies] 20 | pretty_assertions = "0.7.2" 21 | rayon = "1.5.1" 22 | vfs_crate = {version = "0.5.1", package = "vfs"} 23 | 24 | -------------------------------------------------------------------------------- /cli/tests_data/dvi_result/plain_helloworld.dvi: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crlf0710/tex-rs/8383bc4bae740c4a511872725647ee3cf1c12197/cli/tests_data/dvi_result/plain_helloworld.dvi -------------------------------------------------------------------------------- /cli/tests_data/plain/cmbsy10.tfm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crlf0710/tex-rs/8383bc4bae740c4a511872725647ee3cf1c12197/cli/tests_data/plain/cmbsy10.tfm -------------------------------------------------------------------------------- /cli/tests_data/plain/cmbx10.tfm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crlf0710/tex-rs/8383bc4bae740c4a511872725647ee3cf1c12197/cli/tests_data/plain/cmbx10.tfm -------------------------------------------------------------------------------- /cli/tests_data/plain/cmbx5.tfm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crlf0710/tex-rs/8383bc4bae740c4a511872725647ee3cf1c12197/cli/tests_data/plain/cmbx5.tfm -------------------------------------------------------------------------------- /cli/tests_data/plain/cmbx6.tfm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crlf0710/tex-rs/8383bc4bae740c4a511872725647ee3cf1c12197/cli/tests_data/plain/cmbx6.tfm -------------------------------------------------------------------------------- /cli/tests_data/plain/cmbx7.tfm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crlf0710/tex-rs/8383bc4bae740c4a511872725647ee3cf1c12197/cli/tests_data/plain/cmbx7.tfm -------------------------------------------------------------------------------- /cli/tests_data/plain/cmbx8.tfm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crlf0710/tex-rs/8383bc4bae740c4a511872725647ee3cf1c12197/cli/tests_data/plain/cmbx8.tfm -------------------------------------------------------------------------------- /cli/tests_data/plain/cmbx9.tfm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crlf0710/tex-rs/8383bc4bae740c4a511872725647ee3cf1c12197/cli/tests_data/plain/cmbx9.tfm -------------------------------------------------------------------------------- /cli/tests_data/plain/cmcsc10.tfm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crlf0710/tex-rs/8383bc4bae740c4a511872725647ee3cf1c12197/cli/tests_data/plain/cmcsc10.tfm -------------------------------------------------------------------------------- /cli/tests_data/plain/cmdunh10.tfm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crlf0710/tex-rs/8383bc4bae740c4a511872725647ee3cf1c12197/cli/tests_data/plain/cmdunh10.tfm -------------------------------------------------------------------------------- /cli/tests_data/plain/cmex10.tfm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crlf0710/tex-rs/8383bc4bae740c4a511872725647ee3cf1c12197/cli/tests_data/plain/cmex10.tfm -------------------------------------------------------------------------------- /cli/tests_data/plain/cmmi10.tfm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crlf0710/tex-rs/8383bc4bae740c4a511872725647ee3cf1c12197/cli/tests_data/plain/cmmi10.tfm -------------------------------------------------------------------------------- /cli/tests_data/plain/cmmi5.tfm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crlf0710/tex-rs/8383bc4bae740c4a511872725647ee3cf1c12197/cli/tests_data/plain/cmmi5.tfm -------------------------------------------------------------------------------- /cli/tests_data/plain/cmmi6.tfm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crlf0710/tex-rs/8383bc4bae740c4a511872725647ee3cf1c12197/cli/tests_data/plain/cmmi6.tfm -------------------------------------------------------------------------------- /cli/tests_data/plain/cmmi7.tfm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crlf0710/tex-rs/8383bc4bae740c4a511872725647ee3cf1c12197/cli/tests_data/plain/cmmi7.tfm -------------------------------------------------------------------------------- /cli/tests_data/plain/cmmi8.tfm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crlf0710/tex-rs/8383bc4bae740c4a511872725647ee3cf1c12197/cli/tests_data/plain/cmmi8.tfm -------------------------------------------------------------------------------- /cli/tests_data/plain/cmmi9.tfm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crlf0710/tex-rs/8383bc4bae740c4a511872725647ee3cf1c12197/cli/tests_data/plain/cmmi9.tfm -------------------------------------------------------------------------------- /cli/tests_data/plain/cmmib10.tfm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crlf0710/tex-rs/8383bc4bae740c4a511872725647ee3cf1c12197/cli/tests_data/plain/cmmib10.tfm -------------------------------------------------------------------------------- /cli/tests_data/plain/cmr10.tfm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crlf0710/tex-rs/8383bc4bae740c4a511872725647ee3cf1c12197/cli/tests_data/plain/cmr10.tfm -------------------------------------------------------------------------------- /cli/tests_data/plain/cmr5.tfm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crlf0710/tex-rs/8383bc4bae740c4a511872725647ee3cf1c12197/cli/tests_data/plain/cmr5.tfm -------------------------------------------------------------------------------- /cli/tests_data/plain/cmr6.tfm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crlf0710/tex-rs/8383bc4bae740c4a511872725647ee3cf1c12197/cli/tests_data/plain/cmr6.tfm -------------------------------------------------------------------------------- /cli/tests_data/plain/cmr7.tfm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crlf0710/tex-rs/8383bc4bae740c4a511872725647ee3cf1c12197/cli/tests_data/plain/cmr7.tfm -------------------------------------------------------------------------------- /cli/tests_data/plain/cmr8.tfm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crlf0710/tex-rs/8383bc4bae740c4a511872725647ee3cf1c12197/cli/tests_data/plain/cmr8.tfm -------------------------------------------------------------------------------- /cli/tests_data/plain/cmr9.tfm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crlf0710/tex-rs/8383bc4bae740c4a511872725647ee3cf1c12197/cli/tests_data/plain/cmr9.tfm -------------------------------------------------------------------------------- /cli/tests_data/plain/cmsl10.tfm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crlf0710/tex-rs/8383bc4bae740c4a511872725647ee3cf1c12197/cli/tests_data/plain/cmsl10.tfm -------------------------------------------------------------------------------- /cli/tests_data/plain/cmsl8.tfm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crlf0710/tex-rs/8383bc4bae740c4a511872725647ee3cf1c12197/cli/tests_data/plain/cmsl8.tfm -------------------------------------------------------------------------------- /cli/tests_data/plain/cmsl9.tfm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crlf0710/tex-rs/8383bc4bae740c4a511872725647ee3cf1c12197/cli/tests_data/plain/cmsl9.tfm -------------------------------------------------------------------------------- /cli/tests_data/plain/cmsltt10.tfm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crlf0710/tex-rs/8383bc4bae740c4a511872725647ee3cf1c12197/cli/tests_data/plain/cmsltt10.tfm -------------------------------------------------------------------------------- /cli/tests_data/plain/cmss10.tfm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crlf0710/tex-rs/8383bc4bae740c4a511872725647ee3cf1c12197/cli/tests_data/plain/cmss10.tfm -------------------------------------------------------------------------------- /cli/tests_data/plain/cmssbx10.tfm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crlf0710/tex-rs/8383bc4bae740c4a511872725647ee3cf1c12197/cli/tests_data/plain/cmssbx10.tfm -------------------------------------------------------------------------------- /cli/tests_data/plain/cmssi10.tfm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crlf0710/tex-rs/8383bc4bae740c4a511872725647ee3cf1c12197/cli/tests_data/plain/cmssi10.tfm -------------------------------------------------------------------------------- /cli/tests_data/plain/cmssq8.tfm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crlf0710/tex-rs/8383bc4bae740c4a511872725647ee3cf1c12197/cli/tests_data/plain/cmssq8.tfm -------------------------------------------------------------------------------- /cli/tests_data/plain/cmssqi8.tfm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crlf0710/tex-rs/8383bc4bae740c4a511872725647ee3cf1c12197/cli/tests_data/plain/cmssqi8.tfm -------------------------------------------------------------------------------- /cli/tests_data/plain/cmsy10.tfm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crlf0710/tex-rs/8383bc4bae740c4a511872725647ee3cf1c12197/cli/tests_data/plain/cmsy10.tfm -------------------------------------------------------------------------------- /cli/tests_data/plain/cmsy5.tfm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crlf0710/tex-rs/8383bc4bae740c4a511872725647ee3cf1c12197/cli/tests_data/plain/cmsy5.tfm -------------------------------------------------------------------------------- /cli/tests_data/plain/cmsy6.tfm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crlf0710/tex-rs/8383bc4bae740c4a511872725647ee3cf1c12197/cli/tests_data/plain/cmsy6.tfm -------------------------------------------------------------------------------- /cli/tests_data/plain/cmsy7.tfm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crlf0710/tex-rs/8383bc4bae740c4a511872725647ee3cf1c12197/cli/tests_data/plain/cmsy7.tfm -------------------------------------------------------------------------------- /cli/tests_data/plain/cmsy8.tfm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crlf0710/tex-rs/8383bc4bae740c4a511872725647ee3cf1c12197/cli/tests_data/plain/cmsy8.tfm -------------------------------------------------------------------------------- /cli/tests_data/plain/cmsy9.tfm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crlf0710/tex-rs/8383bc4bae740c4a511872725647ee3cf1c12197/cli/tests_data/plain/cmsy9.tfm -------------------------------------------------------------------------------- /cli/tests_data/plain/cmti10.tfm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crlf0710/tex-rs/8383bc4bae740c4a511872725647ee3cf1c12197/cli/tests_data/plain/cmti10.tfm -------------------------------------------------------------------------------- /cli/tests_data/plain/cmti7.tfm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crlf0710/tex-rs/8383bc4bae740c4a511872725647ee3cf1c12197/cli/tests_data/plain/cmti7.tfm -------------------------------------------------------------------------------- /cli/tests_data/plain/cmti8.tfm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crlf0710/tex-rs/8383bc4bae740c4a511872725647ee3cf1c12197/cli/tests_data/plain/cmti8.tfm -------------------------------------------------------------------------------- /cli/tests_data/plain/cmti9.tfm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crlf0710/tex-rs/8383bc4bae740c4a511872725647ee3cf1c12197/cli/tests_data/plain/cmti9.tfm -------------------------------------------------------------------------------- /cli/tests_data/plain/cmtt10.tfm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crlf0710/tex-rs/8383bc4bae740c4a511872725647ee3cf1c12197/cli/tests_data/plain/cmtt10.tfm -------------------------------------------------------------------------------- /cli/tests_data/plain/cmtt8.tfm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crlf0710/tex-rs/8383bc4bae740c4a511872725647ee3cf1c12197/cli/tests_data/plain/cmtt8.tfm -------------------------------------------------------------------------------- /cli/tests_data/plain/cmtt9.tfm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crlf0710/tex-rs/8383bc4bae740c4a511872725647ee3cf1c12197/cli/tests_data/plain/cmtt9.tfm -------------------------------------------------------------------------------- /cli/tests_data/plain/cmu10.tfm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crlf0710/tex-rs/8383bc4bae740c4a511872725647ee3cf1c12197/cli/tests_data/plain/cmu10.tfm -------------------------------------------------------------------------------- /cli/tests_data/plain/manfnt.tfm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crlf0710/tex-rs/8383bc4bae740c4a511872725647ee3cf1c12197/cli/tests_data/plain/manfnt.tfm -------------------------------------------------------------------------------- /cli/tests_data/plain_dmp/plain.fmt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crlf0710/tex-rs/8383bc4bae740c4a511872725647ee3cf1c12197/cli/tests_data/plain_dmp/plain.fmt -------------------------------------------------------------------------------- /cli/tests_data/trip/trip.dvi: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crlf0710/tex-rs/8383bc4bae740c4a511872725647ee3cf1c12197/cli/tests_data/trip/trip.dvi -------------------------------------------------------------------------------- /cli/tests_data/trip/trip.tfm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crlf0710/tex-rs/8383bc4bae740c4a511872725647ee3cf1c12197/cli/tests_data/trip/trip.tfm -------------------------------------------------------------------------------- /cli/tests_data/trip/tripos.tex: -------------------------------------------------------------------------------- 1 | 2 | \uppercase {0{\outputpenalty }} 3 | [\uppercase {mmmmmmmmmm}[ 4 | -------------------------------------------------------------------------------- /rust-toolchain: -------------------------------------------------------------------------------- 1 | nightly -------------------------------------------------------------------------------- /src/tex_the_program/section_0005.rs: -------------------------------------------------------------------------------- 1 | //! @ The overall \TeX\ program begins with the heading just shown, after which 2 | //! comes a bunch of procedure declarations and function declarations. 3 | //! Finally we will get to the main program, which begins with the 4 | //! comment `|start_here|'. If you want to skip down to the 5 | //! main program now, you can look up `|start_here|' in the index. 6 | //! But the author suggests that the best way to understand this program 7 | //! is to follow pretty much the order of \TeX's components as they appear in the 8 | //! \.{WEB} description you are now reading, since the present ordering is 9 | //! intended to combine the advantages of the ``bottom up'' and ``top down'' 10 | //! approaches to the problem of understanding a somewhat complicated system. 11 | 12 | crate::migration_complete!(); 13 | -------------------------------------------------------------------------------- /src/tex_the_program/section_0006.rs: -------------------------------------------------------------------------------- 1 | //! @ Three labels must be declared in the main program, so we give them 2 | //! symbolic names. 3 | //! 4 | //! @d start_of_TEX=1 {go here when \TeX's variables are initialized} 5 | //! @d end_of_TEX=9998 {go here to close files and terminate gracefully} 6 | //! @d final_end=9999 {this label marks the ending of the program} 7 | -------------------------------------------------------------------------------- /src/tex_the_program/section_0013.rs: -------------------------------------------------------------------------------- 1 | //! @ In case somebody has inadvertently made bad settings of the ``constants,'' 2 | //! \TeX\ checks them using a global variable called |bad|. 3 | //! 4 | //! This is the first of many sections of \TeX\ where global variables are 5 | //! defined. 6 | // 7 | // @= 8 | // @!bad:integer; {is some ``constant'' wrong?} 9 | /// is some "constant" wrong? 10 | #[globals_struct_field(TeXGlobals)] 11 | pub(crate) static bad: integer = 0; 12 | 13 | #[globals_struct_use(TeXGlobals)] 14 | use crate::pascal::integer; 15 | 16 | use crate::section_0004::TeXGlobals; 17 | use globals_struct::{globals_struct_field, globals_struct_use}; 18 | -------------------------------------------------------------------------------- /src/tex_the_program/section_0014.rs: -------------------------------------------------------------------------------- 1 | //! @ Later on we will say `\ignorespaces|if mem_max>=max_halfword then bad:=14|', 2 | //! or something similar. (We can't do that until |max_halfword| has been defined.) 3 | // 4 | // @= 5 | // bad:=0; 6 | // if (half_error_line<30)or(half_error_line>error_line-15) then bad:=1; 7 | // if max_print_line<60 then bad:=2; 8 | // if dvi_buf_size mod 8<>0 then bad:=3; 9 | // if mem_bot+1100>mem_top then bad:=4; 10 | // if hash_prime>hash_size then bad:=5; 11 | // if max_in_open>=128 then bad:=6; 12 | // if mem_top<256+11 then bad:=7; {we will want |null_list>255|} 13 | // 14 | -------------------------------------------------------------------------------- /src/tex_the_program/section_0022.rs: -------------------------------------------------------------------------------- 1 | //! @ Some of the ASCII codes without visible characters have been given symbolic 2 | //! names in this program because they are used with a special meaning. 3 | // 4 | // @d null_code=@'0 {ASCII code that might disappear} 5 | /// ASCII code that might disappear 6 | pub(crate) const null_code: u8 = 0o0; 7 | // @d carriage_return=@'15 {ASCII code used at end of line} 8 | /// ASCII code used at end of line 9 | pub(crate) const carriage_return: u8 = 0o15; 10 | // @d invalid_code=@'177 {ASCII code that many systems prohibit in text files} 11 | /// ASCII code that many systems prohibit in text files 12 | pub(crate) const invalid_code: u8 = 0o177; 13 | -------------------------------------------------------------------------------- /src/tex_the_program/section_0024.rs: -------------------------------------------------------------------------------- 1 | //! @ The following system-independent code makes the |xord| array contain a 2 | //! suitable inverse to the information in |xchr|. Note that if |xchr[i]=xchr[j]| 3 | //! where |i= 8 | //! for i:=first_text_char to last_text_char do xord[chr(i)]:=invalid_code; 9 | //! for i:=@'200 to @'377 do xord[xchr[i]]:=i; 10 | //! for i:=0 to @'176 do xord[xchr[i]]:=i; 11 | //! 12 | -------------------------------------------------------------------------------- /src/tex_the_program/section_0029.rs: -------------------------------------------------------------------------------- 1 | //! @ Binary input and output are done with \PASCAL's ordinary |get| and |put| 2 | //! procedures, so we don't have to make any other special arrangements for 3 | //! binary~I/O. Text output is also easy to do with standard \PASCAL\ routines. 4 | //! The treatment of text input is more difficult, however, because 5 | //! of the necessary translation to |ASCII_code| values. 6 | //! \TeX's conventions should be efficient, and they should 7 | //! blend nicely with the user's operating environment. 8 | //! 9 | 10 | crate::migration_complete!(); 11 | -------------------------------------------------------------------------------- /src/tex_the_program/section_0033.rs: -------------------------------------------------------------------------------- 1 | //! @ Here is how to open the terminal files 2 | //! in \ph. The `\.{/I}' switch suppresses the first |get|. 3 | //! @:PASCAL H}{\ph@> 4 | //! @^system dependencies@> 5 | // 6 | // @d t_open_in==reset(term_in,'TTY:','/O/I') {open the terminal for text input} 7 | 8 | /// open the terminal for text input 9 | pub(crate) fn t_open_in(globals: &mut TeXGlobals) { 10 | reset(&mut globals.term_in, "TTY:", "/O/I"); 11 | } 12 | 13 | // @d t_open_out==rewrite(term_out,'TTY:','/O') {open the terminal for text output} 14 | pub(crate) fn t_open_out(globals: &mut TeXGlobals) { 15 | rewrite(&mut globals.term_out, "TTY:", "/O"); 16 | } 17 | 18 | use crate::io_support::{reset, rewrite}; 19 | use crate::section_0004::TeXGlobals; 20 | -------------------------------------------------------------------------------- /src/tex_the_program/section_0040.rs: -------------------------------------------------------------------------------- 1 | //! @ Several of the elementary string operations are performed using \.{WEB} 2 | //! macros instead of \PASCAL\ procedures, because many of the 3 | //! operations are done quite frequently and we want to avoid the 4 | //! overhead of procedure calls. For example, here is 5 | //! a simple macro that computes the length of a string. 6 | //! @.WEB@> 7 | // 8 | // @d length(#)==(str_start[#+1]-str_start[#]) {the number of characters 9 | // in string number \#} 10 | #[cfg_attr( 11 | feature = "trace_verbose", 12 | tracing::instrument(level = "trace", skip(globals)) 13 | )] 14 | pub(crate) fn length(globals: &TeXGlobals, s: integer) -> integer { 15 | globals.str_start[(s + 1) as u32] - globals.str_start[s as u32] 16 | } 17 | 18 | use crate::pascal::integer; 19 | use crate::TeXGlobals; 20 | -------------------------------------------------------------------------------- /src/tex_the_program/section_0041.rs: -------------------------------------------------------------------------------- 1 | //! @ The length of the current string is called |cur_length|: 2 | // 3 | // @d cur_length == (pool_ptr - str_start[str_ptr]) 4 | pub(crate) macro cur_length($globals:expr) { 5 | ($globals.pool_ptr.get() - $globals.str_start[$globals.str_ptr.get()].get()) 6 | } 7 | -------------------------------------------------------------------------------- /src/tex_the_program/section_0044.rs: -------------------------------------------------------------------------------- 1 | //! @ To destroy the most recently made string, we say |flush_string|. 2 | // 3 | // @d flush_string==begin decr(str_ptr); pool_ptr:=str_start[str_ptr]; 4 | // end 5 | pub(crate) fn flush_string(globals: &mut TeXGlobals) { 6 | decr!(globals.str_ptr); 7 | globals.pool_ptr = globals.str_start[globals.str_ptr]; 8 | } 9 | 10 | use crate::section_0004::TeXGlobals; 11 | use crate::section_0016::decr; 12 | -------------------------------------------------------------------------------- /src/tex_the_program/section_0050.rs: -------------------------------------------------------------------------------- 1 | //! @ When the \.{WEB} system program called \.{TANGLE} processes the \.{TEX.WEB} 2 | //! description that you are now reading, it outputs the \PASCAL\ program 3 | //! \.{TEX.PAS} and also a string pool file called \.{TEX.POOL}. The \.{INITEX} 4 | //! @.WEB@>@.INITEX@> 5 | //! program reads the latter file, where each string appears as a two-digit decimal 6 | //! length followed by the string itself, and the information is recorded in 7 | //! \TeX's string memory. 8 | // 9 | // @= 10 | // @!init @!pool_file:alpha_file; {the string-pool file output by \.{TANGLE}} 11 | 12 | #[cfg(feature = "initex")] 13 | #[globals_struct_field(TeXGlobals)] 14 | pub(crate) static pool_file: alpha_file = alpha_file::default(); 15 | // tini 16 | 17 | use crate::section_0004::TeXGlobals; 18 | use globals_struct::globals_struct_field; 19 | -------------------------------------------------------------------------------- /src/tex_the_program/section_0053.rs: -------------------------------------------------------------------------------- 1 | //! @ The \.{WEB} operation \.{@@\$} denotes the value that should be at the 2 | //! end of this \.{TEX.POOL} file; any other value means that the wrong pool 3 | //! file has been loaded. 4 | //! @^check sum@> 5 | // 6 | // @= 7 | pub(crate) macro Check_the_pool_check_sum($globals:expr, $c:expr) { 8 | // begin a:=0; k:=1; 9 | // loop@+ begin if (xord[n]<"0")or(xord[n]>"9") then 10 | // bad_pool('! TEX.POOL check sum doesn''t have nine digits.'); 11 | // @.TEX.POOL check sum...@> 12 | // a:=10*a+xord[n]-"0"; 13 | // if k=9 then goto done; 14 | // incr(k); read(pool_file,n); 15 | // end; 16 | // done: if a<>@$ then bad_pool('! TEX.POOL doesn''t match; TANGLE me again.'); 17 | // @.TEX.POOL doesn't match@> 18 | // c:=true; 19 | $c = true; 20 | // end 21 | } 22 | -------------------------------------------------------------------------------- /src/tex_the_program/section_0055.rs: -------------------------------------------------------------------------------- 1 | //! ` ` 2 | 3 | // @= 4 | pub(crate) macro Initialize_the_output_routines_0055($globals:expr) {{ 5 | // selector:=term_only; tally:=0; term_offset:=0; file_offset:=0; 6 | $globals.selector = term_only.into(); 7 | $globals.tally = 0; 8 | $globals.term_offset = 0.into(); 9 | $globals.file_offset = 0.into(); 10 | 11 | use crate::section_0054::term_only; 12 | }} 13 | -------------------------------------------------------------------------------- /src/tex_the_program/section_0068.rs: -------------------------------------------------------------------------------- 1 | //! @ Old versions of \TeX\ needed a procedure called |print_ASCII| whose function 2 | //! is now subsumed by |print|. We retain the old name here as a possible aid to 3 | //! future software arch\ae ologists. 4 | 5 | // 6 | // @d print_ASCII == print 7 | #[allow(non_snake_case)] 8 | pub(crate) fn print_ASCII(globals: &mut TeXGlobals, s: integer) { 9 | print(globals, s); 10 | } 11 | 12 | use crate::pascal::integer; 13 | use crate::section_0004::TeXGlobals; 14 | use crate::section_0059::print; 15 | -------------------------------------------------------------------------------- /src/tex_the_program/section_0074.rs: -------------------------------------------------------------------------------- 1 | //! ` ` 2 | 3 | // @=interaction:=error_stop_mode; 4 | pub(crate) macro Set_initial_values_of_key_variables_0074($globals:expr) {{ 5 | $globals.interaction = error_stop_mode.into(); 6 | 7 | use crate::section_0073::error_stop_mode; 8 | }} 9 | -------------------------------------------------------------------------------- /src/tex_the_program/section_0077.rs: -------------------------------------------------------------------------------- 1 | //! @ The value of |history| is initially |fatal_error_stop|, but it will 2 | //! be changed to |spotless| if \TeX\ survives the initialization process. 3 | //! 4 | //! @= 5 | //! deletions_allowed:=true; set_box_allowed:=true; 6 | //! error_count:=0; {|history| is initialized elsewhere} 7 | //! 8 | -------------------------------------------------------------------------------- /src/tex_the_program/section_0080.rs: -------------------------------------------------------------------------------- 1 | //! @ @= 2 | //! help_ptr:=0; use_err_help:=false; 3 | //! 4 | -------------------------------------------------------------------------------- /src/tex_the_program/section_0087.rs: -------------------------------------------------------------------------------- 1 | //! @ When the following code is executed, |buffer[(first+1)..(last-1)]| may 2 | //! contain the material inserted by the user; otherwise another prompt will 3 | //! be given. In order to understand this part of the program fully, you need 4 | //! to be familiar with \TeX's input stacks. 5 | //! 6 | //! @= 7 | //! begin begin_file_reading; {enter a new syntactic level for terminal input} 8 | //! {now |state=mid_line|, so an initial blank space will count as a blank} 9 | //! if last>first+1 then 10 | //! begin loc:=first+1; buffer[first]:=" "; 11 | //! end 12 | //! else begin prompt_input("insert>"); loc:=first; 13 | //! @.insert>@> 14 | //! end; 15 | //! first:=last; 16 | //! cur_input.limit_field:=last-1; {no |end_line_char| ends this line} 17 | //! return; 18 | //! end 19 | //! 20 | -------------------------------------------------------------------------------- /src/tex_the_program/section_0088.rs: -------------------------------------------------------------------------------- 1 | //! @ We allow deletion of up to 99 tokens at a time. 2 | //! 3 | //! @= 4 | //! begin s1:=cur_tok; s2:=cur_cmd; s3:=cur_chr; s4:=align_state; 5 | //! align_state:=1000000; OK_to_interrupt:=false; 6 | //! if (last>first+1) and (buffer[first+1]>="0")and(buffer[first+1]<="9") then 7 | //! c:=c*10+buffer[first+1]-"0"*11 8 | //! else c:=c-"0"; 9 | //! while c>0 do 10 | //! begin get_token; {one-level recursive call of |error| is possible} 11 | //! decr(c); 12 | //! end; 13 | //! cur_tok:=s1; cur_cmd:=s2; cur_chr:=s3; align_state:=s4; OK_to_interrupt:=true; 14 | //! help2("I have just deleted some text, as you asked.")@/ 15 | //! ("You can now delete more, or insert, or whatever."); 16 | //! show_context; goto continue; 17 | //! end 18 | //! 19 | -------------------------------------------------------------------------------- /src/tex_the_program/section_0089.rs: -------------------------------------------------------------------------------- 1 | //! @ @= 2 | //! begin if use_err_help then 3 | //! begin give_err_help; use_err_help:=false; 4 | //! end 5 | //! else begin if help_ptr=0 then 6 | //! help2("Sorry, I don't know how to help in this situation.")@/ 7 | //! @t\kern1em@>("Maybe you should try asking a human?"); 8 | //! repeat decr(help_ptr); print(help_line[help_ptr]); print_ln; 9 | //! until help_ptr=0; 10 | //! end; 11 | //! help4("Sorry, I already gave what help I could...")@/ 12 | //! ("Maybe you should try asking a human?")@/ 13 | //! ("An error might have occurred before I noticed any problems.")@/ 14 | //! ("``If all else fails, read the instructions.''");@/ 15 | //! goto continue; 16 | //! end 17 | //! 18 | -------------------------------------------------------------------------------- /src/tex_the_program/section_0094.rs: -------------------------------------------------------------------------------- 1 | //! @ Here is the most dreaded error message. 2 | // 3 | // @= 4 | // procedure overflow(@!s:str_number;@!n:integer); {stop due to finiteness} 5 | /// stop due to finiteness 6 | #[allow(unused_variables)] 7 | pub(crate) fn overflow(globals: &mut TeXGlobals, s: str_number, n: integer) -> TeXResult<()> { 8 | // begin normalize_selector; 9 | // print_err("TeX capacity exceeded, sorry ["); 10 | // @.TeX capacity exceeded ...@> 11 | // print(s); print_char("="); print_int(n); print_char("]"); 12 | // help2("If you really absolutely need more capacity,")@/ 13 | // ("you can ask a wizard to enlarge me."); 14 | // succumb; 15 | // end; 16 | todo!("not yet implemented in {}", file!()); 17 | } 18 | 19 | use crate::pascal::integer; 20 | use crate::section_0004::TeXGlobals; 21 | use crate::section_0038::str_number; 22 | use crate::section_0081::TeXResult; 23 | -------------------------------------------------------------------------------- /src/tex_the_program/section_0097.rs: -------------------------------------------------------------------------------- 1 | //! @ @= 2 | //! interrupt:=0; OK_to_interrupt:=true; 3 | //! 4 | -------------------------------------------------------------------------------- /src/tex_the_program/section_0100.rs: -------------------------------------------------------------------------------- 1 | //! @ Here is a routine that calculates half of an integer, using an 2 | //! unambiguous convention with respect to signed odd numbers. 3 | 4 | pub(crate) trait Half { 5 | fn half(self) -> Self; 6 | } 7 | 8 | // @p function half(@!x:integer):integer; 9 | pub(crate) fn half(x: integer) -> integer { 10 | // begin if odd(x) then half:=(x+1) div 2 11 | if x.is_odd() { 12 | (x + 1) / 2 13 | } 14 | // else half:=x @!div 2; 15 | else { 16 | x / 2 17 | } 18 | // end; 19 | } 20 | 21 | impl Half for integer { 22 | fn half(self) -> Self { 23 | half(self) 24 | } 25 | } 26 | 27 | impl Half for scaled { 28 | fn half(self) -> Self { 29 | scaled::new_from_inner(half(self.inner())) 30 | } 31 | } 32 | 33 | use crate::pascal::integer; 34 | use crate::pascal::IsOddOrEven; 35 | use crate::section_0101::scaled; 36 | -------------------------------------------------------------------------------- /src/tex_the_program/section_0114.rs: -------------------------------------------------------------------------------- 1 | //! @ When debugging, we may want to print a |memory_word| without knowing 2 | //! what type it is; so we print it in all modes. 3 | //! @^dirty \PASCAL@>@^debugging@> 4 | //! 5 | //! @p @!debug procedure print_word(@!w:memory_word); 6 | //! {prints |w| in all ways} 7 | //! begin print_int(w.int); print_char(" ");@/ 8 | //! print_scaled(w.sc); print_char(" ");@/ 9 | //! print_scaled(round(unity*float(w.gr))); print_ln;@/ 10 | //! @^real multiplication@> 11 | //! print_int(w.hh.lh); print_char("="); print_int(w.hh.b0); print_char(":"); 12 | //! print_int(w.hh.b1); print_char(";"); print_int(w.hh.rh); print_char(" ");@/ 13 | //! print_int(w.qqqq.b0); print_char(":"); print_int(w.qqqq.b1); print_char(":"); 14 | //! print_int(w.qqqq.b2); print_char(":"); print_int(w.qqqq.b3); 15 | //! end; 16 | //! gubed 17 | //! 18 | -------------------------------------------------------------------------------- /src/tex_the_program/section_0117.rs: -------------------------------------------------------------------------------- 1 | //! @ In order to study the memory requirements of particular applications, it 2 | //! is possible to prepare a version of \TeX\ that keeps track of current and 3 | //! maximum memory usage. When code between the delimiters |@!stat| $\ldots$ 4 | //! |tats| is not ``commented out,'' \TeX\ will run a bit slower but it will 5 | //! report these statistics when |tracing_stats| is sufficiently large. 6 | // 7 | // @= 8 | // @!var_used, @!dyn_used : integer; {how much memory is in use} 9 | /// how much memory is in use 10 | #[globals_struct_field(TeXGlobals)] 11 | pub(crate) static var_used: integer = 0; 12 | 13 | #[globals_struct_field(TeXGlobals)] 14 | pub(crate) static dyn_used: integer = 0; 15 | 16 | #[globals_struct_use(TeXGlobals)] 17 | use crate::pascal::integer; 18 | 19 | use crate::section_0004::TeXGlobals; 20 | use globals_struct::{globals_struct_field, globals_struct_use}; 21 | -------------------------------------------------------------------------------- /src/tex_the_program/section_0119.rs: -------------------------------------------------------------------------------- 1 | //! @ If memory is exhausted, it might mean that the user has forgotten 2 | //! a right brace. We will define some procedures later that try to help 3 | //! pinpoint the trouble. 4 | //! 5 | //! @p @@/ 6 | //! @ 7 | //! 8 | -------------------------------------------------------------------------------- /src/tex_the_program/section_0121.rs: -------------------------------------------------------------------------------- 1 | //! @ Conversely, a one-word node is recycled by calling |free_avail|. 2 | //! This routine is part of \TeX's ``inner loop,'' so we want it to be fast. 3 | //! @^inner loop@> 4 | // 5 | // @d free_avail(#)== {single-word node liberation} 6 | /// single-word node liberation 7 | pub(crate) macro free_avail($globals:expr, $ptr:expr) {{ 8 | // begin link(#):=avail; avail:=#; 9 | link!($globals, $ptr) = $globals.avail; 10 | $globals.avail = $ptr; 11 | // @!stat decr(dyn_used);@+tats@/ 12 | crate::region_stat! { 13 | decr!($globals.dyn_used); 14 | use crate::section_0016::decr; 15 | } 16 | // end 17 | use crate::section_0118::link; 18 | }} 19 | -------------------------------------------------------------------------------- /src/tex_the_program/section_0128.rs: -------------------------------------------------------------------------------- 1 | //! ` ` 2 | 3 | // @= 4 | pub(crate) macro Allocate_from_the_top_of_node_p_and_goto_found($globals:expr, $p:expr, $r:expr, $lbl_found:lifetime) {{ 5 | // begin node_size(p):=r-p; {store the remaining size} 6 | /// store the remaining size 7 | { 8 | node_size!($globals, $p) = $r as halfword - $p; 9 | } 10 | // @^inner loop@> 11 | // rover:=p; {start searching here next time} 12 | /// start searching here next time 13 | { 14 | $globals.rover = $p; 15 | } 16 | // goto found; 17 | crate::goto_forward_label!($lbl_found); 18 | // end 19 | use crate::section_0113::halfword; 20 | use crate::section_0124::node_size; 21 | }} 22 | -------------------------------------------------------------------------------- /src/tex_the_program/section_0129.rs: -------------------------------------------------------------------------------- 1 | //! @ Here we delete node |p| from the ring, and let |rover| rove around. 2 | // 3 | // @= 4 | pub(crate) macro Allocate_entire_node_p_and_goto_found($globals:expr, $p:expr, $lbl_found:lifetime) {{ 5 | /// temporary register 6 | let t: integer; 7 | // begin rover:=rlink(p); t:=llink(p); 8 | $globals.rover = rlink!($globals, $p); 9 | t = llink!($globals, $p) as _; 10 | // llink(rover):=t; rlink(t):=rover; 11 | llink!($globals, $globals.rover) = t as _; 12 | rlink!($globals, t as pointer) = $globals.rover; 13 | // goto found; 14 | crate::goto_forward_label!($lbl_found); 15 | // end 16 | use crate::pascal::integer; 17 | use crate::section_0115::pointer; 18 | use crate::section_0124::llink; 19 | use crate::section_0124::rlink; 20 | }} 21 | -------------------------------------------------------------------------------- /src/tex_the_program/section_0137.rs: -------------------------------------------------------------------------------- 1 | //! @ A |vlist_node| is like an |hlist_node| in all respects except that it 2 | //! contains a vertical list. 3 | // 4 | // @d vlist_node=1 {|type| of vlist nodes} 5 | /// `type` of vlist nodes 6 | pub(crate) const vlist_node: quarterword = 1; 7 | 8 | use crate::section_0113::quarterword; 9 | -------------------------------------------------------------------------------- /src/tex_the_program/section_0142.rs: -------------------------------------------------------------------------------- 1 | //! @ An |adjust_node|, which occurs only in horizontal lists, 2 | //! specifies material that will be moved out into the surrounding 3 | //! vertical list; i.e., it is used to implement \TeX's `\.{\\vadjust}' 4 | //! operation. The |adjust_ptr| field points to the vlist containing this 5 | //! material. 6 | // 7 | // @d adjust_node=5 {|type| of an adjust node} 8 | /// `type` of an adjust node 9 | pub(crate) const adjust_node: quarterword = 5; 10 | // @d adjust_ptr==mark_ptr {vertical list to be moved out of horizontal list} 11 | /// vertical list to be moved out of horizontal list 12 | pub(crate) macro adjust_ptr($globals:expr, $v:expr) { 13 | crate::section_0141::mark_ptr!($globals, $v) 14 | } 15 | 16 | use crate::section_0113::quarterword; 17 | -------------------------------------------------------------------------------- /src/tex_the_program/section_0148.rs: -------------------------------------------------------------------------------- 1 | //! @ \TeX\ makes use of the fact that |hlist_node|, |vlist_node|, 2 | //! |rule_node|, |ins_node|, |mark_node|, |adjust_node|, |ligature_node|, 3 | //! |disc_node|, |whatsit_node|, and |math_node| are at the low end of the 4 | //! type codes, by permitting a break at glue in a list if and only if the 5 | //! |type| of the previous node is less than |math_node|. Furthermore, a 6 | //! node is discarded after a break if its type is |math_node| or~more. 7 | // 8 | // @d precedes_break(#)==(type(#) 7 | //! However, other references to the nodes are made symbolically in terms of 8 | //! the \.{WEB} macro definitions above, so that format changes will leave 9 | //! \TeX's other algorithms intact. 10 | //! @^system dependencies@> 11 | //! 12 | -------------------------------------------------------------------------------- /src/tex_the_program/section_0163.rs: -------------------------------------------------------------------------------- 1 | //! @ The following code gets |mem| off to a good start, when \TeX\ is 2 | //! initializing itself the slow~way. 3 | //! 4 | //! @= 5 | //! @!k:integer; {index into |mem|, |eqtb|, etc.} 6 | //! 7 | -------------------------------------------------------------------------------- /src/tex_the_program/section_0166.rs: -------------------------------------------------------------------------------- 1 | //! @ @= 2 | //! @!debug was_mem_end:=mem_min; {indicate that everything was previously free} 3 | //! was_lo_max:=mem_min; was_hi_min:=mem_max; 4 | //! panicking:=false; 5 | //! gubed 6 | //! 7 | -------------------------------------------------------------------------------- /src/tex_the_program/section_0179.rs: -------------------------------------------------------------------------------- 1 | //! @ We also need to declare some procedures that appear later in this 2 | //! documentation. 3 | //! 4 | //! @p @@; 5 | //! @ 6 | //! 7 | -------------------------------------------------------------------------------- /src/tex_the_program/section_0185.rs: -------------------------------------------------------------------------------- 1 | //! @ @= 2 | //! begin if span_count(p)<>min_quarterword then 3 | //! begin print(" ("); print_int(qo(span_count(p))+1); 4 | //! print(" columns)"); 5 | //! end; 6 | //! if glue_stretch(p)<>0 then 7 | //! begin print(", stretch "); print_glue(glue_stretch(p),glue_order(p),0); 8 | //! end; 9 | //! if glue_shrink(p)<>0 then 10 | //! begin print(", shrink "); print_glue(glue_shrink(p),glue_sign(p),0); 11 | //! end; 12 | //! end 13 | //! 14 | -------------------------------------------------------------------------------- /src/tex_the_program/section_0194.rs: -------------------------------------------------------------------------------- 1 | //! ` ` 2 | // @= 3 | pub(crate) macro Display_penalty_p($globals:expr, $p:expr) {{ 4 | // begin print_esc("penalty "); print_int(penalty(p)); 5 | print_esc($globals, crate::strpool_str!("penalty ")); 6 | print_int($globals, penalty!($globals, $p as pointer)); 7 | // end 8 | use crate::section_0063::print_esc; 9 | use crate::section_0065::print_int; 10 | use crate::section_0115::pointer; 11 | use crate::section_0157::penalty; 12 | }} 13 | -------------------------------------------------------------------------------- /src/tex_the_program/section_0196_to_0197.rs: -------------------------------------------------------------------------------- 1 | //! @ @= 2 | //! begin print_esc("mark"); print_mark(mark_ptr(p)); 3 | //! end 4 | //! 5 | //! @ @= 6 | //! begin print_esc("vadjust"); node_list_display(adjust_ptr(p)); {recursive call} 7 | //! end 8 | //! 9 | -------------------------------------------------------------------------------- /src/tex_the_program/section_0199.rs: -------------------------------------------------------------------------------- 1 | //! @* \[13] Destroying boxes. 2 | //! When we are done with a node list, we are obliged to return it to free 3 | //! storage, including all of its sublists. The recursive procedure 4 | //! |flush_node_list| does this for us. 5 | //! 6 | -------------------------------------------------------------------------------- /src/tex_the_program/section_0214.rs: -------------------------------------------------------------------------------- 1 | //! @ Here is a common way to make the current list grow: 2 | // 3 | // @d tail_append(#)==begin link(tail):=#; tail:=link(tail); 4 | pub(crate) macro tail_append($globals:expr, $ptr:expr) { 5 | link!($globals, tail!($globals)) = $ptr; 6 | tail!($globals) = link!($globals, tail!($globals)); 7 | // end 8 | use crate::section_0118::link; 9 | use crate::section_0213::tail; 10 | } 11 | -------------------------------------------------------------------------------- /src/tex_the_program/section_0217.rs: -------------------------------------------------------------------------------- 1 | //! @ Conversely, when \TeX\ is finished on the current level, the former 2 | //! state is restored by calling |pop_nest|. This routine will never be 3 | //! called at the lowest semantic level, nor will it be called unless |head| 4 | //! is a node that should be returned to free memory. 5 | // 6 | // @p procedure pop_nest; {leave a semantic level, re-enter the old} 7 | /// leave a semantic level, re-enter the old 8 | #[allow(unused_variables)] 9 | pub(crate) fn pop_nest(globals: &mut TeXGlobals) { 10 | // begin free_avail(head); decr(nest_ptr); cur_list:=nest[nest_ptr]; 11 | free_avail!(globals, head!(globals)); 12 | decr!(globals.nest_ptr); 13 | globals.cur_list = globals.nest[globals.nest_ptr]; 14 | // end; 15 | } 16 | 17 | use crate::section_0004::TeXGlobals; 18 | use crate::section_0016::decr; 19 | use crate::section_0121::free_avail; 20 | use crate::section_0213::head; 21 | -------------------------------------------------------------------------------- /src/tex_the_program/section_0228.rs: -------------------------------------------------------------------------------- 1 | //! @ All glue parameters and registers are initially `\.{0pt plus0pt minus0pt}'. 2 | //! 3 | //! @= 4 | //! equiv(glue_base):=zero_glue; eq_level(glue_base):=level_one; 5 | //! eq_type(glue_base):=glue_ref; 6 | //! for k:=glue_base+1 to local_base-1 do eqtb[k]:=eqtb[glue_base]; 7 | //! glue_ref_count(zero_glue):=glue_ref_count(zero_glue)+local_base-glue_base; 8 | //! 9 | -------------------------------------------------------------------------------- /src/tex_the_program/section_0243.rs: -------------------------------------------------------------------------------- 1 | //! ` ` 2 | // @=c:=escape_char 3 | pub(crate) macro Set_variable_c_to_the_current_escape_character($globals:expr, $c:expr) {{ 4 | $c = escape_char!($globals); 5 | use crate::section_0236::escape_char; 6 | }} 7 | -------------------------------------------------------------------------------- /src/tex_the_program/section_0244.rs: -------------------------------------------------------------------------------- 1 | //! ` ` 2 | 3 | // @=s=new_line_char 4 | pub(crate) macro Character_s_is_the_current_new_line_character($globals:expr, $s:expr) { 5 | $s.numeric_value() 6 | == crate::section_0236::new_line_char!($globals) as crate::section_0018::ASCII_code_repr 7 | } 8 | -------------------------------------------------------------------------------- /src/tex_the_program/section_0250.rs: -------------------------------------------------------------------------------- 1 | //! @ @= 2 | //! for k:=dimen_base to eqtb_size do eqtb[k].sc:=0; 3 | //! 4 | -------------------------------------------------------------------------------- /src/tex_the_program/section_0254.rs: -------------------------------------------------------------------------------- 1 | //! ` ` 2 | // @= 3 | pub(crate) macro Set_initial_values_of_key_variables_0254($globals:expr) {{ 4 | // for k:=int_base to eqtb_size do xeq_level[k]:=level_one; 5 | for k in int_base..=eqtb_size { 6 | let k = k as pointer; 7 | $globals.xeq_level[k] = level_one; 8 | } 9 | 10 | use crate::section_0115::pointer; 11 | use crate::section_0221::level_one; 12 | use crate::section_0230::int_base; 13 | use crate::section_0247::eqtb_size; 14 | }} 15 | -------------------------------------------------------------------------------- /src/tex_the_program/section_0255.rs: -------------------------------------------------------------------------------- 1 | //! @ When the debugging routine |search_mem| is looking for pointers having a 2 | //! given value, it is interested only in regions 1 to~3 of~|eqtb|, and in the 3 | //! first part of region~4. 4 | //! 5 | //! @= 6 | //! for q:=active_base to box_base+255 do 7 | //! begin if equiv(q)=p then 8 | //! begin print_nl("EQUIV("); print_int(q); print_char(")"); 9 | //! end; 10 | //! end 11 | //! 12 | -------------------------------------------------------------------------------- /src/tex_the_program/section_0257.rs: -------------------------------------------------------------------------------- 1 | //! @ @= 2 | //! no_new_control_sequence:=true; {new identifiers are usually forbidden} 3 | //! next(hash_base):=0; text(hash_base):=0; 4 | //! for k:=hash_base+1 to undefined_control_sequence-1 do hash[k]:=hash[hash_base]; 5 | //! 6 | -------------------------------------------------------------------------------- /src/tex_the_program/section_0270.rs: -------------------------------------------------------------------------------- 1 | //! @ The global variable |cur_group| keeps track of what sort of group we are 2 | //! currently in. Another global variable, |cur_boundary|, points to the 3 | //! topmost |level_boundary| word. And |cur_level| is the current depth of 4 | //! nesting. The routines are designed to preserve the condition that no entry 5 | //! in the |save_stack| or in |eqtb| ever has a level greater than |cur_level|. 6 | //! 7 | -------------------------------------------------------------------------------- /src/tex_the_program/section_0273.rs: -------------------------------------------------------------------------------- 1 | //! @ The following macro is used to test if there is room for up to six more 2 | //! entries on |save_stack|. By making a conservative test like this, we can 3 | //! get by with testing for overflow in only a few places. 4 | // 5 | // @d check_full_save_stack==if save_ptr>max_save_stack then 6 | pub(crate) macro check_full_save_stack($globals:expr) {{ 7 | // begin max_save_stack:=save_ptr; 8 | $globals.max_save_stack = $globals.save_ptr; 9 | // if max_save_stack>save_size-6 then overflow("save size",save_size); 10 | if $globals.max_save_stack > save_size - 6 { 11 | todo!("not yet implemented in {}", file!()); 12 | } 13 | // @:TeX capacity exceeded save size}{\quad save size@> 14 | // end 15 | use crate::section_0011::save_size; 16 | }} 17 | -------------------------------------------------------------------------------- /src/tex_the_program/section_0285.rs: -------------------------------------------------------------------------------- 1 | //! @ When looking for possible pointers to a memory location, it is helpful 2 | //! to look for references from |eqtb| that might be waiting on the 3 | //! save stack. Of course, we might find spurious pointers too; but this 4 | //! routine is merely an aid when debugging, and at such times we are 5 | //! grateful for any scraps of information, even if they prove to be irrelevant. 6 | //! @^dirty \PASCAL@> 7 | //! 8 | //! @= 9 | //! if save_ptr>0 then for q:=0 to save_ptr-1 do 10 | //! begin if equiv_field(save_stack[q])=p then 11 | //! begin print_nl("SAVE("); print_int(q); print_char(")"); 12 | //! end; 13 | //! end 14 | //! 15 | -------------------------------------------------------------------------------- /src/tex_the_program/section_0286.rs: -------------------------------------------------------------------------------- 1 | //! @ Most of the parameters kept in |eqtb| can be changed freely, but there's 2 | //! an exception: The magnification should not be used with two different 3 | //! values during any \TeX\ job, since a single magnification is applied to an 4 | //! entire run. The global variable |mag_set| is set to the current magnification 5 | //! whenever it becomes necessary to ``freeze'' it at a particular value. 6 | // 7 | // @= 8 | // @!mag_set:integer; {if nonzero, this magnification should be used henceforth} 9 | /// if nonzero, this magnification should be used henceforth 10 | #[globals_struct_field(TeXGlobals)] 11 | pub(crate) static mag_set: integer = 0; 12 | 13 | #[globals_struct_use(TeXGlobals)] 14 | use crate::pascal::integer; 15 | 16 | use crate::section_0004::TeXGlobals; 17 | use globals_struct::{globals_struct_field, globals_struct_use}; 18 | -------------------------------------------------------------------------------- /src/tex_the_program/section_0287.rs: -------------------------------------------------------------------------------- 1 | //! @ @= 2 | //! mag_set:=0; 3 | //! 4 | -------------------------------------------------------------------------------- /src/tex_the_program/section_0290.rs: -------------------------------------------------------------------------------- 1 | //! @ @= 2 | //! if cs_token_flag+undefined_control_sequence>max_halfword then bad:=21; 3 | //! 4 | -------------------------------------------------------------------------------- /src/tex_the_program/section_0295.rs: -------------------------------------------------------------------------------- 1 | //! @ Here's the way we sometimes want to display a token list, given a pointer 2 | //! to its reference count; the pointer may be null. 3 | // 4 | // @p procedure token_show(@!p:pointer); 5 | #[allow(unused_variables)] 6 | #[cfg_attr(feature = "trace_verbose", tracing::instrument(level = "trace"))] 7 | pub(crate) fn token_show(globals: &mut TeXGlobals, p: pointer) { 8 | // begin if p<>null then show_token_list(link(p),null,10000000); 9 | if p != null { 10 | show_token_list(globals, link!(globals, p) as _, null as _, 10000000); 11 | } 12 | // end; 13 | } 14 | 15 | use crate::section_0004::TeXGlobals; 16 | use crate::section_0115::null; 17 | use crate::section_0115::pointer; 18 | use crate::section_0118::link; 19 | use crate::section_0292::show_token_list; 20 | -------------------------------------------------------------------------------- /src/tex_the_program/section_0306.rs: -------------------------------------------------------------------------------- 1 | //! @ Here is a procedure that uses |scanner_status| to print a warning message 2 | //! when a subfile has ended, and at certain other crucial times: 3 | //! 4 | //! @= 5 | //! procedure runaway; 6 | //! var p:pointer; {head of runaway list} 7 | //! begin if scanner_status>skipping then 8 | //! begin print_nl("Runaway "); 9 | //! @.Runaway...@> 10 | //! case scanner_status of 11 | //! defining: begin print("definition"); p:=def_ref; 12 | //! end; 13 | //! matching: begin print("argument"); p:=temp_head; 14 | //! end; 15 | //! aligning: begin print("preamble"); p:=hold_head; 16 | //! end; 17 | //! absorbing: begin print("text"); p:=def_ref; 18 | //! end; 19 | //! end; {there are no other cases} 20 | //! print_char("?");print_ln; show_token_list(link(p),null,error_line-10); 21 | //! end; 22 | //! end; 23 | //! 24 | -------------------------------------------------------------------------------- /src/tex_the_program/section_0320.rs: -------------------------------------------------------------------------------- 1 | //! @ Here is the missing piece of |show_token_list| that is activated when the 2 | //! token beginning line~2 is about to be shown: 3 | // 4 | // @=set_trick_count 5 | pub(crate) macro Do_magic_computation($globals:expr) {{ 6 | crate::section_0316::set_trick_count!($globals); 7 | }} 8 | -------------------------------------------------------------------------------- /src/tex_the_program/section_0322.rs: -------------------------------------------------------------------------------- 1 | //! @ And of course what goes up must come down. 2 | // 3 | // @d pop_input==@t@> {leave an input level, re-enter the old} 4 | /// leave an input level, re-enter the old 5 | pub(crate) macro pop_input($globals:expr) {{ 6 | // begin decr(input_ptr); cur_input:=input_stack[input_ptr]; 7 | decr!($globals.input_ptr); 8 | crate::trace_expr_verbose!("input_ptr = {:?}", $globals.input_ptr); 9 | $globals.cur_input = $globals.input_stack[$globals.input_ptr]; 10 | // end 11 | use crate::section_0016::decr; 12 | }} 13 | -------------------------------------------------------------------------------- /src/tex_the_program/section_0326.rs: -------------------------------------------------------------------------------- 1 | //! ` ` 2 | 3 | // @= 4 | pub(crate) macro Insert_token_p_into_TeX_s_input($globals:expr, $p:expr) {{ 5 | /// saved value of `cur_tok` 6 | let t; 7 | // begin t:=cur_tok; cur_tok:=p; back_input; cur_tok:=t; 8 | t = $globals.cur_tok; 9 | #[cfg(not(feature = "unicode_support"))] 10 | { 11 | $globals.cur_tok = cur_tok_type::new($p as _); 12 | } 13 | #[cfg(feature = "unicode_support")] 14 | { 15 | $globals.cur_tok = crate::section_0297::cur_tok_type::new( 16 | crate::unicode_support::info_value($globals, $p), 17 | ); 18 | } 19 | back_input($globals); 20 | $globals.cur_tok = t; 21 | // end 22 | use crate::section_0297::cur_tok_type; 23 | use crate::section_0325::back_input; 24 | }} 25 | -------------------------------------------------------------------------------- /src/tex_the_program/section_0333.rs: -------------------------------------------------------------------------------- 1 | //! @ The value of |par_loc| is the |eqtb| address of `\.{\\par}'. This quantity 2 | //! is needed because a blank line of input is supposed to be exactly equivalent 3 | //! to the appearance of \.{\\par}; we must set |cur_cs:=par_loc| 4 | //! when detecting a blank line. 5 | // 6 | // @= 7 | // @!par_loc:pointer; {location of `\.{\\par}' in |eqtb|} 8 | /// location of '`\par`' in `eqtb` 9 | #[globals_struct_field(TeXGlobals)] 10 | pub(crate) static par_loc: pointer = pointer::default(); 11 | // @!par_token:halfword; {token representing `\.{\\par}'} 12 | /// token representing '`\par`' 13 | #[globals_struct_field(TeXGlobals)] 14 | pub(crate) static par_token: cur_tok_type = cur_tok_type::default(); 15 | 16 | use crate::section_0004::TeXGlobals; 17 | use globals_struct::{globals_struct_field, globals_struct_use}; 18 | -------------------------------------------------------------------------------- /src/tex_the_program/section_0334.rs: -------------------------------------------------------------------------------- 1 | //! ` ` 2 | 3 | // @= 4 | #[allow(unused_variables)] 5 | pub(crate) macro Put_each_of_tex_s_primitivies_into_the_hash_table_0334($globals:expr) {{ 6 | let globals = &mut *$globals; 7 | // primitive("par",par_end,256); {cf.\ |scan_file_name|} 8 | /// cf. `scan_file_name` 9 | primitive(globals, crate::strpool_str!("par"), par_end, 256); 10 | // @!@:par_}{\.{\\par} primitive@> 11 | // par_loc:=cur_val; par_token:=cs_token_flag+par_loc; 12 | globals.par_loc = globals.cur_val as _; 13 | globals.par_token = cur_tok_type::from_cs(globals.par_loc); 14 | }} 15 | 16 | use crate::section_0004::TeXGlobals; 17 | use crate::section_0207::par_end; 18 | use crate::section_0208::*; 19 | use crate::section_0264::primitive; 20 | use crate::section_0297::cur_tok_type; 21 | -------------------------------------------------------------------------------- /src/tex_the_program/section_0335.rs: -------------------------------------------------------------------------------- 1 | //! ` ` 2 | 3 | // @= 4 | pub(crate) macro Cases_of_print_cmd_chr_for_symbolic_printing_of_primitives_0335($globals:expr, $cmd:expr, $chr_code:expr) {{ 5 | // par_end:print_esc("par"); 6 | let processed = if $cmd == par_end { 7 | print_esc($globals, crate::strpool_str!("par")); 8 | true 9 | } else { 10 | false 11 | }; 12 | use crate::section_0063::print_esc; 13 | use crate::section_0207::*; 14 | processed 15 | }} 16 | -------------------------------------------------------------------------------- /src/tex_the_program/section_0345.rs: -------------------------------------------------------------------------------- 1 | // @ @= 2 | // any_state_plus(ignore),skip_blanks+spacer,new_line+spacer 3 | pub(crate) macro State_plus_cur_cmd_matches_cases_where_character_is_ignored($state_plus_cur_cmd:expr) {{ 4 | let result = 5 | state_plus_cur_cmd_matches_any_case_plus!($state_plus_cur_cmd, crate::section_0207::ignore) 6 | || $state_plus_cur_cmd 7 | == crate::section_0303::skip_blanks + crate::section_0207::spacer 8 | || $state_plus_cur_cmd == crate::section_0303::new_line + crate::section_0207::spacer; 9 | use crate::section_0344::state_plus_cur_cmd_matches_any_case_plus; 10 | result 11 | }} 12 | -------------------------------------------------------------------------------- /src/tex_the_program/section_0346.rs: -------------------------------------------------------------------------------- 1 | //! @ We go to |restart| instead of to |switch|, because |state| might equal 2 | //! |token_list| after the error has been dealt with 3 | //! (cf.\ |clear_for_error_prompt|). 4 | //! 5 | //! @= 6 | //! begin print_err("Text line contains an invalid character"); 7 | //! @.Text line contains...@> 8 | //! help2("A funny symbol that I can't read has just been input.")@/ 9 | //! ("Continue, and I'll forget that it ever happened.");@/ 10 | //! deletions_allowed:=false; error; deletions_allowed:=true; 11 | //! goto restart; 12 | //! end 13 | //! 14 | -------------------------------------------------------------------------------- /src/tex_the_program/section_0348.rs: -------------------------------------------------------------------------------- 1 | //! @ When a character of type |spacer| gets through, its character code is 2 | //! changed to $\.{"\ "}=@'40$. This means that the ASCII codes for tab and space, 3 | //! and for the space inserted at the end of a line, will 4 | //! be treated alike when macro parameters are being matched. We do this 5 | //! since such characters are indistinguishable on most computer terminal displays. 6 | // 7 | // @= 8 | pub(crate) macro Finish_line__emit_a_space($globals:expr) { 9 | // begin loc:=limit+1; cur_cmd:=spacer; cur_chr:=" "; 10 | loc!($globals) = limit!($globals) + 1; 11 | $globals.cur_cmd = spacer; 12 | $globals.cur_chr = ASCII_code_literal!(b' ').into(); 13 | // end 14 | use crate::section_0018::ASCII_code_literal; 15 | use crate::section_0036::loc; 16 | use crate::section_0207::*; 17 | use crate::section_0302::limit; 18 | } 19 | -------------------------------------------------------------------------------- /src/tex_the_program/section_0349.rs: -------------------------------------------------------------------------------- 1 | //! @ The following code is performed only when |cur_cmd=spacer|. 2 | // 3 | // @= 4 | pub(crate) macro Enter_skip_blanks_state__emit_a_space($globals:expr) { 5 | // begin state:=skip_blanks; cur_chr:=" "; 6 | state!($globals) = skip_blanks; 7 | $globals.cur_chr = ASCII_code_literal!(b' ').into(); 8 | // end 9 | use crate::section_0018::ASCII_code_literal; 10 | use crate::section_0302::state; 11 | use crate::section_0303::*; 12 | } 13 | -------------------------------------------------------------------------------- /src/tex_the_program/section_0350.rs: -------------------------------------------------------------------------------- 1 | //! ` ` 2 | // @= 3 | pub(crate) macro Finish_line__goto_switch($globals:expr, $lbl_switch:lifetime) {{ 4 | // begin loc:=limit+1; goto switch; 5 | loc!($globals) = limit!($globals) + 1; 6 | crate::goto_backward_label!($lbl_switch); 7 | // end 8 | use crate::section_0036::loc; 9 | use crate::section_0302::limit; 10 | }} 11 | -------------------------------------------------------------------------------- /src/tex_the_program/section_0351.rs: -------------------------------------------------------------------------------- 1 | //! ` ` 2 | 3 | // @= 4 | pub(crate) macro Finish_line__emit_a_par($globals:expr) { 5 | // begin loc:=limit+1; cur_cs:=par_loc; cur_cmd:=eq_type(cur_cs); 6 | loc!($globals) = limit!($globals) + 1; 7 | $globals.cur_cs = $globals.par_loc; 8 | $globals.cur_cmd = eq_type!($globals, $globals.cur_cs); 9 | // cur_chr:=equiv(cur_cs); 10 | $globals.cur_chr = chr_code_type::new(equiv!($globals, $globals.cur_cs) as _); 11 | // if cur_cmd>=outer_call then check_outer_validity; 12 | // end 13 | use crate::section_0036::loc; 14 | use crate::section_0221::eq_type; 15 | use crate::section_0221::equiv; 16 | use crate::section_0297::chr_code_type; 17 | use crate::section_0302::limit; 18 | } 19 | -------------------------------------------------------------------------------- /src/tex_the_program/section_0359.rs: -------------------------------------------------------------------------------- 1 | //! ` ` 2 | 3 | // @= 4 | pub(crate) macro Insert_macro_parameter_and_goto_restart($globals:expr, $lbl_restart:lifetime) {{ 5 | crate::trace_span_verbose!("Insert macro parameter..."); 6 | // begin begin_token_list(param_stack[param_start+cur_chr-1],parameter); 7 | begin_token_list( 8 | $globals, 9 | $globals.param_stack[u8_from_0_to_n::new( 10 | (param_start!($globals) + $globals.cur_chr.get() as pointer - 1) as _, 11 | )], 12 | parameter, 13 | ); 14 | // goto restart; 15 | crate::goto_backward_label!($lbl_restart); 16 | // end 17 | use crate::pascal::u8_from_0_to_n; 18 | use crate::section_0115::pointer; 19 | use crate::section_0307::param_start; 20 | use crate::section_0307::parameter; 21 | use crate::section_0323::begin_token_list; 22 | }} 23 | -------------------------------------------------------------------------------- /src/tex_the_program/section_0361.rs: -------------------------------------------------------------------------------- 1 | //! @ The global variable |force_eof| is normally |false|; it is set |true| 2 | //! by an \.{\\endinput} command. 3 | // 4 | // @= 5 | // @!force_eof:boolean; {should the next \.{\\input} be aborted early?} 6 | /// should the next `\input` be aborted early? 7 | #[globals_struct_field(TeXGlobals)] 8 | pub(crate) static force_eof: boolean = false; 9 | 10 | #[globals_struct_use(TeXGlobals)] 11 | use crate::pascal::boolean; 12 | 13 | use globals_struct::{globals_struct_field, globals_struct_use}; 14 | -------------------------------------------------------------------------------- /src/tex_the_program/section_0368.rs: -------------------------------------------------------------------------------- 1 | //! @ It takes only a little shuffling to do what \TeX\ calls \.{\\expandafter}. 2 | // 3 | // @= 4 | pub(crate) macro Expand_the_token_after_the_next_token($globals:expr) {{ 5 | /// token that is being "expanded after" 6 | let t; 7 | 8 | // begin get_token; t:=cur_tok; get_token; 9 | get_token($globals)?; 10 | t = $globals.cur_tok; 11 | get_token($globals)?; 12 | // if cur_cmd>max_command then expand@+else back_input; 13 | if $globals.cur_cmd > max_command { 14 | expand($globals)?; 15 | } else { 16 | back_input($globals); 17 | } 18 | // cur_tok:=t; back_input; 19 | $globals.cur_tok = t; 20 | back_input($globals); 21 | // end 22 | 23 | use crate::section_0209::max_command; 24 | use crate::section_0325::back_input; 25 | use crate::section_0365::get_token; 26 | use crate::section_0366::expand; 27 | }} 28 | -------------------------------------------------------------------------------- /src/tex_the_program/section_0373.rs: -------------------------------------------------------------------------------- 1 | //! @ @= 2 | //! begin print_err("Missing "); print_esc("endcsname"); print(" inserted"); 3 | //! @.Missing \\endcsname...@> 4 | //! help2("The control sequence marked should")@/ 5 | //! ("not appear between \csname and \endcsname."); 6 | //! back_error; 7 | //! end 8 | //! 9 | -------------------------------------------------------------------------------- /src/tex_the_program/section_0375.rs: -------------------------------------------------------------------------------- 1 | //! @ An |end_template| command is effectively changed to an |endv| command 2 | //! by the following code. (The reason for this is discussed below; the 3 | //! |frozen_end_template| at the end of the template has passed the 4 | //! |check_outer_validity| test, so its mission of error detection has been 5 | //! accomplished.) 6 | // 7 | // @= 8 | pub(crate) macro Insert_a_token_containing_frozen_endv($globals:expr) {{ 9 | // begin cur_tok:=cs_token_flag+frozen_endv; back_input; 10 | $globals.cur_tok = cur_tok_type::from_cs(frozen_endv as _); 11 | back_input($globals); 12 | // end 13 | use crate::section_0222::frozen_endv; 14 | use crate::section_0297::cur_tok_type; 15 | use crate::section_0325::back_input; 16 | }} 17 | -------------------------------------------------------------------------------- /src/tex_the_program/section_0376.rs: -------------------------------------------------------------------------------- 1 | //! @ The processing of \.{\\input} involves the |start_input| subroutine, 2 | //! which will be declared later; the processing of \.{\\endinput} is trivial. 3 | // 4 | // @= 5 | #[allow(unused_variables)] 6 | pub(crate) macro Put_each_of_tex_s_primitivies_into_the_hash_table_0376($globals:expr) {{ 7 | let globals = &mut *$globals; 8 | // primitive("input",input,0);@/ 9 | primitive(globals, crate::strpool_str!("input"), input, 0); 10 | // @!@:input_}{\.{\\input} primitive@> 11 | // primitive("endinput",input,1);@/ 12 | primitive(globals, crate::strpool_str!("endinput"), input, 1); 13 | // @!@:end_input_}{\.{\\endinput} primitive@> 14 | }} 15 | 16 | use crate::section_0004::TeXGlobals; 17 | use crate::section_0210::input; 18 | use crate::section_0264::primitive; 19 | -------------------------------------------------------------------------------- /src/tex_the_program/section_0377.rs: -------------------------------------------------------------------------------- 1 | //! ` ` 2 | 3 | // @= 4 | pub(crate) macro Cases_of_print_cmd_chr_for_symbolic_printing_of_primitives_0377($globals:expr, $cmd:expr, $chr_code:expr) {{ 5 | // input: if chr_code=0 then print_esc("input")@+else print_esc("endinput"); 6 | let processed = if $cmd == input { 7 | if $chr_code.get() == 0 { 8 | print_esc($globals, crate::strpool_str!("input")); 9 | } else { 10 | print_esc($globals, crate::strpool_str!("endinput")); 11 | } 12 | true 13 | } else { 14 | false 15 | }; 16 | use crate::section_0063::print_esc; 17 | use crate::section_0210::*; 18 | processed 19 | }} 20 | -------------------------------------------------------------------------------- /src/tex_the_program/section_0378.rs: -------------------------------------------------------------------------------- 1 | //! ` ` 2 | 3 | // @= 4 | pub(crate) macro Initiate_or_terminate_input_from_a_file($globals:expr) {{ 5 | // if cur_chr>0 then force_eof:=true 6 | if $globals.cur_chr.get() > 0 { 7 | $globals.force_eof = true; 8 | } 9 | // else if name_in_progress then insert_relax 10 | else if $globals.name_in_progress { 11 | insert_relax($globals); 12 | } 13 | // else start_input 14 | else { 15 | start_input($globals)?; 16 | } 17 | 18 | use crate::section_0379::insert_relax; 19 | use crate::section_0537::start_input; 20 | }} 21 | -------------------------------------------------------------------------------- /src/tex_the_program/section_0379.rs: -------------------------------------------------------------------------------- 1 | //! @ Sometimes the expansion looks too far ahead, so we want to insert 2 | //! a harmless \.{\\relax} into the user's input. 3 | // 4 | // @= 5 | // procedure insert_relax; 6 | pub(crate) fn insert_relax(globals: &mut TeXGlobals) { 7 | // begin cur_tok:=cs_token_flag+cur_cs; back_input; 8 | globals.cur_tok = cur_tok_type::from_cs(globals.cur_cs); 9 | back_input(globals); 10 | // cur_tok:=cs_token_flag+frozen_relax; back_input; token_type:=inserted; 11 | globals.cur_tok = cur_tok_type::from_cs(frozen_relax as _); 12 | back_input(globals); 13 | token_type!(globals) = inserted; 14 | // end; 15 | } 16 | 17 | use crate::section_0004::TeXGlobals; 18 | use crate::section_0222::frozen_relax; 19 | use crate::section_0297::cur_tok_type; 20 | use crate::section_0307::inserted; 21 | use crate::section_0307::token_type; 22 | use crate::section_0325::back_input; 23 | -------------------------------------------------------------------------------- /src/tex_the_program/section_0383.rs: -------------------------------------------------------------------------------- 1 | //! @ @= 2 | //! top_mark:=null; first_mark:=null; bot_mark:=null; 3 | //! split_first_mark:=null; split_bot_mark:=null; 4 | //! 5 | -------------------------------------------------------------------------------- /src/tex_the_program/section_0385_to_0386.rs: -------------------------------------------------------------------------------- 1 | //! @ @= 2 | //! top_bot_mark: case chr_code of 3 | //! first_mark_code: print_esc("firstmark"); 4 | //! bot_mark_code: print_esc("botmark"); 5 | //! split_first_mark_code: print_esc("splitfirstmark"); 6 | //! split_bot_mark_code: print_esc("splitbotmark"); 7 | //! othercases print_esc("topmark") 8 | //! endcases; 9 | //! 10 | //! @ The following code is activated when |cur_cmd=top_bot_mark| and 11 | //! when |cur_chr| is a code like |top_mark_code|. 12 | //! 13 | //! @= 14 | //! begin if cur_mark[cur_chr]<>null then 15 | //! begin_token_list(cur_mark[cur_chr],mark_text); 16 | //! end 17 | //! 18 | -------------------------------------------------------------------------------- /src/tex_the_program/section_0401.rs: -------------------------------------------------------------------------------- 1 | //! ` ` 2 | 3 | // @= 4 | pub(crate) macro Show_the_text_of_the_macro_being_expanded($globals:expr, $ref_count:expr) {{ 5 | // begin begin_diagnostic; print_ln; print_cs(warning_index); 6 | begin_diagnostic($globals); 7 | print_ln(make_globals_io_string_log_view!($globals)); 8 | print_cs($globals, $globals.warning_index as _); 9 | // token_show(ref_count); end_diagnostic(false); 10 | token_show($globals, $ref_count); 11 | end_diagnostic($globals, false); 12 | // end 13 | use crate::section_0004::make_globals_io_string_log_view; 14 | use crate::section_0057::print_ln; 15 | use crate::section_0245::begin_diagnostic; 16 | use crate::section_0245::end_diagnostic; 17 | use crate::section_0262::print_cs; 18 | use crate::section_0295::token_show; 19 | }} 20 | -------------------------------------------------------------------------------- /src/tex_the_program/section_0402.rs: -------------------------------------------------------------------------------- 1 | //! @* \[26] Basic scanning subroutines. 2 | //! Let's turn now to some procedures that \TeX\ calls upon frequently to digest 3 | //! certain kinds of patterns in the input. Most of these are quite simple; 4 | //! some are quite elaborate. Almost all of the routines call |get_x_token|, 5 | //! which can cause them to be invoked recursively. 6 | //! @^stomach@> 7 | //! @^recursion@> 8 | //! 9 | -------------------------------------------------------------------------------- /src/tex_the_program/section_0404.rs: -------------------------------------------------------------------------------- 1 | //! ` ` 2 | // @= 3 | pub(crate) macro Get_the_next_non_blank_non_relax_non_call_token($globals:expr) {{ 4 | // repeat get_x_token; 5 | loop { 6 | get_x_token($globals)?; 7 | // until (cur_cmd<>spacer)and(cur_cmd<>relax) 8 | if $globals.cur_cmd != spacer && $globals.cur_cmd != relax { 9 | break; 10 | } 11 | } 12 | use crate::section_0207::relax; 13 | use crate::section_0207::spacer; 14 | use crate::section_0380::get_x_token; 15 | }} 16 | -------------------------------------------------------------------------------- /src/tex_the_program/section_0406.rs: -------------------------------------------------------------------------------- 1 | //! ` ` 2 | 3 | // @= 4 | pub(crate) macro Get_the_next_non_blank_non_call_token($globals:expr) {{ 5 | // repeat get_x_token; 6 | loop { 7 | get_x_token($globals)?; 8 | // until cur_cmd<>spacer 9 | if $globals.cur_cmd != spacer { 10 | break; 11 | } 12 | } 13 | use crate::section_0207::spacer; 14 | use crate::section_0380::get_x_token; 15 | }} 16 | -------------------------------------------------------------------------------- /src/tex_the_program/section_0408.rs: -------------------------------------------------------------------------------- 1 | //! @ Here is a procedure that sounds an alarm when mu and non-mu units 2 | //! are being switched. 3 | // 4 | // @p procedure mu_error; 5 | pub(crate) fn mu_error(globals: &mut TeXGlobals) -> TeXResult<()> { 6 | // begin print_err("Incompatible glue units"); 7 | print_err!(globals, crate::strpool_str!("Incompatible glue units")); 8 | // @.Incompatible glue units@> 9 | // help1("I'm going to assume that 1mu=1pt when they're mixed."); 10 | help1!( 11 | globals, 12 | crate::strpool_str!("I'm going to assume that 1mu=1pt when they're mixed.") 13 | ); 14 | // error; 15 | error(globals)?; 16 | // end; 17 | crate::ok_nojump!() 18 | } 19 | 20 | use crate::section_0004::TeXGlobals; 21 | use crate::section_0073::print_err; 22 | use crate::section_0079::help1; 23 | use crate::section_0081::TeXResult; 24 | use crate::section_0082::error; 25 | -------------------------------------------------------------------------------- /src/tex_the_program/section_0409.rs: -------------------------------------------------------------------------------- 1 | //! @ The next routine `|scan_something_internal|' is used to fetch internal 2 | //! numeric quantities like `\.{\\hsize}', and also to handle the `\.{\\the}' 3 | //! when expanding constructions like `\.{\\the\\toks0}' and 4 | //! `\.{\\the\\baselineskip}'. Soon we will be considering the |scan_int| 5 | //! procedure, which calls |scan_something_internal|; on the other hand, 6 | //! |scan_something_internal| also calls |scan_int|, for constructions like 7 | //! `\.{\\catcode\`\\\$}' or `\.{\\fontdimen} \.3 \.{\\ff}'. So we 8 | //! have to declare |scan_int| as a |forward| procedure. A few other 9 | //! procedures are also declared at this point. 10 | //! 11 | //! @p procedure@?scan_int; forward; {scans an integer value} 12 | //! @t\4\4@>@@; 13 | //! @t\4\4@>@ 14 | //! 15 | -------------------------------------------------------------------------------- /src/tex_the_program/section_0419.rs: -------------------------------------------------------------------------------- 1 | //! ` ` 2 | // @= 3 | pub(crate) macro Fetch_the_dead_cycles_or_the_insert_penalties($globals:expr, $m:expr) {{ 4 | // begin if m=0 then cur_val:=dead_cycles@+else cur_val:=insert_penalties; 5 | if $m.get() == 0 { 6 | $globals.cur_val = $globals.dead_cycles; 7 | } else { 8 | $globals.cur_val = $globals.insert_penalties; 9 | } 10 | // cur_val_level:=int_val; 11 | $globals.cur_val_level = cur_val_level_kind::int_val; 12 | // end 13 | use crate::section_0410::cur_val_level_kind; 14 | }} 15 | -------------------------------------------------------------------------------- /src/tex_the_program/section_0423.rs: -------------------------------------------------------------------------------- 1 | //! @ @= 2 | //! begin if par_shape_ptr=null then cur_val:=0 3 | //! else cur_val:=info(par_shape_ptr); 4 | //! cur_val_level:=int_val; 5 | //! end 6 | //! 7 | -------------------------------------------------------------------------------- /src/tex_the_program/section_0425.rs: -------------------------------------------------------------------------------- 1 | //! ` ` 2 | 3 | // @= 4 | pub(crate) macro Fetch_a_font_dimension($globals:expr) {{ 5 | // begin find_font_dimen(false); font_info[fmem_ptr].sc:=0; 6 | find_font_dimen($globals, false)?; 7 | $globals.font_info[$globals.fmem_ptr][MEMORY_WORD_SC] = scaled::zero(); 8 | // scanned_result(font_info[cur_val].sc)(dimen_val); 9 | scanned_result!( 10 | $globals, 11 | $globals.font_info[$globals.cur_val as u16][MEMORY_WORD_SC].inner(), 12 | cur_val_level_kind::dimen_val 13 | ); 14 | // end 15 | use crate::section_0101::scaled; 16 | use crate::section_0101::MEMORY_WORD_SC; 17 | use crate::section_0410::cur_val_level_kind; 18 | use crate::section_0413::scanned_result; 19 | use crate::section_0578::find_font_dimen; 20 | }} 21 | -------------------------------------------------------------------------------- /src/tex_the_program/section_0431.rs: -------------------------------------------------------------------------------- 1 | //! ` ` 2 | 3 | // @= 4 | pub(crate) macro Negate_all_three_glue_components_of_cur_val($globals:expr) {{ 5 | // begin negate(width(cur_val)); 6 | negate!(width!($globals, $globals.cur_val as pointer)); 7 | // negate(stretch(cur_val)); 8 | negate!(stretch!($globals, $globals.cur_val as pointer)); 9 | // negate(shrink(cur_val)); 10 | negate!(shrink!($globals, $globals.cur_val as pointer)); 11 | // end 12 | use crate::section_0016::negate; 13 | use crate::section_0115::pointer; 14 | use crate::section_0135::width; 15 | use crate::section_0150::shrink; 16 | use crate::section_0150::stretch; 17 | }} 18 | -------------------------------------------------------------------------------- /src/tex_the_program/section_0432.rs: -------------------------------------------------------------------------------- 1 | //! @ Our next goal is to write the |scan_int| procedure, which scans anything that 2 | //! \TeX\ treats as an integer. But first we might as well look at some simple 3 | //! applications of |scan_int| that have already been made inside of 4 | //! |scan_something_internal|. 5 | //! 6 | -------------------------------------------------------------------------------- /src/tex_the_program/section_0437.rs: -------------------------------------------------------------------------------- 1 | //! ` 2 | 3 | // @= 4 | // procedure scan_twenty_seven_bit_int; 5 | pub(crate) fn scan_twenty_seven_bit_int(globals: &mut TeXGlobals) -> TeXResult<()> { 6 | // begin scan_int; 7 | scan_int(globals)?; 8 | // if (cur_val<0)or(cur_val>@'777777777) then 9 | if globals.cur_val < 0 || globals.cur_val > 0o777777777 { 10 | // begin print_err("Bad delimiter code"); 11 | // @.Bad delimiter code@> 12 | // help2("A numeric delimiter code must be between 0 and 2^{27}-1.")@/ 13 | // ("I changed this one to zero."); int_error(cur_val); cur_val:=0; 14 | // end; 15 | todo!("bad input"); 16 | } 17 | // end; 18 | crate::ok_nojump!() 19 | } 20 | 21 | use crate::section_0004::TeXGlobals; 22 | use crate::section_0081::TeXResult; 23 | use crate::section_0440::scan_int; 24 | -------------------------------------------------------------------------------- /src/tex_the_program/section_0439.rs: -------------------------------------------------------------------------------- 1 | //! @ We initialize the following global variables just in case |expand| 2 | //! comes into action before any of the basic scanning routines has assigned 3 | //! them a value. 4 | //! 5 | //! @= 6 | //! cur_val:=0; cur_val_level:=int_val; radix:=0; cur_order:=normal; 7 | //! 8 | -------------------------------------------------------------------------------- /src/tex_the_program/section_0443.rs: -------------------------------------------------------------------------------- 1 | //! ` ` 2 | // @= 3 | pub(crate) macro Scan_an_optional_space($globals:expr) {{ 4 | // begin get_x_token; if cur_cmd<>spacer then back_input; 5 | get_x_token($globals)?; 6 | if $globals.cur_cmd != spacer { 7 | back_input($globals); 8 | } 9 | // end 10 | use crate::section_0207::spacer; 11 | use crate::section_0325::back_input; 12 | use crate::section_0380::get_x_token; 13 | }} 14 | -------------------------------------------------------------------------------- /src/tex_the_program/section_0450.rs: -------------------------------------------------------------------------------- 1 | //! @ @= 2 | //! @!num,@!denom:1..65536; {conversion ratio for the scanned units} 3 | //! @!k,@!kk:small_number; {number of digits in a decimal fraction} 4 | //! @!p,@!q:pointer; {top of decimal digit stack} 5 | //! @!v:scaled; {an internal dimension} 6 | //! @!save_cur_val:integer; {temporary storage of |cur_val|} 7 | //! 8 | -------------------------------------------------------------------------------- /src/tex_the_program/section_0451.rs: -------------------------------------------------------------------------------- 1 | //! @ The following code is executed when |scan_something_internal| was 2 | //! called asking for |mu_val|, when we really wanted a ``mudimen'' instead 3 | //! of ``muglue.'' 4 | // 5 | // @= 6 | pub(crate) macro Coerce_glue_to_a_dimension($globals:expr) {{ 7 | // if cur_val_level>=glue_val then 8 | if $globals.cur_val_level >= cur_val_level_kind::glue_val { 9 | /// an internal dimension 10 | let v; 11 | // begin v:=width(cur_val); delete_glue_ref(cur_val); cur_val:=v; 12 | v = width!($globals, $globals.cur_val as pointer); 13 | delete_glue_ref($globals, $globals.cur_val as _); 14 | $globals.cur_val = v.inner() as _; 15 | // end 16 | } 17 | use crate::section_0115::pointer; 18 | use crate::section_0135::width; 19 | use crate::section_0201::delete_glue_ref; 20 | use crate::section_0410::cur_val_level_kind; 21 | }} 22 | -------------------------------------------------------------------------------- /src/tex_the_program/section_0457.rs: -------------------------------------------------------------------------------- 1 | //! @ @= 2 | //! begin prepare_mag; 3 | //! if mag<>1000 then 4 | //! begin cur_val:=xn_over_d(cur_val,1000,mag); 5 | //! f:=(1000*f+@'200000*remainder) div mag; 6 | //! cur_val:=cur_val+(f div @'200000); f:=f mod @'200000; 7 | //! end; 8 | //! end 9 | //! 10 | -------------------------------------------------------------------------------- /src/tex_the_program/section_0460.rs: -------------------------------------------------------------------------------- 1 | //! @ @= 2 | //! begin print_err("Dimension too large"); 3 | //! @.Dimension too large@> 4 | //! help2("I can't work with sizes bigger than about 19 feet.")@/ 5 | //! ("Continue and I'll use the largest value I can.");@/ 6 | //! error; cur_val:=max_dimen; arith_error:=false; 7 | //! end 8 | //! 9 | -------------------------------------------------------------------------------- /src/tex_the_program/section_0467.rs: -------------------------------------------------------------------------------- 1 | //! @ Here's part of the |expand| subroutine that we are now ready to complete: 2 | // 3 | // @p procedure ins_the_toks; 4 | #[cfg_attr(feature = "trace", tracing::instrument(level = "trace"))] 5 | pub(crate) fn ins_the_toks(globals: &mut TeXGlobals) -> TeXResult<()> { 6 | // begin link(garbage):=the_toks; ins_list(link(temp_head)); 7 | link!(globals, garbage) = the_toks(globals)?; 8 | ins_list!(globals, link!(globals, temp_head)); 9 | // end; 10 | crate::ok_nojump!() 11 | } 12 | 13 | use crate::section_0004::TeXGlobals; 14 | use crate::section_0081::TeXResult; 15 | use crate::section_0118::link; 16 | use crate::section_0162::garbage; 17 | use crate::section_0162::temp_head; 18 | use crate::section_0323::ins_list; 19 | use crate::section_0465::the_toks; 20 | -------------------------------------------------------------------------------- /src/tex_the_program/section_0475.rs: -------------------------------------------------------------------------------- 1 | //! @ @= 2 | //! begin print_err("Missing { inserted"); incr(align_state); 3 | //! @.Missing \{ inserted@> 4 | //! help2("Where was the left brace? You said something like `\def\a}',")@/ 5 | //! ("which I'm going to interpret as `\def\a{}'."); error; goto found; 6 | //! end 7 | //! 8 | -------------------------------------------------------------------------------- /src/tex_the_program/section_0481.rs: -------------------------------------------------------------------------------- 1 | //! ` ` 2 | 3 | // @= 4 | pub(crate) macro Set_initial_values_of_key_variables_0481($globals:expr) {{ 5 | // for k:=0 to 16 do read_open[k]:=closed; 6 | for k in 0..=16 { 7 | $globals.read_open[k] = read_open_kind::closed; 8 | } 9 | 10 | use crate::section_0480::read_open_kind; 11 | }} 12 | -------------------------------------------------------------------------------- /src/tex_the_program/section_0490.rs: -------------------------------------------------------------------------------- 1 | //! @ @= 2 | //! cond_ptr:=null; if_limit:=normal; cur_if:=0; if_line:=0; 3 | //! 4 | -------------------------------------------------------------------------------- /src/tex_the_program/section_0493.rs: -------------------------------------------------------------------------------- 1 | //! @ When we skip conditional text, we keep track of the line number 2 | //! where skipping began, for use in error messages. 3 | // 4 | // @= 5 | // @!skip_line:integer; {skipping began here} 6 | /// skipping began here 7 | #[globals_struct_field(TeXGlobals)] 8 | pub(crate) static skip_line: integer = 0; 9 | 10 | #[globals_struct_use(TeXGlobals)] 11 | use crate::pascal::integer; 12 | 13 | use crate::section_0004::TeXGlobals; 14 | use globals_struct::{globals_struct_field, globals_struct_use}; 15 | -------------------------------------------------------------------------------- /src/tex_the_program/section_0496.rs: -------------------------------------------------------------------------------- 1 | //! ` ` 2 | 3 | // @= 4 | pub(crate) macro Pop_the_condition_stack($globals:expr) {{ 5 | let p: pointer; 6 | // begin p:=cond_ptr; if_line:=if_line_field(p); 7 | p = $globals.cond_ptr; 8 | $globals.if_line = if_line_field!($globals, p); 9 | // cur_if:=subtype(p); if_limit:=type(p); cond_ptr:=link(p); 10 | $globals.cur_if = subtype!($globals, p).into(); 11 | $globals.if_limit = r#type!($globals, p).into(); 12 | $globals.cond_ptr = link!($globals, p); 13 | // free_node(p,if_node_size); 14 | free_node($globals, p, if_node_size as _); 15 | // end 16 | use crate::section_0115::pointer; 17 | use crate::section_0118::link; 18 | use crate::section_0130::free_node; 19 | use crate::section_0133::r#type; 20 | use crate::section_0133::subtype; 21 | use crate::section_0489::if_line_field; 22 | use crate::section_0489::if_node_size; 23 | }} 24 | -------------------------------------------------------------------------------- /src/tex_the_program/section_0499.rs: -------------------------------------------------------------------------------- 1 | //! @ In a construction like `\.{\\if\\iftrue abc\\else d\\fi}', the first 2 | //! \.{\\else} that we come to after learning that the \.{\\if} is false is 3 | //! not the \.{\\else} we're looking for. Hence the following curious 4 | //! logic is needed. 5 | //! 6 | -------------------------------------------------------------------------------- /src/tex_the_program/section_0502.rs: -------------------------------------------------------------------------------- 1 | //! ` ` 2 | 3 | // @= 4 | pub(crate) macro Display_the_value_of_b($globals:expr, $b:expr) {{ 5 | // begin begin_diagnostic; 6 | begin_diagnostic($globals); 7 | // if b then print("{true}")@+else print("{false}"); 8 | if $b { 9 | print($globals, crate::strpool_str!("{true}").get() as _); 10 | } else { 11 | print($globals, crate::strpool_str!("{false}").get() as _); 12 | } 13 | // end_diagnostic(false); 14 | end_diagnostic($globals, false); 15 | // end 16 | 17 | use crate::section_0059::print; 18 | use crate::section_0245::begin_diagnostic; 19 | use crate::section_0245::end_diagnostic; 20 | }} 21 | -------------------------------------------------------------------------------- /src/tex_the_program/section_0504.rs: -------------------------------------------------------------------------------- 1 | //! ` ` 2 | 3 | // @= 4 | pub(crate) macro Test_if_an_integer_is_odd($globals:expr, $b:expr) {{ 5 | // begin scan_int; b:=odd(cur_val); 6 | scan_int($globals)?; 7 | $b = $globals.cur_val.is_odd(); 8 | // end 9 | use crate::pascal::IsOddOrEven; 10 | use crate::section_0440::scan_int; 11 | }} 12 | -------------------------------------------------------------------------------- /src/tex_the_program/section_0514.rs: -------------------------------------------------------------------------------- 1 | //! @ Input files that can't be found in the user's area may appear in a standard 2 | //! system area called |TEX_area|. Font metric files whose areas are not given 3 | //! explicitly are assumed to appear in a standard system area called 4 | //! |TEX_font_area|. These system area names will, of course, vary from place 5 | //! to place. 6 | //! @^system dependencies@> 7 | // 8 | // @d TEX_area=="TeXinputs:" 9 | pub(crate) macro TEX_area() { 10 | crate::strpool_str!("TeXinputs:") 11 | } 12 | // @.TeXinputs@> 13 | // @d TEX_font_area=="TeXfonts:" 14 | pub(crate) macro TEX_font_area() { 15 | crate::strpool_str!("TeXfonts:") 16 | } 17 | // @.TeXfonts@> 18 | // 19 | -------------------------------------------------------------------------------- /src/tex_the_program/section_0515.rs: -------------------------------------------------------------------------------- 1 | //! @ Here now is the first of the system-dependent routines for file name scanning. 2 | //! @^system dependencies@> 3 | // 4 | // @p procedure begin_name; 5 | #[allow(unused_variables)] 6 | pub(crate) fn begin_name(globals: &mut TeXGlobals) { 7 | // begin area_delimiter:=0; ext_delimiter:=0; 8 | globals.area_delimiter = pool_pointer::zero(); 9 | globals.ext_delimiter = pool_pointer::zero(); 10 | // end; 11 | } 12 | 13 | use crate::section_0004::TeXGlobals; 14 | use crate::section_0038::pool_pointer; 15 | -------------------------------------------------------------------------------- /src/tex_the_program/section_0518.rs: -------------------------------------------------------------------------------- 1 | //! @ Conversely, here is a routine that takes three strings and prints a file 2 | //! name that might have produced them. (The routine is system dependent, because 3 | //! some operating systems put the file area last instead of first.) 4 | //! @^system dependencies@> 5 | // 6 | // @= 7 | // procedure print_file_name(@!n,@!a,@!e:integer); 8 | pub(crate) fn print_file_name(globals: &mut TeXGlobals, n: integer, a: integer, e: integer) { 9 | // begin slow_print(a); slow_print(n); slow_print(e); 10 | slow_print(globals, a); 11 | slow_print(globals, n); 12 | slow_print(globals, e); 13 | // end; 14 | } 15 | 16 | use crate::pascal::integer; 17 | use crate::section_0004::TeXGlobals; 18 | use crate::section_0060::slow_print; 19 | -------------------------------------------------------------------------------- /src/tex_the_program/section_0521.rs: -------------------------------------------------------------------------------- 1 | //! ` ` 2 | // @= 3 | pub(crate) macro Set_initial_values_of_key_variables_0521($globals:expr) {{ 4 | let globals = &mut *$globals; 5 | // TEX_format_default:='TeXformats:plain.fmt'; 6 | for (idx, ch) in " TeXformats:plain.fmt".chars().enumerate().skip(1) { 7 | globals.TEX_format_default[idx as u16] = xchr(ASCII_code::from(ch as u32 as integer)); 8 | } 9 | // @.TeXformats@> 10 | // @.plain@> 11 | // @^system dependencies@> 12 | use crate::pascal::integer; 13 | use crate::section_0018::ASCII_code; 14 | use crate::section_0020::xchr; 15 | }} 16 | -------------------------------------------------------------------------------- /src/tex_the_program/section_0522.rs: -------------------------------------------------------------------------------- 1 | //! @ @= 2 | //! if format_default_length>file_name_size then bad:=31; 3 | //! 4 | -------------------------------------------------------------------------------- /src/tex_the_program/section_0528.rs: -------------------------------------------------------------------------------- 1 | //! @ Initially |job_name=0|; it becomes nonzero as soon as the true name is known. 2 | //! We have |job_name=0| if and only if the `\.{log}' file has not been opened, 3 | //! except of course for a short time just after |job_name| has become nonzero. 4 | // 5 | // @= 6 | // job_name:=0; name_in_progress:=false; log_opened:=false; 7 | // 8 | -------------------------------------------------------------------------------- /src/tex_the_program/section_0533.rs: -------------------------------------------------------------------------------- 1 | //! @ @=output_file_name:=0; 2 | //! 3 | -------------------------------------------------------------------------------- /src/tex_the_program/section_0535.rs: -------------------------------------------------------------------------------- 1 | //! @ Sometimes |open_log_file| is called at awkward moments when \TeX\ is 2 | //! unable to print error messages or even to |show_context|. 3 | //! The |prompt_file_name| routine can result in a |fatal_error|, but the |error| 4 | //! routine will not be invoked because |log_opened| will be false. 5 | //! 6 | //! The normal idea of |batch_mode| is that nothing at all should be written 7 | //! on the terminal. However, in the unusual case that 8 | //! no log file could be opened, we make an exception and allow 9 | //! an explanatory message to be seen. 10 | //! 11 | //! Incidentally, the program always refers to the log file as a `\.{transcript 12 | //! file}', because some systems cannot use the extension `\.{.log}' for 13 | //! this file. 14 | //! 15 | //! @= 16 | //! begin selector:=term_only; 17 | //! prompt_file_name("transcript file name",".log"); 18 | //! end 19 | //! 20 | -------------------------------------------------------------------------------- /src/tex_the_program/section_0551.rs: -------------------------------------------------------------------------------- 1 | //! @ @= 2 | //! for k:=font_base to font_max do font_used[k]:=false; 3 | //! 4 | -------------------------------------------------------------------------------- /src/tex_the_program/section_0555.rs: -------------------------------------------------------------------------------- 1 | //! @ The global variable |null_character| is set up to be a word of 2 | //! |char_info| for a character that doesn't exist. Such a word provides a 3 | //! convenient way to deal with erroneous situations. 4 | // 5 | // @= 6 | // @!null_character:four_quarters; {nonexistent character information} 7 | crate::moved_to_other_section!(section 0556); 8 | -------------------------------------------------------------------------------- /src/tex_the_program/section_0556.rs: -------------------------------------------------------------------------------- 1 | //! ` ` 2 | 3 | // @= 4 | // null_character.b0:=min_quarterword; null_character.b1:=min_quarterword; 5 | // null_character.b2:=min_quarterword; null_character.b3:=min_quarterword; 6 | /// nonexistent character information 7 | pub(crate) const NULL_CHARACTER: char_info = 8 | char_info::from_four_quarters(four_quarters::new_with_quarters( 9 | min_quarterword, 10 | min_quarterword, 11 | min_quarterword, 12 | min_quarterword, 13 | )); 14 | 15 | use crate::section_0110::min_quarterword; 16 | use crate::section_0113::four_quarters; 17 | use crate::section_0554::char_info; 18 | -------------------------------------------------------------------------------- /src/tex_the_program/section_0559.rs: -------------------------------------------------------------------------------- 1 | //! ` ` 2 | 3 | // @=x_height(cur_font) 4 | pub(crate) macro The_x_height_for_cur_font($globals:expr) { 5 | crate::section_0558::x_height!( 6 | $globals, 7 | crate::section_0548::internal_font_number::from(crate::section_0230::cur_font!($globals)) 8 | ) 9 | } 10 | -------------------------------------------------------------------------------- /src/tex_the_program/section_0567.rs: -------------------------------------------------------------------------------- 1 | //! @ @= 2 | //! begin start_font_error_message; 3 | //! print(" not loaded: Not enough room left"); 4 | //! @.Font x=xx not loaded...@> 5 | //! help4("I'm afraid I won't be able to make use of this font,")@/ 6 | //! ("because my memory for character-size data is too small.")@/ 7 | //! ("If you're really stuck, ask a wizard to enlarge me.")@/ 8 | //! ("Or maybe try `I\font='."); 9 | //! error; goto done; 10 | //! end 11 | //! 12 | -------------------------------------------------------------------------------- /src/tex_the_program/section_0572.rs: -------------------------------------------------------------------------------- 1 | //! ` ` 2 | 3 | // @= 4 | pub(crate) macro Replace_z_by_z_prime_and_compute_alpha_beta($globals:expr, $z:expr, $alpha:expr, $beta:expr) {{ 5 | // begin alpha:=16; 6 | $alpha = 16; 7 | // while z>=@'40000000 do 8 | while $z.inner() >= 0o40000000 { 9 | // begin z:=z div 2; alpha:=alpha+alpha; 10 | $z = scaled::new_from_inner($z.inner() / 2); 11 | $alpha = $alpha + $alpha; 12 | // end; 13 | } 14 | // beta:=256 div alpha; alpha:=alpha*z; 15 | $beta = (256 / $alpha) as u8; 16 | $alpha = $alpha * $z.inner(); 17 | // end 18 | use crate::section_0101::scaled; 19 | }} 20 | -------------------------------------------------------------------------------- /src/tex_the_program/section_0579.rs: -------------------------------------------------------------------------------- 1 | //! ` ` 2 | // @= 3 | pub(crate) macro Issue_an_error_message_if_cur_val_eq_fmem_ptr($globals:expr) {{ 4 | // if cur_val=fmem_ptr then 5 | if $globals.cur_val == $globals.fmem_ptr.get() as integer { 6 | todo!("issue error message"); 7 | // begin print_err("Font "); print_esc(font_id_text(f)); 8 | // print(" has only "); print_int(font_params[f]); 9 | // print(" fontdimen parameters"); 10 | // @.Font x has only...@> 11 | // help2("To increase the number of font parameters, you must")@/ 12 | // ("use \fontdimen immediately after the \font is loaded."); 13 | // error; 14 | // end 15 | } 16 | use crate::pascal::integer; 17 | }} 18 | -------------------------------------------------------------------------------- /src/tex_the_program/section_0593.rs: -------------------------------------------------------------------------------- 1 | //! ` ` 2 | // @= 3 | pub(crate) macro Set_initial_values_of_key_variables_0593($globals:expr) {{ 4 | let globals = &mut *$globals; 5 | // total_pages:=0; max_v:=0; max_h:=0; max_push:=0; last_bop:=-1; 6 | globals.total_pages = 0; 7 | globals.max_v = scaled::zero(); 8 | globals.max_h = scaled::zero(); 9 | globals.max_push = 0; 10 | globals.last_bop = -1; 11 | // doing_leaders:=false; dead_cycles:=0; cur_s:=-1; 12 | globals.doing_leaders = false; 13 | globals.dead_cycles = 0; 14 | globals.cur_s = -1; 15 | 16 | use crate::section_0101::scaled; 17 | }} 18 | -------------------------------------------------------------------------------- /src/tex_the_program/section_0596.rs: -------------------------------------------------------------------------------- 1 | //! @ Initially the buffer is all in one piece; we will output half of it only 2 | //! after it first fills up. 3 | // 4 | // @= 5 | pub(crate) macro Set_initial_values_of_key_variables_0596($globals:expr) {{ 6 | let globals = &mut *$globals; 7 | // half_buf:=dvi_buf_size div 2; dvi_limit:=dvi_buf_size; dvi_ptr:=0; 8 | globals.half_buf = (dvi_buf_size / 2).into(); 9 | globals.dvi_limit = dvi_buf_size.into(); 10 | globals.dvi_ptr = 0.into(); 11 | // dvi_offset:=0; dvi_gone:=0; 12 | globals.dvi_offset = 0; 13 | globals.dvi_gone = 0; 14 | 15 | use crate::section_0011::dvi_buf_size; 16 | }} 17 | -------------------------------------------------------------------------------- /src/tex_the_program/section_0599.rs: -------------------------------------------------------------------------------- 1 | //! @ Here is how we clean out the buffer when \TeX\ is all through; |dvi_ptr| 2 | //! will be a multiple of~4. 3 | // 4 | // @= 5 | pub(crate) macro Empty_the_last_bytes_out_of_dvi_buf($globals:expr) {{ 6 | // if dvi_limit=half_buf then write_dvi(half_buf,dvi_buf_size-1); 7 | if $globals.dvi_limit == $globals.half_buf { 8 | write_dvi($globals, $globals.half_buf, (dvi_buf_size - 1).into()); 9 | } 10 | // if dvi_ptr>0 then write_dvi(0,dvi_ptr-1) 11 | if $globals.dvi_ptr > 0 { 12 | write_dvi($globals, 0.into(), $globals.dvi_ptr - 1); 13 | } 14 | use crate::section_0011::dvi_buf_size; 15 | use crate::section_0597::write_dvi; 16 | }} 17 | -------------------------------------------------------------------------------- /src/tex_the_program/section_0601.rs: -------------------------------------------------------------------------------- 1 | //! @ A mild optimization of the output is performed by the |dvi_pop| 2 | //! routine, which issues a |pop| unless it is possible to cancel a 3 | //! `|push| |pop|' pair. The parameter to |dvi_pop| is the byte address 4 | //! following the old |push| that matches the new |pop|. 5 | // 6 | // @p procedure dvi_pop(@!l:integer); 7 | pub(crate) fn dvi_pop(globals: &mut TeXGlobals, l: integer) { 8 | // begin if (l=dvi_offset+dvi_ptr)and(dvi_ptr>0) then decr(dvi_ptr) 9 | if l == globals.dvi_offset + globals.dvi_ptr.get() as integer && globals.dvi_ptr.get() > 0 { 10 | decr!(globals.dvi_ptr); 11 | } 12 | // else dvi_out(pop); 13 | else { 14 | dvi_out!(globals, pop.byte()); 15 | } 16 | // end; 17 | } 18 | 19 | use crate::pascal::integer; 20 | use crate::section_0004::TeXGlobals; 21 | use crate::section_0016::decr; 22 | use crate::section_0586::pop; 23 | use crate::section_0598::dvi_out; 24 | -------------------------------------------------------------------------------- /src/tex_the_program/section_0603.rs: -------------------------------------------------------------------------------- 1 | //! ` ` 2 | // @= 3 | pub(crate) macro Output_the_font_name_whose_internal_number_is_f($globals:expr, $f:expr) {{ 4 | // for k:=str_start[font_area[f]] to str_start[font_area[f]+1]-1 do 5 | for k in $globals.str_start[$globals.font_area[$f]].get() 6 | ..=$globals.str_start[$globals.font_area[$f] + 1].get() - 1 7 | { 8 | // dvi_out(so(str_pool[k])); 9 | dvi_out!($globals, $globals.str_pool[k].numeric_value()); 10 | } 11 | // for k:=str_start[font_name[f]] to str_start[font_name[f]+1]-1 do 12 | for k in $globals.str_start[$globals.font_name[$f]].get() 13 | ..=$globals.str_start[$globals.font_name[$f] + 1].get() - 1 14 | { 15 | // dvi_out(so(str_pool[k])) 16 | dvi_out!($globals, $globals.str_pool[k].numeric_value()); 17 | } 18 | use crate::section_0598::dvi_out; 19 | }} 20 | -------------------------------------------------------------------------------- /src/tex_the_program/section_0606.rs: -------------------------------------------------------------------------------- 1 | //! @ @= 2 | //! down_ptr:=null; right_ptr:=null; 3 | //! 4 | -------------------------------------------------------------------------------- /src/tex_the_program/section_0618.rs: -------------------------------------------------------------------------------- 1 | //! @ When |hlist_out| is called, its duty is to output the box represented 2 | //! by the |hlist_node| pointed to by |temp_ptr|. The reference point of that 3 | //! box has coordinates |(cur_h,cur_v)|. 4 | //! 5 | //! Similarly, when |vlist_out| is called, its duty is to output the box represented 6 | //! by the |vlist_node| pointed to by |temp_ptr|. The reference point of that 7 | //! box has coordinates |(cur_h,cur_v)|. 8 | //! @^recursion@> 9 | //! 10 | //! @p procedure@?vlist_out; forward; {|hlist_out| and |vlist_out| are mutually 11 | //! recursive} 12 | //! 13 | -------------------------------------------------------------------------------- /src/tex_the_program/section_0643.rs: -------------------------------------------------------------------------------- 1 | //! ` ` 2 | // @= 3 | pub(crate) macro Output_the_font_definitions_for_all_fonts_that_were_used($globals:expr) {{ 4 | // while font_ptr>font_base do 5 | while $globals.font_ptr.get() as integer > font_base as integer { 6 | // begin if font_used[font_ptr] then dvi_font_def(font_ptr); 7 | if $globals.font_used[$globals.font_ptr] { 8 | dvi_font_def($globals, $globals.font_ptr); 9 | } 10 | // decr(font_ptr); 11 | decr!($globals.font_ptr); 12 | // end 13 | } 14 | use crate::pascal::integer; 15 | use crate::section_0012::font_base; 16 | use crate::section_0016::decr; 17 | use crate::section_0602::dvi_font_def; 18 | }} 19 | -------------------------------------------------------------------------------- /src/tex_the_program/section_0647.rs: -------------------------------------------------------------------------------- 1 | //! @ If the global variable |adjust_tail| is non-null, the |hpack| routine 2 | //! also removes all occurrences of |ins_node|, |mark_node|, and |adjust_node| 3 | //! items and appends the resulting material onto the list that ends at 4 | //! location |adjust_tail|. 5 | // 6 | // @= 7 | // @!adjust_tail:pointer; {tail of adjustment list} 8 | /// tail of adjustment list 9 | #[globals_struct_field(TeXGlobals)] 10 | pub(crate) static adjust_tail: pointer = null; 11 | 12 | #[globals_struct_use(TeXGlobals)] 13 | use crate::section_0115::pointer; 14 | 15 | #[globals_struct_use(TeXGlobals)] 16 | use crate::section_0115::null; 17 | 18 | use crate::section_0004::TeXGlobals; 19 | use globals_struct::{globals_struct_field, globals_struct_use}; 20 | -------------------------------------------------------------------------------- /src/tex_the_program/section_0648.rs: -------------------------------------------------------------------------------- 1 | //! ` ` 2 | // @=adjust_tail:=null; last_badness:=0; 3 | // 4 | -------------------------------------------------------------------------------- /src/tex_the_program/section_0652.rs: -------------------------------------------------------------------------------- 1 | //! ` ` 2 | 3 | // @= 4 | pub(crate) macro Make_node_p_look_like_a_char_node_and_goto_reswitch($globals:expr, $p:expr, $lbl_reswitch:lifetime) {{ 5 | // begin mem[lig_trick]:=mem[lig_char(p)]; link(lig_trick):=link(p); 6 | $globals.mem[lig_trick] = $globals.mem[lig_char!($p)]; 7 | link!($globals, lig_trick) = link!($globals, $p); 8 | // p:=lig_trick; goto reswitch; 9 | $p = lig_trick; 10 | crate::goto_backward_label!($lbl_reswitch); 11 | // end 12 | use crate::section_0118::link; 13 | use crate::section_0143::lig_char; 14 | use crate::section_0162::lig_trick; 15 | }} 16 | -------------------------------------------------------------------------------- /src/tex_the_program/section_0659.rs: -------------------------------------------------------------------------------- 1 | //! ` ` 2 | // @= 3 | pub(crate) macro Determine_the_stretch_order($globals:expr, $o:expr) {{ 4 | // if total_stretch[filll]<>0 then o:=filll 5 | if $globals.total_stretch[glue_ord::filll] != scaled::zero() { 6 | $o = glue_ord::filll; 7 | } 8 | // else if total_stretch[fill]<>0 then o:=fill 9 | else if $globals.total_stretch[glue_ord::fill] != scaled::zero() { 10 | $o = glue_ord::fill; 11 | } 12 | // else if total_stretch[fil]<>0 then o:=fil 13 | else if $globals.total_stretch[glue_ord::fil] != scaled::zero() { 14 | $o = glue_ord::fil; 15 | } 16 | // else o:=normal 17 | else { 18 | $o = glue_ord::normal; 19 | } 20 | use crate::section_0101::scaled; 21 | use crate::section_0150::glue_ord; 22 | }} 23 | -------------------------------------------------------------------------------- /src/tex_the_program/section_0661.rs: -------------------------------------------------------------------------------- 1 | //! @ In order to provide a decent indication of where an overfull or underfull 2 | //! box originated, we use a global variable |pack_begin_line| that is 3 | //! set nonzero only when |hpack| is being called by the paragraph builder 4 | //! or the alignment finishing routine. 5 | 6 | // 7 | // @= 8 | // @!pack_begin_line:integer; {source file line where the current paragraph 9 | // or alignment began; a negative value denotes alignment} 10 | /// source file line where the current paragraph or alignment began; 11 | /// a negative value denotes alignment 12 | #[globals_struct_field(TeXGlobals)] 13 | pub(crate) static pack_begin_line: integer = 0; 14 | 15 | #[globals_struct_use(TeXGlobals)] 16 | use crate::pascal::integer; 17 | 18 | use crate::section_0004::TeXGlobals; 19 | use globals_struct::{globals_struct_field, globals_struct_use}; 20 | -------------------------------------------------------------------------------- /src/tex_the_program/section_0662.rs: -------------------------------------------------------------------------------- 1 | //! @ @= 2 | //! pack_begin_line:=0; 3 | //! 4 | -------------------------------------------------------------------------------- /src/tex_the_program/section_0665.rs: -------------------------------------------------------------------------------- 1 | //! ` ` 2 | // @= 3 | pub(crate) macro Determine_the_shrink_order($globals:expr, $o:expr) {{ 4 | // if total_shrink[filll]<>0 then o:=filll 5 | if $globals.total_shrink[glue_ord::filll] != scaled::zero() { 6 | $o = glue_ord::filll; 7 | } 8 | // else if total_shrink[fill]<>0 then o:=fill 9 | else if $globals.total_shrink[glue_ord::fill] != scaled::zero() { 10 | $o = glue_ord::fill; 11 | } 12 | // else if total_shrink[fil]<>0 then o:=fil 13 | else if $globals.total_shrink[glue_ord::fil] != scaled::zero() { 14 | $o = glue_ord::fil; 15 | } 16 | // else o:=normal 17 | else { 18 | $o = glue_ord::normal; 19 | } 20 | use crate::section_0101::scaled; 21 | use crate::section_0150::glue_ord; 22 | }} 23 | -------------------------------------------------------------------------------- /src/tex_the_program/section_0677.rs: -------------------------------------------------------------------------------- 1 | //! @ @= 2 | //! if (-x-total_shrink[normal]>vfuzz)or(vbadness<100) then 3 | //! begin print_ln; print_nl("Overfull \vbox ("); 4 | //! @.Overfull \\vbox...@> 5 | //! print_scaled(-x-total_shrink[normal]); print("pt too high"); 6 | //! goto common_ending; 7 | //! end 8 | //! 9 | -------------------------------------------------------------------------------- /src/tex_the_program/section_0678.rs: -------------------------------------------------------------------------------- 1 | //! ` ` 2 | 3 | // @= 4 | pub(crate) macro Report_a_tight_vbox_and_goto_common_ending__if_this_box_is_sufficiently_bad($globals:expr, $x:expr) {{ 5 | // begin last_badness:=badness(-x,total_shrink[normal]); 6 | $globals.last_badness = badness($globals, -$x, $globals.total_shrink[glue_ord::normal]) as _; 7 | // if last_badness>vbadness then 8 | if $globals.last_badness > vbadness!($globals) { 9 | // begin print_ln; print_nl("Tight \vbox (badness "); print_int(last_badness); 10 | // @.Tight \\vbox...@> 11 | // goto common_ending; 12 | // end; 13 | todo!("Report a tight vbox"); 14 | } 15 | // end 16 | use crate::section_0108::badness; 17 | use crate::section_0150::glue_ord; 18 | use crate::section_0236::vbadness; 19 | }} 20 | -------------------------------------------------------------------------------- /src/tex_the_program/section_0685.rs: -------------------------------------------------------------------------------- 1 | //! ` ` 2 | 3 | // @= 4 | // empty_field.rh:=empty; empty_field.lh:=null;@/ 5 | // null_delimiter.b0:=0; null_delimiter.b1:=min_quarterword;@/ 6 | // null_delimiter.b2:=0; null_delimiter.b3:=min_quarterword; 7 | const _: () = (); 8 | -------------------------------------------------------------------------------- /src/tex_the_program/section_0718.rs: -------------------------------------------------------------------------------- 1 | //! @ Sometimes it is necessary to destroy an mlist. The following 2 | //! subroutine empties the current list, assuming that |abs(mode)=mmode|. 3 | //! 4 | //! @p procedure flush_math; 5 | //! begin flush_node_list(link(head)); flush_node_list(incompleat_noad); 6 | //! link(head):=null; tail:=head; incompleat_noad:=null; 7 | //! end; 8 | //! 9 | -------------------------------------------------------------------------------- /src/tex_the_program/section_0723.rs: -------------------------------------------------------------------------------- 1 | //! @ @= 2 | //! begin print_err(""); print_size(cur_size); print_char(" "); 3 | //! print_int(fam(a)); print(" is undefined (character "); 4 | //! print_ASCII(qo(cur_c)); print_char(")"); 5 | //! help4("Somewhere in the math formula just ended, you used the")@/ 6 | //! ("stated character from an undefined font family. For example,")@/ 7 | //! ("plain TeX doesn't allow \it or \sl in subscripts. Proceed,")@/ 8 | //! ("and I'll try to forget that I needed that character."); 9 | //! error; cur_i:=null_character; math_type(a):=empty; 10 | //! end 11 | //! 12 | -------------------------------------------------------------------------------- /src/tex_the_program/section_0724.rs: -------------------------------------------------------------------------------- 1 | //! @ The outputs of |fetch| are placed in global variables. 2 | // 3 | // @= 4 | // @!cur_f:internal_font_number; {the |font| field of a |math_char|} 5 | // @!cur_c:quarterword; {the |character| field of a |math_char|} 6 | // @!cur_i:four_quarters; {the |char_info| of a |math_char|, 7 | // or a lig/kern instruction} 8 | pub(crate) struct FetchedMathCharInfo { 9 | /// the `font` field of a `math_char` 10 | pub(crate) cur_f: internal_font_number, 11 | /// the `character` field of a `math_char` 12 | pub(crate) cur_c: ASCII_code, 13 | /// the `char_info` of a `math_char`, or a lig/kern instruction 14 | pub(crate) cur_i: char_info, 15 | } 16 | 17 | use crate::section_0018::ASCII_code; 18 | use crate::section_0548::internal_font_number; 19 | use crate::section_0554::char_info; 20 | -------------------------------------------------------------------------------- /src/tex_the_program/section_0729.rs: -------------------------------------------------------------------------------- 1 | //! ` ` 2 | 3 | // @= 4 | pub(crate) macro Convert_a_final_bin_noad_to_an_ord_noad($globals:expr, $r:expr, $r_type:expr) {{ 5 | // if r_type=bin_noad then type(r):=ord_noad 6 | if $r_type == bin_noad { 7 | r#type!($globals, $r) = ord_noad; 8 | } 9 | use crate::section_0133::r#type; 10 | use crate::section_0682::bin_noad; 11 | use crate::section_0682::ord_noad; 12 | }} 13 | -------------------------------------------------------------------------------- /src/tex_the_program/section_0739.rs: -------------------------------------------------------------------------------- 1 | //! ` ` 2 | // @= 3 | pub(crate) macro Make_the_height_of_box_y_equal_to_h($globals:expr, $y:expr, $h:expr, $p:expr) {{ 4 | // begin p:=new_kern(h-height(y)); link(p):=list_ptr(y); list_ptr(y):=p; 5 | $p = new_kern($globals, $h - height!($globals, $y))?; 6 | link!($globals, $p) = list_ptr!($globals, $y); 7 | list_ptr!($globals, $y) = $p; 8 | // height(y):=h; 9 | height!($globals, $y) = $h; 10 | // end 11 | use crate::section_0118::link; 12 | use crate::section_0135::height; 13 | use crate::section_0135::list_ptr; 14 | use crate::section_0156::new_kern; 15 | }} 16 | -------------------------------------------------------------------------------- /src/tex_the_program/section_0763.rs: -------------------------------------------------------------------------------- 1 | //! ` ` 2 | // @= 3 | pub(crate) macro Change_the_current_style_and_goto_delete_q($globals:expr, $q:expr, $s:expr, $lbl_delete_q:lifetime) {{ 4 | // begin cur_style:=subtype(q); s:=style_node_size; 5 | $globals.cur_style = subtype!($globals, $q).into(); 6 | $s = style_node_size; 7 | // @; 8 | crate::section_0703::Set_up_the_values_of_cur_size_and_cur_mu__based_on_cur_style!($globals); 9 | // goto delete_q; 10 | crate::goto_forward_label!($lbl_delete_q); 11 | // end 12 | use crate::section_0133::subtype; 13 | use crate::section_0688::style_node_size; 14 | }} 15 | -------------------------------------------------------------------------------- /src/tex_the_program/section_0765.rs: -------------------------------------------------------------------------------- 1 | //! ` ` 2 | 3 | // @= 4 | // magic_offset:=str_start[math_spacing]-9*ord_noad 5 | pub(crate) const MATH_SPACING_OFFSET: isize = -9 * ord_noad as isize; 6 | 7 | use crate::section_0682::ord_noad; 8 | -------------------------------------------------------------------------------- /src/tex_the_program/section_0771.rs: -------------------------------------------------------------------------------- 1 | //! @ The |align_state| and |preamble| variables are initialized elsewhere. 2 | //! 3 | //! @= 4 | //! align_ptr:=null; cur_align:=null; cur_span:=null; cur_loop:=null; 5 | //! cur_head:=null; cur_tail:=null; 6 | //! 7 | -------------------------------------------------------------------------------- /src/tex_the_program/section_0773.rs: -------------------------------------------------------------------------------- 1 | //! @ \TeX\ has eight procedures that govern alignments: |init_align| and 2 | //! |fin_align| are used at the very beginning and the very end; |init_row| and 3 | //! |fin_row| are used at the beginning and end of individual rows; |init_span| 4 | //! is used at the beginning of a sequence of spanned columns (possibly involving 5 | //! only one column); |init_col| and |fin_col| are used at the beginning and 6 | //! end of individual columns; and |align_peek| is used after \.{\\cr} to see 7 | //! whether the next item is \.{\\noalign}. 8 | //! 9 | //! We shall consider these routines in the order they are first used during 10 | //! the course of a complete \.{\\halign}, namely |init_align|, |align_peek|, 11 | //! |init_row|, |init_span|, |init_col|, |fin_col|, |fin_row|, |fin_align|. 12 | //! 13 | -------------------------------------------------------------------------------- /src/tex_the_program/section_0778.rs: -------------------------------------------------------------------------------- 1 | //! ` ` 2 | // @= 3 | pub(crate) macro Append_the_current_tabskip_glue_to_the_preamble_list($globals:expr) {{ 4 | // link(cur_align):=new_param_glue(tab_skip_code); 5 | link!($globals, $globals.cur_align) = new_param_glue($globals, tab_skip_code.into())?; 6 | // cur_align:=link(cur_align) 7 | $globals.cur_align = link!($globals, $globals.cur_align); 8 | use crate::section_0118::link; 9 | use crate::section_0152::new_param_glue; 10 | use crate::section_0224::tab_skip_code; 11 | }} 12 | -------------------------------------------------------------------------------- /src/tex_the_program/section_0790.rs: -------------------------------------------------------------------------------- 1 | //! @ The token list |omit_template| just referred to is a constant token 2 | //! list that contains the special control sequence \.{\\endtemplate} only. 3 | // 4 | // @= 5 | pub(crate) macro Initialize_the_special_list_heads_and_constant_nodes_0790($globals:expr) {{ 6 | // info(omit_template):=end_template_token; {|link(omit_template)=null|} 7 | info_tok_assign!( 8 | $globals, 9 | omit_template, 10 | cur_tok_type::new(end_template_token) 11 | ); 12 | /// `link(omit_template)=null` 13 | const _: () = (); 14 | 15 | use crate::section_0118::info_tok_assign; 16 | use crate::section_0162::omit_template; 17 | use crate::section_0297::cur_tok_type; 18 | use crate::section_0780::end_template_token; 19 | }} 20 | -------------------------------------------------------------------------------- /src/tex_the_program/section_0795.rs: -------------------------------------------------------------------------------- 1 | //! ` ` 2 | // @= 3 | pub(crate) macro Copy_the_tabskip_glue_between_columns($globals:expr) {{ 4 | // tail_append(new_glue(glue_ptr(link(cur_align)))); 5 | tail_append!( 6 | $globals, 7 | new_glue( 8 | $globals, 9 | glue_ptr!($globals, link!($globals, $globals.cur_align)), 10 | )? 11 | ); 12 | // subtype(tail):=tab_skip_code+1 13 | subtype!($globals, tail!($globals)) = tab_skip_code + 1; 14 | use crate::section_0118::link; 15 | use crate::section_0133::subtype; 16 | use crate::section_0149::glue_ptr; 17 | use crate::section_0153::new_glue; 18 | use crate::section_0213::tail; 19 | use crate::section_0214::tail_append; 20 | use crate::section_0224::tab_skip_code; 21 | }} 22 | -------------------------------------------------------------------------------- /src/tex_the_program/section_0820.rs: -------------------------------------------------------------------------------- 1 | //! ` ` 2 | 3 | // @= 4 | pub(crate) macro Initialize_the_special_list_heads_and_constant_nodes_0820($globals:expr) {{ 5 | // type(last_active):=hyphenated; line_number(last_active):=max_halfword; 6 | r#type!($globals, last_active!()) = hyphenated; 7 | line_number!($globals, last_active!()) = max_halfword; 8 | // subtype(last_active):=0; {the |subtype| is never examined by the algorithm} 9 | /// the `subtype` is never examined by the algorithm 10 | const _: () = (); 11 | subtype!($globals, last_active!()) = 0; 12 | use crate::section_0110::max_halfword; 13 | use crate::section_0133::r#type; 14 | use crate::section_0133::subtype; 15 | use crate::section_0819::hyphenated; 16 | use crate::section_0819::last_active; 17 | use crate::section_0819::line_number; 18 | }} 19 | -------------------------------------------------------------------------------- /src/tex_the_program/section_0831.rs: -------------------------------------------------------------------------------- 1 | //! ` ` 2 | // @= 3 | pub(crate) macro Make_sure_that_pi_is_in_the_proper_range($globals:expr, $pi:expr) {{ 4 | // if abs(pi)>=inf_penalty then 5 | if $pi.abs() >= inf_penalty { 6 | // if pi>0 then return {this breakpoint is inhibited by infinite penalty} 7 | if $pi > 0 { 8 | /// this breakpoint is inhibited by infinite penalty 9 | const _: () = (); 10 | crate::return_nojump!(); 11 | } 12 | // else pi:=eject_penalty {this breakpoint will be forced} 13 | else { 14 | /// this breakpoint will be forced 15 | const _: () = (); 16 | $pi = eject_penalty; 17 | } 18 | } 19 | use crate::section_0157::eject_penalty; 20 | use crate::section_0157::inf_penalty; 21 | }} 22 | -------------------------------------------------------------------------------- /src/tex_the_program/section_0834.rs: -------------------------------------------------------------------------------- 1 | //! ` ` 2 | // @= 3 | pub(crate) macro Get_ready_to_start_line_breaking_0834($globals:expr) {{ 4 | // minimum_demerits:=awful_bad; 5 | $globals.minimum_demerits = awful_bad; 6 | // minimal_demerits[tight_fit]:=awful_bad; 7 | $globals.minimal_demerits[fit_class_kind::tight_fit] = awful_bad; 8 | // minimal_demerits[decent_fit]:=awful_bad; 9 | $globals.minimal_demerits[fit_class_kind::decent_fit] = awful_bad; 10 | // minimal_demerits[loose_fit]:=awful_bad; 11 | $globals.minimal_demerits[fit_class_kind::loose_fit] = awful_bad; 12 | // minimal_demerits[very_loose_fit]:=awful_bad; 13 | $globals.minimal_demerits[fit_class_kind::very_loose_fit] = awful_bad; 14 | 15 | use crate::section_0817::fit_class_kind; 16 | use crate::section_0833::awful_bad; 17 | }} 18 | -------------------------------------------------------------------------------- /src/tex_the_program/section_0876.rs: -------------------------------------------------------------------------------- 1 | //! @ Once the best sequence of breakpoints has been found (hurray), we call on the 2 | //! procedure |post_line_break| to finish the remainder of the work. 3 | //! (By introducing this subprocedure, we are able to keep |line_break| 4 | //! from getting extremely long.) 5 | // 6 | // @= 7 | pub(crate) macro Break_the_paragraph_at_the_chosen_breakpoints__justify_the_resulting_lines_to_the_correct_widths__and_append_them_to_the_current_vertical_list($globals:expr, $final_widow_penalty:expr) {{ 8 | crate::trace_span!("Break the paragraph at the chosen..."); 9 | // post_line_break(final_widow_penalty) 10 | post_line_break($globals, $final_widow_penalty)?; 11 | use crate::section_0877::post_line_break; 12 | }} 13 | -------------------------------------------------------------------------------- /src/tex_the_program/section_0885.rs: -------------------------------------------------------------------------------- 1 | //! ` ` 2 | //! We move the pre-break list from inside node |q| to the main list by 3 | //! re\-attaching it just after the present node |q|, then resetting |q|. 4 | // 5 | // @= 6 | pub(crate) macro Transplant_the_pre_break_list($globals:expr, $q:expr) {{ 7 | /// temporary registers for list manipulation 8 | let mut s; 9 | // begin s:=pre_break(q); link(q):=s; 10 | s = pre_break!($globals, $q); 11 | link!($globals, $q) = s; 12 | // while link(s)<>null do s:=link(s); 13 | while link!($globals, s) != null { 14 | s = link!($globals, s); 15 | } 16 | // pre_break(q):=null; q:=s; 17 | pre_break!($globals, $q) = null; 18 | $q = s; 19 | // end 20 | use crate::section_0115::null; 21 | use crate::section_0118::link; 22 | use crate::section_0145::pre_break; 23 | }} 24 | -------------------------------------------------------------------------------- /src/tex_the_program/section_0886.rs: -------------------------------------------------------------------------------- 1 | //! ` ` 2 | // @= 3 | pub(crate) macro Put_the_rightskip_glue_after_node_q($globals:expr, $q:expr) {{ 4 | /// temporary registers for list manipulation 5 | let r: pointer; 6 | // r:=new_param_glue(right_skip_code); link(r):=link(q); link(q):=r; q:=r 7 | r = new_param_glue($globals, right_skip_code.into())?; 8 | link!($globals, r) = link!($globals, $q); 9 | link!($globals, $q) = r; 10 | $q = r; 11 | use crate::section_0115::pointer; 12 | use crate::section_0118::link; 13 | use crate::section_0152::new_param_glue; 14 | use crate::section_0224::right_skip_code; 15 | }} 16 | -------------------------------------------------------------------------------- /src/tex_the_program/section_0888.rs: -------------------------------------------------------------------------------- 1 | //! ` ` 2 | // @= 3 | pub(crate) macro Append_the_new_box_to_the_current_vertical_list__followed_by_the_list_of_special_nodes_taken_out_of_the_box_by_the_packager($globals:expr) {{ 4 | // append_to_vlist(just_box); 5 | append_to_vlist($globals, $globals.just_box)?; 6 | // if adjust_head<>adjust_tail then 7 | if adjust_head != $globals.adjust_tail { 8 | // begin link(tail):=link(adjust_head); tail:=adjust_tail; 9 | link!($globals, tail!($globals)) = link!($globals, adjust_head); 10 | tail!($globals) = $globals.adjust_tail; 11 | // end; 12 | } 13 | // adjust_tail:=null 14 | $globals.adjust_tail = null; 15 | use crate::section_0115::null; 16 | use crate::section_0118::link; 17 | use crate::section_0162::adjust_head; 18 | use crate::section_0213::tail; 19 | use crate::section_0679::append_to_vlist; 20 | }} 21 | -------------------------------------------------------------------------------- /src/tex_the_program/section_0893.rs: -------------------------------------------------------------------------------- 1 | //! @ Hyphenation routines need a few more local variables. 2 | //! 3 | //! @= 4 | //! @!j:small_number; {an index into |hc| or |hu|} 5 | //! @!c:0..255; {character being considered for hyphenation} 6 | //! 7 | -------------------------------------------------------------------------------- /src/tex_the_program/section_0901.rs: -------------------------------------------------------------------------------- 1 | //! ` ` 2 | // @= 3 | // @!i,@!j,@!l:0..65; {indices into |hc| or |hu|} 4 | // @!q,@!r,@!s:pointer; {temporary registers for list manipulation} 5 | // @!bchar:halfword; {boundary character of hyphenated word, or |non_char|} 6 | // 7 | -------------------------------------------------------------------------------- /src/tex_the_program/section_0922.rs: -------------------------------------------------------------------------------- 1 | //! @ @= 2 | //! @!z:trie_pointer; {an index into |trie|} 3 | //! @!v:integer; {an index into |hyf_distance|, etc.} 4 | //! 5 | -------------------------------------------------------------------------------- /src/tex_the_program/section_0927_to_0929.rs: -------------------------------------------------------------------------------- 1 | //! @ @= 2 | //! @!z:hyph_pointer; {runs through the exception dictionary} 3 | //! 4 | //! @ @= 5 | //! for z:=0 to hyph_size do 6 | //! begin hyph_word[z]:=0; hyph_list[z]:=null; 7 | //! end; 8 | //! hyph_count:=0; 9 | //! 10 | //! @ The algorithm for exception lookup is quite simple, as soon as we have 11 | //! a few more local variables to work with. 12 | //! 13 | //! @= 14 | //! @!h:hyph_pointer; {an index into |hyph_word| and |hyph_list|} 15 | //! @!k:str_number; {an index into |str_start|} 16 | //! @!u:pool_pointer; {an index into |str_pool|} 17 | //! 18 | -------------------------------------------------------------------------------- /src/tex_the_program/section_0932.rs: -------------------------------------------------------------------------------- 1 | //! ` ` 2 | 3 | // @= 4 | pub(crate) macro Insert_hyphens_as_specified_in_hyph_list_h($globals:expr, $h:expr) {{ 5 | /// temporary registers for list manipulation 6 | let mut s; 7 | // s:=hyph_list[h]; 8 | s = $globals.hyph_list[$h]; 9 | // while s<>null do 10 | while s != null { 11 | // begin hyf[info(s)]:=1; s:=link(s); 12 | $globals.hyf[info_inner!($globals, s) as usize] = 1.into(); 13 | // end 14 | s = link!($globals, s); 15 | } 16 | use crate::section_0115::null; 17 | use crate::section_0118::info_inner; 18 | use crate::section_0118::link; 19 | }} 20 | -------------------------------------------------------------------------------- /src/tex_the_program/section_0933.rs: -------------------------------------------------------------------------------- 1 | //! @ @= 2 | //! for q:=0 to hyph_size do 3 | //! begin if hyph_list[q]=p then 4 | //! begin print_nl("HYPH("); print_int(q); print_char(")"); 5 | //! end; 6 | //! end 7 | //! 8 | -------------------------------------------------------------------------------- /src/tex_the_program/section_0936.rs: -------------------------------------------------------------------------------- 1 | //! @ @= 2 | //! begin print_err("Improper "); print_esc("hyphenation"); 3 | //! @.Improper \\hyphenation...@> 4 | //! print(" will be flushed"); 5 | //! help2("Hyphenation exceptions must contain only letters")@/ 6 | //! ("and hyphens. But continue; I'll forgive and forget."); 7 | //! error; 8 | //! end 9 | //! 10 | -------------------------------------------------------------------------------- /src/tex_the_program/section_0938.rs: -------------------------------------------------------------------------------- 1 | //! ` ` 2 | 3 | // @= 4 | pub(crate) macro Append_the_value_n_to_list_p($globals:expr, $n:expr, $p:expr) {{ 5 | /// used when creating a new node for list `p` 6 | let q: pointer; 7 | // begin if n<63 then 8 | if $n < 63 { 9 | // begin q:=get_avail; link(q):=p; info(q):=n; p:=q; 10 | q = get_avail($globals); 11 | link!($globals, q) = $p; 12 | info_inner!($globals, q) = $n.get().into(); 13 | $p = q; 14 | // end; 15 | } 16 | // end 17 | use crate::section_0115::pointer; 18 | use crate::section_0118::info_inner; 19 | use crate::section_0118::link; 20 | use crate::section_0120::get_avail; 21 | }} 22 | -------------------------------------------------------------------------------- /src/tex_the_program/section_0941.rs: -------------------------------------------------------------------------------- 1 | //! @ @= 2 | //! k:=hyph_word[h]; 3 | //! if length(k)length(s) then goto not_found; 5 | //! u:=str_start[k]; v:=str_start[s]; 6 | //! repeat if str_pool[u]str_pool[v] then goto not_found; 8 | //! incr(u); incr(v); 9 | //! until u=str_start[k+1]; 10 | //! found:q:=hyph_list[h]; hyph_list[h]:=p; p:=q;@/ 11 | //! t:=hyph_word[h]; hyph_word[h]:=s; s:=t; 12 | //! not_found: 13 | //! 14 | -------------------------------------------------------------------------------- /src/tex_the_program/section_0946.rs: -------------------------------------------------------------------------------- 1 | //! @ Before we forget how to initialize the data structures that have been 2 | //! mentioned so far, let's write down the code that gets them started. 3 | //! 4 | //! @= 5 | //! for k:=-trie_op_size to trie_op_size do trie_op_hash[k]:=0; 6 | //! for k:=0 to 255 do trie_used[k]:=min_quarterword; 7 | //! trie_op_ptr:=0; 8 | //! 9 | -------------------------------------------------------------------------------- /src/tex_the_program/section_0951.rs: -------------------------------------------------------------------------------- 1 | //! @ Each time \.{\\patterns} appears, it contributes further patterns to 2 | //! the future trie, which will be built only when hyphenation is attempted or 3 | //! when a format file is dumped. The boolean variable |trie_not_ready| 4 | //! will change to |false| when the trie is compressed; this will disable 5 | //! further patterns. 6 | //! 7 | //! @= 8 | //! trie_not_ready:=true; trie_root:=0; trie_c[0]:=si(0); trie_ptr:=0; 9 | //! 10 | -------------------------------------------------------------------------------- /src/tex_the_program/section_0967.rs: -------------------------------------------------------------------------------- 1 | //! @* \[44] Breaking vertical lists into pages. 2 | //! The |vsplit| procedure, which implements \TeX's \.{\\vsplit} operation, 3 | //! is considerably simpler than |line_break| because it doesn't have to 4 | //! worry about hyphenation, and because its mission is to discover a single 5 | //! break instead of an optimum sequence of breakpoints. But before we get 6 | //! into the details of |vsplit|, we need to consider a few more basic things. 7 | //! 8 | -------------------------------------------------------------------------------- /src/tex_the_program/section_0971.rs: -------------------------------------------------------------------------------- 1 | //! @ A global variable |best_height_plus_depth| will be set to the natural size 2 | //! of the box that corresponds to the optimum breakpoint found by |vert_break|. 3 | //! (This value is used by the insertion-splitting algorithm of the page builder.) 4 | // 5 | // @= 6 | // @!best_height_plus_depth:scaled; {height of the best box, without stretching or 7 | // shrinking} 8 | /// height of the best box, without stretching or shrinking 9 | #[globals_struct_field(TeXGlobals)] 10 | pub(crate) static best_height_plus_depth: scaled = scaled::zero(); 11 | 12 | #[globals_struct_use(TeXGlobals)] 13 | use crate::section_0101::scaled; 14 | 15 | use globals_struct::{globals_struct_field, globals_struct_use}; 16 | -------------------------------------------------------------------------------- /src/tex_the_program/section_0989.rs: -------------------------------------------------------------------------------- 1 | //! @ The global variable |output_active| is true during the time the 2 | //! user's output routine is driving \TeX. 3 | 4 | // 5 | // @= 6 | // @!output_active:boolean; {are we in the midst of an output routine?} 7 | /// are we in the midst of an output routine? 8 | #[globals_struct_field(TeXGlobals)] 9 | pub(crate) static output_active: boolean = false; 10 | 11 | #[globals_struct_use(TeXGlobals)] 12 | use crate::pascal::boolean; 13 | 14 | use crate::section_0004::TeXGlobals; 15 | use globals_struct::{globals_struct_field, globals_struct_use}; 16 | -------------------------------------------------------------------------------- /src/tex_the_program/section_0990.rs: -------------------------------------------------------------------------------- 1 | //! @ @= 2 | //! output_active:=false; insert_penalties:=0; 3 | //! 4 | -------------------------------------------------------------------------------- /src/tex_the_program/section_0992.rs: -------------------------------------------------------------------------------- 1 | //! @ At certain times box 255 is supposed to be void (i.e., |null|), 2 | //! or an insertion box is supposed to be ready to accept a vertical list. 3 | //! If not, an error message is printed, and the following subroutine 4 | //! flushes the unwanted contents, reporting them to the user. 5 | //! 6 | //! @p procedure box_error(@!n:eight_bits); 7 | //! begin error; begin_diagnostic; 8 | //! print_nl("The following box has been deleted:"); 9 | //! @.The following...deleted@> 10 | //! show_box(box(n)); end_diagnostic(true); 11 | //! flush_node_list(box(n)); box(n):=null; 12 | //! end; 13 | //! 14 | -------------------------------------------------------------------------------- /src/tex_the_program/section_0995.rs: -------------------------------------------------------------------------------- 1 | //! ` ` 2 | 3 | // @d contrib_tail==nest[0].tail_field {tail of the contribution list} 4 | /// tail of the contribution list 5 | #[allow(unused_macros)] 6 | pub(crate) macro contrib_tail($globals:expr) { 7 | $globals.nest[0].tail_field 8 | } 9 | 10 | // @= 11 | pub(crate) macro Make_the_contribution_list_empty_by_setting_its_tail_to_contrib_head($globals:expr) {{ 12 | // if nest_ptr=0 then tail:=contrib_head {vertical mode} 13 | if $globals.nest_ptr == 0 { 14 | /// vertical mode 15 | const _: () = (); 16 | tail!($globals) = contrib_head; 17 | } 18 | // else contrib_tail:=contrib_head {other modes} 19 | else { 20 | /// other modes 21 | const _: () = (); 22 | contrib_tail!($globals) = contrib_head; 23 | } 24 | use crate::section_0162::contrib_head; 25 | use crate::section_0213::tail; 26 | }} 27 | -------------------------------------------------------------------------------- /src/tex_the_program/section_0998.rs: -------------------------------------------------------------------------------- 1 | //! ` ` 2 | 3 | // @= 4 | pub(crate) macro Link_node_p_into_the_current_page_and_goto_done($globals:expr, $p:expr, $lbl_done:lifetime) {{ 5 | // link(page_tail):=p; page_tail:=p; 6 | link!($globals, $globals.page_tail) = $p; 7 | $globals.page_tail = $p; 8 | // link(contrib_head):=link(p); link(p):=null; goto done 9 | link!($globals, contrib_head) = link!($globals, $p); 10 | link!($globals, $p) = null; 11 | crate::goto_forward_label!($lbl_done); 12 | 13 | use crate::section_0115::null; 14 | use crate::section_0118::link; 15 | use crate::section_0162::contrib_head; 16 | }} 17 | -------------------------------------------------------------------------------- /src/tex_the_program/section_0999.rs: -------------------------------------------------------------------------------- 1 | //! ` ` 2 | // @= 3 | pub(crate) macro Recycle_node_p($globals:expr, $p:expr) {{ 4 | // link(contrib_head):=link(p); link(p):=null; flush_node_list(p) 5 | link!($globals, contrib_head) = link!($globals, $p); 6 | link!($globals, $p) = null; 7 | flush_node_list($globals, $p)?; 8 | use crate::section_0115::null; 9 | use crate::section_0118::link; 10 | use crate::section_0162::contrib_head; 11 | use crate::section_0202::flush_node_list; 12 | }} 13 | -------------------------------------------------------------------------------- /src/tex_the_program/section_1002.rs: -------------------------------------------------------------------------------- 1 | //! ` ` 2 | // @= 3 | pub(crate) macro Prepare_to_move_a_box_or_rule_node_to_the_current_page__then_goto_contribute($globals:expr, $p:expr, $lbl_contribute:lifetime) {{ 4 | // begin page_total:=page_total+page_depth+height(p); 5 | page_total!($globals) += page_depth!($globals) + height!($globals, $p); 6 | // page_depth:=depth(p); 7 | page_depth!($globals) = depth!($globals, $p); 8 | // goto contribute; 9 | crate::goto_forward_label!($lbl_contribute); 10 | // end 11 | use crate::section_0135::depth; 12 | use crate::section_0135::height; 13 | use crate::section_0982::page_depth; 14 | use crate::section_0982::page_total; 15 | }} 16 | -------------------------------------------------------------------------------- /src/tex_the_program/section_1003.rs: -------------------------------------------------------------------------------- 1 | //! ` ` 2 | // @= 3 | pub(crate) macro Make_sure_that_page_max_depth_is_not_exceeded($globals:expr) {{ 4 | // if page_depth>page_max_depth then 5 | if page_depth!($globals) > $globals.page_max_depth { 6 | // begin page_total:=@| 7 | // page_total+page_depth-page_max_depth;@/ 8 | page_total!($globals) += page_depth!($globals) - $globals.page_max_depth; 9 | // page_depth:=page_max_depth; 10 | page_depth!($globals) = $globals.page_max_depth; 11 | // end; 12 | } 13 | use crate::section_0982::page_depth; 14 | use crate::section_0982::page_total; 15 | }} 16 | -------------------------------------------------------------------------------- /src/tex_the_program/section_1011.rs: -------------------------------------------------------------------------------- 1 | //! @ @= 2 | //! begin begin_diagnostic; print_nl("% split"); print_int(n); 3 | //! @.split@> 4 | //! print(" to "); print_scaled(w); 5 | //! print_char(","); print_scaled(best_height_plus_depth);@/ 6 | //! print(" p="); 7 | //! if q=null then print_int(eject_penalty) 8 | //! else if type(q)=penalty_node then print_int(penalty(q)) 9 | //! else print_char("0"); 10 | //! end_diagnostic(false); 11 | //! end 12 | //! 13 | -------------------------------------------------------------------------------- /src/tex_the_program/section_1015.rs: -------------------------------------------------------------------------------- 1 | //! ` ` 2 | // @= 3 | pub(crate) macro Ensure_that_box_255_is_empty_before_output($globals:expr) {{ 4 | // if box(255)<>null then 5 | if r#box!($globals, 255) != null { 6 | // begin print_err(""); print_esc("box"); print("255 is not void"); 7 | // @:box255}{\.{\\box255 is not void}@> 8 | // help2("You shouldn't use \box255 except in \output routines.")@/ 9 | // ("Proceed, and I'll discard its present contents."); 10 | // box_error(255); 11 | // end 12 | todo!("box error"); 13 | } 14 | use crate::section_0115::null; 15 | use crate::section_0230::r#box; 16 | }} 17 | -------------------------------------------------------------------------------- /src/tex_the_program/section_1016.rs: -------------------------------------------------------------------------------- 1 | //! @ @= 2 | //! begin if first_mark=null then 3 | //! begin first_mark:=mark_ptr(p); 4 | //! add_token_ref(first_mark); 5 | //! end; 6 | //! if bot_mark<>null then delete_token_ref(bot_mark); 7 | //! bot_mark:=mark_ptr(p); add_token_ref(bot_mark); 8 | //! end 9 | //! 10 | -------------------------------------------------------------------------------- /src/tex_the_program/section_1019.rs: -------------------------------------------------------------------------------- 1 | //! ` ` 2 | // @= 3 | pub(crate) macro Delete_the_page_insertion_nodes($globals:expr) {{ 4 | /// nodes being examined and/or changed 5 | let (mut q, mut r): (pointer, pointer); 6 | // r:=link(page_ins_head); 7 | r = link!($globals, page_ins_head); 8 | // while r<>page_ins_head do 9 | while r != page_ins_head { 10 | // begin q:=link(r); free_node(r,page_ins_node_size); r:=q; 11 | q = link!($globals, r); 12 | free_node($globals, r, page_ins_node_size as _); 13 | r = q; 14 | // end; 15 | } 16 | // link(page_ins_head):=page_ins_head 17 | link!($globals, page_ins_head) = page_ins_head; 18 | use crate::section_0115::pointer; 19 | use crate::section_0118::link; 20 | use crate::section_0130::free_node; 21 | use crate::section_0162::page_ins_head; 22 | use crate::section_0981::page_ins_node_size; 23 | }} 24 | -------------------------------------------------------------------------------- /src/tex_the_program/section_1027.rs: -------------------------------------------------------------------------------- 1 | //! @ @= 2 | //! begin print_err("Unbalanced output routine"); 3 | //! @.Unbalanced output routine@> 4 | //! help2("Your sneaky output routine has problematic {'s and/or }'s.")@/ 5 | //! ("I can't handle that very well; good luck."); error; 6 | //! repeat get_token; 7 | //! until loc=null; 8 | //! end {loops forever if reading from a file, since |null=min_halfword<=0|} 9 | //! 10 | -------------------------------------------------------------------------------- /src/tex_the_program/section_1028.rs: -------------------------------------------------------------------------------- 1 | //! ` ` 2 | // @= 3 | pub(crate) macro Ensure_that_box_255_is_empty_after_output($globals:expr) {{ 4 | // if box(255)<>null then 5 | if r#box!($globals, 255) != null { 6 | // begin print_err("Output routine didn't use all of "); 7 | // print_esc("box"); print_int(255); 8 | // @.Output routine didn't use...@> 9 | // help3("Your \output commands should empty \box255,")@/ 10 | // ("e.g., by saying `\shipout\box255'.")@/ 11 | // ("Proceed; I'll discard its present contents."); 12 | // box_error(255); 13 | // end 14 | todo!("box error"); 15 | } 16 | use crate::section_0115::null; 17 | use crate::section_0230::r#box; 18 | }} 19 | -------------------------------------------------------------------------------- /src/tex_the_program/section_1033.rs: -------------------------------------------------------------------------------- 1 | //! @ The boolean variables of the main loop are normally false, and always reset 2 | //! to false before the loop is left. That saves us the extra work of initializing 3 | //! each time. 4 | //! 5 | //! @= 6 | //! ligature_present:=false; cancel_boundary:=false; lft_hit:=false; rt_hit:=false; 7 | //! ins_disc:=false; 8 | //! 9 | -------------------------------------------------------------------------------- /src/tex_the_program/section_1052.rs: -------------------------------------------------------------------------------- 1 | //! @ Either \.{\\dump} or \.{\\end} will cause |main_control| to enter the 2 | //! endgame, since both of them have `|stop|' as their command code. 3 | //! 4 | //! @= 5 | #[allow(unused_variables)] 6 | pub(crate) macro Put_each_of_tex_s_primitivies_into_the_hash_table_1052($globals:expr) {{ 7 | let globals = &mut *$globals; 8 | // primitive("end",stop,0);@/ 9 | // @!@:end_}{\.{\\end} primitive@> 10 | primitive(globals, crate::strpool_str!("end"), stop, 0); 11 | // primitive("dump",stop,1);@/ 12 | // @!@:dump_}{\.{\\dump} primitive@> 13 | primitive(globals, crate::strpool_str!("dump"), stop, 1); 14 | }} 15 | 16 | use crate::section_0004::TeXGlobals; 17 | use crate::section_0207::*; 18 | use crate::section_0264::primitive; 19 | -------------------------------------------------------------------------------- /src/tex_the_program/section_1053.rs: -------------------------------------------------------------------------------- 1 | //! ` ` 2 | 3 | // @= 4 | pub(crate) macro Cases_of_print_cmd_chr_for_symbolic_printing_of_primitives_1053($globals:expr, $cmd:expr, $chr_code:expr) {{ 5 | // stop:if chr_code=1 then print_esc("dump")@+else print_esc("end"); 6 | let processed = if $cmd == stop { 7 | if $chr_code.get() == 1 { 8 | print_esc($globals, crate::strpool_str!("dump")); 9 | } else { 10 | print_esc($globals, crate::strpool_str!("end")); 11 | } 12 | true 13 | } else { 14 | false 15 | }; 16 | use crate::section_0063::print_esc; 17 | use crate::section_0207::*; 18 | processed 19 | }} 20 | -------------------------------------------------------------------------------- /src/tex_the_program/section_1055.rs: -------------------------------------------------------------------------------- 1 | //! @* \[47] Building boxes and lists. 2 | //! The most important parts of |main_control| are concerned with \TeX's 3 | //! chief mission of box-making. We need to control the activities that put 4 | //! entries on vlists and hlists, as well as the activities that convert 5 | //! those lists into boxes. All of the necessary machinery has already been 6 | //! developed; it remains for us to ``push the buttons'' at the right times. 7 | //! 8 | -------------------------------------------------------------------------------- /src/tex_the_program/section_1065.rs: -------------------------------------------------------------------------------- 1 | //! @ At this point, |link(temp_head)=p|, a pointer to an empty one-word node. 2 | //! 3 | //! @= 4 | //! case cur_group of 5 | //! semi_simple_group: begin info(p):=cs_token_flag+frozen_end_group; 6 | //! print_esc("endgroup"); 7 | //! @.Missing \\endgroup inserted@> 8 | //! end; 9 | //! math_shift_group: begin info(p):=math_shift_token+"$"; print_char("$"); 10 | //! @.Missing \$ inserted@> 11 | //! end; 12 | //! math_left_group: begin info(p):=cs_token_flag+frozen_right; link(p):=get_avail; 13 | //! p:=link(p); info(p):=other_token+"."; print_esc("right."); 14 | //! @.Missing \\right\hbox{.} inserted@> 15 | //! @^null delimiter@> 16 | //! end; 17 | //! othercases begin info(p):=right_brace_token+"}"; print_char("}"); 18 | //! @.Missing \} inserted@> 19 | //! end 20 | //! endcases 21 | //! 22 | -------------------------------------------------------------------------------- /src/tex_the_program/section_1066.rs: -------------------------------------------------------------------------------- 1 | //! @ @= 2 | //! begin print_err("Extra "); print_cmd_chr(cur_cmd,cur_chr); 3 | //! @.Extra x@> 4 | //! help1("Things are pretty mixed up, but I think the worst is over.");@/ 5 | //! error; 6 | //! end 7 | //! 8 | -------------------------------------------------------------------------------- /src/tex_the_program/section_1069.rs: -------------------------------------------------------------------------------- 1 | //! @ @= 2 | //! procedure extra_right_brace; 3 | //! begin print_err("Extra }, or forgotten "); 4 | //! @.Extra \}, or forgotten x@> 5 | //! case cur_group of 6 | //! semi_simple_group: print_esc("endgroup"); 7 | //! math_shift_group: print_char("$"); 8 | //! math_left_group: print_esc("right"); 9 | //! end;@/ 10 | //! help5("I've deleted a group-closing symbol because it seems to be")@/ 11 | //! ("spurious, as in `$x}$'. But perhaps the } is legitimate and")@/ 12 | //! ("you forgot something else, as in `\hbox{$x}'. In such cases")@/ 13 | //! ("the way to recover is to insert both the forgotten and the")@/ 14 | //! ("deleted material, e.g., by typing `I$}'."); error; 15 | //! incr(align_state); 16 | //! end; 17 | //! 18 | -------------------------------------------------------------------------------- /src/tex_the_program/section_1074.rs: -------------------------------------------------------------------------------- 1 | //! @ The global variable |cur_box| will point to a newly made box. If the box 2 | //! is void, we will have |cur_box=null|. Otherwise we will have 3 | //! |type(cur_box)=hlist_node| or |vlist_node| or |rule_node|; the |rule_node| 4 | //! case can occur only with leaders. 5 | // 6 | // @= 7 | // @!cur_box:pointer; {box to be placed into its context} 8 | /// box to be placed into its context 9 | #[globals_struct_field(TeXGlobals)] 10 | pub(crate) static cur_box: pointer = null; 11 | 12 | #[globals_struct_use(TeXGlobals)] 13 | use crate::section_0115::pointer; 14 | 15 | #[globals_struct_use(TeXGlobals)] 16 | use crate::section_0115::null; 17 | 18 | use crate::section_0004::TeXGlobals; 19 | use globals_struct::{globals_struct_field, globals_struct_use}; 20 | -------------------------------------------------------------------------------- /src/tex_the_program/section_1088.rs: -------------------------------------------------------------------------------- 1 | //! @ A paragraph begins when horizontal-mode material occurs in vertical mode, 2 | //! or when the paragraph is explicitly started by `\.{\\indent}' or 3 | //! `\.{\\noindent}'. 4 | // 5 | // @= 6 | pub(crate) macro Put_each_of_tex_s_primitivies_into_the_hash_table_1088($globals:expr) {{ 7 | let globals = &mut *$globals; 8 | // primitive("indent",start_par,1); 9 | primitive(globals, crate::strpool_str!("indent"), start_par, 1); 10 | // @!@:indent_}{\.{\\indent} primitive@> 11 | // primitive("noindent",start_par,0); 12 | primitive(globals, crate::strpool_str!("noindent"), start_par, 0); 13 | // @!@:no_indent_}{\.{\\noindent} primitive@> 14 | }} 15 | 16 | use crate::pascal::word; 17 | use crate::section_0004::TeXGlobals; 18 | use crate::section_0208::start_par; 19 | use crate::section_0264::primitive; 20 | -------------------------------------------------------------------------------- /src/tex_the_program/section_1089.rs: -------------------------------------------------------------------------------- 1 | //! ` ` 2 | 3 | // @= 4 | pub(crate) macro Cases_of_print_cmd_chr_for_symbolic_printing_of_primitives_1089($globals:expr, $cmd:expr, $chr_code:expr) {{ 5 | // start_par: if chr_code=0 then print_esc("noindent")@+ else print_esc("indent"); 6 | let processed = if $cmd == start_par { 7 | if $chr_code.get() == 0 { 8 | print_esc($globals, crate::strpool_str!("noindent")); 9 | } else { 10 | print_esc($globals, crate::strpool_str!("indent")); 11 | } 12 | true 13 | } else { 14 | false 15 | }; 16 | use crate::section_0063::print_esc; 17 | use crate::section_0208::start_par; 18 | processed 19 | }} 20 | -------------------------------------------------------------------------------- /src/tex_the_program/section_1092.rs: -------------------------------------------------------------------------------- 1 | //! ` ` 2 | 3 | // @= 4 | pub(crate) macro Cases_of_main_control_that_build_boxes_and_lists_1092($globals:expr, $abs_mode_plus_cur_cmd:expr) {{ 5 | // hmode+start_par,mmode+start_par: indent_in_hmode; 6 | let processed = if $abs_mode_plus_cur_cmd == hmode as u16 + start_par as u16 7 | || $abs_mode_plus_cur_cmd == mmode as u16 + start_par as u16 8 | { 9 | indent_in_hmode($globals)?; 10 | true 11 | } else { 12 | false 13 | }; 14 | use crate::section_0208::start_par; 15 | use crate::section_0211::hmode; 16 | use crate::section_0211::mmode; 17 | use crate::section_1093::indent_in_hmode; 18 | processed 19 | }} 20 | -------------------------------------------------------------------------------- /src/tex_the_program/section_1098.rs: -------------------------------------------------------------------------------- 1 | //! ` ` 2 | // @= 3 | pub(crate) macro Forbidden_cases_detected_in_main_control_1098($abs_mode_plus_cur_cmd:expr) {{ 4 | // vmode+vadjust, 5 | let result = $abs_mode_plus_cur_cmd == vmode as u16 + vadjust as u16; 6 | use crate::section_0208::*; 7 | use crate::section_0211::*; 8 | result 9 | }} 10 | -------------------------------------------------------------------------------- /src/tex_the_program/section_1101.rs: -------------------------------------------------------------------------------- 1 | //! ` ` 2 | // @= 3 | // procedure make_mark; 4 | // var p:pointer; {new node} 5 | // begin p:=scan_toks(false,true); p:=get_node(small_node_size); 6 | // type(p):=mark_node; subtype(p):=0; {the |subtype| is not used} 7 | // mark_ptr(p):=def_ref; link(tail):=p; tail:=p; 8 | // end; 9 | // 10 | -------------------------------------------------------------------------------- /src/tex_the_program/section_1102.rs: -------------------------------------------------------------------------------- 1 | //! @ Penalty nodes get into a list via the |break_penalty| command. 2 | //! @^penalties@> 3 | // 4 | // @= 5 | pub(crate) macro Cases_of_main_control_that_build_boxes_and_lists_1102($globals:expr, $abs_mode_plus_cur_cmd:expr) {{ 6 | // any_mode(break_penalty): append_penalty; 7 | let processed = 8 | if abs_mode_plus_cur_cmd_matches_any_mode!($abs_mode_plus_cur_cmd, break_penalty as u16) { 9 | crate::trace_span!("Cases of `main_control` that build...1102"); 10 | append_penalty($globals)?; 11 | use crate::section_1103::append_penalty; 12 | true 13 | } else { 14 | false 15 | }; 16 | use crate::section_0208::*; 17 | use crate::section_1045::abs_mode_plus_cur_cmd_matches_any_mode; 18 | processed 19 | }} 20 | -------------------------------------------------------------------------------- /src/tex_the_program/section_1103.rs: -------------------------------------------------------------------------------- 1 | //! ` ` 2 | // @= 3 | // procedure append_penalty; 4 | #[cfg_attr(feature = "trace", tracing::instrument(level = "trace"))] 5 | pub(crate) fn append_penalty(globals: &mut TeXGlobals) -> TeXResult<()> { 6 | // begin scan_int; tail_append(new_penalty(cur_val)); 7 | scan_int(globals)?; 8 | tail_append!(globals, new_penalty(globals, globals.cur_val)?); 9 | // if mode=vmode then build_page; 10 | if mode!(globals) == vmode { 11 | build_page(globals)?; 12 | } 13 | // end; 14 | crate::ok_nojump!() 15 | } 16 | 17 | use crate::section_0004::TeXGlobals; 18 | use crate::section_0081::TeXResult; 19 | use crate::section_0158::new_penalty; 20 | use crate::section_0211::vmode; 21 | use crate::section_0213::mode; 22 | use crate::section_0214::tail_append; 23 | use crate::section_0440::scan_int; 24 | use crate::section_0994::build_page; 25 | -------------------------------------------------------------------------------- /src/tex_the_program/section_1106.rs: -------------------------------------------------------------------------------- 1 | //! @ @= 2 | //! begin if (cur_chr<>glue_node)or(last_glue<>max_halfword) then 3 | //! begin you_cant; 4 | //! help2("Sorry...I usually can't take things from the current page.")@/ 5 | //! ("Try `I\vskip-\lastskip' instead."); 6 | //! if cur_chr=kern_node then help_line[0]:= 7 | //! ("Try `I\kern-\lastkern' instead.") 8 | //! else if cur_chr<>glue_node then help_line[0]:=@| 9 | //! ("Perhaps you can make the output routine do it."); 10 | //! error; 11 | //! end; 12 | //! end 13 | //! 14 | -------------------------------------------------------------------------------- /src/tex_the_program/section_1109.rs: -------------------------------------------------------------------------------- 1 | //! @ The |un_hbox| and |un_vbox| commands unwrap one of the 256 current boxes. 2 | // 3 | // @= 4 | pub(crate) macro Cases_of_main_control_that_build_boxes_and_lists_1109($globals:expr, $abs_mode_plus_cur_cmd:expr) {{ 5 | // vmode+un_vbox,hmode+un_hbox,mmode+un_hbox: unpackage; 6 | let processed = if $abs_mode_plus_cur_cmd == vmode as u16 + un_vbox as u16 7 | || $abs_mode_plus_cur_cmd == hmode as u16 + un_hbox as u16 8 | || $abs_mode_plus_cur_cmd == mmode as u16 + un_hbox as u16 9 | { 10 | unpackage($globals)?; 11 | use crate::section_1110::unpackage; 12 | true 13 | } else { 14 | false 15 | }; 16 | use crate::section_0208::*; 17 | use crate::section_0211::*; 18 | processed 19 | }} 20 | -------------------------------------------------------------------------------- /src/tex_the_program/section_1111.rs: -------------------------------------------------------------------------------- 1 | //! ` ` 2 | // @=vmode+ital_corr, 3 | pub(crate) macro Forbidden_cases_detected_in_main_control_1111($abs_mode_plus_cur_cmd:expr) {{ 4 | let result = $abs_mode_plus_cur_cmd == vmode as u16 + ital_corr as u16; 5 | use crate::section_0208::*; 6 | use crate::section_0211::*; 7 | result 8 | }} 9 | -------------------------------------------------------------------------------- /src/tex_the_program/section_1114.rs: -------------------------------------------------------------------------------- 1 | //! @ Discretionary nodes are easy in the common case `\.{\\-}', but in the 2 | //! general case we must process three braces full of items. 3 | // 4 | // @= 5 | pub(crate) macro Put_each_of_tex_s_primitivies_into_the_hash_table_1114($globals:expr) {{ 6 | let globals = &mut *$globals; 7 | // primitive("-",discretionary,1); 8 | primitive(globals, crate::strpool_str!("-"), discretionary, 1); 9 | // @!@:Single-character primitives -}{\quad\.{\\-}@> 10 | // primitive("discretionary",discretionary,0); 11 | primitive( 12 | globals, 13 | crate::strpool_str!("discretionary"), 14 | discretionary, 15 | 0, 16 | ); 17 | // @!@:discretionary_}{\.{\\discretionary} primitive@> 18 | }} 19 | 20 | use crate::section_0004::TeXGlobals; 21 | use crate::section_0208::discretionary; 22 | use crate::section_0264::primitive; 23 | -------------------------------------------------------------------------------- /src/tex_the_program/section_1115.rs: -------------------------------------------------------------------------------- 1 | //! ` ` 2 | 3 | // @= 4 | pub(crate) macro Cases_of_print_cmd_chr_for_symbolic_printing_of_primitives_1115($globals:expr, $cmd:expr, $chr_code:expr) {{ 5 | // discretionary: if chr_code=1 then 6 | // print_esc("-")@+else print_esc("discretionary"); 7 | let processed = if $cmd == discretionary { 8 | if $chr_code.get() == 1 { 9 | print_esc($globals, crate::strpool_str!("-")); 10 | } else { 11 | print_esc($globals, crate::strpool_str!("discretionary")); 12 | } 13 | true 14 | } else { 15 | false 16 | }; 17 | use crate::section_0063::print_esc; 18 | use crate::section_0208::discretionary; 19 | processed 20 | }} 21 | -------------------------------------------------------------------------------- /src/tex_the_program/section_1116.rs: -------------------------------------------------------------------------------- 1 | //! ` ` 2 | 3 | // @= 4 | pub(crate) macro Cases_of_main_control_that_build_boxes_and_lists_1116($globals:expr, $abs_mode_plus_cur_cmd:expr) {{ 5 | // hmode+discretionary,mmode+discretionary: append_discretionary; 6 | let processed = if $abs_mode_plus_cur_cmd == hmode as u16 + discretionary as u16 7 | || $abs_mode_plus_cur_cmd == mmode as u16 + discretionary as u16 8 | { 9 | append_discretionary($globals)?; 10 | true 11 | } else { 12 | false 13 | }; 14 | use crate::section_0208::*; 15 | use crate::section_0211::*; 16 | use crate::section_1117::append_discretionary; 17 | processed 18 | }} 19 | -------------------------------------------------------------------------------- /src/tex_the_program/section_1118.rs: -------------------------------------------------------------------------------- 1 | //! ` ` 2 | //! The three discretionary lists are constructed somewhat as if they were 3 | //! hboxes. A~subroutine called |build_discretionary| handles the transitions. 4 | //! (This is sort of fun.) 5 | 6 | // @= 7 | pub(crate) macro Cases_of_handle_right_brace_where_a_right_brace_triggers_a_delayed_action_1118($globals:expr) {{ 8 | // disc_group: build_discretionary; 9 | let processed = if $globals.cur_group == disc_group { 10 | build_discretionary($globals)?; 11 | true 12 | } else { 13 | false 14 | }; 15 | use crate::section_0269::disc_group; 16 | use crate::section_1119::build_discretionary; 17 | processed 18 | }} 19 | -------------------------------------------------------------------------------- /src/tex_the_program/section_1122.rs: -------------------------------------------------------------------------------- 1 | //! ` ` 2 | 3 | // We need only one more thing to complete the horizontal mode routines, namely 4 | // the \.{\\accent} primitive. 5 | // 6 | // @= 7 | pub(crate) macro Cases_of_main_control_that_build_boxes_and_lists_1122($globals:expr, $abs_mode_plus_cur_cmd:expr) {{ 8 | // hmode+accent: make_accent; 9 | let processed = if $abs_mode_plus_cur_cmd == hmode as u16 + accent as u16 { 10 | make_accent($globals)?; 11 | true 12 | } else { 13 | false 14 | }; 15 | use crate::section_0208::*; 16 | use crate::section_0211::*; 17 | use crate::section_1123::make_accent; 18 | processed 19 | }} 20 | -------------------------------------------------------------------------------- /src/tex_the_program/section_1129.rs: -------------------------------------------------------------------------------- 1 | //! @ The help messages here contain a little white lie, since \.{\\noalign} 2 | //! and \.{\\omit} are allowed also after `\.{\\noalign\{...\}}'. 3 | //! 4 | //! @= 5 | //! procedure no_align_error; 6 | //! begin print_err("Misplaced "); print_esc("noalign"); 7 | //! @.Misplaced \\noalign@> 8 | //! help2("I expect to see \noalign only after the \cr of")@/ 9 | //! ("an alignment. Proceed, and I'll ignore this case."); error; 10 | //! end; 11 | //! procedure omit_error; 12 | //! begin print_err("Misplaced "); print_esc("omit"); 13 | //! @.Misplaced \\omit@> 14 | //! help2("I expect to see \omit only after tab marks or the \cr of")@/ 15 | //! ("an alignment. Proceed, and I'll ignore this case."); error; 16 | //! end; 17 | //! 18 | -------------------------------------------------------------------------------- /src/tex_the_program/section_1133.rs: -------------------------------------------------------------------------------- 1 | //! ` ` 2 | 3 | // @= 4 | pub(crate) macro Cases_of_handle_right_brace_where_a_right_brace_triggers_a_delayed_action_1133($globals:expr) {{ 5 | // no_align_group: begin end_graf; unsave; align_peek; 6 | let processed = if $globals.cur_group == no_align_group { 7 | end_graf($globals)?; 8 | unsave($globals)?; 9 | align_peek($globals)?; 10 | // end; 11 | true 12 | } else { 13 | false 14 | }; 15 | use crate::section_0269::no_align_group; 16 | use crate::section_0281::unsave; 17 | use crate::section_0785::align_peek; 18 | use crate::section_1096::end_graf; 19 | processed 20 | }} 21 | -------------------------------------------------------------------------------- /src/tex_the_program/section_1134_to_1135.rs: -------------------------------------------------------------------------------- 1 | //! @ Finally, \.{\\endcsname} is not supposed to get through to |main_control|. 2 | //! 3 | //! @= 4 | //! any_mode(end_cs_name): cs_error; 5 | //! 6 | //! @ @= 7 | //! procedure cs_error; 8 | //! begin print_err("Extra "); print_esc("endcsname"); 9 | //! @.Extra \\endcsname@> 10 | //! help1("I'm ignoring this, since I wasn't doing a \csname."); 11 | //! error; 12 | //! end; 13 | //! 14 | -------------------------------------------------------------------------------- /src/tex_the_program/section_1137.rs: -------------------------------------------------------------------------------- 1 | //! @ We get into math mode from horizontal mode when a `\.\$' (i.e., a 2 | //! |math_shift| character) is scanned. We must check to see whether this 3 | //! `\.\$' is immediately followed by another, in case display math mode is 4 | //! called for. 5 | // 6 | // @= 7 | pub(crate) macro Cases_of_main_control_that_build_boxes_and_lists_1137($globals:expr, $abs_mode_plus_cur_cmd:expr) {{ 8 | // hmode+math_shift:init_math; 9 | let processed = if $abs_mode_plus_cur_cmd == hmode as u16 + math_shift as u16 { 10 | init_math($globals)?; 11 | use crate::section_1138::init_math; 12 | true 13 | } else { 14 | false 15 | }; 16 | use crate::section_0207::*; 17 | use crate::section_0211::*; 18 | processed 19 | }} 20 | -------------------------------------------------------------------------------- /src/tex_the_program/section_1141.rs: -------------------------------------------------------------------------------- 1 | //! ` ` 2 | 3 | // @= 4 | pub(crate) macro Put_each_of_tex_s_primitivies_into_the_hash_table_1141($globals:expr) {{ 5 | let globals = &mut *$globals; 6 | // primitive("eqno",eq_no,0); 7 | primitive(globals, crate::strpool_str!("eqno"), eq_no, 0); 8 | // @!@:eq_no_}{\.{\\eqno} primitive@> 9 | // primitive("leqno",eq_no,1); 10 | primitive(globals, crate::strpool_str!("leqno"), eq_no, 1); 11 | // @!@:leq_no_}{\.{\\leqno} primitive@> 12 | 13 | use crate::section_0208::*; 14 | use crate::section_0264::primitive; 15 | }} 16 | -------------------------------------------------------------------------------- /src/tex_the_program/section_1142.rs: -------------------------------------------------------------------------------- 1 | //! @ When \TeX\ is in display math mode, |cur_group=math_shift_group|, 2 | //! so it is not necessary for the |start_eq_no| procedure to test for 3 | //! this condition. 4 | // 5 | // @= 6 | // procedure start_eq_no; 7 | pub(crate) fn start_eq_no(globals: &mut TeXGlobals) { 8 | // begin saved(0):=cur_chr; incr(save_ptr); 9 | saved!(globals, 0) = globals.cur_chr.get() as _; 10 | incr!(globals.save_ptr); 11 | // @; 12 | crate::section_1139::Go_into_ordinary_math_mode!(globals); 13 | // end; 14 | } 15 | 16 | use crate::section_0004::TeXGlobals; 17 | use crate::section_0016::incr; 18 | use crate::section_0274::saved; 19 | -------------------------------------------------------------------------------- /src/tex_the_program/section_1143.rs: -------------------------------------------------------------------------------- 1 | //! ` ` 2 | // @= 3 | pub(crate) macro Cases_of_print_cmd_chr_for_symbolic_printing_of_primitives_1143($globals:expr, $cmd:expr, $chr_code:expr) {{ 4 | // eq_no:if chr_code=1 then print_esc("leqno")@+else print_esc("eqno"); 5 | let processed = if $cmd == eq_no { 6 | if $chr_code.get() == 1 { 7 | print_esc($globals, crate::strpool_str!("leqno")); 8 | } else { 9 | print_esc($globals, crate::strpool_str!("eqno")); 10 | } 11 | true 12 | } else { 13 | false 14 | }; 15 | use crate::section_0063::print_esc; 16 | use crate::section_0208::eq_no; 17 | processed 18 | }} 19 | -------------------------------------------------------------------------------- /src/tex_the_program/section_1144.rs: -------------------------------------------------------------------------------- 1 | //! ` ` 2 | // @=non_math(eq_no), 3 | pub(crate) macro Forbidden_cases_detected_in_main_control_1144($abs_mode_plus_cur_cmd:expr) {{ 4 | let result = abs_mode_plus_cur_cmd_matches_non_math_mode!($abs_mode_plus_cur_cmd, eq_no as u16); 5 | use crate::section_0208::*; 6 | use crate::section_1046::abs_mode_plus_cur_cmd_matches_non_math_mode; 7 | result 8 | }} 9 | -------------------------------------------------------------------------------- /src/tex_the_program/section_1153.rs: -------------------------------------------------------------------------------- 1 | //! @ The pointer |p| is placed on |save_stack| while a complex subformula 2 | //! is being scanned. 3 | // 4 | // @= 5 | pub(crate) macro Scan_a_subformula_enclosed_in_braces_and_return($globals:expr, $p:expr) {{ 6 | // begin back_input; scan_left_brace;@/ 7 | back_input($globals); 8 | scan_left_brace($globals)?; 9 | // saved(0):=p; incr(save_ptr); push_math(math_group); return; 10 | saved!($globals, 0) = $p as _; 11 | incr!($globals.save_ptr); 12 | push_math($globals, math_group.into()); 13 | crate::return_nojump!(); 14 | // end 15 | use crate::section_0016::incr; 16 | use crate::section_0269::math_group; 17 | use crate::section_0274::saved; 18 | use crate::section_0325::back_input; 19 | use crate::section_0403::scan_left_brace; 20 | use crate::section_1136::push_math; 21 | }} 22 | -------------------------------------------------------------------------------- /src/tex_the_program/section_1161.rs: -------------------------------------------------------------------------------- 1 | //! @ @= 2 | //! begin print_err("Missing delimiter (. inserted)"); 3 | //! @.Missing delimiter...@> 4 | //! help6("I was expecting to see something like `(' or `\{' or")@/ 5 | //! ("`\}' here. If you typed, e.g., `{' instead of `\{', you")@/ 6 | //! ("should probably delete the `{' by typing `1' now, so that")@/ 7 | //! ("braces don't get unbalanced. Otherwise just proceed.")@/ 8 | //! ("Acceptable delimiters are characters whose \delcode is")@/ 9 | //! ("nonnegative, or you can use `\delimiter '."); 10 | //! back_error; cur_val:=0; 11 | //! end 12 | //! 13 | -------------------------------------------------------------------------------- /src/tex_the_program/section_1162.rs: -------------------------------------------------------------------------------- 1 | //! ` ` 2 | 3 | // @= 4 | pub(crate) macro Cases_of_main_control_that_build_boxes_and_lists_1162($globals:expr, $abs_mode_plus_cur_cmd:expr) {{ 5 | // mmode+radical:math_radical; 6 | let processed = if $abs_mode_plus_cur_cmd == mmode as u16 + radical as u16 { 7 | math_radical($globals)?; 8 | true 9 | } else { 10 | false 11 | }; 12 | use crate::section_0208::radical; 13 | use crate::section_0211::mmode; 14 | use crate::section_1163::math_radical; 15 | processed 16 | }} 17 | -------------------------------------------------------------------------------- /src/tex_the_program/section_1164.rs: -------------------------------------------------------------------------------- 1 | //! ` ` 2 | // @= 3 | pub(crate) macro Cases_of_main_control_that_build_boxes_and_lists_1164($globals:expr, $abs_mode_plus_cur_cmd:expr) {{ 4 | // mmode+accent,mmode+math_accent:math_ac; 5 | let processed = if $abs_mode_plus_cur_cmd == mmode as u16 + accent as u16 6 | || $abs_mode_plus_cur_cmd == mmode as u16 + math_accent as u16 7 | { 8 | math_ac($globals)?; 9 | true 10 | } else { 11 | false 12 | }; 13 | use crate::section_0208::accent; 14 | use crate::section_0208::math_accent; 15 | use crate::section_0211::mmode; 16 | use crate::section_1165::math_ac; 17 | processed 18 | }} 19 | -------------------------------------------------------------------------------- /src/tex_the_program/section_1166.rs: -------------------------------------------------------------------------------- 1 | //! @ @= 2 | //! begin print_err("Please use "); print_esc("mathaccent"); 3 | //! print(" for accents in math mode"); 4 | //! @.Please use \\mathaccent...@> 5 | //! help2("I'm changing \accent to \mathaccent here; wish me luck.")@/ 6 | //! ("(Accents are not the same in formulas as they are in text.)"); 7 | //! error; 8 | //! end 9 | //! 10 | -------------------------------------------------------------------------------- /src/tex_the_program/section_1170.rs: -------------------------------------------------------------------------------- 1 | //! ` ` 2 | // @= 3 | pub(crate) macro Cases_of_print_cmd_chr_for_symbolic_printing_of_primitives_1170($globals:expr, $cmd:expr, $chr_code:expr) {{ 4 | // math_style: print_style(chr_code); 5 | let processed = if $cmd == math_style { 6 | print_style($globals, $chr_code.get() as _); 7 | true 8 | } else { 9 | false 10 | }; 11 | use crate::section_0208::math_style; 12 | use crate::section_0694::print_style; 13 | processed 14 | }} 15 | -------------------------------------------------------------------------------- /src/tex_the_program/section_1173.rs: -------------------------------------------------------------------------------- 1 | //! ` ` 2 | 3 | // @= 4 | pub(crate) macro Cases_of_handle_right_brace_where_a_right_brace_triggers_a_delayed_action_1173($globals:expr) {{ 5 | // math_choice_group: build_choices; 6 | let processed = if $globals.cur_group == math_choice_group { 7 | build_choices($globals)?; 8 | true 9 | } else { 10 | false 11 | }; 12 | use crate::section_0269::math_choice_group; 13 | use crate::section_1174::build_choices; 14 | processed 15 | }} 16 | -------------------------------------------------------------------------------- /src/tex_the_program/section_1175.rs: -------------------------------------------------------------------------------- 1 | //! @ Subscripts and superscripts are attached to the previous nucleus by the 2 | //! @^superscripts@>@^subscripts@> 3 | //! action procedure called |sub_sup|. We use the facts that |sub_mark=sup_mark+1| 4 | //! and |subscr(p)=supscr(p)+1|. 5 | // 6 | // @= 7 | pub(crate) macro Cases_of_main_control_that_build_boxes_and_lists_1175($globals:expr, $abs_mode_plus_cur_cmd:expr) {{ 8 | // mmode+sub_mark,mmode+sup_mark: sub_sup; 9 | let processed = if $abs_mode_plus_cur_cmd == mmode as u16 + sub_mark as u16 10 | || $abs_mode_plus_cur_cmd == mmode as u16 + sup_mark as u16 11 | { 12 | sub_sup($globals)?; 13 | true 14 | } else { 15 | false 16 | }; 17 | use crate::section_0207::*; 18 | use crate::section_0211::*; 19 | use crate::section_1176::sub_sup; 20 | processed 21 | }} 22 | -------------------------------------------------------------------------------- /src/tex_the_program/section_1180.rs: -------------------------------------------------------------------------------- 1 | //! ` ` 2 | // @= 3 | pub(crate) macro Cases_of_main_control_that_build_boxes_and_lists_1180($globals:expr, $abs_mode_plus_cur_cmd:expr) {{ 4 | // mmode+above: math_fraction; 5 | let processed = if $abs_mode_plus_cur_cmd == mmode as u16 + above as u16 { 6 | math_fraction($globals)?; 7 | true 8 | } else { 9 | false 10 | }; 11 | use crate::section_0208::above; 12 | use crate::section_0211::mmode; 13 | use crate::section_1181::math_fraction; 14 | processed 15 | }} 16 | -------------------------------------------------------------------------------- /src/tex_the_program/section_1183.rs: -------------------------------------------------------------------------------- 1 | //! @ @= 2 | //! begin if c>=delimited_code then 3 | //! begin scan_delimiter(garbage,false); scan_delimiter(garbage,false); 4 | //! end; 5 | //! if c mod delimited_code=above_code then scan_normal_dimen; 6 | //! print_err("Ambiguous; you need another { and }"); 7 | //! @.Ambiguous...@> 8 | //! help3("I'm ignoring this fraction specification, since I don't")@/ 9 | //! ("know whether a construction like `x \over y \over z'")@/ 10 | //! ("means `{x \over y} \over z' or `x \over {y \over z}'."); 11 | //! error; 12 | //! end 13 | //! 14 | -------------------------------------------------------------------------------- /src/tex_the_program/section_1187.rs: -------------------------------------------------------------------------------- 1 | //! ` ` 2 | // @= 3 | pub(crate) macro Replace_the_tail_of_the_list_by_p($globals:expr, $p:expr) {{ 4 | /// for short-term use 5 | let mut q; 6 | // begin q:=head; while link(q)<>tail do q:=link(q); 7 | q = head!($globals); 8 | while link!($globals, q) != tail!($globals) { 9 | q = link!($globals, q); 10 | } 11 | // link(q):=p; free_node(tail,noad_size); tail:=p; 12 | link!($globals, q) = $p; 13 | free_node($globals, tail!($globals), noad_size as _); 14 | tail!($globals) = $p; 15 | // end 16 | use crate::section_0118::link; 17 | use crate::section_0130::free_node; 18 | use crate::section_0213::head; 19 | use crate::section_0213::tail; 20 | use crate::section_0681::noad_size; 21 | }} 22 | -------------------------------------------------------------------------------- /src/tex_the_program/section_1189.rs: -------------------------------------------------------------------------------- 1 | //! ` ` 2 | 3 | // @= 4 | pub(crate) macro Cases_of_print_cmd_chr_for_symbolic_printing_of_primitives_1189($globals:expr, $cmd:expr, $chr_code:expr) {{ 5 | // left_right: if chr_code=left_noad then print_esc("left") 6 | let processed = if $cmd == left_right { 7 | if $chr_code.get() == left_noad as _ { 8 | print_esc($globals, crate::strpool_str!("left")); 9 | } 10 | // else print_esc("right"); 11 | else { 12 | print_esc($globals, crate::strpool_str!("right")); 13 | } 14 | true 15 | } else { 16 | false 17 | }; 18 | use crate::section_0063::print_esc; 19 | use crate::section_0208::left_right; 20 | use crate::section_0687::left_noad; 21 | processed 22 | }} 23 | -------------------------------------------------------------------------------- /src/tex_the_program/section_1190.rs: -------------------------------------------------------------------------------- 1 | //! ` ` 2 | // @= 3 | pub(crate) macro Cases_of_main_control_that_build_boxes_and_lists_1190($globals:expr, $abs_mode_plus_cur_cmd:expr) {{ 4 | // mmode+left_right: math_left_right; 5 | let processed = if $abs_mode_plus_cur_cmd == mmode as u16 + left_right as u16 { 6 | math_left_right($globals)?; 7 | true 8 | } else { 9 | false 10 | }; 11 | use crate::section_0208::left_right; 12 | use crate::section_0211::mmode; 13 | use crate::section_1191::math_left_right; 14 | processed 15 | }} 16 | -------------------------------------------------------------------------------- /src/tex_the_program/section_1192.rs: -------------------------------------------------------------------------------- 1 | //! @ @= 2 | //! begin if cur_group=math_shift_group then 3 | //! begin scan_delimiter(garbage,false); 4 | //! print_err("Extra "); print_esc("right"); 5 | //! @.Extra \\right.@> 6 | //! help1("I'm ignoring a \right that had no matching \left."); 7 | //! error; 8 | //! end 9 | //! else off_save; 10 | //! end 11 | //! 12 | -------------------------------------------------------------------------------- /src/tex_the_program/section_1193.rs: -------------------------------------------------------------------------------- 1 | //! @ Here is the only way out of math mode. 2 | // 3 | // @= 4 | pub(crate) macro Cases_of_main_control_that_build_boxes_and_lists_1193($globals:expr, $abs_mode_plus_cur_cmd:expr) {{ 5 | // mmode+math_shift: if cur_group=math_shift_group then after_math 6 | let processed = if $abs_mode_plus_cur_cmd == mmode as u16 + math_shift as u16 { 7 | if $globals.cur_group == math_shift_group { 8 | after_math($globals)?; 9 | } 10 | // else off_save; 11 | else { 12 | off_save($globals); 13 | } 14 | use crate::section_0269::math_shift_group; 15 | use crate::section_1064::off_save; 16 | use crate::section_1194::after_math; 17 | true 18 | } else { 19 | false 20 | }; 21 | use crate::section_0207::*; 22 | use crate::section_0211::*; 23 | processed 24 | }} 25 | -------------------------------------------------------------------------------- /src/tex_the_program/section_1197.rs: -------------------------------------------------------------------------------- 1 | //! @ \TeX\ gets to the following part of the program when the first `\.\$' ending 2 | //! a display has been scanned. 3 | // 4 | // @= 5 | pub(crate) macro Check_that_another_dollar_follows($globals:expr) {{ 6 | // begin get_x_token; 7 | get_x_token($globals)?; 8 | // if cur_cmd<>math_shift then 9 | if $globals.cur_cmd != math_shift { 10 | // begin print_err("Display math should end with $$"); 11 | // @.Display math...with \$\$@> 12 | // help2("The `$' that I just saw supposedly matches a previous `$$'.")@/ 13 | // ("So I shall assume that you typed `$$' both times."); 14 | // back_error; 15 | // end; 16 | todo!("cur_cmd != math_shift"); 17 | } 18 | // end 19 | }} 20 | 21 | use crate::section_0207::math_shift; 22 | use crate::section_0380::get_x_token; 23 | -------------------------------------------------------------------------------- /src/tex_the_program/section_1198.rs: -------------------------------------------------------------------------------- 1 | //! @ We have saved the worst for last: The fussiest part of math mode processing 2 | //! occurs when a displayed formula is being centered and placed with an optional 3 | //! equation number. 4 | //! 5 | //! @= 6 | //! @!b:pointer; {box containing the equation} 7 | //! @!w:scaled; {width of the equation} 8 | //! @!z:scaled; {width of the line} 9 | //! @!e:scaled; {width of equation number} 10 | //! @!q:scaled; {width of equation number plus space to separate from equation} 11 | //! @!d:scaled; {displacement of equation in the line} 12 | //! @!s:scaled; {move the line right this much} 13 | //! @!g1,@!g2:small_number; {glue parameter codes for before and after} 14 | //! @!r:pointer; {kern node used to position the display} 15 | //! @!t:pointer; {tail of adjustment list} 16 | -------------------------------------------------------------------------------- /src/tex_the_program/section_1207.rs: -------------------------------------------------------------------------------- 1 | //! @ @= 2 | //! begin print_err("Missing $$ inserted"); 3 | //! @.Missing {\$\$} inserted@> 4 | //! help2("Displays can use special alignments (like \eqalignno)")@/ 5 | //! ("only if nothing but the alignment itself is between $$'s."); 6 | //! back_error; 7 | //! end 8 | //! 9 | -------------------------------------------------------------------------------- /src/tex_the_program/section_1213.rs: -------------------------------------------------------------------------------- 1 | //! ` ` 2 | 3 | // @= 4 | pub(crate) macro Discard_the_prefixes_long_and_outer_if_they_are_irrelevant($globals:expr, $a:expr) {{ 5 | // if (cur_cmd<>def)and(a mod 4<>0) then 6 | if $globals.cur_cmd != def && $a % 4 != 0 { 7 | todo!("discard the prefixes"); 8 | // begin print_err("You can't use `"); print_esc("long"); print("' or `"); 9 | // print_esc("outer"); print("' with `"); 10 | // @.You can't use \\long...@> 11 | // print_cmd_chr(cur_cmd,cur_chr); print_char("'"); 12 | // help1("I'll pretend you didn't say \long or \outer here."); 13 | // error; 14 | // end 15 | } 16 | use crate::section_0209::def; 17 | }} 18 | -------------------------------------------------------------------------------- /src/tex_the_program/section_1216.rs: -------------------------------------------------------------------------------- 1 | //! @ @= 2 | //! text(frozen_protection):="inaccessible"; 3 | //! @.inaccessible@> 4 | //! 5 | -------------------------------------------------------------------------------- /src/tex_the_program/section_1217.rs: -------------------------------------------------------------------------------- 1 | //! @ Here's an example of the way many of the following routines operate. 2 | //! (Unfortunately, they aren't all as simple as this.) 3 | // 4 | // @= 5 | pub(crate) macro Assignments_1217($globals:expr, $cur_cmd:expr, $a:expr) {{ 6 | // set_font: define(cur_font_loc,data,cur_chr); 7 | let processed = if $cur_cmd == set_font { 8 | define!( 9 | $globals, 10 | $a, 11 | cur_font_loc as _, 12 | data, 13 | $globals.cur_chr.get() as _ 14 | ); 15 | use crate::section_0230::cur_font_loc; 16 | true 17 | } else { 18 | false 19 | }; 20 | use crate::section_0209::*; 21 | use crate::section_0210::*; 22 | use crate::section_1214::define; 23 | processed 24 | }} 25 | -------------------------------------------------------------------------------- /src/tex_the_program/section_1219.rs: -------------------------------------------------------------------------------- 1 | //! @ Both \.{\\let} and \.{\\futurelet} share the command code |let|. 2 | // 3 | // @= 4 | #[allow(unused_variables)] 5 | pub(crate) macro Put_each_of_tex_s_primitivies_into_the_hash_table_1219($globals:expr) {{ 6 | let globals = &mut *$globals; 7 | // primitive("let",let,normal);@/ 8 | primitive( 9 | globals, 10 | crate::strpool_str!("let"), 11 | r#let, 12 | let_kind::normal as _, 13 | ); 14 | // @!@:let_}{\.{\\let} primitive@> 15 | // primitive("futurelet",let,normal+1);@/ 16 | primitive( 17 | globals, 18 | crate::strpool_str!("futurelet"), 19 | r#let, 20 | let_kind::futurelet as _, 21 | ); 22 | // @!@:future_let_}{\.{\\futurelet} primitive@> 23 | }} 24 | 25 | use crate::section_0004::TeXGlobals; 26 | use crate::section_0135::let_kind; 27 | use crate::section_0209::*; 28 | use crate::section_0264::primitive; 29 | -------------------------------------------------------------------------------- /src/tex_the_program/section_1220.rs: -------------------------------------------------------------------------------- 1 | //! ` ` 2 | 3 | // @= 4 | pub(crate) macro Cases_of_print_cmd_chr_for_symbolic_printing_of_primitives_1220($globals:expr, $cmd:expr, $chr_code:expr) {{ 5 | // let: if chr_code<>normal then print_esc("futurelet")@+else print_esc("let"); 6 | let processed = if $cmd == r#let { 7 | if $chr_code.get() != let_kind::normal as chr_code_repr { 8 | print_esc($globals, crate::strpool_str!("futurelet")); 9 | } else { 10 | print_esc($globals, crate::strpool_str!("let")); 11 | } 12 | use crate::section_0135::let_kind; 13 | use crate::section_0297::chr_code_repr; 14 | true 15 | } else { 16 | false 17 | }; 18 | use crate::section_0063::print_esc; 19 | use crate::section_0209::*; 20 | processed 21 | }} 22 | -------------------------------------------------------------------------------- /src/tex_the_program/section_1227.rs: -------------------------------------------------------------------------------- 1 | //! @ @= 2 | //! begin if cur_cmd=toks_register then 3 | //! begin scan_eight_bit_int; cur_cmd:=assign_toks; cur_chr:=toks_base+cur_val; 4 | //! end; 5 | //! if cur_cmd=assign_toks then 6 | //! begin q:=equiv(cur_chr); 7 | //! if q=null then define(p,undefined_cs,null) 8 | //! else begin add_token_ref(q); define(p,call,q); 9 | //! end; 10 | //! goto done; 11 | //! end; 12 | //! end 13 | //! 14 | -------------------------------------------------------------------------------- /src/tex_the_program/section_1235.rs: -------------------------------------------------------------------------------- 1 | //! @ Next we consider changes to \TeX's numeric registers. 2 | // 3 | // @= 4 | pub(crate) macro Assignments_1235($globals:expr, $cur_cmd:expr, $a:expr) {{ 5 | // register,advance,multiply,divide: do_register_command(a); 6 | let processed = if $cur_cmd == register 7 | || $cur_cmd == advance 8 | || $cur_cmd == multiply 9 | || $cur_cmd == divide 10 | { 11 | do_register_command($globals, small_number::from($a as u8))?; 12 | use crate::section_0101::small_number; 13 | use crate::section_1236::do_register_command; 14 | true 15 | } else { 16 | false 17 | }; 18 | use crate::section_0209::*; 19 | processed 20 | }} 21 | -------------------------------------------------------------------------------- /src/tex_the_program/section_1245.rs: -------------------------------------------------------------------------------- 1 | //! ` ` 2 | // @= 3 | // procedure alter_page_so_far; 4 | pub(crate) fn alter_page_so_far(globals: &mut TeXGlobals) -> TeXResult<()> { 5 | // var c:0..7; {index into |page_so_far|} 6 | /// index into `page_so_far` 7 | let c; 8 | // begin c:=cur_chr; scan_optional_equals; scan_normal_dimen; 9 | c = globals.cur_chr.get(); 10 | scan_optional_equals(globals)?; 11 | scan_normal_dimen!(globals)?; 12 | // page_so_far[c]:=cur_val; 13 | globals.page_so_far[c as usize] = scaled::new_from_inner(globals.cur_val); 14 | // end; 15 | crate::ok_nojump!() 16 | } 17 | 18 | use crate::section_0004::TeXGlobals; 19 | use crate::section_0081::TeXResult; 20 | use crate::section_0101::scaled; 21 | use crate::section_0405::scan_optional_equals; 22 | use crate::section_0448::scan_normal_dimen; 23 | -------------------------------------------------------------------------------- /src/tex_the_program/section_1249.rs: -------------------------------------------------------------------------------- 1 | //! @ Here's something that isn't quite so obvious. It guarantees that 2 | //! |info(par_shape_ptr)| can hold any positive~|n| for which |get_node(2*n+1)| 3 | //! doesn't overflow the memory capacity. 4 | //! 5 | //! @= 6 | //! if 2*max_halfword= 4 | #[allow(unused_variables)] 5 | pub(crate) macro Put_each_of_tex_s_primitivies_into_the_hash_table_1250($globals:expr) {{ 6 | let globals = &mut *$globals; 7 | // primitive("hyphenation",hyph_data,0); 8 | primitive(globals, crate::strpool_str!("hyphenation"), hyph_data, 0); 9 | // @!@:hyphenation_}{\.{\\hyphenation} primitive@> 10 | // primitive("patterns",hyph_data,1); 11 | primitive(globals, crate::strpool_str!("patterns"), hyph_data, 1); 12 | // @!@:patterns_}{\.{\\patterns} primitive@> 13 | }} 14 | 15 | use crate::section_0004::TeXGlobals; 16 | use crate::section_0209::hyph_data; 17 | use crate::section_0264::primitive; 18 | -------------------------------------------------------------------------------- /src/tex_the_program/section_1251.rs: -------------------------------------------------------------------------------- 1 | //! ` ` 2 | // @= 3 | pub(crate) macro Cases_of_print_cmd_chr_for_symbolic_printing_of_primitives_1251($globals:expr, $cmd:expr, $chr_code:expr) {{ 4 | // hyph_data: if chr_code=1 then print_esc("patterns") 5 | let processed = if $cmd == hyph_data { 6 | if $chr_code.get() == 1 { 7 | print_esc($globals, crate::strpool_str!("patterns")); 8 | } 9 | // else print_esc("hyphenation"); 10 | else { 11 | print_esc($globals, crate::strpool_str!("hyphenation")); 12 | } 13 | true 14 | } else { 15 | false 16 | }; 17 | use crate::section_0063::print_esc; 18 | use crate::section_0209::*; 19 | processed 20 | }} 21 | -------------------------------------------------------------------------------- /src/tex_the_program/section_1254.rs: -------------------------------------------------------------------------------- 1 | //! ` ` 2 | 3 | // @= 4 | #[allow(unused_variables)] 5 | pub(crate) macro Put_each_of_tex_s_primitivies_into_the_hash_table_1254($globals:expr) {{ 6 | let globals = &mut *$globals; 7 | // primitive("hyphenchar",assign_font_int,0); 8 | primitive( 9 | globals, 10 | crate::strpool_str!("hyphenchar"), 11 | assign_font_int, 12 | 0, 13 | ); 14 | // @!@:hyphen_char_}{\.{\\hyphenchar} primitive@> 15 | // primitive("skewchar",assign_font_int,1); 16 | primitive(globals, crate::strpool_str!("skewchar"), assign_font_int, 1); 17 | // @!@:skew_char_}{\.{\\skewchar} primitive@> 18 | }} 19 | 20 | use crate::section_0004::TeXGlobals; 21 | use crate::section_0115::pointer; 22 | use crate::section_0209::*; 23 | use crate::section_0264::primitive; 24 | -------------------------------------------------------------------------------- /src/tex_the_program/section_1255.rs: -------------------------------------------------------------------------------- 1 | //! ` ` 2 | 3 | // @= 4 | pub(crate) macro Cases_of_print_cmd_chr_for_symbolic_printing_of_primitives_1255($globals:expr, $cmd:expr, $chr_code:expr) {{ 5 | // assign_font_int: if chr_code=0 then print_esc("hyphenchar") 6 | let processed = if $cmd == assign_font_int { 7 | if $chr_code.get() == 0 { 8 | print_esc($globals, crate::strpool_str!("hyphenchar")); 9 | } 10 | // else print_esc("skewchar"); 11 | else { 12 | print_esc($globals, crate::strpool_str!("skewchar")); 13 | } 14 | true 15 | } else { 16 | false 17 | }; 18 | use crate::section_0063::print_esc; 19 | use crate::section_0209::*; 20 | processed 21 | }} 22 | -------------------------------------------------------------------------------- /src/tex_the_program/section_1256.rs: -------------------------------------------------------------------------------- 1 | //! @ Here is where the information for a new font gets loaded. 2 | // 3 | // @= 4 | pub(crate) macro Assignments_1256($globals:expr, $cur_cmd:expr, $a:expr) {{ 5 | // def_font: new_font(a); 6 | let processed = if $cur_cmd == def_font { 7 | new_font($globals, small_number::from($a as u8))?; 8 | use crate::section_0101::small_number; 9 | use crate::section_1257::new_font; 10 | true 11 | } else { 12 | false 13 | }; 14 | use crate::section_0209::*; 15 | processed 16 | }} 17 | -------------------------------------------------------------------------------- /src/tex_the_program/section_1264.rs: -------------------------------------------------------------------------------- 1 | //! ` ` 2 | // @= 3 | pub(crate) macro Assignments_1264($globals:expr, $cur_cmd:expr, $a:expr) {{ 4 | // set_interaction: new_interaction; 5 | let processed = if $cur_cmd == set_interaction { 6 | new_interaction($globals); 7 | use crate::section_1265::new_interaction; 8 | true 9 | } else { 10 | false 11 | }; 12 | use crate::section_0209::*; 13 | processed 14 | }} 15 | -------------------------------------------------------------------------------- /src/tex_the_program/section_1266.rs: -------------------------------------------------------------------------------- 1 | //! @ The \.{\\afterassignment} command puts a token into the global 2 | //! variable |after_token|. This global variable is examined just after 3 | //! every assignment has been performed. 4 | // 5 | // @= 6 | // @!after_token:halfword; {zero, or a saved token} 7 | /// zero, or a saved token 8 | #[globals_struct_field(TeXGlobals)] 9 | pub(crate) static after_token: cur_tok_type = cur_tok_type::default(); 10 | 11 | #[globals_struct_use(TeXGlobals)] 12 | use crate::section_0297::cur_tok_type; 13 | 14 | use crate::section_0004::TeXGlobals; 15 | use globals_struct::{globals_struct_field, globals_struct_use}; 16 | -------------------------------------------------------------------------------- /src/tex_the_program/section_1267.rs: -------------------------------------------------------------------------------- 1 | //! @ @= 2 | //! after_token:=0; 3 | //! 4 | -------------------------------------------------------------------------------- /src/tex_the_program/section_1268.rs: -------------------------------------------------------------------------------- 1 | //! ` ` 2 | // @= 3 | pub(crate) macro Cases_of_main_control_that_dont_depend_on_mode_1268($globals:expr, $abs_mode_plus_cur_cmd:expr) {{ 4 | // any_mode(after_assignment):begin get_token; after_token:=cur_tok; 5 | let processed = 6 | if abs_mode_plus_cur_cmd_matches_any_mode!($abs_mode_plus_cur_cmd, after_assignment as u16) 7 | { 8 | get_token($globals)?; 9 | $globals.after_token = $globals.cur_tok; 10 | // end; 11 | true 12 | } else { 13 | false 14 | }; 15 | use crate::section_0208::after_assignment; 16 | use crate::section_0365::get_token; 17 | use crate::section_1045::abs_mode_plus_cur_cmd_matches_any_mode; 18 | processed 19 | }} 20 | -------------------------------------------------------------------------------- /src/tex_the_program/section_1269.rs: -------------------------------------------------------------------------------- 1 | //! ` ` 2 | 3 | // @= 4 | pub(crate) macro Insert_a_token_saved_by_afterassignment__if_any($globals:expr) {{ 5 | // if after_token<>0 then 6 | if $globals.after_token != 0 { 7 | // begin cur_tok:=after_token; back_input; after_token:=0; 8 | $globals.cur_tok = $globals.after_token; 9 | back_input($globals); 10 | $globals.after_token = cur_tok_type::default(); 11 | // end 12 | } 13 | use crate::section_0297::cur_tok_type; 14 | use crate::section_0325::back_input; 15 | }} 16 | -------------------------------------------------------------------------------- /src/tex_the_program/section_1271.rs: -------------------------------------------------------------------------------- 1 | //! ` ` 2 | 3 | // @= 4 | pub(crate) macro Cases_of_main_control_that_dont_depend_on_mode_1271($globals:expr, $abs_mode_plus_cur_cmd:expr) {{ 5 | // any_mode(after_group):begin get_token; save_for_after(cur_tok); 6 | let processed = 7 | if abs_mode_plus_cur_cmd_matches_any_mode!($abs_mode_plus_cur_cmd, after_group as u16) { 8 | get_token($globals)?; 9 | save_for_after($globals, $globals.cur_tok); 10 | // end; 11 | true 12 | } else { 13 | false 14 | }; 15 | use crate::section_0208::after_group; 16 | use crate::section_0280::save_for_after; 17 | use crate::section_0365::get_token; 18 | use crate::section_1045::abs_mode_plus_cur_cmd_matches_any_mode; 19 | processed 20 | }} 21 | -------------------------------------------------------------------------------- /src/tex_the_program/section_1272.rs: -------------------------------------------------------------------------------- 1 | //! @ Files for \.{\\read} are opened and closed by the |in_stream| command. 2 | // 3 | // @= 4 | #[allow(unused_variables)] 5 | pub(crate) macro Put_each_of_tex_s_primitivies_into_the_hash_table_1272($globals:expr) {{ 6 | let globals = &mut *$globals; 7 | // primitive("openin",in_stream,1); 8 | primitive(globals, crate::strpool_str!("openin"), in_stream, 1); 9 | // @!@:open_in_}{\.{\\openin} primitive@> 10 | // primitive("closein",in_stream,0); 11 | primitive(globals, crate::strpool_str!("closein"), in_stream, 0); 12 | // @!@:close_in_}{\.{\\closein} primitive@> 13 | }} 14 | 15 | use crate::section_0004::TeXGlobals; 16 | use crate::section_0208::in_stream; 17 | use crate::section_0264::primitive; 18 | -------------------------------------------------------------------------------- /src/tex_the_program/section_1273.rs: -------------------------------------------------------------------------------- 1 | //! ` ` 2 | 3 | // @= 4 | pub(crate) macro Cases_of_print_cmd_chr_for_symbolic_printing_of_primitives_1273($globals:expr, $cmd:expr, $chr_code:expr) {{ 5 | // in_stream: if chr_code=0 then print_esc("closein") 6 | let processed = if $cmd == in_stream { 7 | if $chr_code.get() == 0 { 8 | print_esc($globals, crate::strpool_str!("closein")); 9 | } 10 | // else print_esc("openin"); 11 | else { 12 | print_esc($globals, crate::strpool_str!("openin")); 13 | } 14 | true 15 | } else { 16 | false 17 | }; 18 | use crate::section_0063::print_esc; 19 | use crate::section_0208::*; 20 | processed 21 | }} 22 | -------------------------------------------------------------------------------- /src/tex_the_program/section_1274.rs: -------------------------------------------------------------------------------- 1 | //! ` ` 2 | 3 | // @= 4 | pub(crate) macro Cases_of_main_control_that_dont_depend_on_mode_1274($globals:expr, $abs_mode_plus_cur_cmd:expr) {{ 5 | // any_mode(in_stream): open_or_close_in; 6 | let processed = 7 | if abs_mode_plus_cur_cmd_matches_any_mode!($abs_mode_plus_cur_cmd, in_stream as u16) { 8 | open_or_close_in($globals)?; 9 | use crate::section_1275::open_or_close_in; 10 | true 11 | } else { 12 | false 13 | }; 14 | use crate::section_0208::*; 15 | use crate::section_1045::abs_mode_plus_cur_cmd_matches_any_mode; 16 | processed 17 | }} 18 | -------------------------------------------------------------------------------- /src/tex_the_program/section_1276.rs: -------------------------------------------------------------------------------- 1 | //! @ The user can issue messages to the terminal, regardless of the 2 | //! current mode. 3 | // 4 | // @= 5 | pub(crate) macro Cases_of_main_control_that_dont_depend_on_mode_1276($globals:expr, $abs_mode_plus_cur_cmd:expr) {{ 6 | // any_mode(message):issue_message; 7 | let processed = 8 | if abs_mode_plus_cur_cmd_matches_any_mode!($abs_mode_plus_cur_cmd, message as u16) { 9 | issue_message($globals)?; 10 | use crate::section_1279::issue_message; 11 | true 12 | } else { 13 | false 14 | }; 15 | use crate::section_0208::*; 16 | use crate::section_1045::abs_mode_plus_cur_cmd_matches_any_mode; 17 | processed 18 | }} 19 | -------------------------------------------------------------------------------- /src/tex_the_program/section_1277.rs: -------------------------------------------------------------------------------- 1 | //! ` ` 2 | // @= 3 | #[allow(unused_variables)] 4 | pub(crate) macro Put_each_of_tex_s_primitivies_into_the_hash_table_1277($globals:expr) {{ 5 | let globals = &mut *$globals; 6 | // primitive("message",message,0); 7 | primitive(globals, crate::strpool_str!("message"), message, 0); 8 | // @!@:message_}{\.{\\message} primitive@> 9 | // primitive("errmessage",message,1); 10 | primitive(globals, crate::strpool_str!("errmessage"), message, 1); 11 | // @!@:err_message_}{\.{\\errmessage} primitive@> 12 | }} 13 | 14 | use crate::section_0004::TeXGlobals; 15 | use crate::section_0208::*; 16 | use crate::section_0264::primitive; 17 | -------------------------------------------------------------------------------- /src/tex_the_program/section_1278.rs: -------------------------------------------------------------------------------- 1 | //! ` ` 2 | // @= 3 | pub(crate) macro Cases_of_print_cmd_chr_for_symbolic_printing_of_primitives_1278($globals:expr, $cmd:expr, $chr_code:expr) {{ 4 | // message: if chr_code=0 then print_esc("message") 5 | let processed = if $cmd == message { 6 | if $chr_code.get() == 0 { 7 | print_esc($globals, crate::strpool_str!("message")); 8 | } 9 | // else print_esc("errmessage"); 10 | else { 11 | print_esc($globals, crate::strpool_str!("errmessage")); 12 | } 13 | true 14 | } else { 15 | false 16 | }; 17 | use crate::section_0063::print_esc; 18 | use crate::section_0208::*; 19 | processed 20 | }} 21 | -------------------------------------------------------------------------------- /src/tex_the_program/section_1281.rs: -------------------------------------------------------------------------------- 1 | //! @ If \.{\\errmessage} occurs often in |scroll_mode|, without user-defined 2 | //! \.{\\errhelp}, we don't want to give a long help message each time. So we 3 | //! give a verbose explanation only once. 4 | //! 5 | //! @= 6 | //! @!long_help_seen:boolean; {has the long \.{\\errmessage} help been used?} 7 | //! 8 | -------------------------------------------------------------------------------- /src/tex_the_program/section_1282.rs: -------------------------------------------------------------------------------- 1 | //! @ @=long_help_seen:=false; 2 | //! 3 | -------------------------------------------------------------------------------- /src/tex_the_program/section_1284.rs: -------------------------------------------------------------------------------- 1 | //! @ The |error| routine calls on |give_err_help| if help is requested from 2 | //! the |err_help| parameter. 3 | // 4 | // @p procedure give_err_help; 5 | pub(crate) fn give_err_help(globals: &mut TeXGlobals) { 6 | // begin token_show(err_help); 7 | token_show(globals, err_help!(globals)); 8 | // end; 9 | } 10 | 11 | use crate::section_0004::TeXGlobals; 12 | use crate::section_0230::err_help; 13 | use crate::section_0295::token_show; 14 | -------------------------------------------------------------------------------- /src/tex_the_program/section_1285.rs: -------------------------------------------------------------------------------- 1 | //! @ The \.{\\uppercase} and \.{\\lowercase} commands are implemented by 2 | //! building a token list and then changing the cases of the letters in it. 3 | // 4 | // @= 5 | pub(crate) macro Cases_of_main_control_that_dont_depend_on_mode_1285($globals:expr, $abs_mode_plus_cur_cmd:expr) {{ 6 | // any_mode(case_shift):shift_case; 7 | let processed = 8 | if abs_mode_plus_cur_cmd_matches_any_mode!($abs_mode_plus_cur_cmd, case_shift as u16) { 9 | shift_case($globals)?; 10 | use crate::section_1288::shift_case; 11 | true 12 | } else { 13 | false 14 | }; 15 | use crate::section_0208::*; 16 | use crate::section_1045::abs_mode_plus_cur_cmd_matches_any_mode; 17 | processed 18 | }} 19 | -------------------------------------------------------------------------------- /src/tex_the_program/section_1287.rs: -------------------------------------------------------------------------------- 1 | //! ` ` 2 | 3 | // @= 4 | pub(crate) macro Cases_of_print_cmd_chr_for_symbolic_printing_of_primitives_1287($globals:expr, $cmd:expr, $chr_code:expr) {{ 5 | // case_shift:if chr_code=lc_code_base then print_esc("lowercase") 6 | let processed = if $cmd == case_shift { 7 | if $chr_code.get() == lc_code_base { 8 | print_esc($globals, crate::strpool_str!("lowercase")); 9 | } 10 | // else print_esc("uppercase"); 11 | else { 12 | print_esc($globals, crate::strpool_str!("uppercase")); 13 | } 14 | use crate::section_0230::lc_code_base; 15 | true 16 | } else { 17 | false 18 | }; 19 | use crate::section_0063::print_esc; 20 | use crate::section_0208::*; 21 | processed 22 | }} 23 | -------------------------------------------------------------------------------- /src/tex_the_program/section_1290.rs: -------------------------------------------------------------------------------- 1 | //! @ We come finally to the last pieces missing from |main_control|, namely the 2 | //! `\.{\\show}' commands that are useful when debugging. 3 | 4 | // 5 | // @= 6 | pub(crate) macro Cases_of_main_control_that_dont_depend_on_mode_1290($globals:expr, $abs_mode_plus_cur_cmd:expr) {{ 7 | // any_mode(xray): show_whatever; 8 | let processed = if false 9 | || abs_mode_plus_cur_cmd_matches_any_mode!($abs_mode_plus_cur_cmd, xray as u16) 10 | || false 11 | { 12 | show_whatever($globals)?; 13 | use crate::section_1293::show_whatever; 14 | true 15 | } else { 16 | false 17 | }; 18 | use crate::section_0208::*; 19 | use crate::section_1045::abs_mode_plus_cur_cmd_matches_any_mode; 20 | processed 21 | }} 22 | -------------------------------------------------------------------------------- /src/tex_the_program/section_1300.rs: -------------------------------------------------------------------------------- 1 | //! @ @= 2 | //! format_ident:=0; 3 | //! 4 | -------------------------------------------------------------------------------- /src/tex_the_program/section_1301.rs: -------------------------------------------------------------------------------- 1 | // @ @= 2 | // format_ident:=" (INITEX)"; 3 | pub(crate) macro Initialize_table_entries_done_by_initex_only_1301($globals:expr) {{ 4 | let globals = &mut *$globals; 5 | globals.format_ident = crate::strpool_str!(" (INITEX)"); 6 | }} 7 | -------------------------------------------------------------------------------- /src/tex_the_program/section_1313.rs: -------------------------------------------------------------------------------- 1 | //! ` ` 2 | // @= 3 | pub(crate) macro Dump_the_table_of_equivalents($globals:expr) {{ 4 | let k: integer; 5 | // @; 6 | crate::section_1315::Dump_regions_1_to_4_of_eqtb!($globals, k); 7 | // @; 8 | crate::section_1316::Dump_regions_5_and_6_of_eqtb!($globals, k); 9 | // dump_int(par_loc); dump_int(write_loc);@/ 10 | dump_int!($globals, $globals.par_loc as _); 11 | dump_int!($globals, $globals.write_loc as _); 12 | // @ 13 | crate::section_1318::Dump_the_hash_table!($globals); 14 | use crate::pascal::integer; 15 | use crate::section_1305::dump_int; 16 | }} 17 | -------------------------------------------------------------------------------- /src/tex_the_program/section_1326.rs: -------------------------------------------------------------------------------- 1 | //! @ We have already printed a lot of statistics, so we set |tracing_stats:=0| 2 | //! to prevent them from appearing again. 3 | // 4 | // @= 5 | pub(crate) macro Dump_a_couple_more_things_and_the_closing_check_word($globals:expr) {{ 6 | // dump_int(interaction); dump_int(format_ident); dump_int(69069); 7 | dump_int!($globals, $globals.interaction.get() as _); 8 | dump_int!($globals, $globals.format_ident.get() as _); 9 | dump_int!($globals, 69069); 10 | // tracing_stats:=0 11 | tracing_stats!($globals) = 0; 12 | use crate::section_0236::tracing_stats; 13 | use crate::section_1305::dump_int; 14 | }} 15 | -------------------------------------------------------------------------------- /src/tex_the_program/section_1329.rs: -------------------------------------------------------------------------------- 1 | //! ` ` 2 | // @= 3 | pub(crate) macro Close_the_format_file($globals:expr) {{ 4 | // w_close(fmt_file) 5 | w_close(&mut $globals.fmt_file); 6 | use crate::section_0028::w_close; 7 | }} 8 | -------------------------------------------------------------------------------- /src/tex_the_program/section_1330.rs: -------------------------------------------------------------------------------- 1 | //! @* \[51] The main program. 2 | //! This is it: the part of \TeX\ that executes all those procedures we have 3 | //! written. 4 | //! 5 | //! Well---almost. Let's leave space for a few more routines that we may 6 | //! have forgotten. 7 | //! 8 | //! @p @ 9 | //! 10 | -------------------------------------------------------------------------------- /src/tex_the_program/section_1343.rs: -------------------------------------------------------------------------------- 1 | //! @ @= 2 | //! for k:=0 to 17 do write_open[k]:=false; 3 | //! 4 | -------------------------------------------------------------------------------- /src/tex_the_program/section_1345.rs: -------------------------------------------------------------------------------- 1 | //! @ The variable |write_loc| just introduced is used to provide an 2 | //! appropriate error message in case of ``runaway'' write texts. 3 | // 4 | // @= 5 | // @!write_loc:pointer; {|eqtb| address of \.{\\write}} 6 | /// `eqtb` address of `\write` 7 | #[globals_struct_field(TeXGlobals)] 8 | pub(crate) static write_loc: pointer = pointer::default(); 9 | 10 | #[globals_struct_use(TeXGlobals)] 11 | use crate::section_0115::pointer; 12 | 13 | use crate::section_0004::TeXGlobals; 14 | use globals_struct::{globals_struct_field, globals_struct_use}; 15 | -------------------------------------------------------------------------------- /src/tex_the_program/section_1347.rs: -------------------------------------------------------------------------------- 1 | //! @ When an |extension| command occurs in |main_control|, in any mode, 2 | //! the |do_extension| routine is called. 3 | // 4 | // @= 5 | pub(crate) macro Cases_of_main_control_that_are_for_extensions_to_TeX_1347($globals:expr, $abs_mode_plus_cur_cmd:expr) {{ 6 | // any_mode(extension):do_extension; 7 | let processed = 8 | if abs_mode_plus_cur_cmd_matches_any_mode!($abs_mode_plus_cur_cmd, extension as u16) { 9 | do_extension($globals)?; 10 | use crate::section_1348::do_extension; 11 | true 12 | } else { 13 | false 14 | }; 15 | use crate::section_0208::*; 16 | use crate::section_1045::abs_mode_plus_cur_cmd_matches_any_mode; 17 | processed 18 | }} 19 | -------------------------------------------------------------------------------- /src/tex_the_program/section_1353.rs: -------------------------------------------------------------------------------- 1 | //! ` ` 2 | 3 | // @= 4 | pub(crate) macro Implement_closeout($globals:expr) {{ 5 | // begin new_write_whatsit(write_node_size); write_tokens(tail):=null; 6 | new_write_whatsit($globals, write_node_size.into())?; 7 | write_tokens!($globals, tail!($globals)) = null; 8 | // end 9 | use crate::section_0115::null; 10 | use crate::section_0213::tail; 11 | use crate::section_1341::write_node_size; 12 | use crate::section_1341::write_tokens; 13 | use crate::section_1350::new_write_whatsit; 14 | }} 15 | -------------------------------------------------------------------------------- /src/tex_the_program/section_1354.rs: -------------------------------------------------------------------------------- 1 | //! @ When `\.{\\special\{...\}}' appears, we expand the macros in the token 2 | //! list as in \.{\\xdef} and \.{\\mark}. 3 | //! 4 | //! @= 5 | //! begin new_whatsit(special_node,write_node_size); write_stream(tail):=null; 6 | //! p:=scan_toks(false,true); write_tokens(tail):=def_ref; 7 | //! end 8 | //! 9 | -------------------------------------------------------------------------------- /src/tex_the_program/section_1357.rs: -------------------------------------------------------------------------------- 1 | //! ` ` 2 | // @= 3 | // case subtype(p) of 4 | // open_node: begin r:=get_node(open_node_size); words:=open_node_size; 5 | // end; 6 | // write_node,special_node: begin r:=get_node(write_node_size); 7 | // add_token_ref(write_tokens(p)); words:=write_node_size; 8 | // end; 9 | // close_node,language_node: begin r:=get_node(small_node_size); 10 | // words:=small_node_size; 11 | // end; 12 | // othercases confusion("ext2") 13 | // @:this can't happen ext2}{\quad ext2@> 14 | // endcases 15 | // 16 | -------------------------------------------------------------------------------- /src/tex_the_program/section_1359.rs: -------------------------------------------------------------------------------- 1 | //! ` ` 2 | // @=do_nothing 3 | pub(crate) macro Incorporate_a_whatsit_node_into_an_vbox($globals:expr) {{ 4 | do_nothing!(); 5 | use crate::section_0016::do_nothing; 6 | }} 7 | -------------------------------------------------------------------------------- /src/tex_the_program/section_1360.rs: -------------------------------------------------------------------------------- 1 | //! ` ` 2 | // @=do_nothing 3 | #[allow(unused_macros)] 4 | pub(crate) macro Incorporate_a_whatsit_node_into_an_hbox($globals:expr) { 5 | do_nothing!(); 6 | use crate::section_0016::do_nothing; 7 | } 8 | -------------------------------------------------------------------------------- /src/tex_the_program/section_1361.rs: -------------------------------------------------------------------------------- 1 | //! ` ` 2 | // @=d:=0 3 | pub(crate) macro Let_d_be_the_width_of_the_whatsit_p($globals:expr, $p:expr, $d:expr) {{ 4 | $d = scaled::zero(); 5 | use crate::section_0101::scaled; 6 | }} 7 | -------------------------------------------------------------------------------- /src/tex_the_program/section_1363.rs: -------------------------------------------------------------------------------- 1 | //! ` ` 2 | // @=@+ 3 | pub(crate) macro Advance_past_a_whatsit_node_in_the_pre_hyphenation_loop($globals:expr, $s:expr) {{ 4 | // adv_past(s) 5 | adv_past!($globals, $s); 6 | use crate::section_1362::adv_past; 7 | }} 8 | -------------------------------------------------------------------------------- /src/tex_the_program/section_1364.rs: -------------------------------------------------------------------------------- 1 | //! ` ` 2 | 3 | // @= 4 | pub(crate) macro Prepare_to_move_whatsit_p_to_the_current_page__then_goto_contribute($globals:expr, $p:expr, $lbl_contribute:lifetime) {{ 5 | // goto contribute 6 | crate::goto_forward_label!($lbl_contribute); 7 | }} 8 | -------------------------------------------------------------------------------- /src/tex_the_program/section_1365.rs: -------------------------------------------------------------------------------- 1 | //! @ @= 2 | //! goto not_found 3 | //! 4 | -------------------------------------------------------------------------------- /src/tex_the_program/section_1366.rs: -------------------------------------------------------------------------------- 1 | //! ` ` 2 | 3 | // @= 4 | pub(crate) macro Output_the_whatsit_node_p_in_a_vlist($globals:expr, $p:expr) {{ 5 | // out_what(p) 6 | out_what($globals, $p)?; 7 | 8 | use crate::section_1373::out_what; 9 | }} 10 | -------------------------------------------------------------------------------- /src/tex_the_program/section_1367.rs: -------------------------------------------------------------------------------- 1 | //! ` ` 2 | // 3 | // @= 4 | pub(crate) macro Output_the_whatsit_node_p_in_a_hlist($globals:expr, $p:expr) {{ 5 | // out_what(p) 6 | out_what($globals, $p)?; 7 | 8 | use crate::section_1373::out_what; 9 | }} 10 | -------------------------------------------------------------------------------- /src/tex_the_program/section_1372.rs: -------------------------------------------------------------------------------- 1 | //! @ @= 2 | //! begin print_err("Unbalanced write command"); 3 | //! @.Unbalanced write...@> 4 | //! help2("On this page there's a \write with fewer real {'s than }'s.")@/ 5 | //! ("I can't handle that very well; good luck."); error; 6 | //! repeat get_token; 7 | //! until cur_tok=end_write_token; 8 | //! end 9 | //! 10 | -------------------------------------------------------------------------------- /src/tex_the_program/section_1378.rs: -------------------------------------------------------------------------------- 1 | //! ` ` 2 | // @= 3 | pub(crate) macro Finish_the_extensions($globals:expr) {{ 4 | // for k:=0 to 15 do if write_open[k] then a_close(write_file[k]) 5 | for k in 0..=15 { 6 | if $globals.write_open[k] { 7 | a_close(&mut $globals.write_file[k]) 8 | } 9 | } 10 | use crate::section_0028::a_close; 11 | }} 12 | -------------------------------------------------------------------------------- /src/tex_the_program/section_1379.rs: -------------------------------------------------------------------------------- 1 | //! @* \[54] System-dependent changes. 2 | //! This section should be replaced, if necessary, by any special 3 | //! modifications of the program 4 | //! that are necessary to make \TeX\ work at a particular installation. 5 | //! It is usually best to design your change file so that all changes to 6 | //! previous sections preserve the section numbering; then everybody's version 7 | //! will be consistent with the published program. More extensive changes, 8 | //! which introduce new sections, can be inserted here; then only the index 9 | //! itself will get a new section number. 10 | //! @^system dependencies@> 11 | --------------------------------------------------------------------------------