How to use sh method in root

Best JavaScript code snippet using root

strategeOneClass.py

Source:strategeOneClass.py Github

copy

Full Screen

1# -*- coding: utf-8 -*-2"""3Created on Wed Mar 01 15:51:28 20174一个实战策略的简单量化测试5看前一日股票收盘价、成交额以及换手率对今日股价的影响6@author: Administrator7"""8import pandas as pd9from pandas import DataFrame10import numpy as np11from sklearn import datasets, linear_model12import sys13from WindPy import *14from datetime import *15w.start()16#load data17datelist = []18datelistJan = []19datelistFeb = []20dateJan = 2017010121dateFeb = 2017020122for i in range(31):23 datelistJan.append(dateJan)24 dateJan += 125 26for i in range(28):27 datelistFeb.append(dateFeb)28 dateFeb += 129 30datelistJan.extend(datelistFeb)31datelist = datelistJan32class strategeOne():33 def __init__(self, datelist):34 self.datelist = datelist35 36 37 def get_reward(self,y_true, y_fit):38 R2 = 1 - np.sum((y_true - y_fit)**2) / np.sum((y_true - np.mean(y_true))**2)39 R = np.sign(R2) * np.sqrt(abs(R2))40 return(R)41 42 def summary(self):43 theta = []44 R = []45 for i in range(len(self.datelist)):46 print(i)47 date = self.datelist[i]48 strdate = str(date) 49 dateString = "tradeDate="+strdate+";priceAdj=U;cycle=D"50 #"tradeDate=20170227;priceAdj=U;cycle=D"51 52 data = w.wss("600000.SH,600004.SH,600006.SH,600007.SH,600008.SH,600009.SH,600010.SH,600011.SH,600012.SH,600015.SH,600016.SH,600017.SH,600018.SH,600019.SH,600020.SH,600021.SH,600022.SH,600023.SH,600026.SH,600027.SH,600028.SH,600029.SH,600030.SH,600031.SH,600033.SH,600035.SH,600036.SH,600037.SH,600038.SH,600039.SH,600048.SH,600050.SH,600051.SH,600052.SH,600053.SH,600054.SH,600055.SH,600056.SH,600057.SH,600058.SH,600059.SH,600060.SH,600061.SH,600062.SH,600063.SH,600064.SH,600066.SH,600067.SH,600068.SH,600069.SH,600070.SH,600071.SH,600072.SH,600073.SH,600074.SH,600075.SH,600076.SH,600077.SH,600078.SH,600079.SH,600080.SH,600081.SH,600082.SH,600083.SH,600084.SH,600085.SH,600086.SH,600088.SH,600089.SH,600090.SH,600091.SH,600093.SH,600094.SH,600095.SH,600096.SH,600097.SH,600098.SH,600099.SH,600100.SH,600101.SH,600103.SH,600104.SH,600105.SH,600106.SH,600107.SH,600108.SH,600109.SH,600110.SH,600111.SH,600112.SH,600113.SH,600114.SH,600115.SH,600116.SH,600117.SH,600118.SH,600119.SH,600120.SH,600121.SH,600122.SH,600123.SH,600125.SH,600126.SH,600127.SH,600128.SH,600129.SH,600130.SH,600131.SH,600132.SH,600133.SH,600135.SH,600136.SH,600137.SH,600138.SH,600139.SH,600141.SH,600143.SH,600145.SH,600146.SH,600148.SH,600149.SH,600150.SH,600151.SH,600152.SH,600153.SH,600155.SH,600156.SH,600157.SH,600158.SH,600159.SH,600160.SH,600161.SH,600162.SH,600163.SH,600165.SH,600166.SH,600167.SH,600168.SH,600169.SH,600170.SH,600171.SH,600172.SH,600173.SH,600175.SH,600176.SH,600177.SH,600178.SH,600179.SH,600180.SH,600182.SH,600183.SH,600184.SH,600185.SH,600186.SH,600187.SH,600188.SH,600189.SH,600190.SH,600191.SH,600192.SH,600193.SH,600195.SH,600196.SH,600197.SH,600198.SH,600199.SH,600200.SH,600201.SH,600202.SH,600203.SH,600206.SH,600207.SH,600208.SH,600209.SH,600210.SH,600211.SH,600212.SH,600213.SH,600215.SH,600216.SH,600217.SH,600218.SH,600219.SH,600220.SH,600221.SH,600222.SH,600223.SH,600225.SH,600226.SH,600227.SH,600228.SH,600229.SH,600230.SH,600231.SH,600232.SH,600233.SH,600234.SH,600235.SH,600236.SH,600237.SH,600238.SH,600239.SH,600240.SH,600241.SH,600242.SH,600243.SH,600246.SH,600247.SH,600248.SH,600249.SH,600250.SH,600251.SH,600252.SH,600255.SH,600256.SH,600257.SH,600258.SH,600259.SH,600260.SH,600261.SH,600262.SH,600265.SH,600266.SH,600267.SH,600268.SH,600269.SH,600270.SH,600271.SH,600272.SH,600273.SH,600275.SH,600276.SH,600277.SH,600278.SH,600279.SH,600280.SH,600281.SH,600282.SH,600283.SH,600284.SH,600285.SH,600287.SH,600288.SH,600289.SH,600290.SH,600291.SH,600292.SH,600293.SH,600295.SH,600297.SH,600298.SH,600299.SH,600300.SH,600301.SH,600302.SH,600303.SH,600305.SH,600306.SH,600307.SH,600308.SH,600309.SH,600310.SH,600311.SH,600312.SH,600313.SH,600315.SH,600316.SH,600317.SH,600318.SH,600319.SH,600320.SH,600321.SH,600322.SH,600323.SH,600325.SH,600326.SH,600327.SH,600328.SH,600329.SH,600330.SH,600331.SH,600332.SH,600333.SH,600335.SH,600336.SH,600337.SH,600338.SH,600339.SH,600340.SH,600343.SH,600345.SH,600346.SH,600348.SH,600350.SH,600351.SH,600352.SH,600353.SH,600354.SH,600355.SH,600356.SH,600358.SH,600359.SH,600360.SH,600361.SH,600362.SH,600363.SH,600365.SH,600366.SH,600367.SH,600368.SH,600369.SH,600370.SH,600371.SH,600372.SH,600373.SH,600375.SH,600376.SH,600377.SH,600378.SH,600379.SH,600380.SH,600381.SH,600382.SH,600383.SH,600385.SH,600386.SH,600387.SH,600388.SH,600389.SH,600390.SH,600391.SH,600392.SH,600393.SH,600395.SH,600396.SH,600397.SH,600398.SH,600399.SH,600400.SH,600401.SH,600403.SH,600405.SH,600406.SH,600408.SH,600409.SH,600410.SH,600415.SH,600416.SH,600418.SH,600419.SH,600420.SH,600421.SH,600422.SH,600423.SH,600425.SH,600426.SH,600428.SH,600429.SH,600432.SH,600433.SH,600435.SH,600436.SH,600438.SH,600439.SH,600444.SH,600446.SH,600448.SH,600449.SH,600452.SH,600455.SH,600456.SH,600458.SH,600459.SH,600460.SH,600461.SH,600462.SH,600463.SH,600466.SH,600467.SH,600468.SH,600469.SH,600470.SH,600475.SH,600476.SH,600477.SH,600478.SH,600479.SH,600480.SH,600481.SH,600482.SH,600483.SH,600485.SH,600486.SH,600487.SH,600488.SH,600489.SH,600490.SH,600491.SH,600493.SH,600495.SH,600496.SH,600497.SH,600498.SH,600499.SH,600500.SH,600501.SH,600502.SH,600503.SH,600505.SH,600506.SH,600507.SH,600508.SH,600509.SH,600510.SH,600511.SH,600512.SH,600513.SH,600515.SH,600516.SH,600517.SH,600518.SH,600519.SH,600520.SH,600521.SH,600522.SH,600523.SH,600525.SH,600526.SH,600527.SH,600528.SH,600529.SH,600530.SH,600531.SH,600532.SH,600533.SH,600535.SH,600536.SH,600537.SH,600538.SH,600539.SH,600540.SH,600543.SH,600545.SH,600546.SH,600547.SH,600548.SH,600549.SH,600550.SH,600551.SH,600552.SH,600555.SH,600556.SH,600557.SH,600558.SH,600559.SH,600560.SH,600561.SH,600562.SH,600563.SH,600565.SH,600566.SH,600567.SH,600568.SH,600569.SH,600570.SH,600571.SH,600572.SH,600573.SH,600575.SH,600576.SH,600577.SH,600578.SH,600579.SH,600580.SH,600581.SH,600582.SH,600583.SH,600584.SH,600585.SH,600586.SH,600587.SH,600588.SH,600589.SH,600590.SH,600592.SH,600593.SH,600594.SH,600595.SH,600596.SH,600597.SH,600598.SH,600599.SH,600600.SH,600601.SH,600602.SH,600603.SH,600604.SH,600605.SH,600606.SH,600608.SH,600609.SH,600610.SH,600611.SH,600612.SH,600613.SH,600614.SH,600615.SH,600616.SH,600617.SH,600618.SH,600619.SH,600620.SH,600621.SH,600622.SH,600623.SH,600624.SH,600626.SH,600628.SH,600629.SH,600630.SH,600633.SH,600634.SH,600635.SH,600636.SH,600637.SH,600638.SH,600639.SH,600640.SH,600641.SH,600642.SH,600643.SH,600644.SH,600645.SH,600647.SH,600648.SH,600649.SH,600650.SH,600651.SH,600652.SH,600653.SH,600654.SH,600655.SH,600657.SH,600658.SH,600660.SH,600661.SH,600662.SH,600663.SH,600664.SH,600665.SH,600666.SH,600667.SH,600668.SH,600671.SH,600673.SH,600674.SH,600675.SH,600676.SH,600677.SH,600678.SH,600679.SH,600680.SH,600681.SH,600682.SH,600683.SH,600684.SH,600685.SH,600686.SH,600687.SH,600688.SH,600689.SH,600690.SH,600691.SH,600692.SH,600693.SH,600694.SH,600695.SH,600696.SH,600697.SH,600698.SH,600699.SH,600701.SH,600702.SH,600703.SH,600704.SH,600705.SH,600706.SH,600707.SH,600708.SH,600710.SH,600711.SH,600712.SH,600713.SH,600714.SH,600715.SH,600716.SH,600717.SH,600718.SH,600719.SH,600720.SH,600721.SH,600722.SH,600723.SH,600724.SH,600725.SH,600726.SH,600727.SH,600728.SH,600729.SH,600730.SH,600731.SH,600732.SH,600733.SH,600734.SH,600735.SH,600736.SH,600737.SH,600738.SH,600739.SH,600740.SH,600741.SH,600742.SH,600743.SH,600744.SH,600745.SH,600746.SH,600747.SH,600748.SH,600749.SH,600750.SH,600751.SH,600753.SH,600754.SH,600755.SH,600756.SH,600757.SH,600758.SH,600759.SH,600760.SH,600761.SH,600763.SH,600764.SH,600765.SH,600766.SH,600767.SH,600768.SH,600769.SH,600770.SH,600771.SH,600773.SH,600774.SH,600775.SH,600776.SH,600777.SH,600778.SH,600779.SH,600780.SH,600781.SH,600782.SH,600783.SH,600784.SH,600785.SH,600787.SH,600789.SH,600790.SH,600791.SH,600792.SH,600793.SH,600794.SH,600795.SH,600796.SH,600797.SH,600798.SH,600800.SH,600801.SH,600802.SH,600803.SH,600804.SH,600805.SH,600806.SH,600807.SH,600808.SH,600809.SH,600810.SH,600811.SH,600812.SH,600814.SH,600815.SH,600816.SH,600817.SH,600818.SH,600819.SH,600820.SH,600821.SH,600822.SH,600823.SH,600824.SH,600825.SH,600826.SH,600827.SH,600828.SH,600829.SH,600830.SH,600831.SH,600833.SH,600834.SH,600835.SH,600836.SH,600837.SH,600838.SH,600839.SH,600841.SH,600843.SH,600844.SH,600845.SH,600846.SH,600847.SH,600848.SH,600850.SH,600851.SH,600853.SH,600854.SH,600855.SH,600856.SH,600857.SH,600858.SH,600859.SH,600860.SH,600861.SH,600862.SH,600863.SH,600864.SH,600865.SH,600866.SH,600867.SH,600868.SH,600869.SH,600870.SH,600871.SH,600872.SH,600873.SH,600874.SH,600875.SH,600876.SH,600877.SH,600879.SH,600880.SH,600881.SH,600882.SH,600883.SH,600884.SH,600885.SH,600886.SH,600887.SH,600888.SH,600889.SH,600890.SH,600891.SH,600892.SH,600893.SH,600894.SH,600895.SH,600896.SH,600897.SH,600898.SH,600900.SH,600908.SH,600909.SH,600917.SH,600919.SH,600926.SH,600936.SH,600939.SH,600958.SH,600959.SH,600960.SH,600961.SH,600962.SH,600963.SH,600965.SH,600966.SH,600967.SH,600969.SH,600970.SH,600971.SH,600973.SH,600975.SH,600976.SH,600977.SH,600978.SH,600979.SH,600980.SH,600981.SH,600982.SH,600983.SH,600984.SH,600985.SH,600986.SH,600987.SH,600988.SH,600990.SH,600992.SH,600993.SH,600995.SH,600996.SH,600997.SH,600998.SH,600999.SH,601000.SH,601001.SH,601002.SH,601003.SH,601005.SH,601006.SH,601007.SH,601008.SH,601009.SH,601010.SH,601011.SH,601012.SH,601015.SH,601016.SH,601018.SH,601020.SH,601021.SH,601028.SH,601038.SH,601058.SH,601069.SH,601088.SH,601098.SH,601099.SH,601100.SH,601101.SH,601106.SH,601107.SH,601111.SH,601113.SH,601116.SH,601117.SH,601118.SH,601126.SH,601127.SH,601128.SH,601137.SH,601139.SH,601155.SH,601158.SH,601163.SH,601166.SH,601168.SH,601169.SH,601177.SH,601179.SH,601186.SH,601188.SH,601198.SH,601199.SH,601208.SH,601211.SH,601212.SH,601216.SH,601218.SH,601222.SH,601225.SH,601226.SH,601229.SH,601231.SH,601233.SH,601238.SH,601258.SH,601288.SH,601311.SH,601313.SH,601318.SH,601328.SH,601333.SH,601336.SH,601339.SH,601368.SH,601369.SH,601375.SH,601377.SH,601388.SH,601390.SH,601398.SH,601500.SH,601515.SH,601518.SH,601519.SH,601555.SH,601558.SH,601566.SH,601567.SH,601579.SH,601588.SH,601595.SH,601599.SH,601600.SH,601601.SH,601607.SH,601608.SH,601611.SH,601616.SH,601618.SH,601628.SH,601633.SH,601636.SH,601666.SH,601668.SH,601669.SH,601677.SH,601678.SH,601688.SH,601689.SH,601699.SH,601700.SH,601717.SH,601718.SH,601727.SH,601766.SH,601777.SH,601788.SH,601789.SH,601798.SH,601799.SH,601800.SH,601801.SH,601808.SH,601811.SH,601818.SH,601857.SH,601858.SH,601866.SH,601872.SH,601877.SH,601880.SH,601881.SH,601882.SH,601886.SH,601888.SH,601890.SH,601898.SH,601899.SH,601900.SH,601901.SH,601908.SH,601918.SH,601919.SH,601928.SH,601929.SH,601933.SH,601939.SH,601958.SH,601965.SH,601966.SH,601968.SH,601969.SH,601985.SH,601988.SH,601989.SH,601991.SH,601992.SH,601996.SH,601997.SH,601998.SH,601999.SH,603000.SH,603001.SH,603002.SH,603003.SH,603005.SH,603006.SH,603007.SH,603008.SH,603009.SH,603010.SH,603011.SH,603012.SH,603015.SH,603016.SH,603017.SH,603018.SH,603019.SH,603020.SH,603021.SH,603022.SH,603023.SH,603025.SH,603026.SH,603027.SH,603028.SH,603029.SH,603030.SH,603031.SH,603032.SH,603033.SH,603035.SH,603036.SH,603037.SH,603038.SH,603039.SH,603040.SH,603058.SH,603060.SH,603066.SH,603067.SH,603069.SH,603077.SH,603085.SH,603088.SH,603089.SH,603090.SH,603098.SH,603099.SH,603100.SH,603101.SH,603108.SH,603111.SH,603116.SH,603117.SH,603118.SH,603123.SH,603126.SH,603128.SH,603131.SH,603158.SH,603159.SH,603160.SH,603165.SH,603166.SH,603167.SH,603168.SH,603169.SH,603177.SH,603186.SH,603188.SH,603189.SH,603198.SH,603199.SH,603203.SH,603208.SH,603218.SH,603222.SH,603223.SH,603227.SH,603228.SH,603238.SH,603239.SH,603258.SH,603266.SH,603268.SH,603288.SH,603298.SH,603299.SH,603300.SH,603306.SH,603308.SH,603309.SH,603311.SH,603313.SH,603315.SH,603318.SH,603319.SH,603322.SH,603323.SH,603328.SH,603330.SH,603333.SH,603336.SH,603337.SH,603338.SH,603339.SH,603345.SH,603355.SH,603358.SH,603360.SH,603366.SH,603368.SH,603369.SH,603377.SH,603389.SH,603393.SH,603398.SH,603399.SH,603416.SH,603421.SH,603429.SH,603444.SH,603456.SH,603508.SH,603515.SH,603518.SH,603519.SH,603520.SH,603528.SH,603555.SH,603556.SH,603558.SH,603559.SH,603566.SH,603567.SH,603568.SH,603569.SH,603577.SH,603579.SH,603585.SH,603588.SH,603589.SH,603598.SH,603599.SH,603600.SH,603601.SH,603603.SH,603606.SH,603608.SH,603609.SH,603611.SH,603615.SH,603616.SH,603618.SH,603626.SH,603628.SH,603633.SH,603636.SH,603637.SH,603638.SH,603639.SH,603658.SH,603660.SH,603663.SH,603667.SH,603668.SH,603669.SH,603677.SH,603678.SH,603686.SH,603688.SH,603689.SH,603690.SH,603696.SH,603698.SH,603699.SH,603701.SH,603703.SH,603708.SH,603716.SH,603718.SH,603726.SH,603727.SH,603729.SH,603737.SH,603738.SH,603766.SH,603777.SH,603778.SH,603779.SH,603788.SH,603789.SH,603798.SH,603799.SH,603800.SH,603806.SH,603808.SH,603816.SH,603817.SH,603818.SH,603819.SH,603822.SH,603823.SH,603828.SH,603838.SH,603839.SH,603843.SH,603858.SH,603859.SH,603861.SH,603866.SH,603868.SH,603869.SH,603877.SH,603878.SH,603881.SH,603883.SH,603885.SH,603886.SH,603887.SH,603888.SH,603889.SH,603898.SH,603899.SH,603900.SH,603901.SH,603909.SH,603918.SH,603919.SH,603928.SH,603929.SH,603936.SH,603939.SH,603958.SH,603959.SH,603966.SH,603968.SH,603969.SH,603977.SH,603979.SH,603986.SH,603987.SH,603988.SH,603989.SH,603990.SH,603993.SH,603996.SH,603997.SH,603998.SH,603999.SH","pre_close,close,amt,free_turn",dateString)53 dataPd = pd.DataFrame(data.Data)54 dataPd = dataPd.transpose()55 dataPd = dataPd.dropna()56 57 if dataPd.empty:58 continue59 else:60 mean_vals = dataPd.mean()61 sd_vals = dataPd.std()62 #dataPd.fillna(mean_vals,inplace=True)63 #normalized data64 dataPdNorm = (dataPd - mean_vals)/sd_vals65 66 xTrain = dataPdNorm.iloc[:,[0,2,3]]67 yTrain = dataPdNorm.iloc[:,1] 68 pricePrediction = linear_model.LinearRegression()69 pricePrediction.fit(xTrain,yTrain)70 theta.append(pricePrediction.coef_)71# print(yTrain)72# print(pricePrediction.predict(xTrain))73 R.append(self.get_reward(yTrain,pricePrediction.predict(xTrain)))74 75 thetaPd = pd.DataFrame(theta)76 summary = thetaPd.describe()77 #print(R,'\n')78 #print(theta)79 sys.stdout.write("\t""pre_close \t""amt \t""free_turn")80 print(summary)81 82if __name__ == '__main__' :83 #simpleBox(target_url = target_url)84 summary1 = strategeOne(datelist = datelist)...

Full Screen

Full Screen

sh_bison.js

Source:sh_bison.js Github

copy

Full Screen

1if (! this.sh_languages) {2 this.sh_languages = {};3}4sh_languages['bison'] = [5 [6 [7 /^%\{/g,8 'sh_preproc',9 1,10 111 ],12 [13 /^%[sx]/g,14 'sh_preproc',15 16,16 117 ],18 [19 /^%option/g,20 'sh_preproc',21 17,22 123 ],24 [25 /^%(?:array|pointer|[aceknopr])/g,26 'sh_preproc',27 -128 ],29 [30 /[A-Za-z_][A-Za-z0-9_-]*/g,31 'sh_preproc',32 19,33 134 ],35 [36 /^%%/g,37 'sh_preproc',38 20,39 140 ]41 ],42 [43 [44 /^%\}/g,45 'sh_preproc',46 -247 ],48 [49 /(\b(?:class|struct|typename))([ \t]+)([A-Za-z0-9_]+)/g,50 ['sh_keyword', 'sh_normal', 'sh_classname'],51 -152 ],53 [54 /\b(?:class|const_cast|delete|dynamic_cast|explicit|false|friend|inline|mutable|namespace|new|operator|private|protected|public|reinterpret_cast|static_cast|template|this|throw|true|try|typeid|typename|using|virtual)\b/g,55 'sh_keyword',56 -157 ],58 [59 /\/\/\//g,60 'sh_comment',61 262 ],63 [64 /\/\//g,65 'sh_comment',66 867 ],68 [69 /\/\*\*/g,70 'sh_comment',71 972 ],73 [74 /\/\*/g,75 'sh_comment',76 1077 ],78 [79 /(\bstruct)([ \t]+)([A-Za-z0-9_]+)/g,80 ['sh_keyword', 'sh_normal', 'sh_classname'],81 -182 ],83 [84 /^[ \t]*#(?:[ \t]*include)/g,85 'sh_preproc',86 11,87 188 ],89 [90 /^[ \t]*#(?:[ \t]*[A-Za-z0-9_]*)/g,91 'sh_preproc',92 -193 ],94 [95 /\b[+-]?(?:(?:0x[A-Fa-f0-9]+)|(?:(?:[\d]*\.)?[\d]+(?:[eE][+-]?[\d]+)?))u?(?:(?:int(?:8|16|32|64))|L)?\b/g,96 'sh_number',97 -198 ],99 [100 /"/g,101 'sh_string',102 14103 ],104 [105 /'/g,106 'sh_string',107 15108 ],109 [110 /\b(?:__asm|__cdecl|__declspec|__export|__far16|__fastcall|__fortran|__import|__pascal|__rtti|__stdcall|_asm|_cdecl|__except|_export|_far16|_fastcall|__finally|_fortran|_import|_pascal|_stdcall|__thread|__try|asm|auto|break|case|catch|cdecl|const|continue|default|do|else|enum|extern|for|goto|if|pascal|register|return|sizeof|static|struct|switch|typedef|union|volatile|while)\b/g,111 'sh_keyword',112 -1113 ],114 [115 /\b(?:bool|char|double|float|int|long|short|signed|unsigned|void|wchar_t)\b/g,116 'sh_type',117 -1118 ],119 [120 /~|!|%|\^|\*|\(|\)|-|\+|=|\[|\]|\\|:|;|,|\.|\/|\?|&|<|>|\|/g,121 'sh_symbol',122 -1123 ],124 [125 /\{|\}/g,126 'sh_cbracket',127 -1128 ],129 [130 /(?:[A-Za-z]|_)[A-Za-z0-9_]*(?=[ \t]*\()/g,131 'sh_function',132 -1133 ],134 [135 /([A-Za-z](?:[^`~!@#$%&*()_=+{}|;:",<.>\/?'\\[\]\^\-\s]|[_])*)((?:<.*>)?)(\s+(?=[*&]*[A-Za-z][^`~!@#$%&*()_=+{}|;:",<.>\/?'\\[\]\^\-\s]*\s*[`~!@#$%&*()_=+{}|;:",<.>\/?'\\[\]\^\-\[\]]+))/g,136 ['sh_usertype', 'sh_usertype', 'sh_normal'],137 -1138 ]139 ],140 [141 [142 /$/g,143 null,144 -2145 ],146 [147 /(?:<?)[A-Za-z0-9_\.\/\-_~]+@[A-Za-z0-9_\.\/\-_~]+(?:>?)|(?:<?)[A-Za-z0-9_]+:\/\/[A-Za-z0-9_\.\/\-_~]+(?:>?)/g,148 'sh_url',149 -1150 ],151 [152 /<\?xml/g,153 'sh_preproc',154 3,155 1156 ],157 [158 /<!DOCTYPE/g,159 'sh_preproc',160 5,161 1162 ],163 [164 /<!--/g,165 'sh_comment',166 6167 ],168 [169 /<(?:\/)?[A-Za-z](?:[A-Za-z0-9_:.-]*)(?:\/)?>/g,170 'sh_keyword',171 -1172 ],173 [174 /<(?:\/)?[A-Za-z](?:[A-Za-z0-9_:.-]*)/g,175 'sh_keyword',176 7,177 1178 ],179 [180 /&(?:[A-Za-z0-9]+);/g,181 'sh_preproc',182 -1183 ],184 [185 /<(?:\/)?[A-Za-z][A-Za-z0-9]*(?:\/)?>/g,186 'sh_keyword',187 -1188 ],189 [190 /<(?:\/)?[A-Za-z][A-Za-z0-9]*/g,191 'sh_keyword',192 7,193 1194 ],195 [196 /@[A-Za-z]+/g,197 'sh_type',198 -1199 ],200 [201 /(?:TODO|FIXME|BUG)(?:[:]?)/g,202 'sh_todo',203 -1204 ]205 ],206 [207 [208 /\?>/g,209 'sh_preproc',210 -2211 ],212 [213 /([^=" \t>]+)([ \t]*)(=?)/g,214 ['sh_type', 'sh_normal', 'sh_symbol'],215 -1216 ],217 [218 /"/g,219 'sh_string',220 4221 ]222 ],223 [224 [225 /\\(?:\\|")/g,226 null,227 -1228 ],229 [230 /"/g,231 'sh_string',232 -2233 ]234 ],235 [236 [237 />/g,238 'sh_preproc',239 -2240 ],241 [242 /([^=" \t>]+)([ \t]*)(=?)/g,243 ['sh_type', 'sh_normal', 'sh_symbol'],244 -1245 ],246 [247 /"/g,248 'sh_string',249 4250 ]251 ],252 [253 [254 /-->/g,255 'sh_comment',256 -2257 ],258 [259 /<!--/g,260 'sh_comment',261 6262 ]263 ],264 [265 [266 /(?:\/)?>/g,267 'sh_keyword',268 -2269 ],270 [271 /([^=" \t>]+)([ \t]*)(=?)/g,272 ['sh_type', 'sh_normal', 'sh_symbol'],273 -1274 ],275 [276 /"/g,277 'sh_string',278 4279 ]280 ],281 [282 [283 /$/g,284 null,285 -2286 ]287 ],288 [289 [290 /\*\//g,291 'sh_comment',292 -2293 ],294 [295 /(?:<?)[A-Za-z0-9_\.\/\-_~]+@[A-Za-z0-9_\.\/\-_~]+(?:>?)|(?:<?)[A-Za-z0-9_]+:\/\/[A-Za-z0-9_\.\/\-_~]+(?:>?)/g,296 'sh_url',297 -1298 ],299 [300 /<\?xml/g,301 'sh_preproc',302 3,303 1304 ],305 [306 /<!DOCTYPE/g,307 'sh_preproc',308 5,309 1310 ],311 [312 /<!--/g,313 'sh_comment',314 6315 ],316 [317 /<(?:\/)?[A-Za-z](?:[A-Za-z0-9_:.-]*)(?:\/)?>/g,318 'sh_keyword',319 -1320 ],321 [322 /<(?:\/)?[A-Za-z](?:[A-Za-z0-9_:.-]*)/g,323 'sh_keyword',324 7,325 1326 ],327 [328 /&(?:[A-Za-z0-9]+);/g,329 'sh_preproc',330 -1331 ],332 [333 /<(?:\/)?[A-Za-z][A-Za-z0-9]*(?:\/)?>/g,334 'sh_keyword',335 -1336 ],337 [338 /<(?:\/)?[A-Za-z][A-Za-z0-9]*/g,339 'sh_keyword',340 7,341 1342 ],343 [344 /@[A-Za-z]+/g,345 'sh_type',346 -1347 ],348 [349 /(?:TODO|FIXME|BUG)(?:[:]?)/g,350 'sh_todo',351 -1352 ]353 ],354 [355 [356 /\*\//g,357 'sh_comment',358 -2359 ],360 [361 /(?:<?)[A-Za-z0-9_\.\/\-_~]+@[A-Za-z0-9_\.\/\-_~]+(?:>?)|(?:<?)[A-Za-z0-9_]+:\/\/[A-Za-z0-9_\.\/\-_~]+(?:>?)/g,362 'sh_url',363 -1364 ],365 [366 /(?:TODO|FIXME|BUG)(?:[:]?)/g,367 'sh_todo',368 -1369 ]370 ],371 [372 [373 /$/g,374 null,375 -2376 ],377 [378 /</g,379 'sh_string',380 12381 ],382 [383 /"/g,384 'sh_string',385 13386 ],387 [388 /\/\/\//g,389 'sh_comment',390 2391 ],392 [393 /\/\//g,394 'sh_comment',395 8396 ],397 [398 /\/\*\*/g,399 'sh_comment',400 9401 ],402 [403 /\/\*/g,404 'sh_comment',405 10406 ]407 ],408 [409 [410 /$/g,411 null,412 -2413 ],414 [415 />/g,416 'sh_string',417 -2418 ]419 ],420 [421 [422 /$/g,423 null,424 -2425 ],426 [427 /\\(?:\\|")/g,428 null,429 -1430 ],431 [432 /"/g,433 'sh_string',434 -2435 ]436 ],437 [438 [439 /"/g,440 'sh_string',441 -2442 ],443 [444 /\\./g,445 'sh_specialchar',446 -1447 ]448 ],449 [450 [451 /'/g,452 'sh_string',453 -2454 ],455 [456 /\\./g,457 'sh_specialchar',458 -1459 ]460 ],461 [462 [463 /$/g,464 null,465 -2466 ],467 [468 /[A-Za-z_][A-Za-z0-9_-]*/g,469 'sh_function',470 -1471 ]472 ],473 [474 [475 /$/g,476 null,477 -2478 ],479 [480 /[A-Za-z_][A-Za-z0-9_-]*/g,481 'sh_keyword',482 -1483 ],484 [485 /"/g,486 'sh_string',487 18488 ],489 [490 /=/g,491 'sh_symbol',492 -1493 ]494 ],495 [496 [497 /$/g,498 null,499 -2500 ],501 [502 /"/g,503 'sh_string',504 -2505 ]506 ],507 [508 [509 /$/g,510 null,511 -2512 ],513 [514 /\{[A-Za-z_][A-Za-z0-9_-]*\}/g,515 'sh_type',516 -1517 ],518 [519 /"/g,520 'sh_string',521 13522 ],523 [524 /~|!|%|\^|\*|\(|\)|-|\+|=|\[|\]|\\|:|;|,|\.|\/|\?|&|<|>|\|/g,525 'sh_symbol',526 -1527 ]528 ],529 [530 [531 /^%%/g,532 'sh_preproc',533 21,534 1535 ],536 [537 /<[A-Za-z_][A-Za-z0-9_-]*>/g,538 'sh_function',539 -1540 ],541 [542 /"/g,543 'sh_string',544 13545 ],546 [547 /\\./g,548 'sh_preproc',549 -1550 ],551 [552 /\{[A-Za-z_][A-Za-z0-9_-]*\}/g,553 'sh_type',554 -1555 ],556 [557 /\/\*/g,558 'sh_comment',559 22560 ],561 [562 /\{/g,563 'sh_cbracket',564 23,565 1566 ],567 [568 /~|!|%|\^|\*|\(|\)|-|\+|=|\[|\]|\\|:|;|,|\.|\/|\?|&|<|>|\|/g,569 'sh_symbol',570 -1571 ]572 ],573 [574 [575 /(\b(?:class|struct|typename))([ \t]+)([A-Za-z0-9_]+)/g,576 ['sh_keyword', 'sh_normal', 'sh_classname'],577 -1578 ],579 [580 /\b(?:class|const_cast|delete|dynamic_cast|explicit|false|friend|inline|mutable|namespace|new|operator|private|protected|public|reinterpret_cast|static_cast|template|this|throw|true|try|typeid|typename|using|virtual)\b/g,581 'sh_keyword',582 -1583 ],584 [585 /\/\/\//g,586 'sh_comment',587 2588 ],589 [590 /\/\//g,591 'sh_comment',592 8593 ],594 [595 /\/\*\*/g,596 'sh_comment',597 9598 ],599 [600 /\/\*/g,601 'sh_comment',602 10603 ],604 [605 /(\bstruct)([ \t]+)([A-Za-z0-9_]+)/g,606 ['sh_keyword', 'sh_normal', 'sh_classname'],607 -1608 ],609 [610 /^[ \t]*#(?:[ \t]*include)/g,611 'sh_preproc',612 11,613 1614 ],615 [616 /^[ \t]*#(?:[ \t]*[A-Za-z0-9_]*)/g,617 'sh_preproc',618 -1619 ],620 [621 /\b[+-]?(?:(?:0x[A-Fa-f0-9]+)|(?:(?:[\d]*\.)?[\d]+(?:[eE][+-]?[\d]+)?))u?(?:(?:int(?:8|16|32|64))|L)?\b/g,622 'sh_number',623 -1624 ],625 [626 /"/g,627 'sh_string',628 14629 ],630 [631 /'/g,632 'sh_string',633 15634 ],635 [636 /\b(?:__asm|__cdecl|__declspec|__export|__far16|__fastcall|__fortran|__import|__pascal|__rtti|__stdcall|_asm|_cdecl|__except|_export|_far16|_fastcall|__finally|_fortran|_import|_pascal|_stdcall|__thread|__try|asm|auto|break|case|catch|cdecl|const|continue|default|do|else|enum|extern|for|goto|if|pascal|register|return|sizeof|static|struct|switch|typedef|union|volatile|while)\b/g,637 'sh_keyword',638 -1639 ],640 [641 /\b(?:bool|char|double|float|int|long|short|signed|unsigned|void|wchar_t)\b/g,642 'sh_type',643 -1644 ],645 [646 /~|!|%|\^|\*|\(|\)|-|\+|=|\[|\]|\\|:|;|,|\.|\/|\?|&|<|>|\|/g,647 'sh_symbol',648 -1649 ],650 [651 /\{|\}/g,652 'sh_cbracket',653 -1654 ],655 [656 /(?:[A-Za-z]|_)[A-Za-z0-9_]*(?=[ \t]*\()/g,657 'sh_function',658 -1659 ],660 [661 /([A-Za-z](?:[^`~!@#$%&*()_=+{}|;:",<.>\/?'\\[\]\^\-\s]|[_])*)((?:<.*>)?)(\s+(?=[*&]*[A-Za-z][^`~!@#$%&*()_=+{}|;:",<.>\/?'\\[\]\^\-\s]*\s*[`~!@#$%&*()_=+{}|;:",<.>\/?'\\[\]\^\-\[\]]+))/g,662 ['sh_usertype', 'sh_usertype', 'sh_normal'],663 -1664 ]665 ],666 [667 [668 /\*\//g,669 'sh_comment',670 -2671 ],672 [673 /\/\*/g,674 'sh_comment',675 22676 ]677 ],678 [679 [680 /\}/g,681 'sh_cbracket',682 -2683 ],684 [685 /\{/g,686 'sh_cbracket',687 23,688 1689 ],690 [691 /\$./g,692 'sh_variable',693 -1694 ],695 [696 /(\b(?:class|struct|typename))([ \t]+)([A-Za-z0-9_]+)/g,697 ['sh_keyword', 'sh_normal', 'sh_classname'],698 -1699 ],700 [701 /\b(?:class|const_cast|delete|dynamic_cast|explicit|false|friend|inline|mutable|namespace|new|operator|private|protected|public|reinterpret_cast|static_cast|template|this|throw|true|try|typeid|typename|using|virtual)\b/g,702 'sh_keyword',703 -1704 ],705 [706 /\/\/\//g,707 'sh_comment',708 2709 ],710 [711 /\/\//g,712 'sh_comment',713 8714 ],715 [716 /\/\*\*/g,717 'sh_comment',718 9719 ],720 [721 /\/\*/g,722 'sh_comment',723 10724 ],725 [726 /(\bstruct)([ \t]+)([A-Za-z0-9_]+)/g,727 ['sh_keyword', 'sh_normal', 'sh_classname'],728 -1729 ],730 [731 /^[ \t]*#(?:[ \t]*include)/g,732 'sh_preproc',733 11,734 1735 ],736 [737 /^[ \t]*#(?:[ \t]*[A-Za-z0-9_]*)/g,738 'sh_preproc',739 -1740 ],741 [742 /\b[+-]?(?:(?:0x[A-Fa-f0-9]+)|(?:(?:[\d]*\.)?[\d]+(?:[eE][+-]?[\d]+)?))u?(?:(?:int(?:8|16|32|64))|L)?\b/g,743 'sh_number',744 -1745 ],746 [747 /"/g,748 'sh_string',749 14750 ],751 [752 /'/g,753 'sh_string',754 15755 ],756 [757 /\b(?:__asm|__cdecl|__declspec|__export|__far16|__fastcall|__fortran|__import|__pascal|__rtti|__stdcall|_asm|_cdecl|__except|_export|_far16|_fastcall|__finally|_fortran|_import|_pascal|_stdcall|__thread|__try|asm|auto|break|case|catch|cdecl|const|continue|default|do|else|enum|extern|for|goto|if|pascal|register|return|sizeof|static|struct|switch|typedef|union|volatile|while)\b/g,758 'sh_keyword',759 -1760 ],761 [762 /\b(?:bool|char|double|float|int|long|short|signed|unsigned|void|wchar_t)\b/g,763 'sh_type',764 -1765 ],766 [767 /~|!|%|\^|\*|\(|\)|-|\+|=|\[|\]|\\|:|;|,|\.|\/|\?|&|<|>|\|/g,768 'sh_symbol',769 -1770 ],771 [772 /\{|\}/g,773 'sh_cbracket',774 -1775 ],776 [777 /(?:[A-Za-z]|_)[A-Za-z0-9_]*(?=[ \t]*\()/g,778 'sh_function',779 -1780 ],781 [782 /([A-Za-z](?:[^`~!@#$%&*()_=+{}|;:",<.>\/?'\\[\]\^\-\s]|[_])*)((?:<.*>)?)(\s+(?=[*&]*[A-Za-z][^`~!@#$%&*()_=+{}|;:",<.>\/?'\\[\]\^\-\s]*\s*[`~!@#$%&*()_=+{}|;:",<.>\/?'\\[\]\^\-\[\]]+))/g,783 ['sh_usertype', 'sh_usertype', 'sh_normal'],784 -1785 ]786 ]...

Full Screen

Full Screen

sh_flex.js

Source:sh_flex.js Github

copy

Full Screen

1if (! this.sh_languages) {2 this.sh_languages = {};3}4sh_languages['flex'] = [5 [6 [7 /^%\{/g,8 'sh_preproc',9 1,10 111 ],12 [13 /^%[sx]/g,14 'sh_preproc',15 16,16 117 ],18 [19 /^%option/g,20 'sh_preproc',21 17,22 123 ],24 [25 /^%(?:array|pointer|[aceknopr])/g,26 'sh_preproc',27 -128 ],29 [30 /[A-Za-z_][A-Za-z0-9_-]*/g,31 'sh_preproc',32 19,33 134 ],35 [36 /^%%/g,37 'sh_preproc',38 20,39 140 ]41 ],42 [43 [44 /^%\}/g,45 'sh_preproc',46 -247 ],48 [49 /(\b(?:class|struct|typename))([ \t]+)([A-Za-z0-9_]+)/g,50 ['sh_keyword', 'sh_normal', 'sh_classname'],51 -152 ],53 [54 /\b(?:class|const_cast|delete|dynamic_cast|explicit|false|friend|inline|mutable|namespace|new|operator|private|protected|public|reinterpret_cast|static_cast|template|this|throw|true|try|typeid|typename|using|virtual)\b/g,55 'sh_keyword',56 -157 ],58 [59 /\/\/\//g,60 'sh_comment',61 262 ],63 [64 /\/\//g,65 'sh_comment',66 867 ],68 [69 /\/\*\*/g,70 'sh_comment',71 972 ],73 [74 /\/\*/g,75 'sh_comment',76 1077 ],78 [79 /(\bstruct)([ \t]+)([A-Za-z0-9_]+)/g,80 ['sh_keyword', 'sh_normal', 'sh_classname'],81 -182 ],83 [84 /^[ \t]*#(?:[ \t]*include)/g,85 'sh_preproc',86 11,87 188 ],89 [90 /^[ \t]*#(?:[ \t]*[A-Za-z0-9_]*)/g,91 'sh_preproc',92 -193 ],94 [95 /\b[+-]?(?:(?:0x[A-Fa-f0-9]+)|(?:(?:[\d]*\.)?[\d]+(?:[eE][+-]?[\d]+)?))u?(?:(?:int(?:8|16|32|64))|L)?\b/g,96 'sh_number',97 -198 ],99 [100 /"/g,101 'sh_string',102 14103 ],104 [105 /'/g,106 'sh_string',107 15108 ],109 [110 /\b(?:__asm|__cdecl|__declspec|__export|__far16|__fastcall|__fortran|__import|__pascal|__rtti|__stdcall|_asm|_cdecl|__except|_export|_far16|_fastcall|__finally|_fortran|_import|_pascal|_stdcall|__thread|__try|asm|auto|break|case|catch|cdecl|const|continue|default|do|else|enum|extern|for|goto|if|pascal|register|return|sizeof|static|struct|switch|typedef|union|volatile|while)\b/g,111 'sh_keyword',112 -1113 ],114 [115 /\b(?:bool|char|double|float|int|long|short|signed|unsigned|void|wchar_t)\b/g,116 'sh_type',117 -1118 ],119 [120 /~|!|%|\^|\*|\(|\)|-|\+|=|\[|\]|\\|:|;|,|\.|\/|\?|&|<|>|\|/g,121 'sh_symbol',122 -1123 ],124 [125 /\{|\}/g,126 'sh_cbracket',127 -1128 ],129 [130 /(?:[A-Za-z]|_)[A-Za-z0-9_]*(?=[ \t]*\()/g,131 'sh_function',132 -1133 ],134 [135 /([A-Za-z](?:[^`~!@#$%&*()_=+{}|;:",<.>\/?'\\[\]\^\-\s]|[_])*)((?:<.*>)?)(\s+(?=[*&]*[A-Za-z][^`~!@#$%&*()_=+{}|;:",<.>\/?'\\[\]\^\-\s]*\s*[`~!@#$%&*()_=+{}|;:",<.>\/?'\\[\]\^\-\[\]]+))/g,136 ['sh_usertype', 'sh_usertype', 'sh_normal'],137 -1138 ]139 ],140 [141 [142 /$/g,143 null,144 -2145 ],146 [147 /(?:<?)[A-Za-z0-9_\.\/\-_~]+@[A-Za-z0-9_\.\/\-_~]+(?:>?)|(?:<?)[A-Za-z0-9_]+:\/\/[A-Za-z0-9_\.\/\-_~]+(?:>?)/g,148 'sh_url',149 -1150 ],151 [152 /<\?xml/g,153 'sh_preproc',154 3,155 1156 ],157 [158 /<!DOCTYPE/g,159 'sh_preproc',160 5,161 1162 ],163 [164 /<!--/g,165 'sh_comment',166 6167 ],168 [169 /<(?:\/)?[A-Za-z](?:[A-Za-z0-9_:.-]*)(?:\/)?>/g,170 'sh_keyword',171 -1172 ],173 [174 /<(?:\/)?[A-Za-z](?:[A-Za-z0-9_:.-]*)/g,175 'sh_keyword',176 7,177 1178 ],179 [180 /&(?:[A-Za-z0-9]+);/g,181 'sh_preproc',182 -1183 ],184 [185 /<(?:\/)?[A-Za-z][A-Za-z0-9]*(?:\/)?>/g,186 'sh_keyword',187 -1188 ],189 [190 /<(?:\/)?[A-Za-z][A-Za-z0-9]*/g,191 'sh_keyword',192 7,193 1194 ],195 [196 /@[A-Za-z]+/g,197 'sh_type',198 -1199 ],200 [201 /(?:TODO|FIXME|BUG)(?:[:]?)/g,202 'sh_todo',203 -1204 ]205 ],206 [207 [208 /\?>/g,209 'sh_preproc',210 -2211 ],212 [213 /([^=" \t>]+)([ \t]*)(=?)/g,214 ['sh_type', 'sh_normal', 'sh_symbol'],215 -1216 ],217 [218 /"/g,219 'sh_string',220 4221 ]222 ],223 [224 [225 /\\(?:\\|")/g,226 null,227 -1228 ],229 [230 /"/g,231 'sh_string',232 -2233 ]234 ],235 [236 [237 />/g,238 'sh_preproc',239 -2240 ],241 [242 /([^=" \t>]+)([ \t]*)(=?)/g,243 ['sh_type', 'sh_normal', 'sh_symbol'],244 -1245 ],246 [247 /"/g,248 'sh_string',249 4250 ]251 ],252 [253 [254 /-->/g,255 'sh_comment',256 -2257 ],258 [259 /<!--/g,260 'sh_comment',261 6262 ]263 ],264 [265 [266 /(?:\/)?>/g,267 'sh_keyword',268 -2269 ],270 [271 /([^=" \t>]+)([ \t]*)(=?)/g,272 ['sh_type', 'sh_normal', 'sh_symbol'],273 -1274 ],275 [276 /"/g,277 'sh_string',278 4279 ]280 ],281 [282 [283 /$/g,284 null,285 -2286 ]287 ],288 [289 [290 /\*\//g,291 'sh_comment',292 -2293 ],294 [295 /(?:<?)[A-Za-z0-9_\.\/\-_~]+@[A-Za-z0-9_\.\/\-_~]+(?:>?)|(?:<?)[A-Za-z0-9_]+:\/\/[A-Za-z0-9_\.\/\-_~]+(?:>?)/g,296 'sh_url',297 -1298 ],299 [300 /<\?xml/g,301 'sh_preproc',302 3,303 1304 ],305 [306 /<!DOCTYPE/g,307 'sh_preproc',308 5,309 1310 ],311 [312 /<!--/g,313 'sh_comment',314 6315 ],316 [317 /<(?:\/)?[A-Za-z](?:[A-Za-z0-9_:.-]*)(?:\/)?>/g,318 'sh_keyword',319 -1320 ],321 [322 /<(?:\/)?[A-Za-z](?:[A-Za-z0-9_:.-]*)/g,323 'sh_keyword',324 7,325 1326 ],327 [328 /&(?:[A-Za-z0-9]+);/g,329 'sh_preproc',330 -1331 ],332 [333 /<(?:\/)?[A-Za-z][A-Za-z0-9]*(?:\/)?>/g,334 'sh_keyword',335 -1336 ],337 [338 /<(?:\/)?[A-Za-z][A-Za-z0-9]*/g,339 'sh_keyword',340 7,341 1342 ],343 [344 /@[A-Za-z]+/g,345 'sh_type',346 -1347 ],348 [349 /(?:TODO|FIXME|BUG)(?:[:]?)/g,350 'sh_todo',351 -1352 ]353 ],354 [355 [356 /\*\//g,357 'sh_comment',358 -2359 ],360 [361 /(?:<?)[A-Za-z0-9_\.\/\-_~]+@[A-Za-z0-9_\.\/\-_~]+(?:>?)|(?:<?)[A-Za-z0-9_]+:\/\/[A-Za-z0-9_\.\/\-_~]+(?:>?)/g,362 'sh_url',363 -1364 ],365 [366 /(?:TODO|FIXME|BUG)(?:[:]?)/g,367 'sh_todo',368 -1369 ]370 ],371 [372 [373 /$/g,374 null,375 -2376 ],377 [378 /</g,379 'sh_string',380 12381 ],382 [383 /"/g,384 'sh_string',385 13386 ],387 [388 /\/\/\//g,389 'sh_comment',390 2391 ],392 [393 /\/\//g,394 'sh_comment',395 8396 ],397 [398 /\/\*\*/g,399 'sh_comment',400 9401 ],402 [403 /\/\*/g,404 'sh_comment',405 10406 ]407 ],408 [409 [410 /$/g,411 null,412 -2413 ],414 [415 />/g,416 'sh_string',417 -2418 ]419 ],420 [421 [422 /$/g,423 null,424 -2425 ],426 [427 /\\(?:\\|")/g,428 null,429 -1430 ],431 [432 /"/g,433 'sh_string',434 -2435 ]436 ],437 [438 [439 /"/g,440 'sh_string',441 -2442 ],443 [444 /\\./g,445 'sh_specialchar',446 -1447 ]448 ],449 [450 [451 /'/g,452 'sh_string',453 -2454 ],455 [456 /\\./g,457 'sh_specialchar',458 -1459 ]460 ],461 [462 [463 /$/g,464 null,465 -2466 ],467 [468 /[A-Za-z_][A-Za-z0-9_-]*/g,469 'sh_function',470 -1471 ]472 ],473 [474 [475 /$/g,476 null,477 -2478 ],479 [480 /[A-Za-z_][A-Za-z0-9_-]*/g,481 'sh_keyword',482 -1483 ],484 [485 /"/g,486 'sh_string',487 18488 ],489 [490 /=/g,491 'sh_symbol',492 -1493 ]494 ],495 [496 [497 /$/g,498 null,499 -2500 ],501 [502 /"/g,503 'sh_string',504 -2505 ]506 ],507 [508 [509 /$/g,510 null,511 -2512 ],513 [514 /\{[A-Za-z_][A-Za-z0-9_-]*\}/g,515 'sh_type',516 -1517 ],518 [519 /"/g,520 'sh_string',521 13522 ],523 [524 /~|!|%|\^|\*|\(|\)|-|\+|=|\[|\]|\\|:|;|,|\.|\/|\?|&|<|>|\|/g,525 'sh_symbol',526 -1527 ]528 ],529 [530 [531 /^%%/g,532 'sh_preproc',533 21,534 1535 ],536 [537 /<[A-Za-z_][A-Za-z0-9_-]*>/g,538 'sh_function',539 -1540 ],541 [542 /"/g,543 'sh_string',544 13545 ],546 [547 /\\./g,548 'sh_preproc',549 -1550 ],551 [552 /\{[A-Za-z_][A-Za-z0-9_-]*\}/g,553 'sh_type',554 -1555 ],556 [557 /\/\*/g,558 'sh_comment',559 22560 ],561 [562 /\{/g,563 'sh_cbracket',564 23,565 1566 ],567 [568 /~|!|%|\^|\*|\(|\)|-|\+|=|\[|\]|\\|:|;|,|\.|\/|\?|&|<|>|\|/g,569 'sh_symbol',570 -1571 ]572 ],573 [574 [575 /(\b(?:class|struct|typename))([ \t]+)([A-Za-z0-9_]+)/g,576 ['sh_keyword', 'sh_normal', 'sh_classname'],577 -1578 ],579 [580 /\b(?:class|const_cast|delete|dynamic_cast|explicit|false|friend|inline|mutable|namespace|new|operator|private|protected|public|reinterpret_cast|static_cast|template|this|throw|true|try|typeid|typename|using|virtual)\b/g,581 'sh_keyword',582 -1583 ],584 [585 /\/\/\//g,586 'sh_comment',587 2588 ],589 [590 /\/\//g,591 'sh_comment',592 8593 ],594 [595 /\/\*\*/g,596 'sh_comment',597 9598 ],599 [600 /\/\*/g,601 'sh_comment',602 10603 ],604 [605 /(\bstruct)([ \t]+)([A-Za-z0-9_]+)/g,606 ['sh_keyword', 'sh_normal', 'sh_classname'],607 -1608 ],609 [610 /^[ \t]*#(?:[ \t]*include)/g,611 'sh_preproc',612 11,613 1614 ],615 [616 /^[ \t]*#(?:[ \t]*[A-Za-z0-9_]*)/g,617 'sh_preproc',618 -1619 ],620 [621 /\b[+-]?(?:(?:0x[A-Fa-f0-9]+)|(?:(?:[\d]*\.)?[\d]+(?:[eE][+-]?[\d]+)?))u?(?:(?:int(?:8|16|32|64))|L)?\b/g,622 'sh_number',623 -1624 ],625 [626 /"/g,627 'sh_string',628 14629 ],630 [631 /'/g,632 'sh_string',633 15634 ],635 [636 /\b(?:__asm|__cdecl|__declspec|__export|__far16|__fastcall|__fortran|__import|__pascal|__rtti|__stdcall|_asm|_cdecl|__except|_export|_far16|_fastcall|__finally|_fortran|_import|_pascal|_stdcall|__thread|__try|asm|auto|break|case|catch|cdecl|const|continue|default|do|else|enum|extern|for|goto|if|pascal|register|return|sizeof|static|struct|switch|typedef|union|volatile|while)\b/g,637 'sh_keyword',638 -1639 ],640 [641 /\b(?:bool|char|double|float|int|long|short|signed|unsigned|void|wchar_t)\b/g,642 'sh_type',643 -1644 ],645 [646 /~|!|%|\^|\*|\(|\)|-|\+|=|\[|\]|\\|:|;|,|\.|\/|\?|&|<|>|\|/g,647 'sh_symbol',648 -1649 ],650 [651 /\{|\}/g,652 'sh_cbracket',653 -1654 ],655 [656 /(?:[A-Za-z]|_)[A-Za-z0-9_]*(?=[ \t]*\()/g,657 'sh_function',658 -1659 ],660 [661 /([A-Za-z](?:[^`~!@#$%&*()_=+{}|;:",<.>\/?'\\[\]\^\-\s]|[_])*)((?:<.*>)?)(\s+(?=[*&]*[A-Za-z][^`~!@#$%&*()_=+{}|;:",<.>\/?'\\[\]\^\-\s]*\s*[`~!@#$%&*()_=+{}|;:",<.>\/?'\\[\]\^\-\[\]]+))/g,662 ['sh_usertype', 'sh_usertype', 'sh_normal'],663 -1664 ]665 ],666 [667 [668 /\*\//g,669 'sh_comment',670 -2671 ],672 [673 /\/\*/g,674 'sh_comment',675 22676 ]677 ],678 [679 [680 /\}/g,681 'sh_cbracket',682 -2683 ],684 [685 /\{/g,686 'sh_cbracket',687 23,688 1689 ],690 [691 /\$./g,692 'sh_variable',693 -1694 ],695 [696 /(\b(?:class|struct|typename))([ \t]+)([A-Za-z0-9_]+)/g,697 ['sh_keyword', 'sh_normal', 'sh_classname'],698 -1699 ],700 [701 /\b(?:class|const_cast|delete|dynamic_cast|explicit|false|friend|inline|mutable|namespace|new|operator|private|protected|public|reinterpret_cast|static_cast|template|this|throw|true|try|typeid|typename|using|virtual)\b/g,702 'sh_keyword',703 -1704 ],705 [706 /\/\/\//g,707 'sh_comment',708 2709 ],710 [711 /\/\//g,712 'sh_comment',713 8714 ],715 [716 /\/\*\*/g,717 'sh_comment',718 9719 ],720 [721 /\/\*/g,722 'sh_comment',723 10724 ],725 [726 /(\bstruct)([ \t]+)([A-Za-z0-9_]+)/g,727 ['sh_keyword', 'sh_normal', 'sh_classname'],728 -1729 ],730 [731 /^[ \t]*#(?:[ \t]*include)/g,732 'sh_preproc',733 11,734 1735 ],736 [737 /^[ \t]*#(?:[ \t]*[A-Za-z0-9_]*)/g,738 'sh_preproc',739 -1740 ],741 [742 /\b[+-]?(?:(?:0x[A-Fa-f0-9]+)|(?:(?:[\d]*\.)?[\d]+(?:[eE][+-]?[\d]+)?))u?(?:(?:int(?:8|16|32|64))|L)?\b/g,743 'sh_number',744 -1745 ],746 [747 /"/g,748 'sh_string',749 14750 ],751 [752 /'/g,753 'sh_string',754 15755 ],756 [757 /\b(?:__asm|__cdecl|__declspec|__export|__far16|__fastcall|__fortran|__import|__pascal|__rtti|__stdcall|_asm|_cdecl|__except|_export|_far16|_fastcall|__finally|_fortran|_import|_pascal|_stdcall|__thread|__try|asm|auto|break|case|catch|cdecl|const|continue|default|do|else|enum|extern|for|goto|if|pascal|register|return|sizeof|static|struct|switch|typedef|union|volatile|while)\b/g,758 'sh_keyword',759 -1760 ],761 [762 /\b(?:bool|char|double|float|int|long|short|signed|unsigned|void|wchar_t)\b/g,763 'sh_type',764 -1765 ],766 [767 /~|!|%|\^|\*|\(|\)|-|\+|=|\[|\]|\\|:|;|,|\.|\/|\?|&|<|>|\|/g,768 'sh_symbol',769 -1770 ],771 [772 /\{|\}/g,773 'sh_cbracket',774 -1775 ],776 [777 /(?:[A-Za-z]|_)[A-Za-z0-9_]*(?=[ \t]*\()/g,778 'sh_function',779 -1780 ],781 [782 /([A-Za-z](?:[^`~!@#$%&*()_=+{}|;:",<.>\/?'\\[\]\^\-\s]|[_])*)((?:<.*>)?)(\s+(?=[*&]*[A-Za-z][^`~!@#$%&*()_=+{}|;:",<.>\/?'\\[\]\^\-\s]*\s*[`~!@#$%&*()_=+{}|;:",<.>\/?'\\[\]\^\-\[\]]+))/g,783 ['sh_usertype', 'sh_usertype', 'sh_normal'],784 -1785 ]786 ]...

Full Screen

Full Screen

relocate_sdk.py

Source:relocate_sdk.py Github

copy

Full Screen

1#!/usr/bin/env python32#3# Copyright (c) 2012 Intel Corporation4#5# This program is free software; you can redistribute it and/or modify6# it under the terms of the GNU General Public License version 2 as7# published by the Free Software Foundation.8#9# This program is distributed in the hope that it will be useful,10# but WITHOUT ANY WARRANTY; without even the implied warranty of11# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.12# See the GNU General Public License for more details.13#14# You should have received a copy of the GNU General Public License15# along with this program; if not, write to the Free Software16# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA17#18# DESCRIPTION19# This script is called by the SDK installer script. It replaces the dynamic20# loader path in all binaries and also fixes the SYSDIR paths/lengths and the21# location of ld.so.cache in the dynamic loader binary22#23# AUTHORS24# Laurentiu Palcu <laurentiu.palcu@intel.com>25#26import struct27import sys28import stat29import os30import re31import errno32if sys.version < '3':33 def b(x):34 return x35else:36 def b(x):37 return x.encode(sys.getfilesystemencoding())38old_prefix = re.compile(b("##DEFAULT_INSTALL_DIR##"))39def get_arch():40 f.seek(0)41 e_ident =f.read(16)42 ei_mag0,ei_mag1_3,ei_class = struct.unpack("<B3sB11x", e_ident)43 if (ei_mag0 != 0x7f and ei_mag1_3 != "ELF") or ei_class == 0:44 return 045 if ei_class == 1:46 return 3247 elif ei_class == 2:48 return 6449def parse_elf_header():50 global e_type, e_machine, e_version, e_entry, e_phoff, e_shoff, e_flags,\51 e_ehsize, e_phentsize, e_phnum, e_shentsize, e_shnum, e_shstrndx52 f.seek(0)53 elf_header = f.read(64)54 if arch == 32:55 # 32bit56 hdr_fmt = "<HHILLLIHHHHHH"57 hdr_size = 5258 else:59 # 64bit60 hdr_fmt = "<HHIQQQIHHHHHH"61 hdr_size = 6462 e_type, e_machine, e_version, e_entry, e_phoff, e_shoff, e_flags,\63 e_ehsize, e_phentsize, e_phnum, e_shentsize, e_shnum, e_shstrndx =\64 struct.unpack(hdr_fmt, elf_header[16:hdr_size])65def change_interpreter(elf_file_name):66 if arch == 32:67 ph_fmt = "<IIIIIIII"68 else:69 ph_fmt = "<IIQQQQQQ"70 """ look for PT_INTERP section """71 for i in range(0,e_phnum):72 f.seek(e_phoff + i * e_phentsize)73 ph_hdr = f.read(e_phentsize)74 if arch == 32:75 # 32bit76 p_type, p_offset, p_vaddr, p_paddr, p_filesz,\77 p_memsz, p_flags, p_align = struct.unpack(ph_fmt, ph_hdr)78 else:79 # 64bit80 p_type, p_flags, p_offset, p_vaddr, p_paddr, \81 p_filesz, p_memsz, p_align = struct.unpack(ph_fmt, ph_hdr)82 """ change interpreter """83 if p_type == 3:84 # PT_INTERP section85 f.seek(p_offset)86 # External SDKs with mixed pre-compiled binaries should not get87 # relocated so look for some variant of /lib88 fname = f.read(11)89 if fname.startswith(b("/lib/")) or fname.startswith(b("/lib64/")) or \90 fname.startswith(b("/lib32/")) or fname.startswith(b("/usr/lib32/")) or \91 fname.startswith(b("/usr/lib32/")) or fname.startswith(b("/usr/lib64/")):92 break93 if p_filesz == 0:94 break95 if (len(new_dl_path) >= p_filesz):96 print("ERROR: could not relocate %s, interp size = %i and %i is needed." \97 % (elf_file_name, p_memsz, len(new_dl_path) + 1))98 break99 dl_path = new_dl_path + b("\0") * (p_filesz - len(new_dl_path))100 f.seek(p_offset)101 f.write(dl_path)102 break103def change_dl_sysdirs(elf_file_name):104 if arch == 32:105 sh_fmt = "<IIIIIIIIII"106 else:107 sh_fmt = "<IIQQQQIIQQ"108 """ read section string table """109 f.seek(e_shoff + e_shstrndx * e_shentsize)110 sh_hdr = f.read(e_shentsize)111 if arch == 32:112 sh_offset, sh_size = struct.unpack("<16xII16x", sh_hdr)113 else:114 sh_offset, sh_size = struct.unpack("<24xQQ24x", sh_hdr)115 f.seek(sh_offset)116 sh_strtab = f.read(sh_size)117 sysdirs = sysdirs_len = ""118 """ change ld.so.cache path and default libs path for dynamic loader """119 for i in range(0,e_shnum):120 f.seek(e_shoff + i * e_shentsize)121 sh_hdr = f.read(e_shentsize)122 sh_name, sh_type, sh_flags, sh_addr, sh_offset, sh_size, sh_link,\123 sh_info, sh_addralign, sh_entsize = struct.unpack(sh_fmt, sh_hdr)124 name = sh_strtab[sh_name:sh_strtab.find(b("\0"), sh_name)]125 """ look only into SHT_PROGBITS sections """126 if sh_type == 1:127 f.seek(sh_offset)128 """ default library paths cannot be changed on the fly because """129 """ the string lengths have to be changed too. """130 if name == b(".sysdirs"):131 sysdirs = f.read(sh_size)132 sysdirs_off = sh_offset133 sysdirs_sect_size = sh_size134 elif name == b(".sysdirslen"):135 sysdirslen = f.read(sh_size)136 sysdirslen_off = sh_offset137 elif name == b(".ldsocache"):138 ldsocache_path = f.read(sh_size)139 new_ldsocache_path = old_prefix.sub(new_prefix, ldsocache_path)140 new_ldsocache_path = new_ldsocache_path.rstrip(b("\0"))141 if (len(new_ldsocache_path) >= sh_size):142 print("ERROR: could not relocate %s, .ldsocache section size = %i and %i is needed." \143 % (elf_file_name, sh_size, len(new_ldsocache_path)))144 sys.exit(-1)145 # pad with zeros146 new_ldsocache_path += b("\0") * (sh_size - len(new_ldsocache_path))147 # write it back148 f.seek(sh_offset)149 f.write(new_ldsocache_path)150 elif name == b(".gccrelocprefix"):151 offset = 0152 while (offset + 4096) <= sh_size:153 path = f.read(4096)154 new_path = old_prefix.sub(new_prefix, path)155 new_path = new_path.rstrip(b("\0"))156 if (len(new_path) >= 4096):157 print("ERROR: could not relocate %s, max path size = 4096 and %i is needed." \158 % (elf_file_name, len(new_path)))159 sys.exit(-1)160 # pad with zeros161 new_path += b("\0") * (4096 - len(new_path))162 #print "Changing %s to %s at %s" % (str(path), str(new_path), str(offset))163 # write it back164 f.seek(sh_offset + offset)165 f.write(new_path)166 offset = offset + 4096167 if sysdirs != "" and sysdirslen != "":168 paths = sysdirs.split(b("\0"))169 sysdirs = b("")170 sysdirslen = b("")171 for path in paths:172 """ exit the loop when we encounter first empty string """173 if path == b(""):174 break175 new_path = old_prefix.sub(new_prefix, path)176 sysdirs += new_path + b("\0")177 if arch == 32:178 sysdirslen += struct.pack("<L", len(new_path))179 else:180 sysdirslen += struct.pack("<Q", len(new_path))181 """ pad with zeros """182 sysdirs += b("\0") * (sysdirs_sect_size - len(sysdirs))183 """ write the sections back """184 f.seek(sysdirs_off)185 f.write(sysdirs)186 f.seek(sysdirslen_off)187 f.write(sysdirslen)188# MAIN189if len(sys.argv) < 4:190 sys.exit(-1)191# In python > 3, strings may also contain Unicode characters. So, convert192# them to bytes193if sys.version_info < (3,):194 new_prefix = sys.argv[1]195 new_dl_path = sys.argv[2]196else:197 new_prefix = sys.argv[1].encode()198 new_dl_path = sys.argv[2].encode()199executables_list = sys.argv[3:]200for e in executables_list:201 perms = os.stat(e)[stat.ST_MODE]202 if os.access(e, os.W_OK|os.R_OK):203 perms = None204 else:205 os.chmod(e, perms|stat.S_IRWXU)206 try:207 f = open(e, "r+b")208 except IOError:209 exctype, ioex = sys.exc_info()[:2]210 if ioex.errno == errno.ETXTBSY:211 print("Could not open %s. File used by another process.\nPlease "\212 "make sure you exit all processes that might use any SDK "\213 "binaries." % e)214 else:215 print("Could not open %s: %s(%d)" % (e, ioex.strerror, ioex.errno))216 sys.exit(-1)217 # Save old size and do a size check at the end. Just a safety measure.218 old_size = os.path.getsize(e)219 if old_size >= 64:220 arch = get_arch()221 if arch:222 parse_elf_header()223 change_interpreter(e)224 change_dl_sysdirs(e)225 """ change permissions back """226 if perms:227 os.chmod(e, perms)228 f.close()229 if old_size != os.path.getsize(e):230 print("New file size for %s is different. Looks like a relocation error!", e)...

Full Screen

Full Screen

elf-dump

Source:elf-dump Github

copy

Full Screen

1#!/usr/bin/env python2import struct3import sys4import StringIO5import common_dump6class Reader:7 def __init__(self, path):8 if path == "-":9 # Snarf all the data so we can seek.10 self.file = StringIO.StringIO(sys.stdin.read())11 else:12 self.file = open(path, "rb")13 self.isLSB = None14 self.is64Bit = None15 def seek(self, pos):16 self.file.seek(pos)17 def read(self, N):18 data = self.file.read(N)19 if len(data) != N:20 raise ValueError, "Out of data!"21 return data22 def read8(self):23 return (ord(self.read(1)), 8)24 def read16(self):25 return (struct.unpack('><'[self.isLSB] + 'H', self.read(2))[0], 16)26 def read32(self):27 return (struct.unpack('><'[self.isLSB] + 'I', self.read(4))[0], 32)28 def read64(self):29 return (struct.unpack('><'[self.isLSB] + 'Q', self.read(8))[0], 64)30 def readWord(self):31 if self.is64Bit:32 return self.read64()33 else:34 return self.read32()35class StringTable:36 def __init__(self, strings):37 self.string_table = strings38 def __getitem__(self, index):39 end = self.string_table.index('\x00', index)40 return self.string_table[index:end]41class Section:42 def __init__(self, f):43 self.sh_name = f.read32()44 self.sh_type = f.read32()45 self.sh_flags = f.readWord()46 self.sh_addr = f.readWord()47 self.sh_offset = f.readWord()48 self.sh_size = f.readWord()49 self.sh_link = f.read32()50 self.sh_info = f.read32()51 self.sh_addralign = f.readWord()52 self.sh_entsize = f.readWord()53 def dump(self, shstrtab, f, strtab, dumpdata):54 print " (('sh_name', %s)" % common_dump.HexDump(self.sh_name), "# %r" % shstrtab[self.sh_name[0]]55 print " ('sh_type', %s)" % common_dump.HexDump(self.sh_type)56 print " ('sh_flags', %s)" % common_dump.HexDump(self.sh_flags)57 print " ('sh_addr', %s)" % common_dump.HexDump(self.sh_addr)58 print " ('sh_offset', %s)" % common_dump.HexDump(self.sh_offset)59 print " ('sh_size', %s)" % common_dump.HexDump(self.sh_size)60 print " ('sh_link', %s)" % common_dump.HexDump(self.sh_link)61 print " ('sh_info', %s)" % common_dump.HexDump(self.sh_info)62 print " ('sh_addralign', %s)" % common_dump.HexDump(self.sh_addralign)63 print " ('sh_entsize', %s)" % common_dump.HexDump(self.sh_entsize)64 if self.sh_type[0] == 2: # SHT_SYMTAB65 print " ('_symbols', ["66 dumpSymtab(f, self, strtab)67 print " ])"68 elif self.sh_type[0] == 4 or self.sh_type[0] == 9: # SHT_RELA / SHT_REL69 print " ('_relocations', ["70 dumpRel(f, self, self.sh_type[0] == 4)71 print " ])"72 elif dumpdata:73 f.seek(self.sh_offset[0])74 if self.sh_type != 8: # != SHT_NOBITS75 data = f.read(self.sh_size[0])76 print " ('_section_data', '%s')" % common_dump.dataToHex(data)77 else:78 print " ('_section_data', '')" 79 print " ),"80def dumpSymtab(f, section, strtab):81 entries = section.sh_size[0] // section.sh_entsize[0]82 for index in range(entries):83 f.seek(section.sh_offset[0] + index * section.sh_entsize[0])84 print " # Symbol %s" % index85 name = f.read32()86 print " (('st_name', %s)" % common_dump.HexDump(name), "# %r" % strtab[name[0]]87 if not f.is64Bit:88 print " ('st_value', %s)" % common_dump.HexDump(f.read32())89 print " ('st_size', %s)" % common_dump.HexDump(f.read32())90 st_info = f.read8()[0]91 st_bind = (st_info >> 4, 4)92 st_type = (st_info & 0xf, 4)93 print " ('st_bind', %s)" % common_dump.HexDump(st_bind)94 print " ('st_type', %s)" % common_dump.HexDump(st_type)95 print " ('st_other', %s)" % common_dump.HexDump(f.read8())96 print " ('st_shndx', %s)" % common_dump.HexDump(f.read16())97 if f.is64Bit:98 print " ('st_value', %s)" % common_dump.HexDump(f.read64())99 print " ('st_size', %s)" % common_dump.HexDump(f.read64())100 print " ),"101def dumpRel(f, section, dumprela = False):102 entries = section.sh_size[0] // section.sh_entsize[0]103 for index in range(entries):104 f.seek(section.sh_offset[0] + index * section.sh_entsize[0])105 print " # Relocation %s" % index106 print " (('r_offset', %s)" % common_dump.HexDump(f.readWord())107 r_info = f.readWord()[0]108 if f.is64Bit:109 r_sym = (r_info >> 32, 32)110 r_type = (r_info & 0xffffffff, 32)111 else:112 r_sym = (r_info >> 8, 24)113 r_type = (r_info & 0xff, 8)114 print " ('r_sym', %s)" % common_dump.HexDump(r_sym)115 print " ('r_type', %s)" % common_dump.HexDump(r_type)116 if dumprela:117 print " ('r_addend', %s)" % common_dump.HexDump(f.readWord())118 print " ),"119def dumpELF(path, opts):120 f = Reader(path)121 magic = f.read(4)122 assert magic == '\x7FELF'123 fileclass = f.read8()124 if fileclass[0] == 1: # ELFCLASS32125 f.is64Bit = False126 elif fileclass[0] == 2: # ELFCLASS64127 f.is64Bit = True128 else:129 raise ValueError, "Unknown file class %s" % common_dump.HexDump(fileclass)130 print "('e_indent[EI_CLASS]', %s)" % common_dump.HexDump(fileclass)131 byteordering = f.read8()132 if byteordering[0] == 1: # ELFDATA2LSB133 f.isLSB = True134 elif byteordering[0] == 2: # ELFDATA2MSB135 f.isLSB = False136 else:137 raise ValueError, "Unknown byte ordering %s" % common_dump.HexDump(byteordering)138 print "('e_indent[EI_DATA]', %s)" % common_dump.HexDump(byteordering)139 print "('e_indent[EI_VERSION]', %s)" % common_dump.HexDump(f.read8())140 print "('e_indent[EI_OSABI]', %s)" % common_dump.HexDump(f.read8())141 print "('e_indent[EI_ABIVERSION]', %s)" % common_dump.HexDump(f.read8())142 f.seek(16) # Seek to end of e_ident.143 print "('e_type', %s)" % common_dump.HexDump(f.read16())144 print "('e_machine', %s)" % common_dump.HexDump(f.read16())145 print "('e_version', %s)" % common_dump.HexDump(f.read32())146 print "('e_entry', %s)" % common_dump.HexDump(f.readWord())147 print "('e_phoff', %s)" % common_dump.HexDump(f.readWord())148 e_shoff = f.readWord()149 print "('e_shoff', %s)" % common_dump.HexDump(e_shoff)150 print "('e_flags', %s)" % common_dump.HexDump(f.read32())151 print "('e_ehsize', %s)" % common_dump.HexDump(f.read16())152 print "('e_phentsize', %s)" % common_dump.HexDump(f.read16())153 print "('e_phnum', %s)" % common_dump.HexDump(f.read16())154 e_shentsize = f.read16()155 print "('e_shentsize', %s)" % common_dump.HexDump(e_shentsize)156 e_shnum = f.read16()157 print "('e_shnum', %s)" % common_dump.HexDump(e_shnum)158 e_shstrndx = f.read16()159 print "('e_shstrndx', %s)" % common_dump.HexDump(e_shstrndx)160 # Read all section headers161 sections = []162 for index in range(e_shnum[0]):163 f.seek(e_shoff[0] + index * e_shentsize[0])164 s = Section(f)165 sections.append(s)166 # Read .shstrtab so we can resolve section names167 f.seek(sections[e_shstrndx[0]].sh_offset[0])168 shstrtab = StringTable(f.read(sections[e_shstrndx[0]].sh_size[0]))169 # Get the symbol string table170 strtab = None171 for section in sections:172 if shstrtab[section.sh_name[0]] == ".strtab":173 f.seek(section.sh_offset[0])174 strtab = StringTable(f.read(section.sh_size[0]))175 break176 print "('_sections', ["177 for index in range(e_shnum[0]):178 print " # Section %s" % index179 sections[index].dump(shstrtab, f, strtab, opts.dumpSectionData)180 print "])"181if __name__ == "__main__":182 from optparse import OptionParser, OptionGroup183 parser = OptionParser("usage: %prog [options] {files}")184 parser.add_option("", "--dump-section-data", dest="dumpSectionData",185 help="Dump the contents of sections",186 action="store_true", default=False)187 (opts, args) = parser.parse_args()188 if not args:189 args.append('-')190 for arg in args:...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1var sh = require('shorthash');2var short = sh.unique('Hello World');3console.log(short);4var sh = require('shorthash');5var short = sh.unique('Hello World');6console.log(short);7var sh = require('shorthash');8var short = sh.unique('Hello World');9console.log(short);10var sh = require('shorthash');11var short = sh.unique('Hello World');12console.log(short);13var sh = require('shorthash');14var short = sh.unique('Hello World');15console.log(short);16var sh = require('shorthash');17var short = sh.unique('Hello World');18console.log(short);19var sh = require('shorthash');20var short = sh.unique('Hello World');21console.log(short);22var sh = require('shorthash');23var short = sh.unique('Hello World');24console.log(short);25var sh = require('shorthash');26var short = sh.unique('Hello World');27console.log(short);28var sh = require('shorthash');29var short = sh.unique('Hello World');30console.log(short);31var sh = require('shorthash');32var short = sh.unique('Hello World');33console.log(short);34var sh = require('shorthash');35var short = sh.unique('Hello World');36console.log(short);37var sh = require('shorthash');38var short = sh.unique('Hello World');39console.log(short);40var sh = require('shorthash');41var short = sh.unique('Hello World

Full Screen

Using AI Code Generation

copy

Full Screen

1var sh = require('root/sh');2sh('ls -l');3sh('ls -l', function (code, output) {4 console.log('Exit code:', code);5 console.log('Program output:', output);6});7var sh = require('child_process').sh;8sh('ls -l');9sh('ls -l', function (code, output) {10 console.log('Exit code:', code);11 console.log('Program output:', output);12});13var sh = require('child_process').sh;14sh('ls -l');15sh('ls -l', function (code, output) {16 console.log('Exit code:', code);17 console.log('Program output:', output);18});19var sh = require('child_process').sh;20sh('ls -l');21sh('ls -l', function (code, output) {22 console.log('Exit code:', code);23 console.log('Program output:', output);24});25var sh = require('child_process').sh;26sh('ls -l');27sh('ls -l', function (code, output) {28 console.log('Exit code:', code);29 console.log('Program output:', output);30});31var sh = require('child_process').sh;32sh('ls -l');33sh('ls -l', function (code, output) {34 console.log('Exit code:', code);35 console.log('Program output:', output);36});37var sh = require('child_process').sh;38sh('ls -l');39sh('ls -l', function (code, output) {40 console.log('Exit code:', code);41 console.log('Program output:', output);42});43var sh = require('child_process').sh;44sh('ls -l');45sh('ls -l', function (code, output) {46 console.log('Exit code:', code);47 console.log('Program output:', output);48});49var sh = require('child_process').sh;50sh('ls -l');51sh('ls -l', function (code, output) {52 console.log('Exit code:',

Full Screen

Using AI Code Generation

copy

Full Screen

1var sh = require("sh").sh;2sh("ls -la");3var sh = require("sh").sh;4sh("ls -la", function(err, stdout, stderr) {5 if(err) {6 console.log("Error: " + err);7 } else {8 console.log("Stdout: " + stdout);9 console.log("Stderr: " + stderr);10 }11});12var sh = require("sh").sh;13sh("ls -la", {cwd: '/home'}, function(err, stdout, stderr) {14 if(err) {15 console.log("Error: " + err);16 } else {17 console.log("Stdout: " + stdout);18 console.log("Stderr: " + stderr);19 }20});21var sh = require("sh").sh;22sh("ls -la", {cwd: '/home'}, function(err, stdout, stderr) {23 if(err) {24 console.log("Error: " + err);25 } else {26 console.log("Stdout: " + stdout);27 console.log("Stderr: " + stderr);28 }29});30var sh = require("sh").sh;31sh("ls -la", {cwd: '/home'}, function(err, stdout, stderr) {32 if(err) {33 console.log("Error: " + err);34 } else {35 console.log("Stdout: " + stdout);36 console.log("Stderr: " + stderr);37 }38});39var sh = require("sh").sh;40sh("ls -la", {cwd: '/home'}, function(err, stdout, stderr) {41 if(err) {42 console.log("Error: " + err);43 } else {44 console.log("Stdout: " + stdout);45 console.log("Stderr: " + stderr);46 }47});48var sh = require("sh").sh;49sh("ls -la", {cwd: '/home'}, function(err, stdout, stderr) {50 if(err) {51 console.log("Error: " + err);52 } else {53 console.log("Stdout

Full Screen

Using AI Code Generation

copy

Full Screen

1var root = require('root');2root.sh('ls -l');3var root = require('root');4root.sh('ls -l', function(err, stdout, stderr){5 console.log(stdout);6});7var root = require('root');8root.sh('ls -l', {encoding: 'utf8'}, function(err, stdout, stderr){9 console.log(stdout);10});11var root = require('root');12root.sh('ls -l', {encoding: 'base64'}, function(err, stdout, stderr){13 console.log(stdout);14});15var root = require('root');16root.sh('ls -l', {encoding: 'hex'}, function(err, stdout, stderr){17 console.log(stdout);18});19var root = require('root');20root.sh('ls -l', {encoding: 'binary'}, function(err, stdout, stderr){21 console.log(stdout);22});23var root = require('root');24root.sh('ls -l', {encoding: 'buffer'}, function(err, stdout, stderr){25 console.log(stdout);26});27var root = require('root');28root.sh('ls -l', {encoding: 'utf8'}, function(err, stdout, stderr){29 console.log(stdout);30});31var root = require('root');32root.sh('ls -l', {encoding: 'base64'}, function(err, stdout, stderr){33 console.log(stdout);34});35var root = require('root');36root.sh('ls -l', {encoding: 'hex'}, function(err, stdout, stderr){37 console.log(stdout);38});39var root = require('root');40root.sh('ls -l', {encoding: 'binary'}, function(err, stdout, stderr){41 console.log(stdout);42});43var root = require('root');44root.sh('ls -l', {encoding: 'buffer'}, function(err, stdout, stderr){45 console.log(stdout);46});47var root = require('root');48root.sh('ls -l', {

Full Screen

Using AI Code Generation

copy

Full Screen

1$scope.sh = function (path) {2 $location.path(path);3};4$scope.go = function (path) {5 $location.path(path);6};7$scope.go = function (path) {8 $location.path(path);9};10$scope.go = function (pa

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run root automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful